query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
3271f5350122e1773ce0fbf91576741d
POST /investments POST /investments.json
[ { "docid": "b0e50e5e4a009108b8d696fe75308ba5", "score": "0.68701905", "text": "def create\n @user = current_user\n @business = Business.find params[:investment][:business_id]\n @investment = @user.investments.build params[:investment]\n\n respond_to do |format|\n if @investment.save\n format.html { redirect_to user_investment_url(@user, @investment), notice: 'Investment was successfully created.' }\n format.json { render json: @investment, status: :created, location: @investment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @investment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "1e9a6235098dfdbbdb859e4e77cef976", "score": "0.76335293", "text": "def create(options)\n API::request(:post, 'investments', options)\n end", "title": "" }, { "docid": "d00c39afcfaeacc9287bdd4a0b7c811c", "score": "0.73285675", "text": "def create\n @investment = Investment.new(params[:investment])\n\n respond_to do |format|\n if @investment.save\n format.html { redirect_to @investment, notice: 'Investment was successfully created.' }\n format.json { render json: @investment, status: :created, location: @investment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @investment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c01ff158a4d9605cd83cc9fdb7063015", "score": "0.72763586", "text": "def create\n @investment = Investment.new(investment_params)\n\n respond_to do |format|\n if @investment.save\n format.html { redirect_to @investment, notice: 'Investment was successfully created.' }\n format.json { render :show, status: :created, location: @investment }\n else\n format.html { render :new }\n format.json { render json: @investment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6ce9b17d6c38eb22773c657f101bffdd", "score": "0.72313535", "text": "def create\n @invest = Invest.new(invest_params)\n\n respond_to do |format|\n if @invest.save\n format.html { redirect_to @invest, notice: 'Invest was successfully created.' }\n format.json { render action: 'show', status: :created, location: @invest }\n else\n format.html { render action: 'new' }\n format.json { render json: @invest.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6ce9b17d6c38eb22773c657f101bffdd", "score": "0.72313535", "text": "def create\n @invest = Invest.new(invest_params)\n\n respond_to do |format|\n if @invest.save\n format.html { redirect_to @invest, notice: 'Invest was successfully created.' }\n format.json { render action: 'show', status: :created, location: @invest }\n else\n format.html { render action: 'new' }\n format.json { render json: @invest.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7b7c7169adb9e319bfb97c11cd321662", "score": "0.69165874", "text": "def investment_params\n params.require(:investment).permit(\n :name, :invested_amount, :status, :open_date, :end_date,\n :user_id, :timeframe, :payout_frequency_id, :payment_method_id\n )\n end", "title": "" }, { "docid": "8c54b082f2f5a364e89ebac9f81c5f2e", "score": "0.69018275", "text": "def create\n @investment_plans = InvestmentPlan::all()\n @investment = Investment.new(investment_params)\n session[:invest_attributes] = nil\n #current_step = params[:current_step]\n #@investment = Investment.new(investment_params.merge(user_id: current_user.id))\n\n\n respond_to do |format|\n if @investment.save\n format.html\n format.js\n #format.html { redirect_to investments_path, notice: 'Investment was successfully created.' }\n #render json: @invetsment\n else\n render json: \"error\"\n end\n end\n end", "title": "" }, { "docid": "dd121fc5ff4690b626ccff9f79afa6fa", "score": "0.68925816", "text": "def create\n if current_user.balance_available?(params[:investment][:amount])\n @investment = CreateInvestmentService.new(investment_params, current_user, @idea).create\n authorize @investment\n respond_to do |format|\n if @investment.save\n format.json { render :show, status: :created }\n else\n format.json { render json: @investment.errors, status: :unprocessable_entity }\n end\n end\n else\n respond_to do |format|\n format.json { render json: { error: \"Insufficient Balance #{current_user.fund['balance']}\" }, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d76d46e31d412f8d7acb7d632474870b", "score": "0.68344164", "text": "def create\n @investor = Investor.new(params[:investor])\n\n respond_to do |format|\n if @investor.save\n format.html { redirect_to @investor, notice: 'Investor was successfully created.' }\n format.json { render json: @investor, status: :created, location: @investor }\n else\n format.html { render action: \"new\" }\n format.json { render json: @investor.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "50d483f06e59cd1e24b65356305b4a36", "score": "0.68335813", "text": "def investment_params\n params.require(:investment).permit(:investor_id, :investment_date, :investment_amount,\n :interest_rate, :created_by, :last_month_interest,\n :current_month_interest, :total_payable_amount,\n :last_return_date, :is_monthly, :returning_date )\n end", "title": "" }, { "docid": "24a0f9146eea7cb6cb11d9601b96159a", "score": "0.681353", "text": "def create\n @me_investment = Me::Investment.new(me_investment_params)\n\n respond_to do |format|\n if @me_investment.save\n format.html { redirect_to @me_investment, notice: 'Investment was successfully created.' }\n format.json { render :show, status: :created, location: @me_investment }\n else\n format.html { render :new }\n format.json { render json: @me_investment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a6f597865a9596233244c9ae51adfb61", "score": "0.676478", "text": "def investment_params\n params.require(:investment).permit(\n :status\n )\n end", "title": "" }, { "docid": "8ad64eabbef269477e7e51dd635169fe", "score": "0.6748168", "text": "def investment_params\n params.require(:investment).permit(:name, :investment_date, :money, :currency, :company_id, :finance_stage_id)\n end", "title": "" }, { "docid": "d19781879294f0ad7210643eba346fe8", "score": "0.67411095", "text": "def investment_params\n params.require(:investment).permit(:investment, :shares, :name)\n end", "title": "" }, { "docid": "d54f1655d19700c8305702511aa2e3e0", "score": "0.67104465", "text": "def create\n @investor = Investor.new(investor_params)\n\n respond_to do |format|\n if @investor.save\n format.html { redirect_to @investor, notice: 'Investor was successfully created.' }\n format.json { render :show, status: :created, location: @investor }\n else\n format.html { render :new }\n format.json { render json: @investor.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d54f1655d19700c8305702511aa2e3e0", "score": "0.67104465", "text": "def create\n @investor = Investor.new(investor_params)\n\n respond_to do |format|\n if @investor.save\n format.html { redirect_to @investor, notice: 'Investor was successfully created.' }\n format.json { render :show, status: :created, location: @investor }\n else\n format.html { render :new }\n format.json { render json: @investor.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6588567d02cec96ffc365da5a5c869b3", "score": "0.6706966", "text": "def create\n @investor = Investor.new(investor_params)\n\n respond_to do |format|\n if @investor.save\n format.html { redirect_to @investor, notice: \"Investor was successfully created.\" }\n format.json { render :show, status: :created, location: @investor }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @investor.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a55ac276f25bf85676386db472cb4187", "score": "0.67050344", "text": "def create\n if signed_in?\n @investment = current_user.investments.new(investment_params)\n\n if @investment.save\n @investments = Investment.where(user_id: current_user.id)\n @symbols = Investment.where(user: current_user.id).distinct.pluck(:symbol)\n respond_to do |format|\n format.html { redirect_to users_index_path, notice: 'Investment was successfully created.' }\n format.js\n end\n else\n users_index_path\n end\n else\n redirect_to root_path\n end\n end", "title": "" }, { "docid": "b5cc9460ecc51f8045fa4777b01b6270", "score": "0.6693846", "text": "def create(options)\n API::request(:post, 'investors', options)\n end", "title": "" }, { "docid": "9a456449058eadfe56449c05a8c336a9", "score": "0.66908103", "text": "def create\n @investment = Investment.new(params[:investment])\n\n respond_to do |format|\n if @investment.save\n flash[:notice] = 'Investment was successfully created.'\n format.html { redirect_to(@investment) }\n format.xml { render :xml => @investment, :status => :created, :location => @investment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @investment.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0a87ae02bf6881a9f415c772f84bf6f0", "score": "0.66812485", "text": "def create\n @investment = Investment.new(investment_params)\n @investment.group_id = Group.all.where('name = ?', params['investment']['group_id']).select(:id).first.id\n\n @investment.user_id = current_user.id\n\n respond_to do |format|\n if @investment.save\n format.html { redirect_to @investment, notice: 'Investment was successfully created.' }\n format.json { render :show, status: :created, location: @investment }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @investment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "db05247b2cd9cbcf621c38e0e7e8eba3", "score": "0.6678847", "text": "def create\n @add_investment = current_user.add_investments.build(add_investment_params)\n @add_investment.user_scenario = @user_scenario\n\n respond_to do |format|\n if @add_investment.save\n format.html { redirect_to @user_scenario, notice: 'Add investment was successfully created.' }\n format.json { render :show, status: :created, location: @add_investment }\n format.js {render js: 'window.top.location.reload(true);'}\n else\n format.html { render :new }\n format.json { render json: @add_investment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c097e6c6f150e33377ca7286c8383d2b", "score": "0.6572414", "text": "def create\n @investigation = Investigation.new(investigation_params)\n\n respond_to do |format|\n if @investigation.save\n format.html { redirect_to @investigation, notice: 'Investigation was successfully created.' }\n format.json { render :show, status: :created, location: @investigation }\n else\n format.html { render :new }\n format.json { render json: @investigation.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e07f1365f46f8528702a23e8f9edca9e", "score": "0.65454316", "text": "def new\n @investment = Investment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @investment }\n end\n end", "title": "" }, { "docid": "08e1b0ef5e61d8d965c39754e4f73fcd", "score": "0.6511749", "text": "def create\n @individual_portfolio_investment = IndividualPortfolioInvestment.new(individual_portfolio_investment_params)\n\n respond_to do |format|\n if @individual_portfolio_investment.save\n format.html { redirect_to @individual_portfolio_investment, notice: 'Individual portfolio investment was successfully created.' }\n format.json { render action: 'show', status: :created, location: @individual_portfolio_investment }\n else\n format.html { render action: 'new' }\n format.json { render json: @individual_portfolio_investment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c623464eb152dd6a835c48e28b30e8ac", "score": "0.65030867", "text": "def create\n @investigate = Investigate.new(investigate_params)\n\n respond_to do |format|\n if @investigate.save\n format.html { redirect_to @investigate, notice: 'Investigate was successfully created.' }\n format.json { render :show, status: :created, location: @investigate }\n else\n format.html { render :new }\n format.json { render json: @investigate.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f235369049f7e2e33cd625014a1a7859", "score": "0.6483531", "text": "def index\n @investments = Investment.all\n end", "title": "" }, { "docid": "94cf4613ac9f35d93dd4aefbfd780157", "score": "0.6464225", "text": "def investment_params\n params.require(:investment).permit(:id, :amount, :message)\n end", "title": "" }, { "docid": "55587a64f7a82b2320e1ec51b2af798b", "score": "0.6453985", "text": "def create\n # PUNDIT_REVIEW_AUTHORIZE\n # PUNDIT_CHECK_AUTHORIZE\n # authorize Investigation\n begin\n gse = RiGse::GradeSpanExpectation.find(params[:grade_span_expectation])\n params[:investigation][:grade_span_expectation] = gse\n rescue\n logger.error('could not find gse')\n end\n @investigation = Investigation.new(params[:investigation])\n @investigation.user = current_visitor\n\n if params[:update_material_properties]\n # set the material_properties tags\n @investigation.material_property_list = (params[:material_properties] || [])\n end\n\n if params[:update_cohorts]\n # set the cohorts\n @investigation.set_cohorts_by_id(params[:cohort_ids] || [])\n end\n\n if params[:update_grade_levels]\n # set the grade_level tags\n @investigation.grade_level_list = (params[:grade_levels] || [])\n end\n\n if params[:update_subject_areas]\n # set the subject_area tags\n @investigation.subject_area_list = (params[:subject_areas] || [])\n end\n\n respond_to do |format|\n if @investigation.save\n flash[:notice] = \"#{Investigation.display_name} was successfully created.\"\n format.html { redirect_to(@investigation) }\n format.xml { render :xml => @investigation, :status => :created, :location => @investigation }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @investigation.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3ecb1da3ead7bf6218fd4c36425edfce", "score": "0.64326537", "text": "def create\n @investor_detail = InvestorDetail.new(investor_detail_params)\n if @investor_detail.save\n data = @investor_detail.as_json(include: %i[user_investor product_invest product])\n render json: { status: 'OK', results: data, errors: nil },\n status: :created\n else\n render json: { status: 'FAIL', results: nil,\n errors: 'Failed to create' },\n status: :unprocesable_entity\n end\n end", "title": "" }, { "docid": "759f4763ed35bee882f831cf30ef707a", "score": "0.64224386", "text": "def me_investment_params\n params.require(:me_investment).permit(:name, :description, :obsevation)\n end", "title": "" }, { "docid": "7dea7be4ee76762d23062b17a161c897", "score": "0.6416388", "text": "def create\n @invest = Invest.new(invest_params)\n @current_user = current_user if current_user\n @invest.user = @current_user if @current_user\n respond_to do |format|\n if @invest.save\n format.html { redirect_to @invest, notice: 'Invest was successfully created.' }\n format.json { render :show, status: :created, location: @invest }\n else\n format.html { render :new }\n format.json { render json: @invest.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d5d8d12205bcd98107a73a51a05e1c7a", "score": "0.64022994", "text": "def invest_params\n params.require(:invest).permit(:user_id, :bank, :name, :amount)\n end", "title": "" }, { "docid": "e5fb3fff71ec93f43df8c4ed1e6b45a8", "score": "0.63733745", "text": "def create\n authorize Investor\n @investor = Investor.new(investor_params)\n respond_to do |format|\n if @investor.save\n format.html { redirect_to investor_main_path(@investor.id), notice: 'Investor was successfully created.' }\n format.json { render :show, status: :created, location: @investor }\n else\n format.html { render :new }\n format.json { render json: @investor.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "333874deaad57e2bad9c4b7572d23a1f", "score": "0.6370439", "text": "def investment_params\n params.require(:investment).permit(:term, :interest_rate, :minimum_order, :denomination, :maturity_date, :issue_date, :offer_start_period, :offer_end_period)\n end", "title": "" }, { "docid": "ce7c6477f41dd91d85d445607ce8279c", "score": "0.636886", "text": "def create\n @investment_purchase = InvestmentPurchase.new(investment_purchase_params)\n\n respond_to do |format|\n if @investment_purchase.save\n format.html { redirect_to @investment_purchase, notice: 'Investment purchase was successfully created.' }\n format.json { render :show, status: :created, location: @investment_purchase }\n else\n format.html { render :new }\n format.json { render json: @investment_purchase.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7539cabe0464c10a687724ef03fdd076", "score": "0.6330193", "text": "def new\n @business = Business.find params[:business_id]\n @user = current_user\n @investment = @user.investments.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @investment }\n end\n end", "title": "" }, { "docid": "f364ccda1074c2d5fac8d8eb5f031975", "score": "0.63101244", "text": "def investment_params\n params.require(:investment).permit(:symbol, :quantity, :cost, :selldate, :status, :purchasedate)\n end", "title": "" }, { "docid": "546a49807fd33e0d5fa7fe440e56f70c", "score": "0.63030976", "text": "def create\n @user_investment = UserInvestment.create(investment_id: params[\"investment_id\"], user_id: params[\"user_id\"])\n return redirect_to \"/welcome/home\"\n\n\n end", "title": "" }, { "docid": "914f4094d5a66dc08317f703a36411b3", "score": "0.62889504", "text": "def create_investment(investor, funding_round_id)\n ::Investment.create!(investor: investor, funding_round_id: funding_round_id)\n end", "title": "" }, { "docid": "2f63825d0c2d1c12849259c0dfad96de", "score": "0.62855345", "text": "def create\n @investisseur = Investisseur.new(investisseur_params)\n\n respond_to do |format|\n if @investisseur.save\n format.html { redirect_to @investisseur, notice: 'Investisseur was successfully created.' }\n format.json { render :show, status: :created, location: @investisseur }\n else\n format.html { render :new }\n format.json { render json: @investisseur.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4fcdb36d53fd757a6d5301f757fcebc9", "score": "0.62765014", "text": "def create\n @objeto = Investigador.new(investigador_params)\n\n respond_to do |format|\n if @objeto.save\n format.html { redirect_to @objeto, notice: 'Investigador was successfully created.' }\n format.json { render :show, status: :created, location: @objeto }\n else\n format.html { render :new }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1ee49eb5ac30b03dea4541fcc81dbb7e", "score": "0.6272247", "text": "def add_investment_params\n params.require(:add_investment).permit(:user_id, :user_scenario_id, :newinvest_sun, :newinvest_amt_sun, :newinvest_mon, :newinvest_amt_mon, :newinvest_tue, :newinvest_amt_tue, :newinvest_wed, :newinvest_amt_wed, :newinvest_thu, :newinvest_amt_thu, :newinvest_fri, :newinvest_amt_fri, :newinvest_sat, :newinvest_amt_sat, :newinvest_month_day_1, :newinvest_month_day_1_amt, :newinvest_month_day_2, :newinvest_month_day_2_amt, :newinvest_month_day_3, :newinvest_month_day_3_amt, :newinvest_month_day_4, :newinvest_month_day_4_amt, :newinvest_month_day_5, :newinvest_month_day_5_amt, :newinvest_month_day_6, :newinvest_month_day_6_amt, :newinvest_month_day_7, :newinvest_month_day_7_amt, :newinvest_month_day_8, :newinvest_month_day_8_amt, :newinvest_month_day_9, :newinvest_month_day_9_amt, :newinvest_month_day_10, :newinvest_month_day_10_amt, :newinvest_month_day_11, :newinvest_month_day_11_amt, :newinvest_month_day_12, :newinvest_month_day_12_amt, :newinvest_month_day_13, :newinvest_month_day_13_amt, :newinvest_month_day_14, :newinvest_month_day_14_amt, :newinvest_month_day_15, :newinvest_month_day_15_amt, :newinvest_month_day_16, :newinvest_month_day_16_amt, :newinvest_month_day_17, :newinvest_month_day_17_amt, :newinvest_month_day_18, :newinvest_month_day_18_amt, :newinvest_month_day_19, :newinvest_month_day_19_amt, :newinvest_month_day_20, :newinvest_month_day_20_amt, :newinvest_month_day_21, :newinvest_month_day_21_amt, :newinvest_month_day_22, :newinvest_month_day_22_amt, :newinvest_month_day_23, :newinvest_month_day_23_amt, :newinvest_month_day_24, :newinvest_month_day_24_amt, :newinvest_month_day_25, :newinvest_month_day_25_amt, :newinvest_month_day_26, :newinvest_month_day_26_amt, :newinvest_month_day_27, :newinvest_month_day_27_amt, :newinvest_month_day_28, :newinvest_month_day_28_amt, :newinvest_month_day_29, :newinvest_month_day_29_amt, :newinvest_month_day_30, :newinvest_month_day_30_amt)\n end", "title": "" }, { "docid": "1e25cb74ce0253746ee849fc12d308bf", "score": "0.6270844", "text": "def create\n @investigator = Investigator.new(investigator_params)\n\n respond_to do |format|\n if @investigator.save\n format.html { redirect_to @investigator, notice: 'Investigator was successfully created.' }\n format.json { render :show, status: :created, location: @investigator }\n else\n format.html { render :new }\n format.json { render json: @investigator.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9a4fc25257d5bca1739e1ad8c83b1104", "score": "0.62692595", "text": "def create\n @investor = Investor.new(params[:investor])\n if @investor.save\n UpdateMailer.update_email(@investor, current_user, action_name).deliver\n flash[:notice] = 'Investor was successfully created.'\n end\n respond_with(@investor, location: investors_url)\n end", "title": "" }, { "docid": "8237006c9e0745493171236e04e260b8", "score": "0.6252306", "text": "def investment_params\n params.require(:investment).permit(:sq_feet, :cost, :sale_val)\n end", "title": "" }, { "docid": "b6f9fe0e6c6e97fe8b1b36d55c72e889", "score": "0.62522167", "text": "def investment_params_update\n params.require(:investment).permit(\n :investment_plan_id, :name, :status, :end_date,\n :user_id, :timeframe, :payout_frequency_id, :payment_method_id\n )\n end", "title": "" }, { "docid": "6171a13ad34fb99ea168be92177f96db", "score": "0.6245787", "text": "def set_add_investment\n @add_investment = AddInvestment.find(params[:id])\n end", "title": "" }, { "docid": "f580631b8d8ca7791091af3eef593ad9", "score": "0.62456685", "text": "def create\n @businessinvestment = Businessinvestment.new(businessinvestment_params)\n\n respond_to do |format|\n if @businessinvestment.save\n format.html { redirect_to @businessinvestment, notice: 'Businessinvestment was successfully created.' }\n format.json { render :show, status: :created, location: @businessinvestment }\n else\n format.html { render :new }\n format.json { render json: @businessinvestment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b70feddae4624ef9020be7875fd669e6", "score": "0.6222957", "text": "def create\n @stocks = Stock.all\n if member_signed_in? \n @investment = Investment.new(investment_params)\n \n if @investment.save\n @stock_id = @investment.stock_id\n redirect_to increment_stock_path(@stock_id, @investment.id)\n else\n respond_to do |format|\n format.html { render action: 'new' }\n format.json { render json: @investment.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to new_member_session_path\n end\n end", "title": "" }, { "docid": "7fa99e9c462945fca155492a5994128b", "score": "0.6212464", "text": "def create\n @seja_investidore = SejaInvestidore.new(params[:seja_investidore])\n\n respond_to do |format|\n if @seja_investidore.save\n format.html { redirect_to @seja_investidore, notice: 'Seja investidore was successfully created.' }\n format.json { render json: @seja_investidore, status: :created, location: @seja_investidore }\n else\n format.html { render action: \"new\" }\n format.json { render json: @seja_investidore.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "58a36031613175f211d6939f67ac1753", "score": "0.6199588", "text": "def index\n @add_investments = AddInvestment.all\n end", "title": "" }, { "docid": "cd97d3ab219472a45499decbcc75e3f6", "score": "0.61808604", "text": "def create\n expense = Expense.new(expense_params)\n if expense.save\n render json: {\n status: 201,\n expense: expense\n }\n else\n render json: {\n status: 422,\n errors: expense.errors.full_messages.join(\", \")\n }, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "c1690f1746e3c687181271849501e148", "score": "0.6159643", "text": "def create\n @investment_in_iran = InvestmentInIran.new(investment_in_iran_params)\n\n respond_to do |format|\n if @investment_in_iran.save\n format.html { redirect_to @investment_in_iran, notice: 'Investment in iran was successfully created.' }\n format.json { render :show, status: :created, location: @investment_in_iran }\n else\n format.html { render :new }\n format.json { render json: @investment_in_iran.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bdefbedf4e2c40a3488b5db0c7bf12e1", "score": "0.61503977", "text": "def create\n @investment_contract_det = InvestmentContractDet.new(investment_contract_det_params)\n\n respond_to do |format|\n if @investment_contract_det.save\n format.html { redirect_to @investment_contract_det, notice: 'Investment contract det was successfully created.' }\n format.json { render :show, status: :created, location: @investment_contract_det }\n else\n format.html { render :new }\n format.json { render json: @investment_contract_det.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "50bef51c69bd7e9afeecd6055362dcd1", "score": "0.61503834", "text": "def create\n @investment_contract = InvestmentContract.new(investment_contract_params)\n\n respond_to do |format|\n if @investment_contract.save\n format.html { redirect_to @investment_contract, notice: 'Investment contract was successfully created.' }\n format.json { render :show, status: :created, location: @investment_contract }\n else\n format.html { render :new }\n format.json { render json: @investment_contract.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7e81ecb9a73b7276841982e3fc590bb9", "score": "0.61445606", "text": "def create\n @stocks = Stock.all\n if member_signed_in? \n @investment = Investment.new(investment_params)\n \n if @investment.save\n @stock_id = @investment.stock_id\n @stock = Stock.where(id: @stock_id).first\n negate = BigDecimal(\"-1\")\n price = StockQuote::Stock.quote(@stock.ticker).last_trade_price_only\n value = BigDecimal(@investment.share_change.to_s) * negate * price\n Rails.logger.debug(\"investments deebug: \" + value.to_s)\n redirect_to order_path(value.truncate.to_s, value.abs().frac().to_s[2..-1])\n else\n respond_to do |format|\n format.html { render action: 'new' }\n format.json { render json: @investment.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to new_member_session_path\n end\n end", "title": "" }, { "docid": "d3792e74a347f2cf7582bd5de4a10a0b", "score": "0.60982686", "text": "def create\n @investigationaction = Investigationaction.new(investigationaction_params)\n\n respond_to do |format|\n if @investigationaction.save\n format.html { redirect_to @investigationaction.investigation, notice: 'Investigationaction was successfully created.' }\n format.json { render :show, status: :created, location: @investigationaction }\n else\n format.html { render :new }\n format.json { render json: @investigationaction.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "30b2fc4053f747152bfeda76b95db9df", "score": "0.6094885", "text": "def set_investment\n @investment = Investment.find(params[:id])\n end", "title": "" }, { "docid": "30b2fc4053f747152bfeda76b95db9df", "score": "0.6094885", "text": "def set_investment\n @investment = Investment.find(params[:id])\n end", "title": "" }, { "docid": "30b2fc4053f747152bfeda76b95db9df", "score": "0.6094885", "text": "def set_investment\n @investment = Investment.find(params[:id])\n end", "title": "" }, { "docid": "de5da2060bba08bb9bfa1e6557dad327", "score": "0.6078266", "text": "def create\n @investigation_type = InvestigationType.new(params[:investigation_type])\n\n respond_to do |format|\n if @investigation_type.save\n format.html { redirect_to @investigation_type, notice: 'Investigation type was successfully created.' }\n format.json { render json: @investigation_type, status: :created, location: @investigation_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @investigation_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "823ba905dc14a5a015e6f7a6977f1749", "score": "0.6076803", "text": "def post_expense(expense)\n post '/expenses', JSON.generate(expense)\n #check the post attempt was a success\n expect(last_response.status).to eq(200)\n\n #check the data is in JSON structure\n parsed = JSON.parse(last_response.body)\n\n #check the data includes an expense_id\n #passing a matcher into another = composing matchers\n expect(parsed).to include('expense_id' => a_kind_of(Integer))\n\n #add an id key to the hash\n expense.merge('id' => parsed['expense_id'])\n end", "title": "" }, { "docid": "58f2d40d27cff29042a70ea9de608dba", "score": "0.60719913", "text": "def investment_params\n params.require(:investment).permit(:crypto, :amount, :user_id)\n end", "title": "" }, { "docid": "c393c63fb9dac704a71b22be9ba962ad", "score": "0.6070377", "text": "def create\n @profesor_investigacion = ProfesorInvestigacion.new(profesor_investigacion_params)\n\n respond_to do |format|\n if @profesor_investigacion.save\n format.html { redirect_to @profesor_investigacion, notice: 'Profesor investigacion was successfully created.' }\n format.json { render :show, status: :created, location: @profesor_investigacion }\n else\n format.html { render :new }\n format.json { render json: @profesor_investigacion.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "892ded7dc062a9600647e02066adb280", "score": "0.60677785", "text": "def set_investment\n @investment = Investment.find(params[:id])\n end", "title": "" }, { "docid": "892ded7dc062a9600647e02066adb280", "score": "0.60677785", "text": "def set_investment\n @investment = Investment.find(params[:id])\n end", "title": "" }, { "docid": "892ded7dc062a9600647e02066adb280", "score": "0.60677785", "text": "def set_investment\n @investment = Investment.find(params[:id])\n end", "title": "" }, { "docid": "892ded7dc062a9600647e02066adb280", "score": "0.60677785", "text": "def set_investment\n @investment = Investment.find(params[:id])\n end", "title": "" }, { "docid": "892ded7dc062a9600647e02066adb280", "score": "0.60677785", "text": "def set_investment\n @investment = Investment.find(params[:id])\n end", "title": "" }, { "docid": "892ded7dc062a9600647e02066adb280", "score": "0.60677785", "text": "def set_investment\n @investment = Investment.find(params[:id])\n end", "title": "" }, { "docid": "86ed1f9675d804d9ff9d575a140debd5", "score": "0.60566396", "text": "def set_invest\n @invest = Invest.find(params[:id])\n end", "title": "" }, { "docid": "86ed1f9675d804d9ff9d575a140debd5", "score": "0.60566396", "text": "def set_invest\n @invest = Invest.find(params[:id])\n end", "title": "" }, { "docid": "a70cead5acb54c9db4ff906833f1483c", "score": "0.605357", "text": "def set_invest\n @invest = Invest.find(params[:id])\n end", "title": "" }, { "docid": "e48a112dce56b3b297ec899ec947f184", "score": "0.6045471", "text": "def post_expense(expense)\n post '/expenses', JSON.generate(expense)\n expect(last_response.status).to eq(200)\n\n parsed = JSON.parse(last_response.body)\n expect(parsed).to include('expense_id' => a_kind_of(Integer))\n expense.merge('id' => parsed['expense_id'])\n end", "title": "" }, { "docid": "dc492d9cb8b57a4ed5c8fa50c222db08", "score": "0.6035384", "text": "def new\n @investor = Company.find(params[:company_id]).investors.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @investor }\n end\n end", "title": "" }, { "docid": "0d1bb5c3cbbc6430f9ba226cd0c8b5f4", "score": "0.6029445", "text": "def investment_params\n params.require(:investment).permit(\n :campaign_id,\n :user_name, \n :investment_amount, \n :currency\n )\n end", "title": "" }, { "docid": "9db97e3a4eeceba2a927d11889fce21f", "score": "0.6014652", "text": "def investment_params\n params.fetch(:investment,{}).permit(:member_id, :stock_id, :share_change)\n end", "title": "" }, { "docid": "9db97e3a4eeceba2a927d11889fce21f", "score": "0.6014652", "text": "def investment_params\n params.fetch(:investment,{}).permit(:member_id, :stock_id, :share_change)\n end", "title": "" }, { "docid": "bb700eb01aba6065c479a8e5b3736e9e", "score": "0.6010382", "text": "def index\n @invests = Invest.all\n end", "title": "" }, { "docid": "bb700eb01aba6065c479a8e5b3736e9e", "score": "0.6010382", "text": "def index\n @invests = Invest.all\n end", "title": "" }, { "docid": "f9141c586e50ed73031a2a6aa9369584", "score": "0.6008333", "text": "def investment_payments(investment_id)\n API::request(:get, \"investments/#{investment_id}/investment_payments\")\n end", "title": "" }, { "docid": "fa699115d5b786e33e5a036da5cfe9a2", "score": "0.6000605", "text": "def investment_params\n params.fetch(:investment, {})\n end", "title": "" }, { "docid": "9b65a8ea2e8fc981d183ab246128ff1b", "score": "0.59899795", "text": "def new\n @investor = Investor.new\n respond_with(@investor)\n end", "title": "" }, { "docid": "654ccb39a4d4e8cf88cba7348487454c", "score": "0.5982711", "text": "def create\n @committee = Committee.find(params[:committee_id])\n @instalment = @committee.instalments.create(instalment_params)\n\n respond_to do |format|\n if @instalment\n format.json { render json: @instalment.to_json, status: :created}\n else\n format.json { render json: @instalment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ee35f1b555ca5419c098a8b300e2a237", "score": "0.59806144", "text": "def investigador_params\n params.require(:investigador).permit(:investigador, :orcid, :email, :departamento_id)\n end", "title": "" }, { "docid": "d871c1bde4fc9385f26193f162d7043a", "score": "0.5968726", "text": "def invest_params\n params.require(:invest).permit(:jkbh, :jybh)\n end", "title": "" }, { "docid": "d871c1bde4fc9385f26193f162d7043a", "score": "0.5968726", "text": "def invest_params\n params.require(:invest).permit(:jkbh, :jybh)\n end", "title": "" }, { "docid": "bf981bf47b1415d6d6a62fb7c66f96ab", "score": "0.5950683", "text": "def create\n @investigation_type = InvestigationType.new(investigation_type_params)\n\n respond_to do |format|\n if @investigation_type.save\n format.html { redirect_to @investigation_type, notice: 'Investigation type was successfully created.' }\n format.json { render action: 'show', status: :created, location: @investigation_type }\n else\n format.html { render action: 'new' }\n format.json { render json: @investigation_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d33e4bfb0c6984946f3e9284117be10b", "score": "0.5947877", "text": "def create\n @m_directors = MDirector.all\n @partners = Partner.all\n #render :text =>params.inspect;return\n @monthly_f_investment = MonthlyFInvestment.new(params[:monthly_f_investment])\n unless params[:m_director_id].nil? or params[:m_director_id].blank?\n @monthly_f_investment.m_director_id = params[:m_director_id][:id]\n end\n\n unless params[:partner_id].nil? or params[:partner_id].blank?\n @monthly_f_investment.partner_id = params[:partner_id][:id] \n end\n\n unless params[:invested_in].nil?\n case params[:invested_in]\n when \"Monthly Finance\"\n @monthly_f_investment.invested_in = \"monthly_finance\"\n when \"Monthly Interest\"\n @monthly_f_investment.invested_in = \"monthly_interest\"\n when \"Daily Finance\"\n @monthly_f_investment.invested_in = \"daily_finance\"\n when \"Daily Interest\"\n @monthly_f_investment.invested_in = \"daily_interest\"\n end\n end\n\n respond_to do |format|\n if @monthly_f_investment.save\n if params[:invested_in] == \"Monthly Finance\"\n add_investment_to_transaction(@monthly_f_investment)\n elsif params[:invested_in] == \"Monthly Interest\"\n add_investment_to_mi_transaction(@monthly_f_investment)\n elsif params[:invested_in] == \"Daily Finance\"\n add_investment_to_df_transaction(@monthly_f_investment)\n elsif params[:invested_in] == \"Daily Interest\"\n add_investment_to_di_transaction(@monthly_f_investment) \n end\n\n format.html { redirect_to :controller => \"monthly_f_investments\" }\n format.json { render json: @monthly_f_investment, status: :created, location: @monthly_f_investment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @monthly_f_investment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "05390d169b13937606ea9b747f0c02e0", "score": "0.5934233", "text": "def investor_params\n params.require(:investor).permit(:name)\n end", "title": "" }, { "docid": "05390d169b13937606ea9b747f0c02e0", "score": "0.5934233", "text": "def investor_params\n params.require(:investor).permit(:name)\n end", "title": "" }, { "docid": "89c4476f1e76aac505fcfa7312248373", "score": "0.5920672", "text": "def create\n @estimated_expense = EstimatedExpense.new(estimated_expense_params)\n\n respond_to do |format|\n if @estimated_expense.save\n format.html { redirect_to @estimated_expense, notice: 'Estimated expense was successfully created.' }\n format.json { render :show, status: :created, location: @estimated_expense }\n else\n format.html { render :new }\n format.json { render json: @estimated_expense.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d5722e144b1e9b53e89c468d14e93fba", "score": "0.5912325", "text": "def destroy\n @add_investment.destroy\n respond_to do |format|\n format.html { redirect_to add_investments_url, notice: 'Add investment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1272f1b6e0197958c47b96675c172c05", "score": "0.58990157", "text": "def create\n @expense = Expense.new(params[:expense])\n @expense.budget_id = session[:budget_id]\n\n respond_to do |format|\n if @expense.save\n format.html { redirect_to \"/budgets\", notice: 'Expense was successfully created.' }\n format.json { render json: @expense.to_json(:include => :expense_values), status: :created }\n else\n format.html { render action: \"new\" }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d0f3b57416e5915f41ba71c688748c27", "score": "0.58875924", "text": "def index\n @investment_head = InvestmentHead.new\n @investment_heads = InvestmentHead.all\n end", "title": "" }, { "docid": "f79f7c65026ccccd7c799ab61f1038a9", "score": "0.58843887", "text": "def create\n @api_v1_establishment = Establishment.new(api_v1_establishment_params)\n\n respond_to do |format|\n if @api_v1_establishment.save\n format.html { redirect_to @api_v1_establishment, notice: 'Establishment was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_establishment }\n else\n format.html { render :new }\n format.json { render json: @api_v1_establishment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fdf44460ca46263c1de1f8c3174c1149", "score": "0.58828634", "text": "def create\n @envolvement = Envolvement.new(envolvement_params)\n\n respond_to do |format|\n if @envolvement.save\n format.html { redirect_to @envolvement, notice: 'Envolvement was successfully created.' }\n format.json { render action: 'show', status: :created, location: @envolvement }\n else\n format.html { render action: 'new' }\n format.json { render json: @envolvement.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d90cea5c8c201d402742ca5cd1440b88", "score": "0.58822304", "text": "def create\n @rad_investment = Rad::Investment.new(rad_investment_params)\n\n respond_to do |format|\n if @rad_investment.save\n @rad_investment.create_wf_proc_resource(deployment_name: 'rad_test_deploy', variables: {'resource_type' => 'Rad::Investment'})\n format.html { redirect_to edit_rad_investment_path(@rad_investment), notice: '年度投资计划创建成功。' }\n format.json { render :show, status: :created, location: @rad_investment }\n else\n format.html { render :new }\n format.json { render json: @rad_investment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ccd61d53ced0ecff82cdbd2a0132f9d9", "score": "0.587855", "text": "def investor_params\n params.require(:investor).permit(:name, :address, :contact_number, :email, :deleting_status, :created_by)\n end", "title": "" } ]
956d69b1239791d2a7849245ac829f7a
Instance Methods Permission Methods
[ { "docid": "deab52a5ccd8d00d0a7e5c1f2e22265c", "score": "0.0", "text": "def can_be_edited?\n published? or unpublished?\n end", "title": "" } ]
[ { "docid": "75cfc3b2181e3d642de252a19d8b06f7", "score": "0.8150802", "text": "def permission; end", "title": "" }, { "docid": "89cb1849101eaf5614248e8c9b6f3080", "score": "0.7921537", "text": "def permissions; end", "title": "" }, { "docid": "e7fa55c996c89a154f6ff748543f9ee3", "score": "0.76609147", "text": "def define_permissions\n end", "title": "" }, { "docid": "d11da73d7a741de16ef5e4fb4157a01a", "score": "0.7514612", "text": "def access; end", "title": "" }, { "docid": "d11da73d7a741de16ef5e4fb4157a01a", "score": "0.7514612", "text": "def access; end", "title": "" }, { "docid": "dd07f0c7dab69e6944c001023da04ef2", "score": "0.7433419", "text": "def permission=(_arg0); end", "title": "" }, { "docid": "4a5084c8b6f9c590ac2378a174ef14db", "score": "0.74187696", "text": "def access_modifier?; end", "title": "" }, { "docid": "4a5084c8b6f9c590ac2378a174ef14db", "score": "0.74187696", "text": "def access_modifier?; end", "title": "" }, { "docid": "73e508b62772b93fccb848de453d734f", "score": "0.73480546", "text": "def custom_permissions; end", "title": "" }, { "docid": "40fcff520da8f8aa030931b554cf3830", "score": "0.733139", "text": "def permissions\n end", "title": "" }, { "docid": "316f02c39b7807454bd3d6ee57145aaa", "score": "0.71694654", "text": "def my_permission\n super\n end", "title": "" }, { "docid": "090f8aeefc03990ee7a067c230c12a5d", "score": "0.7168812", "text": "def security; end", "title": "" }, { "docid": "bba0d99d8049a28f5bceab16ef497fa0", "score": "0.71549827", "text": "def privacy; end", "title": "" }, { "docid": "9414be29752fb67f99b3187e2c835691", "score": "0.71520066", "text": "def custom_permissions\n end", "title": "" }, { "docid": "9414be29752fb67f99b3187e2c835691", "score": "0.71520066", "text": "def custom_permissions\n end", "title": "" }, { "docid": "fdcd363b0dfc2c2492d4cbb30eded23c", "score": "0.70746714", "text": "def custom_permissions\n\n end", "title": "" }, { "docid": "77f516df9e9ebe1bfec96f5de84dfe63", "score": "0.7041536", "text": "def checkAccess\n end", "title": "" }, { "docid": "c3b1a50237451210ac644f61a91c8ba3", "score": "0.70396805", "text": "def can_access?(authorizable); true end", "title": "" }, { "docid": "5e19fd45f68d2efb5c4ed34bce0a738f", "score": "0.7026854", "text": "def check_permissions\n true\n end", "title": "" }, { "docid": "bc01f0c36a89fc8e49af1f3292df3840", "score": "0.6970369", "text": "def public_access_level; end", "title": "" }, { "docid": "e52bd1611b7013acda5d335e015c3571", "score": "0.69612813", "text": "def access_right\n end", "title": "" }, { "docid": "b58161b643c2fadebb5d6a6197facb52", "score": "0.6953291", "text": "def get_active_permission() end", "title": "" }, { "docid": "b58161b643c2fadebb5d6a6197facb52", "score": "0.6953291", "text": "def get_active_permission() end", "title": "" }, { "docid": "51bce2dcd217eea061185ba28a0dc3f6", "score": "0.6934645", "text": "def privacy\n \n end", "title": "" }, { "docid": "e3287ad0c24d3e2ebf785144094d865f", "score": "0.69328374", "text": "def access\n\n end", "title": "" }, { "docid": "30f4e03b55339f4cb481c31f014abf19", "score": "0.68894064", "text": "def security\n end", "title": "" }, { "docid": "de95bfc86f92ed4f10dba9fb4e119089", "score": "0.6853641", "text": "def method_missing(name, *args, &block)\n return define_permission(name, *args, &block) if self.respond_to?(name)\n super\n end", "title": "" }, { "docid": "665b5657e095d664d39fa6b0073e8ac7", "score": "0.6828911", "text": "def user_permission\n super\n end", "title": "" }, { "docid": "8bdf3b8083422d096de47598fc1f02a3", "score": "0.67820764", "text": "def privacy\n end", "title": "" }, { "docid": "8bdf3b8083422d096de47598fc1f02a3", "score": "0.67820764", "text": "def privacy\n end", "title": "" }, { "docid": "8bdf3b8083422d096de47598fc1f02a3", "score": "0.67820764", "text": "def privacy\n end", "title": "" }, { "docid": "8bdf3b8083422d096de47598fc1f02a3", "score": "0.67820764", "text": "def privacy\n end", "title": "" }, { "docid": "8bdf3b8083422d096de47598fc1f02a3", "score": "0.67820764", "text": "def privacy\n end", "title": "" }, { "docid": "a418f0c4fd45d4581450679074dd402a", "score": "0.67589486", "text": "def allow_permission_with_method; self.class.permissable_options[:allow_permission_with_method]; end", "title": "" }, { "docid": "353bdbd57903d1338ab400c1aeafe76d", "score": "0.6697066", "text": "def privacy\n\n end", "title": "" }, { "docid": "353bdbd57903d1338ab400c1aeafe76d", "score": "0.6697066", "text": "def privacy\n\n end", "title": "" }, { "docid": "353bdbd57903d1338ab400c1aeafe76d", "score": "0.6697066", "text": "def privacy\n\n end", "title": "" }, { "docid": "dd6f7732e55269e16c663cb9d4171477", "score": "0.6648341", "text": "def permitted?; end", "title": "" }, { "docid": "66b17658a7a5d28f6d3337fbdfb1292c", "score": "0.6627721", "text": "def custom_permissions\n alias_action :pdf, :show, :manifest, to: :read\n admin_permissions if current_user.admin?\n curation_concern_creator_permissions if current_user.curation_concern_creator?\n campus_patron_permissions if current_user.campus_patron?\n end", "title": "" }, { "docid": "796d10daf105cb06c15c156464e97904", "score": "0.6626642", "text": "def access_restrictions; end", "title": "" }, { "docid": "162b63d96fba382f4ac1d354527bb10c", "score": "0.66168016", "text": "def protection; end", "title": "" }, { "docid": "162b63d96fba382f4ac1d354527bb10c", "score": "0.66168016", "text": "def protection; end", "title": "" }, { "docid": "cbbbaf55c0d577d42d53e39ce9fa49e0", "score": "0.66163605", "text": "def authorization; end", "title": "" }, { "docid": "2fe137a5c53bcf962e5589393e7f2742", "score": "0.6602604", "text": "def custom_permissions\n return unless admin?\n can [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy], Role\n can [:destroy], ActiveFedora::Base\n can [:read], Schools::School\n end", "title": "" }, { "docid": "1090bbfa1a3e93126f2c4d72a60d5da5", "score": "0.65879166", "text": "def show\n check_permissions :read\n end", "title": "" }, { "docid": "85a21121b605f4374d93ab16d3e0ec97", "score": "0.6576245", "text": "def privacy\n\tend", "title": "" }, { "docid": "85a21121b605f4374d93ab16d3e0ec97", "score": "0.6576245", "text": "def privacy\n\tend", "title": "" }, { "docid": "14f5b097cb934cef51e0b9c29168565c", "score": "0.6565109", "text": "def bare_access_modifier?; end", "title": "" }, { "docid": "14f5b097cb934cef51e0b9c29168565c", "score": "0.6565109", "text": "def bare_access_modifier?; end", "title": "" }, { "docid": "2db1f7edfe35c475954b2f38a3ddbaed", "score": "0.65412855", "text": "def enforce_show_permissions\n #DO NOTHING\n end", "title": "" }, { "docid": "bf55bc7eaf18d56cb23fc1d7b4ba7bed", "score": "0.65395933", "text": "def public; end", "title": "" }, { "docid": "00692fa4a6b91c5186760303a12cc0d8", "score": "0.65230006", "text": "def permission?()\n return nil \n end", "title": "" }, { "docid": "eb59d12854b0412adde183602fc83c20", "score": "0.65196365", "text": "def public?; end", "title": "" }, { "docid": "eb59d12854b0412adde183602fc83c20", "score": "0.65196365", "text": "def public?; end", "title": "" }, { "docid": "eb59d12854b0412adde183602fc83c20", "score": "0.65196365", "text": "def public?; end", "title": "" }, { "docid": "25230370f34a30e3edbbab0adeefd729", "score": "0.6502964", "text": "def accessible\n true \n end", "title": "" }, { "docid": "8ed72fe1ff6645091f97393b67fd427c", "score": "0.64933896", "text": "def with_permission_scoping(&blk); wrap_permission_scoping(true,&blk); end", "title": "" }, { "docid": "02827efcddd557e02e0973fbcfddca9e", "score": "0.648534", "text": "def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n\n can %i[edit update], SolrDocument do |solr_doc|\n (AdminSet.where(title: solr_doc.admin_set).first.edit_users.include?(current_user.username) || current_user.admin?) if solr_doc.admin_set.present? && current_user.present?\n end\n\n can %i[edit update], ActiveFedora::Base do |record|\n (record.admin_set.edit_users.include?(current_user.username) if record.respond_to?(:admin_set)) || current_user.admin?\n end\n end", "title": "" }, { "docid": "9be75233bf2626b1b24cea3d60c093a9", "score": "0.64846057", "text": "def permission\n @permission\n end", "title": "" }, { "docid": "976e0e27c46961ad22a9820be189e708", "score": "0.64583564", "text": "def managementinterfaceaccess\n\t\n\tend", "title": "" }, { "docid": "d129cc756661d2db1b6e7ead9a68728c", "score": "0.6437031", "text": "def in_private; end", "title": "" }, { "docid": "d0f62febacb010b97120ef28c345d057", "score": "0.64302254", "text": "def permissions_policy(&block); end", "title": "" }, { "docid": "d1a08d6c90b588877bccf49950ab33cc", "score": "0.64165056", "text": "def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n \n \n\t\tif current_user.superuser?\n\t\t\tcan [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy], Role\n\t\tend\n\t\t\n\t\tif current_user.admin? || current_user.superuser? || current_user.contributor?\n\t\t\tcan [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy, :change_member_visibility, :collection_invisible, :collection_visible, :public_index, :public_show, :collection_thumbnail_set], Collection\n\t\t\tcan [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy, :regenerate], GenericFile\n\t\t\tcan [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy], Institution\n\t#\t\tcannot [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy], GenericFile\n\t else\n\t cannot [:create, :add_user, :remove_user, :edit, :update, :destroy, :change_member_visibility, :collection_invisible, :collection_visible, :index, :collection_thumbnail_set], Collection\n\t\t\tcan [:show, :public_index, :public_show], Collection\n\t\t\tcannot [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy, :regenerate], GenericFile\n\t\t\tcannot [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy], Institution\n\t\tend\n\t\t\n\t\t#cannot :manage, ::Collection unless current_user.superuser?\n end", "title": "" }, { "docid": "2165e75e017327d61962ba9aaf6564ba", "score": "0.6403538", "text": "def private?; end", "title": "" }, { "docid": "2165e75e017327d61962ba9aaf6564ba", "score": "0.6402642", "text": "def private?; end", "title": "" }, { "docid": "16ef39d6033c0e14d1caf01d212ed311", "score": "0.6399136", "text": "def require_permission\n check_permission current_object.employee\n end", "title": "" }, { "docid": "16ef39d6033c0e14d1caf01d212ed311", "score": "0.6399136", "text": "def require_permission\n check_permission current_object.employee\n end", "title": "" }, { "docid": "0503003fc82636428dde75a19a303d61", "score": "0.6392552", "text": "def custom_permissions\n\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n\n if registered_user?\n can [ :create ], Collection\n can [ :create ], Submission\n end\n\n if current_user.admin?\n can [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy], Role\n end\n\n if current_user.curator?\n can [ :create ], BatchImport\n can [ :create ], Dataset\n end\n\n can [ :assign_register_doi ], Dataset do |ds|\n current_user.curator? &&\n current_user.can?(:edit, ds) &&\n ds.doi_assignable? &&\n ds.doi_required_metadata_present?\n end\n\n can [ :assign_register_doi ], SolrDocument do |doc|\n current_user.curator? &&\n current_user.can?(:edit, doc) &&\n doc.doi_assignable? &&\n doc.doi_required_metadata_present?\n end\n\n end", "title": "" }, { "docid": "c5fa62405f0b3d79eaf0ac02e97ed325", "score": "0.63823396", "text": "def permissions\n (super || \"\").split(\",\")\n end", "title": "" }, { "docid": "04a27ae53e182de40631dabc6fe86d14", "score": "0.637631", "text": "def campus_patron_permissions\n end", "title": "" }, { "docid": "1a1b06339764277f9510f9bb35ac10bb", "score": "0.6363828", "text": "def check_permission?\n true\n end", "title": "" }, { "docid": "7536e17370e568418e1eb8f1fad823fe", "score": "0.6360967", "text": "def allow; end", "title": "" }, { "docid": "7536e17370e568418e1eb8f1fad823fe", "score": "0.6360967", "text": "def allow; end", "title": "" }, { "docid": "7687597dd97249020d89a48ede8410cb", "score": "0.63580763", "text": "def acl; end", "title": "" }, { "docid": "d8ce6eb1ee9fa3d4f7f83acba7a6e64e", "score": "0.635353", "text": "def edit_permissions\n # Hydra code passes an object id sometimes (as a string) to bypass object\n # retrieval in views. Upstream code (test_edit) uses a permissions\n # document from solr to check that the user can edit the object in question.\n can [:edit, :update], String do |id|\n test_edit(id)\n end\n can [:edit, :update], ActiveFedora::Base do |obj|\n test_edit(obj.id)\n end\n can [:edit, :update], SolrDocument do |obj|\n cache.put(obj.id, obj)\n test_edit(obj.id)\n end\n end", "title": "" }, { "docid": "0ea2772b5aee3cc45e47b81f0932eba4", "score": "0.63463336", "text": "def custom_permissions\n if current_user.admin?\n can [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy], Role\n end\n\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end", "title": "" }, { "docid": "f0fde79c05ae154e55ca6ccf98630750", "score": "0.6345536", "text": "def only_can_write bit; raise ParkPlace::AccessDenied unless bit.writable_by? @user end", "title": "" }, { "docid": "5c8502dd9efc948a21c41e3b0f963082", "score": "0.6321838", "text": "def custom_permissions\n can [:index, :show], :people_controller\n if current_user.admin?\n can [:create, :show, :add_user, :remove_user, :index], Role\n can [:edit, :create, :destroy], :people_controller\n can [:update], ContentBlock\n end\n\n if current_user.id\n can :show, :unpublished_doi\n end\n\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end", "title": "" }, { "docid": "18be0ddf3ffa8f5379ae0856ea8288aa", "score": "0.63163924", "text": "def custom_permissions\n\n if current_user.admin?\n can [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy], Role\n can :manage, BulkOps::Operation\n can :manage, User\n end\n\n if user_groups.include? \"reviewer\"\n can :read, ContentBlock\n can :read, :admin_dashboard\n \n can :review, :submissions\n\n can :view_admin_show_any, AdminSet\n can :view_admin_show_any, Collection\n can :view_admin_show_any, ::SolrDocument\n\n can [:show, :index, :edit, :update, :delete], BulkOps::Operation\n end\n\n # Limits deleting objects to admin users\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end", "title": "" }, { "docid": "4002617bef49c1400588706eaf62d4fb", "score": "0.6314532", "text": "def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n return unless current_user.admin?\n\n can [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy], Role\n\n # Deprecation Warning: As of Curate v3, Zizia and these abilities will be removed.\n can :manage, Zizia::CsvImport\n can :manage, Zizia::CsvImportDetail\n can :manage, :archivesspace\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end", "title": "" }, { "docid": "1691587c2f9066fef0f3f1c8a2cb8a14", "score": "0.63080066", "text": "def permission\n database.permission\n end", "title": "" }, { "docid": "9f961148bb3e650cd219876b9b7d304e", "score": "0.6299935", "text": "def instance_mod; end", "title": "" }, { "docid": "78efeed29bcb69a73b63c7f237512197", "score": "0.629344", "text": "def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end", "title": "" }, { "docid": "78efeed29bcb69a73b63c7f237512197", "score": "0.629344", "text": "def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end", "title": "" }, { "docid": "4d5592e74b729ace76f1ceaed0fc8c68", "score": "0.62882197", "text": "def privileged?\n self.admin?\n end", "title": "" }, { "docid": "4d5592e74b729ace76f1ceaed0fc8c68", "score": "0.62882197", "text": "def privileged?\n self.admin?\n end", "title": "" }, { "docid": "460bc1e8c7b34480680a0a687f46a2fa", "score": "0.6283217", "text": "def _create_check(op, obj, actor, context = nil)\n context.permission?(actor, Fl::Framework::Access::Grants::WRITE)\n end", "title": "" }, { "docid": "6146be367767fc3ba3a294dbc369b0ef", "score": "0.62829167", "text": "def load_permissions\n authorize! :manage, :all\n end", "title": "" }, { "docid": "6146be367767fc3ba3a294dbc369b0ef", "score": "0.62829167", "text": "def load_permissions\n authorize! :manage, :all\n end", "title": "" }, { "docid": "6146be367767fc3ba3a294dbc369b0ef", "score": "0.62829167", "text": "def load_permissions\n authorize! :manage, :all\n end", "title": "" }, { "docid": "159f4c48dff331e06c5e25e9d779f3d9", "score": "0.6273558", "text": "def custom_permissions\n if current_user.admin?\n can [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy], Role\n can :manage, User\n end\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end", "title": "" }, { "docid": "82400d2d6d2778918e11a70e4ece8736", "score": "0.627201", "text": "def custom_permissions\n if can_review_submissions?\n can [:manage], String do |id|\n approver_for?(admin_set: ActiveFedora::Base.find(id)&.admin_set)\n end\n\n can [:manage], ActiveFedora::Base do |obj|\n approver_for?(admin_set: obj.admin_set)\n end\n end\n return unless admin?\n can [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy], Role\n can [:destroy], ActiveFedora::Base\n can [:read], Schools::School\n can [:manage], RegistrarFeed\n end", "title": "" }, { "docid": "44f2a566091b9ea8bffad7d05aac7b7c", "score": "0.6251227", "text": "def method2 # will be 'protected'\n #...\n end", "title": "" }, { "docid": "e51579fd8f8474a036c61a782bf2b453", "score": "0.62511885", "text": "def paranoid_permissions\n true\n end", "title": "" }, { "docid": "2a5d5b46a63c804a33474e5ed4c393f2", "score": "0.62409645", "text": "def protected_method\n\tend", "title": "" }, { "docid": "2a5d5b46a63c804a33474e5ed4c393f2", "score": "0.62409645", "text": "def protected_method\n\tend", "title": "" }, { "docid": "aa04cb09824ea80bcebf8aa78be10f9b", "score": "0.62402344", "text": "def custom_permissions\n # Limits deleting objects to a the admin user\n can :create, curation_concerns_models if current_user.admin?\n # cannot [:manage], Collection unless current_user.admin? \n can [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy], Role if current_user.admin?\n # Limits creating new objects to a specific group\n #\n # StudentWork_permission if user_groups.include? 'qualifying_project'\n end", "title": "" }, { "docid": "2803f17969152233ea11255e71cefad6", "score": "0.6239443", "text": "def __with_ownership; end", "title": "" }, { "docid": "2803f17969152233ea11255e71cefad6", "score": "0.6239443", "text": "def __with_ownership; end", "title": "" }, { "docid": "8eedd3fe37b22bd08a44b4e2425bbc8f", "score": "0.6234367", "text": "def permit_object?(member)\n end", "title": "" }, { "docid": "5b728389302e3cae5aed2e085856fff5", "score": "0.6225799", "text": "def create?\n @current_user.permission('FrameworkTender', :clerk) \n end", "title": "" } ]
f4d7d2d5a6f921f04058015bd00df20a
Forcefully define a property, even if it already exists.
[ { "docid": "f33047f691521e266b8d410cf84d27c6", "score": "0.6895692", "text": "def property!(property, default=NoDefaultValue)\n property(property, default, overwrite: true)\n end", "title": "" } ]
[ { "docid": "d51e20bc23eb763cd023f35ea848d744", "score": "0.67076635", "text": "def assert_property_exists!(property)\n super unless Plaid.relaxed_models? ||\n self.class.property_ignored?(property)\n end", "title": "" }, { "docid": "58fa94ae5f8793926afe8b29649af7c6", "score": "0.66278434", "text": "def manual_property(prop_name)\n defined_props[prop_name.to_s] = :manual\n end", "title": "" }, { "docid": "50b22e672eb1cf8c68ad5d2c5bfdffcd", "score": "0.6593963", "text": "def __install_property__(property)\n __test_reserved!(property)\n __install_setter__(property)\n __install_getter__(property)\n end", "title": "" }, { "docid": "9a650788132602d4c9b8ba3d411b0a25", "score": "0.65320206", "text": "def add_property!(property)\n current_properties = properties || []\n current_properties << property if valid_property?(property)\n update_attributes(:properties => current_properties)\n end", "title": "" }, { "docid": "7f2bb9ad5c27c7f169dc383018783f0c", "score": "0.64398736", "text": "def ensure_property(name, default_value, description = nil, type = nil)\n begin\n property[name]\n rescue\n def_property(name, default_value, description, type)\n end\n end", "title": "" }, { "docid": "9069ffab6f078c788a886316e725444b", "score": "0.64096045", "text": "def create\n @property_flush[:ensure] = 'present'\n end", "title": "" }, { "docid": "3106a1b4f0056c0ccc6cb5ed92c31f67", "score": "0.6399787", "text": "def create_property_if_none_found\n Property.create!.listings << self unless property\n end", "title": "" }, { "docid": "6772d497f147c51465635f91e242c514", "score": "0.6353412", "text": "def set_property(name, expression, overwrite)\n return if expression == nil\n name = name.to_sym\n error \"Duplicate property definition: '#{name}'\" if \n not overwrite and @expressions.has_key?(name)\n @expressions[name] = expression\n end", "title": "" }, { "docid": "17ebf43e87bed98212a32b70b50d4cd7", "score": "0.6320396", "text": "def create\n @property_flush[:ensure] = :present\n end", "title": "" }, { "docid": "a8a98468ba4e4598c86e00d2b28363d2", "score": "0.6288097", "text": "def __install_property__(property)\n @reserved_method_validator.validate!(property)\n __install_setter__(property)\n __install_getter__(property)\n end", "title": "" }, { "docid": "70163e62d01c54805e5c864eb8e077ad", "score": "0.6216983", "text": "def __install_setter__(property)\n __define_singleton_method__ :\"#{property}=\" do |value|\n __assign!(property, value)\n end\n end", "title": "" }, { "docid": "70163e62d01c54805e5c864eb8e077ad", "score": "0.6216983", "text": "def __install_setter__(property)\n __define_singleton_method__ :\"#{property}=\" do |value|\n __assign!(property, value)\n end\n end", "title": "" }, { "docid": "08b5bd0b44f1fe9aed56de93ae1ec601", "score": "0.6182861", "text": "def define_property(name, options = {}, &block)\n property = Property.new(name, options, &block)\n create_property_getter(property)\n create_property_setter(property) unless property.read_only == true\n\n if property.type.respond_to?(:validates_casted_model)\n validates_casted_model property.name\n end\n\n # Dirty!\n create_dirty_property_methods(property)\n\n properties << property\n properties_by_name[property.to_s] = property\n property\n end", "title": "" }, { "docid": "cc9f3462900831def3b6dc2ee644d337", "score": "0.6158604", "text": "def defProperty(name = :mandatory, description = nil, parameter = nil, options = {})\n raise OEDLMissingArgumentException.new(:defProperty, :name) if name == :mandatory\n if @properties[name] != nil\n raise \"Property '\" + name + \"' already defined.\"\n end\n prop = AppProperty.new(name, description, parameter, options)\n @properties[name] = prop\n end", "title": "" }, { "docid": "1272ef58325838e836b0c7badcddc14e", "score": "0.60855234", "text": "def create\n @property_hash[:ensure] = :present\n end", "title": "" }, { "docid": "d7ea80a146f954a2da65890ee7db1c9c", "score": "0.6059322", "text": "def add_declaration!(property, value)\n if value.nil? or value.empty?\n @declarations.delete(property)\n return\n end\n \n value.gsub!(/;\\Z/, '')\n is_important = !value.gsub!(CssParser::IMPORTANT_IN_PROPERTY_RX, '').nil?\n property = property.downcase.strip\n #puts \"SAVING #{property} #{value} #{is_important.inspect}\"\n @declarations[property] = {\n :value => value, :is_important => is_important, :order => @order += 1\n }\n end", "title": "" }, { "docid": "63c4afe9a08c9f01e1439d3a1b38cc63", "score": "0.604508", "text": "def create_property_setter(property)\n unless instance_methods.map { |m| m.to_s }.include?(\"#{property.name}=\")\n class_eval <<-EOS, __FILE__, __LINE__\n #{property.writer_visibility}\n def #{property.name}=(value)\n attribute_set(#{property.name.inspect}, value)\n end\n EOS\n end\n end", "title": "" }, { "docid": "b60769bd5fa72af3188018f7c2edc5a6", "score": "0.60316706", "text": "def assert_property_set!(property)\n if (\n send(property).nil? &&\n required?(property) &&\n (\n !self.class._readonly_property?(property) ||\n !allow_leaving_required_readonly_properties_blank?\n )\n )\n fail_property_required_error!(property)\n end\n end", "title": "" }, { "docid": "adeebc24eb06015e7354a5bc7788c36b", "score": "0.6019641", "text": "def assign_property(name, value); end", "title": "" }, { "docid": "f89f3c2ac5e95035d1342f829d19df04", "score": "0.60142845", "text": "def assign_prop\n @prop_hsh # todo: hmm.. need to think.. should we internal class this?\n end", "title": "" }, { "docid": "359492e5574c99a9756987ee092f95b5", "score": "0.5993497", "text": "def proto_put(prop, value)\n define_own_property prop, value: value, enumerable: false\n end", "title": "" }, { "docid": "5e565962c66e6b47bdcade4988c26a9e", "score": "0.5980345", "text": "def multi_property(prop_name, property, options = {})\n define_property(prop_name, property, options.merge(:singular_property => false))\n end", "title": "" }, { "docid": "537349bdb8915e5db0d7b433ae08ac1d", "score": "0.5941673", "text": "def define_property(name, options={})\n # check if this property is going to casted\n options[:casted] = options[:cast_as] ? options[:cast_as] : false\n property = CouchRest::Property.new(name, options)\n create_property_getter(property) \n create_property_setter(property) unless property.read_only == true\n properties << property\n end", "title": "" }, { "docid": "b50726e4b69a184288875ba79b1d1987", "score": "0.59116083", "text": "def property(property, default=NoDefaultValue, overwrite: false)\n property = property.to_sym\n\n if !overwrite && self.properties.key?(property)\n raise DuplicateProperty.new(property, self)\n end\n\n self.properties[property] = default\n define_method(property) { self[property] }\n define_method(\"#{property}=\") { |val| self[property] = val }\n\n __push_property_down_chain(property, default)\n\n # For chaining\n return self\n end", "title": "" }, { "docid": "39f7d35253f00dfb9862dbb458010474", "score": "0.5900553", "text": "def create_property_setter(property)\n property_name = property.name\n class_eval <<-EOS\n def #{property_name}=(value)\n write_attribute('#{property_name}', value)\n end\n EOS\n\n if property.alias\n class_eval <<-EOS\n alias #{property.alias.to_sym}= #{property_name.to_sym}=\n EOS\n end\n end", "title": "" }, { "docid": "e6ea44c14b4b1d928cb804f684a867a8", "score": "0.5894798", "text": "def create_property_setter(property)\n name = property.name\n\n define_method(\"#{name}=\") do |value|\n write_attribute(name, value)\n end\n\n if property.alias\n alias_method \"#{property.alias}=\", \"#{name}=\"\n end\n end", "title": "" }, { "docid": "50200bac373a8c7aad5989d3494486dc", "score": "0.58806133", "text": "def add_property(property)\n @properties[property.name] = property\n if @property_values[property.name].nil?\n set_property_value(property.name, property.default)\n end\n end", "title": "" }, { "docid": "4dad11e2db7480a5b1845f44fdac4fed", "score": "0.5871002", "text": "def define_property(prop_name, property, options = {})\n prop_name = prop_name.to_s\n property_options(property, options) # Save options for the current property\n\n return if(defined_props.include?(prop_name))\n raise(ArgumentError, \"Cannot overwrite method #{prop_name}\") if(self.instance_methods.include?(prop_name) || self.instance_methods.include?(\"#{prop_name}=\"))\n\n # define the accessor\n define_method(prop_name) do\n self[property]\n end\n\n # define the writer\n define_writer(prop_name, property)\n\n # define the finder\n (class << self ; self; end).module_eval do\n define_method(\"find_by_#{prop_name}\") do |value, *optional|\n raise(ArgumentError, \"Too many options\") if(optional.size > 1)\n options = optional.last || {}\n finder = options.merge( :find_through => [property, value] )\n find(:all, finder)\n end\n end\n defined_props[prop_name] = property\n end", "title": "" }, { "docid": "086557b92313da670e11fa5ce0dbad01", "score": "0.58477384", "text": "def define_property(name, options={})\n # read only flag\n read_only = options.delete(:read_only) || false\n \n # Store the property and its options\n self.properties[name.to_s] = options\n \n # Create getter and setter methods\n create_property_getter(name)\n create_property_setter(name) unless read_only == true\n \n # Return property name just in case ;)\n name\n end", "title": "" }, { "docid": "523c6bac2ab74c1646daa94d8222966e", "score": "0.5847678", "text": "def set(prop, value)\n prop = prop.to_s\n property ||= self.properties.find_by_name(prop)\n property ||= Property.new(:name => prop, :prototype => self)\n property.value = value\n property.save\n end", "title": "" }, { "docid": "e218078358cbce67c7667fc1603bf6ca", "score": "0.584376", "text": "def defProperty(name, description, parameter, options = {})\n @properties << Property.new(name, description, parameter, options)\n end", "title": "" }, { "docid": "59b5350123ef31e3c0e6e67e90a5bce1", "score": "0.5842954", "text": "def []=(property, value)\n assert_property_required! property, value\n assert_property_exists! property\n super(property, value)\n end", "title": "" }, { "docid": "ea1faa763314f92557c615d8fb29cd51", "score": "0.5831918", "text": "def create_prop(name)\n unless @properties.has_key? name\n @properties[name] = {\n :gets => false,\n :sets => false,\n :name => name\n }\n end\n @properties[name]\n end", "title": "" }, { "docid": "33d4fb3b012849625906681db9ff1111", "score": "0.582118", "text": "def defProperty(id, description, default = nil)\n if @properties[id] != nil\n raise \"Property '\" + id + \"' already defined.\"\n end\n param = Parameter.new(id, id, description, default)\n @properties[id] = param\n end", "title": "" }, { "docid": "1b0a13c87daf5a04f2717da861a700d7", "score": "0.581676", "text": "def with_property(name)\n @properties ||= {}\n @properties[name] = Property.new(name)\n end", "title": "" }, { "docid": "05a80ecfff605429ebc14ebf66157e5e", "score": "0.577766", "text": "def property=(_arg0); end", "title": "" }, { "docid": "05a80ecfff605429ebc14ebf66157e5e", "score": "0.577766", "text": "def property=(_arg0); end", "title": "" }, { "docid": "1eddf3173d637868047fe3a58a9586fb", "score": "0.5738971", "text": "def define_property(name, options={})\n # check if this property is going to casted\n options[:casted] = options[:cast_as] ? options[:cast_as] : false\n property = CouchRest::Property.new(name, (options.delete(:cast_as) || options.delete(:type)), options)\n create_property_getter(property) \n create_property_setter(property) unless property.read_only == true\n properties << property\n end", "title": "" }, { "docid": "2426c8304726853068c384a4af3a3fff", "score": "0.5734791", "text": "def set_propertySection(object)\n @propertySection << object unless @propertySection.include? object\n end", "title": "" }, { "docid": "205884e060ab89e56d2d0aee502ea3ba", "score": "0.5732239", "text": "def property_defined?(name)\n !!@alias_std_prop_map[name.to_sym]\n end", "title": "" }, { "docid": "2c819f6f73e6e4885b42c0c8c0e1f844", "score": "0.57162476", "text": "def set_property(property, value)\n if property == '_links' || property == '_embedded'\n raise ArgumentError, \"Argument #{property} is a reserved property\"\n end\n\n tap { @properties[property] = value }\n end", "title": "" }, { "docid": "1a92bdaecf46355b062c998b6b7f9b57", "score": "0.5715754", "text": "def create_property_setter(property)\n meth = property.name\n class_eval <<-EOS\n def #{meth}=(value)\n self['#{meth}'] = value\n end\n EOS\n\n if property.alias\n class_eval <<-EOS\n alias #{property.alias.to_sym}= #{meth.to_sym}=\n EOS\n end\n end", "title": "" }, { "docid": "1a92bdaecf46355b062c998b6b7f9b57", "score": "0.5715754", "text": "def create_property_setter(property)\n meth = property.name\n class_eval <<-EOS\n def #{meth}=(value)\n self['#{meth}'] = value\n end\n EOS\n\n if property.alias\n class_eval <<-EOS\n alias #{property.alias.to_sym}= #{meth.to_sym}=\n EOS\n end\n end", "title": "" }, { "docid": "540f20c28a471a567fca7b0ef94d26d1", "score": "0.570923", "text": "def add_declaration!(property, value) \n if value.nil? or value.empty?\n @declarations.delete(property)\n return\n end\n \n value.gsub!(/;\\Z/, '')\n is_important = !value.gsub!(CssParserMaster::IMPORTANT_IN_PROPERTY_RX, '').nil?\n property = property.downcase.strip\n \n decl = CssParserMaster::Declaration.new property.downcase.strip, value.strip, is_important, @order += 1\n # puts \"new decl: #{decl.inspect}, #{decl.class}\"\n @declarations[property] = decl \n end", "title": "" }, { "docid": "4378e2b2445cf8445644edecfde73dc6", "score": "0.5698692", "text": "def create_property_setter(property)\n meth = property.name\n if property.coerce\n if property.coerce.is_a? String\n value = \"value.nil? ? nil : value.#{property.coerce}\" \n else\n class_variable_set(\"@@#{property.name}_coerse\", property.coerce)\n value = \"@@#{property.name}_coerse.call(value)\"\n end\n else\n value = \"value\"\n end\n class_eval <<-EOS\n def #{meth}=(value)\n self['#{meth}'] = #{value}\n end\n EOS\n#puts \"YYYYY:#{property.alias.inspect}\"\n class_eval property.alias.map { |_alias| \"alias #{_alias.to_sym}= #{property.name.to_sym}=;\" }.join('')\n end", "title": "" }, { "docid": "c040382ae50656aa405cb7df0f18b1d0", "score": "0.5692639", "text": "def defProperty(id, description, default = nil)\n if @properties[id] != nil\n raise \"Property '\" + id + \"' already defined.\"\n end\n param = OmfEc::Parameter.new(id, id, description, default)\n @properties[id] = param\n end", "title": "" }, { "docid": "76df2b6409453804711e65b3d9ff227c", "score": "0.568262", "text": "def []=(property, value)\n property = normalize_property(property)\n\n if value.is_a?(Value)\n declarations[property] = value\n elsif value.to_s.strip.empty?\n delete property\n else\n declarations[property] = Value.new(value)\n end\n rescue ArgumentError => e\n raise e.exception, \"#{property} #{e.message}\"\n end", "title": "" }, { "docid": "806bf3c9ff1831b42fa0ef47824b8622", "score": "0.5672912", "text": "def property name, required: false, type: Object, default: nil\n properties[name] = Property.new(name, required, type, default)\n end", "title": "" }, { "docid": "41379f82776b2ce05651b2553996b095", "score": "0.56182796", "text": "def create_shorthand_properties! properties, shorthand_property # :nodoc:\n values = []\n properties.each do |property|\n if @declarations.has_key?(property) and not @declarations[property][:is_important]\n values << @declarations[property][:value]\n @declarations.delete(property)\n end\n end\n\n unless values.empty?\n @declarations[shorthand_property] = {:value => values.join(' ')}\n end\n end", "title": "" }, { "docid": "c6e9f0ad030f583166693dfcca3818b9", "score": "0.561704", "text": "def validate_undefined\n return unless properties\n return unless (prop = properties[name])\n\n raise PropertyDefined, name: name, type: prop[:type], default: prop[:default]\n end", "title": "" }, { "docid": "25f42763d7072537addae9ee3054bee3", "score": "0.5611382", "text": "def set_property(name, value)\n puts \"Debug 2: setting property #{name}:#{value}\"\n super(name)\n end", "title": "" }, { "docid": "5b3c508ce9a928ea7e718647c56ac51a", "score": "0.55774534", "text": "def exists?\n not @property_hash[:ensure].nil?\n end", "title": "" }, { "docid": "73661084ec92dc76d3387e3f294136ed", "score": "0.557327", "text": "def property(name, value, important)\n end", "title": "" }, { "docid": "577ec35bf0c20816497d0e746e3ba25f", "score": "0.5566948", "text": "def register_property!(name, options = {})\n @properties ||= {}\n @properties[name] = options\n end", "title": "" }, { "docid": "0fea96dea8011d11344fa936f5e56cd6", "score": "0.5565356", "text": "def <<(property)\n properties << property\n update_map(property.name, property.default)\n property.define_accessor_methods(self)\n self\n end", "title": "" }, { "docid": "0c4ae775b303855f095ea94149b38287", "score": "0.5548638", "text": "def add_property(property)\n name = property.name\n if @properties[name]\n @properties[name].merge(property)\n else\n @properties[name] = property\n end\n end", "title": "" }, { "docid": "0fd5ce6f5e1627b4c2c74afaa58e6b2a", "score": "0.55467415", "text": "def property_fix\n properties.each do |thing|\n next unless [:mode, :owner, :group].include?(thing.name)\n\n # Make sure we get a new stat object\n @stat = :needs_stat\n currentvalue = thing.retrieve\n thing.sync unless thing.safe_insync?(currentvalue)\n end\n end", "title": "" }, { "docid": "0fd5ce6f5e1627b4c2c74afaa58e6b2a", "score": "0.55467415", "text": "def property_fix\n properties.each do |thing|\n next unless [:mode, :owner, :group].include?(thing.name)\n\n # Make sure we get a new stat object\n @stat = :needs_stat\n currentvalue = thing.retrieve\n thing.sync unless thing.safe_insync?(currentvalue)\n end\n end", "title": "" }, { "docid": "fa9a68b02bf14062311773608ca61d2d", "score": "0.5543465", "text": "def add_property(property, value=nil)\n\n # Add the property to the entity\n meta_eval { attr_accessor property }\n\n # Set the value of the property\n instance_variable = to_instance_variable(property)\n self.instance_variable_set(instance_variable, value) if value\n\n #Add to the array of properties\n @properties << property.to_sym\n\n # Return value\n value\n end", "title": "" }, { "docid": "7cc5bcbfa0023b1522800e5a29fbe90e", "score": "0.55413526", "text": "def add_property(prop)\n @properties.push(prop)\n end", "title": "" }, { "docid": "52cf50bd647f9c9ff1adaf1d77d4c618", "score": "0.553749", "text": "def property(name)\n nil\n end", "title": "" }, { "docid": "ef874e623ac4467d9351bc291e00cd06", "score": "0.55343896", "text": "def setProperty(name, value)\n @def.setProperty(name, value)\n end", "title": "" }, { "docid": "22ad738a904511abcf16f3285f52e715", "score": "0.5526138", "text": "def should_define_setter_for?(name, setter)\n super && !_readonly_property?(name)\n end", "title": "" }, { "docid": "a1c8abcd60240ba62b5ad880f6318acc", "score": "0.55154896", "text": "def repeat_property=(property_value)\n @repeat_property = property_value\n end", "title": "" }, { "docid": "4f85fb6356810aefd425f3f334ea18a6", "score": "0.55006987", "text": "def set_tl_properties\n @tl_props.each do |property,value|\n if (self.instance_variable_defined?(('@' + property.to_s)) && self.instance_variable_get(('@' + property.to_s)) == nil) # is it an internal property we map 1:1 and don't have yet\n self.instance_variable_set(('@' + property.to_s),value.to_s )\n @tl_props.delete(property)\n self.class.send(:define_method,(property.to_s)) do\n self.instance_variable_get(('@' + property.to_s))\n end\n end\n end\n end", "title": "" }, { "docid": "bf614963406dfc536130b61fd28a0a93", "score": "0.549613", "text": "def set_property(key, value)\n fail 'not implemented'\n end", "title": "" }, { "docid": "bf614963406dfc536130b61fd28a0a93", "score": "0.549613", "text": "def set_property(key, value)\n fail 'not implemented'\n end", "title": "" }, { "docid": "8e6008d6006765236b90b5d759ce3ffb", "score": "0.54950213", "text": "def alter props\n _alter props, false\n end", "title": "" }, { "docid": "97f32ba8739c3fcb003e875ae38be50d", "score": "0.5483449", "text": "def set_property\n @properties = Property.all\n end", "title": "" }, { "docid": "f68fc29246b76576bb0ed3d5238a4b22", "score": "0.5479121", "text": "def property(property_name, options = T.unsafe(nil)); end", "title": "" }, { "docid": "f68fc29246b76576bb0ed3d5238a4b22", "score": "0.5479121", "text": "def property(property_name, options = T.unsafe(nil)); end", "title": "" }, { "docid": "18872237365c6e69fd58acb0a6782e78", "score": "0.5478586", "text": "def property(name, params={})\n raise \"Duplicate property definition #{name} in #{@classname}\" if @properties.has_key?(name)\n @property_map.push(name)\n add_property_support(name, params)\n end", "title": "" }, { "docid": "720fea7a649848db1405437ab664a7ac", "score": "0.5461079", "text": "def has_property?(name)\n name = name.to_s if name.kind_of? Symbol\n Datastore.convert_exceptions do\n hasProperty(name)\n end\n end", "title": "" }, { "docid": "720fea7a649848db1405437ab664a7ac", "score": "0.5461079", "text": "def has_property?(name)\n name = name.to_s if name.kind_of? Symbol\n Datastore.convert_exceptions do\n hasProperty(name)\n end\n end", "title": "" }, { "docid": "7eebd2c9d4c39fcc4cd91f9169575bb5", "score": "0.5450815", "text": "def property(prop_name, options = {})\n prop_name = prop_name.to_sym\n \n define_method(prop_name) do \n @properties[prop_name]\n end\n \n define_method(:\"#{prop_name}=\") do |new_value|\n @properties[prop_name] = new_value \n end \n private :\"#{prop_name}=\" if options[:readonly]\n end", "title": "" }, { "docid": "df40f455119954f3c3a3a3cf0717effe", "score": "0.5448058", "text": "def update\n self.uninstall if (@property_hash[:ensure] || info2hash[:ensure]) != :absent\n self.install\n end", "title": "" }, { "docid": "24bc20c55e2f548b211a69e834414a1b", "score": "0.5436143", "text": "def patch_property(method_name)\n self.class.class_eval %Q{\n class #{self.class}\n def #{method_name}\n @properties['#{method_name}']\n end\n def #{method_name}=(value)\n @properties['#{method_name}'] = value\n end\n end }\n end", "title": "" }, { "docid": "9f1420abba1d6fb93a6097f8789aa64a", "score": "0.54305524", "text": "def has_property?(name)\n properties.include? name\n end", "title": "" }, { "docid": "bff241bef9514d4c88be9a3720ff29fd", "score": "0.5414042", "text": "def own!(property)\n return if property.class != Property\n property = Property.find_by(id: property.id)\n return if property.nil?\n group = Group.find_by(id: self.id)\n return if group.nil?\n GroupPropertyRelationship.create!(group_id: self.id, property_id: property.id, position: self.property_relations.count)\n end", "title": "" }, { "docid": "622929f703dfdf20b819e1d2bf4c0446", "score": "0.53958905", "text": "def anything_property(property)\n Schema::Object::Property.new(property.name, Schema::Anything.instance, property.required)\n end", "title": "" }, { "docid": "a31b529a6603d47a1c33282aba5a9881", "score": "0.5395255", "text": "def overwrite(properties)\n check_properties(properties)\n set_properties(properties, true)\n end", "title": "" }, { "docid": "0ed346dfbd535953a53c5eeed8589216", "score": "0.53944695", "text": "def define_writer(prop_name, property)\n define_method(\"#{prop_name}=\") do |values|\n self[property] = values\n end\n end", "title": "" }, { "docid": "68ff04d68db1e09a8ddacd010ec7c553", "score": "0.53920865", "text": "def def_property(name, default_value, description = nil)\n OmfEc.exp.property[name] ||= default_value\n end", "title": "" }, { "docid": "79c3fb6940adb4146ac3a3a1f53f3029", "score": "0.538767", "text": "def add_property(prop, deep_copy = false)\n prop.values.delete_if do |k, _|\n IGNORED_CONDITIONS.any? { |condition| k.include?(condition) }\n end if prop.name == 'size'\n super(prop, deep_copy)\n end", "title": "" }, { "docid": "0ed52202555d6bce4b06eb436218688e", "score": "0.53777784", "text": "def create_shorthand_properties!(properties, shorthand_property) # :nodoc:\n values = []\n properties_to_delete = []\n properties.each do |property|\n next unless (declaration = declarations[property])\n next if declaration.important\n\n values << declaration.value\n properties_to_delete << property\n end\n\n return if values.length <= 1\n\n properties_to_delete.each do |property|\n declarations.delete(property)\n end\n\n declarations[shorthand_property] = values.join(' ')\n end", "title": "" }, { "docid": "b50da5940c5a4ef692e602e2797d8bbf", "score": "0.53716004", "text": "def add_property_parameter(prop_name)\n if self.class.validproperty?(prop_name) && !@parameters[prop_name]\n self.newattr(prop_name)\n return true\n end\n false\n end", "title": "" }, { "docid": "b7457abdfd3826fdba96d28de6910e4a", "score": "0.53661394", "text": "def set_property(property, value)\n raise NotImplementedError.new(\"Implement set_property(property, value) in your Job class.\")\n end", "title": "" }, { "docid": "8b0e473f6ce481c7145c5f4f0754f9ca", "score": "0.5364803", "text": "def custom_property?; end", "title": "" }, { "docid": "fab6f066ff7b842b47d16de82628bb5e", "score": "0.53577256", "text": "def add_property(conn, node, value, type)\n # Check if the same property is already added\n r = conn.get(\"#{node}/properties/#{CGI.escape(type)}\")\n #p r.status\n #puts r.body, value\n #puts JSON.parse(value_stored.body)['exception']\n if r.status != 200\n r = conn.put(\"#{node}/properties/#{type}\", \"#{value}\", HEADER) \n #p r.status\n #puts r.body\n $load_p += 1\n else\n if r.body == value\n $skip_p += 1\n else\n puts \"WARNING (Property Conflict): #{node}/properties/#{CGI.escape(type)} old: #{r.body} <> new: #{value}\"\n $warn_p += 1\n end\n end\n #puts \"#{node}/properties/#{CGI.escape(type)}\"\nend", "title": "" }, { "docid": "dc4561ecb9a80977026675fcf5d383c7", "score": "0.5352578", "text": "def define_property(name, options={}, &block)\n # check if this property is going to casted\n type = options.delete(:type) || options.delete(:cast_as)\n if block_given?\n type = Class.new(Hash) do\n include CastedModel\n end\n type.class_eval { yield type }\n type = [type] # inject as an array\n end\n property = CouchRest::Property.new(name, type, options)\n create_property_getter(property) \n create_property_setter(property) unless property.read_only == true\n properties << property\n property\n end", "title": "" }, { "docid": "4282c53ed1259f7c0ce4d4b0a2d22708", "score": "0.5351986", "text": "def primitive=(should)\n @property_hash[:primitive] = should\n end", "title": "" }, { "docid": "4282c53ed1259f7c0ce4d4b0a2d22708", "score": "0.5351986", "text": "def primitive=(should)\n @property_hash[:primitive] = should\n end", "title": "" }, { "docid": "4282c53ed1259f7c0ce4d4b0a2d22708", "score": "0.5351986", "text": "def primitive=(should)\n @property_hash[:primitive] = should\n end", "title": "" }, { "docid": "4282c53ed1259f7c0ce4d4b0a2d22708", "score": "0.5351986", "text": "def primitive=(should)\n @property_hash[:primitive] = should\n end", "title": "" }, { "docid": "a6bd78083ce8e666f59a2ec0d0b361a6", "score": "0.53517973", "text": "def []=(property, value)\n assert_property_required! property, value\n assert_property_exists! property\n assert_property_validate! property, value\n super(property.to_s, value)\n end", "title": "" }, { "docid": "de575447affce6362e0177bd26f0ce42", "score": "0.53414357", "text": "def create_java_property(pd)\n # the new property\n prop = super\n # alias a misnamed collection attribute, if necessary\n if prop.collection? then\n name = prop.attribute.to_s\n if name.singularize == name then\n aliaz = name.pluralize.to_sym\n if aliaz != name then\n logger.debug { \"Adding annotation #{qp} alias #{aliaz} to the misnamed collection property #{prop}...\" }\n delegate_to_property(aliaz, prop)\n end\n end\n end\n prop\n end", "title": "" }, { "docid": "68f382f6a6ccb9cdc3a4c9907505410d", "score": "0.53392524", "text": "def push(property_or_name)\n if String === property_or_name or Symbol === property_or_name\n property = Dormouse::Property.new(self, property_or_name)\n else\n property = property_or_name\n end\n @properties[property.names.id] = property\n property\n end", "title": "" }, { "docid": "7cbee72f7361f9d5aab0756114d402c0", "score": "0.533267", "text": "def require_target_property?\n !!@require_target_property\n end", "title": "" }, { "docid": "a6667ea84b3675f0df9cf29a1df955ac", "score": "0.53299916", "text": "def force=(value)\n @force = value\n end", "title": "" }, { "docid": "229208e7b9313d91741761a5d5c0c60a", "score": "0.53235745", "text": "def add_property name, value\n # Convert it to snake-case\n name = sanitize_name name.to_s\n\n # Add the attr_accessor if it doesn't exist\n unless self.respond_to? \"#{name}\"\n self.class.class_exec(name) do |n|\n attr_accessor n.to_sym\n end\n end\n\n if value.respond_to? :parent=\n value.parent = self\n end\n\n # Set the attribute to the value\n self.send(\"#{name}=\", value)\n end", "title": "" } ]
11ea07dfa52b15116524f871b5c7a922
=> 9 Frequent Letters Write a method frequent_letters that takes in a string and returns an array containing the characters that appeared more than twice in the string.
[ { "docid": "7df4a52c31690bd01209b7b771c1ea4e", "score": "0.87520695", "text": "def frequent_letters(string)\n count = []\n freq = Hash.new(0)\n string.each_char { |char| freq[char] += 1 }\n\n freq.each do |k, v|\n count << k if v > 2\n end\n count\nend", "title": "" } ]
[ { "docid": "5a068d5b7989959eeea3ee5ba41f19c5", "score": "0.89116025", "text": "def frequent_letters(string)\n\tcharacters = []\n \tlettersCount = Hash.new(0)\n \n \tstring.each_char { |letter|\n \tlettersCount[letter] += 1\n \tif lettersCount[letter] > 2 && !characters.include?(letter)\n \tcharacters.push(letter)\n end\n }\n \treturn characters\nend", "title": "" }, { "docid": "29817ea216e19f343ed76ebf0ae57731", "score": "0.8813462", "text": "def frequent_letters(string)\r\n letters = Hash.new(0)\r\n string.each_char {|char| letters[char] += 1}\r\n frequentLetters = []\r\n letters.each {|key, val| if val > 2 then frequentLetters << key end}\r\n return frequentLetters\r\nend", "title": "" }, { "docid": "419d71c3f3fb0652474ba4b9e2f956fb", "score": "0.8806302", "text": "def frequent_letters(string)\n letter_counts = letter_count(string) #=> returns as a hash of letter counts\n repeats = []\n letter_counts.each_pair do |letter, count|\n if count > 2\n repeats << letter\n end\n end\n return repeats\nend", "title": "" }, { "docid": "48f744d1398c44272e9155b37607c0df", "score": "0.88015026", "text": "def frequent_letters(string)\n count = Hash.new(0)\n\n new_array = []\n string.each_char do |char|\n count[char] += 1\n end\n count.each do |char,num|\n if num > 2\n new_array << char\n end\n end\n new_array\nend", "title": "" }, { "docid": "9db99f78460747f2551b9b75d0923b06", "score": "0.8791166", "text": "def frequent_letters(string)\n arr = []\n\n count = Hash.new(0)\n string.each_char { | char | count[char] += 1 }\n\n count.each do | k, v |\n if v > 2\n arr << k\n end\n end\n\n return arr\nend", "title": "" }, { "docid": "bfeaebfaccbf8ed14e3da3ba2d7b6382", "score": "0.8772425", "text": "def frequent_letters(string)\n count = Hash.new(0)\n string.each_char { |char| count[char] += 1}\n\n frequents = []\n count.each do |char, num|\n if num > 2\n frequents << char\n end\n end\n\n return frequents\nend", "title": "" }, { "docid": "2924e29fb3d981cc68312fb2e6f1f03d", "score": "0.876826", "text": "def frequent_letters(string)\n count = Hash.new(0)\n string.each_char do |char|\n count[char] +=1\n end \n\n arrayL = []\n count.each do |ele,num|\n if num >2\n arrayL << ele\n end \n end \n return arrayL\nend", "title": "" }, { "docid": "8c5c6edd9ed338cf4c0e60e64b9e2563", "score": "0.8723521", "text": "def frequent_letters(string)\n count_hash = letter_count(string)\n frequent_arr = []\n count_hash.each do |key_char, val|\n if val > 2\n frequent_arr << key_char\n end\n end\n return frequent_arr\nend", "title": "" }, { "docid": "33d47564dbbb150399880e5ea65c33a6", "score": "0.87013555", "text": "def frequent_letters(str)\n hash = Hash.new(0)\n res_arr = []\n str.each_char{|char| hash[char] += 1}\n hash.each{|k, v| res_arr << k if v > 2}\n res_arr\nend", "title": "" }, { "docid": "cabb0116758818e7950b7419ade95ebe", "score": "0.866516", "text": "def frequent_letters(string)\n count_hash = Hash.new(0)\n string.each_char do |char|\n count_hash[char] += 1\n end\n # Now we have a hash with all the letters and how many times they showed up.\n alpha = (\"a\"..\"z\")\n frequent_arr = []\n count_hash.each_pair do |key, val|\n if val > 2 && alpha.include?(key.downcase)\n frequent_arr << key\n end\n end\n return frequent_arr\nend", "title": "" }, { "docid": "52d146bfba0259c10d9d34f1d9b3aa14", "score": "0.866174", "text": "def frequent_letters(string)\n arr = []\n counter = Hash.new(0)\n string.each_char do |char|\n counter[char] += 1\n end\n counter.each do |key, value|\n if value > 2\n arr << key\n end\n end\n return arr\nend", "title": "" }, { "docid": "3bd296c999224741299ab4b721dc9625", "score": "0.8645368", "text": "def frequent_letters(string)\n\tarry = string.split(\"\")\n \tfinal = []\n \thash = Hash.new(0)\n arry.each do |letter|\n letter.each_char { |i| hash[i] += 1}\n end\n hash.each do |k, v|\n if v > 2\n final << k\n end\n end\n return final\nend", "title": "" }, { "docid": "4a6a9097d0ff493855cca77d237b2d62", "score": "0.86321086", "text": "def frequent_letters(string)\n count_hash = Hash.new(0)\n frequent_arr = []\n string.each_char do |char|\n count_hash[char] += 1\n end\n count_hash.each_pair do |key, value|\n if value > 2\n frequent_arr << key\n end\n end\n return frequent_arr\nend", "title": "" }, { "docid": "55aec127677b8b589a80833296027552", "score": "0.8595619", "text": "def frequent_letters(str)\n count = Hash.new(0)\n frequent = []\n str.each_char do |char|\n count[char] += 1\n end\n\n count.each do |key, val|\n if val > 2\n frequent.push(key)\n end\n end\n return frequent\nend", "title": "" }, { "docid": "297390ba05d92faf4186ef9481231099", "score": "0.85093546", "text": "def frequent_letters(string)\n counter = Hash.new(0)\n arr=[]\n string.each_char { |char| counter[char] += 1 }\n\n s = counter.sort_by { |k,v| v }\n s.each do |el|\n if el[1] > 2\n arr << el[0]\n end\n end\n return arr\nend", "title": "" }, { "docid": "66ef7992823ee00c326e72f2e71bb0a9", "score": "0.84029657", "text": "def frequent_letters(string)\n count_hash = Hash.new(0)\n multiples_arr = []\n\n string.each_char do |char| # counts occurences of each char\n count_hash[char] += 1\n end\n\n # return count_hash\n\n count_hash.each do |key, value|\n if value > 2\n multiples_arr << key\n end\n end\n\n return multiples_arr\nend", "title": "" }, { "docid": "bcfba289156fe84bf5e7d6368ac6146e", "score": "0.8267753", "text": "def frequent_letters(string)\n count = Hash.new(0)\n most_common = []\n\n string.each_char { |letter| count[letter] += 1 }\n\n count.each { |k,v| most_common << k if v > 2 }\n\n return most_common\nend", "title": "" }, { "docid": "51abbf6551eb5a732899e807168265fb", "score": "0.80070007", "text": "def frequent_letters(string)\n\n # step 2 : new box {}\n counter = Hash.new(0) # # counter = {} with default value '0'\n # step 1 : iteration check\n string.each_char do |char|\n # step 3 : add 1 increment \n # counter[char] += 1 \n counter[char] += 1\n end\n # return counter\n # {\"m\"=>1, \"i\"=>4, \"s\"=>4, \"p\"=>2}\n # {\"b\"=>1, \"o\"=>2, \"t\"=>1, \"c\"=>1, \"a\"=>1, \"m\"=>1, \"p\"=>1}\n\n new = []\n counter.each do |k, v|\n\n if v > 2\n new << k\n end\n\n end\n return new\n\nend", "title": "" }, { "docid": "843bb232436edfaa834f26a22c45b932", "score": "0.774878", "text": "def letter_repeats(word)\n\t\n\tsp_word = word.split(\"\")\n\tletters_n_repeats = Hash.new 0\n\tcount = []\n\tsp_word.each { |letter| letters_n_repeats[letter] += 1 }\n\t\n\tletters_n_repeats.each_value {|value| count << value}\n\tcount.select {|num| num > 1}.length\n\t\nend", "title": "" }, { "docid": "58e23fa6e43a80ec23b769da764384cb", "score": "0.77350026", "text": "def letter_frequency(text)\n c = text.downcase.gsub(/[^a-zA-Z]/, '').chars\n arr = c.map { |e| [e, c.count(e)] }.uniq\n arr.sort_by { |e| [-e[1], e[0]] }\nend", "title": "" }, { "docid": "d5cd2af60b5dfde103d9a134b88bda69", "score": "0.76871663", "text": "def most_frequent_letter(string)\n\n\talpha_count = Hash.new 0\n\tstring_splitted = string.delete(\" \").split(\"\")\n\n\tstring_splitted.each { |letter| alpha_count[letter] += 1 }\n\n most_letter = []\n most_count = 0\n\n alpha_count.each do |letter, number|\n\n \tif number > most_count\n \t\tmost_count = number\n \t\tmost_letter = letter\n \tend\n\n end\n most_letter\nend", "title": "" }, { "docid": "bbda1efbdad8449e82feda5b796343e2", "score": "0.7592079", "text": "def counted_characters(string)\n arr = []\n counts(string).each do |k,v|\n if v > 2\n arr << k\n end\n end\n\n arr\nend", "title": "" }, { "docid": "5c2898c27473bd0567dcab82077f739d", "score": "0.7516474", "text": "def get_letter_freq(str)\n freq = Hash.new(0)\n str.chars.each{|ch| freq[ch] += 1}\n freq\nend", "title": "" }, { "docid": "48e48a88792c97c9198b12b1e62615f4", "score": "0.74988955", "text": "def non_unique_letters(string)\n letter_counts = string.split.reduce(Hash.new(0)) do |counts, word|\n word.each_char { |ch| counts[ch] += 1 }\n counts\n end\n\n letter_counts.select { |ch, count| count > 1 }.keys\nend", "title": "" }, { "docid": "6e53557f3cfadeab86fbc02722c1d3d8", "score": "0.7438436", "text": "def most_frequent_letter(string)\n str = string.chars\n h = Hash.new(0)\n str.reject! { |l| l == \" \"}\n str.each do |e|\n h[e] += 1\n end\n freq_letter = h.keys.first\n h.each do |letter, count|\n if count > h[freq_letter]\n freq_letter = letter\n end\n end\n freq_letter\nend", "title": "" }, { "docid": "eb14155f2ae731fc7d041a4a7e3bf7fa", "score": "0.7403222", "text": "def non_unique_letters(string)\n non_unique_letters = []\n counters = Hash.new(0)\n arr = string.downcase.split(//).select {|letter| string.count(letter) > 1}\n \n arr.each do |c|\n counters[c] += 1\n non_unique_letters << c if counters[c] <= 1 \n end\n \n return non_unique_letters\nend", "title": "" }, { "docid": "7f7b8c8342cf794d3502d0966b988911", "score": "0.7389342", "text": "def most_frequent_letter(str)\n if str.include?(\" \")\n words = str.split(\" \")\n letters = []\n words.each do |word|\n word.chars.each do |ch|\n letters << ch\n end\n end\n else\n letters = str.split(\"\")\n end\n\n letter_ct = Hash.new(0)\n\n letters.each do |letter|\n letter_ct[letter] += 1\n end\n\n most_frequent_letter_ct = nil\n most_frequent_letter = nil\n letter_ct.each do |letter, ct|\n if most_frequent_letter_ct.nil? || ct > most_frequent_letter_ct\n most_frequent_letter_ct = ct\n most_frequent_letter = letter\n end\n end\n\n most_frequent_letter\nend", "title": "" }, { "docid": "74c070f617bac4cdd78d1b4e0dcbef9a", "score": "0.73828155", "text": "def num_repeats(string)\n\tletter_repeats = []\n\tletter_array = []\n\tletter_repeated_count = 0\n\ti = 0\n\tstring.length.times do \n\t\tif letter_array.include?(string[i]) && !repeated_array.include?(string[i])\n\t\t\tletter_array << string[i]\n\t\t\trepeated_array << string[i]\n\t\t\tletter_repeated_count += 1\n\t\telse\n\t\t\tletter_array << string[i]\n\t\tend\n\t\ti += 1\n\tend\n\tletter_repeated_count\nend", "title": "" }, { "docid": "eed96b78c7a424977f7cebd50e09318c", "score": "0.7370863", "text": "def letterCounter(word)\n seen = Array.new\n counted = Array.new\n counter = 0\n word.each_char do |c|\n if seen.include?(c) && !counted.include?(c)\n counter += 1\n counted.push(c)\n else\n seen.push(c)\n end\n end\n return counter\nend", "title": "" }, { "docid": "24304860d7cc06fa5f0ea2be4dcca315", "score": "0.7362517", "text": "def letter_count string\n frequency = {}\n i = 0\n while i < string.length do\n if !frequency[string[i]]\n frequency[string[i]] = 1\n else\n frequency[string[i]] += 1\n end\n i += 1\n end\n frequency\nend", "title": "" }, { "docid": "d1137028d871dd5f45c4d6885f34ed9b", "score": "0.7346688", "text": "def letter_counts(word)\n char_counts = Hash.new(0)\n word.chars.uniq.each {|ch| char_counts[ch] = word.count(ch)}\n char_counts\nend", "title": "" }, { "docid": "4b8d833bae04bed509ea61f8e909bfe2", "score": "0.73204637", "text": "def repeated_chars(word)\n hasher = Hash.new(0)\n arr = []\n count = 0\n if arr.empty?\n arr\n end\n word.each_char do |letters|\n if word.include?(letters)\n hasher[letters]+=1\n arr << letters\n end\n end\n p arr.any? { |i| \n arr.uniq!\n }\n p hasher\nend", "title": "" }, { "docid": "23cbdd31cca3480e38892f3caa3c4730", "score": "0.7310176", "text": "def duplicate_count(string)\n dup_letters = []\n string.downcase.chars.each do |char|\n dup_letters << char if string.downcase.count(char) > 1\n end\n dup_letters.uniq.size\nend", "title": "" }, { "docid": "33f5396c46ea985979c607d7725821b1", "score": "0.72674155", "text": "def non_unique_letters(string)\n str_arr = string.split(\" \")\n char_arr = str_arr.join(\"\").split(\"\")\n occur_arr = char_arr.select { |char| char_arr.count(char) > 1 }\n return occur_arr.uniq.sort\nend", "title": "" }, { "docid": "b3ddc58ce43301516aeebeedc2e872ae", "score": "0.7264735", "text": "def most_frequent_letter(string)\n result = Hash.new(0)\n\n string.split(\" \").each do |word|\n word.each_char { |char| result[char] += 1 }\n end\n\n result.key(result.values.max)\nend", "title": "" }, { "docid": "4c28b7978ad8a779a7143a2027ad47ca", "score": "0.7263757", "text": "def letter_counts(word)\n freq = Hash.new(0)\n word.chars.each{|ch| freq[ch] += 1 }\n freq\nend", "title": "" }, { "docid": "ea4e8bf0a7cbfd99cac18d2ed75dc580", "score": "0.72311836", "text": "def ordered_count(str)\n lts = str.chars.uniq\n lts.collect {|letter| [letter, str.count(letter)]}\nend", "title": "" }, { "docid": "b4488b9093773b382f4f76afaac8660d", "score": "0.7217077", "text": "def freq(char, string)\n return (0 .. string.length - 1).find_all { |i| string[i,1] == char }.length\nend", "title": "" }, { "docid": "f1b862fe768f679d3f1e72ae1b69af0c", "score": "0.7204432", "text": "def counted_characters(str)\n output = []\n str.each_char do |char|\n if str.count(char) > 2 && !output.include?(char)\n output << char\n end\n end\n output\nend", "title": "" }, { "docid": "0d74bc650ce2704672bfd511c723cb5f", "score": "0.71970314", "text": "def non_unique_letters(string)\n str = string.chars\n h = Hash.new(0)\n str.reject! { |o| o == ' '}\n str.each do |l|\n h[l] += 1\n end\n arr = Array.new\n h.each do |k, e|\n arr << k if e > 1\n end\n arr\nend", "title": "" }, { "docid": "158b592bc50df427eda0bd99c81071f6", "score": "0.71946", "text": "def non_unique_letters(string)\n\tsplitted_string = string.delete(\" \").split(\"\")\n\n\tcount = Hash.new 0\n\tnew_arr = []\n\n\tsplitted_string.each { |letter| count[letter] += 1 }\n\tcount.each { |k,v| new_arr << k if v > 1 }\n new_arr\n\nend", "title": "" }, { "docid": "f45bac5722fdd1698fc119374176094d", "score": "0.7179459", "text": "def non_unique_letters(string)\n arr = []\n hash = Hash.new(0)\n string.each_char do |ch|\n hash[ch] += 1 \n end\n hash.each do |key, value|\n if key != \" \"\n if value >= 2\n arr << key\n end\n end\n end\n \n return arr\nend", "title": "" }, { "docid": "ad5d169552f79e01f991db26e3a1fe41", "score": "0.7171845", "text": "def letter_count string\n frequency = {}\n string.each_char do |char|\n if frequency[char]\n frequency[char] += 1\n else frequency[char] = 1\n end\n end\n frequency\nend", "title": "" }, { "docid": "c7980782c038510c77aec88070933628", "score": "0.71718377", "text": "def get_char_count (string)\n array_of_chars = string.downcase.chars\n array_of_chars.select! do |letter|\n letter.match?(/[a-z0-9]/)\n end\n array_of_chars.uniq.sort.group_by {|char| array_of_chars.count(char)}\nend", "title": "" }, { "docid": "26c8713a2fec803213395c95d99c7485", "score": "0.7170651", "text": "def num_repeats(string)\n\talph = [\"a\", \"b\", \"c\", \"d\", \"e\", \"f\", \"g\", \"h\", \"i\", \"j\", \"k\", \"l\", \"m\", \"n\", \"o\", \"p\", \"q\", \"r\", \"s\", \"t\", \"u\", \"v\", \"w\", \"x\", \"y\", \"z\"]\n\t\n\ti = 0\n\trepeated_letter = {}\n\twhile i < string.length\n\t\trepeat_num = 0\n\t\tif string.count(string[i]) > 1\n\t\t\trepeat_num = string.count(string[i])\n\t\t\trepeated_letter[string[i]] = repeat_num\n\n\t\tend\n\n\t\ti +=1\n\tend\n\tarray = []\n\tarray = repeated_letter.keys\n\tputs array\n\treturn array.length\n\nend", "title": "" }, { "docid": "7975d4438e294a803d54f4cf664bb79e", "score": "0.71489775", "text": "def non_unique_letters(string)\n counts = Hash.new(0)\n string.chars.each do |character|\n counts[character] += 1 unless character == \" \"\n end\n non_uniques = []\n counts.each do |letter, count|\n non_uniques << letter if count > 1\n end\n non_uniques\nend", "title": "" }, { "docid": "6213af8abbe1ffcd469a747f09c6248b", "score": "0.71322715", "text": "def counted_characters(s)\r\n counted = Hash.new(0)\r\n\r\n s.chars.each {|c| counted[c] += 1 }\r\n counted.select {|k, v| v > 2}.keys\r\nend", "title": "" }, { "docid": "38557e3c52ba43c4e37e630eb79cea11", "score": "0.71236", "text": "def letterCount(text)\n freq = ('A'..'Z').to_a.zip([0]*26).to_h\n text.split('').each{|c| freq[c] += 1}\n return freq\nend", "title": "" }, { "docid": "fbd46a56b2b5a384e77b09984031ee70", "score": "0.71119004", "text": "def num_repeats(string)\n letters= string.split(\"\")\n frequencies = Hash.new(0)\n stuff.each {|letter| frequencies[letter] += 1}\n\n frequencies.delete_if {|letter, frequency| frequency <= 1 }\n\n frequencies.each {|letter, frequency| puts letter + \" \" + frequency.to_s}\n\n frequencies.length\nend", "title": "" }, { "docid": "8476aaad3a677a485a7a73ac4ece023b", "score": "0.71107304", "text": "def letter_counts(s)\n s.chars.group_by { |c| c }.map { |k, v| [k, v.length] }.to_h\nend", "title": "" }, { "docid": "f9a133a1923f1180039c33608c2dea52", "score": "0.7098674", "text": "def non_unique_letters(string)\n finalArray = []\n hash = Hash.new(0)\n array = string.split(\"\")\n array.each do |letter|\n hash[letter] += 1 if letter != \" \"\n end\n hash.keys.each do |key|\n if hash[key] > 1\n finalArray.push(key)\n end\n end\n return finalArray \nend", "title": "" }, { "docid": "7c5087ff623ea66da2b3c3340cf68d76", "score": "0.7095249", "text": "def letter_count(str)\n count = Hash.new(0) # Make a hash of for letters and frequencies\n str.split.join.chars.each do |x| # .split.join is just my quick way to remove spaces. See below for more info\n count[x] += 1 # For every character, make a key for the character\n end # and set it to its frequency \n count # Return the hash \nend", "title": "" }, { "docid": "5c6aa6940a791a8671d12dc7b241c8e8", "score": "0.7093312", "text": "def num_repeats(string)\n\n # Array to track letters that repeat\n repeats = []\n j = 1\n\n # Outer loop to check each letter\n for i in 0...string.length do\n # Inner loop checks every successive letter from the outer loop\n for k in j...string.length do\n # If the outer loop's letter isn't already counted...\n unless repeats.include?(string[i])\n # Add to the array if a repetition is found\n repeats << string[i] if string[i] == string[k]\n end\n end\n j += 1 # Inner loop index increase\n end\n\n # Return how many letters we found that repeat\n return repeats.size\nend", "title": "" }, { "docid": "53e01b373b9be1545c667c3aa9643c98", "score": "0.70894855", "text": "def most_frequent_letter(string)\n hash = Hash.new(0)\n string.split('').each do |char|\n hash[char] += 1 if char.between?('a','z')\n end\n ret = ''\n biggest = 0\n hash.each do |k,v|\n if v > biggest\n biggest = v\n ret = k\n end\n end\n ret\nend", "title": "" }, { "docid": "43de2e43cca99d5891c52fee7aafcec1", "score": "0.7087956", "text": "def LetterCountI(str)\n words = str.split(\" \")\n words_w_repeat = words.select do |word|\n word.downcase.chars.group_by { |char| char }.any? { |_, group| group.length > 1 }\n end\n\n words_w_repeat.first || -1\nend", "title": "" }, { "docid": "a35efff590fd56303a3682035c46f475", "score": "0.70837367", "text": "def occur(string, character)\n arr = []\n string.each_char do |x|\n if x == character\n arr.push(x)\n end\n end\n\n arr.size\nend", "title": "" }, { "docid": "6128b073e77ca5c0f31c1b1b83b78ab3", "score": "0.70792496", "text": "def letter_frequency(text)\n alphabet = (\"a\"..\"z\").to_a\n letter_to_freq = Hash.new(0)\n text.downcase.chars.each { |element| letter_to_freq[element] += 1 if alphabet.include?(element) }\n letter_to_freq.sort { |arr1, arr2| (arr2.last <=> arr1.last) == 0 ? (arr1.first <=> arr2.first) : (arr2.last <=> arr1.last) }\nend", "title": "" }, { "docid": "a0db0cb4cbe91f64e08a3d3099114d57", "score": "0.7071493", "text": "def count_letters(word)\n word_frequency=Hash.new(0)\n word.each_char{|c| word_frequency[c]+=1}\n max=0\n word_frequency.each{|c, d| max=d if d>max}\n return max\n end", "title": "" }, { "docid": "31b292a70b54766ea77dfe14fca6d615", "score": "0.70687026", "text": "def character_frequency(string)\n unsorted = convert_to_data_structure( create_string_hash(string) )\n\n unsorted.sort do |arr1, arr2|\n result = 0\n if arr1[1] > arr2[1]\n result = -1\n elsif arr1[1] < arr2[1]\n result = 1\n elsif arr1[0].ord < arr2[0].ord\n result = -1\n else\n result = 1\n end\n result\n end\nend", "title": "" }, { "docid": "0b1cc2d00da0697f1863bd2f711ea18f", "score": "0.7058455", "text": "def LetterCountI(str)\n str = str.split\n result = \"\"\n repeated = 0\n \n str.each do |word|\n if num_repeated(word) > repeated\n result = word\n repeated = num_repeated(word)\n end\n end\n \n return \"-1\" if result.length == 0\n \n return result\nend", "title": "" }, { "docid": "593b8e85a3721ce2237e6038c6dc434a", "score": "0.7050508", "text": "def letter_counts(word)\n letters_hash = Hash.new(0)\n word.chars { |char| letters_hash[char] += 1 }\n letters_hash\nend", "title": "" }, { "docid": "0057056890c9b3a87e68bf5c97e348a8", "score": "0.70481604", "text": "def count_letters(string)\n letter_frequency = Hash.new(0)\n arr = string.split(\"\")\n arr.reject! {|letter| letter == \" \"}\n arr.each { |letter| letter_frequency[letter] += 1 }\n letter_frequency\nend", "title": "" }, { "docid": "84ab2704bd715494592c3dffc9370d03", "score": "0.7040852", "text": "def non_unique_letters(string)\n result = []\n (\"a\"..\"z\").each do |ch|\n result << ch if string.count(ch) > 1\n end\n result\nend", "title": "" }, { "docid": "47a43786bbf35eb8a5f70346c1736a38", "score": "0.7023117", "text": "def most_frequent_letters(msg)\n letter_frequencies(msg)\n .map { |count| count[0] }\n end", "title": "" }, { "docid": "55aba5e5dc55bd2b3dab8beaeb3265ef", "score": "0.70192593", "text": "def most_common_letter(string)\n# str = string\n# mostCommonLetter = \"\"\n# mostCommonFreq = 0\n mostCommon = [\"\",0]\n \n i=0\n while i<string.length\n # For each letter, go through rest of string counting occurences of the letter. \n j=i+1\n freq=1\n while j<string.length\n if string[i]==string[j] \n freq += 1\n end\n j+=1\n end\n \n if freq>mostCommon[1]\n mostCommon[0] = string[i]\n mostCommon[1] = freq\n end\n \n i += 1\n end\n \n return mostCommon\n# return [mostCommonLetter, mostCommonFreq]\n \nend", "title": "" }, { "docid": "4af873835433b1d905bfe9a8162c3e26", "score": "0.7018239", "text": "def duplicates(str)\n\tletters={}\n count = 0\n str.each_char {|chara| letters.store(chara, str.count(chara))}\n letters.each {|k,v| count += (v-1) }\n return count\nend", "title": "" }, { "docid": "68a856a62edef5184df98547a3a8028a", "score": "0.70109403", "text": "def num_repeats(string)\n letter_count = get_letter_count(string)\n i = 0\n multiple_letter_count = 0\n while i < letter_count.length\n if letter_count[i][1] > 1\n multiple_letter_count += 1\n end\n i += 1\n end\n return multiple_letter_count\nend", "title": "" }, { "docid": "660b3983137eef9d1aa2d0b60a0fb9aa", "score": "0.7010926", "text": "def most_frequent_letter(string)\n hash = Hash.new(0)\n array = string.split(\"\")\n array.each do |letter|\n if letter != \" \"\n hash[letter] += 1\n end\n end\n hasher = hash.sort{|a,b| a[1] <=> b[1]}.last[0]\n return hasher\n \nend", "title": "" }, { "docid": "dcebeffa9b0d817f60e0c952ac9ae0ef", "score": "0.7010643", "text": "def num_repeats(string)\n counts = []\n\n str_idx = 0\n while str_idx < string.length\n letter = string[str_idx]\n\n counts_idx = 0\n while counts_idx < counts.length\n if counts[counts_idx][0] == letter\n counts[counts_idx][1] += 1\n break\n end\n counts_idx += 1\n end\n\n if counts_idx == counts.length\n # didn't find this letter in the counts array; count it for the\n # first time\n counts.push([letter, 1])\n end\n\n str_idx += 1\n end\n\n num_repeats = 0\n counts_idx = 0\n while counts_idx < counts.length\n if counts[counts_idx][1] > 1\n num_repeats += 1\n end\n\n counts_idx += 1\n end\n\n return num_repeats\nend", "title": "" }, { "docid": "dcebeffa9b0d817f60e0c952ac9ae0ef", "score": "0.7010643", "text": "def num_repeats(string)\n counts = []\n\n str_idx = 0\n while str_idx < string.length\n letter = string[str_idx]\n\n counts_idx = 0\n while counts_idx < counts.length\n if counts[counts_idx][0] == letter\n counts[counts_idx][1] += 1\n break\n end\n counts_idx += 1\n end\n\n if counts_idx == counts.length\n # didn't find this letter in the counts array; count it for the\n # first time\n counts.push([letter, 1])\n end\n\n str_idx += 1\n end\n\n num_repeats = 0\n counts_idx = 0\n while counts_idx < counts.length\n if counts[counts_idx][1] > 1\n num_repeats += 1\n end\n\n counts_idx += 1\n end\n\n return num_repeats\nend", "title": "" }, { "docid": "4ff16e11c5ad16d9c176f225a7bfd2e1", "score": "0.7008692", "text": "def letter_frequency\n freq = Hash.new(0)\n @text.each_char { |char| (freq[char] += 1) if char.match(/[a-zA-Z]/) }\n freq\n end", "title": "" }, { "docid": "a68a22906791933850c3cf57b5fc0ca8", "score": "0.7002515", "text": "def count_letters(string)\n\tletters = Hash.new(0)\n\tall_letters = string.delete(' ').split('')\n\tall_letters.each { |i| letters[i] += 1 }\n\tletters\nend", "title": "" }, { "docid": "be2c528d9e39545d4df55adac8e06c1a", "score": "0.6995903", "text": "def letter_counts(word)\n letters = Hash.new(0)\n word.each_char do |char|\n letters[char] += 1\n end\n return letters\nend", "title": "" }, { "docid": "c05252638c1d9b4a8ac5d065d4a4cac6", "score": "0.69826216", "text": "def string_letter_count_ms_x(s)\n s = s.downcase.gsub(/[^a-z]/, '').chars\n s.sort.uniq.map {|c| [s.count(c), c]}.join\nend", "title": "" }, { "docid": "3bf19e7b2db727a7400e6e0a0de64aaa", "score": "0.6980966", "text": "def duplicate_count(text)\n # arr = []\n # text.downcase.chars.each { |c| text.downcase.count(c) >= 2 && !arr.include?(c) ? arr << c : next }\n # arr.count\n # or \n\t('a'..'z').count { |c| text.downcase.count(c) > 1 }\nend", "title": "" }, { "docid": "9def73b725872592468668f4782c85ff", "score": "0.69785714", "text": "def double_letter_count(string)\n count = 0\n countArr = []\n\n string.split(\" \").each do |ele|\n countHash = Hash.new(0)\n\n ele.each_char do |let|\n countHash[let] += 1\n end\n \n countArr << countHash\n end\n\n countArr.each do |ele1|\n ele1.each do |k, v|\n if v >= 2\n count += 1\n else\n next\n end\n end\n end\n\n return count\n\nend", "title": "" }, { "docid": "bdc969baaa61f04a4bb5d41d3b1acf0c", "score": "0.6977546", "text": "def letter_counts(word)\n count = Hash.new(0)\n word.chars do |let|\n count[let] += 1\n end\n count\nend", "title": "" }, { "docid": "d71d31cab92d4ea9b5ba1902a1ab445e", "score": "0.6975649", "text": "def non_unique_letters(string)\n hash = Hash.new(0)\n string.split('').each do |char|\n hash[char] += 1 if char.between?('a','z')\n end\n ret =[]\n hash.each { |k,v| ret << k if v > 1 }\n ret\nend", "title": "" }, { "docid": "61a05ea0af251bd9fff90528fccfed63", "score": "0.697414", "text": "def count_letters(s)\n Hash[s.delete(' ').split('').group_by{ |c| c }.map{ |k, v| [k, v.size] }]\nend", "title": "" }, { "docid": "3bc149c2e3424dcf95189d9a646585bd", "score": "0.697051", "text": "def character_frequency str\n hash_var = Hash.new(0)\n str.split(\"\").map{ |ele| hash_var[ele] += 1 }\n return hash_var\nend", "title": "" }, { "docid": "23181de9eda0e767e448b3fcaa8c8b55", "score": "0.69663405", "text": "def count_freq_of_letter_in_string(string, letter_to_look_for)\n count = 0\n string.each do |letter|\n if letter == letter_to_look_for\n count += 1\n end # if\n end # each\n return count\nend", "title": "" }, { "docid": "065c2f50e406bca4eb40f8a9eb2c81ca", "score": "0.6964621", "text": "def letter_counts(word)\n hashed = {}\n word.each_char do |el|\n count = word.count el\n hashed[el] = count\n end \n hashed\nend", "title": "" }, { "docid": "ff39dddbaeb8981c2df71379d8e1390e", "score": "0.69646025", "text": "def character_frequency(string)\n character_hash = {}\n string.chars.each do |character|\n character_hash[character] ? character_hash[character] += 1 : character_hash[character] = 1 if character != \" \"\n end\n character_hash\nend", "title": "" }, { "docid": "403a6bb09fe161f82f67c069715278b2", "score": "0.6960861", "text": "def most_common_letter_count\n char = most_common_letter.first\n chars.select { |c| c if c == char }.size\n end", "title": "" }, { "docid": "f844ce530874df2411e94de322a65e2e", "score": "0.69394165", "text": "def char_freq(str)\n freqs = Hash.new(0)\n (1..4).each do |i|\n str.chars.each_cons(i).inject(freqs) do |freq, ngram|\n ngram = ngram.join\n freq[ngram] = freq[ngram] + 1\n freq\n end\n end\n freqs\n end", "title": "" }, { "docid": "ecb42d271ad735b20f5bc41eee427d24", "score": "0.6927696", "text": "def letters_frequency(word)\n word = word.downcase.gsub(/[\\W\\d_]/, '')\n frequency = {}\n word.each_char do |char|\n frequency[char] ||= 0\n frequency[char] += 1\n end\n return frequency\nend", "title": "" }, { "docid": "353e6549cbbd6045b68bf8dd3c21a870", "score": "0.69268596", "text": "def num_repeats(string)\n letter_cnt= {} # an empty Hash\n letter_cnt.default= 0 # Hashes have a default value that is returned when accessing keys that do not exist in the hash. If no default is set nil is used.\n \n letters= string.split('') # converts string into array of characters/one-letter-strings\n \n for letter in letters\n letter_cnt[letter]+= 1\n end\n \n num_repeats= 0\n letter_cnt.each do |key, value| # key is a letter, value is that letter's count\n num_repeats+= (value>1)? 1:0\n end\n \n return num_repeats\nend", "title": "" }, { "docid": "826b2f8736096280527364d8db61d878", "score": "0.6923506", "text": "def letter_counts(word)\n counts = Hash.new(0)\n word.each_char { |ch| counts[ch] += 1 }\n return counts\nend", "title": "" }, { "docid": "e51ef5fcdb70245e365befa0c2288634", "score": "0.69221944", "text": "def duplicate_count(text)\n duplicate_letter = []\n #text = text.downcase\n text.downcase.split(\"\").each{ |letter| (text.count(letter) >1)? duplicate_letter << letter : 0 }\n return duplicate_letter.uniq.size\nend", "title": "" }, { "docid": "43555f16aa8e444ad0c35b8f8911c16c", "score": "0.6921956", "text": "def most_common_letter(string)\n unique = string.chars.uniq\n maxChar = string[0]\n maxCount = string.chars.count maxChar\n unique.each do |char|\n count = string.count char\n if count > maxCount\n maxCount = count\n maxChar = char\n end\n end\n \n return [maxChar, maxCount] \nend", "title": "" }, { "docid": "a9964ca68c60a2f7d5f423974cf4afdc", "score": "0.69185114", "text": "def letter_counts(word)\n hash = Hash.new(0)\n word.chars.each { |ch| hash[ch] += 1}\n hash\nend", "title": "" }, { "docid": "b289f27bf9ff7aa0cc0b24c421b00ebc", "score": "0.6914201", "text": "def letter_counts(word)\n hash = Hash.new(0)\n letters = word.chars\n letters.each do |ch, value|\n hash[ch] += 1\n end\n return hash\nend", "title": "" }, { "docid": "ff7433428566151c70cd34aea696f684", "score": "0.6913594", "text": "def num_repeats(string)\n counter = 0\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# Number of repeating letters\n checked = []\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# Letters that have already been considered\n string.chars.each do |x|\t\t\t\t\t\t\t\t\t\t\t\t\t# Increment counter by 1 if the letter repeats\n counter += 1 if string.chars.count(x) > 1 unless checked.include?(x) # and hasn't been considered yet\n checked << x\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# The letter is now marked as considered\n end\n counter\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# Return the number of repeating letters\nend", "title": "" }, { "docid": "af49cbdee94519ce27fc775b5f226d70", "score": "0.6911014", "text": "def letter_counts(word)\n counts = Hash.new(0)\n word.chars.each do |el|\n counts[el] += 1\n end\n counts\nend", "title": "" }, { "docid": "22799063727126227e3f8f3ea901e8b5", "score": "0.69083375", "text": "def letters_method(string)\n clean_string = string.downcase.delete(\" \\t\\r\\n\")\n char_tracker = Hash.new(0)#every new element we create will start with\n #default 0 value.\n clean_string.each { |l| char_tracker[l] +=1 }\n\n puts char_tracker.select { |k,v| v > 1 }.keys.sort.join\n end", "title": "" }, { "docid": "aeb898ee99e4b30cf18703e285df31a4", "score": "0.6901935", "text": "def letter_frequency(text) \n answer = text.downcase.gsub(/[^a-z]/,\"\")\n .split(\"\").each_with_object(Hash.new(0)) { |item, hash| hash[item] += 1 }\n .sort_by {|word, freq| [-freq, word] }.to_a\nend", "title": "" }, { "docid": "21e501c71e8fcabb4cff5daf364f11c5", "score": "0.68938607", "text": "def most_common_letter(string)\n most_common_letter = 0\n most_common_letter_count = 0\n\n i = 0\n while i < string.length\n letter = string[i]\n count = 0\n\n ii = 0\n while ii < string.length\n if string[ii] == letter\n count = count + 1\n end\n ii = ii + 1\n end\n\n if most_common_letter_count == 0 || count > most_common_letter_count\n most_common_letter = letter\n most_common_letter_count = count\n end\n\n i = i + 1\n end\n return [most_common_letter, most_common_letter_count]\n\nend", "title": "" }, { "docid": "799653f8e35e6b64984fdd991b905902", "score": "0.68937176", "text": "def letter_count(str)\n frequencies = {}\n\tletters = str.split('')\n\tletters.each do |letter|\n frequencies[letter] = letters.count(letter)\n\tend\n\tfrequencies.delete(\" \")\n\tfrequencies\nend", "title": "" }, { "docid": "cb392a7db3e58db390669b465b197224", "score": "0.68882316", "text": "def num_repeats(string)\n count = 0 #overall count, will return later\n stringHash = Hash.new # create new hash\n\n string.chars.each do |i| # loop through each letter in string\n stringHash[i] = string.count(i) # create a key in the hash and set the value to the to the number of occurrences of the given key\n end\n stringHash.each do |k,v| #loop through the hash\n if v > 1 # if the vale is greater than 1\n count += 1 # add 1 to the overall count\n end\n end\n return count # return overall count\nend", "title": "" }, { "docid": "8b4641a14cd6ba766c84866372eb67f6", "score": "0.68851036", "text": "def repeated_chars(word)\n repeated_chars = []\n largest_index_explored = 0\n\n i = 0\n while i < word.length\n j = i + 1\n\n while j < word.length - 1\n if word[i] == word[j]\n repeated_chars << word[i]\n end\n\n largest_index_explored = j\n break\n j += 1\n end\n\n i += 1\n end\n\n repeated_chars\nend", "title": "" } ]
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "6721ee8c8fc7c68d7db5fd0ca8a5f826", "score": "0.0", "text": "def set_product\n @product = Product.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60339177", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.60135007", "text": "def on_setup_callbacks; end", "title": "" }, { "docid": "311e95e92009c313c8afd74317018994", "score": "0.59219855", "text": "def setup_actions\n domain = @apps.domain\n path_user = '/a/feeds/'+domain+'/user/2.0'\n path_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n path_email_list = '/a/feeds/'+domain+'/emailList/2.0'\n path_group = '/a/feeds/group/2.0/'+domain\n\n @apps.register_action(:domain_login, {:method => 'POST', :path => '/accounts/ClientLogin' })\n @apps.register_action(:user_create, { :method => 'POST', :path => path_user })\n @apps.register_action(:user_retrieve, { :method => 'GET', :path => path_user+'/' })\n @apps.register_action(:user_retrieve_all, { :method => 'GET', :path => path_user })\n @apps.register_action(:user_update, { :method => 'PUT', :path => path_user +'/' })\n @apps.register_action(:user_delete, { :method => 'DELETE', :path => path_user +'/' })\n @apps.register_action(:nickname_create, { :method => 'POST', :path =>path_nickname })\n @apps.register_action(:nickname_retrieve, { :method => 'GET', :path =>path_nickname+'/' })\n @apps.register_action(:nickname_retrieve_all_for_user, { :method => 'GET', :path =>path_nickname+'?username=' })\n @apps.register_action(:nickname_retrieve_all_in_domain, { :method => 'GET', :path =>path_nickname })\n @apps.register_action(:nickname_delete, { :method => 'DELETE', :path =>path_nickname+'/' })\n @apps.register_action(:group_create, { :method => 'POST', :path => path_group })\n @apps.register_action(:group_update, { :method => 'PUT', :path => path_group })\n @apps.register_action(:group_retrieve, { :method => 'GET', :path => path_group })\n @apps.register_action(:group_delete, { :method => 'DELETE', :path => path_group })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>'' })\n end", "title": "" }, { "docid": "8315debee821f8bfc9718d31b654d2de", "score": "0.5913137", "text": "def initialize(*args)\n super\n @action = :setup\nend", "title": "" }, { "docid": "8315debee821f8bfc9718d31b654d2de", "score": "0.5913137", "text": "def initialize(*args)\n super\n @action = :setup\nend", "title": "" }, { "docid": "bfea4d21895187a799525503ef403d16", "score": "0.589884", "text": "def define_action_helpers\n super\n define_validation_hook if runs_validations_on_action?\n end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5890051", "text": "def actions; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5890051", "text": "def actions; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5890051", "text": "def actions; end", "title": "" }, { "docid": "352de4abc4d2d9a1df203735ef5f0b86", "score": "0.5889191", "text": "def required_action\n # TODO: implement\n end", "title": "" }, { "docid": "8713cb2364ff3f2018b0d52ab32dbf37", "score": "0.58780754", "text": "def define_action_helpers\n if action == :save\n if super(:create_or_update)\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n else\n super\n end\n end", "title": "" }, { "docid": "a80b33627067efa06c6204bee0f5890e", "score": "0.5863248", "text": "def actions\n\n end", "title": "" }, { "docid": "930a930e57ae15f432a627a277647f2e", "score": "0.58094144", "text": "def setup_actions\n domain = @apps.domain\n path_base = '/a/feeds/emailsettings/2.0/'+domain+'/'\n\n @apps.register_action(:create_label, {:method => 'POST', :path => path_base })\n @apps.register_action(:create_filter, { :method => 'POST', :path => path_base })\n @apps.register_action(:create_send_as, { :method => 'POST', :path => path_base })\n @apps.register_action(:update_webclip, { :method => 'PUT', :path => path_base })\n @apps.register_action(:update_forward, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_pop, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_imap, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_vacation, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_signature, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_language, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_general, { :method => 'PUT', :path =>path_base })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>nil })\n end", "title": "" }, { "docid": "33ff963edc7c4c98d1b90e341e7c5d61", "score": "0.57375425", "text": "def setup\n common_setup\n end", "title": "" }, { "docid": "a5ca4679d7b3eab70d3386a5dbaf27e1", "score": "0.57285565", "text": "def perform_setup\n end", "title": "" }, { "docid": "ec7554018a9b404d942fc0a910ed95d9", "score": "0.57149214", "text": "def before_setup(&block)\n pre_setup_actions.unshift block\n end", "title": "" }, { "docid": "9c186951c13b270d232086de9c19c45b", "score": "0.5703237", "text": "def callbacks; end", "title": "" }, { "docid": "c85b0efcd2c46a181a229078d8efb4de", "score": "0.56900954", "text": "def custom_setup\n\n end", "title": "" }, { "docid": "100180fa74cf156333d506496717f587", "score": "0.56665677", "text": "def do_setup\n\t\tget_validation\n\t\tprocess_options\n\tend", "title": "" }, { "docid": "2198a9876a6ec535e7dcf0fd476b092f", "score": "0.5651118", "text": "def initial_action; end", "title": "" }, { "docid": "b9b75a9e2eab9d7629c38782c0f3b40b", "score": "0.5648135", "text": "def setup_intent; end", "title": "" }, { "docid": "471d64903a08e207b57689c9fbae0cf9", "score": "0.56357735", "text": "def setup_controllers &proc\n @global_setup = proc\n self\n end", "title": "" }, { "docid": "468d85305e6de5748477545f889925a7", "score": "0.5627078", "text": "def inner_action; end", "title": "" }, { "docid": "bb445e7cc46faa4197184b08218d1c6d", "score": "0.5608873", "text": "def pre_action\n # Override this if necessary.\n end", "title": "" }, { "docid": "432f1678bb85edabcf1f6d7150009703", "score": "0.5598699", "text": "def target_callbacks() = commands", "title": "" }, { "docid": "48804b0fa534b64e7885b90cf11bff31", "score": "0.5598419", "text": "def execute_callbacks; end", "title": "" }, { "docid": "5aab98e3f069a87e5ebe77b170eab5b9", "score": "0.5589822", "text": "def api_action!(*args)\n type = self.class.name.split(\"::\").last.downcase\n run_callbacks_for([\"before_#{type}\", :before], *args)\n result = nil\n begin\n result = yield if block_given?\n run_callbacks_for([\"after_#{type}\", :after], *args)\n result\n rescue => err\n run_callbacks_for([\"failed_#{type}\", :failed], *(args + [err]))\n raise\n end\n end", "title": "" }, { "docid": "9efbca664902d80a451ef6cff0334fe2", "score": "0.5558845", "text": "def global_callbacks; end", "title": "" }, { "docid": "9efbca664902d80a451ef6cff0334fe2", "score": "0.5558845", "text": "def global_callbacks; end", "title": "" }, { "docid": "482481e8cf2720193f1cdcf32ad1c31c", "score": "0.55084664", "text": "def required_keys(action)\n\n end", "title": "" }, { "docid": "353fd7d7cf28caafe16d2234bfbd3d16", "score": "0.5504379", "text": "def assign_default_callbacks(action_name, is_member=false)\n if ResourceController::DEFAULT_ACTIONS.include?(action_name)\n DefaultActions.send(action_name, self)\n elsif is_member\n send(action_name).build { load_object }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => object }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { render :xml => object.errors }\n else\n send(action_name).build { load_collection }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => collection }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { head 500 }\n end\n end", "title": "" }, { "docid": "dcf95c552669536111d95309d8f4aafd", "score": "0.5465574", "text": "def layout_actions\n \n end", "title": "" }, { "docid": "2f6ef0a1ebe74f4d79ef0fb81af59d40", "score": "0.5464707", "text": "def on_setup(&block); end", "title": "" }, { "docid": "8ab2a5ea108f779c746016b6f4a7c4a8", "score": "0.54471064", "text": "def testCase_001\n test_case_title # fw3_actions.rb\n setup # fw3_global_methods.rb\n \n get_page_url # fw3_actions.rb\n validate_page_title # fw3_actions.rb\n validate_page_link_set # fw3_actions.rb\n \n teardown # fw3_global_methods.rb\nend", "title": "" }, { "docid": "e3aadf41537d03bd18cf63a3653e05aa", "score": "0.54455084", "text": "def before(action)\n invoke_callbacks *options_for(action).before\n end", "title": "" }, { "docid": "6bd37bc223849096c6ea81aeb34c207e", "score": "0.5437386", "text": "def post_setup\n end", "title": "" }, { "docid": "07fd9aded4aa07cbbba2a60fda726efe", "score": "0.54160327", "text": "def testCase_001\n testTitle # fw2_actions.rb\n setup # fw2_global_methods.rb\n get_page_url # fw2_actions.rb\n validate_title # fw2_actions.rb\n teardown # fw2_global_methods.rb\nend", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5411113", "text": "def action_methods; end", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5411113", "text": "def action_methods; end", "title": "" }, { "docid": "9358208395c0869021020ae39071eccd", "score": "0.5397424", "text": "def post_setup; end", "title": "" }, { "docid": "cb5bad618fb39e01c8ba64257531d610", "score": "0.5392518", "text": "def define_model_action(methods,action,default_options={:validate => true})\n default_options.merge!(methods.extract_options!)\n actions = [action,\"#{action}!\".to_sym]\n actions.each do |a|\n define_method(a) do |opts = {}|\n rslt = nil\n options = default_options.merge(opts)\n options[:raise_exception] = a.to_s.match(/\\!$/)\n run_callbacks(action) do\n rslt = run_model_action(methods,options)\n end\n run_after_any\n rslt\n end\n end\n end", "title": "" }, { "docid": "c5904f93614d08afa38cc3f05f0d2365", "score": "0.5391541", "text": "def before_setup; end", "title": "" }, { "docid": "c5904f93614d08afa38cc3f05f0d2365", "score": "0.5391541", "text": "def before_setup; end", "title": "" }, { "docid": "a468b256a999961df3957e843fd9bdf4", "score": "0.5385411", "text": "def _setup\n setup_notification_categories\n setup_intelligent_segments\n end", "title": "" }, { "docid": "f099a8475f369ce73a38d665b6ee6877", "score": "0.53794575", "text": "def action_run\n end", "title": "" }, { "docid": "2c4e5a90aa8efaaa3ed953818a9b30d2", "score": "0.5357573", "text": "def execute(setup)\n @action.call(setup)\n end", "title": "" }, { "docid": "118932433a8cfef23bb8a921745d6d37", "score": "0.53487605", "text": "def register_action(action); end", "title": "" }, { "docid": "725216eb875e8fa116cd55eac7917421", "score": "0.5346655", "text": "def setup\n @controller.setup\n end", "title": "" }, { "docid": "39c39d6fe940796aadbeaef0ce1c360b", "score": "0.53448105", "text": "def setup_phase; end", "title": "" }, { "docid": "bd03e961c8be41f20d057972c496018c", "score": "0.5342072", "text": "def post_setup\n controller.each do |name,ctrl|\n ctrl.post_setup\n end\n end", "title": "" }, { "docid": "c6352e6eaf17cda8c9d2763f0fbfd99d", "score": "0.5341318", "text": "def initial_action=(_arg0); end", "title": "" }, { "docid": "207a668c9bce9906f5ec79b75b4d8ad7", "score": "0.53243506", "text": "def before_setup\n\n end", "title": "" }, { "docid": "669ee5153c4dc8ee81ff32c4cefdd088", "score": "0.53025913", "text": "def ensure_before_and_after; end", "title": "" }, { "docid": "c77ece7b01773fb7f9f9c0f1e8c70332", "score": "0.5283114", "text": "def setup!\n adding_handlers do\n check_arity\n apply_casting\n check_validation\n end\n end", "title": "" }, { "docid": "1e1e48767a7ac23eb33df770784fec61", "score": "0.5282289", "text": "def set_minimum_up_member_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "title": "" }, { "docid": "4ad1208a9b6d80ab0dd5dccf8157af63", "score": "0.52585614", "text": "def rails_controller_callbacks(&block)\n rails_controller_instance.run_callbacks(:process_action, &block)\n end", "title": "" }, { "docid": "63a9fc1fb0dc1a7d76ebb63a61ed24d7", "score": "0.52571374", "text": "def define_callbacks(*args)\n if abstract_class\n all_shards.each do |model|\n model.define_callbacks(*args)\n end\n end\n\n super\n end", "title": "" }, { "docid": "fc88422a7a885bac1df28883547362a7", "score": "0.52483684", "text": "def pre_setup_actions\n @@pre_setup_actions ||= []\n end", "title": "" }, { "docid": "8945e9135e140a6ae6db8d7c3490a645", "score": "0.5244467", "text": "def action_awareness\n if action_aware?\n if !@options.key?(:allow_nil)\n if @required\n @allow_nil = false\n else\n @allow_nil = true\n end\n end\n if as_action != \"create\"\n @required = false\n end\n end\n end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52385926", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52385926", "text": "def action; end", "title": "" }, { "docid": "7b3954deb2995cf68646c7333c15087b", "score": "0.5236853", "text": "def after_setup\n end", "title": "" }, { "docid": "1dddf3ac307b09142d0ad9ebc9c4dba9", "score": "0.52330637", "text": "def external_action\n raise NotImplementedError\n end", "title": "" }, { "docid": "5772d1543808c2752c186db7ce2c2ad5", "score": "0.52300817", "text": "def actions(state:)\n raise NotImplementedError\n end", "title": "" }, { "docid": "64a6d16e05dd7087024d5170f58dfeae", "score": "0.522413", "text": "def setup_actions(domain)\n\t\t\tpath_user = '/a/feeds/'+domain+'/user/2.0'\n\t\t\tpath_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n\t\t\tpath_group = '/a/feeds/group/2.0/'+domain # path for Google groups\n\n\t\t\taction = Hash.new\n\t\t\taction[:domain_login] = {:method => 'POST', :path => '/accounts/ClientLogin' }\n\t\t\taction[:user_create] = { :method => 'POST', :path => path_user }\n\t\t\taction[:user_retrieve] = { :method => 'GET', :path => path_user+'/' }\n\t\t\taction[:user_retrieve_all] = { :method => 'GET', :path => path_user } \n\t\t\taction[:user_update] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_rename] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_delete] = { :method => 'DELETE', :path => path_user +'/' }\n\t\t\taction[:nickname_create] = { :method => 'POST', :path =>path_nickname }\n\t\t\taction[:nickname_retrieve] = { :method => 'GET', :path =>path_nickname+'/' }\n\t\t\taction[:nickname_retrieve_all_for_user] = { :method => 'GET', :path =>path_nickname+'?username=' }\n\t\t\taction[:nickname_retrieve_all_in_domain] = { :method => 'GET', :path =>path_nickname }\n\t\t\taction[:nickname_delete] = { :method => 'DELETE', :path =>path_nickname+'/' }\n\t\t\taction[:group_create] = { :method => 'POST', :path =>path_group }\n\t\t\taction[:group_update] = { :method => 'PUT', :path =>path_group+'/' }\n\t\t\taction[:group_delete] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:groups_retrieve] = { :method => 'GET', :path =>path_group+'?member=' }\n\t\t\taction[:all_groups_retrieve] = { :method => 'GET', :path =>path_group }\n\t\t\taction[:membership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:membership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:membership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_members_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:ownership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:ownership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:ownership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_owners_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\n\t\t\t# special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n\t\t\taction[:next] = {:method => 'GET', :path =>nil }\n\t\t\treturn action \t\n\t\tend", "title": "" }, { "docid": "6350959a62aa797b89a21eacb3200e75", "score": "0.52226824", "text": "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "title": "" }, { "docid": "db0cb7d7727f626ba2dca5bc72cea5a6", "score": "0.521999", "text": "def process_params\n set_params_authable if process_params_authable?\n set_params_ownerable if process_params_ownerable?\n set_params_sub_action\n end", "title": "" }, { "docid": "8d7ed2ff3920c2016c75f4f9d8b5a870", "score": "0.5215832", "text": "def pick_action; end", "title": "" }, { "docid": "7bbfb366d2ee170c855b1d0141bfc2a3", "score": "0.5213786", "text": "def proceed_with(action, *arguments)\n self.class.decouplings.each do |decoupler|\n decoupler.run_on(self, action, *arguments)\n end\n end", "title": "" }, { "docid": "78ecc6a2dfbf08166a7a1360bc9c35ef", "score": "0.52100146", "text": "def define_action_helpers\n if action_hook\n @action_hook_defined = true\n define_action_hook\n end\n end", "title": "" }, { "docid": "2aba2d3187e01346918a6557230603c7", "score": "0.52085197", "text": "def ac_action(&blk)\n @action = blk\n end", "title": "" }, { "docid": "4c23552739b40c7886414af61210d31c", "score": "0.5203262", "text": "def execute_pre_setup_actions(test_instance,runner=nil)\n self.class.pre_setup_actions.each do |action|\n action.call test_instance\n end\n end", "title": "" }, { "docid": "691d5a5bcefbef8c08db61094691627c", "score": "0.5202406", "text": "def performed(action)\n end", "title": "" }, { "docid": "6a98e12d6f15af80f63556fcdd01e472", "score": "0.520174", "text": "def perform_setup\n ## Run global setup before example\n Alfred.configuration.setup.each do |setup|\n @request.perform_setup(&setup)\n end\n\n ## Run setup blocks for scenario\n setups.each { |setup| @request.perform_setup(&setup) }\n end", "title": "" }, { "docid": "d56f4ec734e3f3bc1ad913b36ff86130", "score": "0.5201504", "text": "def create_setup\n \n end", "title": "" }, { "docid": "ad33138fb4bd42d9785a8f84821bfd88", "score": "0.51963276", "text": "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "title": "" }, { "docid": "ad33138fb4bd42d9785a8f84821bfd88", "score": "0.51963276", "text": "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "title": "" }, { "docid": "7fca702f2da4dbdc9b39e5107a2ab87d", "score": "0.5191404", "text": "def add_transition_callbacks\n %w(before after).each {|type| owner_class.define_callbacks(\"#{type}_transition_#{attribute}\") }\n end", "title": "" }, { "docid": "063b82c93b47d702ef6bddadb6f0c76e", "score": "0.5178325", "text": "def setup(instance)\n action(:setup, instance)\n end", "title": "" }, { "docid": "9f1f73ee40d23f6b808bb3fbbf6af931", "score": "0.51765746", "text": "def setup( *args )\n\t\t\tself.class.setupMethods.each {|sblock|\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\tend", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.51710224", "text": "def setup(resources) ; end", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.51710224", "text": "def setup(resources) ; end", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.51710224", "text": "def setup(resources) ; end", "title": "" }, { "docid": "7a0c9d839516dc9d0014e160b6e625a8", "score": "0.5162045", "text": "def setup(request)\n end", "title": "" }, { "docid": "e441ee807f2820bf3655ff2b7cf397fc", "score": "0.5150735", "text": "def after_setup; end", "title": "" }, { "docid": "1d375c9be726f822b2eb9e2a652f91f6", "score": "0.5143402", "text": "def before *actions, &proc\n actions = ['*'] if actions.size == 0\n actions.each { |a| @callbacks[:a][a] = proc }\n end", "title": "" }, { "docid": "c594a0d7b6ae00511d223b0533636c9c", "score": "0.51415485", "text": "def code_action_provider; end", "title": "" }, { "docid": "faddd70d9fef5c9cd1f0d4e673e408b9", "score": "0.51398855", "text": "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "title": "" }, { "docid": "2fcff037e3c18a5eb8d964f8f0a62ebe", "score": "0.51376045", "text": "def setup(params)\n end", "title": "" }, { "docid": "111fd47abd953b35a427ff0b098a800a", "score": "0.51318985", "text": "def setup\n make_notification_owner\n load_superusers\n admin_sets.each do |as|\n @logger.debug \"Attempting to make admin set for #{as}\"\n make_admin_set_from_config(as)\n end\n load_workflows\n everyone_can_deposit_everywhere\n give_superusers_superpowers\n end", "title": "" }, { "docid": "f2ac709e70364fce188bb24e414340ea", "score": "0.5115387", "text": "def setup_defaults\n add_help\n @handler = Cliqr::Util.forward_to_help_handler if @handler.nil? && help? && actions?\n @actions.each(&:setup_defaults)\n end", "title": "" }, { "docid": "3b4fb29fa45f95d436fd3a8987f12de7", "score": "0.5111866", "text": "def setup\n transition_to(:setup)\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5110294", "text": "def action\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5110294", "text": "def action\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5110294", "text": "def action\n end", "title": "" }, { "docid": "4c7a1503a86fb26f1e4b4111925949a2", "score": "0.5109771", "text": "def scaffold_setup_helper\n include ScaffoldingExtensions::Helper\n include ScaffoldingExtensions::MerbControllerHelper\n include ScaffoldingExtensions::PrototypeHelper\n include ScaffoldingExtensions::Controller\n include ScaffoldingExtensions::MerbController\n before :scaffold_check_nonidempotent_requests\n end", "title": "" }, { "docid": "63849e121dcfb8a1b963f040d0fe3c28", "score": "0.5107364", "text": "def perform_action(action, item)\n if action == :approve\n approve(item.fullid)\n elsif action == :remove\n remove(item.fullid)\n elsif action == :alert\n #perform_alert() check condition alert params and proceed\n else\n #something isn't cool, pass or error \n end\nend", "title": "" }, { "docid": "f04fd745d027fc758dac7a4ca6440871", "score": "0.5106081", "text": "def block_actions options ; end", "title": "" }, { "docid": "0d1c87e5cf08313c959963934383f5ae", "score": "0.51001656", "text": "def on_action(action)\n @action = action\n self\n end", "title": "" }, { "docid": "916d3c71d3a5db831a5910448835ad82", "score": "0.50964546", "text": "def do_action(action)\n case action\n when \"a\"\n @user_manager.create_user\n when \"b\"\n @user_manager.delete_user\n when \"c\"\n @user_manager.get_info\n when \"d\"\n @user_manager.list_all_users\n when \"quit\", \"exit\"\n bail\n end\n end", "title": "" }, { "docid": "076c761e1e84b581a65903c7c253aa62", "score": "0.5093199", "text": "def add_callbacks(base); end", "title": "" } ]
7475a2f168a72743972418f05ac99e1e
Retorna true si el usuario es administrador de una cuenta
[ { "docid": "1e41e4da95d5bd23f752054d98478445", "score": "0.0", "text": "def jefe_tecnico?\n return self.tipo_usuario== JEFE_TECNICO\n end", "title": "" } ]
[ { "docid": "bbb502944fe2f5d847fc24a59ba1110f", "score": "0.80806094", "text": "def admin?\n (current_user.class.to_s==\"Administrador\")? true : false\n end", "title": "" }, { "docid": "3fa692f0e2bfc76c38e68a15ef20ebea", "score": "0.7954798", "text": "def administrador?\n self.has_role?(:administrador)\n end", "title": "" }, { "docid": "2bd102fd04fb8e64d9569ebc46d7cf81", "score": "0.79356754", "text": "def administrator?\n uid == 1\n end", "title": "" }, { "docid": "bd9556bc70194579106df1b106c56049", "score": "0.7844467", "text": "def admin?\n (session[:drupal_user_role] && session[:drupal_user_role].values.include?('administrator')) ? true : false\n end", "title": "" }, { "docid": "1f557b7c4d248ade0861af1d8b49aea7", "score": "0.7801677", "text": "def admin_user?\n current_user.admin != 0\n end", "title": "" }, { "docid": "995dd9ec498b21b42902ec9a93eadf8b", "score": "0.7798386", "text": "def admin_user?\n user_role == MEMBER_TYPE[:admin]\n end", "title": "" }, { "docid": "6db9d5d1bd07e2ddf9e1dfc359ebf463", "score": "0.7745515", "text": "def isuseradmin?\n if $credentials != nil\n isadminornot = User.where(:username => $credentials[0]).to_a.first\n @adminuser = \"#{isadminornot.username}\"\n if @adminuser == \"Admin\"\n return true\n else \n return false\n end\n end \n end", "title": "" }, { "docid": "2919ae323c90191a2dd15023078e1933", "score": "0.77407205", "text": "def manage?\n user and user.valeur_privilege(:administrateur) == true\n end", "title": "" }, { "docid": "3542d35599f1a4424dbe906ad2f3d921", "score": "0.77208835", "text": "def is_administrator\n if current_user && current_user.is_administrator\n return true\n else\n return false\n end\n end", "title": "" }, { "docid": "096aa1a6af2b730487e744388c01bbf2", "score": "0.7720244", "text": "def admin?\n\t\tu = User.get(session[:uid])\n\t\treturn false if u.org == 0\n\t\treturn false if !u.active\n\n\t\treturn u.admin\n\tend", "title": "" }, { "docid": "591dd93060c978663e57618d790f3b1f", "score": "0.77180374", "text": "def admin?\n return self.tipo_usuario == ADMIN\n end", "title": "" }, { "docid": "c972b7ead0c375567095ac700eca73af", "score": "0.77143556", "text": "def administratorLoggedIn?\n\t\tadministrators = [\"davenportw15\"]\n\t\tif loggedIn? and administrators.include?(session[:user][:username])\n\t\t\treturn true\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend", "title": "" }, { "docid": "2510ae36e2c720175105019ef1f4cd53", "score": "0.77124476", "text": "def is_admin?(user)\n $alladmins.include?(user.authname.to_s) && user.authed? == true\n end", "title": "" }, { "docid": "b2acc45c0a8c96d6fc12a4b7e3ba8ed3", "score": "0.77012736", "text": "def user_is_admin()\n site_admins = ENV[\"VOICES_ADMINS\"].split(\"#\")\n if site_admins.include? session[:cas_user]\n return true\n else\n return false\n end\n end", "title": "" }, { "docid": "652c1b2aa1b0a16cccf9a2b69534a1c3", "score": "0.7696657", "text": "def admin_user?\n current_user == 'akiyama'\n end", "title": "" }, { "docid": "49e45c7fe675d17c3515cc4d653fc3ba", "score": "0.7681039", "text": "def admin?\n username == 'davidcelis'\n end", "title": "" }, { "docid": "8aaac0c8e4ae95f2d11c37e6562e0888", "score": "0.7681036", "text": "def user_admin?\n current_user.account_type == 'Admin'\n end", "title": "" }, { "docid": "0e6591d5ab13e70690b408fa03483c22", "score": "0.76621544", "text": "def administrating?(file)\n administrator? && (login != file.depositor && !file.edit_users.include?(login))\n end", "title": "" }, { "docid": "5c8e942712cdcd9344f1a9bb12d395ce", "score": "0.7644947", "text": "def is_admin?\n login == ADMIN_LOGIN\n end", "title": "" }, { "docid": "71a1ef754369ce4e58de63ef206f3964", "score": "0.76391053", "text": "def admin?\n result = false\n if current_user != nil && ADMIN_ID == current_user.id.to_s\n result = true\n end\n result\n end", "title": "" }, { "docid": "eff0cea0231034fffe7c4680258e9c4d", "score": "0.7634516", "text": "def users?\n !!current_user && current_user.admin?\n end", "title": "" }, { "docid": "145da3fc17db0dee9bfa30bfabba8e5c", "score": "0.7632171", "text": "def admin_user?\r\n logged_in? and current_user.admin?\r\n end", "title": "" }, { "docid": "346931c8af35790ef56b2e01320e5bbd", "score": "0.76223844", "text": "def admin?(user)\n if user.email == 'mrdougwright@gmail.com' or user.email == 'janekim9321@gmail.com'\n return true\n else\n return false\n end\n end", "title": "" }, { "docid": "a1b302d2b560bcc8b606bda9bb4cbc1c", "score": "0.76204354", "text": "def is_admin?\n self.user_status == 'admin'\n end", "title": "" }, { "docid": "4cffa1a43103f17587b06120cebe92d1", "score": "0.76181513", "text": "def admin?\n session[:usuario] and session[:usuario][:tipo] == 'admin'\n end", "title": "" }, { "docid": "7efbcefa67b00624a0247b177d938d4a", "score": "0.76167035", "text": "def admin?\n\tlogged_in? && current_user.Privilege==\"Admin\"\n end", "title": "" }, { "docid": "2e96b2e8b9aab4d0cd14044ba12e415f", "score": "0.76137054", "text": "def admin?\n\t\t\tcurrent_user && current_user.username == \"admin\"\n\t\tend", "title": "" }, { "docid": "7cdc79e368a6fe27a24018b7de811aff", "score": "0.76058733", "text": "def admin?\n current_user && (current_user.login==MDSL_SUPER_USER) \n end", "title": "" }, { "docid": "58c087c5c6a042bba19016efc1efdac4", "score": "0.76048857", "text": "def is_admin\n user = User.find_by_id(session[:user_id])\n if user and user.roles.exists?(:name => 'Administrative')\n return true\n end\n return false\n end", "title": "" }, { "docid": "7adb2ab19eb0acf8fd6787a367f7dfa4", "score": "0.7604378", "text": "def admin?\n session[:user] and session[:user][:tipo] == 'admin'\n end", "title": "" }, { "docid": "d92002051ee97926cd8fb5678ab7d19a", "score": "0.7601922", "text": "def is_admin\n admin = Configuration.find_by_key(\"admin\")\n if admin\n return fel_id[:user_id] == admin.value\n else\n return false\n end\n end", "title": "" }, { "docid": "47855ea3477e8d1f07e9910436ad1ed7", "score": "0.76013744", "text": "def admin?\n\t\tcurrent_user && current_user.administrator\t\t\t\t\n\tend", "title": "" }, { "docid": "de34e6c17149c187133655cc4f9cea02", "score": "0.75996614", "text": "def are_you_admin?\n if current_user.email == \"laurenceweening@gmail.com\" && \"test@example.com\"\n return true\n end\n end", "title": "" }, { "docid": "52f1c4c77cdfc94883ff6c368fbed31a", "score": "0.7599077", "text": "def is_admin_user?\n false\n #is_logged_in? && (is_admin? || is_manager? || is_division_rep?)\n end", "title": "" }, { "docid": "a241c901cd6fb6ca2995600b026db3c2", "score": "0.75967985", "text": "def users?\n @user.can_org_admin?\n end", "title": "" }, { "docid": "a241c901cd6fb6ca2995600b026db3c2", "score": "0.75967985", "text": "def users?\n @user.can_org_admin?\n end", "title": "" }, { "docid": "8b78d31c27ac91d0145c8682c9dc4f1f", "score": "0.7586256", "text": "def is_admin?\n unless self.groups.find_by_is_the_administrators_group(true).blank?\n return true\n else\n return false\n end\n end", "title": "" }, { "docid": "783658f4d3aaf7b69af803d757660127", "score": "0.75815433", "text": "def admin?\n if session[:user_id]\n User.find(session[:user_id]).admin\n else\n false\n end\n end", "title": "" }, { "docid": "0a8b157fc41a05572d98b884696ff60e", "score": "0.75806874", "text": "def is_admin?\n current_user ? current_user.login == \"admin\" : false\n end", "title": "" }, { "docid": "bf6dc62d01893d4e07effd9b4e1566cc", "score": "0.7575188", "text": "def admin?\n # FIXME: Implement admin? function.\n username == 'SYSOP'\n end", "title": "" }, { "docid": "92618c26c36c267ac9adce903e3604c2", "score": "0.75704443", "text": "def current_user_has_admin_privileges?\n current_user_has_privileges_of?('Administrator')\n end", "title": "" }, { "docid": "12ae71d84ddcd2de8546e247261acfc7", "score": "0.75669205", "text": "def admin?(user)\n return true if user.uid.to_s == Application.first.uid_admin.to_s\n end", "title": "" }, { "docid": "39cfed437c98eddb7ea46782eb1ee393", "score": "0.756372", "text": "def is_admin\n if self.security_lvl.name == \"admin\"\n logger.debug(\"TRUE\")\n return true\n else\n logger.debug(\"FALSE\")\n return false\n end\n end", "title": "" }, { "docid": "87b34a242d4d51326ab5bc83aa2be33e", "score": "0.7559791", "text": "def isAdmin?\n if User.find(session[:user_id]).account_type == \"admin\"\n return true\n else\n return false\n end\n end", "title": "" }, { "docid": "9fe46b028eccefda8d98c53ec65d059f", "score": "0.7554195", "text": "def is_admin\n current_user.email == \"admin@123.se\"\n end", "title": "" }, { "docid": "f90912b26d14e5bf6b535d3f0cd51e29", "score": "0.7551468", "text": "def admin?\n return ( self.user_type == User::USER_TYPE_ADMIN )\n end", "title": "" }, { "docid": "5926a1a29b704fcdd09150237a1f9c93", "score": "0.75448287", "text": "def admin?\n if (User.find_by_login(session[:login]).is_admin rescue nil)\n return true\n else\n return false\n end\n end", "title": "" }, { "docid": "43f741020ebdc7584cf4848cd9eb93f7", "score": "0.75405055", "text": "def user_is_admin\n\t\t@user ||= User.find(session[:user_id])\n\t\treturn @user.is_admin?\n\tend", "title": "" }, { "docid": "954a16fa0a49c021025afe9280949487", "score": "0.7536813", "text": "def user_admin?\n return false unless logged_in?\n current_user.has_role?('admin')\n end", "title": "" }, { "docid": "041612eb7460527cd9b7e991fd4feff9", "score": "0.75317657", "text": "def admin?\n @usuario_actual = Usuario.find_by_id(session[:user_id])\n return true if @usuario_actual.admin?\n redirect_to new_session_path and return false\n end", "title": "" }, { "docid": "6ad2ebbab8819660c2f4ebac0c9b687e", "score": "0.7530354", "text": "def is_admin?\n if(current_user == nil)\n return false\n else\n current_user.name == \"admin\" or current_user.name == \"administrator\"\n end\n end", "title": "" }, { "docid": "4134c80b5b72b55af1c0bab454869d91", "score": "0.7529366", "text": "def admin?\n return false\n # return (session[:user_id] && User.find(session[:user_id])[:login] == \"\") ? true : false\n end", "title": "" }, { "docid": "af8482fc44f68ac75b0f9adceb9cf9aa", "score": "0.7520776", "text": "def is_admin?\n current_user && current_user.roles.first && current_user.roles.first.title == \"Administrator\" ? true : false \n end", "title": "" }, { "docid": "802ef87e3fc146806b5c821f66f843ce", "score": "0.7514012", "text": "def admin_user?\n logged_in? && current_user.roles.exists?(name: 'admin')\n end", "title": "" }, { "docid": "f39f4049975edd87473a1396e54dd5cf", "score": "0.7510409", "text": "def current_user_is_admin?\n %w(wakibbe dfu601 super jml237 cmc622 pfr957).include?(current_user_session.try(:username))\n end", "title": "" }, { "docid": "3081093b74734992e6795227c3d6a424", "score": "0.75083774", "text": "def admin?\n Service.is_user_admin?\n end", "title": "" }, { "docid": "3081093b74734992e6795227c3d6a424", "score": "0.75083774", "text": "def admin?\n Service.is_user_admin?\n end", "title": "" }, { "docid": "72fc3ea446b70554813505902f13c1e1", "score": "0.75081056", "text": "def is_admin?\n\t\t!current_user.nil? && current_user.id == 1\n\tend", "title": "" }, { "docid": "9fa1530c019e04d57e50327b49de74e4", "score": "0.7503939", "text": "def is_admin\n @logged_in_user.roles.include?(Role.find_by_name(\"Admin\"))\n end", "title": "" }, { "docid": "7e8a599a9983f9dd260213c34f626693", "score": "0.7496529", "text": "def admin?\n\t\tuser.type == 'AdminUser'\n\tend", "title": "" }, { "docid": "7e8a599a9983f9dd260213c34f626693", "score": "0.7496529", "text": "def admin?\n\t\tuser.type == 'AdminUser'\n\tend", "title": "" }, { "docid": "5aed44cd0e611f750668cf00b59cd88c", "score": "0.7488967", "text": "def is_admin?\n # Best string comparing ever :v\n self.user_role.name == \"Administrator\"\n end", "title": "" }, { "docid": "2f1c9976c1916155cfdb398067c0b22b", "score": "0.7487503", "text": "def administrator?\n return true if @group.eql?(ADMINISTRATOR)\n false\n end", "title": "" }, { "docid": "43f9366720eb6769ea631c9176ec33b2", "score": "0.7486521", "text": "def superadmin?\n registered? and self.user_role_id == 1\n end", "title": "" }, { "docid": "953f720946804943d443487a80eb74b3", "score": "0.7483172", "text": "def admin?\n get_user =~ /^(riccardo|fabio|rcarlesso|fmattei)$/\n end", "title": "" }, { "docid": "50d8422ab05319c8c74260a17cde2586", "score": "0.7478161", "text": "def is_admin?\n is_admin == 1\n end", "title": "" }, { "docid": "50d8422ab05319c8c74260a17cde2586", "score": "0.7478161", "text": "def is_admin?\n is_admin == 1\n end", "title": "" }, { "docid": "50d8422ab05319c8c74260a17cde2586", "score": "0.7478161", "text": "def is_admin?\n is_admin == 1\n end", "title": "" }, { "docid": "0af174e481aceb2f4847317ddb55b18a", "score": "0.74775773", "text": "def admin_loggedin?\r\n @logged_in_user and @logged_in_user.admin?\r\n end", "title": "" }, { "docid": "e238d0d05a6a0ef4f41b5e11754c5de0", "score": "0.7458246", "text": "def is_admin\n current_user.priv == ADMIN ? true : false\n end", "title": "" }, { "docid": "72ad2ac9147c2eecc3bac8e7d2bbce6b", "score": "0.7457736", "text": "def admin?\n\t\tcurrent_user.admin == true\n\tend", "title": "" }, { "docid": "abcfb4e6f59a5adf13f1620123c276cf", "score": "0.7456384", "text": "def user_admin?(user)\n\t\t@admins.include?(user)\n\tend", "title": "" }, { "docid": "8438b08441f0c9dacbef653c9973dc43", "score": "0.74561024", "text": "def admin?\n true if IsUserAnAdmin.call.nonzero?\n end", "title": "" }, { "docid": "e93dcefb41e8b5958d2f771163a5e5a2", "score": "0.7450171", "text": "def user_is_admin?\n\t`groups`.split.include? \"admin\"\n end", "title": "" }, { "docid": "e93dcefb41e8b5958d2f771163a5e5a2", "score": "0.7450171", "text": "def user_is_admin?\n\t`groups`.split.include? \"admin\"\n end", "title": "" }, { "docid": "054525d37af0f375b8ef80280dda8cfd", "score": "0.7448737", "text": "def admin_user?\n logged_in? && current_user.admin\n end", "title": "" }, { "docid": "054525d37af0f375b8ef80280dda8cfd", "score": "0.7448737", "text": "def admin_user?\n logged_in? && current_user.admin\n end", "title": "" }, { "docid": "2d17ec469a93dd36d2e1ef2bf37e8b38", "score": "0.7446558", "text": "def check_admin?\n current_user.user_id == \"admin\" if current_user.present?\n end", "title": "" }, { "docid": "67764a75f0d2e1adeb48f0d11c193450", "score": "0.7444103", "text": "def admin_user?\n return true if current_user.email == 'samatov.dilshod@gmail.com' && Rails.env.production?\n return false if Rails.env.production?\n true\n end", "title": "" }, { "docid": "428f08f05a4b4ffa92806024aff48424", "score": "0.74347013", "text": "def is_admin?\n\t\t#puts \"is_admin:\"+login+\" USER_ADMIN\"+::SYLRPLM::USER_ADMIN+\":\"+login+\" GROUP_ADMINS=\"+::SYLRPLM::GROUP_ADMINS+\":\"+group_names.to_s\n\t\tret = login==PlmServices.get_property(:USER_ADMIN)\n\t\tret = group_names.include?(PlmServices.get_property(:GROUP_ADMINS)) unless ret\n\t\tret\n\tend", "title": "" }, { "docid": "6ac282d5341afc0c0bde6ec8f564d2b9", "score": "0.7433795", "text": "def admin?\n @current_user.user_type == 0\n end", "title": "" }, { "docid": "9a6b0ee63a23e1256ccbb8ba2f0288eb", "score": "0.743111", "text": "def employer?\n @current_user.admin.equal?(true)\n end", "title": "" }, { "docid": "0d459b8e159aa165ce5450c0918cddf9", "score": "0.7430463", "text": "def isAdmin\n @user=User.find(session[:user_id])\n if @user.role_id == Role::Admin\n true\n else\n false\n end\n end", "title": "" }, { "docid": "63bcf90c762b29111cf4ff9c2c83aaa6", "score": "0.74289393", "text": "def user_admin\n\t\tif not @event.is_admin?(current_user.id)\n\t\t\trespond(ERR_INVALID_PERMISSIONS)\n\t\t\treturn false\n\t\tend\n\t\ttrue\n\tend", "title": "" }, { "docid": "50620f57c356c8bbab85c0dd05a83a97", "score": "0.7427696", "text": "def is_admin?(user)\n (not user.nil?) and user.user_type == 2\n end", "title": "" }, { "docid": "a30e5b2986589b8f8826493888022395", "score": "0.7426169", "text": "def admin?(user)\n user.admin.nil? == false\n end", "title": "" }, { "docid": "383eecb84d8914653993434222d25149", "score": "0.7422616", "text": "def admin?\n\t\tcurrent_user.admin\t\n\tend", "title": "" }, { "docid": "85ed83368ce896a905e334af5f2f971f", "score": "0.7419", "text": "def is_admin?(user)\n ADMINS.include?(user.nick)\n end", "title": "" }, { "docid": "e822faee8499481996fa5a4f42a58a53", "score": "0.7418718", "text": "def admin_authorized?\n user_signed_in? && @current_user.has_role?('administrator')\n end", "title": "" }, { "docid": "73fbf3c84c2b6c250eda742723e81c47", "score": "0.74131274", "text": "def current_user_admin?\n current_user && current_user.read_attribute(\"admin\")\n end", "title": "" }, { "docid": "14babb63ae029afdac58d49d2fd4067d", "score": "0.74102396", "text": "def is_admin?\n staff? && activated?\n end", "title": "" }, { "docid": "4bdb1920030445411b0fc123a0446554", "score": "0.7407564", "text": "def user_is_admin?(user)\n Array(robot.config.robot.admins).include?(user.id)\n end", "title": "" }, { "docid": "4226b0afa8b587b62b0da4ff4f840427", "score": "0.7404942", "text": "def is_admin?\n current_user && current_user.starts_with?('admin')\n end", "title": "" }, { "docid": "76b5f0e9126c5c2e4085d9c92a8ce2aa", "score": "0.74044466", "text": "def is_admin?\n (logged_in? && (current_user.isAdmin == true))\n end", "title": "" }, { "docid": "16f4abab839c91686897c6f667942e1c", "score": "0.7398977", "text": "def admin?\n if user_level === 'admin' || user_level === 'super-admin'\n true\n else\n false\n end\n end", "title": "" }, { "docid": "9c86341c568c7a157628102417f2aebd", "score": "0.73971146", "text": "def admin?\n return true if admin\n self.creds.admins.present?\n end", "title": "" }, { "docid": "0b50c73716aaae3c00b6c43df1d82df6", "score": "0.7395999", "text": "def user?\n admin? || member? || is?(:user)\n end", "title": "" }, { "docid": "98cd76ff250e959cbee0b18b2940489d", "score": "0.7394976", "text": "def current_user_is_admin?\n roles.include?(ADMIN_ROLE)\n end", "title": "" }, { "docid": "8613d11c331e75c8952a23fc54e8e224", "score": "0.7389408", "text": "def is_admin?(user)\n user_id == user.id\n end", "title": "" }, { "docid": "4cf158787b6487cdb78b67c9e31816e3", "score": "0.7387345", "text": "def current_user_admin\n #if \"admin\".casecmp(current_user.user_class)\n if current_user.user_class == \"admin\"\n return true\n end\n end", "title": "" }, { "docid": "386bf3d0ba4499e8bb3dfe82646d4f54", "score": "0.7385426", "text": "def is_admin\n is_logged_in && session[:role] == 2 ? true : false\n end", "title": "" } ]
bb59d70a710b3173721fd186eab31195
API required to get travel time
[ { "docid": "60926a19a2433d590b163c303f60c974", "score": "0.6544972", "text": "def travel_time(origin, destination)\n url = \"https://maps.googleapis.com/maps/api/distancematrix/xml?units=imperial&origins=\" + origin + \"&destinations=\" + destination + \"&key=\" + ENV[\"GOOGLE_MAPS_API\"]\n parse_page = Nokogiri::XML(open(url))\n\n return parse_page.css('duration').css('value').text.to_i\nend", "title": "" } ]
[ { "docid": "a329cc80d05c6b27bb7ab9d6020b9b7e", "score": "0.716468", "text": "def trip_time_resolution\n method = \"tripTimeResolution\"\n post_request(method)\n end", "title": "" }, { "docid": "a329cc80d05c6b27bb7ab9d6020b9b7e", "score": "0.716468", "text": "def trip_time_resolution\n method = \"tripTimeResolution\"\n post_request(method)\n end", "title": "" }, { "docid": "9f2490145469a8c551293c71d99b69e4", "score": "0.7143091", "text": "def getTimeBetween(startcord, endcord, time)\n options = {\n startcoord: startcord,\n endcoord: endcord,\n time: time,\n time_type: 'arrival',\n key: @apikey,\n format: 'json'\n }\n self.class.get \"/api/1/traveltime/?#{options.to_query}\", {} # options don't work\n end", "title": "" }, { "docid": "735672b45385ed71d5efc897ec23b1d8", "score": "0.7047396", "text": "def get_est_time\n url = \"https://maps.googleapis.com/maps/api/directions/json?origin=\\\n #{locations[0].coordinates[0]},#{locations[0].coordinates[1]}\\\n &destination=#{locations[1].coordinates[0]},\\\n #{locations[1].coordinates[1]}&key=\\\n #{Rails.application.credentials.gmap_geocode_api_kep}\"\n response = HTTParty.get(url).parsed_response\n self.est_time = ((response['routes'].first['legs'].first['duration']['value']) / 60).round + BUFFER_TIME\n end", "title": "" }, { "docid": "95aa65e7350738b52aad31f3c10ab527", "score": "0.70286334", "text": "def transit_route_tapi(params={})\n lon_lat = Course.get_lon_lat(params[:lon_lat])\n lon_lat = \"lonlat:#{lon_lat[:longitude]},#{lon_lat[:latitude]}\" if lon_lat\n origin = params[:origin] || lon_lat || \"postcode:LS2+9DY\" #lonlat:-1.5359008,53.797678 bus station!\n\n params[:destination] ||= \"lonlat:#{self.longitude},#{self.latitude}\"\n\n if self.start_date < Time.now\n params[:start_date] ||= Time.now.strftime(\"%Y-%m-%d\")\n else\n params[:start_date] ||= self.start_date.strftime(\"%Y-%m-%d\")\n end\n\n params[:start_time] ||= self.start_time.strftime(\"%H:%M\")\n \n base_url=\"https://transportapi.com/v3/uk/public/journey\"\n rest_params=\"/from/#{origin}/to/#{params[:destination]}/by/#{params[:start_date]}/#{params[:start_time]}.json\"\n\n query_params = \"?\" + {\n \"app_id\" => AppConfig[\"transportapi_id\"],\n \"app_key\" => AppConfig[\"transportapi_key\"],\n \"modes\" => \"bus\",\n \"service\" => \"southeast\"\n }.map {|k,v| \"#{k}=#{CGI.escape(v)}\"}*\"&\"\n \n url=URI.parse(base_url+rest_params+query_params)\n logger.debug \"calling #{url}\"\n\n response = HTTParty.get(url)\n \n if response.code != 200\n msg = \"Problem with Transport API transit routing: Code: #{response.code.to_s} Body: \" + response.body.inspect\n raise ApiError, msg\n end\n \n body = JSON.parse(response.body)\n\n return nil unless body[\"error\"].blank?\n \n route = body[\"routes\"][0]\n\n duration = route[\"duration\"]\n departure_time = route[\"departure_time\"]\n arrival_time = route[\"arrival_time\"]\n \n\n parts = route[\"route_parts\"].map {| part | \n {\"mode\" => part[\"mode\"],\n \"from\"=> part[\"from_point_name\"], \n \"to\" => part[\"to_point_name\"], \n \"line_name\" => part[\"line_name\"], \n \"departure_time\" => part[\"departure_time\"],\n \"arrival_time\" => part[\"arrival_time\"],\n \"duration\" => part[\"duration\"]} }\n \n return {:type => \"transit\",\n :duration => duration,\n :date => params[:start_date],\n :departure_time => departure_time,\n :arrival_time => arrival_time,\n :parts => parts }\n end", "title": "" }, { "docid": "97f744e71ebffa1d92649816816d5f5a", "score": "0.69362986", "text": "def travel_to(date_or_time); end", "title": "" }, { "docid": "8729ffa0bd06ced98717066ba1023d41", "score": "0.6821766", "text": "def time\n PublicRequest.perform({\n request_method: :get,\n path: '/api/v3/time',\n })\n end", "title": "" }, { "docid": "de23dbd8115006c5695dbe82349860fc", "score": "0.66549903", "text": "def get_eta\n api_params = {\n start_latitude: self.source.coordinates[:latitude],\n start_longitude: self.source.coordinates[:longitude],\n product_id: CAB_PRODUCT_ID\n }\n\n response = RestClient::Request.execute(method: :get, url: API_BASE_URL, headers: { 'Authorization' => \"Token #{API_TOKEN}\", params: api_params })\n\n if response.code.to_i == 200\n get_estimated_time_of_arrival(response)\n else\n raise \"Uber Api returned non-200 response\"\n end\n end", "title": "" }, { "docid": "882fcee888a0bc3e249c0cca5268a8a7", "score": "0.6630727", "text": "def find_time_in_transit(origin, destination, packages, options={})\n origin, destination = upsified_location(origin), upsified_location(destination)\n options = @options.merge(options)\n packages = Array(packages)\n access_request = build_access_request\n rate_request = build_time_in_transit_request(origin, destination, packages, options)\n response = ssl_post(\"https://www.ups.com/ups.app/xml/TimeInTransit\", \"<?xml version=\\\"1.0\\\"?>\"+access_request+\"<?xml version=\\\"1.0\\\"?>\"+rate_request)\n parse_time_in_transit_response(origin, destination, packages,response, options)\n end", "title": "" }, { "docid": "2710d3f89c1801eb349dfd4fe946fb4d", "score": "0.6614921", "text": "def travel_time(from)\n 1.2 * (@latlng.distance_to(from, {units: :kms}) / 4) * 60 * 60\n end", "title": "" }, { "docid": "6f62ae2f9105c2a02c107113590a0c21", "score": "0.66033494", "text": "def walk_route(params={})\n\n params[:origin] ||= {:lat =>53.797678, :lon =>-1.5359008} #-1.5359008,53.797678 bus station!\n lon_lat = Course.get_lon_lat(params[:lon_lat])\n \n params[:origin] = {:lat =>lon_lat[:latitude], :lon =>lon_lat[:longitude]} if lon_lat\n\n params[:start_time] ||= self.start_time.strftime(\"%H:%M\")\n if self.start_date < Time.now\n params[:start_date] ||= Time.now.strftime(\"%Y-%m-%d\")\n else\n params[:start_date] ||= self.start_date.strftime(\"%Y-%m-%d\")\n end\n\n time = params[:start_date]+\"T\"+params[:start_time]\n json = {\"locations\" => [{\"lat\"=>params[:origin][:lat], \"lon\"=>params[:origin][:lon]},{\"lat\"=>self.latitude, \"lon\"=> self.longitude}], \"directions_options\"=>{\"units\"=>\"kilometers\"},\"costing\" => \"pedestrian\" }.to_json\n location = \"#{params[:origin][:lon]},#{params[:origin][:lat]};#{self.longitude},#{self.latitude}\"\n url = \"#{AppConfig['osrm_url']}/route/v1/foot/#{location}?overview=false&alternatives=false&steps=true\"\n\n logger.debug \"calling #{url}\"\n\n response = HTTParty.get(url, {\n headers: {\"User-Agent\" => \"Leeds-Adult-Learning;Contact osm @chippy\"} \n })\n\n if response.code != 200\n msg = \"Problem with OSRM walk routing: Code: #{response.code.to_s} Body: \" + response.body.inspect\n raise ApiError, msg\n end\n \n body = JSON.parse(response.body)\n\n duration = body[\"routes\"][0][\"legs\"][0][\"duration\"]\n length = body[\"routes\"][0][\"legs\"][0][\"distance\"]\n departure_time = self.start_time - duration\n arrival_time = self.start_time \n\n parts = []\n body[\"routes\"][0][\"legs\"].each do | leg |\n leg[\"steps\"].each do | step |\n instruction = OSRMTextInstructions.compile(step)\n parts << { \"mode\" => \"foot\",\n \"pre_instruction\" => instruction,\n \"post_instruction\" => \"\",\n \"duration\" => step[\"duration\"],\n \"distance\" => step[\"distance\"],\n \"ref\" => step[\"ref\"]\n } \n end\n end\n \n return {:type => \"foot\",\n :duration => duration,\n :length => length,\n :date => params[:start_date],\n :departure_time => departure_time,\n :arrival_time => arrival_time,\n :parts => parts }\n\n end", "title": "" }, { "docid": "5e0b7a887df3b5b9b1adf3bbf85d3a36", "score": "0.6541549", "text": "def return_trip_time(start, dest)\n trip2 = Trip.new(\"Columbus_Circle\", \"Grand_Central\", 9, [\"1\", \"S\"],'<iframe src=\"https://www.google.com/maps/embed?pb=!1m28!1m12!1m3!1d12088.308001632395!2d-73.98839553425857!3d40.76033113259129!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!4m13!3e6!4m5!1s0x89c258f63c9804b5%3A0xacca5e3d4112d7eb!2sColumbus+Cir%2C+New+York%2C+NY!3m2!1d40.7680441!2d-73.9823722!4m5!1s0x89c25a21fb011c85%3A0x37513b7f1821408b!2sGrand+Central+Terminal%2C+East+42nd+Street%2C+New+York%2C+NY!3m2!1d40.7527262!2d-73.9772294!5e0!3m2!1sen!2sus!4v1440768180490\" width=\"600\" height=\"450\" frameborder=\"0\" style=\"border:0\" allowfullscreen></iframe>')\n if start==\"COLUMBUS CIRCLE\" && dest==\"GRAND CENTRAL\"\n return trip2.trip_time\n else\n return \"Not a Valid trip.\"\n end\nend", "title": "" }, { "docid": "163d824a95b0b48da7412cef193cec4f", "score": "0.65255696", "text": "def travel_time\n\t\tfromtime.to_s + \" - \" + totime.to_s\n\n\tend", "title": "" }, { "docid": "bdec47c484e693dd5c2b0d11c66f37c5", "score": "0.6497594", "text": "def departure_info(route, direction, stop)\n departures = RestClient.get(\"http://svc.metrotransit.org/NexTrip/#{route}/#{direction}/#{stop}?format=json\")\n JSON.parse(departures)\nend", "title": "" }, { "docid": "5db3edfa1d95fb991fe090929522e638", "score": "0.6497218", "text": "def get_est_time\n if locations[0].coordinates.nil? || locations[1].coordinates.nil?\n logger.warn 'Coordinates did not exist for these locations, returning default est_time'\n self.est_time = 15\n return\n end\n url = \"https://maps.googleapis.com/maps/api/directions/json?origin=\\\n #{locations[0].coordinates[0]},#{locations[0].coordinates[1]}\\\n &destination=#{locations[1].coordinates[0]},\\\n #{locations[1].coordinates[1]}&key=\\\n #{Rails.application.credentials.google_maps_key}\"\n response = HTTParty.get(url).parsed_response\n if response.nil?\n self.est_time = 0\n logger.warn \"Google Maps API returned nothing for est time. Request URL: #{url}\"\n else\n est_time_min = response['routes'].first['legs'].first['duration']['value'] / 60\n buffer_time = est_time_min * 0.1\n self.est_time = (est_time_min + buffer_time).round\n end\n end", "title": "" }, { "docid": "7f9fbf24e6930bbfb2f8ef2678f1dd59", "score": "0.6485886", "text": "def show\n predictions = CTA::BusTracker.predictions(:stpid => params(:stop_id), :rt => params(:route))\n next_times = predictions.map {|p| Time.parse(p['prdtm'])}\n\n render json: {next_time: next_times}\n end", "title": "" }, { "docid": "d14553fff91074895ae9e1ea008a301b", "score": "0.6402666", "text": "def total_travel_time\n coordinates = JSON.parse(self.coordinates)\n sum_travel_time = 0\n total_distance = 0\n array = []\n coordinates.each_with_index do |coordinate_pair, index| \n array << Concurrent::Promises.future(coordinate_pair) do |coordinate_pair|\n ForecastFetcher.new(coordinate_pair).fetch_wind_data \n end\n end\n\n coordinates.each_with_index do |coordinate, index| \n next_coordinate = coordinates[index+1]\n if next_coordinate != nil\n distance = Haversine.distance(coordinate[0], coordinate[1], next_coordinate[0], next_coordinate[1]).to_miles\n total_distance += distance\n wind = array[index].value\n adjusted_wind_angle = heading(wind[\"wind_direction\"]) - boat_heading(coordinate, next_coordinate)\n boat = Boat.new(adjusted_wind_angle.abs, wind[\"wind_speed\"])\n velocity = boat.velocity\n travel_time = distance / velocity\n sum_travel_time += travel_time\n\n end\n end\n sum_travel_time\n time_and_distance = {\"time\": sum_travel_time, \"distance\": total_distance}\n end", "title": "" }, { "docid": "ae9154905832a01b03f9543f68fb4d3a", "score": "0.6324818", "text": "def get_times_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi.get_times ...\"\n end\n # resource path\n local_var_path = \"/times\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'user_id'] = opts[:'user_id'] if !opts[:'user_id'].nil?\n query_params[:'start'] = opts[:'start'] if !opts[:'start'].nil?\n query_params[:'end'] = opts[:'_end'] if !opts[:'_end'].nil?\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['apiKey']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'TimesResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#get_times\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "d8bf6485effff10d096bdd45d4cf7178", "score": "0.6299854", "text": "def travel_time\n @error.check_initialized(self)\n total_time{|cell, nextcell| get_travel_time(cell, nextcell)}\n end", "title": "" }, { "docid": "3ae7844207dedc5de8fb4ea8bcb6c74a", "score": "0.62948203", "text": "def travel_location\n#puts \"travel_location, member=#{self.attributes}, status=#{status_id}, on_field=#{status.on_field if status}\"\n\n # We look at the most recent travel, if any, with dates including today. When no return date is specified,\n # a trip beginning in past is considered to be still in progress. This means it's important to terminate\n # trips whether by using a return date or adding a more recent flight (return or otherwise)\n if spouse\n current_travel = Travel.where(\"member_id = ? or (member_id = ? and with_spouse)\", self.id, spouse_id).\n where(\"date < ? and (return_date is ? or return_date > ?)\", \n Date.today, nil, Date.today).order(\"date desc\").limit(1)[0]\n else\n current_travel = travels.where(\"date < ? and (return_date is ? or return_date > ?)\", \n Date.today, nil, Date.today).order(\"date desc\").limit(1)[0]\n end \n if current_travel\n if visiting_field? # Someone visiting the field\n answer = \"arrived on field #{current_travel.date.to_s(:short).strip}\"\n if current_travel.return_date\n answer << \", leaves #{current_travel.return_date.to_s(:short).strip}\"\n end\n return answer\n elsif status && status.on_field && !current_travel.arrival # if on-field person has traveled (according to travel schedule)\n answer = \"left field #{current_travel.date.to_s(:short).strip}\"\n if current_travel.return_date\n answer << \", returns #{current_travel.return_date.to_s(:short).strip}\"\n end\n return answer\n end \n end \n return nil\n end", "title": "" }, { "docid": "a66289b8a0aabf99b2fe94ebb3ca5a7b", "score": "0.6261936", "text": "def get_departure_times(departure_station,destination_station)\n\n\t\t# Typhoeus is used to submit http requests\n\n\t\t bart_url = \"http://api.bart.gov/api/etd.aspx?cmd=etd&orig=#{departure_station}&key=ZZLI-UU93-IMPQ-DT35\"\n\n\t\t response = Typhoeus.get(bart_url)\n\n\t\t # Extract the departure times to the chosen destination\n\n\t\t response_XML = Nokogiri.XML(response.body)\n\n\t\t @departure_times = {}\n\n\t\t # Create a hash list of the departure times\n\n\t\t response_XML.xpath(\"//station/etd/destination\").each do |node|\n\t\t \t\t@departure_times[node.text] = node.next.text\n\t\t \t\tbinding.pry\n\t\t end\n\n\t\t binding.pry\n\n\t\t return @departure_times\n\n\tend", "title": "" }, { "docid": "0160a48e4fd90f761aef8061b5b257d2", "score": "0.6247639", "text": "def get_route_time(metro_list)\n return self.get_route_layover_time(metro_list) + self.get_route_flying_time(metro_list)\n end", "title": "" }, { "docid": "448532efecec0642b0fe2182e85e0a53", "score": "0.62344235", "text": "def totalFlightTime\n\n end", "title": "" }, { "docid": "0d025227a0dface46b644e5fd86213a0", "score": "0.62313646", "text": "def totalTripTime\n\n end", "title": "" }, { "docid": "9b128aee5f43f3f92844e7f606328779", "score": "0.6205212", "text": "def get_departure_times\n\n\t\t# The requested origination station is in the instance of \n\t\t# station\n\n\t\t# Typhoeus is used to submit http requests\n\n\t\t response = Typhoeus.get(\"http://api.bart.gov/api/stn.aspx?cmd=etd&key=ZZLI-UU93-IMPQ-DT35\")\n\n\t\t # Extract the station names and short names\n\n\t\t response_XML = Nokogiri.XML(response.body)\n\n\t\t @station_names = {}\n\n\t\t # Create a hash list of the station names and abbreviations\n\t\t # node provides the full name of the station and next node is \n\t\t # the abbreviation\n\n\t\t response_XML.xpath(\"//stations/station/name\").each do |node|\n\t\t \t\t@station_names[node.text] = node.next.text\n\t\t end\n\n\t\t return @station_names\n\n\tend", "title": "" }, { "docid": "a70ee0de2096ffed61872ac4eefcf52d", "score": "0.61930114", "text": "def get_geolocation_and_timezones(incoming={})\n opts = HttpClient::Helper.symbolize_keys(incoming)\n query = {\n :ip => (x = opts.delete(:ip); x.nil? ? nil : HttpClient::Preconditions.assert_class('ip', x, String))\n }.delete_if { |k, v| v.nil? }\n r = @client.request(\"/geolocation/timezones\").with_query(query).get\n r.map { |x| ::Io::Flow::V0::Models::Timezone.new(x) }\n end", "title": "" }, { "docid": "cda7ac24ce4bcdf038f394962ea6e5eb", "score": "0.6179777", "text": "def get_walk_time otp_itin, trip_type\n if trip_type.in? [:car, :bicycle]\n return 0\n else\n return otp_itin[\"walkTime\"]\n end\n end", "title": "" }, { "docid": "3d7539d96acee0144aaa95fac8d3c961", "score": "0.61574405", "text": "def time\n get('/time')[:body]\n end", "title": "" }, { "docid": "9ae1a0a112e66eea9b9d26049857e629", "score": "0.6150706", "text": "def envoy_travel_time(v)\n diplomats -2*0.20*v\n merchants -2*0.01*v\n colonists -1*0.10*v\n end", "title": "" }, { "docid": "e714491bf9b2127480109d6deb620fc6", "score": "0.6146385", "text": "def envoy_travel_time(v)\n diplomats -2*0.25*v\n merchants -2*0.01*v\n colonists -1*0.10*v\n end", "title": "" }, { "docid": "38e710f75d7d42f530371f859f854bbb", "score": "0.6139692", "text": "def forecast(latitude, longitude, time = nil, options = {})\n time ||= Time.now.to_i\n url_string = url latitude, longitude, time\n response = Typhoeus::Request.get url_string, DEFAULT_OPTIONS.dup.merge(options)\n JSON.parse(response.body) if response.code == 200\n end", "title": "" }, { "docid": "a7f9797c92f33a94963c524f97537e82", "score": "0.61394536", "text": "def travels\n end", "title": "" }, { "docid": "5fdadabe68dd50c132ccd8b2a076781c", "score": "0.610332", "text": "def get_geolocation_and_timezones(incoming={})\n opts = HttpClient::Helper.symbolize_keys(incoming)\n query = {\n :address => (x = opts.delete(:address); x.nil? ? nil : HttpClient::Preconditions.assert_class('address', x, String)),\n :ip => (x = opts.delete(:ip); x.nil? ? nil : HttpClient::Preconditions.assert_class('ip', x, String))\n }.delete_if { |k, v| v.nil? }\n r = @client.request(\"/geolocation/timezones\").with_query(query).get\n r.map { |x| ::Io::Flow::V0::Models::Timezone.new(x) }\n end", "title": "" }, { "docid": "bd0ce6cacf951194445ccb9aeaf69757", "score": "0.6096262", "text": "def get_transit_time(otp_itin, trip_type)\n if trip_type.in? [:car, :bicycle]\n return otp_itin[\"walkTime\"]\n else\n return otp_itin[\"transitTime\"]\n end\n end", "title": "" }, { "docid": "399f7a9bed10ea2fed10dc6fa76fbc1c", "score": "0.6088662", "text": "def get_google_data_for_travel(origin, destination)\n url = \"https://maps.googleapis.com/maps/api/directions/json?key=#{GOOGLE_MAPS_API_KEY}&origin=#{origin}&destination=#{destination}\"\n response = open(url)\n # response_status = response.status\n response_body = response.read\n return JSON.parse(response_body)\nend", "title": "" }, { "docid": "1925602aca4ab23364cead3d122fa35e", "score": "0.6078573", "text": "def stop_info(route, direction)\n stops = RestClient.get(\"http://svc.metrotransit.org/NexTrip/Stops/#{route}/#{direction}?format=json\")\n JSON.parse(stops)\nend", "title": "" }, { "docid": "7f5475cb0926eac16da7b47530aa1f54", "score": "0.6071662", "text": "def directions_info(route)\n directions = RestClient.get(\"http://svc.metrotransit.org/NexTrip/Directions/#{route}?format=json\")\n JSON.parse(directions)\nend", "title": "" }, { "docid": "e0cfdbde3fc7d3f53497899ba5e64e38", "score": "0.6051279", "text": "def get_time\n if(@total_distance < 400)\n s_dist = (@total_distance/2)\n acceleration = (@@plane_speed**2)/(2*s_dist)\n time = @plane_speed/acceleration\n @total_time = 2*time + @layover_time\n else\n s_dist = 200\n acceleration = (@@plane_speed**2)/(2*s_dist)\n time = @@plane_speed/acceleration\n air_dist = @total_distance - 400\n @total_time = 2*time + (air_dist/@@plane_speed) + @layover_time\n end\n puts \"Total time for your journey is #{@total_time} minutes\"\n end", "title": "" }, { "docid": "454562ea89d950ca14242339d541a7d5", "score": "0.6048378", "text": "def flight_time(origin, destination)\n\n distance = Haversine.distance(origin, destination)\n distance = distance.to_miles / FLIGHTSPEED\n distance.round\nend", "title": "" }, { "docid": "8036faf1d4b564114818b9a94ea08ed2", "score": "0.60129404", "text": "def travel_time_to(at_time, to)\n travel_time to\n end", "title": "" }, { "docid": "894c6d7dee49ac8a022e74bc16a96610", "score": "0.60061556", "text": "def get_ups_ground_transit_time(from_zip_code, to_zip_code, weight)\r\n \r\n access_options = {\r\n :access_license_number => @UPS_ACCESS_LICENSE_NUMBER,\r\n :user_id => @UPS_USER_ID,\r\n :password => @UPS_PASSWORD,\r\n :order_cutoff_time => 17 ,\r\n :sender_state => state_from_zip(\"#{from_zip_code}\"),\r\n :sender_country_code => 'US',\r\n :sender_zip => \"#{from_zip_code}\"\r\n }\r\n \r\n request_options = {\r\n :total_packages => 1,\r\n :unit_of_measurement => 'LBS',\r\n :weight => weight,\r\n :state => state_from_zip(\"#{to_zip_code}\"),\r\n :zip => \"#{to_zip_code}\",\r\n :country_code => 'US',\r\n :mode => @UPS_TESTMODE\r\n }\r\n \r\n return Integer(UPS::TimeInTransit.new(access_options).request(request_options)) \r\n \r\n end", "title": "" }, { "docid": "0f0a3efc4ab31041b0dce580314c1a4c", "score": "0.5985783", "text": "def scanDistTimeSpeed(json)\n tripPos = json['tripPos'] ;\n pickUpPos = Geo2D::Point.sureGeoObj([tripPos['pickUp']['x'],\n tripPos['pickUp']['y']]) ;\n dropOffPos = Geo2D::Point.sureGeoObj([tripPos['dropOff']['x'],\n tripPos['dropOff']['y']]) ; \n dist = Sav::Util::averageManhattanDistance(pickUpPos, dropOffPos) ;\n @totalDistance += dist ;\n\n if(json['tripTime']['pickUp'].nil? ||\n json['tripTime']['dropOff'].nil?) then\n ##### ?????\n ##### なぜこのようなケースがあるか不明。\n else\n# time = json['tripTime']['dropOff'] - json['tripTime']['pickUp'] ;\n time = (json['tripTime']['dropOff'] -\n json['tripRequiredTime']['pickUp']) ;\n waitTime = (json['tripTime']['pickUp'] -\n json['tripRequiredTime']['pickUp'])\n @totalTime += time ;\n @waitTimeStatInfo.put(waitTime) ;\n\n speed = dist / time ;\n @speedStatInfo.put(speed) ;\n end\n end", "title": "" }, { "docid": "3ce166a1b8bcb0495abab6b016cf41d3", "score": "0.59830683", "text": "def get_optimal_route\n # prepare starting [x,y] for API request\n prep_start_point\n # prepare destinations for API request\n prep_destinations\n # combines start_point and destinations into a query string\n build_query_string\n # sends formatted GET Request to Traveling Salesman Endpoint of HERE API\n @res = HTTParty.get(@query_string, format: :plain)\n\n return @res\n end", "title": "" }, { "docid": "90c8c180889aab08c9e8141cf445cb9b", "score": "0.59091026", "text": "def arrival_time\n\t\t\tget_full_details if @arrival_time.nil?\n\t\t\t@arrival_time == :none ? nil : @arrival_time\n\t\tend", "title": "" }, { "docid": "9d607ff2250f50b9db42d652c9a4a654", "score": "0.5897991", "text": "def get_data(lat, long, time_current)\n\t\n\ttime_earliest = time_current - REFER * MTOS\n\t\n\tdata = Hash.new\n\t(time_earliest..time_current).step(INTER * MTOS) do |time|\n\t\t#puts Time.at(time)\n\t\t\n\t\tlat_long = lat.to_s + \",\" + long.to_s\n\t\trequest_uri = URI.parse(\"#{BASE_URL}/#{API_KEY}/#{lat_long},#{time}\")\n\t\tforecast = JSON.parse(open(request_uri, \n\t\t\t{ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE}).read)\n\t\tcurrent = forecast['currently']\n\t\t\n\t\t# rainfall, temperature, wind_dir, wind_spd, updated, loc_id?\n\t\t# need controller methods for create if we want to insert\n\t\t# data retrieved for predictions into table\n\t\tdata[time] = Hash.new\n\t\tdata[time]['rainfall'] = current['precipIntensity'] * ITOMM * \n\t\t\tcurrent['precipProbability']\n\t\tdata[time]['temperature'] = (current['temperature'] - 32) * 5/9\n\t\tdata[time]['wind_speed'] = current['windSpeed'] * MTOKM\n\t\tdata[time]['wind_dir'] = current['windBearing']\n\t\tdata[time]['observed'] = current['time']\n\tend\n\treturn data\nend", "title": "" }, { "docid": "2e9aaaac0b94354ce9cdf08cf54b8948", "score": "0.589276", "text": "def arriving_times(start_latitude, start_longitude, customer_uuid=nil, product_id=nil)\n # TODO validate parameters\n # TODO figure out how to send server_token by default\n payload = {\n server_token: client.server_token,\n start_latitude: start_latitude,\n start_longitude: start_longitude,\n end_latitude: end_latitude,\n end_longitude: end_longitude\n }\n payload.merge!({ customer_uuid: customer_uuid }) if customer_uuid\n payload.merge!({ product_id: product_id }) if product_id\n\n client.connection.get(path, payload)\n end", "title": "" }, { "docid": "fe16e9bae3d4d3e1a176267be25247c9", "score": "0.58879054", "text": "def return_trip_datetime\n return nil if is_round_trip != \"1\"\n parse_time_and_fields('return_trip')\n end", "title": "" }, { "docid": "b52fafd0d06ba8793b09548439887e11", "score": "0.58738965", "text": "def get_time()\n path = '/health/time'\n\n params = {\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'GET',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::HealthTime\n )\n end", "title": "" }, { "docid": "75f79d083ef5f3f82d19d137dd3677b6", "score": "0.5868518", "text": "def time_in_store\n @departure_time - @arrival_time\n end", "title": "" }, { "docid": "a40543ec0c3c3dcc08fff07c0eb6420f", "score": "0.5850416", "text": "def index\n @time_travellers = TimeTraveller.all\n end", "title": "" }, { "docid": "71fd8286742bf8aff5320853ef2fec23", "score": "0.5844029", "text": "def getManagerTime\r\n send_soap(:get_manager_time)\r\n end", "title": "" }, { "docid": "9e1aae55383465220cacb2b144e80087", "score": "0.58392227", "text": "def show\n @deadline_locations = @trip.deadline_locations\n @deadline_accomodations = @trip.deadline_accomodations\n @deadline_transportations = @trip.deadline_transportations\n # if deadline_locations < Time.now\n\n @locations = @trip.locations\n @transportations = @trip.transportations\n @accomodations = @trip.accomodations\n @comments = @trip.comments\n\n end", "title": "" }, { "docid": "116dd9c62931da71ed79a612151245a6", "score": "0.5837874", "text": "def get_tm\n response = get(\"#{@config['url']}/api/2.1/rest/time_machine\", {accept: :json, :cookies => cookies})\n JSON.parse(response, :symbolize_names => true)[:time_machine]\n end", "title": "" }, { "docid": "6952305b014700a58bdf811b99064a57", "score": "0.58327454", "text": "def datetime_from_departure(route, direction, stop)\n # Get the departure information retrieved from the API as a hash\n info = departure_info(route, direction, stop)[0]\n # Raise an error if the last bus for the day has already left\n raise 'Last bus for the day has already left' if info.nil?\n # Strip the milliseconds and timezone from the departure time value\n stripped_time = info['DepartureTime'][/Date\\((.*)\\)/, 1]\n # Return the stripped time in a datetime format\n DateTime.strptime(stripped_time, '%Q %z')\nend", "title": "" }, { "docid": "26be4855d327c5690ea771ea6b5e66f8", "score": "0.58316773", "text": "def test_get_time_for_activity\n url = format('%s/times?activity=dev&token=%s',\n @ts.instance_variable_get(:@baseurl),\n @ts.instance_variable_get(:@token))\n\n stub_request(:get, /.*times.*/)\n .to_return(body: JSON.dump([Hash['this' => 'should be in a list']]))\n\n assert_equal(@ts.get_times(Hash['activity' => ['dev']]),\n [Hash['this' => 'should be in a list']])\n end", "title": "" }, { "docid": "29d01d8d777cc59fd96e0c7b0de8996c", "score": "0.58187073", "text": "def api_time; utc.strftime(API_TIME_FORMAT); end", "title": "" }, { "docid": "313fc2a60717131d1add93de182cb14c", "score": "0.5807051", "text": "def flight_time\n parse('drone.flight_time')\n end", "title": "" }, { "docid": "e35badd25793efb90aa337a4fff5cd96", "score": "0.5803575", "text": "def get_trip_data\n begin\n data = {}\n # for each departure/return entry, grab: start_time, end_time, travel_time, cost\n i = 0\n try_action(\"Wait for #{@browser.url} to load\", 0.2, 10) { @browser.label(index: i).exists? } == \"Error\" ? (return \"Error\") : (puts \"#{@browser.url} finished loading\")\n sleep 0.2\n while (@browser.label(index: i).exists?)\n cost = @browser.label(index: i).p(class: \"ui-li-aside\").span.text\n cost[0] = '' if cost[0] = '$' # remove $ sign\n start_time = @browser.label(index: i).h4.span.text\n end_time = @browser.label(index: i).p(index: 1).span(index: 1).text\n travel_time = @browser.label(index: i).p(index: 1).span(index: 3).text\n\n data[i] = { cost: cost, start_time: start_time, end_time: end_time, travel_time: travel_time}\n i += 1\n end\n puts \"Found #{i} schedules\"\n rescue Watir::Exception::UnknownObjectException => e\n puts \"Page load error\"\n return nil\n end\n data\n end", "title": "" }, { "docid": "8aa987760d387170a865bae9fcd502cb", "score": "0.5801104", "text": "def departure_time(arrival_time)\n departure_time = arrival_time - travel_time.hours\n end", "title": "" }, { "docid": "0438500c8ba5baca9e4c2e2885073118", "score": "0.5798606", "text": "def arrival_time\n selected_itinerary.try(:end_time) || trip_time\n end", "title": "" }, { "docid": "19142ac11ae96e2bf5f9f3ffe195ec2e", "score": "0.57981366", "text": "def create\n route = Route.create!(user_id: params[:user_id], coordinates: params[:coordinates], name: params[:name])\n # byebug\n total_travel_time_and_distance = route.total_travel_time\n puts \"Total Travel Time and Distance\"\n puts total_travel_time_and_distance[\"time\"]\n puts total_travel_time_and_distance[\"distance\"]\n # byebug\n render json: total_travel_time_and_distance\n end", "title": "" }, { "docid": "ee65ebc0c2b1351ef029c8d0be00ca62", "score": "0.5787626", "text": "def test_directions_for_start_end_lat_lon\n # Step 1\n params = {\n 'start_lat' => 34.155,\n 'start_lon' => -118.255,\n 'end_lat' => 34.16,\n 'end_lon' => -118.42\n }\n\n get '/directions', params\n assert_response(@response, :success)\n assert_has_keys(@parsed_response, DIRECTIONS_KEYS[:main])\n @parsed_response['Itinerary'].each do |itinerary|\n assert_has_keys(itinerary, DIRECTIONS_KEYS[:itinerary])\n end\n\n total_distance = get_total_distance(@parsed_response['Itinerary'])\n refute_nil(@parsed_response['TotalDistance'], @parsed_response)\n assert_in_epsilon(total_distance, @parsed_response['TotalDistance'], 0.001, @parsed_response)\n refute_nil(@parsed_response['TotalDrivingTime'], @parsed_response)\n assert(@parsed_response['TotalDrivingTime'] > 0, @parsed_response)\n end", "title": "" }, { "docid": "eea97b48e9ff8ebc9b49d9d81d8394f3", "score": "0.57798237", "text": "def departure_time_from_origin\n\t\t\tget_full_details if @departure_time_from_origin.nil?\n\t\t\t@departure_time_from_origin == :none ? nil : @departure_time_from_origin\n\t\tend", "title": "" }, { "docid": "7e2973f60b7e40e19afde57b2068099f", "score": "0.57463807", "text": "def departure_time\n\t\t\tget_full_details if @departure_time.nil?\n\t\t\t@departure_time == :none ? nil : @departure_time\n\t\tend", "title": "" }, { "docid": "b958273aa3b8b496f8d19698b72c099f", "score": "0.57293093", "text": "def forecast(lat, long)\n url = \"#{BASE_URL}format=application/json&latitude=#{lat}&longitude=#{long}&date=&distance=100&api_key=#{@api_key}\"\n puts url\n uri = URI(url)\n response = HTTP.get(uri)\n result = JSON.parse(response)\n end", "title": "" }, { "docid": "c5ddd0275cae4da285b63931e104fc84", "score": "0.57263285", "text": "def arrival_time_from_origin\n\t\t\tget_full_details if @arrival_time_from_origin.nil?\n\t\t\t@arrival_time_from_origin == :none ? nil : @arrival_time_from_origin\n\t\tend", "title": "" }, { "docid": "97a60bd4c6082f3951598f8505031587", "score": "0.5724591", "text": "def show\n\t\t@travel = Travel.find(params[:id])\n\t\t@travel_schedule = []\n\t\t@travel_schedule.push(@travel.get_starting_point)\n\n\t\t@travel.travel_steps.each do |t_steps|\n\t\t\t@travel_schedule.push t_steps\n\t\tend\n\n\t\t@travel_schedule.push(@travel.get_ending_point)\n\t\ttrasform_meeting_participations_in_meeting(@travel_schedule)\n\t\t@user = @travel.get_user\n\tend", "title": "" }, { "docid": "0d9a6ff5126244e1f84154892ddd9f98", "score": "0.5716903", "text": "def build_time_in_transit_request(origin, destination, pickup_date, shipment_weight_in_lbs = nil, total_packages = nil, monetary_value = nil, documents_only = false, maximum_list_size = nil)\n xml_request = xml('TimeInTransitRequest') { |root|\n root << xml('Request') { |request|\n request << xml('RequestAction', 'TimeInTransit')\n # Not implemented: TransactionReference/*\n }\n root << xml('TransitFrom') {|from| from << address_artifact(origin) }\n root << xml('TransitTo') {|to| to << address_artifact(destination) }\n root << xml('PickupDate', pickup_date.strftime(\"%Y%m%d\")) # YYYYMMDD\n if shipment_weight_in_lbs\n root << weight('ShipmentWeight', shipment_weight_in_lbs, 'LBS') #TODO: get the weight in its native format\n end\n if total_packages\n root << xml('TotalPackagesInShipment', total_packages)\n end\n if monetary_value\n root << money('InvoiceLineTotal', monetary_value.to_money)\n end\n if documents_only\n root << xml('DocumentsOnlyIndicator')\n end\n if maximum_list_size\n root << xml('MaximumListSize', maximum_list_size)\n end\n }\n \n xml_request.to_xml\n end", "title": "" }, { "docid": "eb83593ebda7a778907e75e1e9c8593f", "score": "0.5714657", "text": "def departure_time_local\n (self.departure + self.origin.timezone.offset.hours).strftime('%H:%M')\n end", "title": "" }, { "docid": "b66de02566613bc1978a6bc2b4c69aeb", "score": "0.57134306", "text": "def request_trip\n date = Date.today\n driver_id = Driver.available.id \n passenger_id = self.id\n trip_params = {date: date, driver_id: driver_id , passenger_id: passenger_id} \n return trip_params\n end", "title": "" }, { "docid": "a337b1c1bfadc3bec6379928b7a63d6c", "score": "0.56970507", "text": "def describe_time_to_live(*args)\n @resource_via_client.send('describe_time_to_live', *args)\n end", "title": "" }, { "docid": "0b0fc65e06204fe66ee241707d2982e9", "score": "0.5693302", "text": "def api_time\n utc.strftime(MO.api_time_format)\n end", "title": "" }, { "docid": "d3f66769fd37e7f99040f8784de3ab6a", "score": "0.5691052", "text": "def get_arrival_times(route, stop, in_out)\n raise unless route and stop and in_out\n route_handler = Muni::Route.find(route)\n stop_handler = route_handler.send(in_out.to_sym).stop_at(stop)\n raise \"Couldn't find stop: found '#{stop_handler.title}' for '#{stop}'\" if\n stop != stop_handler.title\n # return stop_handler.predictions.map(&:time)\n # stop_handler.predictions.map(&:time).map {|t| StationTime.new(route, t) }\n stop_handler.predictions.map(&:time).map {|t| StationTime.new(route, t) }.select { |st| (st.time - Time.now) > 60 }\nend", "title": "" }, { "docid": "59f0c0c2f8023b323a52161f439d52f3", "score": "0.56881934", "text": "def get_device_time_history_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AllEndpointsApi.get_device_time_history_using_get ...'\n end\n # resource path\n local_var_path = '/api/v2/admin/device-time'\n\n # query parameters\n query_params = {}\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'forWholeAccount'] = opts[:'for_whole_account'] if !opts[:'for_whole_account'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['apiKeyInHeader', 'oAuth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'APIListOfAPIUserDeviceTime')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AllEndpointsApi#get_device_time_history_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "f5fbe4dbfc68c1201e0c64b46b8b5fd6", "score": "0.5687797", "text": "def arrival_time\n self.date + self.duration\n end", "title": "" }, { "docid": "0a46fad1f6160390298ac94a534e47f5", "score": "0.5686071", "text": "def get_visitor_timing\n @visitor_result&.get_timing\n end", "title": "" }, { "docid": "4c746baf11f0f55a7dc768fd0dc1dcde", "score": "0.5681845", "text": "def get_times\n resp = HTTParty.post(DIMLO_URI, {:body => form_options, :headers => headers})\n doc = Nokogiri::HTML(resp.body)\n @proximo = doc.css('#ProximoTXT').inner_text\n @siguiente = doc.css('#SiguienteTXT').inner_text\n @duracion = doc.css('#DuracionTXT').inner_text\n end", "title": "" }, { "docid": "6cf6bc615ccdd2542f7beff0372fede3", "score": "0.5679506", "text": "def travel_params\n params.require(:travel).permit(:time, :distance, :value, :user_identification, :user_phone, :user_email, :user_id)\n end", "title": "" }, { "docid": "d92b8c68038a11155f99aff7766de7ef", "score": "0.5673728", "text": "def index\n\n @start_time = set_params(:start_time)\n\n date_str, hour = @start_time.split(' ')\n @date = date_str ? Date.parse(date_str) : Date.today\n @hour = hour ? hour.gsub(/:\\d+/, \"h\") : \"12h\"\n\n @address = set_params(:address)\n\n set_travel_time\n\n @level = current_user.profile.level\n\n set_preferred_spots\n set_spots\n set_ratings_n_markers\n end", "title": "" }, { "docid": "7fdf9f04ce03d2bbcd542a194584d8ea", "score": "0.56719226", "text": "def get_time_table_with_http_info(type, stopid, routeid, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TimetableInformationApi.get_time_table ...\"\n end\n # verify the required parameter 'type' is set\n fail ArgumentError, \"Missing the required parameter 'type' when calling TimetableInformationApi.get_time_table\" if type.nil?\n # verify enum value\n unless ['week'].include?(type)\n fail ArgumentError, \"invalid value for 'type', must be one of week\"\n end\n # verify the required parameter 'stopid' is set\n fail ArgumentError, \"Missing the required parameter 'stopid' when calling TimetableInformationApi.get_time_table\" if stopid.nil?\n # verify the required parameter 'routeid' is set\n fail ArgumentError, \"Missing the required parameter 'routeid' when calling TimetableInformationApi.get_time_table\" if routeid.nil?\n if opts[:'format'] && !['json', 'xml'].include?(opts[:'format'])\n fail ArgumentError, 'invalid value for \"format\", must be one of json, xml'\n end\n # resource path\n local_var_path = \"/timetableinformation\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'type'] = type\n query_params[:'stopid'] = stopid\n query_params[:'routeid'] = routeid\n query_params[:'format'] = opts[:'format'] if !opts[:'format'].nil?\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json', 'application/xml']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json', 'application/xml']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'TimetableList')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TimetableInformationApi#get_time_table\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "02043455b9fb364e53377dbe02e2bc26", "score": "0.5670202", "text": "def time_until(station)\n data = get_and_parse_json\n time = 0\n data['Trips'].each do |trip|\n end\n end", "title": "" }, { "docid": "78be5aca4fb261e8757c8a3f5a2a9d0a", "score": "0.566247", "text": "def timegrid()\n require_authentication!\n options = make_options(\"getTimegridUnits\")\n response = self.class.post(\"/WebUntis/jsonrpc.do;jsessionid=#{@session_id}?school=#{@school}\", options)\n raise response[\"error\"][\"message\"] unless response[\"error\"].nil?\n response[\"result\"]\n end", "title": "" }, { "docid": "b3459a8630276d9a502ec725b5ee1326", "score": "0.5660935", "text": "def today_closest\r\n date_range_object = params[:date_range_object_milli]\r\n lat_lng_object = params[:lat_lng]\r\n branch = params[:branch]\r\n start_milli = date_range_object[:start_date]\r\n end_milli = date_range_object[:end_date]\r\n lat = lat_lng_object[:lat]\r\n lng = lat_lng_object[:lng]\r\n \r\n p start_milli\r\n p end_milli\r\n p lat\r\n p lng\r\n p branch\r\n\r\n best_trips = getClosestTrips(start_milli, end_milli, lat, lng, branch)\r\n render json: best_trips.to_json()\r\nend", "title": "" }, { "docid": "4ff9ae87853730428e733fe9f65e84e5", "score": "0.5659575", "text": "def get_current_shared_secret_time_to_live_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ScanEngineApi.get_current_shared_secret_time_to_live ...'\n end\n # resource path\n local_var_path = '/api/3/scan_engines/shared_secret/time_to_live'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Integer')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ScanEngineApi#get_current_shared_secret_time_to_live\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "dc0551e6e48106fd1e05c8eaaf24c305", "score": "0.5658231", "text": "def time_on_path(d)\n getTimeOnPath(view_path_coordinates[\"LonLat\"], average_speed, d)\n end", "title": "" }, { "docid": "473e5edc4aecaca4b57c50934a6f3e09", "score": "0.56554", "text": "def get_time_required\n 20.0\n end", "title": "" }, { "docid": "089f85318a522947c80d19d6b23d5818", "score": "0.5651575", "text": "def get_departures station_name\n\t# See if the station was accessed before\n\t$stationsAccessed.each do |station|\n\t\tif (station[\"station_code\"] == station_name)\n\t\t\tputs \"Seen before\"\n\t\t\treturn station\n\t\tend\n\tend\n\n\t# If not accessed before\n\tputs \"======== MADE A REQUEST TO TRANSPORT API POOOR THEM\"\n\tget_request = JSON.parse(HTTP.get(\"https://transportapi.com/v3/uk/train/station/#{station_name}/live.json?app_id=#{APP_ID}&app_key=#{APP_KEY}&darwin=false&train_status=passenger\").body)\n\t$stationsAccessed.push(get_request)\n\treturn get_request\nend", "title": "" }, { "docid": "419882228ae04c440a809ba3257539d8", "score": "0.56509054", "text": "def times\n driver_order_times.map{|dto| dto.tour.time}\n end", "title": "" }, { "docid": "d4e4a1c046d4643a9a6ec4e9e8ea6109", "score": "0.5649756", "text": "def difference_in_time(route, direction, stop)\n departure_time = datetime_from_departure(route, direction, stop)\n # Get the difference in seconds between the two dates\n difference = ((departure_time - DateTime.now) * 24 * 60 * 60).to_i\n # Calculate the minutes and seconds remaining\n minutes = difference / 60\n seconds = difference - minutes * 60\n # Return the difference in a string format\n \"#{minutes} Minutes #{seconds} Seconds\"\nend", "title": "" }, { "docid": "0fe3349e9ef08007f61f9b1fa1fd21b4", "score": "0.56488717", "text": "def get_arrival_times(route, stop, in_out)\n raise unless route and stop and in_out\n route_handler = Muni::Route.find(route)\n stop_handler = route_handler.send(in_out.to_sym).stop_at(stop)\n raise \"Couldn't find stop: found '#{stop_handler.title}' for '#{stop}'\" if\n stop != stop_handler.title\n return stop_handler.predictions.map(&:time)\nend", "title": "" }, { "docid": "de3d37132831de258ca2afd54448436f", "score": "0.56417274", "text": "def show\n respond_to do |format|\n format.html\n format.json { render :json => @vehicle_stop_time.to_json(:include => [:vehicle_trip, :vehicle_stop]) }\n end\n end", "title": "" }, { "docid": "f0795e18a7bcdb0d379d3f204750476f", "score": "0.5638484", "text": "def tsp_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TSPApi.tsp ...'\n end\n # resource path\n local_var_path = '/tsp'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'multipart/form-data'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse20045')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TSPApi#tsp\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "ae22a8e937d8ec27aac6d9f5a69df601", "score": "0.5638299", "text": "def station_time(station)\n\n # If a station has multiple stations codes we join the codes together\n @station_code = station['Code']\n if !station['StationTogether1'].empty?\n @station_code += \",#{station['StationTogether1']}\"\n end\n if !station['StationTogether2'].empty?\n @station_code += \",#{station['StationTogether2']}\"\n end\n\n # The call to the api is made and the prediction times are returned\n @metro_time = RestClient.get \"#{BASE_URL}/StationPrediction.svc/json/GetPrediction/#{@station_code}\", :params => {\n \"api_key\" => API_KEY,\n \"subscription-key\" => API_KEY\n }\n @metro_time\n end", "title": "" }, { "docid": "ca318c2a54d0a0bcfa99e98fb5db60f1", "score": "0.56335676", "text": "def get_time\n send_to_plug(:time => {:get_time =>{}})\n end", "title": "" }, { "docid": "99b6b0d71a9c6d0d26d8b41f9e715c3e", "score": "0.562898", "text": "def google_timezone_api_proxy\n require \"net/http\"\n if params[:place_id]\n url = \"https://maps.googleapis.com/maps/api/place/details/json?placeid=#{params[:place_id]}&fields=geometry&key=#{Rails.application.credentials[:google_maps][:api_key]}&sessiontoken=#{params[:google_session]}\"\n uri = URI(url)\n response = JSON.parse(Net::HTTP.get(uri))\n if response[\"result\"]\n latitude = response.dig(\"result\", \"geometry\", \"location\", \"lat\")\n longitude = response.dig(\"result\", \"geometry\", \"location\", \"lng\")\n tz_url = \"https://maps.googleapis.com/maps/api/timezone/json?location=#{latitude},#{longitude}&timestamp=#{Time.now.to_i}&key=#{Rails.application.credentials[:google_maps][:api_key]}\"\n tz_uri = URI(tz_url)\n tz_response = Net::HTTP.get(tz_uri)\n render json: tz_response\n else\n render json: {}\n end\n else\n render json: {}\n end\n end", "title": "" }, { "docid": "a2398317ea9d3f51bdebe1bce3b38002", "score": "0.56286925", "text": "def get_current_location\n puts 'get me'.yellow\n response = Typhoeus.get(\"https://api.box.com/2.0/events?stream_position=now\",\n HEADER_OPTIONS\n )\n puts \"Response: #{response.body}\"\n response = JSON.parse(response.body)\n current_location = response['next_stream_position']\n puts \"The current location is: #{current_location}\".blue\n current_location\nend", "title": "" }, { "docid": "a0a633fb5891b55041358e81cc271dba", "score": "0.5628195", "text": "def travel_params\n\t\t\tparams.require(:travel).permit(:user_id, :dep_address, :dep_lat, :dep_lng, :stage_address, :stage_lat, :stage_lng, :arr_address, :arr_lat, :arr_lng, :dep_time, :arr_time, :stage_time, :semi_distance, :semi_time, :distance, :time, :way)\n\t\tend", "title": "" }, { "docid": "3556f97342353db2d3b42a4b2d021fce", "score": "0.5626756", "text": "def get_route_flying_time(metro_list)\n time_sum = 0\n metro_list.each_cons(2) do |metro1, metro2|\n flight_distance = @map.get_route(metro1, metro2)\n if flight_distance > 400\n time = (flight_distance + 400) / 750\n else\n time = sqrt(flight_distance) / 37.5\n end\n time_sum += time\n end\n return time_sum\n end", "title": "" }, { "docid": "14376ba1dde07a92067497352090cb5c", "score": "0.56243885", "text": "def get_route\n res = if params[:route_id] == 'all'\n normalize_and_pad_data(RouteDelay.on_week_days.avg_global_delay)\n else\n normalize_and_pad_data(RouteDelay.route(params[:route_id]).on_week_days.avg_global_delay)\n end\n render json: res, status: 200\n end", "title": "" }, { "docid": "009441f4c95a8e66755377f9240ca6e6", "score": "0.56186473", "text": "def intarrival()\n\t\t'''Returns the interarrival time'''\n\t\treturn @_intarrival\n\tend", "title": "" } ]
0fd6cb738c6d1a7b83d3c568e122d859
Initializes the exception instance. message:: The exception message. details:: An object with details about the exception.
[ { "docid": "96bb0e35540cc1571bdf941a8c6240dc", "score": "0.73815966", "text": "def initialize(message = nil, details = nil)\n @details = details\n super(message)\n end", "title": "" } ]
[ { "docid": "c076824b340fd86ff4ff5bc0d76239e4", "score": "0.6780305", "text": "def initialize\n @message = 'Unknown Exception'\n end", "title": "" }, { "docid": "3ed36f1cb2be9bfafce7ec79ef24ae66", "score": "0.66228783", "text": "def initialize(status_code, details)\n @error_type = details['type'].to_sym\n @status_code = status_code\n super(details['message'] || details['type'])\n end", "title": "" }, { "docid": "2f47247ab4d2973d68d0e4660065446a", "score": "0.61525655", "text": "def initialize(msg, original_exception, language)\n super(msg)\n @message = msg\n @original_exception = original_exception\n @language = language\n end", "title": "" }, { "docid": "8e031b8920dca20f1bab772535bdc345", "score": "0.6131851", "text": "def initialize(message = nil, cause_exception = nil)\n @message = message\n @cause = cause_exception\n end", "title": "" }, { "docid": "c612ae6e8d90b8459871295a1d08d0d1", "score": "0.6094358", "text": "def initialize(exception)\n @exception = exception\n end", "title": "" }, { "docid": "a1b5abe0277b0d52cc92d01a69f4a83a", "score": "0.609202", "text": "def initialize(exception)\n @exception = exception\n end", "title": "" }, { "docid": "5a0a35cefd40e81f075fb29aa65a0082", "score": "0.60248417", "text": "def initialize(message=nil, code=\"500\")\n @message=message\n @code=code\n end", "title": "" }, { "docid": "5a0a35cefd40e81f075fb29aa65a0082", "score": "0.60248417", "text": "def initialize(message=nil, code=\"500\")\n @message=message\n @code=code\n end", "title": "" }, { "docid": "5a0a35cefd40e81f075fb29aa65a0082", "score": "0.60248417", "text": "def initialize(message=nil, code=\"500\")\n @message=message\n @code=code\n end", "title": "" }, { "docid": "98f2fc0d54f32b90c3bece33ebbb54d0", "score": "0.5957321", "text": "def error(message, details = nil)\n log_error \"[ #{self} ] - #{message}#{details.nil? ? '' : \"\\n#{details}\"}\" if @expected_failure.nil?\n @errors << message\n end", "title": "" }, { "docid": "0cc86cb0dc378cd14d023d7a2a0fbcc2", "score": "0.59084755", "text": "def exception_details(e, msg); end", "title": "" }, { "docid": "d46981c91249eafffc79af4133fca16f", "score": "0.5889316", "text": "def initialize(*args)\n msg = nil\n while (arg = args.shift)\n case arg\n when String then msg = arg\n when Exception then @original_exception = arg\n end\n end\n msg ||= @original_exception&.message\n super(msg)\n end", "title": "" }, { "docid": "fa525ad50a17fd4a84f9081099d30a16", "score": "0.588764", "text": "def initialize(event_id, execution, workflow_type, reason, details)\n @cause = details\n # TODO This should probably do more with the event_id, execution, workflow_type\n super(reason, details)\n end", "title": "" }, { "docid": "62f213e4d3c51ee4fb94d435db417c39", "score": "0.58675206", "text": "def initialize(message)\n @message = message\n end", "title": "" }, { "docid": "28c7c3b20caa425460eb8e335789bef6", "score": "0.5859549", "text": "def initialize(msg, original_exception, language, file, commit_id)\n super(msg)\n @message = msg\n @original_exception = original_exception\n @language = language\n @file = file\n @commit_id = commit_id\n end", "title": "" }, { "docid": "4aa28da915acffe0404dadd3a83cefc9", "score": "0.5853361", "text": "def initialize(message)\n self.message = message\n end", "title": "" }, { "docid": "4aa28da915acffe0404dadd3a83cefc9", "score": "0.5853361", "text": "def initialize(message)\n self.message = message\n end", "title": "" }, { "docid": "4aa28da915acffe0404dadd3a83cefc9", "score": "0.5853361", "text": "def initialize(message)\n self.message = message\n end", "title": "" }, { "docid": "cfa82f139a75aa8b1dc749c2dc698d96", "score": "0.5831387", "text": "def initialize(message)\n @message = message\n end", "title": "" }, { "docid": "cfa82f139a75aa8b1dc749c2dc698d96", "score": "0.5831387", "text": "def initialize(message)\n @message = message\n end", "title": "" }, { "docid": "cfa82f139a75aa8b1dc749c2dc698d96", "score": "0.5831387", "text": "def initialize(message)\n @message = message\n end", "title": "" }, { "docid": "59118c4abd8744584ffaa5db8c9d113f", "score": "0.5800739", "text": "def initialize(message=nil, params={})\n @help_func=params[:help_func]\n @message=message\n @local_msg=\"Error\"\n @retry = params[:retry]\n @error_code= params[:error_code]\n super(message)\n end", "title": "" }, { "docid": "cfb2717be0f0374f6b6bd7d54fac83c8", "score": "0.5766379", "text": "def initialize\n @details = {}\n end", "title": "" }, { "docid": "f491f0a108706f156890bfa77f0965dd", "score": "0.5758152", "text": "def initialize(message, code = 500)\n super(message)\n @code = code\n end", "title": "" }, { "docid": "81ff8aefd5e348a3f128883cdc8e9b49", "score": "0.57527965", "text": "def initialize(message, code = 500)\n super(message)\n @code = code\n end", "title": "" }, { "docid": "5447ad80a91dcdee65041215fe4c62b4", "score": "0.57457334", "text": "def initialize(message, opts={})\n self.response = opts[:response]\n self.response_object = opts[:response_object]\n self.cause = opts[:cause]\n\n ## Try to help out with the message\n if self.response_object\n if error = self.response_object['error']\n message = \"#{message} (#{error})\"\n end\n elsif self.response\n message = \"#{message} (\\\"#{self.response.inspect}\\\")\"\n end\n\n super(message)\n end", "title": "" }, { "docid": "ccdadd4064f1231252c49b519dc53281", "score": "0.57442313", "text": "def initialize(message=$!)\n if message.respond_to?(:backtrace)\n super(message.message)\n @response_message = message\n else\n super(message.to_s)\n end\n end", "title": "" }, { "docid": "ccdadd4064f1231252c49b519dc53281", "score": "0.57442313", "text": "def initialize(message=$!)\n if message.respond_to?(:backtrace)\n super(message.message)\n @response_message = message\n else\n super(message.to_s)\n end\n end", "title": "" }, { "docid": "4294d2cec6db7d9975151866daea9fc3", "score": "0.5740736", "text": "def initialize(message = $!)\n if message.respond_to?(:backtrace)\n super(message.message)\n @response_message = message\n else\n super(message.to_s)\n end\n end", "title": "" }, { "docid": "23371f5ea17c1c701630fd57e2cda2b9", "score": "0.57320434", "text": "def initialize(message=nil)\n @message=message\n end", "title": "" }, { "docid": "23371f5ea17c1c701630fd57e2cda2b9", "score": "0.57320434", "text": "def initialize(message=nil)\n @message=message\n end", "title": "" }, { "docid": "23371f5ea17c1c701630fd57e2cda2b9", "score": "0.57320434", "text": "def initialize(message=nil)\n @message=message\n end", "title": "" }, { "docid": "23371f5ea17c1c701630fd57e2cda2b9", "score": "0.57320434", "text": "def initialize(message=nil)\n @message=message\n end", "title": "" }, { "docid": "27e8b78214345fcf851348addf40e821", "score": "0.5726869", "text": "def initialize(message='', options={})\n super(message)\n @java_exception = options[:java_exception]\n end", "title": "" }, { "docid": "b9cbccd96ca96e28b1fb5300b8ff63b9", "score": "0.56879807", "text": "def initialize(message)\n @message = message\n end", "title": "" }, { "docid": "b9cbccd96ca96e28b1fb5300b8ff63b9", "score": "0.56879807", "text": "def initialize(message)\n @message = message\n end", "title": "" }, { "docid": "b9cbccd96ca96e28b1fb5300b8ff63b9", "score": "0.56879807", "text": "def initialize(message)\n @message = message\n end", "title": "" }, { "docid": "b9cbccd96ca96e28b1fb5300b8ff63b9", "score": "0.56879807", "text": "def initialize(message)\n @message = message\n end", "title": "" }, { "docid": "b9cbccd96ca96e28b1fb5300b8ff63b9", "score": "0.56879807", "text": "def initialize(message)\n @message = message\n end", "title": "" }, { "docid": "dbe42fa0f6dc6a4eb62ec03235aae933", "score": "0.5683735", "text": "def initialize(message = '', code = nil, error = :invalid, resource = nil, field = nil)\n @code = code\n @error = error.to_sym\n @resource = resource\n @field = field\n super(message)\n end", "title": "" }, { "docid": "743981f46a8c0678f3ff4c5298f704b1", "score": "0.5677412", "text": "def initialize( name, header, details )\n\t\t@name = name\n\t\t@header = header\n\t\t@details = details\n\n\t\t@exchange = nil\n\t\t@queue = nil\n\t\t@thread = nil\n\tend", "title": "" }, { "docid": "d7b85bdce9797132dc43ab83fd9586dd", "score": "0.5665657", "text": "def initialize(message, status)\n\t\t\t\t\tsuper(message)\n\t\t\t\t\t@code = status\n\t\t\t\tend", "title": "" }, { "docid": "739f932acd9abb059dc21eb0993d0076", "score": "0.56455666", "text": "def initialize(message, code=1)\n super(message)\n @message = message\n @code = code\n end", "title": "" }, { "docid": "5e1983963130434ab7741967e320f1b3", "score": "0.5639389", "text": "def initialize(message=nil, errno=0x1111)\n @message = message\n @errno = errno\n end", "title": "" }, { "docid": "731a098f4a4f2ee389679c6400214398", "score": "0.56302655", "text": "def initialize(code, message, cause_exception)\n @code = code\n super(message, cause_exception)\n end", "title": "" }, { "docid": "3df19b9892cbb005b79ebe0ecd26c6ff", "score": "0.56120527", "text": "def initialize(message=nil)\n @message = message\n end", "title": "" }, { "docid": "56e39796badfadbb9e21191f8056d73c", "score": "0.5607986", "text": "def initialize(message)\n @message = message\n end", "title": "" }, { "docid": "959ef3278e46f26fb9ada982f36e56b0", "score": "0.55795807", "text": "def initialize(message, code = FFI.errno, original = nil)\n @original = original\n super(message + \": #{self.class.format_error_code(code)}\")\n\n @code = code\n end", "title": "" }, { "docid": "7c5a215a9379deb8df138382bfc83721", "score": "0.55668354", "text": "def initialize(status: , message: )\n @failure_status = status\n @message = message\n self.errors.add(:base, message)\n end", "title": "" }, { "docid": "9ea34d666fc4282bd00d0c32226286f5", "score": "0.55579114", "text": "def initialize(params = {})\n set_error(params)\n set_message(params[:message])\n set_error_identifiers(params)\n set_http_code(params[:http_code])\n set_go_to(params[:go_to])\n set_error_data(params[:error_data])\n @data = params[:data] || {}\n end", "title": "" }, { "docid": "220e45ab19f3a6a0325f2d0f5ce8f08e", "score": "0.55523884", "text": "def initialize_message\n\t\t@message = Message.new\n\tend", "title": "" }, { "docid": "86421a19702e7d0da412cbc85a35f3fd", "score": "0.5551488", "text": "def initialize(message, lineno = -1, filename = nil, nested = $!)\n super(message)\n @nested = nested\n @lineno = lineno\n @filename = filename\n if (-1 == @lineno || nil == @filename)\n guess_template_info\n end\n @raw_message = message\n update_repr\n end", "title": "" }, { "docid": "191a80a0e5bfe3254ba3ec885e266971", "score": "0.55264324", "text": "def initialize(order_details)\n raise \"Should not be initialized directly. Use the `.build` factory method instead\" unless order_detail_validator_class\n @order_details = order_details\n end", "title": "" }, { "docid": "30ca9191aa8763117ea1f345d152380a", "score": "0.5497271", "text": "def initialize(message, errors = nil)\n @message = message\n\n @errors = errors ? flatten_errors(errors) : []\n end", "title": "" }, { "docid": "05034cde3c17c33c8ffc9be2c515c98a", "score": "0.5495516", "text": "def initialize(message = nil, code = nil)\n super(message)\n @code = code\n end", "title": "" }, { "docid": "a48a00af75f20e8ba3a572fd838d7ef9", "score": "0.5479898", "text": "def initialize(message, status=nil)\n @status = status\n\n super(message)\n end", "title": "" }, { "docid": "7d46400312259fa6f4e89ce8ed6fc53b", "score": "0.5469809", "text": "def initialize(recipe_details)\n\t\t\n\t\t@label = recipe_details['label']\n\n\n\t\t@uri = \"\"\n real_uri = false\n\n recipe_details['uri'].each_char do |character|\n if character == \"_\"\n real_uri = true\n end\n\n if real_uri\n @uri << character\n end\n end\n\n\t\tif @uri == nil || @uri == \"\" || @label == nil || @label == \"\"\n\t\t\traise ArgumentError\n\t\tend\n\n\t\t@image = recipe_details['image']\n\t\t@url = recipe_details['url']\n\t\t@shareas = recipe_details['shareas'] #link to the recipe on edamam website, as opposed to the source website\n\t\t@ingredients = recipe_details['ingredients']\n\t\t@calories = recipe_details['calories']\n\t\t@totalNutrients = recipe_details['totalNutrients']\n\t\t@totalDaily = recipe_details['totalDaily']\n\tend", "title": "" }, { "docid": "f6f5d26cff692c03271193af14c636fa", "score": "0.5468018", "text": "def initialize(error_source:, error_type:, error_code:, message:)\n @error_source = error_source\n @error_type = error_type\n @error_code = error_code\n @message = message\n end", "title": "" }, { "docid": "b647c2484565ca8533c0743e1f174162", "score": "0.5463778", "text": "def initialize(status, message = nil)\n self.status = status\n self.message = message\n\n unless self.message.present?\n status_message = Rack::Utils::HTTP_STATUS_CODES[status]\n self.message = \"[#{status_message.gsub(' ', '_').underscore.upcase}] #{status_message}\"\n end\n\n @messages = []\n @field_errors = {}\n\n parse(self.message)\n\n super(self.message)\n end", "title": "" }, { "docid": "384a4bb598359204c72811d43c91f090", "score": "0.5457257", "text": "def initialize(message = nil, object = nil)\n @object = object\n @code = object.http_code || NOCODE\n super(JSON.parse(object.body)['message'])\n rescue NoMethodError, JSON::ParserError\n @code = NOCODE\n super(message)\n end", "title": "" }, { "docid": "76c4a65014093f675122adc0bdeb2ce1", "score": "0.5450201", "text": "def initialize(params = {})\n set_error(params)\n set_message(params[:message])\n set_http_code(params[:http_code])\n @data = params[:data] || {}\n end", "title": "" }, { "docid": "74852149ccdd372f829d59e9ff375985", "score": "0.5433357", "text": "def initialize(message, issue_code = nil)\n super(message, kind, nil, issue_code)\n end", "title": "" }, { "docid": "5b18b616e9620fba6bbd33fe394c2329", "score": "0.54223484", "text": "def initialize(message,exit_code)\n super(message)\n @exit_code = exit_code\n end", "title": "" }, { "docid": "25f75eff6bc7a0f299b134369eaa3664", "score": "0.5414365", "text": "def initialize(params = nil, error_message = nil)\n @params = params\n super error_message\n end", "title": "" }, { "docid": "a78c5dcbd1248b4852bead09725bbdaa", "score": "0.54038286", "text": "def initialize(message, code, commands = nil)\n @error_code = code\n @error_text = message\n @commands = commands\n message = \"Error [#{code}]: #{message}\"\n super(message)\n end", "title": "" }, { "docid": "57d2afdf746ab177ff21623f5d3cdbc8", "score": "0.5401146", "text": "def initialize(message:, backtrace:)\n @message = Concierge::Context::Message.new(\n label: LABEL,\n message: message,\n backtrace: backtrace\n )\n end", "title": "" }, { "docid": "1bb551586087e347a8209e45e10fad88", "score": "0.53864264", "text": "def occurred(message)\n @message = message\n mail subject: 'Pragmatic Store Error Occurred'\n end", "title": "" }, { "docid": "3ca2bc59c88a6fdc3f15a6bdf1795aa4", "score": "0.5381563", "text": "def initialize(params)\n\t\tparams.transform_keys!(&:to_sym)\n\t\t@timestamp = DateTime.parse params[:timestamp]\n\t\tunless params[:status_exception_description].blank?\n\t\t\t@description = params[:status_exception_description]\n\t\telse\n\t\t\t@description = params[:event_description]\n\t\tend\n\tend", "title": "" }, { "docid": "b746a6f0231a35a49b1cf4c1b4c6ac11", "score": "0.53807425", "text": "def initialize(id, activity_id, reason, details)\n @id = id\n @activity_id = activity_id\n @cause = details\n super(reason, details)\n end", "title": "" }, { "docid": "02008f4f9c3f7d24c9775ab300905086", "score": "0.5375316", "text": "def initialize(details) # details will now be a hash\r\n\t\tbinding.pry\r\n\t\t@name = details[:name]\r\n\t\t@language = details[:language]\r\n\t\t@release_date = details[:release_date]\r\n\t\tbinding.pry\r\n\tend", "title": "" }, { "docid": "e639ff0bff2b503dc7062a226cfb42e9", "score": "0.53452224", "text": "def initialize(data)\n message = data.name.dup << \": \" << data.message\n backtrace = data.backtrace.map { |i| Base64.decode64(i) }\n backtrace.reject! { |i| i.empty? }\n \n super(message)\n self.set_backtrace(backtrace)\n end", "title": "" }, { "docid": "0ed887996201744ffb0056bdfca27f41", "score": "0.534011", "text": "def initialize(message)\n super()\n\n show_message(message)\n end", "title": "" }, { "docid": "31e2e99e068c04453a262aec7db97d75", "score": "0.5333897", "text": "def initialize(message = nil)\n super(message || DEFAULT_MESSAGE)\n end", "title": "" }, { "docid": "6fa13f4ee48e25c220b5b2f27a2afd81", "score": "0.5333216", "text": "def initialize(msg = nil)\n @backtrace = nil\n @message = msg\n end", "title": "" }, { "docid": "f9154a1e209764f6051458d65d935e60", "score": "0.5324339", "text": "def initialize(initial_hash = nil)\n super\n @optional_method_names = %i[message typeName fullTypeName evaluateName stackTrace innerException]\n end", "title": "" }, { "docid": "e99cade09bee67a3af3ac5292e9d6283", "score": "0.53143424", "text": "def initialize(details = {})\n required = [:package_id, :summary, :events]\n valid = required + [:weight, :service, :service_code, :estimated_delivery_date, :origin, :destination, :delivered_at]\n validate_options(details, required, valid)\n \n @package_id = details[:package_id]\n @summary = details[:summary]\n @origin = details[:origin]\n @destination = details[:destination]\n @events = details[:events]\n @weight = details[:weight] || nil\n @delivered_at = details[:delivered_at]\n @estimated_delivery_date = details[:estimated_delivery_date] || nil\n @service = details[:service] || nil\n @service_code = details[:service_code] || nil\n end", "title": "" }, { "docid": "608601511b2b89caf22ef07cb8d08262", "score": "0.5304834", "text": "def initialize(message = nil, response = nil)\n @response = response\n @code = response.code\n\n json = JSON.parse(response.body)\n api_message = json['error'] || json['errors']\n\n message ||= ''\n message = \"#{message} #{api_message}\"\n\n super(message, response)\n rescue NoMethodError, JSON::ParserError\n super(message, response)\n end", "title": "" }, { "docid": "f9ac686282190b3a4da5c42a8b9b9c1e", "score": "0.5290333", "text": "def initialize(message = MESSAGE)\n super\n end", "title": "" }, { "docid": "11aeac9257f8251efb8a92f856671b0f", "score": "0.52853096", "text": "def initialize(details)\n @creator_id = BlackhawkIdentity.new(details.creatorId)\n @updater_id = BlackhawkIdentity.new(details.updaterId)\n @notes = details.notes\n @created_timestamp = details.created_timestamp\n @updated_timestamp = details.updated_timestamp\n @product_urls = details.productIds\n @description = details.description\n end", "title": "" }, { "docid": "b7d12106ecbd8aa7c90283b339d2e7b4", "score": "0.5281527", "text": "def build_new_exception e\n e.class.new(e.message)\n rescue\n Exception.new e.message\n end", "title": "" }, { "docid": "67360178effcde7cef28c61218754e70", "score": "0.5274508", "text": "def initialize( status, expected_message=nil, expected_headers={} )\n\n\t\t\t# Allow headers, but no message\n\t\t\tif expected_message.is_a?( Hash )\n\t\t\t\texpected_headers = expected_message\n\t\t\t\texpected_message = nil\n\t\t\tend\n\n\t\t\t@expected_status = status\n\t\t\t@expected_message = expected_message\n\t\t\t@expected_headers = expected_headers || {}\n\n\t\t\t@failure = nil\n\t\tend", "title": "" }, { "docid": "421e54e7a9580b1186c3413dd5fadc0a", "score": "0.5272156", "text": "def initialize(message, action) # estamos creando una nueva excepcion!!!! que hereda todo lo de StandardError\n # Call the parent's constructor to set the message\n super(message)\n\n # Store the action in an instance variable\n @action = action\n end", "title": "" }, { "docid": "89e6a1a9e61f3d7357ac793121aef532", "score": "0.52654266", "text": "def initialize(name, message)\n @name = name\n @message = message\n end", "title": "" }, { "docid": "99e09994da9831b51f11c2b3438efd39", "score": "0.5264935", "text": "def initialize(msg = '', opts = {})\n super(msg)\n @backtrace = opts[:backtrace] \n end", "title": "" }, { "docid": "7aa947f3c13b0aed90561dd522791ff8", "score": "0.5264879", "text": "def exception(exception, status)\n @current_step[:exception] = build_exception_detail(exception)\n end", "title": "" }, { "docid": "a30d3c90cbb5fb3c9e9d9e314ab57929", "score": "0.5250797", "text": "def initialize(message = nil, response = nil)\n @response = response\n @code = if response.nil?\n NOCODE\n else\n response.code\n end\n\n begin\n api_message = JSON.parse(response.body)['message']\n rescue JSON::ParserError\n api_message = response.body\n rescue NoMethodError\n api_message = \"Unknown API error\"\n rescue\n api_message = 'Unknown API error'\n end\n\n message = message || ''\n message = message + ': ' + api_message\n\n super(message, response)\n rescue NoMethodError, JSON::ParserError\n @code = NOCODE\n super(message, response)\n end", "title": "" }, { "docid": "6cb07b8d24675434cd5da42220eeffd6", "score": "0.52192837", "text": "def initialize(message, exit_code = ExitCodes::STARTUP_ERROR)\n super(message)\n @exit_code = exit_code\n end", "title": "" }, { "docid": "a627ba611cea97b566a452391720cdd7", "score": "0.5215999", "text": "def initialize(message, errors, code=nil, content=nil)\n Hyperion::Util.guard_param(message, 'a message string', String)\n Hyperion::Util.guard_param(errors, 'an array of errors', &method(:error_array?))\n code = ClientErrorCode.from(code || errors.first.try(:code) || ClientErrorCode::UNKNOWN)\n Hyperion::Util.guard_param(code, 'a code') { ClientErrorCode.values.include?(code) }\n\n @message = message\n @code = code\n @errors = errors\n @content = content\n end", "title": "" }, { "docid": "05b4601cfb6d22cd64216aa79df6c363", "score": "0.5196357", "text": "def initialize(code, message)\n @code = code\n @message = message\n end", "title": "" }, { "docid": "16018663f70784f988a0fc8b1cd3f5ed", "score": "0.518918", "text": "def initialize\n super(MESSAGE)\n end", "title": "" }, { "docid": "10ea1e14cd50290352ca10da18b7527e", "score": "0.51795655", "text": "def initialize(code, message)\n @code = code\n @message = message\n end", "title": "" }, { "docid": "3cd5e60ca48d40e9527bdef37babe648", "score": "0.51751006", "text": "def initialize(message:)\n @message = message\n @timestamp = Time.now\n end", "title": "" }, { "docid": "e991e5920a91a85d39daf62b7ba9d85f", "score": "0.5172368", "text": "def initialize code, message\n @code = code\n @message = message\n end", "title": "" }, { "docid": "0880fe8fa8880e35fae294c725a2ddb8", "score": "0.5165509", "text": "def initialize(message = nil, param = {})\n super(message) ;\n @param = param ;\n end", "title": "" }, { "docid": "34f3e65be2e072c3fef5e262a8442526", "score": "0.51616925", "text": "def initialize(figure, reason)\n super(figure << \". \" << reason)\n @figure = figure\n @reason = reason\n end", "title": "" }, { "docid": "53a27c1f759099317e3f09a1f588116f", "score": "0.5137221", "text": "def initialize(message_text)\n raise_error_if(message_text.empty?)\n @message_text = message_text \n extract_separators # sets @separators\n break_into_segments # sets @segment_units, @segments\n set_message_type # sets @type\n end", "title": "" }, { "docid": "824cccc46d73c6a809a7ece039058e7a", "score": "0.5129404", "text": "def initialize(message = nil, entity = nil)\n @entity = entity\n message ||= \"Invalid #{entity}\"\n\n super(message)\n end", "title": "" }, { "docid": "6252f47c7493dd69ee85484d84274190", "score": "0.51274824", "text": "def initialize(resource, message, options = {})\n @resource = resource\n @custom_message = evaluate_message(message)\n end", "title": "" }, { "docid": "931ba0b9197254f94b42f920cfa9dc1c", "score": "0.5126041", "text": "def error(message, status = 400, details = nil)\n error_body = {\n :success => false,\n :response_type => \"ERROR\",\n :message => message,\n }\n error_body[:details] = details if details\n render :json => error_body, :status => status\n end", "title": "" } ]
30e42c54a38d60b6c4584564a75317f1
atom = CFWS? atext+ CFWS?
[ { "docid": "13fbb915ce426bafeb2fe6183a031c32", "score": "0.6094951", "text": "def _atom\n\n _save = self.pos\n while true # sequence\n _save1 = self.pos\n _tmp = apply(:_CFWS)\n unless _tmp\n _tmp = true\n self.pos = _save1\n end\n unless _tmp\n self.pos = _save\n break\n end\n _save2 = self.pos\n _tmp = apply(:_atext)\n if _tmp\n while true\n _tmp = apply(:_atext)\n break unless _tmp\n end\n _tmp = true\n else\n self.pos = _save2\n end\n unless _tmp\n self.pos = _save\n break\n end\n _save3 = self.pos\n _tmp = apply(:_CFWS)\n unless _tmp\n _tmp = true\n self.pos = _save3\n end\n unless _tmp\n self.pos = _save\n end\n break\n end # end sequence\n\n set_failed_rule :_atom unless _tmp\n return _tmp\n end", "title": "" } ]
[ { "docid": "56bb412c24a994d82121ac027da7ff32", "score": "0.6200111", "text": "def atom() puts \"ATOM\" end", "title": "" }, { "docid": "86780583ecdaa7506b4a40ea7fb96091", "score": "0.5860611", "text": "def quote_atom(str); end", "title": "" }, { "docid": "5104ab5319ddfb00c3fa3748613e9ec8", "score": "0.5404313", "text": "def atom_attrb(name)\n self.attrb(['atom', Atom::NS], name)\n end", "title": "" }, { "docid": "e86e8503327ba1d75d0564dec2d864b3", "score": "0.5388231", "text": "def atom_string(name)\n attr_accessor name\n\n self.parse_plain(Atom::NS, name)\n self.build_plain(['atom', Atom::NS], name)\n end", "title": "" }, { "docid": "afac241e6be3ca751796358f11b5ed58", "score": "0.53548616", "text": "def atom\n body.to_atom\n end", "title": "" }, { "docid": "afac241e6be3ca751796358f11b5ed58", "score": "0.53548616", "text": "def atom\n body.to_atom\n end", "title": "" }, { "docid": "f78471386841cca104ef86569c7631d5", "score": "0.52519846", "text": "def atom\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 6 )\n result = nil\n a = nil\n r = nil\n\n begin\n # at line 83:7: (a= INT | a= FLOAT | LPAREN r= expression RPAREN | a= MODVAR | a= UNMODVAR )\n # at line 83:7: (a= INT | a= FLOAT | LPAREN r= expression RPAREN | a= MODVAR | a= UNMODVAR )\n alt_5 = 5\n case look_5 = @input.peek( 1 )\n when INT then alt_5 = 1\n when FLOAT then alt_5 = 2\n when LPAREN then alt_5 = 3\n when MODVAR then alt_5 = 4\n when UNMODVAR then alt_5 = 5\n else\n raise NoViableAlternative( \"\", 5, 0 )\n end\n case alt_5\n when 1\n # at line 83:8: a= INT\n a = match( INT, TOKENS_FOLLOWING_INT_IN_atom_341 )\n # --> action\n result = BigDecimal(a.text)\n # <-- action\n\n when 2\n # at line 84:8: a= FLOAT\n a = match( FLOAT, TOKENS_FOLLOWING_FLOAT_IN_atom_356 )\n # --> action\n result = BigDecimal(a.text)\n # <-- action\n\n when 3\n # at line 85:8: LPAREN r= expression RPAREN\n match( LPAREN, TOKENS_FOLLOWING_LPAREN_IN_atom_367 )\n @state.following.push( TOKENS_FOLLOWING_expression_IN_atom_371 )\n r = expression\n @state.following.pop\n # --> action\n result = r \n # <-- action\n match( RPAREN, TOKENS_FOLLOWING_RPAREN_IN_atom_375 )\n\n when 4\n # at line 86:8: a= MODVAR\n a = match( MODVAR, TOKENS_FOLLOWING_MODVAR_IN_atom_386 )\n # --> action\n\n \t\t\t\t\t\tresult = @objectCache.send(a.text)\n \t\t\t\n # <-- action\n\n when 5\n # at line 89:8: a= UNMODVAR\n a = match( UNMODVAR, TOKENS_FOLLOWING_UNMODVAR_IN_atom_400 )\n # --> action\n \n \t\t\t\t\t\tcase a.text \n \t\t\t\t\t\t\twhen 'R'\n \t\t\t\t\t\t\t\tresult = @objectCache.runtime \n \t\t\t\t\t\t\twhen 'U'\n \t\t\t\t\t\t\t\tresult = @objectCache.send(a.text)\n \t\t\t\t\t\t\twhen 'V'\n \t\t\t\t\t\t\t\tresult = @objectCache.send(a.text)\n \t\t\t\t\t\t\telse\n \t\t\t\t\t\t\t\tresult = BigDecimal(\"0\")\n \t\t\t\t\t\t\tend\n \t\t\t\t\t \n # <-- action\n\n end\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 6 )\n\n end\n \n return result\n end", "title": "" }, { "docid": "a7d8ff08ff40eb457c7beb881ceb7345", "score": "0.51711977", "text": "def parse_atom\n tok = @tokenizer.token\n if tok.is_identifier?\n return AST::Identifier.new(tok)\n elsif tok.is_number?\n return AST::Number.new(tok)\n elsif tok.is_number?\n return AST::Number.new(tok)\n elsif tok.is_boolean?\n return AST::BoolConst.new(tok)\n elsif tok.is_null?\n return AST::Null.new(tok)\n elsif tok.nil?\n return nil\n else\n show_error \"Unknown atom #{tok}!\"\n end\n end", "title": "" }, { "docid": "155b84df1c025ff0b902ec1e87595415", "score": "0.5143731", "text": "def atom_ext\n length = read(2, 'n')\n read(length, nil).to_sym\n end", "title": "" }, { "docid": "cfa0a6a372b1117ed825d46a5218294c", "score": "0.514339", "text": "def atom\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 23 )\n return_value = AtomReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n op = nil\n __RULE_REF110__ = nil\n __ARG_ACTION111__ = nil\n terminal107 = nil\n range108 = nil\n not_set109 = nil\n\n tree_for_op = nil\n tree_for_RULE_REF110 = nil\n tree_for_ARG_ACTION111 = nil\n stream_BANG = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token BANG\" )\n stream_ROOT = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token ROOT\" )\n stream_RULE_REF = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token RULE_REF\" )\n stream_ARG_ACTION = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token ARG_ACTION\" )\n stream_range = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule range\" )\n stream_not_set = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule not_set\" )\n begin\n # at line 257:5: ( terminal | range ( (op= '^' | op= '!' ) -> ^( $op range ) | -> range ) | not_set ( (op= '^' | op= '!' ) -> ^( $op not_set ) | -> not_set ) | RULE_REF ( ARG_ACTION )? ( (op= '^' | op= '!' ) -> ^( $op RULE_REF ( ARG_ACTION )? ) | -> ^( RULE_REF ( ARG_ACTION )? ) ) )\n alt_56 = 4\n case look_56 = @input.peek( 1 )\n when CHAR_LITERAL then look_56_1 = @input.peek( 2 )\n\n if ( look_56_1 == RANGE )\n alt_56 = 2\n elsif ( look_56_1 == SEMPRED || look_56_1.between?( TREE_BEGIN, REWRITE ) || look_56_1.between?( TOKEN_REF, ACTION ) || look_56_1 == RULE_REF || look_56_1 == T__71 || look_56_1 == T__74 || look_56_1.between?( T__81, T__83 ) || look_56_1.between?( T__87, T__88 ) || look_56_1.between?( T__90, T__92 ) )\n alt_56 = 1\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 56, 1 )\n end\n when TOKEN_REF, STRING_LITERAL, T__90 then alt_56 = 1\n when T__87 then alt_56 = 3\n when RULE_REF then alt_56 = 4\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 56, 0 )\n end\n case alt_56\n when 1\n root_0 = @adaptor.create_flat_list\n\n\n # at line 257:9: terminal\n @state.following.push( TOKENS_FOLLOWING_terminal_IN_atom_1752 )\n terminal107 = terminal\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, terminal107.tree )\n end\n\n when 2\n # at line 258:4: range ( (op= '^' | op= '!' ) -> ^( $op range ) | -> range )\n @state.following.push( TOKENS_FOLLOWING_range_IN_atom_1757 )\n range108 = range\n @state.following.pop\n if @state.backtracking == 0\n stream_range.add( range108.tree )\n end\n # at line 259:3: ( (op= '^' | op= '!' ) -> ^( $op range ) | -> range )\n alt_50 = 2\n look_50_0 = @input.peek( 1 )\n\n if ( look_50_0.between?( ROOT, BANG ) )\n alt_50 = 1\n elsif ( look_50_0 == SEMPRED || look_50_0 == TREE_BEGIN || look_50_0 == REWRITE || look_50_0.between?( TOKEN_REF, ACTION ) || look_50_0 == RULE_REF || look_50_0 == T__71 || look_50_0 == T__74 || look_50_0.between?( T__81, T__83 ) || look_50_0 == T__87 || look_50_0.between?( T__90, T__92 ) )\n alt_50 = 2\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 50, 0 )\n end\n case alt_50\n when 1\n # at line 259:5: (op= '^' | op= '!' )\n # at line 259:5: (op= '^' | op= '!' )\n alt_49 = 2\n look_49_0 = @input.peek( 1 )\n\n if ( look_49_0 == ROOT )\n alt_49 = 1\n elsif ( look_49_0 == BANG )\n alt_49 = 2\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 49, 0 )\n end\n case alt_49\n when 1\n # at line 259:6: op= '^'\n op = match( ROOT, TOKENS_FOLLOWING_ROOT_IN_atom_1767 )\n if @state.backtracking == 0\n stream_ROOT.add( op )\n end\n\n when 2\n # at line 259:13: op= '!'\n op = match( BANG, TOKENS_FOLLOWING_BANG_IN_atom_1771 )\n if @state.backtracking == 0\n stream_BANG.add( op )\n end\n\n end\n # AST Rewrite\n # elements: range, op\n # token labels: op\n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_op = token_stream( \"token op\", op )\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 259:21: -> ^( $op range )\n # at line 259:24: ^( $op range )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( stream_op.next_node, root_1 )\n\n @adaptor.add_child( root_1, stream_range.next_tree )\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end\n when 2\n # at line 260:9: \n # AST Rewrite\n # elements: range\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 260:9: -> range\n @adaptor.add_child( root_0, stream_range.next_tree )\n\n\n\n return_value.tree = root_0\n\n end\n end\n\n when 3\n # at line 262:7: not_set ( (op= '^' | op= '!' ) -> ^( $op not_set ) | -> not_set )\n @state.following.push( TOKENS_FOLLOWING_not_set_IN_atom_1805 )\n not_set109 = not_set\n @state.following.pop\n if @state.backtracking == 0\n stream_not_set.add( not_set109.tree )\n end\n # at line 263:3: ( (op= '^' | op= '!' ) -> ^( $op not_set ) | -> not_set )\n alt_52 = 2\n look_52_0 = @input.peek( 1 )\n\n if ( look_52_0.between?( ROOT, BANG ) )\n alt_52 = 1\n elsif ( look_52_0 == SEMPRED || look_52_0 == TREE_BEGIN || look_52_0 == REWRITE || look_52_0.between?( TOKEN_REF, ACTION ) || look_52_0 == RULE_REF || look_52_0 == T__71 || look_52_0 == T__74 || look_52_0.between?( T__81, T__83 ) || look_52_0 == T__87 || look_52_0.between?( T__90, T__92 ) )\n alt_52 = 2\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 52, 0 )\n end\n case alt_52\n when 1\n # at line 263:5: (op= '^' | op= '!' )\n # at line 263:5: (op= '^' | op= '!' )\n alt_51 = 2\n look_51_0 = @input.peek( 1 )\n\n if ( look_51_0 == ROOT )\n alt_51 = 1\n elsif ( look_51_0 == BANG )\n alt_51 = 2\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 51, 0 )\n end\n case alt_51\n when 1\n # at line 263:6: op= '^'\n op = match( ROOT, TOKENS_FOLLOWING_ROOT_IN_atom_1814 )\n if @state.backtracking == 0\n stream_ROOT.add( op )\n end\n\n when 2\n # at line 263:13: op= '!'\n op = match( BANG, TOKENS_FOLLOWING_BANG_IN_atom_1818 )\n if @state.backtracking == 0\n stream_BANG.add( op )\n end\n\n end\n # AST Rewrite\n # elements: not_set, op\n # token labels: op\n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_op = token_stream( \"token op\", op )\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 263:21: -> ^( $op not_set )\n # at line 263:24: ^( $op not_set )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( stream_op.next_node, root_1 )\n\n @adaptor.add_child( root_1, stream_not_set.next_tree )\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end\n when 2\n # at line 264:9: \n # AST Rewrite\n # elements: not_set\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 264:9: -> not_set\n @adaptor.add_child( root_0, stream_not_set.next_tree )\n\n\n\n return_value.tree = root_0\n\n end\n end\n\n when 4\n # at line 266:9: RULE_REF ( ARG_ACTION )? ( (op= '^' | op= '!' ) -> ^( $op RULE_REF ( ARG_ACTION )? ) | -> ^( RULE_REF ( ARG_ACTION )? ) )\n __RULE_REF110__ = match( RULE_REF, TOKENS_FOLLOWING_RULE_REF_IN_atom_1854 )\n if @state.backtracking == 0\n stream_RULE_REF.add( __RULE_REF110__ )\n end\n # at line 266:18: ( ARG_ACTION )?\n alt_53 = 2\n look_53_0 = @input.peek( 1 )\n\n if ( look_53_0 == ARG_ACTION )\n alt_53 = 1\n end\n case alt_53\n when 1\n # at line 266:18: ARG_ACTION\n __ARG_ACTION111__ = match( ARG_ACTION, TOKENS_FOLLOWING_ARG_ACTION_IN_atom_1856 )\n if @state.backtracking == 0\n stream_ARG_ACTION.add( __ARG_ACTION111__ )\n end\n\n end\n # at line 267:3: ( (op= '^' | op= '!' ) -> ^( $op RULE_REF ( ARG_ACTION )? ) | -> ^( RULE_REF ( ARG_ACTION )? ) )\n alt_55 = 2\n look_55_0 = @input.peek( 1 )\n\n if ( look_55_0.between?( ROOT, BANG ) )\n alt_55 = 1\n elsif ( look_55_0 == SEMPRED || look_55_0 == TREE_BEGIN || look_55_0 == REWRITE || look_55_0.between?( TOKEN_REF, ACTION ) || look_55_0 == RULE_REF || look_55_0 == T__71 || look_55_0 == T__74 || look_55_0.between?( T__81, T__83 ) || look_55_0 == T__87 || look_55_0.between?( T__90, T__92 ) )\n alt_55 = 2\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 55, 0 )\n end\n case alt_55\n when 1\n # at line 267:5: (op= '^' | op= '!' )\n # at line 267:5: (op= '^' | op= '!' )\n alt_54 = 2\n look_54_0 = @input.peek( 1 )\n\n if ( look_54_0 == ROOT )\n alt_54 = 1\n elsif ( look_54_0 == BANG )\n alt_54 = 2\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 54, 0 )\n end\n case alt_54\n when 1\n # at line 267:6: op= '^'\n op = match( ROOT, TOKENS_FOLLOWING_ROOT_IN_atom_1866 )\n if @state.backtracking == 0\n stream_ROOT.add( op )\n end\n\n when 2\n # at line 267:13: op= '!'\n op = match( BANG, TOKENS_FOLLOWING_BANG_IN_atom_1870 )\n if @state.backtracking == 0\n stream_BANG.add( op )\n end\n\n end\n # AST Rewrite\n # elements: RULE_REF, ARG_ACTION, op\n # token labels: op\n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_op = token_stream( \"token op\", op )\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 267:21: -> ^( $op RULE_REF ( ARG_ACTION )? )\n # at line 267:24: ^( $op RULE_REF ( ARG_ACTION )? )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( stream_op.next_node, root_1 )\n\n @adaptor.add_child( root_1, stream_RULE_REF.next_node )\n # at line 267:39: ( ARG_ACTION )?\n if stream_ARG_ACTION.has_next?\n @adaptor.add_child( root_1, stream_ARG_ACTION.next_node )\n\n end\n\n stream_ARG_ACTION.reset();\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end\n when 2\n # at line 268:9: \n # AST Rewrite\n # elements: ARG_ACTION, RULE_REF\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 268:9: -> ^( RULE_REF ( ARG_ACTION )? )\n # at line 268:12: ^( RULE_REF ( ARG_ACTION )? )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( stream_RULE_REF.next_node, root_1 )\n\n # at line 268:23: ( ARG_ACTION )?\n if stream_ARG_ACTION.has_next?\n @adaptor.add_child( root_1, stream_ARG_ACTION.next_node )\n\n end\n\n stream_ARG_ACTION.reset();\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end\n end\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 23 )\n\n end\n \n return return_value\n end", "title": "" }, { "docid": "c6f9f48c543b56e77f42fa20aae69b55", "score": "0.512118", "text": "def addAtom(atom)\n raise \"Expecting ATOM or HETATM\" unless atom.is_a? Bio::PDB::Record::ATOM\n @atoms.push(atom)\n self\n end", "title": "" }, { "docid": "5cb5be2e05ff75c9ce8177ff45a95dc5", "score": "0.509444", "text": "def atom?\n is_content_type?('application/atom+xml')\n end", "title": "" }, { "docid": "5cb5be2e05ff75c9ce8177ff45a95dc5", "score": "0.509444", "text": "def atom?\n is_content_type?('application/atom+xml')\n end", "title": "" }, { "docid": "5cb5be2e05ff75c9ce8177ff45a95dc5", "score": "0.509444", "text": "def atom?\n is_content_type?('application/atom+xml')\n end", "title": "" }, { "docid": "5cb5be2e05ff75c9ce8177ff45a95dc5", "score": "0.509444", "text": "def atom?\n is_content_type?('application/atom+xml')\n end", "title": "" }, { "docid": "432d33786dac90c771e8cf052675cc32", "score": "0.5077091", "text": "def add_atom!(arg, bond_order=1)\n unless arg.is_a?(Rubabel::Atom)\n arg = mol.add_atom!(arg)\n end\n @ob.get_parent.add_bond(self.ob.get_idx, arg.ob.get_idx, bond_order)\n arg\n end", "title": "" }, { "docid": "b689adc6f122c56ac79fb366b15342b9", "score": "0.50649184", "text": "def atom_safe?(str); end", "title": "" }, { "docid": "966196edfd39326cad61f781d774d634", "score": "0.5033593", "text": "def atom_safe?( str )\n not ATOM_UNSAFE === str\n end", "title": "" }, { "docid": "94dbb59761b0bd8d673fdb926feba595", "score": "0.5027139", "text": "def atom(token)\n if token[/\\.\\d+/]\n token.to_f\n elsif token[/\\d+/]\n token.to_i\n elsif token == \"'\"\n :quote\n else\n token.to_sym\n end\n end", "title": "" }, { "docid": "fb14ce827b7ee665c4da0c7f7591d0e9", "score": "0.50060534", "text": "def cached_atom_ext\n read(1)\n end", "title": "" }, { "docid": "440b5f8b29f9de83814b47ef44a0dd09", "score": "0.4908463", "text": "def emulate_atom!\n aliases.merge!({\n :rights => :copyright,\n :content => :description,\n :contributor => :author,\n :id => [ :guid_value, :link ],\n :author => [ :managingeditor, :webmaster ],\n :updated => [ :lastbuilddate, :pubdate ],\n :published => [ :pubDate, :lastbuilddate ],\n :icon => :'image/url',\n :logo => :'image/url',\n :summary => :'description_trunc'\n })\n end", "title": "" }, { "docid": "b4c1ebd4f1100cf6ca06dadae4792f78", "score": "0.48956892", "text": "def atom_element(name, klass)\n self.element(['atom', Atom::NS], name, klass)\n end", "title": "" }, { "docid": "57d69c7a0afd4814e2aeefea69c08146", "score": "0.4845743", "text": "def get_atom_elem xml, name\n get_elem xml, Atom::NS, name\n end", "title": "" }, { "docid": "4e35180d0ea220e6d4a1167e2bc1b2e1", "score": "0.48386237", "text": "def valid_atom?(atom)\n # Normalize the regular expression output to a boolean\n !!(atom =~ DEPEND_ATOM_REGEX)\n end", "title": "" }, { "docid": "895560a00c7e7fda4d0a81ebb737b974", "score": "0.4819208", "text": "def atom\n error_404\n end", "title": "" }, { "docid": "f6b8cc22c554404a326a3e9d8bc6463c", "score": "0.48009357", "text": "def quote_atom( str )\n atom_safe?( str ) ? str : dquote(str)\n end", "title": "" }, { "docid": "dc622756adc3135dd7b81f296125adda", "score": "0.47955626", "text": "def build__char_literal_atom(char_literal_ast)\n c = Grammar.get_char_value_from_grammar_char_literal(char_literal_ast.get_text)\n return build__atom(c, char_literal_ast)\n end", "title": "" }, { "docid": "9cc0a89a97014cd82168bafe69265832", "score": "0.4770385", "text": "def a_CharRef(c, to_add)\n # the &... whatever is sitting in the buffer\n (@buf.length - @buf.rindex(AMP)).times { @buf.pop }\n @buf << to_add\n false\n end", "title": "" }, { "docid": "aeaa899ad8e7b47bd927f2c8844f5f1e", "score": "0.47684017", "text": "def read_atom\n case buffer = read_literal\n when '.' then buffer.to_sym\n when A then RDF_TYPE\n when BASE then @parsed_base = true; buffer.to_sym\n when NIL then nil\n when FALSE then RDF::Literal(false)\n when TRUE then RDF::Literal(true)\n when DOUBLE then RDF::Literal::Double.new(buffer)\n when DECIMAL then RDF::Literal::Decimal.new(buffer)\n when INTEGER then RDF::Literal::Integer.new(buffer)\n when BNODE_ID then @bnodes[$1] ||= RDF::Node($1)\n when BNODE_NEW then RDF::Node.new\n when ND_VAR then variable($1, distinguished: false)\n when VAR_ID then variable($1, distinguished: true)\n when ND_EVAR then variable($1, existential: true, distinguished: false)\n when EVAR_ID then variable($1, existential: true, distinguished: true)\n else buffer.to_sym\n end\n end", "title": "" }, { "docid": "f023b57d364ffedac162fdee8f1b565f", "score": "0.47638226", "text": "def atom_url\n type_rel_url \"application/atom+xml\"\n end", "title": "" }, { "docid": "cfe5a50969b49152e2c50b959ef4f4da", "score": "0.4753431", "text": "def get_atom_attrb xml, name\n xml.attributes[name.to_s]\n end", "title": "" }, { "docid": "3263d61ce3094c1b447def04ccdf5469", "score": "0.4751614", "text": "def create_atom_feed\n @items << Nanoc3::Item.new(\n \"<%= atom_feed :limit => 25, :title => 'EBible Fellowship News', \" +\n \":author_name => 'Admin', :author_uri => 'http://www.ebiblefellowship.com' %>\",\n { :extension => 'xml', :is_hidden => true },\n '/atom/'\n )\n end", "title": "" }, { "docid": "be4d6da57cd9944c8134d0596d5965c1", "score": "0.4744899", "text": "def atom(token)\n int = Integer(token) rescue nil\n float = Float(token) rescue nil\n int || float || token\nend", "title": "" }, { "docid": "2f602ce2a7b3d0a782617e68561f9a6d", "score": "0.47070253", "text": "def consume_atom!\n at = @buf.strip\n erase_buffer\n return if at.empty?\n \n the_atom = case at\n when INT_ATOM\n at.to_i\n when STR_ATOM\n unquote_s(at)\n when FLOAT_ATOM\n at.to_f\n when AT_FRAME\n if $1.include?(\".\")\n [:value_at, $1.to_f, @stack.pop]\n else\n [:value_at, $1.to_i, @stack.pop]\n end\n else\n [:atom, at]\n end\n \n push(the_atom)\n end", "title": "" }, { "docid": "ddd2638be1ddad90c0ee0d460afeb1c1", "score": "0.47036332", "text": "def atom\n if @str != nil\n @str\n elsif @options == nil and @access_token == nil\n # simply open the url\n open(@url).read\n elsif @options == nil and @url != nil\n # open the url through OAuth\n @access_token.get(@url).body\n else\n # build the atom file from internal information\n feed = TinyAtom::Feed.new(\n self.id,\n self.title,\n\n @url,\n\n :author_name => self.author.name,\n :author_email => self.author.email,\n :author_uri => self.author.uri,\n\n :hubs => self.hubs\n )\n\n @options[:entries].each do |entry|\n entry_url = entry.url\n entry_url = @url if entry_url == nil\n\n feed.add_entry(\n entry.id,\n entry.title,\n entry.updated,\n\n entry_url,\n\n :published => entry.published,\n\n :content => entry.content,\n\n :author_name => self.author.name,\n :author_email => self.author.email,\n :author_uri => self.author.uri\n )\n end\n\n feed.make(:indent => 2)\n end\n end", "title": "" }, { "docid": "91ee3779bb0e62e4dabe0f375e4419d6", "score": "0.46974707", "text": "def process_atom(atom)\n time_offset = 1\n\n # taking out site/blog link and title.\n site_link = (atom/:feed).search(:link)[1]['href']\n site_title = (atom/:feed/:title).first.inner_html\n\n puts \"processing atom for #{site_link}\"\n\n (atom/:entry).each do |item|\n link_raw = item.%('feedburner:origLink') || item.%('link')\n\n if !link_raw.blank?\n link = (link_raw).inner_html\n else\n link = (item/:link).attr('href')\n end\n\n if (Feed.find_by_link(link)).blank?\n atom_feed = Feed.new\n atom_feed.feed_url = self\n atom_feed.site_link = site_link\n atom_feed.site_title = site_title\n atom_feed.title = (item/:title).inner_html\n atom_feed.link = link\n atom_feed.author = (item/:author/:name).inner_html\n atom_feed.content = (item/:content).inner_html\n atom_feed.published = (item/:published).inner_html\n\n if atom_feed.content.blank?\n atom_feed.content = (item/:summary).inner_html\n end\n\n if atom_feed.published.blank?\n atom_feed.published = (item/:updated).inner_html\n end\n\n if atom_feed.published.blank?\n # taking it 20 days back..\n atom_feed.published = (Time.now - (20*60*60*24) - time_offset.hours).to_s(:db)\n time_offset += 1\n end\n\n atom_feed.title = htmlize(atom_feed.title)\n atom_feed.content = htmlize(atom_feed.content, link)\n atom_feed.save!\n end\n end\n end", "title": "" }, { "docid": "98628572013136bd333ca61bd4d53e0e", "score": "0.46842912", "text": "def mxptag arg\n return MXP_BEG + arg + MXP_END\nend", "title": "" }, { "docid": "e3c80f21a3e18839da5808ce824b8e40", "score": "0.46746215", "text": "def <<(atom, bond_order=1)\n add_atom!(atom, bond_order)\n end", "title": "" }, { "docid": "ff5e92ec9395f7c0d0f5c8ffa29251d4", "score": "0.4672818", "text": "def atom(base_uri)\n # Create the OStatus::PortableContacts object\n poco = OStatus::PortableContacts.new(:id => author.id,\n :display_name => author.name,\n :preferred_username => author.username)\n\n # Create the OStatus::Author object\n os_auth = OStatus::Author.new(:name => author.username,\n :uri => author.website,\n :portable_contacts => poco)\n\n # Gather entries as OStatus::Entry objects\n entries = updates.to_a.sort{|a, b| b.created_at <=> a.created_at}.map do |update|\n OStatus::Entry.new(:title => update.text,\n :content => update.text,\n :updated => update.updated_at,\n :published => update.created_at,\n :id => update.id,\n :link => { :href => (\"#{base_uri}updates/#{update.id.to_s}\")})\n end\n\n # Create a Feed representation which we can generate\n # the Atom feed and send out.\n feed = OStatus::Feed.from_data(\"#{base_uri}feeds/#{id}.atom\",\n :title => \"#{author.username}'s Updates\",\n :id => \"#{base_uri}feeds/#{id}.atom\",\n :author => os_auth,\n :entries => entries,\n :links => {\n :hub => [{:href => hubs.first}]\n })\n feed.atom\n end", "title": "" }, { "docid": "5dfdc4796fd6a767a795c17fabd47b43", "score": "0.4666748", "text": "def atom(name, window = None)\n if None == window\n Tk.execute(:winfo, :atom, name)\n else\n Tk.execute(:winfo, :atom, '-displayof', window, name)\n end\n end", "title": "" }, { "docid": "b5af81a3a32b0676b7205c5a6b220adf", "score": "0.46625036", "text": "def atom(token)\n # Try converting to integer\n begin\n Integer(token)\n rescue\n # Try converting to float\n begin\n Float(token)\n rescue\n # Non-float, non-int, it's a string\n token\n end\n end\n end", "title": "" }, { "docid": "4d78a32340b52803cf965f57d9a65748", "score": "0.46451333", "text": "def atoms\n terms.map(&:atom)\n end", "title": "" }, { "docid": "3183c218120f23becfba957a6a21fcc1", "score": "0.46451324", "text": "def compound_token; end", "title": "" }, { "docid": "7c92e792113030be24f2669449fcea0b", "score": "0.46422726", "text": "def get_atom\n response = HTTParty.get(@atom_url)\n doc = Nokogiri::XML(response)\n doc.remove_namespaces!\n end", "title": "" }, { "docid": "b950ca06321d5c8986d03c79db6b3dea", "score": "0.46365285", "text": "def test_atomentry\n atom = Deposit::SwordClient::AtomEntry.new\n File.open(\"#{TEST_OUTPUT_DIR}/atom.xml\", \"w\"){ |f| f << atom.xml}\n assert_not_nil atom\n end", "title": "" }, { "docid": "43b271baac735fc8a301d7125adf28ff", "score": "0.4634824", "text": "def test_encode_atom()\n input = Erlang::Atom.new('ilia_atom')\n expected = [131, 115, 9, 105, 108, 105, 97, 95, 97, 116, 111, 109]\n\n stream = Erlang::StreamEmulator.new()\n Erlang::encode(input, stream)\n actual = stream.data.bytes().entries()\n\n assert_equal(expected, actual)\n end", "title": "" }, { "docid": "bd007c23ec7c7db5385d17f4059a4fa0", "score": "0.46195552", "text": "def format_atom(hash)\n str = \"\"\n\n if hash[:version]\n ver_hash = parse_cmpver(hash[:version])\n str << ver_hash[:compare]\n str << hash[:name]\n str << '-'\n str << ver_hash[:version]\n else\n str = hash[:name].dup\n end\n if hash[:slot]\n str << ':'\n str << hash[:slot]\n end\n\n str\n end", "title": "" }, { "docid": "e01ae2f798815d6850bb410d67c94724", "score": "0.4601656", "text": "def atom token\n begin\n Integer token\n rescue ArgumentError\n begin \n Float token\n rescue ArgumentError\n String token\n end\n end\nend", "title": "" }, { "docid": "42247d6447e4ebfe9c47f7b9208f7289", "score": "0.45599797", "text": "def add_implicit_namespace(mtag, ourl)\n mtag[/#{Tag::PREDICATE_DELIMITER}/] ? mtag : ourl.tag_list.primary_namespace.to_s + Tag::PREDICATE_DELIMITER + mtag\n end", "title": "" }, { "docid": "bb91ea7503eb957c9cb17c2c6abec81b", "score": "0.45541504", "text": "def on_xstring_add(xstring, part); end", "title": "" }, { "docid": "68056db91fd032c99815d9ebd39f7456", "score": "0.45364124", "text": "def rewrite_tree_atom\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 38 )\n return_value = RewriteTreeAtomReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n d = nil\n __CHAR_LITERAL162__ = nil\n __TOKEN_REF163__ = nil\n __ARG_ACTION164__ = nil\n __RULE_REF165__ = nil\n __STRING_LITERAL166__ = nil\n __ACTION168__ = nil\n id167 = nil\n\n tree_for_d = nil\n tree_for_CHAR_LITERAL162 = nil\n tree_for_TOKEN_REF163 = nil\n tree_for_ARG_ACTION164 = nil\n tree_for_RULE_REF165 = nil\n tree_for_STRING_LITERAL166 = nil\n tree_for_ACTION168 = nil\n stream_T__93 = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token T__93\" )\n stream_TOKEN_REF = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token TOKEN_REF\" )\n stream_ARG_ACTION = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token ARG_ACTION\" )\n stream_id = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule id\" )\n begin\n # at line 390:5: ( CHAR_LITERAL | TOKEN_REF ( ARG_ACTION )? -> ^( TOKEN_REF ( ARG_ACTION )? ) | RULE_REF | STRING_LITERAL | d= '$' id -> LABEL[$d,$id.text] | ACTION )\n alt_80 = 6\n case look_80 = @input.peek( 1 )\n when CHAR_LITERAL then alt_80 = 1\n when TOKEN_REF then alt_80 = 2\n when RULE_REF then alt_80 = 3\n when STRING_LITERAL then alt_80 = 4\n when T__93 then alt_80 = 5\n when ACTION then alt_80 = 6\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 80, 0 )\n end\n case alt_80\n when 1\n root_0 = @adaptor.create_flat_list\n\n\n # at line 390:9: CHAR_LITERAL\n __CHAR_LITERAL162__ = match( CHAR_LITERAL, TOKENS_FOLLOWING_CHAR_LITERAL_IN_rewrite_tree_atom_2820 )\n if @state.backtracking == 0\n\n tree_for_CHAR_LITERAL162 = @adaptor.create_with_payload( __CHAR_LITERAL162__ )\n @adaptor.add_child( root_0, tree_for_CHAR_LITERAL162 )\n\n end\n\n when 2\n # at line 391:6: TOKEN_REF ( ARG_ACTION )?\n __TOKEN_REF163__ = match( TOKEN_REF, TOKENS_FOLLOWING_TOKEN_REF_IN_rewrite_tree_atom_2827 )\n if @state.backtracking == 0\n stream_TOKEN_REF.add( __TOKEN_REF163__ )\n end\n # at line 391:16: ( ARG_ACTION )?\n alt_79 = 2\n look_79_0 = @input.peek( 1 )\n\n if ( look_79_0 == ARG_ACTION )\n alt_79 = 1\n end\n case alt_79\n when 1\n # at line 391:16: ARG_ACTION\n __ARG_ACTION164__ = match( ARG_ACTION, TOKENS_FOLLOWING_ARG_ACTION_IN_rewrite_tree_atom_2829 )\n if @state.backtracking == 0\n stream_ARG_ACTION.add( __ARG_ACTION164__ )\n end\n\n end\n # AST Rewrite\n # elements: TOKEN_REF, ARG_ACTION\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 391:28: -> ^( TOKEN_REF ( ARG_ACTION )? )\n # at line 391:31: ^( TOKEN_REF ( ARG_ACTION )? )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( stream_TOKEN_REF.next_node, root_1 )\n\n # at line 391:43: ( ARG_ACTION )?\n if stream_ARG_ACTION.has_next?\n @adaptor.add_child( root_1, stream_ARG_ACTION.next_node )\n\n end\n\n stream_ARG_ACTION.reset();\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end\n when 3\n root_0 = @adaptor.create_flat_list\n\n\n # at line 392:7: RULE_REF\n __RULE_REF165__ = match( RULE_REF, TOKENS_FOLLOWING_RULE_REF_IN_rewrite_tree_atom_2848 )\n if @state.backtracking == 0\n\n tree_for_RULE_REF165 = @adaptor.create_with_payload( __RULE_REF165__ )\n @adaptor.add_child( root_0, tree_for_RULE_REF165 )\n\n end\n\n when 4\n root_0 = @adaptor.create_flat_list\n\n\n # at line 393:6: STRING_LITERAL\n __STRING_LITERAL166__ = match( STRING_LITERAL, TOKENS_FOLLOWING_STRING_LITERAL_IN_rewrite_tree_atom_2855 )\n if @state.backtracking == 0\n\n tree_for_STRING_LITERAL166 = @adaptor.create_with_payload( __STRING_LITERAL166__ )\n @adaptor.add_child( root_0, tree_for_STRING_LITERAL166 )\n\n end\n\n when 5\n # at line 394:6: d= '$' id\n d = match( T__93, TOKENS_FOLLOWING_T__93_IN_rewrite_tree_atom_2864 )\n if @state.backtracking == 0\n stream_T__93.add( d )\n end\n @state.following.push( TOKENS_FOLLOWING_id_IN_rewrite_tree_atom_2866 )\n id167 = id\n @state.following.pop\n if @state.backtracking == 0\n stream_id.add( id167.tree )\n end\n # AST Rewrite\n # elements: \n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 394:15: -> LABEL[$d,$id.text]\n @adaptor.add_child( root_0, @adaptor.create( LABEL, d, ( id167 && @input.to_s( id167.start, id167.stop ) ) ) )\n\n\n\n return_value.tree = root_0\n\n end\n when 6\n root_0 = @adaptor.create_flat_list\n\n\n # at line 395:4: ACTION\n __ACTION168__ = match( ACTION, TOKENS_FOLLOWING_ACTION_IN_rewrite_tree_atom_2877 )\n if @state.backtracking == 0\n\n tree_for_ACTION168 = @adaptor.create_with_payload( __ACTION168__ )\n @adaptor.add_child( root_0, tree_for_ACTION168 )\n\n end\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 38 )\n\n end\n \n return return_value\n end", "title": "" }, { "docid": "35bfbcb4caea3a18ef19f9ad6a01c72b", "score": "0.45277876", "text": "def atom_url\n Config.site['url'].chomp('/') + TagController.r(:atom, name).to_s\n end", "title": "" }, { "docid": "5749ccb3ee2222222053602b82b3c330", "score": "0.4526928", "text": "def atomy?(s)\n s.size == 1 || %r/\n \\A\n (?>\n \\\\\\w # one of the canned character class expressions\n | # OR\n \\[ # an ad hoc character class expression\n (?>\n [^\\[\\]\\\\]\n |\n \\\\.\n )++\n \\]\n )\n \\z\n /x === s\n end", "title": "" }, { "docid": "a674aba5367d9a7f66ebd0ed683e925d", "score": "0.45232135", "text": "def atom\n if @str != nil\n @str\n elsif @options == nil and @access_token == nil\n # simply open the url\n open(@url).read\n elsif @options == nil and @url != nil\n # open the url through OAuth\n @access_token.get(@url).body\n else\n self.links << Atom::Link.new(:rel => 'self', :href => @url) if @url\n self.links << Atom::Link.new(:rel => 'edit', :href => @url) if @url\n self.to_xml\n end\n end", "title": "" }, { "docid": "7541ea73a3f51e666046cf7fd885bb9e", "score": "0.45105895", "text": "def atom(token)\n begin \n return Integer(token)\n rescue TypeError, ArgumentError\n begin\n return Float(token)\n rescue TypeError, ArgumentError\n return token.to_sym\n end\n end\nend", "title": "" }, { "docid": "3da02419f24e8129f027d313d768e27e", "score": "0.44984683", "text": "def atom_id\n \"tag:netcooler.com,#{created_at.strftime(\"%Y-%m-%d\")}:/companies/#{company.id}/posts/#{id}\"\n end", "title": "" }, { "docid": "0624187ef860cbd24fddd15fd18056fe", "score": "0.44942233", "text": "def atom(token)\n begin\n return Integer(token)\n rescue ArgumentError\n begin\n return Float(token)\n rescue ArgumentError\n return String(token)\n end\n end\nend", "title": "" }, { "docid": "6800d7c29d44231ab5d10f2f2f1db95e", "score": "0.44776106", "text": "def set_atom_attrb xml, name, value\n xml.attributes[name.to_s] = value\n end", "title": "" }, { "docid": "d81141cbc33b717849ce9229290a9ed3", "score": "0.44688094", "text": "def conjunction_code\n if conjunction?\n @entry.at_xpath('./*[1]', HQMF2::Document::NAMESPACES).name\n else\n nil\n end\n end", "title": "" }, { "docid": "9b3cab7350a4e113565c8f663d213992", "score": "0.4461554", "text": "def include?(atom)\n # atoms.any? {|atm| atom.id == atm.id }\n (@ob.get_begin_atom.get_id == atom.id) || (@ob.get_end_atom.get_id == atom.id)\n end", "title": "" }, { "docid": "c7846b84e00325464a83215ec9c3f53c", "score": "0.4454504", "text": "def BEG03=(arg)", "title": "" }, { "docid": "47cb7d81ff838dc0496dcf741e16d1e6", "score": "0.4449875", "text": "def pack(term, call)\n call + \"(\" + term + \")\"\nend", "title": "" }, { "docid": "58f16204e48f0dc86c0f44b9c43f4e49", "score": "0.44471017", "text": "def SymbolLiteral(value); end", "title": "" }, { "docid": "0d452cedff9b645f51796fab7a7b5860", "score": "0.44259432", "text": "def BEG07=(arg)", "title": "" }, { "docid": "5cfc3723ea41373ca21a88b4002ab4fb", "score": "0.442558", "text": "def get_atom_pack(type)\n case type\n when Q_TYPE_BOOLEAN, Q_TYPE_BYTE then\n ['c',1]\n when Q_TYPE_SHORT then\n ['s',2]\n when Q_TYPE_INT, Q_TYPE_MONTH, Q_TYPE_DATE, Q_TYPE_MINUTE, Q_TYPE_SECOND, Q_TYPE_TIME then\n ['I',4]\n when Q_TYPE_LONG, Q_TYPE_TIMESTAMP, Q_TYPE_TIMESPAN then\n ['q',8]\n when Q_TYPE_REAL then\n ['F',4]\n when Q_TYPE_FLOAT, Q_TYPE_DATETIME then\n ['D',8]\n when Q_TYPE_CHAR then\n ['Z',1]\n when Q_TYPE_SYMBOL, Q_TYPE_EXCEPTION then\n ['Z*',0]\n else\n raise QIOException.new \"Unknown atom type #{type}\"\n end\n end", "title": "" }, { "docid": "a0583859526eb0ceea21523fa04f106d", "score": "0.44255635", "text": "def test_xstring\n function = Function.new(\"MY_XSTRING\")\n parameter = Parameter.new(:name => \"RFC_XSTRING\", :type => :RFCTYPE_XSTRING, :direction=> :RFC_IMPORT)\n function.add_parameter(parameter)\n fc = function.get_function_call\n fc[:RFC_XSTRING] = \"Sequence of bytes\"\n assert_equal(\"Sequence of bytes\", fc[:RFC_XSTRING], \"RFC_XSTRING\")\n fc[:RFC_XSTRING] = \"\\x01\\xA1\\xB2\\xDC\\xCD\\xE1\\xE0\\xFF\"\n assert_equal(\"\\x01\\xA1\\xB2\\xDC\\xCD\\xE1\\xE0\\xFF\", fc[:RFC_XSTRING], \"RFC_XSTRING\")\n end", "title": "" }, { "docid": "ad212aa05d7fe5548fd459c759c16986", "score": "0.4400609", "text": "def atom(token)\n Integer(token)\n rescue ArgumentError\n begin\n Float(token)\n rescue ArgumentError\n token.to_sym\n end\n end", "title": "" }, { "docid": "76ff7aa36de5a1b30e178bda67265164", "score": "0.43860748", "text": "def oa\n binary_operator \"+\"\n end", "title": "" }, { "docid": "bf3612ff2a7ff11d10f2131394e8c29c", "score": "0.43844342", "text": "def cmd_concat_operator\n \" & \"\n end", "title": "" }, { "docid": "bf3612ff2a7ff11d10f2131394e8c29c", "score": "0.43844342", "text": "def cmd_concat_operator\n \" & \"\n end", "title": "" }, { "docid": "d0b96a5b239ebb924eb7f6f2b36eef48", "score": "0.43816504", "text": "def html_to_atom_content(html_tree, atom_entry)\n # make a blank XHTML <atom:content/>\n atom_entry.content = ''\n atom_entry.content.type = 'xhtml'\n\n # skip the <h1/> (it's already in the <atom:title/>)\n REXML::XPath.each(html_tree, '//body/*[name() != \"h1\"]') do |el|\n # unfortunately I didn't expose an atom-tools API for appending elements...\n atom_entry.content.instance_variable_get('@content') << el\n end\nend", "title": "" }, { "docid": "d41d59c1089b71b646418edd1dd41077", "score": "0.4381219", "text": "def add_wff wff\n #return false if @tt.keys.any?{|k2| wff.to_s == k1.to_s} \n if wff.is_a? Variable\n return false\n elsif wff.is_unary?\n if wff.atom1.is_a? WFF\n add_wff(wff.atom1)\n end\n @tt[wff] = @tt[wff.atom1].map{|x| wff.eval x}\n elsif wff.atom1.is_a? WFF and wff.atom2.is_a? WFF\n add_wff(wff.atom1)\n add_wff(wff.atom2)\n @tt[wff] = @tt[wff.atom1].each_with_index.map{|x, idx| wff.eval(x, @tt[wff.atom2][idx])}\n elsif wff.atom1.is_a? WFF\n add_wff(wff.atom1)\n @tt[wff] = @tt[wff.atom1].each_with_index.map{|x, idx| wff.eval(x, @tt[wff.atom2][idx])}\n elsif wff.atom2.is_a? WFF\n add_wff(wff.atom2)\n @tt[wff] = @tt[wff.atom1].each_with_index.map{|x, idx| wff.eval(x, @tt[wff.atom2][idx])}\n else\n @tt[wff] = @tt[wff.atom1].each_with_index.map{|x, idx| wff.eval(x, @tt[wff.atom2][idx])}\n end\n end", "title": "" }, { "docid": "ea5594961ca073492fd0cf0ab19dbef3", "score": "0.43749663", "text": "def extract_ref_without_atom(id)\n id_without_atom = id.sub(/\\.atom$/, '')\n valid_refs = ref_names.select { |v| \"#{id_without_atom}/\".start_with?(\"#{v}/\") }\n\n valid_refs.max_by(&:length)\n end", "title": "" }, { "docid": "8beb04d8775fdcbd507ad652c164a385", "score": "0.43542096", "text": "def token(content, kind); end", "title": "" }, { "docid": "18a471b012feb28424f481580c51edf8", "score": "0.4346936", "text": "def on_xstring_literal(xstring); end", "title": "" }, { "docid": "007082fb9927f3727cd044199bc55c18", "score": "0.4342411", "text": "def atom(base_uri)\n # Create the OStatus::Author object\n os_auth = author.to_atom\n\n # Gather entries as OStatus::Entry objects\n entries = updates.to_a.sort{|a, b| b.created_at <=> a.created_at}.map do |update|\n update.to_atom(base_uri)\n end\n\n avatar_url_abs = author.avatar_url\n if avatar_url_abs.start_with?(\"/\")\n avatar_url_abs = \"#{base_uri}#{author.avatar_url[1..-1]}\"\n end\n\n # Create a Feed representation which we can generate\n # the Atom feed and send out.\n feed = OStatus::Feed.from_data(\"#{base_uri}feeds/#{id}.atom\",\n :title => \"#{author.username}'s Updates\",\n :logo => avatar_url_abs,\n :id => \"#{base_uri}feeds/#{id}.atom\",\n :author => os_auth,\n :updated => updated_at,\n :entries => entries,\n :links => {\n :hub => [{:href => hubs.first}],\n :salmon => [{:href => \"#{base_uri}feeds/#{id}/salmon\"}],\n :\"http://salmon-protocol.org/ns/salmon-replies\" =>\n [{:href => \"#{base_uri}feeds/#{id}/salmon\"}],\n :\"http://salmon-protocol.org/ns/salmon-mention\" =>\n [{:href => \"#{base_uri}feeds/#{id}/salmon\"}]\n })\n feed.atom\n end", "title": "" }, { "docid": "4327f951344439596780c94cd0487a74", "score": "0.43381324", "text": "def atomlink(xml)\n # Effectively memoize this XMLAttr object, since we can use it for\n # every parsed page.\n @atomlink ||= GProv::Provision::EntryBase::XMLAttr.new(:link, :xpath => %{/xmlns:feed/xmlns:link[@rel = \"next\"]/@href})\n\n # REVIEW This might be utilizing behavior that's unexpected. This\n # retrieves a fully qualified URL, which means that it might be\n # bypassing some of the logic in the GProv::Conection code. Instead of\n # passing in the base resource URI like the rest of GProv, we're\n # blindly using this\n #\n # So instead of retrieving this:\n #\n # /group/2.0/:domain/<group>@<domain>/member?start=<string>\n #\n # We're retrieving this:\n #\n # https://apps-apis.google.com/a/feeds/group/2.0/<domain>/<group>@<domain>/member?start=<string>\n #\n # This works, since by the nature of this request the group and domain\n # are filled in correctly. However, it ignores the baseuri respected by\n # the rest of this library, the :domain symbol, and other behaviors.\n # This should continue to work, but if HTTParty stops allowing fully\n # qualified URLs like this and merely prepends the current baseuri to\n # this string then the world will explode.\n link = @atomlink.parse(xml)\n link unless link.empty?\n end", "title": "" }, { "docid": "d8a1b8166144d58e21e6aea246f28bd9", "score": "0.43351445", "text": "def SymbolContent(value); end", "title": "" }, { "docid": "53dee0216b2cdf4c8d2e1996fb02ca5b", "score": "0.4329982", "text": "def on_dyna_symbol(string_content); end", "title": "" }, { "docid": "802926b541118d65ad9d30a2587400cd", "score": "0.43277296", "text": "def special?\n atom.special? rescue false\n end", "title": "" }, { "docid": "d98620617ac42692b75118b08fc09a2b", "score": "0.43194324", "text": "def add_flvc_owner_extension manifest\n flvc_prefix = get_prefix_for_flvc_extension\n\n if flvc_extensions?\n mods_flvc_extension = @xml_document.xpath(\"//mods:extension/flvc:flvc\", 'mods' => MODS_NAMESPACE, 'flvc' => MANIFEST_NAMESPACE)\n mods_flvc_extension.remove()\n end\n\n str = <<-XML.gsub(/^ /, '')\n <#{format_prefix}extension>\n <#{flvc_prefix}:flvc>\n <#{flvc_prefix}:owningInstitution>#{manifest.owning_institution}</#{flvc_prefix}:owningInstitution>\n </#{flvc_prefix}:flvc>\n </#{format_prefix}extension>\n XML\n\n @xml_document.root.add_child(str)\n\n rescue => e\n error \"Can't add extension OwningInstitution extension element to MODS document '#{short_filename}', error #{e.class} - #{e.message}.\"\n end", "title": "" }, { "docid": "804d11277202cd44aae4f60133a0640e", "score": "0.43183726", "text": "def putOne_Atom(strm, obj)\n strm << obj.inspect ;\n end", "title": "" }, { "docid": "9e0c1fa931ebccb79300813a5ebb35f0", "score": "0.43168014", "text": "def BEG06=(arg)", "title": "" }, { "docid": "1c92897fed7233bc379cd771257f517b", "score": "0.43155053", "text": "def to_atom\n\n # Determine global url for this author\n author_url = url\n if author_url.start_with?(\"/\")\n author_url = \"http://#{domain}/feeds/#{feed.id}\"\n end\n\n # Set up PortableContacts\n poco = OStatus::PortableContacts.new(:id => author_url,\n :preferred_username => username)\n p name\n poco.display_name = name unless name.nil? || name.empty?\n\n # Set up and return Author\n avatar_url_abs = avatar_url\n if avatar_url_abs.start_with?(\"/\")\n avatar_url_abs = \"http://#{domain}#{avatar_url_abs}\"\n end\n\n author = OStatus::Author.new(:name => username,\n :uri => author_url,\n :portable_contacts => poco,\n :links => [Atom::Link.new(:rel => \"avatar\",\n :type => \"image/png\",\n :href => avatar_url_abs)])\n\n author.email = email unless email.nil?\n\n author\n end", "title": "" }, { "docid": "06f54a02eebaabb7c057004fb687cc60", "score": "0.43115094", "text": "def fcm\n return nil if doc_head==nil\n fee_m_code=doc_head.doc_type==1 ? FeeCodeMatch.find_by_fee_code(\"07\") : FeeCodeMatch.find_by_fee_code(\"08\")\n if fee\n fcm= FeeCodeMatch.find_by_fee_code(fee.code)\n if fcm\n fee_m_code=fcm\n end\n end\n return fee_m_code\n end", "title": "" }, { "docid": "e3ef340500070003d792cc832dec506d", "score": "0.43083164", "text": "def xmldecl(version, encoding, standalone)\r\n end", "title": "" }, { "docid": "33d967ea94d2e47ab263e886724c164e", "score": "0.4307539", "text": "def read_atom\n case buffer = read_literal\n when '.' then buffer.to_sym\n when RATIONAL then Rational($1.to_i, $2.to_i)\n when DECIMAL then Float(buffer) # FIXME?\n when INTEGER then Integer(buffer)\n when /^t$/i then true\n when /^nil$/i then nil\n else buffer.to_sym\n end\n end", "title": "" }, { "docid": "6d0579c4c70f36440d33244f94e37314", "score": "0.43070865", "text": "def atom_elements(one_name, many_name, klass)\n self.elements(['atom', Atom::NS], one_name, many_name, klass)\n end", "title": "" }, { "docid": "84696137af09f151b4fbb1ac144e26f8", "score": "0.43053693", "text": "def to_fOOrth_c\r\n \"\\x00\"\r\n end", "title": "" }, { "docid": "84696137af09f151b4fbb1ac144e26f8", "score": "0.43053693", "text": "def to_fOOrth_c\r\n \"\\x00\"\r\n end", "title": "" }, { "docid": "9070e69b90902bbd0d51650de7cb0284", "score": "0.43052602", "text": "def BEG11=(arg)", "title": "" }, { "docid": "fce786913d70274688209632866f649b", "score": "0.4292987", "text": "def add_atx3\n sub_block :atx3, class_name: 'ATX3', base_address: 0x7000_0000\n end", "title": "" }, { "docid": "808cf1348d81ed7128ef03b79c7b3fb6", "score": "0.42851624", "text": "def concatinator(thing1 = \"Thing #1 & \", thing2 = \"Thing #2\")\n thing1 + thing2\nend", "title": "" }, { "docid": "a5c9256970f0b1e9b08531ae22e48927", "score": "0.4283712", "text": "def namespaces_in_content(contents, file = T.unsafe(nil)); end", "title": "" }, { "docid": "31d7d845147231aba65b65b567b33311", "score": "0.4278515", "text": "def sax_xmldecl(version,encoding,standalone) end", "title": "" }, { "docid": "00ec71cf77ba0a1ed84a732cec5505f4", "score": "0.4276678", "text": "def literal(cmd)\n end", "title": "" }, { "docid": "d5871ec9b477fdd9ea7bda028bcf3f5a", "score": "0.42754573", "text": "def atom(token)\n Integer(token)\nrescue ArgumentError\n begin\n Float(token)\n rescue ArgumentError\n token.to_sym\n end\nend", "title": "" }, { "docid": "a269fa1766cb0e7fe34deaf58bd90c4e", "score": "0.4274953", "text": "def create_entry(entry)\n\n # template\n xml = <<DATA \n <entry xmlns=\"http://purl.org/atom/ns#\">\n <link rel=\"related\" type=\"text/html\" />\n <summary type=\"text/plain\"></summary>\n </entry>\nDATA\n \n # edit xml\n doc = REXML::Document.new(xml)\n doc.elements['/entry/link'].add_attribute('href',entry[:url])\n doc.elements['/entry/summary'].add_text(entry[:summary])\n\n data=String.new \n doc.write(data)\n\n #make request\n path='/atom/post'\n \n req=Net::HTTP::Post.new(path)\n req['Accept']= 'application/x.atom+xml,application/xml,text/xml,*/*',\n req['X-WSSE']= @credential_string\n\n res = @http.request(req,data)\n case res\n when Net::HTTPSuccess then\n return get_edit_url(res.body)\n else\n raise \"Http Response != Success\"\n end\n end", "title": "" }, { "docid": "c9913e8241f5903c02ee1889e2eac503", "score": "0.42719904", "text": "def on_mlhs_paren(contents); end", "title": "" }, { "docid": "b7a611aeae8d170985dea43bdf8012b2", "score": "0.42708665", "text": "def atom_time(name)\n self.time ['atom', Atom::NS], name\n end", "title": "" } ]
706b6d3753ea7441639632ab6da475ea
List gets a list of Resources matching a given set of criteria.
[ { "docid": "e35e292833e5b6c38bb712359f9a504c", "score": "0.70522237", "text": "def list(\n filter,\n *args,\n deadline: nil\n )\n return @resources.list(\n filter,\n *args,\n deadline: deadline,\n )\n end", "title": "" } ]
[ { "docid": "37547c676524d82e5c9a0bdab28e3e8f", "score": "0.6932504", "text": "def list(\n filter,\n *args,\n deadline: nil\n )\n return @account_resources.list(\n filter,\n *args,\n deadline: deadline,\n )\n end", "title": "" }, { "docid": "2e61763478a4452625fbd8da961cb123", "score": "0.68335724", "text": "def list(\n filter,\n *args,\n deadline: nil\n )\n return @role_resources.list(\n filter,\n *args,\n deadline: deadline,\n )\n end", "title": "" }, { "docid": "0e72ebdf1b73c2d09023823e8ceb2113", "score": "0.67740643", "text": "def list(abs_url = nil)\n @ro_resource_mixin.list(abs_url)\n end", "title": "" }, { "docid": "9dc0c33fd3793632adef0563e23f2c41", "score": "0.6698795", "text": "def resources(*args)\n run_context.resource_collection.find(*args)\n end", "title": "" }, { "docid": "42670e7a9ba370320f6ed6b70b25b28c", "score": "0.6614955", "text": "def find_resources options\n\n # return [] unless resource_class.ancestors.include? ActiveRecord::Base\n params[:ids] ||= []\n params[:ids] << params[:id] unless params[:id].nil?\n\n if params[:ids].compact.any?\n policy_scope(resource_class).where(id: params[:ids].compact.split(\",\").flatten)\n else\n # search\n r = _search options\n\n # filter\n r = _filter r, options\n\n # sort\n r = _sort r, options\n\n # paginate\n r = _paginate r\n\n # (params[:format].nil? or params[:format]=='html') ? r.page(params[:page]).per(params[:perpage]) : r\n end\n end", "title": "" }, { "docid": "0d1102cfd5f8e8129a2d5181640c9532", "score": "0.64959776", "text": "def list_resources(opts = {})\n data, _status_code, _headers = list_resources_with_http_info(opts)\n data\n end", "title": "" }, { "docid": "4940478bc51f2ff924203a43510bc806", "score": "0.6471893", "text": "def find_all_resources options\n policy_scope(resource_class)\n end", "title": "" }, { "docid": "556657a04c8f785bb407fc90772f39c1", "score": "0.63714963", "text": "def resources\n @resources ||= if options[:resources]\n options[:resources]\n elsif options[:search]\n if options[:search].is_a?(String)\n options[:search] = Rack::Utils.parse_nested_query(options[:search])\n end\n\n model.ransack(options[:search]).result\n else\n model.all\n end\n end", "title": "" }, { "docid": "3804c72dc327602d5ba4293c9ea310c1", "score": "0.63675946", "text": "def list(\n filter,\n *args,\n deadline: nil\n )\n req = V1::AccountResourceListRequest.new()\n req.meta = V1::ListRequestMetadata.new()\n page_size_option = @parent._test_options[\"PageSize\"]\n if page_size_option.is_a? Integer\n req.meta.limit = page_size_option\n end\n if not @parent.snapshot_time.nil?\n req.meta.snapshot_at = @parent.snapshot_time\n end\n\n req.filter = Plumbing::quote_filter_args(filter, *args)\n resp = Enumerator::Generator.new { |g|\n tries = 0\n loop do\n begin\n plumbing_response = @stub.list(req, metadata: @parent.get_metadata(\"AccountResources.List\", req), deadline: deadline)\n rescue => exception\n if (@parent.shouldRetry(tries, exception))\n tries + +@parent.jitterSleep(tries)\n next\n end\n raise Plumbing::convert_error_to_porcelain(exception)\n end\n tries = 0\n plumbing_response.account_resources.each do |plumbing_item|\n g.yield Plumbing::convert_account_resource_to_porcelain(plumbing_item)\n end\n break if plumbing_response.meta.next_cursor == \"\"\n req.meta.cursor = plumbing_response.meta.next_cursor\n end\n }\n resp\n end", "title": "" }, { "docid": "708a57c5ef74ad9f600e9b69e0a6183e", "score": "0.63593763", "text": "def list(resource_type,limit=0,params={})\n path = '/api/' + resource_type.to_s\n params.merge!({limit: limit.to_s})\n response = http_get(path,params)\n hydrate_list(resource_type, response['objects'])\n end", "title": "" }, { "docid": "47f4d7c515780c9ee041f6420fd1ba18", "score": "0.6305186", "text": "def list(\n filter,\n *args,\n deadline: nil\n )\n req = V1::ResourceListRequest.new()\n req.meta = V1::ListRequestMetadata.new()\n page_size_option = @parent._test_options[\"PageSize\"]\n if page_size_option.is_a? Integer\n req.meta.limit = page_size_option\n end\n if not @parent.snapshot_time.nil?\n req.meta.snapshot_at = @parent.snapshot_time\n end\n\n req.filter = Plumbing::quote_filter_args(filter, *args)\n resp = Enumerator::Generator.new { |g|\n tries = 0\n loop do\n begin\n plumbing_response = @stub.list(req, metadata: @parent.get_metadata(\"Resources.List\", req), deadline: deadline)\n rescue => exception\n if (@parent.shouldRetry(tries, exception))\n tries + +@parent.jitterSleep(tries)\n next\n end\n raise Plumbing::convert_error_to_porcelain(exception)\n end\n tries = 0\n plumbing_response.resources.each do |plumbing_item|\n g.yield Plumbing::convert_resource_to_porcelain(plumbing_item)\n end\n break if plumbing_response.meta.next_cursor == \"\"\n req.meta.cursor = plumbing_response.meta.next_cursor\n end\n }\n resp\n end", "title": "" }, { "docid": "5a4080142d45680c32c6745e636233b9", "score": "0.6268116", "text": "def list(resource_group, options = {})\n url = build_url(resource_group, options)\n response = rest_get(url)\n\n if options[:all]\n get_all_results(response)\n else\n Azure::Armrest::ArmrestCollection.create_from_response(response, Azure::Armrest::Resource)\n end\n end", "title": "" }, { "docid": "cf2419a4597a540a5d8f5ae20a00ead7", "score": "0.6240769", "text": "def resource_list\n self.resources\n end", "title": "" }, { "docid": "9a524b9d91ec71e09efd1fed677beebe", "score": "0.62369305", "text": "def list_all(options = {})\n url = build_url(nil, options)\n response = rest_get(url)\n\n if options[:all]\n get_all_results(response)\n else\n Azure::Armrest::ArmrestCollection.create_from_response(response, Azure::Armrest::Resource)\n end\n end", "title": "" }, { "docid": "9ce98dacfd19eaea752105056187d344", "score": "0.6233486", "text": "def list(opts = {})\n search_provider.list(opts)\n end", "title": "" }, { "docid": "335fcce4e11207d1914be04a636944a2", "score": "0.6212623", "text": "def list(*_filters)\n raise NotImplementedError\n end", "title": "" }, { "docid": "86ffd703cfa6339e1f36ee074f47bb38", "score": "0.62106854", "text": "def list\n url = prefix + \"list\"\n return response(url)\n end", "title": "" }, { "docid": "32959f0595750e4e2f848e97cfb53031", "score": "0.61823267", "text": "def index\n @resources = Resource.where(active: true)\n @general = Resource.where(active: true, general: true)\n @motivation = Resource.where(active: true, motivation: true)\n @mindset = Resource.where(active: true, mindset: true)\n @resourcing = Resource.where(active: true, resourcing: true)\n @planning = Resource.where(active: true, planning: true)\n @time_management = Resource.where(active: true, time_management: true)\n @discipline = Resource.where(active: true, discipline: true)\n end", "title": "" }, { "docid": "e22180ed6df9dd4a405fd37211db00ad", "score": "0.6158073", "text": "def find_resources(type)\n resource_collection.all_resources.select do |resource|\n resource_name(resource) == type.to_sym\n end\n end", "title": "" }, { "docid": "308a30ab8ed531445b238dd5e91890e3", "score": "0.6147133", "text": "def list\n url = prefix + \"list\"\n return response(url)\n end", "title": "" }, { "docid": "65e5ea3e8e0d8c7e310ae0b7e76126ff", "score": "0.61199117", "text": "def list\n puts local_resources.map { |name, resource| name }.join(\" \")\n end", "title": "" }, { "docid": "6a52580ff6cbfe9e7253a1a6968c8f67", "score": "0.60755664", "text": "def list_resources\n resources = []\n addr = create_address(:sliceID => @@sliceID, :domain => @@domain)\n resource_prefix = \"#{addr.generate_address}/\"\n nodes = list_nodes(@@domain)\n nodes.each{|node|\n next if !node.include?(resource_prefix)\n node.slice!(resource_prefix)\n resources << node if !node.empty?\n }\n resources\n end", "title": "" }, { "docid": "e879e3aea7a4b346aab073ecaab846d6", "score": "0.6074223", "text": "def list(type)\n get(resource_path_for_entity_type(type) + \"?rows=all\")\n end", "title": "" }, { "docid": "1fa0da032f10417af2393d9699b91ce6", "score": "0.60647935", "text": "def list(\n filter,\n *args,\n deadline: nil\n )\n req = V1::RoleResourceListRequest.new()\n req.meta = V1::ListRequestMetadata.new()\n page_size_option = @parent._test_options[\"PageSize\"]\n if page_size_option.is_a? Integer\n req.meta.limit = page_size_option\n end\n if not @parent.snapshot_time.nil?\n req.meta.snapshot_at = @parent.snapshot_time\n end\n\n req.filter = Plumbing::quote_filter_args(filter, *args)\n resp = Enumerator::Generator.new { |g|\n tries = 0\n loop do\n begin\n plumbing_response = @stub.list(req, metadata: @parent.get_metadata(\"RoleResources.List\", req), deadline: deadline)\n rescue => exception\n if (@parent.shouldRetry(tries, exception))\n tries + +@parent.jitterSleep(tries)\n next\n end\n raise Plumbing::convert_error_to_porcelain(exception)\n end\n tries = 0\n plumbing_response.role_resources.each do |plumbing_item|\n g.yield Plumbing::convert_role_resource_to_porcelain(plumbing_item)\n end\n break if plumbing_response.meta.next_cursor == \"\"\n req.meta.cursor = plumbing_response.meta.next_cursor\n end\n }\n resp\n end", "title": "" }, { "docid": "312f8b038a4b9b0ec9228e59ff50de5e", "score": "0.6061294", "text": "def list(options = {})\n url = build_url\n url << \"&$top=#{options[:top]}\" if options[:top]\n url << \"&$filter=#{options[:filter]}\" if options[:filter]\n\n response = rest_get(url)\n Azure::Armrest::ArmrestCollection.create_from_response(response, Azure::Armrest::ResourceGroup)\n end", "title": "" }, { "docid": "d6193aef29ac47b3cede522625681caf", "score": "0.6045805", "text": "def list(resource,limit=0,params={})\n uri = '/api/' + resource.to_s\n params.merge!({limit: limit.to_s})\n http_get(uri,params)\n end", "title": "" }, { "docid": "e8d595b377264d012367ef2e7eac9653", "score": "0.60324603", "text": "def list_resources_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ResourcesApi.list_resources ...'\n end\n # resource path\n local_var_path = '/resource_set'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<String>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['protection_auth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ResourcesApi#list_resources\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "9501e56ec7a3b762fed7c5a947d308be", "score": "0.5986039", "text": "def index\n @resources = Resource.all\n end", "title": "" }, { "docid": "9c84e415f71e77a7482931b0d7b75d40", "score": "0.59804434", "text": "def list(options = {})\n page = options[:page]\n per_page = options[:per_page]\n filters = options[:filters]\n validate_list_pagination!(page, per_page)\n qs = pagination_query_string(page: page, per_page: per_page)\n if !filters.nil? && filters.any?\n filter_qs = filter_query_string(filters)\n qs = qs.length > 0 ? \"#{qs}&#{filter_qs}\" : filter_qs\n end\n url = qs.length > 0 ? \"#{endpoint}?#{qs}\" : endpoint\n fix_list_response(@http.get(url))\n end", "title": "" }, { "docid": "cb3c937144dd986155ec13c8b72e9a05", "score": "0.5976689", "text": "def list(**options)\n\t\t\t\tjson = get_request(options.merge(:method => 'list'))\n\t\t\t\tres = JSON.parse(json.body)\n\t\t\t\t\n\t\t\t\tif json.status == 200\n\t\t\t\t\tresults = process_list_response(res)\n\t\t\t\telse\n\t\t\t\t\traise \"HTTP Error #{json.status}: #{json.body}\"\n\t\t\t\tend\n\n\t\t\t\treturn results\n\t\t\tend", "title": "" }, { "docid": "cb3c937144dd986155ec13c8b72e9a05", "score": "0.5976689", "text": "def list(**options)\n\t\t\t\tjson = get_request(options.merge(:method => 'list'))\n\t\t\t\tres = JSON.parse(json.body)\n\t\t\t\t\n\t\t\t\tif json.status == 200\n\t\t\t\t\tresults = process_list_response(res)\n\t\t\t\telse\n\t\t\t\t\traise \"HTTP Error #{json.status}: #{json.body}\"\n\t\t\t\tend\n\n\t\t\t\treturn results\n\t\t\tend", "title": "" }, { "docid": "53d226c3fcf82a0db55ff667a46c769a", "score": "0.5972713", "text": "def list(params = {})\n http_helper.send_get_request(\"#{@url_prefix}/list\", params)\n end", "title": "" }, { "docid": "53d226c3fcf82a0db55ff667a46c769a", "score": "0.5972713", "text": "def list(params = {})\n http_helper.send_get_request(\"#{@url_prefix}/list\", params)\n end", "title": "" }, { "docid": "e135f4f5dc60e11ed382ad3b450c3d48", "score": "0.5969203", "text": "def lists\n Resources::Lists.new(self)\n end", "title": "" }, { "docid": "b676af04daf75c5fa141600679343106", "score": "0.5931532", "text": "def index\n @resources = Resource.all\n end", "title": "" }, { "docid": "b676af04daf75c5fa141600679343106", "score": "0.5931532", "text": "def index\n @resources = Resource.all\n end", "title": "" }, { "docid": "b676af04daf75c5fa141600679343106", "score": "0.5931532", "text": "def index\n @resources = Resource.all\n end", "title": "" }, { "docid": "5993008602f7ee60f79c164be1978a22", "score": "0.59232926", "text": "def api_list_resource(collection: nil, search_fields: nil, paginate: true,\n filtering_params: nil)\n ApiListResource.new(\n collection: collection,\n params: params,\n search_fields: search_fields,\n filtering_params: filtering_params,\n paginate: paginate\n )\n end", "title": "" }, { "docid": "c05f002330460beed0229aefac6d7737", "score": "0.5920366", "text": "def list(scope = list_query)\n model.all(scope)\n end", "title": "" }, { "docid": "6193364fd66855beebcf6ac82c554224", "score": "0.59059846", "text": "def list_all\n __log_activity\n __debug_route\n prm = paginator.initial_parameters.except(*Paginator::NON_SEARCH_KEYS)\n terms = prm.delete(:like)\n found = { list: get_accounts(*terms, **prm) }\n @list = paginator.finalize(found, **prm)\n respond_to do |format|\n format.html { render 'account/index' }\n format.json { render 'account/index' }\n format.xml { render 'account/index' }\n end\n end", "title": "" }, { "docid": "2588a15b06d7cdb4244c66c1bbe53d70", "score": "0.59048986", "text": "def index\n if current_user.role?(:admin)\n if params[:search]\n @resources = Resource.search(params[:search]).paginate(:page => params[:page]).per_page(10)\n elsif params[:resource]\n @resources = Resource.tagged_with(params[:resource][:tagged_with]).paginate(:page => params[:page]).per_page(10)\n else\n @resources = Resource.all.paginate(:page => params[:page]).per_page(10)\n end\n else\n if params[:search]\n @resources = Resource.search(params[:search]).active.paginate(:page => params[:page]).per_page(10)\n elsif params[:resource]\n @resources = Resource.tagged_with(params[:resource][:tagged_with]).active.paginate(:page => params[:page]).per_page(10)\n else\n @resources = Resource.active.paginate(:page => params[:page]).per_page(10)\n end\n end\n end", "title": "" }, { "docid": "6c4a25ec285942da008d2983897a6af0", "score": "0.58897233", "text": "def list\n call(:get, path)\n end", "title": "" }, { "docid": "3a239954795ddd0d43d0ee3ef577e374", "score": "0.58869165", "text": "def resources options={}\n @resources ||= find_resources options\n end", "title": "" }, { "docid": "61d91db5253f19b28ee6cd94d394e701", "score": "0.5849972", "text": "def compute_list(mixins = nil)\n mixins = deep_clone(mixins) if mixins\n @backend_instance.compute_list(mixins) || Occi::Core::Resources.new\n end", "title": "" }, { "docid": "4b2faede3367a26ea3a7c95ba9f11d21", "score": "0.58428615", "text": "def list(project_id, options)\n @_client.get(resource_root(project_id), options)\n end", "title": "" }, { "docid": "9b51d66188c983a784e1aae82a1ccc7b", "score": "0.5836349", "text": "def resources\n self.collection.find({}, :sort => [:_id, :asc]).map do |hash|\n self.normalize hash\n end\n end", "title": "" }, { "docid": "a88431d1482c2b5aa6c8407be53b797f", "score": "0.5825199", "text": "def all(params = {})\n query = params.map { |key, value| \"#{CGI.escape(key.to_s)}=#{CGI.escape(value.to_s)}\" }.join(\"&\")\n query = \"?\" + query unless query.empty?\n code, data = @session.get(collection_path + '.json' + query)\n data.collect { |data|\n key = @resource.name.to_s.split('::').last.downcase\n @resource.new(data[key].merge(:session => @session, :prefix => @prefix))\n }\n end", "title": "" }, { "docid": "5ab547cace46f989b93b791107ab95a4", "score": "0.58246857", "text": "def list(\n filter,\n *args,\n deadline: nil\n )\n return @accounts.list(\n filter,\n *args,\n deadline: deadline,\n )\n end", "title": "" }, { "docid": "6d2aa2b2b025740a3333a010b4c765b5", "score": "0.5822389", "text": "def list(resource_type_identifier=nil)\n if resource_type_identifier\n # convert type to type identifier\n resource_type_identifier = @model.kinds.select {\n |kind| kind.term == resource_type_identifier\n }.first.type_identifier if @model.kinds.select {\n |kind| kind.term == resource_type_identifier\n }.any?\n\n # check some basic pre-conditions\n raise \"Endpoint is not connected!\" unless @connected\n raise \"Unkown resource type identifier! [#{resource_type_identifier}]\" unless @model.get_by_id resource_type_identifier\n\n # split the type identifier and get the most important part\n uri_part = resource_type_identifier.split('#').last\n\n # request uri-list from the server\n path = uri_part + '/'\n else\n path = '/'\n end\n\n headers = self.class.headers.clone\n headers['Accept'] = 'text/uri-list'\n\n # TODO: remove the gsub OCCI-OS hack\n response = self.class.get(\n @endpoint + path,\n :headers => headers\n ).body.gsub(/\\# uri:\\/(compute|storage|network)\\/[\\n]?/, '').split(\"\\n\").compact\n end", "title": "" }, { "docid": "75f8e1c1070206e5f951266a74e26ca6", "score": "0.58192265", "text": "def resources\n @resources ||=\n query_service.custom_queries.find_by_property(property: :source_metadata_identifier, value: [], lazy: true).select do |resource|\n id = resource.source_metadata_identifier.first\n next if /99.*3506421/.match?(id)\n next if transform_id(id).length > 18\n RemoteRecord.catalog?(id)\n end.to_a\n end", "title": "" }, { "docid": "205aebc018321c5458cdc4127848f36c", "score": "0.5815486", "text": "def list\n get()\n end", "title": "" }, { "docid": "ccded4301ad11eb00e5c507bc977d408", "score": "0.5806845", "text": "def resource_all(stack)\n result = request(\n :method => :get,\n :path => \"/stacks/#{stack.name}/#{stack.id}/resources\",\n :expects => 200\n )\n result.fetch(:body, :resources, []).map do |resource|\n Stack::Resource.new(\n stack,\n :id => resource[:physical_resource_id],\n :name => resource[:resource_name],\n :type => resource[:resource_type],\n :logical_id => resource[:logical_resource_id],\n :state => resource[:resource_status].downcase.to_sym,\n :status => resource[:resource_status],\n :status_reason => resource[:resource_status_reason],\n :updated => Time.parse(resource[:updated_time])\n ).valid_state\n end\n end", "title": "" }, { "docid": "4e981419dc995192abe58dab08b0f796", "score": "0.5805607", "text": "def resource_all(stack)\n all_result_pages(nil, :body,\n \"ListStackResourcesResponse\", \"ListStackResourcesResult\",\n \"StackResourceSummaries\", \"member\") do |options|\n request(\n :method => :post,\n :path => \"/\",\n :form => options.merge(\n Smash.new(\n \"Action\" => \"ListStackResources\",\n \"StackName\" => stack.id,\n )\n ),\n )\n end.map do |res|\n Stack::Resource.new(\n stack,\n :id => res[\"PhysicalResourceId\"],\n :name => res[\"LogicalResourceId\"],\n :logical_id => res[\"LogicalResourceId\"],\n :type => res[\"ResourceType\"],\n :state => res[\"ResourceStatus\"].downcase.to_sym,\n :status => res[\"ResourceStatus\"],\n :updated => res[\"LastUpdatedTimestamp\"],\n ).valid_state\n end\n end", "title": "" }, { "docid": "1f7704e6969a9cff17377129dd302fc5", "score": "0.58026636", "text": "def get_resources(opts = {})\n data, _status_code, _headers = get_resources_with_http_info(opts)\n data\n end", "title": "" }, { "docid": "0dc81e89c6c214b31c49e9cc84083e20", "score": "0.5802418", "text": "def list klass, names, options, check_remote = false, &block\n ResourceInfo.list klass, self, names, options, check_remote, &block\n end", "title": "" }, { "docid": "cb8aa16905310d8afb267d2caf71a52d", "score": "0.5793668", "text": "def list(\n filter,\n *args,\n deadline: nil\n )\n return @peering_group_resources.list(\n filter,\n *args,\n deadline: deadline,\n )\n end", "title": "" }, { "docid": "64dc617921fb6ddf5876bcc6a90e91e1", "score": "0.57922983", "text": "def index\n self.resources = resource_class.all.paginate(per_page: 15, page: (params[:page] || 1).to_i)\n end", "title": "" }, { "docid": "6c7c8c1093e6682eb3bc8c718879300e", "score": "0.578251", "text": "def list(\n filter,\n *args,\n deadline: nil\n )\n return @roles.list(\n filter,\n *args,\n deadline: deadline,\n )\n end", "title": "" }, { "docid": "3dd3feaf59dd85b56203aea24099d8ab", "score": "0.577361", "text": "def index\n @resources_customs = ResourcesCustom.all\n end", "title": "" }, { "docid": "e4ef6836333b2bf34e5bd71e978fc624", "score": "0.5772844", "text": "def index\n @resources = Catalogs::Level.search(params[:search]).order(\"#{sort_column} #{sort_direction}\").paginate(per_page: 11, page: params[:page])\n authorize @resources\n end", "title": "" }, { "docid": "8b088187e5faadf3ce30d74f140b550f", "score": "0.5766634", "text": "def getAllResources(domain = \"*\")\n where_clause = \"\"\n if domain != \"*\" then\n where_clause = \"WHERE testbeds.name='#{domain}'\"\n end\n qs = <<ALLRESOURCES_QS\nSELECT nodes.hrn\n FROM nodes\n LEFT JOIN locations ON nodes.location_id = locations.id\n LEFT JOIN testbeds ON locations.testbed_id = testbeds.id\n#{where_clause};\nALLRESOURCES_QS\n\n resources = Set.new\n runQuery(qs) { |name|\n resources.add(name)\n }\n return resources\n end", "title": "" }, { "docid": "2ca28d3c9b00a53dd4ec1cc11d207c2f", "score": "0.57637113", "text": "def list_resource\n find_resource!(:template, \"#{new_resource.conf_dir}/list.conf\")\n end", "title": "" }, { "docid": "9897fac0e5f92087a915820af0266553", "score": "0.57583416", "text": "def matching_resources(env)\n @resources.find_all { |resource| resource.match!(env) }\n end", "title": "" }, { "docid": "eaa29e492c76b911cf986f3f5f75dc96", "score": "0.5748122", "text": "def list_resources request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_list_resources_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::Config::V1::ListResourcesResponse.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "title": "" }, { "docid": "261f964621614f3d276ac06db04eb840", "score": "0.5725841", "text": "def generate_resources_list\n resources = YARD::Registry.all(:resource).uniq.sort_by {|resource| resource.name.to_s}\n generate_full_list(resources, 'Resource', 'resources')\nend", "title": "" }, { "docid": "2643032a40534e5f15a53915f6067ae2", "score": "0.5720921", "text": "def list(**options)\n raise ParameterMissing, 'required parameter :ids is missing' unless options[:ids]\n\n get_collection_by_ids(options.delete(:ids), options)\n end", "title": "" }, { "docid": "e4a9bc77ef5ef7c912b82cc58c386f6a", "score": "0.57181776", "text": "def resources(oneview_type = nil, oneview_name = nil)\n oneview_type = @options[:oneview_type] if oneview_type.nil?\n oneview_name = @options[:oneview_name] if oneview_name.nil?\n raise 'Oneview resource type must be specified.' if oneview_type.nil?\n\n # Determine the endpoint that needs to be called\n endpoint = format('/rest/%s', oneview_type)\n\n # Find the resources\n response = oneview_client.rest_get(endpoint)\n resources = oneview_client.response_handler(response)\n\n return resources if oneview_name.nil?\n\n # Filter the resources by the name if it has been specified\n resources['members'].select { |r| r['name'] == oneview_name }\n end", "title": "" }, { "docid": "9c944b3a9d2afad0a29c73e6cac42033", "score": "0.57108253", "text": "def resources(opts={})\n Tripod::ResourceCollection.new(\n self.resource_class._resources_from_sparql(self.as_query(opts)),\n # pass in the criteria that was used to generate this collection, as well as whether the user specified return graph\n :return_graph => (opts.has_key?(:return_graph) ? opts[:return_graph] : true),\n :criteria => self\n )\n end", "title": "" }, { "docid": "029777b76f170a192e17e7350f561f02", "score": "0.56987834", "text": "def show_resources\r\n @resources_pages = Paginator.new self, \r\n Resource.count, \r\n Resource.get(\"resources_paginator_count\").to_i, \r\n params[:page] \r\n @resources = Resource.find :all, :order => 'name',\r\n :limit => @resources_pages.items_per_page,\r\n :offset => @resources_pages.current.offset \r\n end", "title": "" }, { "docid": "98cb78cfa1ef5f7e6b1bc807df1e0744", "score": "0.56865793", "text": "def resources\n @resources ||= @response[@resource_field].to_a\n end", "title": "" }, { "docid": "a3ea5510e9597b876984c72c8a62de62", "score": "0.56808424", "text": "def list(\n filter,\n *args,\n deadline: nil\n )\n return @account_permissions.list(\n filter,\n *args,\n deadline: deadline,\n )\n end", "title": "" }, { "docid": "c28fc0203615b78e9a0c56d21009d403", "score": "0.56775737", "text": "def all\n describe(resource_uri)\n end", "title": "" }, { "docid": "75766a41c850d58c59af53b95fccc049", "score": "0.5677194", "text": "def all options={}, account_id:\n DynamicModel.new perform_request api_url \"matchlists/by-account/#{account_id}\", options\n end", "title": "" }, { "docid": "b4d31af56212fb51442b2255b9c88103", "score": "0.5674268", "text": "def all(params = {})\n response = http_get(resource_url, params)\n format_object(response, TYPE)\n end", "title": "" }, { "docid": "a621177d9e4d561edee66e71556f7e29", "score": "0.56694704", "text": "def all(options={})\r\n find(:all, options)\r\n end", "title": "" }, { "docid": "468abcc2246ea9daac6bcdc16f6b3cce", "score": "0.56682914", "text": "def resources\n @resources\n end", "title": "" }, { "docid": "149df37bd68b736fafda41dce1e75097", "score": "0.5668057", "text": "def list(\n filter,\n *args,\n deadline: nil\n )\n req = V1::AccountResourceHistoryListRequest.new()\n req.meta = V1::ListRequestMetadata.new()\n page_size_option = @parent._test_options[\"PageSize\"]\n if page_size_option.is_a? Integer\n req.meta.limit = page_size_option\n end\n if not @parent.snapshot_time.nil?\n req.meta.snapshot_at = @parent.snapshot_time\n end\n\n req.filter = Plumbing::quote_filter_args(filter, *args)\n resp = Enumerator::Generator.new { |g|\n tries = 0\n loop do\n begin\n plumbing_response = @stub.list(req, metadata: @parent.get_metadata(\"AccountResourcesHistory.List\", req), deadline: deadline)\n rescue => exception\n if (@parent.shouldRetry(tries, exception))\n tries + +@parent.jitterSleep(tries)\n next\n end\n raise Plumbing::convert_error_to_porcelain(exception)\n end\n tries = 0\n plumbing_response.history.each do |plumbing_item|\n g.yield Plumbing::convert_account_resource_history_to_porcelain(plumbing_item)\n end\n break if plumbing_response.meta.next_cursor == \"\"\n req.meta.cursor = plumbing_response.meta.next_cursor\n end\n }\n resp\n end", "title": "" }, { "docid": "ffac1f730d9fda17f0a9562d93013cda", "score": "0.56634545", "text": "def record_sets(opt = {})\n client.list_resource_record_sets(opt)&.resource_record_sets\n end", "title": "" }, { "docid": "99a286e2326cc7a75e59c2984e02ffc4", "score": "0.56624705", "text": "def get_fhir_resources(fhir_client, type, resource_id, patient_id=nil)\n if patient_id == nil\n search = { parameters: { _id: resource_id} } \n else\n search = { parameters: { _id: resource_id, patient: patient_id} }\n end\n results = fhir_client.search(type, search: search )\n binding.pry if results == nil || results.resource == nil || results.resource.entry == nil \n results.resource.entry.map(&:resource)\n end", "title": "" }, { "docid": "356861a05140e29bd2a08502447293f7", "score": "0.5660628", "text": "def list_resources(options)\n #debug \"options = \" + options.inspect\n body, format = parse_body(options)\n params = body[:options]\n #debug \"Body & Format = \", opts.inspect + \", \" + format.inspect\n\n debug 'ListResources: Options: ', params.inspect\n\n only_available = params[:only_available]\n slice_urn = params[:slice_urn]\n\n authorizer = options[:req].session[:authorizer]\n # debug \"!!!authorizer = \" + authorizer.inspect\n\n debug \"!!!USER = \" + authorizer.user.inspect\n debug \"!!!ACCOUNT = \" + authorizer.account.inspect\n # debug \"!!!ACCOUNT_URN = \" + authorizer.account[:urn]\n # debug \"!!!ACCOUNT = \" + authorizer.user.accounts.first.inspect\n\n if slice_urn\n @return_struct[:code][:geni_code] = 4 # Bad Version\n @return_struct[:output] = \"Geni version 3 no longer supports arguement 'geni_slice_urn' for list resources method, please use describe instead.\"\n @return_struct[:value] = ''\n return ['application/json', JSON.pretty_generate(@return_struct)]\n else\n resources = @am_manager.find_all_samant_leases(nil, $acceptable_lease_states, authorizer)\n comps = @am_manager.find_all_samant_components_for_account(nil, authorizer)\n # child nodes should not be included in listresources\n comps.delete_if {|c| ((c.nil?)||(c.to_uri.to_s.include?\"/leased\"))}\n if only_available\n debug \"only_available selected\"\n # TODO maybe delete also interfaces and locations as well\n comps.delete_if {|c| (c.kind_of?SAMANT::Uxv) && c.hasResourceStatus && (c.hasResourceStatus.to_uri == SAMANT::BOOKED.to_uri) }\n end\n resources.concat(comps)\n #debug \"the resources: \" + resources.inspect\n # TODO uncomment to obtain rspeck, commented out because it's very time-wasting\n #used_for_side_effect = OMF::SFA::AM::Rest::ResourceHandler.rspecker(resources, :Offering) # -> creates the advertisement rspec file inside /ready4translation (less detailed, sfa enabled)\n start = Time.now\n debug \"START CREATING JSON\"\n res = OMF::SFA::AM::Rest::ResourceHandler.omn_response_json(resources, options) # -> returns the json formatted results (more detailed, omn enriched)\n debug \"END CREATING JSON. total time = \" + (Time.now-start).to_s\n end\n\n @return_struct[:code][:geni_code] = 0\n @return_struct[:value] = res\n @return_struct[:output] = ''\n return ['application/json', JSON.pretty_generate(@return_struct)]\n rescue OMF::SFA::AM::InsufficientPrivilegesException => e\n @return_struct[:code][:geni_code] = 3\n @return_struct[:output] = e.to_s\n @return_struct[:value] = ''\n return ['application/json', JSON.pretty_generate(@return_struct)]\n end", "title": "" }, { "docid": "28db25cc2979908e6f0d70d0bc6c7842", "score": "0.5652016", "text": "def index\n @resources = Catalogs::Location.search(params[:search]).order(\"#{sort_column} #{sort_direction}\").paginate(per_page: 11, page: params[:page])\n authorize @resources\n end", "title": "" }, { "docid": "bb7f983da7a5b5cc276dd9aadfa51287", "score": "0.5649479", "text": "def list(org_id_list, fy_year=current_planning_year_year, asset_type_id=nil, asset_subtype_id=nil)\n\n Rails.logger.debug \"AssetEndOfServiceService: list()\"\n #\n if org_id_list.blank?\n Rails.logger.warn \"AssetEndOfServiceService: disposition list: Org ID cannot be null\"\n return []\n end\n\n # Start to set up the query\n conditions = []\n values = []\n\n # Filter for the selected org\n conditions << \"organization_id IN (?)\"\n values << org_id_list\n # Scheduled replacement year, defaults to the next planning year unless\n # specified\n conditions << \"scheduled_replacement_year = ?\"\n values << fy_year\n\n # Limit by asset type\n #unless asset_type_id.blank?\n # conditions << \"asset_subtype_id = ?\"\n # values << asset_type_id\n #end\n\n unless asset_subtype_id.blank?\n conditions << \"asset_subtype_id = ?\"\n values << asset_subtype_id\n end\n\n Rails.application.config.asset_base_class_name.constantize.operational.where(conditions.join(' AND '), *values)\n end", "title": "" }, { "docid": "c7d1fdb0b360a52d6742758865174d22", "score": "0.56406355", "text": "def get_list(params = {})\n http_helper.send_get_request(\"#{@url_prefix}/\", params)\n end", "title": "" }, { "docid": "c5e2787e9579dee3f3608eefce5650a7", "score": "0.56405675", "text": "def all\n setup_request \"#{@@resource_url}s\"\n end", "title": "" }, { "docid": "246caf0118c6f836bf0f0421c66f187f", "score": "0.5635896", "text": "def test_list_available_resources\n puts \"## list_available_resources (retrieveable SF objects) ##\"\n resp = Salesforce::Rest::AsfRest.xlist_available_resources()\n\n resp.each {|key, val| pp key + ' => ' + val.to_s}\n assert !resp.nil?\n end", "title": "" }, { "docid": "e52407452328d438d5a2bd93a2b7bd52", "score": "0.5635833", "text": "def resources\n @resources.values\n end", "title": "" }, { "docid": "d56a28fd75851702612f235336ed5fef", "score": "0.5635193", "text": "def get_resources()\n data, _status_code, _headers = get_resources_with_http_info()\n return data\n end", "title": "" }, { "docid": "1aa0f9dd07ce95c55a7e964c238605c0", "score": "0.5633444", "text": "def list_resource\n resource_class.all_but_other\n end", "title": "" }, { "docid": "50307ffbdc14051805ee4b2bee860586", "score": "0.56290466", "text": "def all(options={})\r\n find(:all,options)\r\n end", "title": "" }, { "docid": "85ce25c4999ea180a0913bfbcfd1b020", "score": "0.56251097", "text": "def resources\n return @resources\n end", "title": "" }, { "docid": "85ce25c4999ea180a0913bfbcfd1b020", "score": "0.56251097", "text": "def resources\n return @resources\n end", "title": "" }, { "docid": "85ce25c4999ea180a0913bfbcfd1b020", "score": "0.56251097", "text": "def resources\n return @resources\n end", "title": "" }, { "docid": "428f43fee24fceddc78161bd57ba0fb2", "score": "0.56234175", "text": "def list(opts = {})\n data, _status_code, _headers = list_with_http_info(opts)\n data\n end", "title": "" }, { "docid": "428f43fee24fceddc78161bd57ba0fb2", "score": "0.56234175", "text": "def list(opts = {})\n data, _status_code, _headers = list_with_http_info(opts)\n data\n end", "title": "" }, { "docid": "428f43fee24fceddc78161bd57ba0fb2", "score": "0.56234175", "text": "def list(opts = {})\n data, _status_code, _headers = list_with_http_info(opts)\n data\n end", "title": "" }, { "docid": "428f43fee24fceddc78161bd57ba0fb2", "score": "0.56234175", "text": "def list(opts = {})\n data, _status_code, _headers = list_with_http_info(opts)\n data\n end", "title": "" }, { "docid": "428f43fee24fceddc78161bd57ba0fb2", "score": "0.5621212", "text": "def list(opts = {})\n data, _status_code, _headers = list_with_http_info(opts)\n data\n end", "title": "" }, { "docid": "8f324081fa0060cf72e37ef6af3817ef", "score": "0.5607437", "text": "def get_info(params)\n debug 'Admin ListResources: Options: ', params.inspect\n category = params[:type]\n descr = params[:description]\n descr, find_with_array_hash = find_doctor(descr)\n\n if category # if applied specific resource type\n debug \"descr = \" + descr.inspect\n resources = @am_manager.find_all_samant_resources(category, descr)\n elsif urns = params[:urns] # if applied for certain urns\n resources = @am_manager.find_all_samant_resources(nil, descr)\n resources.delete_if {|c| !urns.include?(c.to_uri.to_s)}\n end\n resources.delete_if {|c| c.to_uri.to_s.include?\"/leased\"} unless resources.nil?\n unless find_with_array_hash.empty?\n resources.delete_if {|c| !find_with_array_hash.values[0].include? eval(\"c.#{find_with_array_hash.keys[0]}\")} unless resources.nil?\n end\n resources\n end", "title": "" }, { "docid": "69eeb1aa7dde21b48d3940b6b68a3ea7", "score": "0.5573701", "text": "def list(options={})\n if options['minimal']\n minimal_list\n else\n detailed_list(options)\n end\n end", "title": "" }, { "docid": "0f72eed0e360095f061d4e75f898ced5", "score": "0.55589396", "text": "def list(*args)\n fail \"Unacceptable HTTP Method #{request.env['REQUEST_METHOD']} for list\" unless request.get?\n {:action => 'list',\n :args => args}\n end", "title": "" } ]
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "2c2049f975bd00dbff2f6fc577b0d6a7", "score": "0.0", "text": "def credential_params\n params.require(:credential).permit(:name, :cer_number, :score, :cer_type, :start_date, :end_date, :identity_number)\n end", "title": "" } ]
[ { "docid": "e164094e79744552ae1c53246ce8a56c", "score": "0.6979893", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6781746", "text": "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "title": "" }, { "docid": "1677b416ad07c203256985063859691b", "score": "0.6746611", "text": "def allow_params_authentication!; end", "title": "" }, { "docid": "c1f317213d917a1e3cfa584197f82e6c", "score": "0.6742344", "text": "def allowed_params\n ALLOWED_PARAMS\n end", "title": "" }, { "docid": "547b7ab7c31effd8dcf394d3d38974ff", "score": "0.6735229", "text": "def default_param_whitelist\n [\"mode\"]\n end", "title": "" }, { "docid": "a91e9bf1896870368befe529c0e977e2", "score": "0.6592651", "text": "def param_whitelist\n [:role, :title]\n end", "title": "" }, { "docid": "b32229655ba2c32ebe754084ef912a1a", "score": "0.65027124", "text": "def expected_permitted_parameter_names; end", "title": "" }, { "docid": "3a9a65d2bba924ee9b0f67cb77596482", "score": "0.6498011", "text": "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "title": "" }, { "docid": "068f8502695b7c7f6d382f8470180ede", "score": "0.648163", "text": "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "title": "" }, { "docid": "e291b3969196368dd4f7080a354ebb08", "score": "0.647716", "text": "def permitir_parametros\n \t\tparams.permit!\n \tend", "title": "" }, { "docid": "c04a150a23595af2a3d515d0dfc34fdd", "score": "0.64556813", "text": "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "title": "" }, { "docid": "9a2a1af8f52169bd818b039ef030f513", "score": "0.64386255", "text": "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "title": "" }, { "docid": "c5f294dd85260b1f3431a1fbbc1fb214", "score": "0.63784456", "text": "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "title": "" }, { "docid": "631f07548a1913ef9e20ecf7007800e5", "score": "0.63756156", "text": "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "title": "" }, { "docid": "9735bbaa391eab421b71a4c1436d109e", "score": "0.636574", "text": "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "title": "" }, { "docid": "12fa2760f5d16a1c46a00ddb41e4bce2", "score": "0.6319542", "text": "def param_whitelist\n [:rating, :review]\n end", "title": "" }, { "docid": "f12336a181f3c43ac8239e5d0a59b5b4", "score": "0.63004524", "text": "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "title": "" }, { "docid": "c25a1ea70011796c8fcd4927846f7a04", "score": "0.6299559", "text": "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "title": "" }, { "docid": "822c743e15dd9236d965d12beef67e0c", "score": "0.62925464", "text": "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "title": "" }, { "docid": "9d23b31178b8be81fe8f1d20c154336f", "score": "0.62923217", "text": "def valid_params_request?; end", "title": "" }, { "docid": "7f0fd756d3ff6be4725a2c0449076c58", "score": "0.6289894", "text": "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "title": "" }, { "docid": "533f1ba4c3ab55e79ed9b259f67a70fb", "score": "0.6289475", "text": "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "title": "" }, { "docid": "5f16bb22cb90bcfdf354975d17e4e329", "score": "0.62831545", "text": "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "title": "" }, { "docid": "1dfca9e0e667b83a9e2312940f7dc40c", "score": "0.6242381", "text": "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "title": "" }, { "docid": "a44360e98883e4787a9591c602282c4b", "score": "0.6240358", "text": "def allowed_params\n params.require(:allowed).permit(:email)\n end", "title": "" }, { "docid": "4fc36c3400f3d5ca3ad7dc2ed185f213", "score": "0.6217451", "text": "def permitted_params\n []\n end", "title": "" }, { "docid": "7a218670e6f6c68ab2283e84c2de7ba8", "score": "0.6214354", "text": "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "title": "" }, { "docid": "b074031c75c664c39575ac306e13028f", "score": "0.62098235", "text": "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "title": "" }, { "docid": "0cb77c561c62c78c958664a36507a7c9", "score": "0.61918235", "text": "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "title": "" }, { "docid": "9892d8126849ccccec9c8726d75ff173", "score": "0.6177287", "text": "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "title": "" }, { "docid": "e3089e0811fa34ce509d69d488c75306", "score": "0.61755854", "text": "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "title": "" }, { "docid": "7b7196fbaee9e8777af48e4efcaca764", "score": "0.61712915", "text": "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "title": "" }, { "docid": "9d589006a5ea3bb58e5649f404ab60fb", "score": "0.61620486", "text": "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "title": "" }, { "docid": "d578c7096a9ab2d0edfc431732f63e7f", "score": "0.6151379", "text": "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "title": "" }, { "docid": "38a9fb6bd1d9ae5933b748c181928a6b", "score": "0.61510575", "text": "def safe_params\n params.require(:user).permit(:name)\n end", "title": "" }, { "docid": "7a6fbcc670a51834f69842348595cc79", "score": "0.6145169", "text": "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "title": "" }, { "docid": "fe4025b0dd554f11ce9a4c7a40059912", "score": "0.61207956", "text": "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.6115647", "text": "def check_params; true; end", "title": "" }, { "docid": "60ccf77b296ed68c1cb5cb262bacf874", "score": "0.6107701", "text": "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "3c8ffd5ef92e817f2779a9c56c9fc0e9", "score": "0.61030304", "text": "def quote_params\n params.permit!\n end", "title": "" }, { "docid": "86b2d48cb84654e19b91d9d3cbc2ff80", "score": "0.60909295", "text": "def valid_params?; end", "title": "" }, { "docid": "34d018968dad9fa791c1df1b3aaeccd1", "score": "0.60797", "text": "def paramunold_params\n params.require(:paramunold).permit!\n end", "title": "" }, { "docid": "6d41ae38c20b78a3c0714db143b6c868", "score": "0.60701567", "text": "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "title": "" }, { "docid": "c436017f4e8bd819f3d933587dfa070a", "score": "0.6062068", "text": "def filtered_parameters; end", "title": "" }, { "docid": "49052f91dd936c0acf416f1b9e46cf8b", "score": "0.60203075", "text": "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "title": "" }, { "docid": "5eaf08f3ad47cc781c4c1a5453555b9c", "score": "0.60167485", "text": "def filtering_params\n params.permit(:email, :name)\n end", "title": "" }, { "docid": "5ee931ad3419145387a2dc5a284c6fb6", "score": "0.60125494", "text": "def check_params\n true\n end", "title": "" }, { "docid": "3b17d5ad24c17e9a4c352d954737665d", "score": "0.6009718", "text": "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "title": "" }, { "docid": "45b8b091f448e1e15f62ce90b681e1b4", "score": "0.6007027", "text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "title": "" }, { "docid": "45b8b091f448e1e15f62ce90b681e1b4", "score": "0.6007027", "text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "title": "" }, { "docid": "74c092f6d50c271d51256cf52450605f", "score": "0.6000283", "text": "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "title": "" }, { "docid": "75415bb78d3a2b57d539f03a4afeaefc", "score": "0.59990394", "text": "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "title": "" }, { "docid": "bb32aa218785dcd548537db61ecc61de", "score": "0.5996995", "text": "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "title": "" }, { "docid": "65fa57add93316c7c8c6d8a0b4083d0e", "score": "0.59915864", "text": "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "title": "" }, { "docid": "865a5fdd77ce5687a127e85fc77cd0e7", "score": "0.59914654", "text": "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "title": "" }, { "docid": "ec609e2fe8d3137398f874bf5ef5dd01", "score": "0.59912056", "text": "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "title": "" }, { "docid": "423b4bad23126b332e80a303c3518a1e", "score": "0.5979621", "text": "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "title": "" }, { "docid": "48e86c5f3ec8a8981d8293506350accc", "score": "0.596686", "text": "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "title": "" }, { "docid": "2202d6d61570af89552803ad144e1fe7", "score": "0.5959418", "text": "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "title": "" }, { "docid": "9f774a9b74e6cafa3dd7fcc914400b24", "score": "0.59585625", "text": "def active_code_params\n params[:active_code].permit\n end", "title": "" }, { "docid": "a573514ae008b7c355d2b7c7f391e4ee", "score": "0.59583765", "text": "def filtering_params\n params.permit(:email)\n end", "title": "" }, { "docid": "8b571e320cf4baff8f6abe62e4143b73", "score": "0.5958032", "text": "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "title": "" }, { "docid": "d493d59391b220488fdc1f30bd1be261", "score": "0.5952298", "text": "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "title": "" }, { "docid": "f18c8e1c95a8a21ba8cd6fbc6d4d524a", "score": "0.5951678", "text": "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "title": "" }, { "docid": "4e6017dd56aab21951f75b1ff822e78a", "score": "0.5941885", "text": "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "title": "" }, { "docid": "67fe19aa3f1169678aa999df9f0f7e95", "score": "0.59378815", "text": "def list_params\n params.permit(:name)\n end", "title": "" }, { "docid": "bd826c318f811361676f5282a9256071", "score": "0.59376645", "text": "def filter_parameters; end", "title": "" }, { "docid": "bd826c318f811361676f5282a9256071", "score": "0.59376645", "text": "def filter_parameters; end", "title": "" }, { "docid": "5060615f2c808bab2d45f4d281987903", "score": "0.5933908", "text": "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "title": "" }, { "docid": "7fa620eeb32e576da67f175eea6e6fa0", "score": "0.59302104", "text": "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "title": "" }, { "docid": "d9483565c400cd4cb1096081599a7afc", "score": "0.5924862", "text": "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "title": "" }, { "docid": "f7c6dad942d4865bdd100b495b938f50", "score": "0.5923981", "text": "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "title": "" }, { "docid": "70fa55746056e81854d70a51e822de66", "score": "0.59165645", "text": "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "title": "" }, { "docid": "753b67fc94e3cd8d6ff2024ce39dce9f", "score": "0.5909916", "text": "def url_whitelist; end", "title": "" }, { "docid": "3683f6af8fc4e6b9de7dc0c83f88b6aa", "score": "0.590986", "text": "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "title": "" }, { "docid": "3eef50b797f6aa8c4def3969457f45dd", "score": "0.5908378", "text": "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "title": "" }, { "docid": "f9f0da97f7ea58e1ee2a5600b2b79c8c", "score": "0.5904956", "text": "def admin_social_network_params\n params.require(:social_network).permit!\n end", "title": "" }, { "docid": "de77f0ab5c853b95989bc97c90c68f68", "score": "0.5897421", "text": "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "title": "" }, { "docid": "5bdab99069d741cb3414bbd47400babb", "score": "0.58970135", "text": "def filter_params\n params.require(:filters).permit(:letters)\n end", "title": "" }, { "docid": "7c5ee86a81b391c12dc28a6fe333c0a8", "score": "0.5894611", "text": "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "title": "" }, { "docid": "29d030b36f50179adf03254f7954c362", "score": "0.5893914", "text": "def sensitive_params=(params)\n @sensitive_params = params\n end", "title": "" }, { "docid": "bf321f5f57841bb0f8c872ef765f491f", "score": "0.58927566", "text": "def permit_request_params\n params.permit(:address)\n end", "title": "" }, { "docid": "5186021506f83eb2f6e244d943b19970", "score": "0.5891277", "text": "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "title": "" }, { "docid": "b85a12ab41643078cb8da859e342acd5", "score": "0.5885355", "text": "def secure_params\n params.require(:location).permit(:name)\n end", "title": "" }, { "docid": "46e104db6a3ac3601fe5904e4d5c425c", "score": "0.58825094", "text": "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "title": "" }, { "docid": "abca6170eec412a7337563085a3a4af2", "score": "0.58783555", "text": "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "title": "" }, { "docid": "26a35c2ace1a305199189db9e03329f1", "score": "0.58728755", "text": "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "title": "" }, { "docid": "de49fd084b37115524e08d6e4caf562d", "score": "0.58686864", "text": "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "title": "" }, { "docid": "7b7ecfcd484357c3ae3897515fd2931d", "score": "0.5867015", "text": "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "title": "" }, { "docid": "8aa9e548d99691623d72891f5acc5cdb", "score": "0.58660764", "text": "def url_params\n params[:url].permit(:full)\n end", "title": "" }, { "docid": "0016f219c5d958f9b730e0824eca9c4a", "score": "0.58659357", "text": "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "title": "" }, { "docid": "c6a8b768bfdeb3cd9ea388cd41acf2c3", "score": "0.5864526", "text": "def backend_user_params\n params.permit!\n end", "title": "" }, { "docid": "be95d72f5776c94cb1a4109682b7b224", "score": "0.58634263", "text": "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "title": "" }, { "docid": "e4a29797f9bdada732853b2ce3c1d12a", "score": "0.5861585", "text": "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "title": "" }, { "docid": "967c637f06ec2ba8f24e84f6a19f3cf5", "score": "0.5861255", "text": "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "title": "" }, { "docid": "d14f33ed4a16a55600c556743366c501", "score": "0.5858771", "text": "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "title": "" }, { "docid": "46cb58d8f18fe71db8662f81ed404ed8", "score": "0.58579147", "text": "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "title": "" }, { "docid": "7e9a6d6c90f9973c93c26bcfc373a1b3", "score": "0.5854071", "text": "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "title": "" }, { "docid": "ad61e41ab347cd815d8a7964a4ed7947", "score": "0.5853147", "text": "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "title": "" }, { "docid": "8894a3d0d0ad5122c85b0bf4ce4080a6", "score": "0.58498794", "text": "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "title": "" }, { "docid": "53d84ad5aa2c5124fa307752101aced3", "score": "0.58492327", "text": "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end", "title": "" } ]
9146452ffd23e02c2eb5de0656fbc327
The phrases to be assembled in to a string representation.
[ { "docid": "9eb3bcd7be692d59c7e7fe69ddbc3113", "score": "0.63887286", "text": "def phrases\n [context, weeks, days, hm].reject &:nil?\n end", "title": "" } ]
[ { "docid": "eda9215770628c3f529629a1bc465cef", "score": "0.7699456", "text": "def to_string(phrases, separator = \"\\n\")\n phrases.join(separator).inspect\n end", "title": "" }, { "docid": "0f48bc31b1901f5914c03654ae363d74", "score": "0.72413564", "text": "def phrases; end", "title": "" }, { "docid": "5ad7a41c736e2dbe4d4b0ee19c6e0989", "score": "0.70104015", "text": "def transcription\n map { |p| p.ipa }.join\n end", "title": "" }, { "docid": "e3cd9540cd1ee8560e6de72c74ccccaa", "score": "0.6927679", "text": "def phrases\n out = words.dup\n keys = subs.keys.each.to_a\n subs.keys.each do |key1|\n keys[(keys.index(key1) + 1..-1)].each do |key2|\n next unless self === subs[key1] + subs[key2] \n out.merge form_phrases(key1, key2)\n end\n end\n out\n end", "title": "" }, { "docid": "05264523f76cd0faf19687df232d8ce5", "score": "0.6883368", "text": "def phrases(query)\n parts = keywords(query)\n parts_size = parts.size\n\n [*0..parts_size]\n .combination(2)\n .map { |(a, b)| parts[a...parts_size - (b - a - 1)].join(' ') }\n end", "title": "" }, { "docid": "d9bd0f870dae83994142184d842f88b4", "score": "0.66807276", "text": "def get_phrase\n @genes.join('')\n end", "title": "" }, { "docid": "d7ade4881871f6ec8d7b20119e5ed2ed", "score": "0.6637887", "text": "def transcription\n @phonetic_component.map { |p| p.transcription }.join\n end", "title": "" }, { "docid": "f1b339a37b10e4a6d1c23bc2805cd6e5", "score": "0.6369199", "text": "def phrases\n quote = [' Let the dance begin.', ' Human or AI?', \" Let's dance.\"]\n quote[Random.rand(0...quote.length)]\n end", "title": "" }, { "docid": "d895e2d73f95cde1fbab5c571a180c8c", "score": "0.63452256", "text": "def content\n # estraggo le frasi e verifico che esistano\n phrases = self.phrases.order('paragraph_position ASC')\n return '' if !phrases\n # genero il risultato\n content = ''\n phrases.each do |phrase|\n content = \"#{content}#{phrase.print} \"\n content content.gsub(/\\ +$/, '') if phrase === phrases.last\n end\n # ritorno il risultato\n return content\n end", "title": "" }, { "docid": "07dcdf19dcf0853a031f4a1bdaa0de55", "score": "0.6316728", "text": "def all_phrases\n phrases = Hash.new\n translation_scope(I18n.default_locale).find_each() do |translation|\n phrases[translation.key] = translation.value\n end\n phrases\n end", "title": "" }, { "docid": "9bbd0d7ce03b3903dc57e5de0d3d3baf", "score": "0.62814474", "text": "def to_s\n \"(#{@synset_type}) #{words.map { |x| x.tr('_',' ') }.join(', ')} (#{@gloss})\"\n end", "title": "" }, { "docid": "9bbd0d7ce03b3903dc57e5de0d3d3baf", "score": "0.62814474", "text": "def to_s\n \"(#{@synset_type}) #{words.map { |x| x.tr('_',' ') }.join(', ')} (#{@gloss})\"\n end", "title": "" }, { "docid": "8c28ed9cb2d7370031d3cabb320ca60b", "score": "0.62519556", "text": "def phrases\n @phrase_klass.search(phraseable_words)\n end", "title": "" }, { "docid": "967cbf512e424594c0289c67cf580866", "score": "0.62401795", "text": "def to_s\r\n @phrase\r\nend", "title": "" }, { "docid": "1bf72f7a9f31d51001173d5e5b0f8e69", "score": "0.61932087", "text": "def to_s\r\n paragraphs.map(&:to_s).join(\"\\n\")\r\n end", "title": "" }, { "docid": "a6d6583bf625f6666d2f6f5e4e2aba17", "score": "0.616102", "text": "def to_s\r\n text_runs.map(&:text).join('')\r\n end", "title": "" }, { "docid": "a6d6583bf625f6666d2f6f5e4e2aba17", "score": "0.616102", "text": "def to_s\r\n text_runs.map(&:text).join('')\r\n end", "title": "" }, { "docid": "9863c0dc9c629ace75b6b85b365e9a0e", "score": "0.6156908", "text": "def to_s\n\t\treturn self.words.join(\" \")\n\tend", "title": "" }, { "docid": "9863c0dc9c629ace75b6b85b365e9a0e", "score": "0.6156908", "text": "def to_s\n\t\treturn self.words.join(\" \")\n\tend", "title": "" }, { "docid": "c0a1549a8dc91356bf2a2690f10e14f1", "score": "0.6150933", "text": "def to_s\n to_a.map do |allomorph|\n allomorph.transcription\n end.sort.join(\"/\")\n end", "title": "" }, { "docid": "c9e51ed08cb6df8e8067e33003811886", "score": "0.6143971", "text": "def to_s\n paragraphs.map(&:to_s).join(\"\\n\")\n end", "title": "" }, { "docid": "c9e51ed08cb6df8e8067e33003811886", "score": "0.6143971", "text": "def to_s\n paragraphs.map(&:to_s).join(\"\\n\")\n end", "title": "" }, { "docid": "c9e51ed08cb6df8e8067e33003811886", "score": "0.6143971", "text": "def to_s\n paragraphs.map(&:to_s).join(\"\\n\")\n end", "title": "" }, { "docid": "a9095de3595ed32ab8b0bcd5abcc31a6", "score": "0.6122984", "text": "def build_rhyme(lines)\n lines.each_index.map do |index|\n # construct one line\n phrase = lines[0..index].reverse.join(\" \")\n \"This is #{phrase}.\"\n end.join(\"\\n\")\n end", "title": "" }, { "docid": "7ffc6b08ada7bb8d62a182b6b80d3f18", "score": "0.60909015", "text": "def phrases\n transitions.keys\n end", "title": "" }, { "docid": "91b64c9837b39390d797d5e45f1d28b6", "score": "0.60450816", "text": "def rhymed_to_s\n\n @rhymed_word_collection << @rhymed_words\n end", "title": "" }, { "docid": "749ba7c07e1edb5e2ffea28ad6bbc221", "score": "0.60324895", "text": "def phrases(words, length)\n words.lazy.each_with_index.map {|_, index|\n phrase = ''\n eof = false\n\n length.times do |i| #creates 3 word combos, traversing each index.\n word = words[index+i]\n\n # Reached end, break out\n if word.nil?\n eof = true\n else\n phrase += \"#{words[index+i]} \"\n end\n end #end length loop\n\n if eof\n next # sets value to nil if not a three word combo\n end\n\n phrase.rstrip #remove whitespace\n }.reject(&:nil?) # remove any nil values\nend", "title": "" }, { "docid": "d29a67960d97dd8bc65ff3ed83c3c07c", "score": "0.6022405", "text": "def phrase()\n @phrase\n end", "title": "" }, { "docid": "9ecbfdfc703cdd3a437021d1b68d3e90", "score": "0.60178477", "text": "def sentencize(*clauses)\n clauses\n .flatten\n .compact\n .reject(&:empty?)\n .map(&:strip)\n .join(\" \")\n end", "title": "" }, { "docid": "b88697eea5a15c5cc7015059f4ece13b", "score": "0.599933", "text": "def to_s\n format(text, words)\n end", "title": "" }, { "docid": "ca2864b33791cd03cc0fee1a6e1531a9", "score": "0.59667474", "text": "def to_s\n\t\tret = \"\"\n\t\t@corpus.each_pair do |key, value|\n\t\t\tret << \"[#{key[0].to_s},#{key[1].to_s}] => [\"\n\t\t\tfor word in value do ret << word + \",\" end\n\t\t\tret.chop!\n\t\t\tret << \"], \"\n\t\tend\n\t\tret.chop.chop\n\tend", "title": "" }, { "docid": "723f65dd10c797766a7f10d11c0d55d8", "score": "0.5965237", "text": "def emphasized_phrase_regex_str\n longlist.map do |opening_emphasis|\n opening = Regexp.escape(opening_emphasis)\n closing = Regexp.escape(opening_emphasis.reverse)\n # using ?: here because we don't need to capture this group\n \"(?:#{opening}.+#{closing})\"\n end.join(\"|\")\n end", "title": "" }, { "docid": "1bba84c2dcd1419f118094b83a858404", "score": "0.59548414", "text": "def to_s\n lines = String.new\n @proteins.values.each {|p| \n p.clans = @clans\n p.names = @names\n lines += p.to_s\n }\n return lines\n end", "title": "" }, { "docid": "bf19020dc16c0b2517e716ce3d4883d9", "score": "0.59502023", "text": "def phrase_content(phrase_to_encode)\n\t\t@starting_phrase = \"\"\n\t\tphrase_valid = validate_input(phrase_to_encode)\n\t\tif (phrase_valid)\n\t\t\t\t@starting_array = phrase_to_encode.split()\n\t\t\t\t@starting_phrase = phrase_to_encode\n\t\tend\n\t\t@starting_phrase\n\tend", "title": "" }, { "docid": "3175f824b19a8bbeae5aecb42165c6b2", "score": "0.59407395", "text": "def to_string\n productions.map(&:to_string).join(\"\\n\")\n end", "title": "" }, { "docid": "25636023dddd6a03abb9682cee0cb124", "score": "0.5855195", "text": "def merge_phrases(phrase_array)\n count = 0\n until phrase_array[count+1] == nil || (phrase_array[count] + phrase_array[count+1]).length > 139\n phrase_array[count] = phrase_array[count..count+1].join(\" \")\n phrase_array.delete_at(count+1)\n end\n count += 1\n phrase_array\nend", "title": "" }, { "docid": "d6cd07d31374a82be9c8a9e8d607b38d", "score": "0.5849866", "text": "def text\n @parts.join ' '\n end", "title": "" }, { "docid": "de5495ba9648e4576ae43a1397cc31f6", "score": "0.5826199", "text": "def to_s\n solution = \"(#{@name}:\"\n @ingredients.each_with_index do |x, index|\n solution = solution + \" #{ingredients_grams[index]} gramos de #{x.name},\"\n end\n solution[solution.length-1]=\")\"\n solution\n end", "title": "" }, { "docid": "6a98ac66168134ef9ebb3532b7f1a8ba", "score": "0.58088017", "text": "def trimmers_str\n trimmers.join \"\\n\"\n end", "title": "" }, { "docid": "2f9c0c7d663db049eaa1c3eabb784dd0", "score": "0.58050984", "text": "def transcription\n \"[#{allomorphs}]\"\n end", "title": "" }, { "docid": "3a8404031a989aec5784f00eb5f4a215", "score": "0.58007115", "text": "def pretty_to_s\n \"#{self.lemma}[#{self.rod_id}] : #{self.type.name} #{self.paradigm.code}\\n\" +\n self.paradigm.pretty_to_s(self.word_forms.map{|f| f && f.value})\n end", "title": "" }, { "docid": "64ea95b0448f53b38b8557c21ed6657a", "score": "0.5796352", "text": "def to_s() run.join(' '); end", "title": "" }, { "docid": "04614d60ffdc191d30baa7181679e3d2", "score": "0.5789729", "text": "def get_sample_phrase_2\r\n \"the bat in the flat\"\r\n end", "title": "" }, { "docid": "7b50403edd0edbae9522ca6e2c3ff4dc", "score": "0.577728", "text": "def all_phrases\n mario\n toadstool\n link\nend", "title": "" }, { "docid": "733aa5f685c63e28728d43240217a09a", "score": "0.57749844", "text": "def to_s\n\t\t\t\treturn self.map { |the_motif| the_motif.to_s }.join(\"\\n\")\n\t\t\tend", "title": "" }, { "docid": "9a574308d859a281dd8e99eb5c1f05bc", "score": "0.57717055", "text": "def to_s\n \"#{@word}(#{@tags.join(', ')})\"\n end", "title": "" }, { "docid": "09c5732b484a6878a79d3f5f55e7ff36", "score": "0.5770732", "text": "def construct_out_string\n out_string = @secret_word.map { |c| guessed?(c) }\n return out_string.join(' ')\n end", "title": "" }, { "docid": "3ba3e07bc0d8a3495e1f704a3fa83415", "score": "0.5766427", "text": "def to_s\n @word + '(' + @tags.join(', ') + ') '\n end", "title": "" }, { "docid": "d8af7704b6d098bd2c2f6621ddb42db7", "score": "0.5756708", "text": "def posession\n noun = mutate_consonants_if_necessary\n return {\n ben: \"benim #{noun}\" + ben_ending,\n sen: \"senin #{noun}\" + sen_ending,\n o: \"onun #{noun}\" + o_ending,\n siz: \"sizin #{noun}\" + siz_ending,\n biz: \"bizim #{noun}\" + biz_ending,\n onlar: \"onların #{noun}\" + onlar_ending\n }\n end", "title": "" }, { "docid": "9699c9e0f352bc1fcdd8944d2ea4a239", "score": "0.5752009", "text": "def to_s\n @cadena = @titulo + \"\\n\"\n @preguntas.each do |q|\n @cadena = @cadena + q.to_s\n end\n return @cadena\n end", "title": "" }, { "docid": "ac119b83073c7011b8c2f82d903a34f4", "score": "0.57310927", "text": "def to_s\n clauses.join(', ')\n end", "title": "" }, { "docid": "aa061c3c40ef17e78779f193f7287165", "score": "0.5727708", "text": "def to_s\n @word << '(' << @tags.join(', ') << ') '\n end", "title": "" }, { "docid": "aa061c3c40ef17e78779f193f7287165", "score": "0.5727708", "text": "def to_s\n @word << '(' << @tags.join(', ') << ') '\n end", "title": "" }, { "docid": "6fc104b9fdc811df8f5b7e461fd132ef", "score": "0.57239187", "text": "def make_word_phrase(array_of_words)\n array_of_words.each do |word|\n n = array_of_words.index(word)\n # Creates a two word array\n two_word = array_of_words[n..n+1]\n # Checks for the punctuations\n check_two(two_word)\n # Checks for two words\n if two_word[1].nil?\n two_word.clear\n else\n two_word.each do |c|\n # removes unnecessary punctuation\n strip_punct(c)\n end\n if proper_two(two_word)\n two_word = two_word.join(\" \")\n else\n two_word = two_word.join(\" \")\n end\n end\n # Creates a three word array\n three_word = array_of_words[n..n+2]\n # Checks for the punctuations\n check_three(three_word)\n if three_word[2].nil?\n three_word.clear\n else\n three_word.each do |c|\n strip_punct(c)\n end\n if proper_three(three_word)\n three_word = three_word.join(\" \")\n else\n three_word = three_word.join(\" \")\n end\n end\n end\n end", "title": "" }, { "docid": "f2edd14a2c0694201c815b85990adb62", "score": "0.5706204", "text": "def to_s\n \"#{transcription}: #{meaning}\"\n end", "title": "" }, { "docid": "f2edd14a2c0694201c815b85990adb62", "score": "0.5706204", "text": "def to_s\n \"#{transcription}: #{meaning}\"\n end", "title": "" }, { "docid": "2d0bbe9d6f430a0f4c5ab2fdbb3e3b92", "score": "0.56790525", "text": "def get_sample_phrase_1\r\n \"the cat in the hat\"\r\n end", "title": "" }, { "docid": "8e13b4ea6157fd475a39b64dd5a9895f", "score": "0.5665024", "text": "def convert_sentence_to_string\r\n temp_array = []\r\n self.map do |token| \r\n temp_array.push(token.value)\r\n temp_array.push(\" \")\r\n end\r\n temp_array.reverse!.shift\r\n temp_array.reverse!\r\n temp_array.to_s\r\n end", "title": "" }, { "docid": "1a5ef088e02a4085fd0bcaa53502287e", "score": "0.56345236", "text": "def to_s\n\t\t\tretval = 'Dictionary'\n\t\t\tword_stats = []\n\t\t\t@words.keys.sort.each do |speech_part|\n\t\t\t\tword_stats << \"#{@words[speech_part].size}x #{SpeechParts.describe(speech_part)}\"\n\t\t\tend\n\t\t\twords_part = word_stats.join(', ')\n\t\t\tretval += '; ' + words_part unless (words_part.empty?)\n\t\t\tretval\n\t\tend", "title": "" }, { "docid": "8b36cf811a8446b6ce5bff2759466692", "score": "0.56297845", "text": "def prepare_search phrase\n new_phrase = []\n \n phrase.split.each do |a|\n # If something like be*r\n if a.index WILDCARD_OPERATOR\n # replace be*r with possible alternatives: bear OR beer OR bever...\n new_phrase << @gram_handler.search_and(wildcard_parts(a)).join(\" #{OR_OPERATOR} \")\n else\n new_phrase << a\n end\n end\n \n return new_phrase.join ' '\n end", "title": "" }, { "docid": "5002881c5ed2dfa2b8d4195010764f39", "score": "0.56265455", "text": "def content_underline(special_phrase)\n # estraggo le frasi e verifico che esistano\n phrases = self.phrases.order('paragraph_position ASC')\n return '' if !phrases\n # genero il risultato\n content = ''\n phrases.each do |phrase|\n if phrase === special_phrase\n content = \"#{content}<b>#{phrase.print}</b> \"\n else\n content = \"#{content}#{phrase.print} \"\n end\n content = content.gsub(/\\ +$/, '') if phrase === phrases.last\n end\n # ritorno il risultato\n return content\n end", "title": "" }, { "docid": "32224af3a9d457b3a8eab0593e653c6f", "score": "0.56212413", "text": "def phrases(argument:, label: nil, inspect: true, depth_offset: 0)\n depth = depth_offset.nil? ? 0 : depth_offset.to_i\n {\n tag: ValueHelper.tag(depth: depth + 1),\n line: ValueHelper.line(depth: depth + 1),\n value: ValueHelper.value(argument: argument, inspect: inspect, depth: depth + 1),\n label: ValueHelper.label(argument: argument, explicit_label: label)\n }\n end", "title": "" }, { "docid": "e18cd24df3b3bcb43fab61756a1ef04f", "score": "0.56212157", "text": "def create_phrases(phrases)\n # separo le frasi rispetto al punto\n return false if !phrases\n phrases = phrases.gsub('. ', '.###')\n phrases = phrases.gsub('? ', '?###')\n phrases = phrases.gsub('! ', '!###')\n phrases = phrases.gsub(\".\\n\", '!###')\n phrases = phrases.split('###')\n phrases.each_with_index do |phrase, position|\n phrase = Phrase.new(content: phrase, paragraph_id: self.id, paragraph_position: position, profile_id: self.profile.id)\n phrase.save\n end\n end", "title": "" }, { "docid": "06744c4239dedf086c1e68df1b510524", "score": "0.5621162", "text": "def process_text string_array\n final = Array.new\n string_array.each { |s| final.push(s.strip)}\n final.join(\" \")\n end", "title": "" }, { "docid": "4891711b9b2965c52e039befb45c4254", "score": "0.56117606", "text": "def mathphrase\n p length = (1..20).to_a.sample\n sentence_array = []\n length.times do\n sentence_array << NUMBERS.sample\n sentence_array << OPERATORS.sample\n end\n sentence_array << NUMBERS.sample\n sentence_array.join(\" \").gsub(\"divided\", \"divided by\")\nend", "title": "" }, { "docid": "bb74a1a0545c9b8ce4077a36e2bf1999", "score": "0.5602646", "text": "def generate_payload_passphrases\r\n phrases = Set.new(@passphrases)\r\n @possible_keys.each do |key|\r\n @possible_ivs.each do |iv|\r\n phrase = Rex::Text.encode_base64(\r\n encrypt_data(@encryptor, key + iv, key + iv)\r\n )\r\n phrases.add(String.new(phrase[0, 16]))\r\n end\r\n end\r\n @passphrases = phrases.to_a\r\n end", "title": "" }, { "docid": "6e7ecbaa6e4a0eb9180f90c13ff9ad86", "score": "0.5598645", "text": "def chunk_by_phrases(key_array)\n out_array = []\n common_pre = /\\Aa|the\\z/i\n common_2b_verbs = /\\Ais|was|were|am|are|be\\z/i\n for k in (0..key_array.length-1)\n last = out_array.length - 1\n if (common_pre =~ key_array[k]) || (common_2b_verbs =~ key_array[k])\n out_arra y[last] = out_array[last].nil? ? key_array[k] : \"#{out_array[last]} #{key_array[k]}\"\n else\n out_array.push(key_array[k])\n end \n end\n return out_array\n end", "title": "" }, { "docid": "17ee24cf30a4faa9c1e6baf2cecc8c65", "score": "0.5587516", "text": "def to_s\n contents.flatten.join\n end", "title": "" }, { "docid": "5eba0f0e8329d49042af04f2918edd9c", "score": "0.55788547", "text": "def format_text(words)\n words.map do |word|\n format_val = self.send(:next)\n segment = \"\"\n\n # add whitespace\n while format_val.match(/^\\s+$/)\n segment += format_val\n format_val = self.send(:next)\n end\n\n segment += word\n end.join(\"\")\n end", "title": "" }, { "docid": "586131dde1141c8f5ae482fd5747fcb5", "score": "0.5574567", "text": "def translate phrase\n\n words = phrase.split(' ')\n pig_latin_phrase = []\n\n words.each do |i|\n pig_latin_phrase << pig_latin_word(i)\n end\n\n pig_latin_phrase.join(' ')\nend", "title": "" }, { "docid": "234837846e66676a3cf8655364a3d67f", "score": "0.55457336", "text": "def to_s\n x=\"#{@nombrep}, prot: #{@alim_total.prot}, carbs: #{@alim_total.carbs}, lip: #{@alim_total.lip}, emisiones: #{@alim_total.emisiones}, terreno: #{@alim_total.terreno}, VCT: #{@alim_total.valorEnergetico}.\"\n y=\" Compuesto por: \"\n lista2 = ali_list.zip(gram_list)\n lista2.cycle(1){ |z| y+=z[0].nombre + \", \" + z[1].to_s + \" gramos, \"}\n y = y[0..(y.length-3)]\n x + y\nend", "title": "" }, { "docid": "3b51c22d7bd20aa3f9cf44c18f8d99e1", "score": "0.55357635", "text": "def to_s\n\t\treturn \"my names is #{name} and i am a #{species} and these are my toys: #{toys.join(\", \")}\"\n\tend", "title": "" }, { "docid": "639267e92ba592b924ef56b5d252516a", "score": "0.55356103", "text": "def body\n @texts.map { |t| \"q=#{CGI::escape(t)}\" }.join '&'\n end", "title": "" }, { "docid": "7852171233295d6c7b223d37c44522ec", "score": "0.5535115", "text": "def build_content_string\n parts = []\n line_items.each do |li|\n if li.product_options.any?\n str = \"#{li.product.name} (#{li.product_options.map { |po| po.name }.join(', ')}) : #{li.count} #{li.note}\"\n else\n str = \"#{li.product.name} : #{li.count} #{li.note}\"\n end\n parts << str\n end\n parts.join(';')\n end", "title": "" }, { "docid": "fdc8ab87b069e84cc18c266a2f1e2c6f", "score": "0.5530321", "text": "def convert (snippet, phrase)\n # sort the WORDS array randomly. rand_words is an array of the words in an random order\n rand_words = WORDS.sort_by {rand}\n # craft the class_names array\n class_names = craft_names(rand_words, snippet, /###/, caps=true)\n # craft the other_names array\n other_names = craft_names(rand_words, snippet, /\\*\\*\\*/)\n # craft the param_names array\n param_names = craft_params(rand_words, snippet, /@@@/)\n \n results = []\n \n # \"sentence\": do snippet, then phrase\n [snippet, phrase].each do |sentence|\n # replace all /###/ (stand for class name) with the last element of class_names\n result = sentence.gsub(/###/) {|x| class_names.pop}\n \n # replace all /\\*\\*\\*/ (stands for other names) with the last element of other_names\n result.gsub!(/\\*\\*\\*/) {|x| other_names.pop }\n \n # replace all /@@@/ with the last element of param_names\n result.gsub!(/@@@/) {|x| param_names.pop}\n \n # push the new \"sentence\" (now with the words put in) to the results array\n results.push(result)\n end\n \n return results\nend", "title": "" }, { "docid": "c16959c1a560bffce8fe88f7c8af8118", "score": "0.5529483", "text": "def responses_as_text\n rv = \"\"\n responses.each do |r|\n rv << \"[#{r.itembank_id},#{r.item_id}]=#{r.value}\\n\"\n end\n rv\n end", "title": "" }, { "docid": "aba3d1949e888ac8e1aa59e34fd5512e", "score": "0.5528549", "text": "def to_s\n\t\t\treturn [\n\t\t\t\tself.language_range,\n\t\t\t\tself.qvaluestring,\n\t\t\t\tself.extension_strings,\n\t\t\t].compact.join( ';' )\n\t\tend", "title": "" }, { "docid": "b918630e65bf8f1136608849f73be835", "score": "0.55169016", "text": "def make_examples examples\n\t\ts = ''\n\n\t\texamples.each do |example|\n\t\t\tword = example.word\n\t\t\tkana = example.kana\n\t\t\tmeaning = example.meaning\n\n\t\t\ts += word + ' (' + kana + ') - ' + meaning\n\t\t\ts += '<br>'\n\t\tend\n\n\t\ts.chomp! '<br>'\n\t\treturn s\n\tend", "title": "" }, { "docid": "c532114eb6f8742a8f63d65fb1e6a379", "score": "0.5512027", "text": "def to_s\n tags = []\n\n tags << \"v=#{@v}\" if @v\n tags << \"p=#{@p}\" if @p\n tags << \"sp=#{@sp}\" if @sp\n tags << \"rua=#{@rua.join(',')}\" if @rua\n tags << \"ruf=#{@ruf.join(',')}\" if @ruf\n tags << \"adkim=#{@adkim}\" if @adkim\n tags << \"aspf=#{@aspf}\" if @aspf\n tags << \"ri=#{@ri}\" if @ri\n tags << \"fo=#{@fo.join(':')}\" if @fo\n tags << \"rf=#{@rf}\" if @rf\n tags << \"pct=#{@pct}\" if @pct\n\n return tags.join('; ')\n end", "title": "" }, { "docid": "34454b446dbed154cb637864d3e9075b", "score": "0.5494935", "text": "def comma(str, *phrases)\n _concat([\", \", str])\n _inspect(phrases)\n end", "title": "" }, { "docid": "8ed7246609bcecb3d12d0ea566ce57d9", "score": "0.54831487", "text": "def reconstruct_parameters_string parameters\n parameters.map(&:input_str).join \",\"\n end", "title": "" }, { "docid": "4054b9b1fa2e823665c5f4f1f82b0f57", "score": "0.54827744", "text": "def initialize_as_words\n self.as_words = \"\"\n romaji_constituents.each_with_index do |const, i|\n unless const.in?(JAPANESE_PUNCTUATION)\n if romaji_constituents[i + 1].in?(JAPANESE_PUNCTUATION)\n self.as_words += const\n else\n self.as_words += const += \" \"\n end\n else\n if const == \"、\"\n self.as_words += \", \"\n end\n end\n end\n end", "title": "" }, { "docid": "6d9997215023c80fe09a4a719dd72917", "score": "0.548143", "text": "def to_s\n rules.map { |r| r.embed }.join(' ')\n end", "title": "" }, { "docid": "d5f7e39a8129d005c7d69c54823cbd64", "score": "0.54745644", "text": "def sentence\n [intro, subject, verb, object].join(\" \")\n end", "title": "" }, { "docid": "7611de5c543a506483bef4fc36d03274", "score": "0.5471184", "text": "def to_s\n\t\t\"(#{nombre},#{prot},#{carbo},#{lip},#{gases},#{terreno})\"\n\tend", "title": "" }, { "docid": "ef12d515b4e674a1031c8e0086f27619", "score": "0.54663926", "text": "def phrases(options={})\n options[:limit] ||= 10\n word_phrases = Wordnik.get(\"/word.json/#{URI.escape(self.wordstring)}/phrases\", {:headers => self.client.api_headers, :query=>{:limit=>options[:limit]}})\n return word_phrases\n end", "title": "" }, { "docid": "eb893b8df1cef41fb571ae037e93e909", "score": "0.5461684", "text": "def to_s\n self.atoms.collect{|a| a.to_s}.join(\"\\n\")\n end", "title": "" }, { "docid": "e5e915ab7d0e33f70660cb514aba2431", "score": "0.54596204", "text": "def ingredients_to_string\n ingredients.to_sentence\n end", "title": "" }, { "docid": "e2c4f82123b89c275519c707f433ea79", "score": "0.54505515", "text": "def to_s\n @lines.map do |line|\n line.join(' ')\n end.join(\"\\n\")\n end", "title": "" }, { "docid": "6f623007d72cb908e447eaa11e030074", "score": "0.5440165", "text": "def to_s\n to_a.shelljoin\n end", "title": "" }, { "docid": "d2a85aa51490d16747034c37b477cefc", "score": "0.54317605", "text": "def to_text(array)\n text = ''\n capital = true\n ind = 0\n skip_next = false\n array.each do |word|\n if %w[? ! .].include? word\n text << word unless skip_next\n skip_next = false\n capital = true\n elsif [',', ' and'].include? word\n text << word unless skip_next\n skip_next = false\n capital = false\n elsif (word == 'NEWLINE') || (word == \"\\n\")\n if %w[? ! . ,].include?(array[ind + 1])\n text << array[ind + 1]\n skip_next = true\n end\n text << \"\\n\"\n else\n text << ' ' << if capital\n word.spelling.capitalize\n else\n word.spelling\n end\n capital = false\n end\n ind += 1\n end\n\n text\n end", "title": "" }, { "docid": "ab4cc793620690af8010233af986e31c", "score": "0.5426425", "text": "def sentence(array)\n case array.length\n when 0 ; ''\n when 1 ; array[0].to_s\n when 2 ; \"#{array[0]} and #{array[1]}\"\n else ; \"#{array[0...-1].join(', ')}, and #{array[-1]}\"\n end\n end", "title": "" }, { "docid": "4b8c2fcfdd870ab575593526f23f249f", "score": "0.5419785", "text": "def english_list(array:, conjunction:)\n return '' if array.empty?\n return array.first if array.length == 1\n\n \"#{array[0..-2].join(', ')} #{conjunction} #{array.last}\"\n end", "title": "" }, { "docid": "2c79827d80a8ff9c8589e5d07ba29e08", "score": "0.5414199", "text": "def to_s\n\t\t\"(#{@nombre},#{@proteinas},#{@hidratos},#{@lipidos},#{@gei},#{@terreno})\"\n\tend", "title": "" }, { "docid": "3e2289441043f5e03120afbdd649b784", "score": "0.5411179", "text": "def to_s; self.join $/; end", "title": "" }, { "docid": "55769f43c37d413d50c378d1143b03a7", "score": "0.5408126", "text": "def to_s\n lines.map(&:to_s).join\n end", "title": "" }, { "docid": "6ef7273c6c854878602308130b79e535", "score": "0.5407776", "text": "def to_rawtext\n res = []\n res << author\n res << message\n res << tags if !tags.try(:empty?)\n res << comments if !comments.try(:empty?)\n res.join(' ')\n end", "title": "" }, { "docid": "6eadcfc2b755855627b9812c95e17633", "score": "0.5400121", "text": "def translate(phrase) #splits up the phrase and passes each word into rearranage()\n #Joins back into a phrase for return after rearrange\n phrase.split(\" \").map { |word| rearrange(word) }.join(\" \") \nend", "title": "" }, { "docid": "7232cf57c48abff6d7cca7116190a569", "score": "0.53976667", "text": "def phrases(*names)\n # Because Score is a singleton, this can just write its notes to Score's output notes\n # This is bad because it goes in the opposite direction of the nesting logic for Notes, Phrases, etc.\n # So, lurking bugs. Also it breaks if we want to have more than on Score. Fine for \"now.\"\n \n names.each do |name| \n name = name.strip \n phrase = @phrases_by_name[name] \n phrase.notes.each do |note| \n @score_notes << note.dup \n end\n end\nend", "title": "" }, { "docid": "1e9bd0fbfc7a7708dead193b3386cdab", "score": "0.53932923", "text": "def description\n \"Your dinner is a #{protein} burrito in a #{base} with #{toppings.join\" & \"}.\"\n end", "title": "" } ]
55387877fa7e59cddf4dae32e6e23567
coloca en mayuscula la primera letra de nombre y apellido
[ { "docid": "72eb2d452ed875956501c2bfa760c561", "score": "0.0", "text": "def second_name=(n)\n write_attribute(:second_name, n.to_s.titleize)\n end", "title": "" } ]
[ { "docid": "a0521ad71f5f2183654d57e694ff68cf", "score": "0.6757766", "text": "def apellido\n self.usuario_sput.apellido\n end", "title": "" }, { "docid": "349e2ca0c2ad652d62c00867e838c155", "score": "0.6686209", "text": "def nombre_y_apellido \n primer_nombre + ' ' + primer_apellido\n end", "title": "" }, { "docid": "3509c35b17d17664d5724fac5619a1de", "score": "0.66223216", "text": "def full_name\n \tnombre + \" \" + apellidos\n end", "title": "" }, { "docid": "31080749541dbdb0a6180f2fc6d84aa3", "score": "0.6511823", "text": "def nombre_completo\n\tprimer_nombre+\" \"+primer_apellido\n#fin del metodo\nend", "title": "" }, { "docid": "4cdf067e4b7dfb8b66ade9510644d4ba", "score": "0.63153803", "text": "def get_autores_apellidos(autor)\n trozo = autor.split - [\" \"]\n nombre, apellido = trozo[0], trozo[1]\n apellido + \", \" + nombre[0]\n end", "title": "" }, { "docid": "79136d439a3404653a6d52c74b0bbb9f", "score": "0.61145955", "text": "def full_name\n \t\t\"#{nombre} #{apellido}\"\n\tend", "title": "" }, { "docid": "51dc0115648a0f3629569c6825b4888f", "score": "0.6078383", "text": "def nombre_completo\n\t\t\"#{nombre} #{apellido}\"\n\tend", "title": "" }, { "docid": "baff953a2c3e576a25cd808691b6015e", "score": "0.6024325", "text": "def full_name_apellido_paterno\n self.apellido_paterno.to_s + \" \" + self.apellido_materno.to_s + \" \" + self.nombre.to_s\n end", "title": "" }, { "docid": "12f89dc1bf3074ff099009ba8f0d1532", "score": "0.5942144", "text": "def full_name\n \"#{nombre} #{apellidos}\"\n end", "title": "" }, { "docid": "08226ba0758090945bce231d8004d0d7", "score": "0.59258676", "text": "def create_researcher_quotation\n nome_citacoes = Array.new\n initials = []\n cleaned_name = self.clean_name self.nome\n nome_list = cleaned_name.split ' '\n nome_list.each{|n| initials << n[0]}\n\n initials_first_index = 0\n initials_last_index = initials.length - 1\n nome_list_last_index = nome_list.length - 1\n\n # 1. MICHAEL DA COSTA MORA\n citacao = self.nome.upcase\n nome_citacoes << citacao.gsub(/\\s+/, '')\n\n # 2. MICHAEL C. M.\n citacao = nome_list.first + ' ' + initials.list_without_element(initials_first_index).join('. ') + '.'\n nome_citacoes << citacao.gsub(/\\s+/, '')\n\n # 3. MICHAEL C. MORA\n citacao = nome_list.first + ' ' + initials.list_without_list_of_elements([initials_first_index, initials_last_index]).join('. ') + '. ' + nome_list.last\n nome_citacoes << citacao.gsub(/\\s+/, '')\n\n # 4. M. C, MORA\n citacao = initials.list_without_element(initials_last_index).join('. ') + ', ' + nome_list.last\n nome_citacoes << citacao.gsub(/\\s+/, '')\n\n # 5. MORA, MICHAEL COSTA\n rest_of_name = nome_list.list_without_element(nome_list_last_index)\n last_name_formatted = nome_list.list_without_list_of_elements((0..(rest_of_name.length - 1))).join('') + ', '\n citacao = last_name_formatted + rest_of_name.join(' ')\n nome_citacoes << citacao.gsub(/\\s+/, '')\n\n # 6. MORA, MICHAEL DA COSTA\n full_name_list = I18n.transliterate(self.nome).upcase.split(' ')\n full_name_list_last_index = full_name_list.length - 1\n rest_of_name = full_name_list.list_without_element(full_name_list_last_index)\n citacao = last_name_formatted + rest_of_name.join(' ')\n nome_citacoes << citacao.gsub(/\\s+/, '')\n\n # 7. MORA, MICHAEL C.\n citacao = last_name_formatted + rest_of_name.list_without_element(rest_of_name.length - 1).join('') + initials.list_without_list_of_elements([initials_first_index, initials_last_index]).join('. ') + '.'\n nome_citacoes << citacao.gsub(/\\s+/, '')\n\n # 8. MORA, M. C.\n citacao = last_name_formatted + initials.list_without_element(initials_last_index).join('. ') + '.'\n nome_citacoes << citacao.gsub(/\\s+/, '')\n\n # 9. DA COSTA MORA, MICHAEL\n full_name_list = I18n.transliterate(self.nome).upcase.split(' ')\n rest_of_name = full_name_list.list_without_element(0)\n citacao = rest_of_name.join(' ') + ',' + full_name_list.first\n nome_citacoes << citacao.gsub(/\\s+/, '')\n\n return nome_citacoes\n end", "title": "" }, { "docid": "9926ab96137e6b424114f28b56f30c89", "score": "0.59088904", "text": "def appellant_fullname_readable\n appellant_name&.titleize\n end", "title": "" }, { "docid": "620989d7bdcb211f0b592671fa5a0066", "score": "0.5813101", "text": "def first_name_men; end", "title": "" }, { "docid": "83a513d6b6568e3953b0e6e7ce830c12", "score": "0.5811134", "text": "def pessoavaidois(lugar)\n \"indo para \" + lugar\nend", "title": "" }, { "docid": "96e18266f4f3afe7e0838b514124041f", "score": "0.5802268", "text": "def recolectar_una\n\t\test = \"\"\n\t\tif @estado == ESTADO::MUERTE\n\t\t\test = \"El árbol está muerto\"\n\t\telse\n\t\t\tif @contador == 0\n\t\t\t\test = \"No hay más naranjas\"\n\t\t\telse\n\t\t\t\test = \"La naranja estaba deliciosa\"\n\t\t\t\t@contador -= 1\n\t\t\tend\n\t\tend\n\t\test\n\tend", "title": "" }, { "docid": "3fea7d040c238ab2ac12a8e2ebcc4a8e", "score": "0.5789155", "text": "def e010_nome(pedido)\n return \"%-100s\" % remover_acentos(pedido.pessoa.nome.upcase)\n end", "title": "" }, { "docid": "5918b09bd9eec3aee5a3229984eebff5", "score": "0.57881576", "text": "def paterno_materno_nombre\n \"#{paterno} #{materno} #{nombre}\"\n end", "title": "" }, { "docid": "c3b34e7d064ab8907ada1a1f19e52808", "score": "0.574152", "text": "def nombre_completo\n [apellido, nombre].join(\" \")\n end", "title": "" }, { "docid": "412197d94024ed4ed2109a49fefae1b8", "score": "0.57347924", "text": "def alias_creator(full_name)\n full_name = full_name.downcase\n name = full_name.split(' ').to_a\n first_name = name[0]\n last_name = name[1]\n first_name_letters = first_name.split('')\n last_name_letters = last_name.split('')\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\", \"a\"]\n consonants = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\", \"y\", \"z\", \"b\"]\n \n first_name_letters.map! do |letter|\n if vowels.include?(letter)\n letter_index = vowels.index(letter)\n new_letter_index = letter_index + 1\n letter = vowels[new_letter_index]\n elsif consonants.include?(letter)\n letter_index = consonants.index(letter)\n new_letter_index = letter_index + 1\n letter = consonants[new_letter_index]\n end\n end\n new_first_name = first_name_letters.join('').capitalize\n \n last_name_letters.map! do |letter|\n if vowels.include?(letter)\n letter_index = vowels.index(letter)\n new_letter_index = letter_index + 1\n letter = vowels[new_letter_index]\n elsif consonants.include?(letter)\n letter_index = consonants.index(letter)\n new_letter_index = letter_index + 1\n letter = consonants[new_letter_index]\n end\n end\n new_last_name = last_name_letters.join('').capitalize\n\n new_name = new_last_name + \" \" + new_first_name\n return new_name\n \nend", "title": "" }, { "docid": "789b06aadfa2460eaf80fd64005c7fba", "score": "0.5729282", "text": "def full_name_with_grado\n self.grado + self.full_name\n end", "title": "" }, { "docid": "0ff5a40d19fe230f116b0e66bc00aacd", "score": "0.5708138", "text": "def prox() \n print \"Introduzca una jugada: \"\n entrada = gets\n entrada.downcase! # Lleva todo el input a minusculas \n entrada.capitalize! # Convierte a la primera letra en mayusculas\n entrada = entrada.slice(0,entrada.length - 1) # Quita el salto de linea\n @mano = Jugada.new(entrada) # Se crea una instancia de Jugada\n return @mano\n \n # Manejador si ocurre que el usuario ingresa una opcion no valida \n if not @mano.jugada_valida? \n @mano = $sin_jugada\n return \"Esta jugada no es válida, introduzca una opción que lo sea\"\n end \n end", "title": "" }, { "docid": "e84d31fc5aa32a64b1ca9a4f4b015eb9", "score": "0.5660232", "text": "def birthplace\n search_by_text('место рождения').split(', ').first\n end", "title": "" }, { "docid": "ff59cd22950e4f381ad299dd1810ef53", "score": "0.5616049", "text": "def nombre_paterno_materno\n \"#{nombre} #{paterno} #{materno}\"\n end", "title": "" }, { "docid": "9a59929cfab61d9979697fd36d966774", "score": "0.55987", "text": "def preencher\n nome.set 'leticia'\n \n end", "title": "" }, { "docid": "63e6ec7673aa88c4d0f8f765184ff6c9", "score": "0.5591986", "text": "def jeuTermine\n\t\tlancementAventure(@tailleGrille+1)\n\tend", "title": "" }, { "docid": "03677c447549dae8c23a2fb3f7681e3d", "score": "0.55755943", "text": "def discursarnolocal(pessoa, lugar)\n \"#{pessoa} discursou no #{lugar}\"\nend", "title": "" }, { "docid": "ebcd0ca3f5f54d38aa8acdfe71236f7d", "score": "0.55466723", "text": "def info_conta\n # CAMPO TAMANHO\n # agencia 4\n # complemento 1\n # conta corrente 8\n # digito da conta 1\n # complemento 6\n \"#{agencia} #{conta_corrente}#{digito_conta}#{''.rjust(6, ' ')}\"\n end", "title": "" }, { "docid": "77652ef57bca0a4b054963c0e586560d", "score": "0.5544565", "text": "def full_descripcion \n \"#{asunto.nombre} - \"+\"#{nombre}\" \n end", "title": "" }, { "docid": "4263e6f212ffe68f94f7a6f4613755d6", "score": "0.553573", "text": "def vocal_en_nombre_piloto(pilotos) \n pos = 0\n mayor = 0\n\n for i in 0..pilotos.size-1\n nombre = pilotos[i].downcase\n\n contador = 0\n for j in 0..nombre.size-1\n letra = nombre[j]\n if letra == 'a' || letra == 'e' || letra == 'i' || letra =='o' || letra =='u'\n contador = contador + 1\n end\n end\n\n if contador > mayor\n mayor = contador\n pos = i\n end\n end\n\n return pilotos[pos]\n\nend", "title": "" }, { "docid": "00ab32761d463b01ea416a335f97e5df", "score": "0.55294317", "text": "def info_conta\n # CAMPO TAMANHO\n # agencia 4\n # complemento 1\n # conta corrente 8\n # digito da conta 1\n # complemento 6\n \"#{agencia} #{conta_corrente}#{digito_conta}#{''.rjust(6, ' ')}\"\n end", "title": "" }, { "docid": "44cb4fefaa8a913e09e5ef0a3e7242c7", "score": "0.5518013", "text": "def appellant_last_name\n appellant_name.split[-1]\n end", "title": "" }, { "docid": "624eb131144da93ef8923c3283e21a0f", "score": "0.550085", "text": "def get_nombre; @nombre; end", "title": "" }, { "docid": "90fe7f61b3d37a003637070ad1330780", "score": "0.54984343", "text": "def get_nombre # la convencion de ruby es def nombre\n @nombre # el nombre es implicito\n end", "title": "" }, { "docid": "9e3bcd4177991fb152cc892787c22b01", "score": "0.5485303", "text": "def nombre\n m = []\n m << self.padre.nombre unless self.padre.blank?\n m << self.madre.nombre unless self.madre.blank?\n m = m.join('&')\n n = []\n n << self.padre.apepat unless self.padre.blank? \n n << self.madre.apepat unless self.madre.blank?\n n << \"(#{m})\"\n n.join(' ')\n end", "title": "" }, { "docid": "1cc0dbd05e701106d4a1c33e578e255d", "score": "0.5485116", "text": "def alias_creator(nickname)\nvowels=\"aeiou\"\nconsonants=\"bcdfghjklmnpqrstvwxyz\"\n#consonants exclude all vowels\n\nnickname_split=nickname.split(\"\")\nnew_nickname=[]\n#The translated nickname will be saved in the new_nickname arrawy\n\nnickname_split.map! do |x|\n\tif vowels.include?(x)\n\t\tnew_nickname << vowels[vowels.index(x)+1]\n\telsif consonants.include?(x)\n\t\tnew_nickname << consonants[consonants.index(x)+1]\n\telsif x == \" \"\n\t\tnew_nickname << \" \"\n\tend\nend\nnew_nickname.join(\"\").split.map {|x| x.capitalize}.join(\" \")\n#We are doing this so that we capitalize the first letter of both words\nend", "title": "" }, { "docid": "892c9835ebfe59c6885ad2050e80f7a9", "score": "0.54698414", "text": "def critique_nm1(nm1, acc)\n edit(:NM1) do\n # Organization/last name\n nm1.element(3).tap do |e|\n if e.node.blank? and e.node.usage.optional?\n acc.warn(e, \"optional element is not present\")\n end\n end\n\n # Non-person entity\n if nm1.element(2).select{|e| e.node == \"2\" }.defined?\n # First name\n nm1.element(4).tap do |e|\n if e.node.present? and e.node.usage.optional?\n acc.stc01(e, \"T\", \"A8\", \"505\", \"must not be present when NM102 is 2\")\n end\n end\n\n # Middle name\n nm1.element(5).tap do |e|\n if e.node.present? and e.node.usage.optional?\n acc.stc01(e, \"T\", \"A8\", \"514\", \"must not be present when NM102 is 2\")\n end\n end\n\n # Prefix name\n nm1.element(6).tap do |e|\n if e.node.present? and e.node.usage.optional?\n acc.stc01(e, \"T\", \"A8\", \"125\", \"must not be present when NM102 is 2\")\n end\n end\n\n # Suffix name\n nm1.element(7).tap do |e|\n if e.node.present? and e.node.usage.optional?\n acc.stc01(e, \"T\", \"A8\", \"125\", \"must not be present when NM102 is 2\")\n end\n end\n end\n\n # Person\n if nm1.element(2).select{|e| e.node == \"1\" }.defined?\n # First name\n nm1.element(4).tap do |e|\n if e.node.blank? and e.node.usage.optional?\n acc.warn(e, \"optional element is not present\")\n end\n end\n\n # Middle name\n nm1.element(5).tap do |e|\n if e.node.blank? and e.node.usage.optional?\n acc.warn(e, \"optional element is not present\")\n end\n end\n\n # Prefix name\n nm1.element(6).tap do |e|\n if e.node.blank? and e.node.usage.optional?\n acc.warn(e, \"optional element is not present\")\n end\n end\n\n # Suffix name\n nm1.element(7).tap do |e|\n if e.node.blank? and e.node.usage.optional?\n acc.warn(e, \"optional element is not present\")\n end\n end\n end\n end\n end", "title": "" }, { "docid": "ebe5882021de352530ac8576eeefc26c", "score": "0.5464046", "text": "def first_name_women; end", "title": "" }, { "docid": "5dd4e1543eb7ce0193d875643a7b9418", "score": "0.54579145", "text": "def nome_proprio\n palavras = []\n self.titleize().each do |palavra|\n palavra =~ /^(.)(.*)$/\n palavras << \"#{$1.upcase_br}#{$2}\"\n end\n palavras.join(' ').gsub(/ D(a|e|o|as|os) /, ' d\\1 ').gsub(/ E /, ' e ')\n end", "title": "" }, { "docid": "b220d1c2f2f20f3699fb7a6f8b5e9d50", "score": "0.5446337", "text": "def slogan\n # 'A maneira mais fácil de pré-qualificar ao Atlas.'\n ''\n end", "title": "" }, { "docid": "25ec52f41929d443c8c65189f8878555", "score": "0.54298306", "text": "def get_nombre # definicion del metodo get para el nombre no esperamos ningun argumento \n @nombre # hacemos un return de la variable, la variable como atributo hasta que nosotros usamos @nombre por primera vez\n end", "title": "" }, { "docid": "e7f93da5fb102af7c57c23f1b246c7ac", "score": "0.54260457", "text": "def info_conta\n # CAMPO TAMANHO\n # agencia 4\n # complemento 2\n # conta corrente 5\n # digito da conta 1\n # complemento 8\n \"#{agencia}#{codigo_beneficiario}#{''.rjust(uso_exclusivo_header, ' ')}\"\n end", "title": "" }, { "docid": "f41a0ff8eabfe4fcd4ef8b3b039ee837", "score": "0.54214364", "text": "def asignar_titulo_propiedad()\n \n end", "title": "" }, { "docid": "cb44d590c8be6c4f0243debe0c6a48ce", "score": "0.542023", "text": "def mary_desc\n name_descriptions(:peltigera_user_desc)\n end", "title": "" }, { "docid": "6167262f821d5d9fff0b5620e285e094", "score": "0.54186183", "text": "def nombre\r\n return @nombre\r\n \r\n end", "title": "" }, { "docid": "b645b89f8123894a80fd39526efd4694", "score": "0.5412671", "text": "def da_first_name_m\n %w(Lucas Magnus Mathias Frederik Oliver Emil Mikkel Victor Tobias Sebastian Mads Nikolaj Rasmus Marcus Christian Noah Jonas Jakob Kasper Oscar Andreas Alexander William Simon Gustav Nicklas Malthe Daniel Benjamin Philip Christoffer Anton Jeppe Anders Lasse Carl Silas Jonathan Marius Elias August Patrick Valdemar Thomas Laurits Bertram Martin David Hjalte Albert ).rand\n end", "title": "" }, { "docid": "ef3e1adf81c1c801b1b160405a7bbc78", "score": "0.53930074", "text": "def nome=(nome)\r\n # @palavra = atributo do objeto\r\n @nome = nome\r\n end", "title": "" }, { "docid": "8175c82fe252aeff5aadf7c3a7834410", "score": "0.5383894", "text": "def three_word_name; end", "title": "" }, { "docid": "154a274c368995f3c0aa53d9006468e2", "score": "0.53614944", "text": "def da_last_name\n %w(Ahmed Ali Andersen Andersson Andreasen Andreassen Andresen Asmussen Bach Bak Bang Bech Beck Bendtsen Berg Bertelsen Berthelsen Bjerre Bjerregård Bjerregaard Bonde Brandt Brodersen Bruun Buch Bundgaard Bundgård Carlsen Carstensen Christensen Christiansen Christoffersen Clausen Dahl Dalgaard Dalgård Dalsgård Dalsgaard Dam Damgaard Damgård Danielsen Davidsen Enevoldsen Eriksen Eskildsen Fischer Frandsen Frederiksen Friis Frost Gade Gregersen Hald Hansen Hedegård Hedegaard Hemmingsen Henningsen Henriksen Hermansen Hjorth Hoffmann Holm Holst Hougård Hougaard Ibsen Iversen Jacobsen Jakobsen Jensen Jeppesen Jepsen Jespersen Jessen Johannesen Johannsen Johansen Johansson Johnsen Juhl Justesen Juul Jønsson Jørgensen Karlsen Kirkegaard Kirkegård Kjeldsen Kjær Kjærgaard Kjærgård Klausen Knudsen Koch Kofoed Kragh Kristensen Kristiansen Kristoffersen Krog Krogh Kruse Lange Larsen Lassen Lauridsen Lauritsen Lauritzen Laursen Laustsen Leth Lind Lorentzen Lorenzen Lund Madsen Markussen Mathiasen Mathiesen Meyer Michelsen Mikkelsen Mogensen Mortensen Munk Müller Mølgård Mølgaard Møller Nguyen Nielsen Nikolajsen Nilsson Nissen Nygaard Nygård Nørgård Nørgaard Olesen Olsen Olsson Overgaard Overgård Paulsen Pedersen Persson Petersen Poulsen Rasmussen Ravn Riis Schmidt Schou Schrøder Schultz Simonsen Skov Sommer Steffensen Svendsen Svensson Søgård Søgaard Søndergård Søndergaard Sørensen Thomassen Thomsen Thorsen Thygesen Thøgersen Toft Vestergaard Vestergård Villadsen Vinther Winther Østergaard Østergård Ågård Ågaard Aagård Aagaard).rand\n end", "title": "" }, { "docid": "6021b0e0cc9d7edcf9bf03925a5acfd7", "score": "0.5359007", "text": "def por_nombre\n return unless (params[:nombre].present? && params[:especie_id].blank?)\n self.taxones = taxones.caso_nombre_comun_y_cientifico(params[:nombre].strip).left_joins(:nombres_comunes)\n end", "title": "" }, { "docid": "ce0fb5bc53e1a29d3a7e4805ee1e8576", "score": "0.535879", "text": "def nombre_comun_a_id_referencia(num_nombre)\n # El 9 inicial es apra identificarlo, despues se forza el ID a 6 digitos y el numero de nombre comun a 2 digitos\n \"1#{id.to_s.rjust(6,'0')}#{num_nombre.to_s.rjust(3,'0')}\".to_i\n end", "title": "" }, { "docid": "471c74716450f1a8f48a47ad7f317432", "score": "0.5357921", "text": "def alias_name\n first_name = \"lia\".chars\nlast_name = \"hogan\".chars\np first_name.class\nfirst_name[3] = last_name[0]\nfirst_name[4] = last_name[1]\nfirst_name[5] = last_name[2]\nfirst_name[6] = last_name[3]\nfirst_name[7] = last_name[4]\np first_name\n\nlast_name[5] = first_name[0]\nlast_name[6] = first_name[1]\nlast_name[7] = first_name[2]\np last_name\nfirst_name.delete_at(0)\nfirst_name.delete_at(0)\nfirst_name.delete_at(0)\np first_name\nlast_name.delete_at(0)\nlast_name.delete_at(0)\nlast_name.delete_at(0)\nlast_name.delete_at(0)\nlast_name.delete_at(0)\np last_name\n \n full_name = first_name + last_name\n index = 0 \n str_back = \"\"\n while index < full_name.length\n str_back[index]\n if full_name[index] == \"a\"\n str_back[index] = \"e\"\n elsif full_name[index] == \"b\" \n str_back[index] = \"c\"\n elsif full_name[index] == \"c\" \n str_back[index] = \"d\" \n elsif full_name[index] == \"d\" \n str_back[index] = \"f\"\n elsif full_name[index] == \"e\" \n str_back[index] = \"i\"\n elsif full_name[index] == \"f\" \n str_back[index] = \"g\"\n elsif full_name[index] == \"g\" \n str_back[index] = \"h\"\n elsif full_name[index] == \"h\" \n str_back[index] = \"j\"\n elsif full_name[index] == \"i\" \n str_back[index] = \"o\"\n elsif full_name[index] == \"j\" \n str_back[index] = \"k\"\n elsif full_name[index] == \"k\" \n str_back[index] = \"l\"\n elsif full_name[index] == \"l\" \n str_back[index] = \"m\"\n elsif full_name[index] == \"m\" \n str_back[index] = \"n\"\n elsif full_name[index] == \"n\" \n str_back[index] = \"p\"\n elsif full_name[index] == \"o\" \n str_back[index] = \"u\"\n elsif full_name[index] == \"p\" \n str_back[index] = \"q\"\n elsif full_name[index] == \"q\" \n str_back[index] = \"r\"\n elsif full_name[index] == \"r\" \n str_back[index] = \"s\"\n elsif full_name[index] == \"s\" \n str_back[index] = \"t\"\n elsif full_name[index] == \"t\" \n str_back[index] = \"v\"\n elsif full_name[index] == \"u\" \n str_back[index] = \"y\"\n elsif full_name[index] == \"v\" \n str_back[index] = \"w\"\n elsif full_name[index] == \"w\" \n str_back[index] = \"x\"\n elsif full_name[index] == \"x\" \n str_back[index] = \"z\"\n elsif full_name[index] == \"y\" \n str_back[index] = \"a\"\n elsif full_name[index] == \"z\" \n str_back[index] = \"b\"\n else \n str_back[index] = \" \"\n end\n index += 1 \n end\n str_back\nend", "title": "" }, { "docid": "ada0cd7b05ad73bfcce8ce3b4d15e937", "score": "0.53570473", "text": "def modificare_carte\n\t\tputs \">>>MODIFICARE CARTE<<<\"\n\t\tputs \"Introduceti noul titlu: \"\n\t\t@titlu = gets\n\t\tputs \"Modificati numele autorului: \"\n\t\t@autor = gets\n\t\tputs \"Modificarea s-a executat cu succes!\"\n\tend", "title": "" }, { "docid": "3d4e1747cd7631a1f53b167ab41707bb", "score": "0.5355554", "text": "def long_name\n [number, title].join(' ')\n end", "title": "" }, { "docid": "3d4e1747cd7631a1f53b167ab41707bb", "score": "0.5355554", "text": "def long_name\n [number, title].join(' ')\n end", "title": "" }, { "docid": "3484f3762eb6d845366fcb9401cc98f1", "score": "0.53522086", "text": "def info_conta\n # CAMPO TAMANHO\n # agencia 3\n # conta corrente 7\n \"#{agencia}#{conta_corrente}\"\n end", "title": "" }, { "docid": "e4dd9152808cd94c9493845d19cded49", "score": "0.5348295", "text": "def unit_lead_by_academician\n main_tasks=Login.current_login.staff.position.tasks_main\n if main_tasks.include?(\"Ketua Unit\") \n mgmt_unit=main_tasks.scan(/Ketua Unit(.*),/)[0][0].strip\n else\n mgmt_unit=\"\"\n end\n mgmt_unit\n end", "title": "" }, { "docid": "5496ff77d9938724a147dedac056a68d", "score": "0.53458685", "text": "def indice_masa_corporal\n\t\t(peso / (talla * talla) * 10000).round(1)\n\tend", "title": "" }, { "docid": "b491a0bef846df7bbcbafebc730c0a04", "score": "0.53351384", "text": "def imprimir_nome\n @nome\n end", "title": "" }, { "docid": "5e41e536a6dff4fcba8542eb224fd971", "score": "0.53329235", "text": "def alias_manager(name)\n name = name.downcase\n name = name.split(\" \").reverse.join(\" \")\n name = name.split(\"\")\n index = 0\n consonant = \"bcdfghjklmnpqrstvwqyz\"\n vowel = \"aeiou\"\n while index < name.length\n if\n !consonant.index(name[index]) && !vowel.index(name[index])\n elsif\n index_of_letter = vowel.index(name[index])\n new_letter = vowel[index_of_letter + 1]\n name[index] = new_letter\n else\n index_of_letter = consonant.index(name[index])\n new_letter = consonant[index_of_letter + 1]\n name[index]= new_letter\n end\n index += 1\n end\n name.join(\"\")\nend", "title": "" }, { "docid": "096d4dad89739aaaf94c10e13a0a638b", "score": "0.5314241", "text": "def info_conta\n # CAMPO TAMANHO\n # agencia 4\n # zeros 2\n # conta corrente 7\n # digito da conta 1\n # complemento 6\n \"#{agencia}00#{conta_corrente}#{digito_conta}#{''.rjust(6, ' ')}\"\n end", "title": "" }, { "docid": "3f3106ad3feaa0bbbbb1b9d0bf936ec7", "score": "0.5311358", "text": "def e010_logradouro(pedido)\n return \"%-100s\" % \"CAMARGO PIMENTEL\"\n end", "title": "" }, { "docid": "67c86eec347d720e5db3aa2e83a948a0", "score": "0.5308222", "text": "def info_conta\n # CAMPO TAMANHO\n # agencia 4\n # digito agencia 1\n # conta corrente 8\n # digito da conta 1\n # numero convenio 6\n cc = conta_corrente.to_s.rjust(8, '0')\n \"#{agencia}#{agencia_dv}#{cc}#{conta_corrente_dv}#{''.rjust(6, '0')}\"\n end", "title": "" }, { "docid": "28356444e4f8db3351bf682ed2daed84", "score": "0.5296095", "text": "def create_multi_name\n base_name = String.new(Faker::Games::ElderScrolls.creature)\n if base_name.split.size == 1\n adjective = Spicy::Proton.adjective.capitalize\n new_name = base_name.split.unshift(adjective)\n new_name.join(' ')\n else\n return base_name\n end\n end", "title": "" }, { "docid": "f51c0a9860aa36efe08522fd643130c8", "score": "0.5290583", "text": "def devolver_nombre \n return @nombre\n end", "title": "" }, { "docid": "0600784fb041e6041e5ea19658ac74ee", "score": "0.5282529", "text": "def acces_nome\r\n @nome\r\n end", "title": "" }, { "docid": "297da10f18e936987faad4db62b65c9d", "score": "0.5281908", "text": "def make_dick_editor_of_addtional_name\n name = names(:boletus_edulis)\n name.user = users(:rolf)\n name.save\n end", "title": "" }, { "docid": "2f1a131e6b898d5cb05635d20d8fced2", "score": "0.52773315", "text": "def english_name\n self[3]\n end", "title": "" }, { "docid": "2f1a131e6b898d5cb05635d20d8fced2", "score": "0.52773315", "text": "def english_name\n self[3]\n end", "title": "" }, { "docid": "8e2de9c89aaeb8be85b21adf49cf9978", "score": "0.5275855", "text": "def sigla; @nome; end", "title": "" }, { "docid": "33fbfbda9f5bb1a73c0d6769a3a73ba4", "score": "0.5275386", "text": "def info_conta\n # CAMPO TAMANHO\n # agencia 4\n # complemento 2\n # conta corrente 5\n # digito da conta 1\n # complemento 8\n \"#{agencia}00#{conta_corrente}#{digito_conta}#{''.rjust(8, ' ')}\"\n end", "title": "" }, { "docid": "33fbfbda9f5bb1a73c0d6769a3a73ba4", "score": "0.5275386", "text": "def info_conta\n # CAMPO TAMANHO\n # agencia 4\n # complemento 2\n # conta corrente 5\n # digito da conta 1\n # complemento 8\n \"#{agencia}00#{conta_corrente}#{digito_conta}#{''.rjust(8, ' ')}\"\n end", "title": "" }, { "docid": "a7ef25d77d18b914132dc6531f20ca27", "score": "0.5263316", "text": "def informal_name\n given = given_name.presence || \"\"\n chinese, english = given.split(/,\\s*/)\n given = english.presence || chinese # nb. if no comma then chinese will hold the whole name and we'll show that.\n [given, family_name].join(' ')\n end", "title": "" }, { "docid": "e598d784fa5e7851b216f3924525bb18", "score": "0.5261972", "text": "def name\n nome\n end", "title": "" }, { "docid": "657234813d2293dd09f5f0ff029979f8", "score": "0.5261504", "text": "def nome_perfil\n \tself.descricao\n end", "title": "" }, { "docid": "62adf351892925d6bec219c32830f62d", "score": "0.5241442", "text": "def juega_primero mano\n\t\tcartas_palo_menor = obtiene_cartas_palo_menor mano\n\t\tif es_palo_corto cartas_palo_menor\n\t\t\tthen \n\t\t\tcarta_a_jugar = obtiene_carta_menor cartas_palo_menor\n\t\t\tUtil.muestra_msg \"Palo Corto=>\" + carta_a_jugar.carta.split(\"+\")[1] + \"\\n\", @verbose\n\t\telse\n\t\t\tcarta_a_jugar = obtiene_carta_menor mano\n\t\tend\n\t\treturn carta_a_jugar\n\tend", "title": "" }, { "docid": "fc9ba49539c3e6aa9919bd9344ef40a7", "score": "0.523763", "text": "def my_name\n return \"Bagus Wachyu Nuralam\" # Pengembalian secara eksplisit pada return\nend", "title": "" }, { "docid": "78531eb58326ba56e212d868475f2c29", "score": "0.5237579", "text": "def art_directors_hash\n search_by_text_hash 'художник'\n end", "title": "" }, { "docid": "27b71d241af106e993a1f3d9999c89d1", "score": "0.52342", "text": "def reemplazar_letra(letra, ind)\n # Necesario duplicar el objeto sino se modifica la variable original\n tmp = busqueda.dup\n\n case letra\n when 'e'\n tmp[ind,1] = 'i'\n when 'i'\n tmp[ind,1] = 'e'\n when 'o'\n tmp[ind,1] = 'u'\n when 'u'\n tmp[ind,1] = 'o'\n end\n\n tmp\n end", "title": "" }, { "docid": "01afe4dd451743d5906f5d0bf77d4b23", "score": "0.52338195", "text": "def full_name\n return Contact.generate_full_name self.first_name, self.middel_name, self.last_name\n end", "title": "" }, { "docid": "4d4e4b90a681a4d88749539ca4b43e44", "score": "0.52307224", "text": "def nombre\n\t\t@nombre\n\tend", "title": "" }, { "docid": "37a21c493d8415042e01f94c1c261884", "score": "0.5220985", "text": "def get_nombre()\n @nombre\n end", "title": "" }, { "docid": "7f0058a10365ab2d70699b3781ed831b", "score": "0.5215391", "text": "def namekomplett\n\t\t\t\t vorname.capitalize + \" \" + nachname.capitalize # methode vor und nachname mit leerzeichen\n\t\t\t\tend", "title": "" }, { "docid": "569c8165709d5a3a0d6120edebfcb73f", "score": "0.5211657", "text": "def nome\n @nome\n end", "title": "" }, { "docid": "38fac9b8d1fad7e62e6069d8be8bc59d", "score": "0.5210746", "text": "def ausgabe\n\t\t@name\n\tend", "title": "" }, { "docid": "2a7b63f2a75680855a7bfb5378d2fe41", "score": "0.5208512", "text": "def name\n name_str = \"#{first_name} #{last_name}\".strip\n if name_str.length < 1\n name_str = email\n end\n if name_str.length < 1\n name_str = \"Person utan namn (id #{id})\"\n end\n name_str\n end", "title": "" }, { "docid": "ac28a6f561f9118deacc0461448710f5", "score": "0.52084506", "text": "def e010_telefone(pedido)\n return \"%-16s\" % \"(19)3241-5135\"\n end", "title": "" }, { "docid": "9fcce8b5f2c0601999643424a530ab30", "score": "0.52067447", "text": "def nip_dan_nama\n \"#{nip} - #{nama_pegawai}\"\n end", "title": "" }, { "docid": "37b70c0bea84498e77331e0014e51fbc", "score": "0.5205937", "text": "def ausgabe\n\t\t@name\n\t\n\tend", "title": "" }, { "docid": "840f1ec8b4f0c6238aeaa7dd9a7a053b", "score": "0.520535", "text": "def vowels_consonant_movement2(name)\n name = name.downcase.split(\" \")\nfirst_name = name[0]\nsecond_name = name[1]\n consonants = \"bcdfghjklmnpqrstvwxyz\"\n vowels = \"aeiou\"\n translated_name = []\n translated_name2 = []\n\n#adjust first name \n x = 0 \n while x < first_name.length\n if first_name[x] == \"z\"\n first_name[x] = \"b\"\n translated_name << first_name[x]\n elsif\n first_name[x] == \"u\"\n first_name[x] = \"a\"\n translated_name << first_name[x]\n \n elsif consonants.include?first_name[x]\n \n new_position = consonants.index(first_name[x]) + 1 \n \n first_name[x] = consonants[new_position]\n translated_name << first_name[x]\n \n elsif vowels.include?first_name[x]\n newer_position = vowels.index(first_name[x]) + 1\n first_name[x] = vowels[newer_position]\n translated_name << first_name[x]\n \n end\n \n x += 1\n end\n \n#adjust second name \n x = 0 \n while x < second_name.length\n if second_name[x] == \"z\"\n second_name[x] = \"b\"\n translated_name2 << second_name[x]\n elsif\n second_name[x] == \"u\"\n second_name[x] = \"a\"\n translated_name2 << second_name[x]\n \n elsif consonants.include?second_name[x]\n \n new_position = consonants.index(second_name[x]) + 1 \n \n second_name[x] = consonants[new_position]\n translated_name2 << second_name[x]\n \n elsif vowels.include?second_name[x]\n newer_position = vowels.index(second_name[x]) + 1\n second_name[x] = vowels[newer_position]\n translated_name2 << second_name[x]\n \n end\n \n x += 1\n end\n \n first_letter = translated_name[0].upcase\n translated_name.delete_at(0)\n translated_name.insert(0, first_letter)\n \n first_letter2 = translated_name2[0].upcase\n translated_name2.delete_at(0)\n translated_name2.insert(0, first_letter2)\n \n return translated_name2.join(\"\") + \" \" + translated_name.join(\"\")\n \n \nend", "title": "" }, { "docid": "011b85cf723149eec9a8a2b6b7a05f6d", "score": "0.51963246", "text": "def french_name\n self[4]\n end", "title": "" }, { "docid": "011b85cf723149eec9a8a2b6b7a05f6d", "score": "0.51963246", "text": "def french_name\n self[4]\n end", "title": "" }, { "docid": "17dbc6cbc9385af8436084746e4a8e9d", "score": "0.51913625", "text": "def keyword\n\t\t\tlegal = legal_record_type_id == 0 ? legal_record_type.name : custom_legal_record_type\n\t\t\talley = is_alley == 1 ? 'Hẻm' : 'Mặt tiền'\n\n\t\t\tkeyword = \n\t\t\t\t\"#{name}, #{purpose.name} #{real_estate_type.name} quận #{district.name}, #{real_estate_type.name} #{legal}, #{real_estate_type.name} #{alley}, #{alley} quận #{district.name}, #{street.name} quận #{district.name}, #{purpose.name}, #{province.name}, #{real_estate_type.name}, #{legal}\"\n\t\tend", "title": "" }, { "docid": "80d8ce67f567a733646bccdaad4a8af0", "score": "0.5187967", "text": "def badish\n# Post process each bad entry to match against the profesor names in a regular expression fashion\nbad.each do |item|\n # unpack\n id = materias[item][0]\n rfc = materias[item][3]\n p_name = materias[item][4]\n #puts materias[item].inspect if (DEBUG)\n\n #name = []\n profesores.each do |profesor|\n # normalize string and split into words\n name = profesor[1].chomp.upcase.gsub(/\\s+/,' ').gsub(/(M\\.[ICAG]|L\\.A|I\\.Q|ING|FIS|MTRO|MRTO|DRA?)\\.?$/,\"\").split(\" \")\n # match the known name against a regular expression\n if (name.length >= 5)\n regex = Regexp.new(\"^\"+name[0]+\" \"+name[1]+\" \"+name[2]+\" \"+name[3]+\" \"+name[4])\n puts [p_name , name , regex].inspect if (p_name =~ regex)\n end\n if (name.length >= 4)\n regex = Regexp.new(\"^\"+name[0]+\" \"+name[1]+\" \"+name[2]+\" \"+name[3])\n puts [p_name , name , regex].inspect if (p_name =~ regex)\n end\n if (name.length >= 3)\n regex = Regexp.new(\"^\"+name[0]+\" \"+name[1]+\" \"+name[2])\n puts [p_name , name , regex].inspect if (p_name =~ regex)\n end\n if (name.length >= 2)\n regex = Regexp.new(\"^\"+name[0]+\" \"+name[1])\n puts [p_name , name , regex].inspect if (p_name =~ regex)\n end\n end\nend\nend", "title": "" }, { "docid": "7e88fe0664055b61ec21152b30ead15c", "score": "0.51816314", "text": "def full_name\n f_name + \" \" + l_name \n end", "title": "" }, { "docid": "5cb15a5a56ed3e6167d3bf533726838c", "score": "0.518161", "text": "def llenar_productos\n self.productos = self.clase.descripcion unless self.clase.nil?\n end", "title": "" }, { "docid": "c4db4b13557c76a2aa02e4e001826c23", "score": "0.5168187", "text": "def guarda_nombres_comunes_todos\n dame_nombres_comunes_todos\n\n if x_nombre_comun_principal.present?\n a = adicional ? adicional : Adicional.new(especie_id: id)\n a.nombres_comunes = x_nombres_comunes.encode('UTF-8', {invalid: :replace, undef: :replace, replace: ''})\n a.nombre_comun_principal = x_nombre_comun_principal.force_encoding(\"UTF-8\")\n\n if a.changed?\n a.save\n reload\n end\n end\n end", "title": "" }, { "docid": "6e7779f1293b966ece25de1f4479e1b4", "score": "0.5165749", "text": "def proper_name\n\t\tfirst_name + \" \" + last_name\n\tend", "title": "" }, { "docid": "34a519f0af563132d35f06ea9d92e35e", "score": "0.5162936", "text": "def spy_alias1 full_name\n alias_name = full_name.downcase.split(' ').reverse!.join(' ').split(//)\n vowels=['a','e','i','o','u']\n alias_name.map! do |letter|\n next_vowel=letter\n vowels.each_index do |index|\n if vowels[index]=='u'&&letter==vowels[index]\n next_vowel='a'\n elsif letter==vowels[index]\n next_vowel=vowels[index+1]\n end\n end\n next_vowel\n end\n \n consonants=['b','c','d','f','g','h','j','k','l','m','n','p','q','r','s','t','v','w','x','y','z']\n alias_name.map! do |letter|\n next_consonant=letter\n consonants.each_index do |index|\n if consonants[index]=='z'&&letter==consonants[index]\n next_consonant='b'\n elsif letter==consonants[index]\n next_consonant=consonants[index+1]\n end\n end\n next_consonant\n end\n \n alias_name=alias_name.join('').split(' ').map! {|name| name.capitalize}.join(' ')\nend", "title": "" }, { "docid": "b7f33a452038b4df68ce478d500cfbb0", "score": "0.5161851", "text": "def retorna_nome_produto\n titulo_produto.greenify\n titulo_produto.text\n end", "title": "" }, { "docid": "3d4aa85408662e3fda81a4d66b5d453b", "score": "0.51596045", "text": "def buscar_o_crear_titular(params)\n rep = Representante.where([\"LOWER(nombre) = ?\", params['NOMBRE DEL TITULAR'].downcase]).first\n pais = Pais.find_by_codigo(params['PAIS DEL TITULAR'])\n if rep\n if pais\n rep.pais_id = pais.id\n rep.pais_codigo = pais.codigo\n rep.pais_nombre = pais.nombre\n end\n rep.direccion = params['DIRECCION DEL TITULAR']\n rep.save(:validate => false)\n elsif !params['NOMBRE DEL TITULAR'].blank?\n rep = Representante.new(\n :nombre => params['NOMBRE DEL TITULAR'],\n :direccion => params['DIRECCION DEL TITULAR'],\n :cliente => false,\n :pais_id => pais.try(:id)\n )\n rep.save\n end\n rep.id\n end", "title": "" }, { "docid": "cb3ba9097e1f75ccfe46dd2cdabff082", "score": "0.51569366", "text": "def complete_name\n \tself.name.to_s + \" \" + self.surname.to_s \n end", "title": "" }, { "docid": "c01ca981850d50a80c595d812a45670d", "score": "0.51549876", "text": "def hide_name\n str = \" utente Fiscosport n° \" + self.id.to_s\n if self.comune_id && self.comune\n str += \" - prov. di \" + self.comune.province.name + \" (\" + self.comune.province.sigla + \")\" unless self.comune.province.nil?\n end\n return (str.nil? || str.blank?) ? \"-\" : str\n end", "title": "" } ]
039332f9d956b6622442c16a487fcded
this action is triggered on selecting cluster(s) to get the cluster's livians & their skills
[ { "docid": "72c09cafb5c984c5bdc740a3ab4d3a0e", "score": "0.6287507", "text": "def get_livians_and_skills\n cluster_ids = params[:clusters]\n clusters_livian_users = []\n livians_skills = []\n cluster_ids.each do |cluster_id|\n cluster = Cluster.find cluster_id\n clusters_livian_users += cluster.livians\n end\n @lawfirm_users_livians = clusters_livian_users.uniq\n @lawfirm_users_livians.each do |livian|\n livians_skills += livian.work_subtypes\n end\n @livians_skills = livians_skills.uniq\n @unassigned_skills = WorkSubtype.all - @livians_skills\n render :update do |page|\n page << \"loader.remove();\"\n unless clusters_livian_users.blank?\n page.replace_html 'livians_of_lawyers_clusters',:partial => \"livians_of_lawyers_clusters\"\n page.replace_html 'livians_skills',:partial => \"livians_skills\"\n else\n page.replace_html 'livians_of_lawyers_clusters',:text => \"No Livians are assigned to the selected cluster(s)\"\n page.replace_html 'livians_skills',:text => \"\"\n end\n end\n end", "title": "" } ]
[ { "docid": "d1eea7e8034ea1bacd7f885c72208954", "score": "0.6528774", "text": "def cluster_list\n super\n end", "title": "" }, { "docid": "83257b1016f8e7ea1b8c05c099cda4ec", "score": "0.63763195", "text": "def select(cluster, tags = nil)\n\n end", "title": "" }, { "docid": "49b93ceccabdf8395dd99304e44e50c7", "score": "0.61980903", "text": "def index\n @clusters = current_account.clusters\n end", "title": "" }, { "docid": "8c21976a72ce9b8aaf6f423e25ad3a84", "score": "0.59932977", "text": "def index\n @clusters = current_user.clusters.all if current_user.clusters.any?\n @infrastructures = current_user.infrastructures.all if current_user.infrastructures.any?\n end", "title": "" }, { "docid": "7c53e6324c79153a1fe6a92604ffb3d0", "score": "0.5923595", "text": "def listCluster()\n @crosssiteadmin.listClusters()\n end", "title": "" }, { "docid": "06a6b7efc16488d047d2d86103729e2b", "score": "0.59174293", "text": "def cluster name\n Cluster.receive connection.resource(:get, \"clusters/#{name}\")\n end", "title": "" }, { "docid": "ce99fd137f1553abbe31b07b8246c7b1", "score": "0.58906126", "text": "def get_clusters_livians_and_skills_for_selected_lawyer\n lawfirm_user = User.find(params[:lawfirm_user_id])\n @lawfirm_users_clusters = []\n @lawfirm_users_livians = []\n @livians_skills = []\n for cluster in lawfirm_user.clusters\n @lawfirm_users_clusters << cluster\n @lawfirm_users_livians += cluster.livians\n end\n @lawfirm_users_livians.uniq!\n @lawfirm_users_livians = sort_by_first_name_and_last_name(@lawfirm_users_livians) unless @lawfirm_users_livians.blank?\n for livian in @lawfirm_users_livians\n @livians_skills += livian.work_subtypes\n end\n @livians_skills.uniq!\n @unassigned_skills = WorkSubtype.all - @livians_skills\n render :update do |page|\n unless @lawfirm_users_clusters.blank? || @lawfirm_users_livians.blank?\n page.replace_html 'clusters_of_selected_lawyer',:partial => \"clusters_of_selected_lawyer\"\n page.replace_html 'livians_of_lawyers_clusters',:partial => \"livians_of_lawyers_clusters\"\n page.replace_html 'livians_skills',:partial => \"livians_skills\"\n else\n page.replace_html 'clusters_of_selected_lawyer',:text=>\"No Clusters / Livians are assigned to #{lawfirm_user.full_name}\"\n page.replace_html 'livians_of_lawyers_clusters',:text=>\"\"\n page.replace_html 'livians_skills',:text=>\"\"\n end\n end\n end", "title": "" }, { "docid": "0a2eeda2127ac298a3d5f8107be91635", "score": "0.584783", "text": "def cluster(cluster)\n features = {\n 'vsan' => true,\n 'enableDrs' => true,\n 'enableHA' => true,\n }\n\n return cluster.merge(features)\nend", "title": "" }, { "docid": "a9a725ab245eb3b1371ba9b7fe0ac422", "score": "0.58229387", "text": "def set_cluster\n @cluster = Cluster.find(params[:id])\n end", "title": "" }, { "docid": "ad960654a27ca2ba3f8899697117f651", "score": "0.5792237", "text": "def get_cluster instance_id, cluster_id\n instances.get_cluster name: cluster_path(instance_id, cluster_id)\n end", "title": "" }, { "docid": "c60fb2cd584f937395be22e9ee36d5a1", "score": "0.57869816", "text": "def cluster( name )\n\n return ::Module::Cluster.instance_controller( self ).cluster( name )\n \n end", "title": "" }, { "docid": "f0015d09e608f6a9764a52f2437d2f0b", "score": "0.5775099", "text": "def cluster() node[:cluster_name] ; end", "title": "" }, { "docid": "dd1d20f2bb5881d43183e6740a570d83", "score": "0.57743746", "text": "def set_project_cluster\n @cluster = @project.clusters.find_by!(id: params[:id]) if @project\n end", "title": "" }, { "docid": "a2061ca4ddf484b8af7fe704c5b4312b", "score": "0.57584316", "text": "def index\n @galactic_clusters = GalacticCluster.all\n end", "title": "" }, { "docid": "68880ad0b907066b265c31312afdfd7a", "score": "0.57540137", "text": "def index\n @clusters = []\n @project = Project.where(:key => params[:project_key]).first\n\n get_cluster_data() \n render :partial => 'index'\n end", "title": "" }, { "docid": "15f9ee341e55286910cb31b3e22415e7", "score": "0.57140887", "text": "def get_cluster\n if params[:jobcluster] && (OODClusters[params[:jobcluster]] || params[:jobcluster] == 'all')\n params[:jobcluster]\n end\n end", "title": "" }, { "docid": "d25d6879a0d866a2b1ca020e2ff757f6", "score": "0.5701276", "text": "def clusters\n begin\n clusters = PermissionsManager.get_family_clusters(current_user, clusters_params[:family_group_id])\n rescue\n render json: {}, status: 403\n return\n end\n render json: { 'clusters': clusters }, status: 200\n end", "title": "" }, { "docid": "9d0c5a7f99a3913c078ed4153e71e91a", "score": "0.5687573", "text": "def set_cluster\n @cluster = Cluster.find(params[:id])\n end", "title": "" }, { "docid": "9d0c5a7f99a3913c078ed4153e71e91a", "score": "0.5687573", "text": "def set_cluster\n @cluster = Cluster.find(params[:id])\n end", "title": "" }, { "docid": "9d0c5a7f99a3913c078ed4153e71e91a", "score": "0.5687573", "text": "def set_cluster\n @cluster = Cluster.find(params[:id])\n end", "title": "" }, { "docid": "9d0c5a7f99a3913c078ed4153e71e91a", "score": "0.5687573", "text": "def set_cluster\n @cluster = Cluster.find(params[:id])\n end", "title": "" }, { "docid": "9d0c5a7f99a3913c078ed4153e71e91a", "score": "0.5687573", "text": "def set_cluster\n @cluster = Cluster.find(params[:id])\n end", "title": "" }, { "docid": "a14915ecab195dd149d268ca0a36da53", "score": "0.55910224", "text": "def show\n @galactic_cluster = GalacticCluster.find(params[:id])\n end", "title": "" }, { "docid": "e3b51e9a4c59c9c5d6a4dba28adc0220", "score": "0.55850035", "text": "def list_and_select_kit\n resp = @api.list_kits\n\n kit_ids = resp['kits'].map { |h| h['id'] }\n\n if kit_ids.empty?\n choice = @io.yes?(\"No Kits found! Would you like to create one?\")\n @operation_stack.unshift(choice ? :prompt_kit_params : :quit)\n return\n end\n\n # fetch information about each kit to get their names for user selection\n # note: If there are a lot of kits, this is definitely slow. This could\n # overcome in a couple ways that I could think of: with multithreading to \n # make multiple requests at once, or with an async implementation to make \n # multiple requests at once, but since my account can only have a single \n # Kit at a time I wasn't able to implement or test a solution.\n kits = {}\n kit_ids.each do |id|\n resp = @api.kit_info(id)\n unless resp['error'].nil?\n @io.print_error resp['error']\n @operation_stack.unshift :quit\n return\n end\n kit_info = resp['kit']\n # map each Kit's name to its ID, for menu selection\n kits[kit_info[\"name\"]] = kit_info['id']\n end\n\n kit_id = @io.select_from_options(\"Select a Kit:\", kits)\n\n @operation_stack.unshift :select_kit_action\n\n # now that the next action is on the stack, return the ID to act on\n kit_id\n end", "title": "" }, { "docid": "a646f8e648e78cb3ca0f427e1d3d5fb7", "score": "0.5569942", "text": "def cluster(name = context&.cluster)\n named_cluster(name)&.cluster\n end", "title": "" }, { "docid": "6bef1e7186d804b22dd48c5bc430d754", "score": "0.5507464", "text": "def index\n\n if user_signed_in?\n\n @mclusters = Mcluster.all\n\n else\n\n redirect_to new_user_session_path\n\n end\n\n end", "title": "" }, { "docid": "bf87da4fd987fd77ed05d6fb78cc65d1", "score": "0.5506587", "text": "def get_cluster instance_id, cluster_id\n execute do\n instances.get_cluster(\n cluster_path(instance_id, cluster_id)\n )\n end\n end", "title": "" }, { "docid": "1bc03d2514e457a45fb62bded0ab6e70", "score": "0.5459347", "text": "def index\n @desired_skills = DesiredSkill.all\n end", "title": "" }, { "docid": "91512b80924d883b844d3fb971c79907", "score": "0.5436859", "text": "def get_cluster_by_key\n return @cluster_by\n end", "title": "" }, { "docid": "d13005b603fafe2a31229eecbb8b2fd3", "score": "0.54272205", "text": "def getClusterInfo\n require 'rest_client'\n require 'uri'\n\n if @role.nil? and !current_actor.superadmin\n json_response({ message: \"You don't have permission to view the clusters in this project\" }, :unauthorized)\n return\n end\n\n # Env variables for Manager host and port\n serviceManagerHost = Settings.service_manager_host\n serviceManagerPort = Settings.service_manager_port.to_s\n serviceManagerURI = 'http://' + serviceManagerHost + ':' + serviceManagerPort + '/v1/swarm'\n\n # Create request for Service Manager\n stack = {\n 'engine-url' => @cluster.endpoint,\n 'ca-cert' => @cluster.ca,\n 'cert' => @cluster.cert,\n 'cert-key' => @cluster.key\n }.to_json\n\n begin\n response = RestClient.post(\n serviceManagerURI,\n stack,\n 'Accept' => 'application/json',\n 'Content-Type' => 'application/json'\n )\n puts \"Deploy Response: \" + response\n json_response(response, 200)\n rescue Exception => e\n # If error, respond with it\n puts e\n json_response({message: e}, :unprocessable_entity)\n end\n end", "title": "" }, { "docid": "2c3a001974b248ff4b25301d2046b03d", "score": "0.54137385", "text": "def manage_cluster\n @nodes = Node.find(:all)\n end", "title": "" }, { "docid": "3c9033e744a022d001b0191a5a53a5dd", "score": "0.5406221", "text": "def index\n @leaderships = Leadership.all\n end", "title": "" }, { "docid": "3389f57ff44114fef87e9a63e74c3254", "score": "0.5388738", "text": "def index\n @computer_skills = current_user.computer_skills.all\n @computerSkillList = ComputerSkillList.all\n @skillLevel = SkillLevel.all\n end", "title": "" }, { "docid": "64900a314f6165bcb4340402fe1ebd7d", "score": "0.538735", "text": "def clusterables(all = false)\n cluster_klass.where({ project_id: self.project.id }.merge(all ? {} : { active: true }))\n end", "title": "" }, { "docid": "d1cae3fb8e728e820c754ff856f52aa3", "score": "0.5365378", "text": "def run_cluster(cluster)\n name = cluster_id(cluster)\n @dialog.setMainStatusAndLogIt(\"Tagging Cluster #{@cluster_run}-#{name}\")\n sorted = ClusterSorter.new(@dialog, @cluster_run, cluster)\n items = sorted.review\n tag = \"ClusterReview|#{@cluster_run}|#{name}\"\n @dialog.setSubStatusAndLogIt(\"Tagging #{items.size} items with: #{tag}\")\n @dialog.setSubProgress(0)\n @annotater.add_tag(tag, items)\n end", "title": "" }, { "docid": "27f646fa0acddba432135d723c4f47fa", "score": "0.5334417", "text": "def projects_clusters_sectors(site)\n if site.navigate_by_cluster?\n sql=\"select subq.id,subq.name,count(subq.id) from\n (select distinct c.id as id, c.name as name, p.id as project_id\n from clusters_as c\n inner join projects_sites as ps on cp.project_id=ps.project_id and ps.site_id=#{site.id}\n inner join projects as p on ps.project_id=p.id\n inner join countries_projects as cop on ps.project_id=cop.project_id and cop.country_id=#{self.id}\n ) as subq\n group by subq.id,subq.name order by count desc\"\n Cluster.find_by_sql(sql).map do |c|\n [c,c.count.to_i]\n end\n else\n sql=\"select subq.id,subq.name,count(subq.id) from\n (select distinct s.id as id, s.name as name, p.id as project_id\n from sectors as s\n inner join projects_sectors as pjs on s.id=pjs.sector_id\n inner join projects_sites as ps on pjs.project_id=ps.project_id and ps.site_id=#{site.id}\n inner join projects as p on ps.project_id=p.id\n inner join countries_projects as cop on ps.project_id=cop.project_id and cop.country_id=#{self.id}\n ) as subq\n group by subq.id,subq.name order by count desc\"\n Sector.find_by_sql(sql).map do |s|\n [s,s.count.to_i]\n end\n end\n end", "title": "" }, { "docid": "6dc3987f6a1b9ee8b5593e9d6480976a", "score": "0.53317857", "text": "def things\n begin\n things = PermissionsManager.get_cluster_things(current_user, things_params[:cluster_group_id])\n rescue\n render json: {}, status: 403\n return\n end\n render json: { 'things': things }, status: 200\n end", "title": "" }, { "docid": "4ce928c0398013d81957f3db0558a0ad", "score": "0.5327174", "text": "def index\n @skills = current_user.skills.all\n end", "title": "" }, { "docid": "2043bba35839116e48534b8da57d7c1e", "score": "0.532004", "text": "def show\n @cluster = Cluster.find(params[:id])\n\t@categories = Category.find(:all, :order=> 'lang, order_num')\n\t@words = @cluster.words.find(:all, :include => :cluster_words, :order => 'cluster_words.order_num, order_num')\n\t\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cluster }\n end\n end", "title": "" }, { "docid": "48cb556484c01a8b6b33e9133eca7a8d", "score": "0.53196746", "text": "def get_cluster(name)\n cl_obj = Com::Vmware::Vcenter::Cluster.new(vapi_config)\n\n # @todo: Use Cluster::FilterSpec to only get the cluster which was asked\n # filter = Com::Vmware::Vcenter::Cluster::FilterSpec.new(clusters: Set.new(['...']))\n clusters = cl_obj.list.select { |cluster| cluster.name == name }\n raise format(\"Unable to find Cluster: %s\", name) if clusters.empty?\n\n cluster_id = clusters[0].cluster\n cl_obj.get(cluster_id)\n end", "title": "" }, { "docid": "8ba7d2bbeee5e77336b70f23900a33e5", "score": "0.53029126", "text": "def show\n @cluster = Cluster.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cluster }\n end\n end", "title": "" }, { "docid": "ad6114c41737f08c4c7aaea5b995bd46", "score": "0.52982295", "text": "def cluster_by\n return @cluster_by\n end", "title": "" }, { "docid": "5913cfa5e92f10c778c6c99a9ac71bd6", "score": "0.52962357", "text": "def cluster\n OodAppkit.clusters[cluster_id] || raise(ClusterNotFound, \"Session specifies nonexistent '#{cluster_id}' cluster id.\")\n end", "title": "" }, { "docid": "7b21923a5d2736f6306c659a19113403", "score": "0.5277748", "text": "def info\n puts 'All clusters registered to ActiveRecord::ShardFor'\n puts\n clusters.each do |cluster|\n puts \"= Cluster: #{cluster.name} =\"\n cluster.connections.each do |name|\n puts \"- #{name}\"\n end\n puts\n end\n end", "title": "" }, { "docid": "0189665df44a82948edbf878547e6223", "score": "0.524323", "text": "def index\n @other_skills = OtherSkill.visible :view_other_skills\n end", "title": "" }, { "docid": "5a0e9f7a0af144313247d4659f145f61", "score": "0.5239025", "text": "def select_cl(title)\n cm = CM.select_cm(title: \"#{title}\\n\\n\")\n\n title = \"#{title}\\n\\nSelect Cluster (only 1):\\n\".red\n header = TABLE_HEADERS.values_at(*LABEL)\n body = CM.clusters(cm).map { |c| c.values_at(*LABEL) }\n .sort_by { |c| c.map(&:djust) }\n table = FMT.table(header: header, body: body, rjust: [3, 4])\n fzfopt = \"+m --header='#{title}' --no-clear\"\n\n selected = Utils.fzf(list: table, opt: fzfopt)\n Utils.exit_if_empty(selected, 'No items selected')\n selected.flat_map(&:split)\n end", "title": "" }, { "docid": "c7354ea2e08b92fd81d5f50df2f1d208", "score": "0.5234019", "text": "def set_mcluster\n @mcluster = Mcluster.find(params[:id])\n end", "title": "" }, { "docid": "f4bf74fba2ab8dc1fa13593f5d39e575", "score": "0.5228015", "text": "def set_status_cluster\n @status_cluster = StatusCluster.find(params[:id])\n end", "title": "" }, { "docid": "656b3eb377af390a0a8d89cf56b5fc32", "score": "0.51864284", "text": "def collectClusters(rf, db)\n\trf.childEntity.grep(RbVmomi::VIM::Datacenter).each do |dc|\n\t\tprogressbar = ProgressBar.create(:title => \"Clusters\", :format => '%t |%b>>%i| %p%% %a')\n\t\tprogressbar.total = counter(dc, \"c\")\n\t\tdc.hostFolder.childEntity.each do |cluster|\n\t\t\tdb.select(1)\n\t\t\tdb.hset(\"#{cluster.name}\", \"Status\", \"#{cluster.summary.overallStatus}\") \n\t\t\tdb.hset(\"#{cluster.name}\", \"NumberHosts\", \"#{cluster.summary.numHosts}\")\n\t\t\tdb.hset(\"#{cluster.name}\", \"EffectiveHosts\", \"#{cluster.summary.numEffectiveHosts}\") \n\t\t\tdb.hset(\"#{cluster.name}\", \"CPUtotal\", \"#{cluster.summary.totalCpu}\")\n\t\t\tdb.hset(\"#{cluster.name}\", \"EffectiveCPU\", \"#{cluster.summary.effectiveCpu}\")\n\t\t\tdb.hset(\"#{cluster.name}\", \"MemTotal\", \"#{cluster.summary.totalMemory}\")\n\t\t\tdb.hset(\"#{cluster.name}\", \"EffectiveMem\", \"#{cluster.summary.effectiveMemory}\")\n\t\t\tprogressbar.increment\n\t\tend\n\tend\nend", "title": "" }, { "docid": "fe10ecc4395d438d8dcb32b153c3406f", "score": "0.51814026", "text": "def index\n @membership_clerks = MembershipClerk.all\n end", "title": "" }, { "docid": "66b084e5c32c81c27f32cdffd64da7b2", "score": "0.5166436", "text": "def star_cluster; end", "title": "" }, { "docid": "cf4e4e65e18881b82e14b915762b814e", "score": "0.5161332", "text": "def set_galactic_cluster\n @galactic_cluster = GalacticCluster.find(params[:id])\n end", "title": "" }, { "docid": "e00bea6ab77068359adbf702b51462ae", "score": "0.5156011", "text": "def index\n @pool_members = Pool.find(session[:pool_id]).pool_members\n @skaters = Skater.joins(:nhl_team).where('nhl_teams.pool_id' => session[:pool_id])\n end", "title": "" }, { "docid": "b31e78ed2db776978cb040d46ea9149f", "score": "0.51526076", "text": "def index\n @current_skills = CurrentSkill.all\n end", "title": "" }, { "docid": "65b4264bdd2e55c1e0ac2d38c1016337", "score": "0.51483464", "text": "def cluster_params\n params.require(:cluster).permit(:master_url, :name, :id)\n end", "title": "" }, { "docid": "3175977ace126dc6472dc7d3dd1f3137", "score": "0.51266867", "text": "def cluster_ids\n []\n end", "title": "" }, { "docid": "ed597454d8e4e4eab516ec9cac460977", "score": "0.5121447", "text": "def cluster()\n @cluster ||= $ip2cluster[@ip]\n @cluster\n end", "title": "" }, { "docid": "bf8c572449509b89951be5461d1812be", "score": "0.5118386", "text": "def index\n if params[:cluster_id]\n @cluster_projects = @projectable.projects\n @group_projects = @projectable.group_projects\n @all_projects = Project.where(id: (@projectable.project_ids+@projectable.group_project_ids)).order('name asc')\n\n if params[:state] == 'group'\n @projects = @group_projects\n elsif params[:state] == 'module'\n @projects = @projectable.projects\n else\n @projects = @all_projects\n end\n elsif params[:group_id]\n @projects = Group.find(params[:group_id]).projects\n @all_projects = @projects\n end\n\n @current_user_projects = @projects.with_user(current_user)\n if params[:ufilter] == 'you-are-in'\n @projects = @current_user_projects\n end\n\n respond_to do |format|\n format.html { render layout: 'fluid' }# index.html.erb\n format.json { render json: @projects }\n end\n end", "title": "" }, { "docid": "dbc66900a4e4ec89ef29a56b36cd36af", "score": "0.5113945", "text": "def initialize(cluster)\n @oodClustersAdapter = nil\n @server = \"/usr/bin\"\n @cluster_id = cluster.id\n @cluster_title = cluster.metadata.title || cluster.id.titleize\n self\n end", "title": "" }, { "docid": "d1fe041032306cbe456bc704de291951", "score": "0.51115334", "text": "def index\n @skill_categories = SkillCategory.includes(:skills)\n # @skills = Skill.all\n end", "title": "" }, { "docid": "f89ae369701e939b6d8ccfd4cc8c0741", "score": "0.51114684", "text": "def index\n @skill_levels = SkillLevel.all\n end", "title": "" }, { "docid": "b84667e7dd623bdc7492e0f20ab5a3fe", "score": "0.51068765", "text": "def cloud_desc\n if @config['flavor'] == \"EKS\"\n resp = MU::Cloud::AWS.eks(region: @config['region'], credentials: @config['credentials']).describe_cluster(\n name: @mu_name\n )\n resp.cluster\n else\n resp = MU::Cloud::AWS.ecs(region: @config['region'], credentials: @config['credentials']).describe_clusters(\n clusters: [@mu_name]\n )\n resp.clusters.first\n end\n end", "title": "" }, { "docid": "ef3a2af75e31bfa2d91b16f91a5420ff", "score": "0.5093873", "text": "def index\n @resources = @user.resources\n @matches = find_matches @user # defined below\n @like_requests = find_like_requests @user # defined below\n\n existing_categories = [] # populates the carousel dropdown with resource to be searched for\n\n if @user.wants_bike == true\n existing_categories << \"bike\"\n end\n\n if @user.wants_vehicle == true\n existing_categories << \"vehicle\"\n end\n\n if @user.wants_social == true\n existing_categories << \"social\"\n end\n\n if @user.wants_pet == true\n existing_categories << \"pet\"\n end\n\n if @user.wants_housing == true\n existing_categories << \"housing\"\n end\n\n @avail_resources = existing_categories # instance variable to be used in view\n end", "title": "" }, { "docid": "e7a3ad0789e680be7a47420a1af89995", "score": "0.5091671", "text": "def project_cluster(project, cluster_id)\n get(\"/projects/#{url_encode project}/clusters/#{cluster_id}\")\n end", "title": "" }, { "docid": "a9f3ecdb0febbfebadf1329f33933f77", "score": "0.5082644", "text": "def index\n\t@skills = Skill.all\n end", "title": "" }, { "docid": "f197424523c6e83d153e8db281e7d9f1", "score": "0.507156", "text": "def set_cluster\n if params[:id].to_i == -1\n # orphans\n @cluster = Cluster.new(elements: find_orphans)\n else\n @cluster = Cluster.includes(:elements).find(params[:id])\n end\n end", "title": "" }, { "docid": "8784a4b071dbe706395a00321ce83eaf", "score": "0.5068955", "text": "def index\n @skillsets = Skillset.all\n end", "title": "" }, { "docid": "8784a4b071dbe706395a00321ce83eaf", "score": "0.5068955", "text": "def index\n @skillsets = Skillset.all\n end", "title": "" }, { "docid": "a7b5d6383cdfa213c06675edd13102f0", "score": "0.5068679", "text": "def index\n if params[:klass_id]\n @skill_categories = SkillCategory.where(klass_id: params[:klass_id])\n else\n @skill_categories = SkillCategory.all\n end\n end", "title": "" }, { "docid": "5ee7f4721f326494f1c96d48438ca40e", "score": "0.50653076", "text": "def __cluster_info\n health = JSON.parse(Net::HTTP.get(URI(\"#{__cluster_url}/_cluster/health\")))\n nodes = if version == '0.90'\n JSON.parse(Net::HTTP.get(URI(\"#{__cluster_url}/_nodes/?process&http\")))\n else\n JSON.parse(Net::HTTP.get(URI(\"#{__cluster_url}/_nodes/process,http\")))\n end\n master = JSON.parse(Net::HTTP.get(URI(\"#{__cluster_url}/_cluster/state\")))['master_node']\n\n result = [\"\\n\",\n ('-'*80).ansi(:faint),\n 'Cluster: '.ljust(20).ansi(:faint) + health['cluster_name'].to_s.ansi(:faint),\n 'Status: '.ljust(20).ansi(:faint) + health['status'].to_s.ansi(:faint),\n 'Nodes: '.ljust(20).ansi(:faint) + health['number_of_nodes'].to_s.ansi(:faint)].join(\"\\n\")\n\n nodes['nodes'].each do |id, info|\n m = id == master ? '*' : '-'\n result << \"\\n\" +\n ''.ljust(20) +\n \"#{m} \".ansi(:faint) +\n \"#{info['name'].ansi(:bold)} \".ansi(:faint) +\n \"| version: #{info['version'] rescue 'N/A'}, \".ansi(:faint) +\n \"pid: #{info['process']['id'] rescue 'N/A'}, \".ansi(:faint) +\n \"address: #{info['http']['bound_address'] rescue 'N/A'}\".ansi(:faint)\n end\n\n result\n end", "title": "" }, { "docid": "1fc17a6567841e2af4856b7f6d545a31", "score": "0.50590736", "text": "def on_cluster(hid, &block)\n return unless @clusters[hid] && @clusters[hid][:cluster]\n\n block.call(@clusters[hid][:cluster])\n end", "title": "" }, { "docid": "f2f6a9796af74faef2f29ba53a43b27e", "score": "0.5050669", "text": "def cluster_roles\n iterate :clusterroles do |r|\n setup_role role_kind: :ClusterRole, role: r\n end\n\n # For cluster roles with aggregation rules create an edge betweeen those roles\n @aggregable_roles.each do |aggregating_role, composite_roles|\n composite_roles.each do |composite_role|\n edge :aggregate, {\n aggregating_role_name: aggregating_role, \n composite_role_name: composite_role\n }\n edge :composite, {\n aggregating_role_name: aggregating_role,\n composite_role_name: composite_role\n }\n end\n end\n end", "title": "" }, { "docid": "215817133b1526811e133d137a1d1d06", "score": "0.5039711", "text": "def index\n @iams = $iam.groups.map{ |x| Iam.new(name: x.name) } \n @users = $iam.users\n @roles = $iam.client.list_roles \n end", "title": "" }, { "docid": "0dcabf34cafa8f3d3c80e940371d87ef", "score": "0.50322974", "text": "def list\n @session[:clustername]=nil\n @session[:clustername1]=nil\n @group_pages, @groups = paginate :groups, :per_page => 10\n end", "title": "" }, { "docid": "625aef1084ac767b7c7e5d2cac5c7013", "score": "0.50309783", "text": "def index\n # Filtro: solo veo mis candidatos.\n if !params[:category_id].blank? # || ADMIN\n @candidates = Candidate.where(category_id: @category)\n else\n return @candidates = Candidate.all if current_user.is_admin?\n end\n\n if !params[:selection_process_id].blank?\n # <!--Candidatos where: category.selection_process_id == selection_process -->\n @categories = Category.where(selection_process_id: params[:selection_process_id])\n @candidates = Candidate.where(category_id: @categories)\n end\n\n unless user_session[:selection_process_id].nil?\n @categories = Category.where(selection_process_id: user_session[:selection_process_id])\n @candidates = Candidate.where(category_id: @categories)\n end\n end", "title": "" }, { "docid": "fcb0ab775474440576c6480de04efe75", "score": "0.50164175", "text": "def order_clusters\n use_ary = self.look.face_map.ordered_product_role_array \n use_ary.each_with_index do |params, idx| \n set_cluster_use_order(idx + 1, *params)\n end\n end", "title": "" }, { "docid": "2ac9935e4eb2b747d3a512253fa71cfa", "score": "0.50159013", "text": "def cluster_params\n params.require(:cluster).permit(:name, :project_id, :element_id, :method)\n end", "title": "" }, { "docid": "06736b683b4a0a33496e6eb393c003e8", "score": "0.5001574", "text": "def get_cluster(name)\n cluster_id = get_cluster_id(name)\n\n host_api = VSphereAutomation::VCenter::HostApi.new(api_client)\n raise_if_unauthenticated host_api, \"checking for cluster `#{name}`\"\n\n hosts = host_api.list({ filter_clusters: cluster_id, connection_states: \"CONNECTED\" }).value\n filter_maintenance!(hosts)\n raise_if_missing hosts, format(\"Unable to find active hosts in cluster `%s`\", name)\n\n cluster_api = VSphereAutomation::VCenter::ClusterApi.new(api_client)\n cluster_api.get(cluster_id).value\n end", "title": "" }, { "docid": "c1af2e8ae8d03f00aa69bebae7fe1cac", "score": "0.49934334", "text": "def index\n @projects_skills = ProjectsSkill.all\n end", "title": "" }, { "docid": "072d8e24323f93565a6d5fc24d8ddc0e", "score": "0.49877045", "text": "def index\n @user = current_user\n @learningstyle = @user.learningstyles.find_by_user_id(@user.id)\n @teamsmembers = User.joins(organizations: [teams: :teaminvites]).joins(:learningstyles).select('learningstyles.activisttotal, learningstyles.reflectortotal, \n learningstyles.theoristtotal, learningstyles.pragmatisttotal, learningstyles.actstatus, learningstyles.refstatus,\n learningstyles.theostatus, learningstyles.pragstatus').where(\"teaminvites.user_id = ? AND teaminvites.accepted = ? AND teaminvites.team_id = ?\", current_user.id, 'true', 1).group('learningstyles.id')\n end", "title": "" }, { "docid": "b6ff4e408536dd811cdac4dc2334d49b", "score": "0.49836427", "text": "def index\n @lectors = Lector.all\n end", "title": "" }, { "docid": "be8a45af94225a8b2f2e00e8e369fca1", "score": "0.49792582", "text": "def detect_cluster\n initialize_metadata\n result = {\n region: @region,\n instance_id: @instance_id,\n cluster_name: nil,\n cluster_role: nil\n }\n\n find_instance_tags.each do |tag|\n if tag[:key] === CLUSTER_TAG_NAME\n result[:cluster_name] = tag[:value]\n elsif tag[:key] === ROLE_TAG_NAME\n result[:cluster_role] = tag[:value].to_sym\n end\n end\n\n if result[:cluster_name].nil? || result[:cluster_role].nil?\n result[:cluster_name] = nil\n result[:cluster_role] = nil\n end\n\n result\n end", "title": "" }, { "docid": "847aefd1a8fca2c6bee3ab221f5afc0f", "score": "0.49761537", "text": "def index\n @learners = Learner.all\n end", "title": "" }, { "docid": "a1512d039100ba197d82a105866af231", "score": "0.49696288", "text": "def cluster_params\n params.require(:cluster).permit(:rank_id, :last_time_cbc_posted,\n :time_between_member_left_cluster_created,:has_more_than_4_members,\n :is_cluster_full, user_left_cluster_timestamps:[])\n end", "title": "" }, { "docid": "969d80472736af37fced831c973ed7be", "score": "0.49692658", "text": "def deployClusters\n\n $cluster = @parsed_obj['environment_cluster']\n\n # for each layer in --deploy parameter.\n @opt.deploy.each do |d|\n case d\n when 'batch'\n if !@opt.nofacts\n # This is the only method using the JSON information\n # The reamin methods, puppetRunBatch, handleBatchLayer,\n # are using the mcollective discoverty feature using\n # the deployed facts. Uses the global @host_facts variable.\n deployFactsLayer 'batch'\n end\n if !@opt.norun\n # this method uses the mc discovery subsystem.\n @mchandler.puppetRunBatch $cluster, 'batch', 2\n end\n if !@opt.onlyrun\n # this method uses the mc discovery subsystem.\n @mchandler.handleBatchLayer $cluster, 'bootstrap'\n end\n when 'bus'\n if !@opt.nofacts\n deployFactsLayer 'bus'\n end\n if !@opt.norun\n @mchandler.puppetRunBatch $cluster, 'bus', 2\n end\n @mchandler.handleBusLayer $cluster, 'bootstrap'\n when 'speed'\n if !@opt.nofacts\n deployFactsLayer 'speed'\n end\n if !@opt.norun\n @mchandler.puppetRunBatch $cluster, 'speed', 2\n end\n @mchandler.handleSpeedLayer $cluster, 'bootstrap'\n when 'serving'\n if !@opt.nofacts\n deployFactsLayer 'serving'\n end\n if !@opt.norun\n @mchandler.puppetRunBatch $cluster, 'serving', 2\n end\n @mchandler.handleServingLayer $cluster, 'bootstrap'\n end\n end\n end", "title": "" }, { "docid": "66dc28d7e069df943e64ad76c9bc4ce9", "score": "0.49628094", "text": "def projects_clusters_sectors(site, location_id = nil)\n if location_id.present?\n location_id = [location_id] unless location_id.is_a? Array\n \n if location_id.length == 1 and site.navigate_by_country?\n location_join = \"inner join countries_projects cp on cp.project_id = p.id and cp.country_id = #{location_id.first}\"\n else\n location_join = \"inner join projects_regions as pr on pr.project_id = p.id and pr.region_id = #{location_id.last}\"\n end\n end\n\n if site.navigate_by_cluster?\n sql=\"select subq.id,subq.name,count(subq.id) from\n (select distinct c.id as id, c.name as name, p.id as project_id\n from clusters_as c\n inner join projects_sites as ps on cp.project_id=ps.project_id and ps.site_id=#{site.id}\n inner join projects as p on ps.project_id=p.id\n #{location_join}\n where p.primary_organization_id=#{self.id}\n ) as subq\n group by subq.id,subq.name order by count desc\"\n Cluster.find_by_sql(sql).map do |c|\n [c,c.count.to_i]\n end\n else\n sql=\"select subq.id,subq.name,count(subq.id) from\n (select distinct s.id as id, s.name as name, p.id as project_id\n from sectors as s\n inner join projects_sectors as pjs on s.id=pjs.sector_id\n inner join projects_sites as ps on pjs.project_id=ps.project_id and ps.site_id=#{site.id}\n inner join projects as p on ps.project_id=p.id\n #{location_join}\n where p.primary_organization_id=#{self.id}\n ) as subq\n group by subq.id,subq.name order by count desc\"\n Sector.find_by_sql(sql).map do |s|\n [s,s.count.to_i]\n end\n end\n end", "title": "" }, { "docid": "5b9d05bbf528803c7034cd1f29d72248", "score": "0.49550676", "text": "def all_clusters\n @clusters ||= redshift.describe_clusters[:clusters].map { |c| c[:cluster_identifier] }\n end", "title": "" }, { "docid": "3264918656316e3f552e89b882b0211a", "score": "0.49476194", "text": "def getClusterMetrics\n @admin.getClusterMetrics\n end", "title": "" }, { "docid": "836a133e3162081a3ba0691e16299536", "score": "0.49440056", "text": "def show\n # OBSOLETE\n authorize! :read, @study_plan\n @skill = Skill.find(params[:id])\n @competence = Competence.find(params[:competence_id])\n \n @prereq_ids = @skill.prereq_ids.to_set\n @prereq_courses = @skill.prereq_courses.includes([:localized_description, {:skills => :localized_description}]).uniq\n \n log(\"view_skill #{@skill.id}\")\n render :action => 'show', :layout => 'leftnav'\n end", "title": "" }, { "docid": "b6b3f09571d04f51b4d95bee2cf53911", "score": "0.4939726", "text": "def create\n\n @project = Project.where(:key => params[:project_key]).first\n\n if analyzable?(@project)\n\n jobs = Job.where(:project_id => @project.id, :step_id => session[:active_step]).all.to_a.sort{|a, b| (a.updated_at.to_s || '0') <=> (b.updated_at.to_s || '0')}\n last_job = jobs.last\n session[:last_update_active_step] = @project.status_id.to_s + \",\"\n session[:last_update_active_step] += [jobs.size, last_job.status_id, last_job.updated_at].join(\",\") if last_job\n \n @cluster = Cluster.new(cluster_params)\n @cluster.project_id = @project.id\n @cluster.user_id = (current_user) ? current_user.id : 1\n tmp_attrs = params[:attrs]\n @cluster.attrs_json = tmp_attrs.to_json\n @cluster.step_id = nil\n if m = params[:cluster][:dim_reduction_id].match(/,(\\d+)/)\n @cluster.dim_reduction_id=nil\n @cluster.step_id=m[1].to_i\n end\n if params[:cluster][:dim_reduction_id].match(/^\\d+$/)\n dr_name = DimReduction.where(:id => @cluster.dim_reduction_id).first.label\n else\n step = Step.where(:id => @cluster.step_id).first\n dr_name = step.name + \" data\"\n end\n \n cm = @cluster.cluster_method\n list_attrs = JSON.parse(cm.attrs_json)\n # other_params = ([\"Input data=#{dr_name}\"] + list_attrs.reject{|attr| attr['widget'] == nil}.map{|attr| \"#{attr['label']}=\" + ((attr['name'] == 'nbclust' and tmp_attrs['nbclust'] == '') ? 'Auto' : tmp_attrs[attr['name']].to_s)}).join(\", \")\n other_params = list_attrs.reject{|attr| attr['widget'] == nil or attr['name'] == 'nbclust'}.map{|attr| \"#{attr['label']}=#{tmp_attrs[attr['name']].to_s}\"}.join(\", \")\n other_params = \"(\" + other_params + \")\" if other_params != ''\n #[@diff_expr.diff_expr_method.label, other_params].join(\" \")\n @cluster.label = [ClusterMethod.where(:id => @cluster.cluster_method_id).first.label, ((tmp_attrs['nbclust'] != '') ? (tmp_attrs['nbclust'].to_s + \" clusters\") : '[Auto]') , (\"on \" + dr_name), other_params].join(\" \")\n # @cluster.label = [ClusterMethod.where(:id => @cluster.cluster_method_id).first.label, other_params].join(\" \")\n @existing_cluster = Cluster.where(:project_id => @project.id, :label => @cluster.label).first\n last_cluster = Cluster.where(:project_id => @project.id).last\n @cluster.num = (last_cluster and last_cluster.num) ? (last_cluster.num + 1) : 1\n @project.update_attributes(:status_id => 1, :step_id => 5) if @project.status_id > 2 and !@existing_cluster\n respond_to do |format|\n if @existing_cluster\n @cluster = @existing_cluster\n @clusters=[]\n get_cluster_data()\n format.html {\n render :partial => 'index'\n }\n elsif @cluster.save\n job = Basic.create_job(@cluster, 5, @project, :job_id, cm.speed_id)\n # @cluster.update_attributes(:status_id => 1)#, :num => (last_cluster and last_cluster.num) ? (last_cluster.num + 1) : 1)\n session[:last_step_status_id]=2\n# @cluster.delay(:queue => (cm.speed) ? cm.speed.name : 'default').run\n delayed_job = Delayed::Job.enqueue Cluster::NewClustering.new(@cluster), :queue => (cm.speed) ? cm.speed.name : 'default'\n job.update_attributes(:delayed_job_id => delayed_job.id) #job.id) \n # @cluster.run\n @clusters=[]\n \n get_cluster_data()\n \n format.html { \n # redirect_to @cluster, notice: 'Cluster was successfully created.' \n render :partial => 'index'\n }\n # format.json { render :show, status: :created, location: @cluster }\n else\n format.html { render :new }\n format.json { render json: @cluster.errors, status: :unprocessable_entity }\n end\n end\n else\n render :nothing => true\n end\n end", "title": "" }, { "docid": "ac3161737d684fb0a273d60c78a702e0", "score": "0.49383703", "text": "def cluster_params\n params.require(:cluster).permit(:clustername, :clusterendpoints, :clusterstatus, :clusterusername, :clusterpassword)\n end", "title": "" }, { "docid": "f4290757f78fafe21197c58826e33bf4", "score": "0.4933736", "text": "def list_clusters(opts = {})\n @transporter.read(:GET, '/1/clusters', {}, opts)\n end", "title": "" }, { "docid": "543836b8cbcdfb3c7db892d02c2ef315", "score": "0.4933067", "text": "def fetch_cluster_data\n env = release_env(last_release(@project))\n env.cluster_deploy_groups.each do |cdg|\n cdg.cluster.client.get_pods(namespace: cdg.namespace, label_selector: \"project_id=#{@project.id}\").each do |pod|\n update_rc_pods(Kubernetes::Api::Pod.new(pod))\n end\n end\n end", "title": "" }, { "docid": "0ce860f62ee011fdcebbeb99b1889550", "score": "0.49315932", "text": "def index\n @admin_student_majors = Admin::StudentMajor.all\n end", "title": "" }, { "docid": "140a9436b1e58853505006bbee968c69", "score": "0.4930224", "text": "def get_cluster_collections\n params = {:action => \"LIST\"}\n cluster_collections = solr_collection_api(node['ipaddress'], node['port_no'], params)\n collection_list = cluster_collections[\"collections\"]\n return collection_list\n end", "title": "" }, { "docid": "6d881e96004944695b4c62f9a8e6c7ed", "score": "0.49276417", "text": "def index\n @skills = Skill.all\n end", "title": "" }, { "docid": "6d881e96004944695b4c62f9a8e6c7ed", "score": "0.49276417", "text": "def index\n @skills = Skill.all\n end", "title": "" }, { "docid": "4c3d869161e5b86f614a8ca21351df45", "score": "0.49254727", "text": "def set_leadership\n @leadership = Leadership.find(params[:id])\n end", "title": "" }, { "docid": "6d7251a4fb2ddb62e819b5b4df3c8717", "score": "0.49254462", "text": "def cluster_params\n #ActiveModel::Serializer::Adapter::JsonApi::Deserialization.parse(params.to_h)\n ActiveModelSerializers::Deserialization.jsonapi_parse!(params.to_unsafe_h)\n #params.require(:cluster).permit(:name, :description, :region_id)\n end", "title": "" }, { "docid": "3db703b6431ff4489370a3d937aad358", "score": "0.49228275", "text": "def index\n @skills_users = SkillsUser.all\n end", "title": "" } ]
13a25936c2741d8f5701758f15cd1777
State transition tables end reduce 0 omitted
[ { "docid": "a99068f7be295a226c12197165f7ebc0", "score": "0.0", "text": "def _reduce_1(val, _values, result)\n self.lexer.lex_state = :expr_beg\n \n result\nend", "title": "" } ]
[ { "docid": "4a7c9864b4f194fb7c65c825195e6ada", "score": "0.64042956", "text": "def transitions; end", "title": "" }, { "docid": "0d2e863a19c863a84c1d98b365e36bbf", "score": "0.6064393", "text": "def closure! \n cstart = new_state\n cend = new_state\n\n add_transition(cstart, cend, \"\")\n add_transition(cend, cstart, \"\")\n\n add_transition(cstart, @start, \"\")\n @final.keys.each { |key| add_transition(key, cend, \"\")}\n\n set_start(cstart)\n @final.keys.each { |key| set_final(key, false)}\n set_final(cend, true)\n\n\n end", "title": "" }, { "docid": "6e5bb95855debb7206acbd94ad87f7da", "score": "0.60386634", "text": "def closure! \n\t\ttemp = new_state\n\t\tadd_transition(temp, @start, \"\")\n\t\t@start = temp\n\t\ttemp = new_state\n\t\t@final.keys.sort.each { |x| \n\t\tadd_transition(x, temp, \"\") \n\t\tset_final(x, false) }\n\t\t\n\t\t@final = {temp=>true}\n\t\tadd_transition(@start, temp, \"\")\n\t\tadd_transition(temp, @start, \"\")\n\t\t@state.delete(nil)\n\t\t@transition.delete(nil)\n end", "title": "" }, { "docid": "ce097359d83118495203703bc5870b9c", "score": "0.6007729", "text": "def finished_states\n states - transitive_states\n end", "title": "" }, { "docid": "7a032e8581dd0cfd1a61af0d76a47f62", "score": "0.5946686", "text": "def end_transition\n nil\n end", "title": "" }, { "docid": "6250f31eb54abd3482eab9c2d805b9ed", "score": "0.59351325", "text": "def transition_at; end", "title": "" }, { "docid": "6250f31eb54abd3482eab9c2d805b9ed", "score": "0.59351325", "text": "def transition_at; end", "title": "" }, { "docid": "edc9376843efbb175d5d683c5bd030a9", "score": "0.5909589", "text": "def rest\n @state -= 1 if @state > 2\n @state += 1 if @state < 2\n end", "title": "" }, { "docid": "c657f514159aebe65926e02523aa20b5", "score": "0.58873314", "text": "def closure!\ns0 = new_state\ns1 = new_state\nadd_transition(s0, @start, \"\")\n# reset the final states of the current object\nkeys = @final.keys\ni = 0\nwhile i < keys.size\nadd_transition(keys[i], s1, \"\")\nset_final(keys[i], false)\ni = i + 1\nend\nadd_transition(s0, s1, \"\")\nadd_transition(s1, s0, \"\")\nset_start(s0)\nset_final(s1, true)\nend", "title": "" }, { "docid": "0537a1a86324c8203d2e19e3e618a502", "score": "0.58676314", "text": "def up\n @state -= 1 unless @state == 0\n @y -= 1 * @boost\n end", "title": "" }, { "docid": "0537a1a86324c8203d2e19e3e618a502", "score": "0.58676314", "text": "def up\n @state -= 1 unless @state == 0\n @y -= 1 * @boost\n end", "title": "" }, { "docid": "6c462bab210dee341a1bcb5026f6e87e", "score": "0.57807076", "text": "def compute_unreachable_states\n queue = [starting_state].to_set\n transitions = self.each_transition.to_a.dup\n\n done_something = true\n while done_something\n done_something = false\n transitions.delete_if do |from, _, to|\n if queue.include?(from)\n queue << to\n done_something = true\n end\n end\n end\n\n transitions.map(&:first).to_set\n end", "title": "" }, { "docid": "5cc24bd7423ef368486f00ce19270508", "score": "0.5779571", "text": "def final_state(state)\n final_states(state)\n end", "title": "" }, { "docid": "b8cf49032c8937fdea4e6c1855365d85", "score": "0.5710219", "text": "def states; end", "title": "" }, { "docid": "ddc83dddfff7e2566993b1f7b9479c27", "score": "0.56961817", "text": "def rest\n if @state > 2\n @state -= 1\n elsif @state < 2\n @state += 1\n end\n end", "title": "" }, { "docid": "1518155241a297a3d321e814ba4e781e", "score": "0.5655912", "text": "def state_on_table_game_end\n @log.debug(\"Net_state: change to state state_on_table_game_end\")\n @network_state = :state_on_table_game_end\n make_state_change_ntfy(:ntfy_state_on_table_game_end)\n end", "title": "" }, { "docid": "4040bb649451c41b5686ccb58f462b39", "score": "0.55736065", "text": "def times_walked_to(state); end", "title": "" }, { "docid": "52ea8e7698c77e299e0b8b3094a41147", "score": "0.55026084", "text": "def finish\n transition_to(:successful) unless transition_to(:waiting_funds)\n end", "title": "" }, { "docid": "e1e5a015f778f466c75c4c8757ef813b", "score": "0.54936284", "text": "def count_next_index()\n if @operation == :pour\n if @second_index + 1 >= @original_state.size\n @second_index = 0\n @first_index += 1\n else\n @second_index += @second_index + 1 == @first_index ? 2 : 1\n end\n if @first_index + 1 == @original_state.size && @second_index + 1 >= @original_state.size\n @operation = :nop\n end\n else\n if @first_index + 1 < @original_state.size\n @first_index += 1\n else\n @first_index = 0\n @operation = @operation == :fill ? :empty : :pour\n end\n end\n end", "title": "" }, { "docid": "caf9db117fd6bd3ba07c17e9c6a9ea8e", "score": "0.5481873", "text": "def get_lambda_transitions(state)\n transitions = []\n @lambda_table[state].each.with_index do |value, index|\n if value == 1\n transitions << index\n end\n end\n return transitions\n end", "title": "" }, { "docid": "893f7385843f520940a88289b5863bb9", "score": "0.5438249", "text": "def exit!\n map = @transition_map\n map.each do |type, events_to_transition_arrays|\n events_to_transition_arrays.each do |event, transitions|\n transitions.each(&:unarm)\n end\n end\n\n @exit_actions.each do |exit_action|\n exit_action.call(@state_machine)\n end\n @state_machine.current_state = nil\n end", "title": "" }, { "docid": "5ecbb61e1a2d9e798852640e3ff5754c", "score": "0.5409715", "text": "def state_anim\n states.each do |state|\n return state.state_anim if state.state_anim > 0\n end\n return 0\n end", "title": "" }, { "docid": "de193b4aebc6fc84a432b6b87688f0ed", "score": "0.5403657", "text": "def completeTable(mach)\n\t\tfiltered = {}\n\t\ttable = mach.to_table\n\n\t\t# for each state in the machine\n\t\tmach.states.each_with_index do |s, index|\n\t\t\t# for each rule at a given state\n\t\t\ts.state.each do |lhs, rules|\n\t\t\t\trules.each_with_index do |rule, offset|\n\t\t\t\t\t# tryRuleInState\n\t\t\t\t\tnext unless rule.last == @marker\n\n\t\t\t\t\tfollow_set(lhs).each do |sym|\n\t\t\t\t\t\t# assertEntry\n\t\t\t\t\t\traise ShiftReductConflictError unless table[index][sym].nil?\n\t\t\t\t\t\ttable[index][sym] = \"#{lhs},#{offset}\"\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t\n\t\t# AssertEntry[StartState, Goalsymbol, accept_symbol]\n\t\traise ShiftReductConflictError unless table[0][@goal].nil?\n\t\ttable[0][@goal] = \"accept\"\n\n\t\treturn table\n\tend", "title": "" }, { "docid": "0e940c0a873cb27723e8dd3c46a26bde", "score": "0.5375035", "text": "def setup_rem_state\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n c = @acts[2] || 100\n c = c/100.0 if c.integer?\n if area_flag\n target_array.each do |t|\n if chance(c)\n t.remove_state(@acts[1])\n get_scene.tsbs_redraw_status(t)\n end\n end\n return\n end\n return unless target\n if chance(c)\n target.remove_state(@acts[1])\n get_scene.tsbs_redraw_status(target)\n end\n end", "title": "" }, { "docid": "50e6b7b402a20a7d7dcff79c7bcbdafd", "score": "0.5353606", "text": "def union!(f1)\n\t\ttemp = new_state\n\t\tadd_transition(temp, @start, \"\")\n\t\t@start = temp\n\t\tadd_transition(temp, f1.start, \"\")\n\t\ttemp = new_state\n\t\t@final.keys.sort.each { |x| set_final(x, false) \n\t\tadd_transition(x, temp, \"\") }\n\t\tset_final(temp)\n\t\tf1.final.keys.sort.each { |x| add_transition(x, temp, \"\") }\n\t\tf1.transition.keys.each { |v1| \n f1.transition[v1].keys.each { |v2| \n add_transition(v1, v2, f1.get_transition(v1,v2))\n }\n }\n\t\t@state.delete(nil)\n\t\t@transition.delete(nil)\n end", "title": "" }, { "docid": "80919462d1c13af2f37e151e6ca533c3", "score": "0.5353463", "text": "def failed_states\n states - success_states - transitive_states\n end", "title": "" }, { "docid": "d2b8aeb944e46f52ead0c89762dc3cd5", "score": "0.5348177", "text": "def finished!\n Mua::State::Transition.new(state: self.terminal_states[0])\n end", "title": "" }, { "docid": "0afe9eb013c03698e6c693fcc3cc85d9", "score": "0.5342463", "text": "def reward(state, _action, _next_state)\n state == :stop ? 0 : grid[state[0]][state[1]]\n end", "title": "" }, { "docid": "328788ca3423a6f0eedc3723c6967e48", "score": "0.5341549", "text": "def after_transition(*args, &block); end", "title": "" }, { "docid": "22ec21af79564fc4ec6a1286d689e31a", "score": "0.5316064", "text": "def states\n is = (0...grid.size).to_a\n js = (0...grid.first.size).to_a\n is.product(js).select { |i, j| grid[i][j] } + [:stop]\n end", "title": "" }, { "docid": "cd087c4eb60d0bf6e159f8cd1fb999e6", "score": "0.5311208", "text": "def execute\n mark_states\n @nfa = {\n :initial => 0,\n :final => @final_states,\n :symbols => @symbols,\n :states => (0..@last_state),\n :transitions => @transitions\n }\n end", "title": "" }, { "docid": "a39c4b435bd0838677fa01884e9e996d", "score": "0.53055745", "text": "def update_state_effects\n @state_poptimer[0] += 1 unless primary_state_ani.nil?\n if @state_poptimer[0] == 30\n @animation_id = primary_state_ani\n @animation_id = 0 if @animation_id.nil?\n elsif @state_poptimer[0] == 180\n @state_poptimer[0] = 0\n end\n update_state_action_steps \n end", "title": "" }, { "docid": "c458466c66c21c48567a5943fef3fa63", "score": "0.53051555", "text": "def union! newFA\ns0 = new_state\ns1 = new_state\nadd_transition(s0, @start, \"\")\nadd_transition(s0, newFA.get_start, \"\")\n# reset the final states of the current object\nkeys = @final.keys\ni = 0\nwhile i < keys.size\nadd_transition(keys[i], s1, \"\")\nset_final(keys[i], false)\ni = i + 1\nend\n# set the final states of the other object\nkeys = newFA.get_final\ni = 0\nwhile i < keys.size\nadd_transition(keys[i], s1, \"\")\ni = i + 1\nend\n# copy over the states\nkeys = newFA.get_state\ni = 0\nwhile i < keys.size\nadd_state(keys[i])\ni = i + 1\nend\n# copy over the transitions\nnewFA.get_trans_hash.keys.sort.each { |v1|\nnewFA.get_trans_hash[v1].keys.sort.each { |x|\nv2 = newFA.get_transition(v1,x)\ni = 0\nwhile i < v2.size\nadd_transition(v1, v2[i], x)\ni = i + 1\nend\n}\n}\nset_start(s0)\nset_final(s1, true)\n# copy over the alphabets\nnewFA.get_alpha.each{|a|\nif @alphabet.include?(a) == false\n@alphabet.push(a)\nend\n}\nend", "title": "" }, { "docid": "e833471ba5af56ed2e81cd672f442405", "score": "0.52858603", "text": "def total\n @state[0]*VALUES[0] + @state[1]*VALUES[1] + @state[2]*VALUES[2] + @state[3]*VALUES[3] + @state[4]*VALUES[4]\n end", "title": "" }, { "docid": "46271544c5ba51aa5d3fa06b8fa4f40b", "score": "0.527972", "text": "def done?(state)\n state[:position][0][0] == 0\n end", "title": "" }, { "docid": "d81a1f46f678fd72eaba4baeb91204b8", "score": "0.52724856", "text": "def start_transition\n nil\n end", "title": "" }, { "docid": "c652e6edfe0aa2ec10dd7cb548831345", "score": "0.5271459", "text": "def transition_probability(state, action, next_state)\n if state == :stop || terminii.member?(state)\n action == :stop && next_state == :stop ? 1 : 0\n else\n # agent usually succeeds in moving forward, but sometimes it ends up\n # moving left or right\n move = case action\n when '^' then [['^', 0.8], ['<', 0.1], ['>', 0.1]]\n when '>' then [['>', 0.8], ['^', 0.1], ['v', 0.1]]\n when 'v' then [['v', 0.8], ['<', 0.1], ['>', 0.1]]\n when '<' then [['<', 0.8], ['^', 0.1], ['v', 0.1]]\n end\n move.map do |m, pr|\n m_state = [state[0] + MOVES[m][0], state[1] + MOVES[m][1]]\n m_state = state unless states.member?(m_state) # stay in bounds\n pr if m_state == next_state\n end.compact.inject(:+) || 0\n end\n end", "title": "" }, { "docid": "8430c898ddae6c958728271b37211bbf", "score": "0.5267875", "text": "def transitions\n [\n {:parked => :idling, :on => :ignite},\n {:idling => :first_gear, :first_gear => :second_gear, :on => :shift_up}\n # ...\n ]\n end", "title": "" }, { "docid": "a14862f593a0857324fc425482bedece", "score": "0.5256976", "text": "def extract_valid_transitions\r\n transitions_in_model=Array.new\r\n \t\tself.adjacency_matrix.each_key do |a_state|\r\n\t\t\t if self.adjacency_matrix[a_state].length == 0\r\n\t\t\t \t\t\t # Ignore if no actions, as this is not a transition, just a dead end\r\n else\r\n \t self.adjacency_matrix[a_state].each do |a_transition|\r\n \t transitions_in_model.push a_transition\r\n \tend # end each \t\r\n end # end else\r\n end # end each key\r\n\r\n return transitions_in_model\r\n end", "title": "" }, { "docid": "ff501cfcdb39dd534be26e18b1c756fa", "score": "0.52524394", "text": "def transition\n new_state = fetch_sensor_state\n return if new_state == @state\n puts \"Transitioned from #{@state} to #{new_state}\"\n if valid_transition?(new_state)\n @state = new_state\n # Do nothing\n else\n puts \"Invalid transition!\"\n @beam_broken = 0\n # TODO: toss up the correct error light\n end\n end", "title": "" }, { "docid": "2e7f551fec883c80a1a3f61bc27686b2", "score": "0.52235377", "text": "def state; end", "title": "" }, { "docid": "2e7f551fec883c80a1a3f61bc27686b2", "score": "0.52235377", "text": "def state; end", "title": "" }, { "docid": "2e7f551fec883c80a1a3f61bc27686b2", "score": "0.52235377", "text": "def state; end", "title": "" }, { "docid": "2e7f551fec883c80a1a3f61bc27686b2", "score": "0.52235377", "text": "def state; end", "title": "" }, { "docid": "2e7f551fec883c80a1a3f61bc27686b2", "score": "0.52235377", "text": "def state; end", "title": "" }, { "docid": "2e7f551fec883c80a1a3f61bc27686b2", "score": "0.52235377", "text": "def state; end", "title": "" }, { "docid": "2e7f551fec883c80a1a3f61bc27686b2", "score": "0.52235377", "text": "def state; end", "title": "" }, { "docid": "2e7f551fec883c80a1a3f61bc27686b2", "score": "0.52235377", "text": "def state; end", "title": "" }, { "docid": "303a30fe1d19fa74b9d0e439b02a1560", "score": "0.52161413", "text": "def phase; end", "title": "" }, { "docid": "e4a4f395c4acbee041301f792a0ee6d3", "score": "0.52023757", "text": "def transitions(curr_state = nil, **)\n curr_state = state_value(curr_state)\n next_states = state_table.dig(curr_state, :next)\n Array.wrap(next_states).compact_blank\n end", "title": "" }, { "docid": "3c0c4b63aefe17ecaf7b7ad32a88b770", "score": "0.5194032", "text": "def transitions\n @transitions ||= {}\n end", "title": "" }, { "docid": "42ec7da032574106ce5d07a8ff7244d9", "score": "0.51610833", "text": "def final_states(*states)\n @subject.final_states = states\n end", "title": "" }, { "docid": "3594b9043c3399425f471f81fb275fa7", "score": "0.515993", "text": "def states\n\t[:shelf,:in_use,:borrowed,:misplaced,:lost]\nend", "title": "" }, { "docid": "2d92b0da6f377422a81c87c8fc388d2e", "score": "0.5158976", "text": "def get_transition(v1,x)\nif has_state?(v1)\n@transition[v1][x]\nelse\nnil\nend\nend", "title": "" }, { "docid": "ee1d5dba06aebce331716ad83a8fa123", "score": "0.51530755", "text": "def converge(state) ; end", "title": "" }, { "docid": "2c40f5886240327c0e07cc0377486b58", "score": "0.51404214", "text": "def unflag_row_deltas\n tables.each(&:unflag_row_deltas)\n end", "title": "" }, { "docid": "6cb66e36c2308c2387da79fef9edf200", "score": "0.51395154", "text": "def free\n @state.sum do |row|\n row.count { |square| square == FREE }\n end\n end", "title": "" }, { "docid": "816c31c2a21caa8d3bf0432dcdc5f7cc", "score": "0.51342064", "text": "def states\n states = Set.new([@initial_state])\n @transitions.each { |k,v| states += v.values }\n states\n end", "title": "" }, { "docid": "2c0aa6a8964547ed659b056720d7dfb1", "score": "0.51177794", "text": "def main_end\r\n super\r\n # Execute transition\r\n Graphics.transition(40)\r\n # Prepare for transition\r\n Graphics.freeze\r\n # If battle test\r\n if $BTEST\r\n $scene = nil\r\n end\r\n end", "title": "" }, { "docid": "4810560fe09f2afdd9aa5f42a6ad0292", "score": "0.510656", "text": "def transitions(year); end", "title": "" }, { "docid": "4810560fe09f2afdd9aa5f42a6ad0292", "score": "0.510656", "text": "def transitions(year); end", "title": "" }, { "docid": "8b79cfdc9b38e48b69fc51ed96c07945", "score": "0.51036125", "text": "def state\n active = 0\n my_nodes.each do |n|\n # any node that's error or unknown will cause the whole state to be in the other state\n if n.state < 0 \n return ERROR\n elsif n.state > 0 \n active+=1\n elsif n.state == nil\n return UNKNOWN\n end\n end\n # if all the nodes fall through the tests above then the snapshot is ready or active\n return (active == 0 ? ACTIVE : TRANSITION)\n end", "title": "" }, { "docid": "c9732ceddc74ce59a25ce31864ae839e", "score": "0.50729126", "text": "def flag_row_deltas\n tables.each(&:flag_row_deltas)\n end", "title": "" }, { "docid": "facb589c261ea5ce68c4f8dc31f2d2cf", "score": "0.50688297", "text": "def transition_time\n end", "title": "" }, { "docid": "2d13000981250281e85acbef9edf7a5d", "score": "0.50653076", "text": "def state\n super\n table :cs_rep, ['ident'], ['payload']\n table :cs_meter, ['ident'], ['payload']\n scratch :rmg_can_store, ['ident'], ['payload']\n end", "title": "" }, { "docid": "908a5867eb1b956ed424325ba0edd734", "score": "0.506288", "text": "def succ() end", "title": "" }, { "docid": "908a5867eb1b956ed424325ba0edd734", "score": "0.506288", "text": "def succ() end", "title": "" }, { "docid": "908a5867eb1b956ed424325ba0edd734", "score": "0.506288", "text": "def succ() end", "title": "" }, { "docid": "14a0e7d0ea58c860d774faea260ddec1", "score": "0.50624055", "text": "def state_transitions\n StateTransition.where(record_id: id, record_type: self.class.to_s).order(id: :desc)\n end", "title": "" }, { "docid": "955661c84894500ab31dd19bd9b3d22f", "score": "0.5061938", "text": "def execState\n findNextState\n current_state = @state_list[@state][@transition]\n\n @transition = eval \"#{@state}\"\n @history.push @state\n\n @finished = @state == :finish\n end", "title": "" }, { "docid": "a5cd360d7ebcee43b8e8c8e32fdee34f", "score": "0.505782", "text": "def transitions\n @transitions ||= []\n end", "title": "" }, { "docid": "46561db7453f14b4d42dc39f567b27dc", "score": "0.5055675", "text": "def update_transitions\n from_states.each do |from|\n if (value = machine.transitions[name][from])\n machine.transitions[name][from] = [value, map[from]].flatten\n else\n machine.transitions[name][from] = map[from] || ANY_STATE\n end\n end\n end", "title": "" }, { "docid": "a2168bb5d19b95c45571c48ff11d0ea2", "score": "0.50532365", "text": "def transition(offset_id, timestamp_value); end", "title": "" }, { "docid": "c93230461b490f930883caa3657bc503", "score": "0.5044276", "text": "def start_level\n # clear transition layer\n clear_temporary\n end", "title": "" }, { "docid": "8df53b4e4c5861487e89fc858435586b", "score": "0.50338036", "text": "def expand_transition_table(row)\n (row - @transition_table.size + 1).times do |r|\n @transition_table << {}\n end\n end", "title": "" }, { "docid": "80bc7b48c22dffb8a5177be70d89c33c", "score": "0.5032605", "text": "def rollback\n each {|transition| transition.rollback}\n end", "title": "" }, { "docid": "cf10fb27e03947637dda244dd71a46ce", "score": "0.502155", "text": "def transitions\n @transitions ||= @internal_struct[:transitions] || {}\n end", "title": "" }, { "docid": "56dab4a89cf0c918bfc3886c742f3732", "score": "0.5016229", "text": "def state_removed! statemachine\n transitions_changed!\n end", "title": "" }, { "docid": "a87272671aeb6a75096b1390dd4778dc", "score": "0.5014718", "text": "def generate_state_transiton(state_transtion={})\n if state_transtion == {}\n # default setting is like EC\n states = [\n {state_id: 0, state_name: 'top_page_view', item_type: :no_item, request: '/'},\n {state_id: 1, state_name: 'list_page_view', item_type: :many, request: '/list'},\n {state_id: 2, state_name: 'detail_page_view', item_type: :one, request: '/item'},\n {state_id: 3, state_name: 'item_purchase', item_type: :one, request: '/purchace'}\n ]\n \n start_state = [0]\n\n taranstion = [\n # probability is 0.6 if user transit from top(id:0) to list(id:1) page.\n # transition restrict by item is none.\n {from: 0, to: 1, probability: 0.6, dependent_item: false},\n\n # probability is 0.4 if user transit from list(id:1) to detail(id:2) page\n # \"to state\" item should be choosed \"from state\" items.\n {from: 1, to: 2, probability: 0.4, dependent_item: true},\n \n # probability is 0.2 if user transit from detatil(id:2) to purchase(id:3) page\n # \"to state\" item should be choosed \"from state\" items.\n # after transition to state '3', automatically transition to state \"0\"\n {from: 2, to: 3, probability: 0.2, dependent_item: true, auto_transiton: 0}\n ]\n @start_state, @transitions = start_state, taranstion\n else\n @start_state = state_transtion[:start_state]\n @transitions = state_transtion[:transitions]\n states = state_transtion[:states]\n end\n # convert states\n states_hash = {}\n states.each do |state|\n states_hash[state[:state_id]] = state\n end\n @states = states_hash\n\n # generate auto transiton\n @transitions.each do |transition|\n if transition[:auto_transiton]\n @auto_transiton[transition[:to]] = transition[:auto_transiton]\n end\n end\n end", "title": "" }, { "docid": "cb336de6cf5cf4f49fe564fdb4eb5dcc", "score": "0.50023186", "text": "def main_transition\r\n # Execute transition\r\n if $data_system.battle_transition == \"\"\r\n Graphics.transition(20)\r\n else\r\n Graphics.transition(40, \"Graphics/Transitions/\" +\r\n $data_system.battle_transition)\r\n end\r\n # Start pre-battle phase\r\n start_phase1\r\n end", "title": "" }, { "docid": "ca245618a6c3fb3f7878b6573627ed01", "score": "0.49948356", "text": "def go_sub(num)\n @state = @states[num]\n end", "title": "" }, { "docid": "d23d837f804a6b5db829af1cf3b7a64b", "score": "0.49934676", "text": "def reducer; end", "title": "" }, { "docid": "ddd68cd989f79a7e24a3f4f81c684f28", "score": "0.49767", "text": "def setup_rem_state\n return unless PONY::ERRNO::check_sequence(current_act)\n current_action_targets.each do |target|\n state_id = @acts[1]\n chance = @acts[2] || 100\n chance = chance / 100.0 if c.integer?\n target.remove_state(state_id) if rand < chance\n end\n end", "title": "" }, { "docid": "e7b8a4a8e9a3db788a00e2ddf7aa24fd", "score": "0.49704567", "text": "def states\n no_set_states + set_bonuses\n end", "title": "" }, { "docid": "65626f0ffbe21c765868f550271f3fa8", "score": "0.4968285", "text": "def exit_state\n end", "title": "" }, { "docid": "6949d028983d214ef6285aec67dae959", "score": "0.49624747", "text": "def rollback\n each { |transition| transition.rollback }\n end", "title": "" }, { "docid": "b6b87d0bd473f6c30bc203ab070230c4", "score": "0.4961586", "text": "def reduziere_lebendige_transitionen(lebendig)\n # Prüfe alle Transitionen\n lebendig.transitionen.each do |t|\n # Überspringe t, sofern Übergänge zu t laufen\n next if lebendig.fluss.values.join(', ').include?(t)\n\n # t kommt im Vorbereich mindestens einer Stelle vor\n next unless lebendig.fluss.key?(t)\n\n # Da wir vorher alle Transitionen übersprungen haben, die keinen leeren Vorbereich haben,\n # sind ab hier alle Transitionen lebendig.\n\n # Entferne jede Stelle im Nachbereich von t, mitsamt Übergängen\n lebendig.fluss[t].each do |s|\n lebendig.reduziere_knoten(s)\n end\n\n # Entferne die lebendige Transition t\n lebendig.reduziere_knoten(t)\n\n # Fürs Protokoll\n puts(\"Lebendige Transitionen reduziert!\")\n end\nend", "title": "" }, { "docid": "7ffc9aa5fcf366a6c14691c360bcbefb", "score": "0.49610332", "text": "def derive_offsets(transitions, offsets); end", "title": "" }, { "docid": "7ffc9aa5fcf366a6c14691c360bcbefb", "score": "0.49610332", "text": "def derive_offsets(transitions, offsets); end", "title": "" }, { "docid": "5c3ae42e1e10c1afc6fc9ccb255f23e6", "score": "0.4958078", "text": "def force_final_state\r\n @final_state = true\r\n end", "title": "" }, { "docid": "67b0a03142f81c03b6bd95624f281220", "score": "0.49576372", "text": "def update_sm_with_actions\r\n puts_debug \"Update StateMachine with actions:\"\r\n puts_debug @state_machine.adjacency_matrix\r\n @state_machine.adjacency_matrix.values.each do |trans_array|\r\n trans_array.each do |transition|\r\n puts_debug transition.action\r\n \r\n define_action transition.action\r\n end # each transition\r\n end # each trans array \r\n end", "title": "" }, { "docid": "fc64a1c20c479532c7dd1ad9a9e03c6a", "score": "0.494714", "text": "def dump_table(type = :state, indent_width = 2, indent_level = 2)\r\n # edge_labels = friendly_edge_labels << \" Other\" # I suspect this line is ruining the code.\r\n edge_labels = get_edge_labels << \" Other\"\r\n node_names = get_node_names\r\n \r\n s = \"#{ind(indent_level)}@#{type}_table = \" +\r\n ((type == :action) ? \"\\n#{ind(indent_level+1)}\\# ERROR = 0; MACHINE_ACCEPT = 1; HALT_RETURN = 2\" : \"\") +\r\n \"\\n#{ind(indent_level+1)}#\"\r\n edge_labels.each do |label|\r\n s += sprintf(\"%#{WIDTH+1}s\", label_friendly(label))\r\n end\r\n s += \"\\n#{ind(indent_level+1)}\"\r\n \r\n node_names.each_with_index do |node,ii|\r\n on_last_node = (ii == node_names.size-1)\r\n is_accept = !@accept_states[node].nil?\r\n s += ((ii==0) ? \"[\" : \" \") + \"[\"\r\n \r\n edge_labels.each_with_index do |edge,jj|\r\n on_last_edge = (jj == edge_labels.size-1)\r\n if(@graph_hash[node].nil?||\r\n @graph_hash[node][edge].nil?||@graph_hash[node][edge][0].nil?)\r\n sdest = \"-1\"\r\n adest = ((is_accept) ? HALT_RETURN.to_s : ERROR.to_s)\r\n if(!accept_states[node].nil?)\r\n ldest = ((is_accept) ? (lookup_codes.find_index(accept_states[node]).to_i).to_s : \"0\")\r\n else\r\n ldest = \"0\"\r\n end\r\n else\r\n sdest = graph_hash[node][edge].to_s\r\n adest = MACHINE_ACCEPT.to_s # MA if NON-ACCEPT state\r\n ldest = \"0\"\r\n end\r\n case type\r\n when :state\r\n s += sprintf(\"%#{WIDTH}s\", sdest) + \r\n ((!on_last_edge) ? \",\" \\\r\n : \"]\" + ((!on_last_node) ? \",\" \\\r\n : \"]\" ) + \" \\# #{node}#{(is_accept ? \" ACCEPT\":\"\")}\\n#{ind(indent_level+1)}\")\r\n when :action\r\n s += sprintf(\"%#{WIDTH}s\", adest) + \r\n (!on_last_edge ? \",\" \\\r\n : \"]\" + (!on_last_node ? \",\" \\\r\n : \"]\" ) + \" \\# #{node}#{(is_accept ? \" ACCEPT\" : \"\")}\\n#{ind(indent_level+1)}\")\r\n when :lookup\r\n s += sprintf(\"%#{WIDTH}s\", ldest) + \r\n (!on_last_edge ? \",\" \\\r\n : \"]\" + (!on_last_node ? \",\" \\\r\n : \"]\" ) + \" \\# #{node}#{(is_accept ? \" #{@accept_states[node]}\" : \"\")}\\n#{ind(indent_level+1)}\")\r\n end\r\n end\r\n end\r\n s.rstrip\r\n end", "title": "" }, { "docid": "d636ea13f37e369ba4e5dd4a9691d09d", "score": "0.49357703", "text": "def next states\n raise \"Must be implemented by subclass\"\n end", "title": "" }, { "docid": "035380851e4b0482056fb43c7498e37c", "score": "0.4929767", "text": "def transition\n newMap = []\n for x in 0...@map.length do\n for y in 0...@map[x].length do\n if !newMap[x]\n newMap[x] = []\n end\n if !newMap[x][y]\n newMap[x][y] = @map[x][y]\n end\n numAlive = neighbors(x, y).reduce(0) { |a, c| c == 1 ? a + 1 : a }\n if numAlive < 2\n newMap[x][y] = 0 # death by under population\n elsif numAlive > 3\n newMap[x][y] = 0 # death by over population\n elsif @map[x][y] == 0 and numAlive == 3\n newMap[x][y] = 1 # alive by reproduction\n end\n end\n end\n @map = newMap\n end", "title": "" }, { "docid": "cae761eeaada273d38dfc8dafd948b73", "score": "0.4925796", "text": "def next_state\n newstate = state_transition_out\n newiteration = @iteration\n if [:day, :signup].include?(@state)\n newiteration = @iteration + 1\n end\n @state = newstate\n @iteration = newiteration\n #state_transition_in\n @state\n end", "title": "" }, { "docid": "f7803b7f9ec64ba59545cbbf4455a8bf", "score": "0.492318", "text": "def emit_finish_mutations\n finish = node.finish\n #emit_self(negative_infinity, finish)\n emit_self(nan, finish)\n end", "title": "" }, { "docid": "5eb973be4e4cc6036b6cddc959dba2f8", "score": "0.4921991", "text": "def generate_initial_state\n @state.each_with_index do |row, row_index|\n end\n end", "title": "" }, { "docid": "1858be35de3e5ffad6805ba368594f4a", "score": "0.49218357", "text": "def final?\n @transitions.empty?\n end", "title": "" }, { "docid": "50462365072d7b42a7ea34e4b1486482", "score": "0.4919685", "text": "def steps_before_repeat_state_naive\n\t\t# state = {}\n\t\tsteps = 0\n\t\torig = @moons_pos.to_s\n\t\tzero_vel = [0, 0, 0]\n\t\tstarting_time = Time.now\n\t\tp @moons_pos\n\t\twhile (42)\n\t\t\tsleep(1)\n\t\t\t# state.has_key?(@moons_pos.to_s) ? break : state[@moons_pos.to_s] = true\n\n\t\t\tapply_gravity_to_velocity\n\t\t\tapply_velocity_to_position\n\t\t\tsteps += 1\n\t\t\tp @moons_pos\n\t\t\tbreak if velocity(:io) == zero_vel && @moons_pos.to_s == orig\n\t\tend\n\t\tsteps\n\tend", "title": "" }, { "docid": "f012679e0e16fe52d695c1b82830fa0a", "score": "0.49154374", "text": "def resetStates()\r\n @players.each do |player|\r\n if(player.money > 0)\r\n player.state = \"fine\"\r\n else\r\n player.state = \"broke\"\r\n end\r\n end\r\n end", "title": "" }, { "docid": "079a1ad15998977e09c722836e894924", "score": "0.49153164", "text": "def actions(state)\n if state == :stop || terminii.member?(state)\n [:stop]\n else\n MOVES.keys\n end\n end", "title": "" } ]
0ebf33273975bd2aeb4112f77b3c03dd
For backwards compatibility removing in 1.0
[ { "docid": "5f1b8c5c400e6a73c3f60ce0dec6d568", "score": "0.0", "text": "def current_page #:nodoc:\n page = OpenStruct.new\n page.url = @current_url\n page.http_method = @http_method\n page.data = @data\n page\n end", "title": "" } ]
[ { "docid": "ae835b718242a27843cf0b0934dec1a4", "score": "0.7205462", "text": "def legacy_deprecations; end", "title": "" }, { "docid": "d1b856784af0feb1cac827a81be20c9d", "score": "0.7028347", "text": "def deprecation; end", "title": "" }, { "docid": "77b0c109415e0f3e761fd3df7d4dff39", "score": "0.68628293", "text": "def deprecated; end", "title": "" }, { "docid": "77b0c109415e0f3e761fd3df7d4dff39", "score": "0.68628293", "text": "def deprecated; end", "title": "" }, { "docid": "77b0c109415e0f3e761fd3df7d4dff39", "score": "0.68628293", "text": "def deprecated; end", "title": "" }, { "docid": "77b0c109415e0f3e761fd3df7d4dff39", "score": "0.68628293", "text": "def deprecated; end", "title": "" }, { "docid": "77b0c109415e0f3e761fd3df7d4dff39", "score": "0.68628293", "text": "def deprecated; end", "title": "" }, { "docid": "6b36ed13bd965c436b61ca68e369bd9c", "score": "0.6792313", "text": "def old; end", "title": "" }, { "docid": "b9a1cd5a3228e8bc02063b710c7c309a", "score": "0.67907083", "text": "def obsolete; end", "title": "" }, { "docid": "7db0727baf89eb76beac27c515d7fe32", "score": "0.6658586", "text": "def support; end", "title": "" }, { "docid": "73068497a6ac43af09c4f919b5de0290", "score": "0.6619038", "text": "def obsolete?; end", "title": "" }, { "docid": "bec3ad3d7a2f8e71dd0c0b7205220fb7", "score": "0.66122764", "text": "def legacy_deprecations=(_arg0); end", "title": "" }, { "docid": "e649c20190a1bf05acdf49bb89865c2b", "score": "0.6591476", "text": "def deprecated=(_); end", "title": "" }, { "docid": "e649c20190a1bf05acdf49bb89865c2b", "score": "0.6591476", "text": "def deprecated=(_); end", "title": "" }, { "docid": "6ab77a9219ee157923bc58599ba6aa77", "score": "0.65882087", "text": "def in_use; end", "title": "" }, { "docid": "6ab77a9219ee157923bc58599ba6aa77", "score": "0.65882087", "text": "def in_use; end", "title": "" }, { "docid": "feb51464e074644cba82a0f4d8e156f9", "score": "0.658491", "text": "def version_support; end", "title": "" }, { "docid": "7b648fdf921d6fbe886c47d0ea48692d", "score": "0.6572553", "text": "def deprecation_warn; end", "title": "" }, { "docid": "baabe5bb658b17a85353fb66fdbbf873", "score": "0.6537839", "text": "def extended; end", "title": "" }, { "docid": "f19e675535030e797892e4483b8dd8e0", "score": "0.6517521", "text": "def support_deprecated_config; end", "title": "" }, { "docid": "f19e675535030e797892e4483b8dd8e0", "score": "0.6517521", "text": "def support_deprecated_config; end", "title": "" }, { "docid": "0c860d341b57fa9168894e792350480f", "score": "0.6454886", "text": "def missingimpl; end", "title": "" }, { "docid": "6a6ed5368f43a25fb9264e65117fa7d1", "score": "0.63997644", "text": "def internal; end", "title": "" }, { "docid": "6afdccea65606a5378730a1ad58f9298", "score": "0.63780373", "text": "def obsolete=(_arg0); end", "title": "" }, { "docid": "2290804b238fc95bfd6b38f87c6d2895", "score": "0.63493013", "text": "def override; end", "title": "" }, { "docid": "f4d35d22dd639821840a0c6fbf98114e", "score": "0.6294692", "text": "def on_conflict_behavior; end", "title": "" }, { "docid": "cd9721dfb069da263e33514281e55ed8", "score": "0.6282956", "text": "def disable_monkey_patching!; end", "title": "" }, { "docid": "5a848e1a78e814f4addafb82445f2b93", "score": "0.6229279", "text": "def version; 1; end", "title": "" }, { "docid": "5a848e1a78e814f4addafb82445f2b93", "score": "0.6229279", "text": "def version; 1; end", "title": "" }, { "docid": "5a848e1a78e814f4addafb82445f2b93", "score": "0.6229279", "text": "def version; 1; end", "title": "" }, { "docid": "5a848e1a78e814f4addafb82445f2b93", "score": "0.6229279", "text": "def version; 1; end", "title": "" }, { "docid": "5a848e1a78e814f4addafb82445f2b93", "score": "0.6229279", "text": "def version; 1; end", "title": "" }, { "docid": "bb051e7236766c4c83c230e2590713b4", "score": "0.62284124", "text": "def version_supplied; end", "title": "" }, { "docid": "9dcc74dd11eb115d21bf9af45b3ec4e3", "score": "0.6223088", "text": "def bodystmt; end", "title": "" }, { "docid": "9dcc74dd11eb115d21bf9af45b3ec4e3", "score": "0.6223088", "text": "def bodystmt; end", "title": "" }, { "docid": "9dcc74dd11eb115d21bf9af45b3ec4e3", "score": "0.6223088", "text": "def bodystmt; end", "title": "" }, { "docid": "9dcc74dd11eb115d21bf9af45b3ec4e3", "score": "0.6223088", "text": "def bodystmt; end", "title": "" }, { "docid": "9dcc74dd11eb115d21bf9af45b3ec4e3", "score": "0.6223088", "text": "def bodystmt; end", "title": "" }, { "docid": "9dcc74dd11eb115d21bf9af45b3ec4e3", "score": "0.6223088", "text": "def bodystmt; end", "title": "" }, { "docid": "8b608597e4f8cb342968a26900959e68", "score": "0.61855483", "text": "def extended?; end", "title": "" }, { "docid": "8b3569b219e99d9eac85050822f6f885", "score": "0.6167758", "text": "def wrappers; end", "title": "" }, { "docid": "45b9e5d1da1562a27f15ce5cb9b634ca", "score": "0.6159546", "text": "def ext; end", "title": "" }, { "docid": "58e2e07d11b107b6864a328f2187e248", "score": "0.61550623", "text": "def apop?; end", "title": "" }, { "docid": "c9dca2359e04038394b1c66d5d923fa2", "score": "0.6118396", "text": "def wrapped; end", "title": "" }, { "docid": "c9dca2359e04038394b1c66d5d923fa2", "score": "0.6118396", "text": "def wrapped; end", "title": "" }, { "docid": "c9dca2359e04038394b1c66d5d923fa2", "score": "0.6118396", "text": "def wrapped; end", "title": "" }, { "docid": "c9dca2359e04038394b1c66d5d923fa2", "score": "0.6118396", "text": "def wrapped; end", "title": "" }, { "docid": "286991ce1dc16ae01cde25107f48ed30", "score": "0.6117623", "text": "def deprecation_stream; end", "title": "" }, { "docid": "286991ce1dc16ae01cde25107f48ed30", "score": "0.6117623", "text": "def deprecation_stream; end", "title": "" }, { "docid": "286991ce1dc16ae01cde25107f48ed30", "score": "0.6117623", "text": "def deprecation_stream; end", "title": "" }, { "docid": "286991ce1dc16ae01cde25107f48ed30", "score": "0.6117623", "text": "def deprecation_stream; end", "title": "" }, { "docid": "9de4306501711176ab8084b28395030d", "score": "0.609171", "text": "def module; end", "title": "" }, { "docid": "c3285b979f713395f60cf13edce8a310", "score": "0.6091052", "text": "def methodmissing; end", "title": "" }, { "docid": "fb26c7ad205460690e5f3d91431625ca", "score": "0.6089219", "text": "def adapter; end", "title": "" }, { "docid": "fb26c7ad205460690e5f3d91431625ca", "score": "0.6089219", "text": "def adapter; end", "title": "" }, { "docid": "fb26c7ad205460690e5f3d91431625ca", "score": "0.6089219", "text": "def adapter; end", "title": "" }, { "docid": "fb26c7ad205460690e5f3d91431625ca", "score": "0.6089219", "text": "def adapter; end", "title": "" }, { "docid": "fb26c7ad205460690e5f3d91431625ca", "score": "0.6089219", "text": "def adapter; end", "title": "" }, { "docid": "a29c5ce532d6df480df4217790bc5fc7", "score": "0.6079566", "text": "def extra; end", "title": "" }, { "docid": "a29c5ce532d6df480df4217790bc5fc7", "score": "0.6079566", "text": "def extra; end", "title": "" }, { "docid": "a29c5ce532d6df480df4217790bc5fc7", "score": "0.6079566", "text": "def extra; end", "title": "" }, { "docid": "a29c5ce532d6df480df4217790bc5fc7", "score": "0.6079566", "text": "def extra; end", "title": "" }, { "docid": "b6b2bcc0062aeb115edab7b10cbe6930", "score": "0.60712487", "text": "def desired; end", "title": "" }, { "docid": "14187174b07e4c51e8d38b1dd3593d4a", "score": "0.6038246", "text": "def macro; raise NotImplementedError; end", "title": "" }, { "docid": "14187174b07e4c51e8d38b1dd3593d4a", "score": "0.6038246", "text": "def macro; raise NotImplementedError; end", "title": "" }, { "docid": "14187174b07e4c51e8d38b1dd3593d4a", "score": "0.6038246", "text": "def macro; raise NotImplementedError; end", "title": "" }, { "docid": "e174f2df0828cb4d6a4a89af03ea808b", "score": "0.60357654", "text": "def extend; end", "title": "" }, { "docid": "e174f2df0828cb4d6a4a89af03ea808b", "score": "0.60357654", "text": "def extend; end", "title": "" }, { "docid": "e174f2df0828cb4d6a4a89af03ea808b", "score": "0.60357654", "text": "def extend; end", "title": "" }, { "docid": "e174f2df0828cb4d6a4a89af03ea808b", "score": "0.60357654", "text": "def extend; end", "title": "" }, { "docid": "f20473284a2311111e1b322c0ab5070c", "score": "0.6035133", "text": "def native; end", "title": "" }, { "docid": "f20473284a2311111e1b322c0ab5070c", "score": "0.6035133", "text": "def native; end", "title": "" }, { "docid": "e810b5d51ce652ddba97f0cb8366d5a7", "score": "0.6034474", "text": "def include_version; end", "title": "" }, { "docid": "e810b5d51ce652ddba97f0cb8366d5a7", "score": "0.6034474", "text": "def include_version; end", "title": "" }, { "docid": "e810b5d51ce652ddba97f0cb8366d5a7", "score": "0.6034474", "text": "def include_version; end", "title": "" }, { "docid": "3660c5f35373aec34a5a7b0869a4a8bd", "score": "0.6019985", "text": "def implementation; end", "title": "" }, { "docid": "3660c5f35373aec34a5a7b0869a4a8bd", "score": "0.6019985", "text": "def implementation; end", "title": "" }, { "docid": "3660c5f35373aec34a5a7b0869a4a8bd", "score": "0.6019985", "text": "def implementation; end", "title": "" }, { "docid": "3660c5f35373aec34a5a7b0869a4a8bd", "score": "0.6019985", "text": "def implementation; end", "title": "" }, { "docid": "3660c5f35373aec34a5a7b0869a4a8bd", "score": "0.6019985", "text": "def implementation; end", "title": "" }, { "docid": "4e7f63d2e8327143b97af38c6fce7a24", "score": "0.6019769", "text": "def original; end", "title": "" }, { "docid": "4e7f63d2e8327143b97af38c6fce7a24", "score": "0.6019769", "text": "def original; end", "title": "" }, { "docid": "4e7f63d2e8327143b97af38c6fce7a24", "score": "0.6019769", "text": "def original; end", "title": "" }, { "docid": "4e7f63d2e8327143b97af38c6fce7a24", "score": "0.6019769", "text": "def original; end", "title": "" }, { "docid": "27001ed7d91f44c53e23fca81794eccc", "score": "0.60048485", "text": "def oldmtd\n\t\"old improved method\"\nend", "title": "" }, { "docid": "33e1db3c06643dd523dcc31fccf3a005", "score": "0.59910315", "text": "def used; end", "title": "" }, { "docid": "33e1db3c06643dd523dcc31fccf3a005", "score": "0.59910315", "text": "def used; end", "title": "" }, { "docid": "f311ccc4af8cac1e8337d1581352913f", "score": "0.5971002", "text": "def dependency; end", "title": "" }, { "docid": "f311ccc4af8cac1e8337d1581352913f", "score": "0.5971002", "text": "def dependency; end", "title": "" }, { "docid": "4463b65c57e07f544d0288a8a3deba80", "score": "0.5967495", "text": "def external; end", "title": "" }, { "docid": "bb2cf20999efd9fcacf7668301ebe565", "score": "0.5956972", "text": "def missing; end", "title": "" }, { "docid": "bb2cf20999efd9fcacf7668301ebe565", "score": "0.5956972", "text": "def missing; end", "title": "" }, { "docid": "1125fdeab58606c9af842c5ba20caae0", "score": "0.59463966", "text": "def renamable?; end", "title": "" }, { "docid": "4ea6f5c11a3bc16e2394d273e748b292", "score": "0.5935277", "text": "def internal?; end", "title": "" }, { "docid": "15d52f513334b78dc6b0967d7f614969", "score": "0.5916839", "text": "def support_code; end", "title": "" }, { "docid": "15d52f513334b78dc6b0967d7f614969", "score": "0.5916839", "text": "def support_code; end", "title": "" }, { "docid": "7a6afd7e29131d8ce08124ba4af541c1", "score": "0.58970976", "text": "def version=(_); end", "title": "" }, { "docid": "7a6afd7e29131d8ce08124ba4af541c1", "score": "0.58970976", "text": "def version=(_); end", "title": "" }, { "docid": "2811397aefca145cecd731fd0748b1e6", "score": "0.58958995", "text": "def preparable; end", "title": "" }, { "docid": "2811397aefca145cecd731fd0748b1e6", "score": "0.58958995", "text": "def preparable; end", "title": "" }, { "docid": "2811397aefca145cecd731fd0748b1e6", "score": "0.58958995", "text": "def preparable; end", "title": "" } ]
b72747ae5b9453b652cf0c19bcb75d31
PATCH/PUT /goalies/1 PATCH/PUT /goalies/1.json
[ { "docid": "f898d3b8b7ba0339f741d559119d4f3e", "score": "0.68035483", "text": "def update\n respond_to do |format|\n if @goalie.update(goaly_params)\n format.html { redirect_to @goalie, notice: 'Goalie was successfully updated.' }\n format.json { render :show, status: :ok, location: @goalie }\n else\n format.html { render :edit }\n format.json { render json: @goalie.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "c1ce37391efb1725d5ad8dfc631e0c25", "score": "0.68725854", "text": "def update\n @goal = Goal.find(params[:id])\n\n respond_to do |format|\n if @goal.update_attributes(params[:goal])\n format.html { redirect_to @goal, notice: 'Goal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c1ce37391efb1725d5ad8dfc631e0c25", "score": "0.68725854", "text": "def update\n @goal = Goal.find(params[:id])\n\n respond_to do |format|\n if @goal.update_attributes(params[:goal])\n format.html { redirect_to @goal, notice: 'Goal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c1ce37391efb1725d5ad8dfc631e0c25", "score": "0.68725854", "text": "def update\n @goal = Goal.find(params[:id])\n\n respond_to do |format|\n if @goal.update_attributes(params[:goal])\n format.html { redirect_to @goal, notice: 'Goal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dd5642a234beb0f953537ad5732ea08d", "score": "0.6862116", "text": "def update\n @goal = Goal.find(params[:id])\n\n respond_to do |format|\n if @goal.update_attributes(params[:goal])\n format.html { redirect_to welcome_home_path, notice: 'Goal was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5eea1b8fd12864429064b0714f3640b5", "score": "0.6850882", "text": "def update\n respond_to do |format|\n if @goal.update_attributes(params[:goal])\n format.html { redirect_to @goal, notice: 'Goal was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0160a07acfc233ba2f4b2306dcf02200", "score": "0.6800565", "text": "def update\n respond_to do |format|\n if @goal.update(goal_params)\n format.html { redirect_to @goal, notice: 'Goal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0160a07acfc233ba2f4b2306dcf02200", "score": "0.6800565", "text": "def update\n respond_to do |format|\n if @goal.update(goal_params)\n format.html { redirect_to @goal, notice: 'Goal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0160a07acfc233ba2f4b2306dcf02200", "score": "0.6800565", "text": "def update\n respond_to do |format|\n if @goal.update(goal_params)\n format.html { redirect_to @goal, notice: 'Goal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "45981f111ede5aa6dba54a23ae72c8a8", "score": "0.679799", "text": "def update\n respond_to do |format|\n if @goalie.update(goalie_params)\n format.html { redirect_to @goalie, notice: 'Goalie was successfully updated.' }\n format.json { render :show, status: :ok, location: @goalie }\n else\n format.html { render :edit }\n format.json { render json: @goalie.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "45981f111ede5aa6dba54a23ae72c8a8", "score": "0.679799", "text": "def update\n respond_to do |format|\n if @goalie.update(goalie_params)\n format.html { redirect_to @goalie, notice: 'Goalie was successfully updated.' }\n format.json { render :show, status: :ok, location: @goalie }\n else\n format.html { render :edit }\n format.json { render json: @goalie.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2028b93260fcf75039bd5993a5d43886", "score": "0.6784497", "text": "def update\n respond_to do |format|\n if @goal.update(goal_params)\n format.html { redirect_to new_goal_path, notice: 'Goal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ffe018214fb176e9cbba13c0e8c1efc7", "score": "0.6712481", "text": "def update\n respond_to do |format|\n if @goal.update(goal_params)\n format.html { redirect_to @goal, notice: 'Goal goal was successfully updated.' }\n format.json { render :show, status: :ok, location: @goal }\n else\n format.html { render :edit }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c042ad4d6d29aaae7728dba75fcd079d", "score": "0.67090696", "text": "def update\n respond_to do |format|\n if @goal.update(goal_params)\n format.html { redirect_to @goal, notice: 'Goal was successfully updated.' }\n format.json { render :show, status: :ok, location: @goal }\n else\n format.html { render :edit }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c042ad4d6d29aaae7728dba75fcd079d", "score": "0.67090696", "text": "def update\n respond_to do |format|\n if @goal.update(goal_params)\n format.html { redirect_to @goal, notice: 'Goal was successfully updated.' }\n format.json { render :show, status: :ok, location: @goal }\n else\n format.html { render :edit }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c042ad4d6d29aaae7728dba75fcd079d", "score": "0.67090696", "text": "def update\n respond_to do |format|\n if @goal.update(goal_params)\n format.html { redirect_to @goal, notice: 'Goal was successfully updated.' }\n format.json { render :show, status: :ok, location: @goal }\n else\n format.html { render :edit }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c042ad4d6d29aaae7728dba75fcd079d", "score": "0.67090696", "text": "def update\n respond_to do |format|\n if @goal.update(goal_params)\n format.html { redirect_to @goal, notice: 'Goal was successfully updated.' }\n format.json { render :show, status: :ok, location: @goal }\n else\n format.html { render :edit }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c042ad4d6d29aaae7728dba75fcd079d", "score": "0.67090696", "text": "def update\n respond_to do |format|\n if @goal.update(goal_params)\n format.html { redirect_to @goal, notice: 'Goal was successfully updated.' }\n format.json { render :show, status: :ok, location: @goal }\n else\n format.html { render :edit }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c042ad4d6d29aaae7728dba75fcd079d", "score": "0.67090696", "text": "def update\n respond_to do |format|\n if @goal.update(goal_params)\n format.html { redirect_to @goal, notice: 'Goal was successfully updated.' }\n format.json { render :show, status: :ok, location: @goal }\n else\n format.html { render :edit }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c042ad4d6d29aaae7728dba75fcd079d", "score": "0.67090696", "text": "def update\n respond_to do |format|\n if @goal.update(goal_params)\n format.html { redirect_to @goal, notice: 'Goal was successfully updated.' }\n format.json { render :show, status: :ok, location: @goal }\n else\n format.html { render :edit }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c042ad4d6d29aaae7728dba75fcd079d", "score": "0.67090696", "text": "def update\n respond_to do |format|\n if @goal.update(goal_params)\n format.html { redirect_to @goal, notice: 'Goal was successfully updated.' }\n format.json { render :show, status: :ok, location: @goal }\n else\n format.html { render :edit }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c042ad4d6d29aaae7728dba75fcd079d", "score": "0.67090696", "text": "def update\n respond_to do |format|\n if @goal.update(goal_params)\n format.html { redirect_to @goal, notice: 'Goal was successfully updated.' }\n format.json { render :show, status: :ok, location: @goal }\n else\n format.html { render :edit }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c042ad4d6d29aaae7728dba75fcd079d", "score": "0.67090696", "text": "def update\n respond_to do |format|\n if @goal.update(goal_params)\n format.html { redirect_to @goal, notice: 'Goal was successfully updated.' }\n format.json { render :show, status: :ok, location: @goal }\n else\n format.html { render :edit }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c1b0c529a224b620c75599b0288f8599", "score": "0.66923904", "text": "def update\n respond_to do |format|\n if @goal.update(goal_params)\n format.html { redirect_to @goal, notice: \"Goal was successfully updated.\" }\n format.json { render :show, status: :ok, location: @goal }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "94babfb8b9e25c0d3b12b1e0470b238a", "score": "0.6687197", "text": "def update\n respond_to do |format|\n if @goal.update(goal_params)\n format.html { redirect_to goal_path(@goal), notice: 'Goal was successfully updated.' }\n format.json { render :show, status: :ok, location: @goal }\n else\n format.html { render :edit }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dd1ea3753c30c858625ea9d51da496f3", "score": "0.6676311", "text": "def update\n respond_to do |format|\n if @goal.update(goal_params)\n format.html { redirect_to goals_path, notice: 'Goal was successfully updated.' }\n format.json { render :show, status: :ok, location: @goal }\n else\n format.html { render :edit }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0341337f5e186db943337714116630ee", "score": "0.6649968", "text": "def update\n\n @goals = Goal.all\n @my_custom_goals = my_custom_goals\n @user_goal = my_goals.find(params[:id])\n\n respond_to do |format|\n if @user_goal.update_attributes(params[:users_goal])\n format.html { redirect_to action: 'new', notice: 'Users goal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_goal.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5523e16ec9ec9a2eef994f120537a971", "score": "0.66414756", "text": "def update\r\n respond_to do |format|\r\n if @goal.update(goal_params)\r\n format.html { redirect_to @goal, notice: 'Goal was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @goal }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @goal.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "title": "" }, { "docid": "839bb9481431e42313a298ac81472d94", "score": "0.66319156", "text": "def update\n # expire_action :action => :index\n # cache_key = \"views/tmp/cache/goals\"\n # Rails.cache.delete(cache_key)\n\n @goal = Goal.find(params[:id])\n\n respond_to do |format|\n if @goal.update_attributes(params[:goal])\n format.html { redirect_to @goal, notice: 'Goal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0b41b07b4a04bc240de1ee17721aee79", "score": "0.6630884", "text": "def update\n respond_to do |format|\n if @goal.update(goal_params)\n format.html { redirect_to '/misc_tasks', notice: 'Goal was successfully updated.' }\n format.json { render :show, status: :ok, location: @goal }\n else\n format.html { render :edit }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "23fb3b28fa137017da47242ba8f9282c", "score": "0.6626176", "text": "def update\n respond_to do |format|\n if @goal_update.update(goal_update_params)\n format.html { redirect_to [@goal, @goal_update], notice: 'Goal update was successfully updated.' }\n format.json { render :show, status: :ok, location: @goal_update }\n else\n format.html { render :edit }\n format.json { render json: @goal_update.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c3370acf2ca3457b954e16e32da81d0d", "score": "0.6566661", "text": "def update\n if @goal.update(goal_params)\n render :show, status: :ok, location: @goal\n else\n render json: @goal.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "8b3db7f98fe4afb7cec5e16af968e789", "score": "0.65032935", "text": "def update\n @goal = Goal.find(params[:id])\n\n respond_to do |format|\n if @goal.update_attributes(params[:goal])\n format.html { redirect_to(@goal, :notice => 'Goal was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @goal.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2572fb900123dab962d92dfd5cd31505", "score": "0.64812994", "text": "def update\n spice = Spice.find_by(id: params[:id])\n spice.update(spice_params)\n render json: spice\nend", "title": "" }, { "docid": "577ca3b5e132f3de28ca0632f6f0e2df", "score": "0.6462259", "text": "def update\n respond_to do |format|\n if @team_goal.update(team_goal_params)\n format.html { redirect_to @team_goal, notice: 'Team goal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @team_goal.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "89210cf1608444259b1f363004c7f534", "score": "0.64463437", "text": "def update\n respond_to do |format|\n if @goal.update(goal_params)\n format.html { redirect_to :goals, \n notice: \"<p>Your goal was successfully updated. Go get it!</p>#{view_context.tweet_your_goal_button(@goal)}\".html_safe }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fe34f93da0751ad55cc5052cfdd2366c", "score": "0.6445594", "text": "def update\n render json: Person.update(params[\"id\"], params[\"person\"])\n end", "title": "" }, { "docid": "211c936b732cc0cd3795a5b00db1b029", "score": "0.6424852", "text": "def update\n @field_goal = FieldGoal.find(params[:id])\n\n respond_to do |format|\n if @field_goal.update_attributes(params[:field_goal])\n format.html { redirect_to @field_goal, notice: 'Field goal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @field_goal.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8238da563a2387a0ff4fd5d7b4a90cf9", "score": "0.6417314", "text": "def update\n respond_to do |format|\n if @project_goal.update(project_goal_params)\n format.html { redirect_to @project_goal, notice: 'Project goal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @project_goal.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3d0b8ab6ca934df2c11603833a753246", "score": "0.6401038", "text": "def update\n @goat = Goat.find(params[:id])\n\n if @goat.update(goat_params)\n head :no_content\n else\n render json: @goat.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "cfbbaf073f5e472b8fc42737750c2df9", "score": "0.6399149", "text": "def update\n @life_goal = LifeGoal.find(params[:id])\n @life_goal.update_attributes(params[:life_goal])\n redirect_to_index_or_todo_list\n end", "title": "" }, { "docid": "8ab1a81e354fd489aea4a42b5ad43ff9", "score": "0.63926166", "text": "def update\n @goal = Goal.find(params[:id])\n\n respond_to do |format|\n if @goal.update_attributes(params[:goal])\n flash[:notice] = 'Goal was successfully updated.'\n format.html { redirect_to(@goal) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @goal.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cedb3640c83abdb0d74679ae63d52675", "score": "0.63532096", "text": "def update\n if logged_in?\n goal = Goal.find_by(:title => params[:goal_title])\n make_user_goal(current_user, goal)\n goal_details = goal_values_calculate(goal)\n respond_to do |format|\n format.json { render :json => goal_details }\n end\n \n else\n redirect_to login_path, status: 303\n end\n end", "title": "" }, { "docid": "5aead7658d0ad211b633e235058a500b", "score": "0.63367534", "text": "def update\n @goal = current_user.goals.find(params[:id])\n\n respond_to do |format|\n if @goal.update_attributes(params[:goal])\n format.html { redirect_to(@goal, :notice => 'Goal was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @goal.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7b71c09d13e4fce54860b15b8cffc626", "score": "0.63363117", "text": "def update\n @activitygoal = Activitygoal.find(params[:id])\n\n respond_to do |format|\n if @activitygoal.update_attributes(params[:activitygoal])\n format.html { redirect_to @activitygoal, notice: 'Activitygoal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activitygoal.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "94ec8ed920ef9fd119b3295c2a4b3541", "score": "0.63261884", "text": "def update\n unless params[:goal].try(:fetch,:due_on,nil).nil?\n params[:goal][:due_on] = Date.parse(params[:goal][:due_on])\n end\n respond_to do |format|\n if @goal.update_attributes(params[:goal])\n format.json { render :json => jeditable_result(@goal,true) }\n format.html { redirect_to(@goal, :notice => t('goals.update.success')) }\n format.xml { head :ok }\n else\n edit # run edit method for variables needed in form.\n format.json { render :json => jeditable_result(@goal, false)}\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @goal.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f4ce503def2eec85a4630c78187f3e9a", "score": "0.63106996", "text": "def update\n @goal = Goal.find(params[:id])\n @client = @goal.client\n @goal_categories = GoalCategory.all\n @visit = Visit.find(params[:visit_id])\n\n respond_to do |format|\n if @goal.update_attributes(params[:goal])\n @goal_state = @goal.getGoalStateForVisit(@visit)\n if @goal_state == nil\n saveGoalState(@goal.current_value, @goal.current_expenditures, @visit, @goal)\n else\n @goal_state.updateState(@goal.current_value, @goal.current_expenditures)\n @goal_state.save\n end\n\n format.html { redirect_to client_visits_path(@goal.client), notice: 'Goal was successfully updated.' }\n format.json { head :no_content }\n format.js\n else\n format.html { redirect_to client_visits_path(@goal.client) }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n format.js { render \"show\" }\n end\n end\n end", "title": "" }, { "docid": "25ea692b7f280ab4c8100d42676ef854", "score": "0.6307195", "text": "def update\n @food_promise = FoodPromise.find(params[:id])\n\n respond_to do |format|\n if @food_promise.update_attributes(params[:food_promise])\n format.html { redirect_to @food_promise, notice: 'Food item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @food_promise.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b15a752b1e7c93a667ff22585e16affd", "score": "0.6299645", "text": "def update\n goal = Goal.find_by(\"id\" => params[\"id\"])\n goal.update(\"outcome\" => params[\"outcome\"])\n redirect_to \"/efforts\"\n end", "title": "" }, { "docid": "3dde3bb8955e126ae783dbeb81aedaae", "score": "0.6299324", "text": "def update\n @goal = Goal.find(params[:id])\n raise PermissionViolation unless @goal.updatable_by?(current_user)\n\n respond_to do |format|\n if @goal.update_attributes(params[:goal])\n format.html { redirect_to @goal, notice: 'Goal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ae3b6ce932b5c74861fa141009494507", "score": "0.6286792", "text": "def update\n @goal_progress = GoalProgress.find(params[:id])\n\n respond_to do |format|\n if @goal_progress.update_attributes(params[:goal_progress])\n format.html { redirect_to @goal_progress, notice: 'Goal progress was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @goal_progress.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "861440739a03bf71a9799b579decb959", "score": "0.6281625", "text": "def update\n if @goal.has_parent?\n redirect_url = @goal.parent_url\n else\n redirect_url = request.referer || goals_url # redirect to referring page\n end\n\n respond_to do |format|\n if @goal.update(goal_params)\n format.html { redirect_to redirect_url, notice: 'Goal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d2b313c08e09dd56b0611287e63d9787", "score": "0.6260162", "text": "def update\n @hackathon = Hackathon.find(params[:id])\n\n respond_to do |format|\n if @hackathon.update_attributes(params[:hackathon])\n format.html { redirect_to @hackathon, notice: 'Hackathon was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hackathon.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e8cfdce5b0eeeba4fc38e063721573ed", "score": "0.6259966", "text": "def update\n @jogo = Jogo.find(params[:id])\n \n respond_to do |format|\n if (@jogo.update_attributes(params[:jogo]))\n \n # format.json { render :json => { :success => true, :jogo_id => @jogo.id, :perguntas => new_perguntas, :respostas => new_respostas }, :status => :created, :location => @jogo }\n\n format.html { redirect_to @jogo, :notice => 'Jogo was successfully updated.' }\n else\n render :edit\n end\n end\n end", "title": "" }, { "docid": "23c5ca1cfbd615a9427eb46d1fcc0b6f", "score": "0.6248912", "text": "def update\n respond_to do |format|\n if @goal.update(goal_params)\n format.html { redirect_to goals_path, notice: 'Цель успешно изменена.' }\n else\n format.html { render :edit }\n end\n end\n end", "title": "" }, { "docid": "70e7b5b412ee0f25b45f87f7f1179ec9", "score": "0.62429124", "text": "def update\n @ped_goal = PedGoal.find(params[:id])\n\n respond_to do |format|\n if @ped_goal.update_attributes(params[:ped_goal])\n format.html { redirect_to @ped_goal, notice: 'Ped goal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ped_goal.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fa6eb1ae651d1f6551965c5056fdbc27", "score": "0.6237152", "text": "def update\n @goal = @user.goals.find(params[:id])\n\t@goal.update_attributes!(params[:goal])\n\t@goal.create_activity :update, owner: current_user\n respond_to do |format|\n\t\tformat.html {redirect_to user_goals_url(@user)}\n\t\tformat.js\n\tend\n \n \n end", "title": "" }, { "docid": "b46b6014f42ad700c9919db45965c10f", "score": "0.6228504", "text": "def update\n respond_to do |format|\n if @goal.update(goal_params.merge(user_id: current_user.id))\n format.html { redirect_to goals_url, notice: I18n.t(:edit, scope: [:generic, :confirmation]) }\n format.json { render :show, status: :ok, location: @goal }\n else\n format.html { render :edit }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c1ecba0331a66357fa8dfa22cdc568f6", "score": "0.6218614", "text": "def update\n respond_to do |format|\n if @user_goal.update(user_goal_params)\n format.html { redirect_to @user_goal, notice: 'User goal was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_goal }\n else\n format.html { render :edit }\n format.json { render json: @user_goal.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b07e9d64f1986e180bb991feb8fb6f83", "score": "0.62185", "text": "def update\n @goal = Goal.find(params[:id])\n @goal.condition_id=0 unless @goal.condition_id\n @goal.measure_id=0 unless @goal.measure_id\n respond_to do |format|\n if @goal.update_attributes(params[:goal])\n flash[:notice] = 'Goal was successfully updated.'\n format.html { redirect_to(:action=>\"index\") }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @goal.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b2a6f09336e93b98c5153a36f59cd001", "score": "0.62019026", "text": "def update\n @mgoal = Mgoal.find(params[:id])\n\n respond_to do |format|\n if @mgoal.update_attributes(params[:mgoal])\n format.html { redirect_to @mgoal, notice: 'Mgoal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mgoal.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2ece03308a0d62c1d86d55f632637b44", "score": "0.6199133", "text": "def update\n @sgoal = Sgoal.find(params[:id])\n\n respond_to do |format|\n if @sgoal.update_attributes(params[:sgoal])\n format.html { redirect_to @sgoal, notice: 'Sgoal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sgoal.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "233fcd201b3c7f568ecae565fa9dce80", "score": "0.61946136", "text": "def update\n respond_to do |format|\n if @health_goal.update(health_goal_params)\n format.html { redirect_to @health_goal, notice: 'Health goal was successfully updated.' }\n format.json { render :show, status: :ok, location: @health_goal }\n else\n format.html { render :edit }\n format.json { render json: @health_goal.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7ae5969f9bff6ff64ce84fd97c73ccb1", "score": "0.6179699", "text": "def update\n respond_to do |format|\n if @awesome.update(awesome_params)\n format.html { redirect_to @awesome, notice: 'Awesome was successfully updated.' }\n format.json { render :show, status: :ok, location: @awesome }\n else\n format.html { render :edit }\n format.json { render json: @awesome.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4bafd6db07983daa97163294b9f3f077", "score": "0.61772627", "text": "def update\n respond_to do |format|\n if @strategic_goal.update(strategic_goal_params)\n format.html { redirect_to @strategic_goal, notice: 'Strategic goal was successfully updated.' }\n format.json { render :show, status: :ok, location: @strategic_goal }\n else\n format.html { render :edit }\n format.json { render json: @strategic_goal.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bebd6e8e869a99b12ef14686532d07e8", "score": "0.6176744", "text": "def update\n respond_to do |format|\n if @page_goal.update(page_goal_params)\n format.html { redirect_to @page_goal, notice: 'Page goal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @page_goal.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "14c831741ac71491403c6e5f859a5dd7", "score": "0.6175031", "text": "def update\n @goal_instance = GoalInstance.find(params[:id])\n\n respond_to do |format|\n if @goal_instance.update_attributes(params[:goal_instance])\n format.html { redirect_to @goal_instance, notice: 'Goal instance was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @goal_instance.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7b5d938237acba50842b16ec49a3e79b", "score": "0.6173282", "text": "def update\n if @hackathon.update(hackathon_params)\n render :show, status: :ok, location: @hackathon\n else\n render json: @hackathon.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "7f7c16b9e14f1352bb07fd27f83679a7", "score": "0.61727", "text": "def patch(path, params: {}, headers: {})\n request_json :patch, path, params, headers\n end", "title": "" }, { "docid": "0eb8e6c83b0244f8817c55ecf146efae", "score": "0.61674863", "text": "def update\n @thief_talent = ThiefTalent.find(params[:id])\n\n if @thief_talent.update(thief_talent_params)\n head :no_content\n else\n render json: @thief_talent.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "8762d73cffb9b115d5d73b5d237c5370", "score": "0.6157227", "text": "def update\n @goal = Goal.find_by_id params[:id]\n if @goal.update_attributes params[:goal]\n redirect_to :action => 'show', :id => @goal.id\n else\n flash[:error] = 'Could not save changes to the goal.'\n redirect_to :action => 'edit', :id => params[:id]\n end\n end", "title": "" }, { "docid": "81967e06032609de095588c6ec0cef2f", "score": "0.6157062", "text": "def update\n @step.update(step_params)\n render json: @step\n end", "title": "" }, { "docid": "f2ff0f092d2327e5a3cd354934d621c6", "score": "0.61533445", "text": "def update\n respond_to do |format|\n if @budget_goal.update(budget_goal_params)\n format.html { redirect_to @budget_goal, notice: 'Budget goal was successfully updated.' }\n format.json { render :show, status: :ok, location: @budget_goal }\n else\n format.html { render :edit }\n format.json { render json: @budget_goal.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "abce1dfbfa7adc8a127622108f732a95", "score": "0.6145585", "text": "def update_person(api, cookie, perstoupdate, person)\n pers_id = perstoupdate['id']\n option_hash = { content_type: :json, accept: :json, cookies: cookie }\n pers = nil\n res = api[\"people/#{pers_id}\"].patch person.to_json, option_hash unless $dryrun\n if res&.code == 201\n pers = JSON.parse(res.body)\n end\n pers\nend", "title": "" }, { "docid": "3242ffb6c6a2c5f0f9abe0ff5863794a", "score": "0.6142567", "text": "def update\n @list = List.find(params[:list_id])\n @goal = @list.goals.find(params[:id])\n\n respond_to do |format|\n if @goal.update_attributes(params[:goal])\n format.html { redirect_to list_goal_url(@list, @goal), notice: 'goal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fb2f7b247f16c356c4c1e7ebe626dcf1", "score": "0.614101", "text": "def update\n @goals = Goals.find(params[:id])\n\n respond_to do |format|\n if @goals.update_attributes(params[:goals])\n flash[:notice] = 'Goals was successfully updated.'\n format.html { redirect_to(@goals) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @goals.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "40f35768cf7c6d257f1c621c983fdbce", "score": "0.61342126", "text": "def update\n @participant = Participant__c.find(request[:participant_id])\n @fitness_goal = Fitness_Goal__c.find(params[:id])\n\n params[:fitness_goal__c].keys.each do |key|\n @fitness_goal[key] = params[:fitness_goal__c][key]\n puts \"---\" + params[:fitness_goal__c][key]\n end\n\n result = @fitness_goal.save\n puts result\n\n respond_to do |format|\n if result\n format.html { redirect_to [@participant, @fitness_goal], notice: 'Fitness goal was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @participant.fitness_goal.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a9226a523309225598228fe67203738d", "score": "0.6129534", "text": "def update\n @goal = Goal.find(params[:id])\n\n if @goal.update(run_params)\n head :no_content\n else\n render json: @goal.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "11980563ef5fc92429b487e93e3d0ef4", "score": "0.6115186", "text": "def update\n @coachgoal = Coachgoal.find(params[:id])\n\n respond_to do |format|\n if @coachgoal.update_attributes(params[:coachgoal])\n flash[:notice] = 'Coachgoal was successfully updated.'\n format.html { redirect_to(@coachgoal) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @coachgoal.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e6968baae8cfeafc3a03929821d2f4c8", "score": "0.611317", "text": "def update\n respond_to do |format|\n if @goal_skill.update(goal_skill_params)\n format.html { redirect_to @goal_skill, notice: 'Goal skill was successfully updated.' }\n format.json { render :show, status: :ok, location: @goal_skill }\n else\n format.html { render :edit }\n format.json { render json: @goal_skill.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9f927d84edb7577ca088aed859f22940", "score": "0.6103527", "text": "def update\n respond_to do |format|\n if @operational_goal.update(operational_goal_params)\n format.html { redirect_to @operational_goal, notice: 'Operational goal was successfully updated.' }\n format.json { render :show, status: :ok, location: @operational_goal }\n else\n format.html { render :edit }\n format.json { render json: @operational_goal.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6c9a58ffaf016fdd16f67aafa493e026", "score": "0.61018103", "text": "def update\n @thingy = Thingy.find(params[:id])\n\n respond_to do |format|\n if @thingy.update_attributes(params[:thingy])\n format.html { redirect_to @thingy, notice: 'Thingy was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @thingy.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "56252ded715e5809e913993bf65901cb", "score": "0.6096026", "text": "def update\n @goal = Goal.find(params[:id])\n a = params[:users][0].to_i\n unless a==0\n @goal.assign_to = a\n end\n respond_to do |format|\n if @goal.update_attributes(params[:goal])\n format.html { redirect_to @goal, :notice => 'Goal was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @goal.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "41cdfc9209bcacfdec7d7afc40011d16", "score": "0.6082953", "text": "def update\n @yeti = Yeti.find(params[:id])\n\n respond_to do |format|\n if @yeti.update_attributes(params[:yeti])\n format.html { redirect_to yetis_url }\n else\n format.html { render action: \"edit\" }\n end\n end\n end", "title": "" }, { "docid": "1e779e8f9ae1ba68b47495ac0b85f1d8", "score": "0.6081711", "text": "def update\n authorize @goal\n if @goal.update(goal_params)\n redirect_to edit_goal_path(@goal), notice: \"The goal was updated successfully\"\n else\n render 'edit'\n end\n end", "title": "" }, { "docid": "47abb2cddfa1a665018f717cdaaa4164", "score": "0.6060834", "text": "def update!(params)\n res = @client.put(path, {}, params, \"Content-Type\" => \"application/json\")\n\n @attributes = res.json if res.status == 201\n end", "title": "" }, { "docid": "1c35f89f4e93251128bbf53c08021b3d", "score": "0.6055787", "text": "def update\n @company_id = company_params[:company_id]\n @reponse = HTTParty.put(\"https://rails-api-ipo.herokuapp.com/api/v1/companies/#{@company_id}.json\",\n :body => {:company_name => company_params[:company_name]}.to_json,\n :headers => { 'Content-Type' => 'application/json' } )\n respond_to do |format|\n format.html { redirect_to '/companies/'+(@reponse['id'].to_s), notice: 'Company was successfully created.' }\n end\n end", "title": "" }, { "docid": "c775faed49515affa5ccb7dee6939803", "score": "0.6054849", "text": "def update\n @toy = Toy.find(params[:id])\n\n respond_to do |format|\n if @toy.update_attributes(params[:toy])\n format.html { redirect_to @toy, notice: 'Toy was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @toy.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "db4ae434cb8c00abfbff7270adf3f272", "score": "0.6049192", "text": "def update\n @jogo = Jogo.find(params[:id])\n\n respond_to do |format|\n if @jogo.update_attributes(params[:jogo])\n format.html { redirect_to @jogo, :notice => 'Jogo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @jogo.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "71c24cd355c769bd29c129296065806a", "score": "0.60487884", "text": "def update\n @energy_goal = EnergyGoal.find(params[:id])\n\n respond_to do |format|\n if @energy_goal.update_attributes(params[:energy_goal])\n format.html { redirect_to welcome_index_url, notice: 'Energieeffizienzziel erfolgreich aktualisiert.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @energy_goal.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "548ba1babbcdb78511c04a317bf5c979", "score": "0.6046532", "text": "def update\n json_update(factType,factType_params, FactType)\n end", "title": "" }, { "docid": "2bc252056c49f17b57320d2b2b0fe6f6", "score": "0.6041643", "text": "def update\n respond_to do |format|\n if @pony.update(pony_params)\n format.html { redirect_to @pony, notice: \"Pony was successfully updated.\" }\n format.json { render :show, status: :ok, location: @pony }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @pony.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4befeb358e0e476d376e6ecc60741717", "score": "0.60323846", "text": "def update\n respond_to do |format|\n if @pool_member.update(pool_member_params)\n if @pool_member.goalie1.present?\n Goalie.where(team: @pool_member.goalie1).each do |goalie|\n goalie.update(pool_member_id: params[:id])\n end\n end\n\n if @pool_member.goalie2.present?\n Goalie.where(team: @pool_member.goalie2).each do |goalie|\n goalie.update(pool_member_id: params[:id])\n end\n end\n\n format.html { redirect_to pool_pool_members_path, notice: 'Pool member was successfully updated.' }\n format.json { render :show, status: :ok, location: @pool_member }\n else\n format.html { render :edit }\n format.json { render json: @pool_member.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e5a67ae1f4f60c9bd594be9dd388b53b", "score": "0.60315585", "text": "def update\n respond_to do |format|\n if @pony.update(pony_params)\n format.html { redirect_to @pony, notice: 'Pony was successfully updated.' }\n format.json { render :show, status: :ok, location: @pony }\n else\n format.html { render :edit }\n format.json { render json: @pony.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a289fdcc315cb93ec1df78ed425dae7f", "score": "0.6027173", "text": "def update\n respond_to do |format|\n if @clothing.update(clothing_params)\n format.html { redirect_to @clothing, notice: t('clothings.update.edit') }\n format.json { render :show, status: :ok, location: @clothing }\n else\n format.html { render :edit }\n format.json { render json: @clothing.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "450eb1229e3a0e021086dda35d705e1e", "score": "0.6025179", "text": "def update\n @badgeship = Badgeship.find(params[:id])\n\n respond_to do |format|\n if @badgeship.update_attributes(params[:badgeship])\n format.html { redirect_to @badgeship, notice: 'Badgeship was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @badgeship.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0191651825fb511238c277f49147dbf4", "score": "0.60216635", "text": "def update\n @journy = Journy.find(params[:id])\n\n respond_to do |format|\n if @journy.update_attributes(params[:journy])\n format.html { redirect_to @journy, notice: 'Journy was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @journy.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6b8362cf3c3016b077f46bb4837f6e84", "score": "0.60183394", "text": "def update\n respond_to do |format|\n if @thingie.update(thingie_params)\n format.html { redirect_to admin_thingies_path, notice: 'thingie was successfully updated.' }\n format.json { render :show, status: :ok, location: @thingie }\n else\n format.html { render :edit }\n format.json { render json: @thingie.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ce6852704631d5365ff588de119b07d2", "score": "0.601681", "text": "def update\n respond_to do |format|\n if @goal_progress.update(goal_progress_params)\n format.html { redirect_to @goal_progress, notice: 'Progress was successfully updated.' }\n format.json { render :show, status: :ok, location: @goal_progress }\n else\n format.html { render :edit }\n format.json { render json: @goal_progress.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "929c3d5441bcc776286ef6ce5e471afc", "score": "0.60157603", "text": "def update\n respond_to do |format|\n if @foody.update(foody_params)\n format.html { redirect_to @foody, notice: 'Foody was successfully updated.' }\n format.json { render :show, status: :ok, location: @foody }\n else\n format.html { render :edit }\n format.json { render json: @foody.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3790d814a36a5a88f9dea5b0d7d99da9", "score": "0.6015308", "text": "def update # PATCH '/movements/:movement_id/guides/:id' => 'guides#update'\n render json: @guide, status: 200 if @guide.update_attributes(permitted_attributes(@guide))\n end", "title": "" } ]
f37792ac7d97988807fde68cf10d33ca
Does database support the nowait clause? Values are :nw_supported and :nw_unsupported
[ { "docid": "f60f1dbfcf0d0f781d777972d241495a", "score": "0.7302862", "text": "def nowait_support\n case __ub1(OCI_ATTR_NOWAIT_SUPPORT)\n when 0; :nw_supported\n when 1; :nw_unsupported\n end\n end", "title": "" } ]
[ { "docid": "1538e27fd748a97cc44dff0ab14a5990", "score": "0.6441089", "text": "def nowait?\n attr_get_ub1(OCI_ATTR_CONN_NOWAIT) != 0\n end", "title": "" }, { "docid": "1538e27fd748a97cc44dff0ab14a5990", "score": "0.6441089", "text": "def nowait?\n attr_get_ub1(OCI_ATTR_CONN_NOWAIT) != 0\n end", "title": "" }, { "docid": "3897a424cbbc13b2fa9b189576ad25ad", "score": "0.61701834", "text": "def chrono_supported?\n postgresql_version >= 90000\n end", "title": "" }, { "docid": "7d521b19478a083b3fc443b095130d6b", "score": "0.6169447", "text": "def chrono_supported?\n postgresql_version >= 90300\n end", "title": "" }, { "docid": "7d521b19478a083b3fc443b095130d6b", "score": "0.6169447", "text": "def chrono_supported?\n postgresql_version >= 90300\n end", "title": "" }, { "docid": "5fa0e359feb8798f011ff824eb1d7d15", "score": "0.61372036", "text": "def blocking?\n\t\t\tnot available?\n\t\tend", "title": "" }, { "docid": "fc1bc8015b3757511bbaac51ae9af3fc", "score": "0.6106264", "text": "def supports_timestamp_usecs?\n db.supports_timestamp_usecs?\n end", "title": "" }, { "docid": "b3a63e79e1747c8b5a39c6c58f1f432d", "score": "0.61009693", "text": "def any_waiting?; end", "title": "" }, { "docid": "be7ff76bb71d8334b4bd41ab53bca7eb", "score": "0.60133636", "text": "def available?\n !(available_on.nil? || available_on.future?)\n end", "title": "" }, { "docid": "c0f4a5a7a3593e899fb4836da90e9625", "score": "0.5948167", "text": "def active?\n @connection.execute(\"SELECT 1\").finish\n true\n rescue DBI::DatabaseError, DBI::InterfaceError\n false\n end", "title": "" }, { "docid": "65dd388d4627dd15221cea7bf33444ff", "score": "0.5834426", "text": "def supports_fetch_next_rows?\n server_version >= 12000000 && !(@opts[:lock] || @opts[:skip_locked])\n end", "title": "" }, { "docid": "db8e03ee714537fa1fafac87fa8bb9ed", "score": "0.58188087", "text": "def isnonblocking\n 1 == Libpq.PQisnonblocking(pg_conn)\n end", "title": "" }, { "docid": "4be50482d530448a04417913c4e4a88c", "score": "0.58145374", "text": "def available?\n !(available_on.nil? || available_on.future?) && !deleted?\n end", "title": "" }, { "docid": "c50434ad24dd6ea8da7d0c8ab9a8aee6", "score": "0.5797323", "text": "def strait?\n strait_exeption? || range? ? true : false\n end", "title": "" }, { "docid": "90f7b1245d3f0375af99a1a2d4a7efaf", "score": "0.5774886", "text": "def available?\n future.fulfilled?\n end", "title": "" }, { "docid": "788997996d366860025ab6104f9b1802", "score": "0.5768903", "text": "def supports_transaction_isolation?\n version[0] >= 5\n end", "title": "" }, { "docid": "09f3b91055bab3680aa0c13c72ad697a", "score": "0.5741871", "text": "def is_db_selected?\n @connection != nil and not @connection.finished?\n end", "title": "" }, { "docid": "f552c2fbb5930866cab6d921b8dfe3fa", "score": "0.57406986", "text": "def database_exception_use_sqlstates?\n false\n end", "title": "" }, { "docid": "5d12198a51acc9667eac4b5b70336166", "score": "0.5730876", "text": "def blocking?; end", "title": "" }, { "docid": "cf6a8d1897542834439e8ef78727a884", "score": "0.5700963", "text": "def supports_prepared_transactions?\n server_version >= 50000\n end", "title": "" }, { "docid": "0a9bd71437dc1cfa00c730dc5ad83aa5", "score": "0.56888926", "text": "def isnonblocking()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "b135c28b354be3aac8b66fb042c0e924", "score": "0.5683811", "text": "def database_exception_use_sqlstates?\n true\n end", "title": "" }, { "docid": "f61eb7ce8028f3b5fb96c78eb5d7c300", "score": "0.5682651", "text": "def supports_transaction_isolation?\n false\n end", "title": "" }, { "docid": "963361f3e7795330c1e726d322521981", "score": "0.5666899", "text": "def supports_transaction_isolation?; end", "title": "" }, { "docid": "034d26b1ea708dd51ca06ac1ea4c6b4d", "score": "0.565991", "text": "def isnonblocking; end", "title": "" }, { "docid": "6774b79f73348bdf49ef647766d373b2", "score": "0.56597394", "text": "def active?\n compute_timeout < @timeout\n end", "title": "" }, { "docid": "4c486e7620827b7ff8f80d457dca73f7", "score": "0.5647999", "text": "def available_now?\n available?(DateTime.now)\n end", "title": "" }, { "docid": "446c9642536d44f9762f88f204219187", "score": "0.5642102", "text": "def suspended?()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "e932cc82b0a8b8575e032ad0baae6845", "score": "0.5619768", "text": "def supports_timestamp_usecs?\n false\n end", "title": "" }, { "docid": "78fa85f889d4416065556d2a7392f017", "score": "0.5610561", "text": "def is_busy()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "3944e50346a059b5a92aae5a64df283d", "score": "0.5585018", "text": "def active_connection?; end", "title": "" }, { "docid": "72c14fd8dc0e1b28f5f26bc998db1359", "score": "0.55812347", "text": "def supports_transaction_isolation?\n true\n end", "title": "" }, { "docid": "a23ab801313ac64afde50a411a409946", "score": "0.5571579", "text": "def pending?; end", "title": "" }, { "docid": "a23ab801313ac64afde50a411a409946", "score": "0.5571579", "text": "def pending?; end", "title": "" }, { "docid": "a23ab801313ac64afde50a411a409946", "score": "0.5571579", "text": "def pending?; end", "title": "" }, { "docid": "a23ab801313ac64afde50a411a409946", "score": "0.5571579", "text": "def pending?; end", "title": "" }, { "docid": "a23ab801313ac64afde50a411a409946", "score": "0.5571579", "text": "def pending?; end", "title": "" }, { "docid": "4ebdad2176a042422d95b1afa3ead2a5", "score": "0.5568447", "text": "def is_busy\n 1 == Libpq.PQisBusy(pg_conn)\n end", "title": "" }, { "docid": "db8cdfaa7b388f83f6f055167b0c6d63", "score": "0.55576783", "text": "def is_available?\n true\n end", "title": "" }, { "docid": "e5b71655ab4cfef0d0948576ed790a2a", "score": "0.5551141", "text": "def no_wait_poll; end", "title": "" }, { "docid": "801bb0a6fea4d4c798bc8448cc309373", "score": "0.55465037", "text": "def wait_until_available\n loop_if = if @config[\"create_cluster\"]\n Proc.new { cloud_desc(use_cache: false).status != \"available\" }\n else\n Proc.new { cloud_desc(use_cache: false).db_instance_status != \"available\" }\n end\n MU.retrier(wait: 10, max: 360, loop_if: loop_if) { |retries, _wait|\n if retries > 0 and retries % 20 == 0\n MU.log \"Waiting for RDS #{@config['create_cluster'] ? \"cluster\" : \"database\" } #{@cloud_id} to be ready...\", MU::NOTICE\n end\n }\n end", "title": "" }, { "docid": "70e3c06aeffaf4f6c839f3ba5183302c", "score": "0.5546372", "text": "def waiting?\n true\n end", "title": "" }, { "docid": "86f5ed705ce45182f7b9f96f99f1ef12", "score": "0.5539662", "text": "def is_available\n\t\treturn true\n end", "title": "" }, { "docid": "ecbec6a38bca334d60f21f6318eb77ec", "score": "0.5523923", "text": "def busy?(connection)\n raise \"Should be implemented in child class\"\n end", "title": "" }, { "docid": "327cbd864c72d272f5aca20f10dc55d5", "score": "0.5519538", "text": "def application_ok?\n ActiveRecord::Base.connection_pool.with_connection(&:active?)\n end", "title": "" }, { "docid": "41a5b1a6826231bd73eeee5c2c34a9bd", "score": "0.5519516", "text": "def available?\n state.eql? 'closed'\n end", "title": "" }, { "docid": "22411a01468dae3415a361dc3edbc71e", "score": "0.55100733", "text": "def active?\n @connection.do \"SELECT 1 FROM DUMMY\"\n true\n rescue ODBC::Error\n false\n end", "title": "" }, { "docid": "e486d75d1e75720d5dae540691dc4726", "score": "0.55078876", "text": "def test_available_for_read?\n return true if select_for_read?\n\n idle!\n false\n end", "title": "" }, { "docid": "8e39be5a1e285cd90ab0901983823c60", "score": "0.5506158", "text": "def work_featurable?\n false\n end", "title": "" }, { "docid": "cb1f797a50002027f2d46fb16de52bad", "score": "0.5500106", "text": "def active?\n !deleted? && available_on.present? ? available_on <= Time.now : false\n end", "title": "" }, { "docid": "43e9d716a0e3cd4030425f6a59677ae9", "score": "0.54993325", "text": "def should_enque?(time); end", "title": "" }, { "docid": "166e82c3d8bf43e707aaaf17ea131b14", "score": "0.5496212", "text": "def supports_advisory_locks?; end", "title": "" }, { "docid": "71fad80571cda1bdd0876dcd9dc983f1", "score": "0.54947627", "text": "def allow_waiting_for_data_state?\n current_state == \"data_to_be_requested\"\n end", "title": "" }, { "docid": "ae51fa9994a93232f154a013bfd0d2f0", "score": "0.5492361", "text": "def blocking?\n return !@timeout.nil?\n end", "title": "" }, { "docid": "074cca7b2c8dfdd02f0bb69d0f61df85", "score": "0.54904515", "text": "def active?\n @connection.run('SELECT TRUE AS active')\n end", "title": "" }, { "docid": "10fef5351cb5c15116c7cc12da7c1f49", "score": "0.5487141", "text": "def status_will_change?\n queued? || running?\n end", "title": "" }, { "docid": "757366b06d652d732f71a6ff4b20e89f", "score": "0.54851925", "text": "def supports_timestamp_usecs?\n true\n end", "title": "" }, { "docid": "757366b06d652d732f71a6ff4b20e89f", "score": "0.54851925", "text": "def supports_timestamp_usecs?\n true\n end", "title": "" }, { "docid": "e7dbeb10fbf812c08e00b2cd76bf874d", "score": "0.5483932", "text": "def is_blocked?\n @migration.cluster_running_maxed_out?\n end", "title": "" }, { "docid": "8b159fe0c3060d6dcab6849fb4031596", "score": "0.5475588", "text": "def active?\n @connection.query 'SELECT 1'\n true\n rescue PGError\n false\n end", "title": "" }, { "docid": "8b159fe0c3060d6dcab6849fb4031596", "score": "0.5475588", "text": "def active?\n @connection.query 'SELECT 1'\n true\n rescue PGError\n false\n end", "title": "" }, { "docid": "907e9765259f083a71b0ebf61956f3a0", "score": "0.5472457", "text": "def available; end", "title": "" }, { "docid": "907e9765259f083a71b0ebf61956f3a0", "score": "0.5472457", "text": "def available; end", "title": "" }, { "docid": "907e9765259f083a71b0ebf61956f3a0", "score": "0.5472457", "text": "def available; end", "title": "" }, { "docid": "907e9765259f083a71b0ebf61956f3a0", "score": "0.5472457", "text": "def available; end", "title": "" }, { "docid": "16f4528f5f75d4a111a59da688a93f57", "score": "0.5469159", "text": "def supports_isolation_levels?\n false\n end", "title": "" }, { "docid": "fc3357ca2d4d69440dcd019625b9b90a", "score": "0.54675865", "text": "def ready?\n active? and not running? \n end", "title": "" }, { "docid": "056239e4ceb2d049e968750a3fa79b06", "score": "0.54487765", "text": "def pending?\n false\n end", "title": "" }, { "docid": "b6012c68c6904733494e8a61e0262380", "score": "0.5439582", "text": "def with_exclusively_acquired_all_connections(raise_on_acquisition_timeout = T.unsafe(nil)); end", "title": "" }, { "docid": "d3d5187f68d66ade85ec8d95dc067e3a", "score": "0.5436803", "text": "def select_for_reading?\n true unless (@close_scheduled || @close_requested)\n end", "title": "" }, { "docid": "d3d5187f68d66ade85ec8d95dc067e3a", "score": "0.5436803", "text": "def select_for_reading?\n true unless (@close_scheduled || @close_requested)\n end", "title": "" }, { "docid": "2f4220db16fad6706c076f5286f971d8", "score": "0.54365975", "text": "def ongoing_support?\n\t\tlogger.debug \"found ongoing support = #{ongoing_support}\"\n\t\tongoing_support\n\tend", "title": "" }, { "docid": "91437c4e7b5648d02b8039e8ddbc7fdd", "score": "0.54219955", "text": "def active?\n return false unless @connection\n\n raw_connection_do \"SELECT 1\"\n true\n rescue *connection_errors\n false\n end", "title": "" }, { "docid": "aa397ba7f2c93e21d823c1ecee46b705", "score": "0.5418642", "text": "def available?\n return false\n end", "title": "" }, { "docid": "aa397ba7f2c93e21d823c1ecee46b705", "score": "0.5418642", "text": "def available?\n return false\n end", "title": "" }, { "docid": "dd9ae968968e2f03eafb3fd9aadbfa64", "score": "0.54177994", "text": "def ready_to_execute?\n (while_condition? == true) && !(unfixed_error?)\n end", "title": "" }, { "docid": "d3792870254353ae6de66bc948d67a40", "score": "0.54173565", "text": "def supports_ddl_transactions?\n false\n end", "title": "" }, { "docid": "d3792870254353ae6de66bc948d67a40", "score": "0.54173565", "text": "def supports_ddl_transactions?\n false\n end", "title": "" }, { "docid": "fae76521b540be3673995ea37435d369", "score": "0.54163134", "text": "def active?\n @lock.synchronize do\n return false unless @raw_connection\n @raw_connection.query \";\"\n end\n true\n rescue PG::Error\n false\n end", "title": "" }, { "docid": "841292bf48ae1d4087efd6ca89f2d1f3", "score": "0.540831", "text": "def wait_until_not_full; end", "title": "" }, { "docid": "21886d60342bde89e7bffdbab8760b1b", "score": "0.54076046", "text": "def alive?\n listening_on? 5432\n end", "title": "" }, { "docid": "62600107fc49cea8bf9ad5ba79dcd6ac", "score": "0.5407011", "text": "def autocommit?\n raise NoMethodError, \"Not implemented for this raw driver\"\n end", "title": "" }, { "docid": "8cf6f3d2f9343a153c05fdd315f71889", "score": "0.5404063", "text": "def queued?\n raise NotImplementedError\n end", "title": "" }, { "docid": "54ddf7a0feb9690f4d077d4b89be6d78", "score": "0.53974754", "text": "def supports_ddl_transactions?\n false\n end", "title": "" }, { "docid": "54ddf7a0feb9690f4d077d4b89be6d78", "score": "0.53974754", "text": "def supports_ddl_transactions?\n false\n end", "title": "" }, { "docid": "b39f872a79c72bb566f058bbf357a6ab", "score": "0.5366215", "text": "def available?\n available_boole = !(available_on.nil? || available_on.future?) && !deleted? && !discontinued? \n publish! if available_boole && draft? \n available_boole \n end", "title": "" }, { "docid": "8bc9ce618efaafceedecce58f48f40dd", "score": "0.5363769", "text": "def available?\n false\n end", "title": "" }, { "docid": "abc9bf40a8cb65d5b933f3add58147ab", "score": "0.5360315", "text": "def trigger_stale?(trigger)\r\n false\r\n end", "title": "" }, { "docid": "36dfa25e00cb94894f8dbe0b03fccfc5", "score": "0.5352688", "text": "def active?\n return false unless @connection.open?\n # return true if @connection.transaction_started\n @connection.query(\"SELECT 1 FROM RDB$DATABASE\")\n true\n rescue\n false\n end", "title": "" }, { "docid": "ba51fbd063637cc91f640abf2eca430c", "score": "0.5345639", "text": "def available_online?\n pseudo_facet?('available_online')\n end", "title": "" }, { "docid": "0241c42455221a4080a78c3e22f40cae", "score": "0.53436595", "text": "def async_isnonblocking; end", "title": "" }, { "docid": "18db2f0914b533f5ac197e39739008d8", "score": "0.5341265", "text": "def future?\n DateTime.now < kick_off\n end", "title": "" }, { "docid": "16b84bf765b8eddce8628a70952f9392", "score": "0.5338908", "text": "def pending?() return(@state == :pending); end", "title": "" }, { "docid": "113885edab590f45a0758620489bdb79", "score": "0.5334547", "text": "def supports_ddl_transactions?; end", "title": "" }, { "docid": "6eaebe4608133685eb8ba102c5de4aa7", "score": "0.5332236", "text": "def wait_until_ready\n # this method may be left unimplemented if that is applicablelog\n end", "title": "" }, { "docid": "068dbaf4e7f87a2cce9fb916720a9718", "score": "0.5330443", "text": "def stale?\n breaker.run(fallback: -> { false }) do\n connection { |redis| redis.exists?(naming.body) && redis.ttl(naming.head) < 0 }\n end\n end", "title": "" }, { "docid": "eb4504e9ce0b005d150ea64f2dfc848d", "score": "0.53294677", "text": "def pending?\n false\n end", "title": "" }, { "docid": "eb4504e9ce0b005d150ea64f2dfc848d", "score": "0.53294677", "text": "def pending?\n false\n end", "title": "" }, { "docid": "b1f9163210c43c3b97a1f3bba11fbf95", "score": "0.53281313", "text": "def ready?\n num_alive < @max_run\n end", "title": "" }, { "docid": "e791880ea8e4bbb7b24a970a6de7cb98", "score": "0.5328052", "text": "def currently_stuck?\n !!stuck_on\n end", "title": "" } ]
dc18d91ef5701e8be5b24dd575ce7e10
get current page's resource by template.current_piece
[ { "docid": "71248535fd947ca4adc0c826ba9cd254", "score": "0.0", "text": "def resources()\n objs = []\n data_source = self.template_tag.current_piece.data_source\n if data_source.present?\n if data_source == 'gpvs'\n #objs = menu.products\n #copy from taxons_controller#show\n @searcher = Spree::Config.searcher_class.new({:taxon => menu.id})\n #@searcher.current_user = try_spree_current_user\n #@searcher.current_currency = current_currency\n objs = @searcher.retrieve_products\n elsif data_source == 'this_product'\n #default_taxon.id is 0 \n objs = [self.resource] #menu.products.where(:id=>resource.id) \n end\n if objs.present?\n objs = Products.new( self.page_generator, objs)\n end\n end\n objs\n end", "title": "" } ]
[ { "docid": "6fd991f620a6b60db760b41592cd3ec3", "score": "0.68942505", "text": "def current_resource\n return nil unless current_path\n sitemap.find_resource_by_destination_path(current_path)\n end", "title": "" }, { "docid": "79f412256c413e798b20d311dd430a16", "score": "0.6732544", "text": "def current_resource\n instance_variable_get(:\"@#{resource_name}\")\n end", "title": "" }, { "docid": "9d01e69bd9e334a42236123e6d482ac2", "score": "0.66998476", "text": "def page\n\t\t\t\t\tsend(current_template)\n\t\t\t\tend", "title": "" }, { "docid": "9d01e69bd9e334a42236123e6d482ac2", "score": "0.66998476", "text": "def page\n\t\t\t\t\tsend(current_template)\n\t\t\t\tend", "title": "" }, { "docid": "ef58723df7be6273a6683d0b1499d028", "score": "0.66640186", "text": "def current_resource\n resources[request_pattern[:controller].split('/').last.to_sym]\n end", "title": "" }, { "docid": "572692b1536ba5e52845cac6d625f364", "score": "0.66505754", "text": "def current_resource\n @current_resource ||= find_resource\n end", "title": "" }, { "docid": "c61675ce1da908eaa90237ddd20ffc3e", "score": "0.6505761", "text": "def current_resource\n @current_resource ||= @opening\n end", "title": "" }, { "docid": "efb61ef1e9fa9cf88477265244241e2c", "score": "0.6502425", "text": "def current_resource\n @current_resource ||= @timesheet\n end", "title": "" }, { "docid": "81b224ade849ccb2745db40f23ce9bc7", "score": "0.6467768", "text": "def resource\n self.uri_parts['Resource']\n end", "title": "" }, { "docid": "bf3a9bd6aab7a8434ec5b1a2c3d8020e", "score": "0.64525825", "text": "def current_page\n @rel.current_page\n end", "title": "" }, { "docid": "4fa4526bf17e672e807638a9a68fe085", "score": "0.64509976", "text": "def current_page\n self[@current_page]\n end", "title": "" }, { "docid": "aa75bb278021320a8162433695df10fb", "score": "0.6432704", "text": "def current_page\n @pages[:current]\n end", "title": "" }, { "docid": "faf4f04ce82e898f9e9c6e4a2ab0648f", "score": "0.64072037", "text": "def getPage(id)\n htmlResources.select {|r| r.locals[:id] === id }[0]\n end", "title": "" }, { "docid": "9cc0cebecdb21d36d338ef4e58f623eb", "score": "0.6399081", "text": "def current_resource # :nodoc:\n options[:custom][:current_resource]\n end", "title": "" }, { "docid": "d41b24b1bd14ab9bb0e58a677ba8c583", "score": "0.6369173", "text": "def current_resource\n # ActionController::Routing::Routes.recognize_path(\n # request.env[\"PATH_INFO\"][:controller]\n # )\n\n params[:controller]\n end", "title": "" }, { "docid": "74b117e23ea3e24f3a0a1f40daebdb1d", "score": "0.63257426", "text": "def current_resource\n @current_resource ||= @recipe\n end", "title": "" }, { "docid": "3e6a6c9b5fa34d1aabaf72bda4a02e98", "score": "0.6319867", "text": "def current_page\n\t\t@document.page(@assembly.floor_no)\n\tend", "title": "" }, { "docid": "472fe1323ab028811efd4d9fea76ce1a", "score": "0.6310778", "text": "def template\n if self.template_id\n Page.templates.find(self.template_id)\n else\n nil\n end\n end", "title": "" }, { "docid": "472fe1323ab028811efd4d9fea76ce1a", "score": "0.6310778", "text": "def template\n if self.template_id\n Page.templates.find(self.template_id)\n else\n nil\n end\n end", "title": "" }, { "docid": "b41a17aa34ce7d3994332568c0967417", "score": "0.6261009", "text": "def load_current_resource\n end", "title": "" }, { "docid": "b41a17aa34ce7d3994332568c0967417", "score": "0.6261009", "text": "def load_current_resource\n end", "title": "" }, { "docid": "179c0e1eefefb05b39335585f852c106", "score": "0.6243392", "text": "def current_template\n template_nesting.last\n end", "title": "" }, { "docid": "0eeb4aa4bc36dae16ac287f768424381", "score": "0.62085664", "text": "def current_resource\n resources.find { |model| try model }\n end", "title": "" }, { "docid": "7442af378d0aff3975e63f32f51acfbe", "score": "0.6202643", "text": "def current_resource\n @current_resource ||= @option\n end", "title": "" }, { "docid": "83b7f6653f37b0e734b6e3f7877a9f17", "score": "0.6199898", "text": "def current_resource\n @current_resource ||= @meal\n end", "title": "" }, { "docid": "f8502cdbdfae6d8265f6ca10e46cd4a0", "score": "0.61813396", "text": "def current_resource\n @current_resource ||= @post\n end", "title": "" }, { "docid": "2b3f90521469b1c979e6e1441202268d", "score": "0.6155271", "text": "def current_resource\n @current_resource ||= @posting\n end", "title": "" }, { "docid": "5e34e72a48b31f0887265e5220b1bacd", "score": "0.6129349", "text": "def current_resource\n @current_resource ||= @wage\n end", "title": "" }, { "docid": "7814e24b73283b70a809556fe2c2c5e0", "score": "0.6116293", "text": "def page_template\n PageTemplate.where(:_id => self.page_template_id.to_s).first if self.page_template_id\n end", "title": "" }, { "docid": "7814e24b73283b70a809556fe2c2c5e0", "score": "0.6116293", "text": "def page_template\n PageTemplate.where(:_id => self.page_template_id.to_s).first if self.page_template_id\n end", "title": "" }, { "docid": "6d969c491457111ff7ab0d8e3d34ab87", "score": "0.61054695", "text": "def current_template\n\t\t\t\t\tget_current_wizard_step.to_s\n\t\t\t\tend", "title": "" }, { "docid": "6d969c491457111ff7ab0d8e3d34ab87", "score": "0.61054695", "text": "def current_template\n\t\t\t\t\tget_current_wizard_step.to_s\n\t\t\t\tend", "title": "" }, { "docid": "b5be5fd50650e8767b06fcf7ce6dd688", "score": "0.60982496", "text": "def current_resource\n @current_resource ||= @message\n end", "title": "" }, { "docid": "83d6431ec481f5b295b23aaffd233454", "score": "0.6096476", "text": "def current_resource\n @current_resource ||= Fulfillment.find_by(guid: params[:guid]) if params[:guid]\n end", "title": "" }, { "docid": "2d83f2036a6ccf4cbdc352649215099d", "score": "0.60827905", "text": "def current_resource\n @current_resource ||= Fulfillment.find_by(guid: params[:guid]).order\n end", "title": "" }, { "docid": "a0b8393d00b9db2c01e62f489f983ecc", "score": "0.60795933", "text": "def current_item(request)\n return nil if request.path == \"/docs\"\n\n item = route_map[request.path.sub(\"/docs/\", \"\")]\n raise ActionController::RoutingError.new(\"Missing navigation for #{request.path}\") unless item\n\n item\n end", "title": "" }, { "docid": "12b2e5e685fd5d151ef06dbadc5d0f20", "score": "0.60770833", "text": "def current_resource\n @current_resource ||= @supplier\n end", "title": "" }, { "docid": "87f5c7bf96f37f6444cac6e58308c5e1", "score": "0.6068309", "text": "def get_page\n base.page\n end", "title": "" }, { "docid": "a4d0243d6a9a182e2a180940b1dbe8ad", "score": "0.6045468", "text": "def page_template\n page = self\n page = page.parent while page.template.blank? && !page.is_root?\n raise \"No template available for page #{slug}\" if page.template.blank?\n\n page.template\n end", "title": "" }, { "docid": "058b441eaf4edcad861822a510f64fc5", "score": "0.60444075", "text": "def current_page\n current_cursor\n end", "title": "" }, { "docid": "cf9faf05eb74c3901bd641fff8677871", "score": "0.6043806", "text": "def current_page; end", "title": "" }, { "docid": "5398d878eea9929893048c267178dedf", "score": "0.6025978", "text": "def get_resource\n\t\tinstance_variable_get(\"@#{resource_name}\")\n\tend", "title": "" }, { "docid": "9e706a633f8028223638ad274bfa93fb", "score": "0.602451", "text": "def current_page\n info[info.keys.first]['current_page']\n end", "title": "" }, { "docid": "9821de77b0598bba83b01c7baff9f097", "score": "0.6011925", "text": "def current_course\n path = current_page.path.split('courses/').last || ''\n path.split('/').first\n end", "title": "" }, { "docid": "3883798967661209c4b6868efb28ba26", "score": "0.600549", "text": "def get_resource\n instance_variable_get(\"@#{resource_name}\")\n end", "title": "" }, { "docid": "e52451165b6321f9250532d976f06d4a", "score": "0.5995274", "text": "def current_page\n sitemap.page_by_destination(current_path)\n end", "title": "" }, { "docid": "f586fdb67439b01fd87e87ac69fa96ba", "score": "0.59941643", "text": "def resource\n instance_variable_get(:\"@#{resource_name}\")\n end", "title": "" }, { "docid": "d79bbdf05ed00ff24ae84244b8de0504", "score": "0.59940195", "text": "def get_resource\n instance_variable_get(\"@#{resource_name}\")\n end", "title": "" }, { "docid": "d79bbdf05ed00ff24ae84244b8de0504", "score": "0.59940195", "text": "def get_resource\n instance_variable_get(\"@#{resource_name}\")\n end", "title": "" }, { "docid": "d79bbdf05ed00ff24ae84244b8de0504", "score": "0.59940195", "text": "def get_resource\n instance_variable_get(\"@#{resource_name}\")\n end", "title": "" }, { "docid": "d79bbdf05ed00ff24ae84244b8de0504", "score": "0.59940195", "text": "def get_resource\n instance_variable_get(\"@#{resource_name}\")\n end", "title": "" }, { "docid": "d79bbdf05ed00ff24ae84244b8de0504", "score": "0.59940195", "text": "def get_resource\n instance_variable_get(\"@#{resource_name}\")\n end", "title": "" }, { "docid": "d79bbdf05ed00ff24ae84244b8de0504", "score": "0.59940195", "text": "def get_resource\n instance_variable_get(\"@#{resource_name}\")\n end", "title": "" }, { "docid": "d79bbdf05ed00ff24ae84244b8de0504", "score": "0.59940195", "text": "def get_resource\n instance_variable_get(\"@#{resource_name}\")\n end", "title": "" }, { "docid": "d79bbdf05ed00ff24ae84244b8de0504", "score": "0.59940195", "text": "def get_resource\n instance_variable_get(\"@#{resource_name}\")\n end", "title": "" }, { "docid": "07e6610ccae1626defcebd0fc221fe80", "score": "0.59799397", "text": "def get_resource\n var = instance_variable_get(\"@#{controller_name.humanize.singularize.downcase}\")\n end", "title": "" }, { "docid": "1964844362505c561464ac10a989dbd6", "score": "0.59769976", "text": "def current_resource\n @current_resource ||= @bank\n end", "title": "" }, { "docid": "e74b47a828122e65a6bf9ad124261f1c", "score": "0.5974063", "text": "def resource\n @page ||= params[:id].present? ? Transit::Page.find(params[:id]) : Transit::Page.new\n end", "title": "" }, { "docid": "58eace0f359249a18e2e417bf7bce5cb", "score": "0.59731954", "text": "def load_current_resource\n # Dummy\n end", "title": "" }, { "docid": "1d2270d8474f6665489df9e8f604b22d", "score": "0.594926", "text": "def resource_template\n r = resource_templates.routing[[controller_name, action_name]]\n r[0] if r\n end", "title": "" }, { "docid": "6f2f208ee57a7b3800930109afc46601", "score": "0.5935058", "text": "def content\n @template_page\n end", "title": "" }, { "docid": "428d83f2cfa7f1614c1447084255382c", "score": "0.5925139", "text": "def resource\n instance_variable_get(:\"@#{resource_name}\")\n end", "title": "" }, { "docid": "8a53b699a79aab5780aaf0b6f7bdbf58", "score": "0.59152645", "text": "def current_resource\n user_id = params[:path].gsub(\"user/avatar/\", \"\").gsub(/\\/.*/, \"\")\n @current_resource ||= User.find(user_id) if user_id\n end", "title": "" }, { "docid": "4b9f664aa5ef89a3f8aee4070070b286", "score": "0.5899857", "text": "def current_page\n @response.request.page\n end", "title": "" }, { "docid": "e5d4699c19f9ee3f6b97bddf33d39cb7", "score": "0.58971107", "text": "def resource\n instance_variable_get(:\"@#{resource_name}\")\n end", "title": "" }, { "docid": "e5d4699c19f9ee3f6b97bddf33d39cb7", "score": "0.58971107", "text": "def resource\n instance_variable_get(:\"@#{resource_name}\")\n end", "title": "" }, { "docid": "6a841a4cc318decc6db3932fa5ab667d", "score": "0.58722603", "text": "def retrieve_resource\n instance_variable_get(\"@#{resource_name}\")\n end", "title": "" }, { "docid": "5dc4ac0833f136f23c249053d910b8f2", "score": "0.5871361", "text": "def current\n return @current unless @current.nil?\n return nil if I3.server.nil?\n request_uri = CGI.unescape(I3.server.request.params[\"REQUEST_URI\"])\n return self[request_uri.scan(%r'/([^/]+)/data/')[0][0]]\n end", "title": "" }, { "docid": "a2ad02f7d3d3c83162d2127b6c2503d1", "score": "0.58677053", "text": "def current_page\n SeoTag.find_by_path(@seo_identifier.present? ? @seo_identifier : request.path)\n end", "title": "" }, { "docid": "79bb7a22db0aefacf4de62fe5f610cb8", "score": "0.5867538", "text": "def instance_resource\n self.class.resource[\"#{self.id}\"]\n end", "title": "" }, { "docid": "ddc89f03f4137c1645c8b5f991536c8e", "score": "0.5866786", "text": "def current_page\n collection.current_page\n end", "title": "" }, { "docid": "a8e8696a8a632a00dc72108f5577bdf3", "score": "0.5859841", "text": "def get_resource_path\r\n return @cup_gui.get_resource_path\r\n end", "title": "" }, { "docid": "add6f488cde9e70a7431ee43dc6d8a34", "score": "0.5855094", "text": "def resource\n instance_variable_get(:\"@#{resource_name}\")\n end", "title": "" }, { "docid": "8431ce3af9a3a6c333733632a3745aca", "score": "0.5849456", "text": "def template\n Cms::PageTemplate.find_by_file_name(template_file_name)\n end", "title": "" }, { "docid": "98bf3c09764557706f346e484c1989ad", "score": "0.58493334", "text": "def page\n owner.try(:page)\n end", "title": "" }, { "docid": "0e2e9f0ed1790273ae72af567faa88a1", "score": "0.5847694", "text": "def resource\r\n parent_project.get_resource_by_unique_id(resource_unique_id)\r\n end", "title": "" }, { "docid": "185e345817b505088a5a4c6c04ef7c69", "score": "0.5841578", "text": "def getPage()\n return @page\n end", "title": "" }, { "docid": "299e8ebebef456215278f3ff4c10a769", "score": "0.58401525", "text": "def resource\n instance_variable_get(\"@#{resource_name}\")\n end", "title": "" }, { "docid": "299e8ebebef456215278f3ff4c10a769", "score": "0.58401525", "text": "def resource\n instance_variable_get(\"@#{resource_name}\")\n end", "title": "" }, { "docid": "d443e38721dd9b0d2222300554c59fea", "score": "0.58393127", "text": "def instance_resource\n self.class.resource[\"#{self.id}\"]\n end", "title": "" }, { "docid": "d443e38721dd9b0d2222300554c59fea", "score": "0.58393127", "text": "def instance_resource\n self.class.resource[\"#{self.id}\"]\n end", "title": "" }, { "docid": "91894e7346e911cb5b732d54842498a2", "score": "0.5828779", "text": "def get_resource\n instance_variable_get(\"@#{resource_name}\")\n end", "title": "" }, { "docid": "91894e7346e911cb5b732d54842498a2", "score": "0.5828779", "text": "def get_resource\n instance_variable_get(\"@#{resource_name}\")\n end", "title": "" }, { "docid": "17a94b25a67d90fe09bc446d1ba64682", "score": "0.5821594", "text": "def current_page_id\n Rails.application.routes.recognize_path(request.path).inspect.parameterize('_') rescue root_path\n end", "title": "" }, { "docid": "d4d8ae1f92fc676f080bf4b6d9fb89a6", "score": "0.5805043", "text": "def current_page\n @opts[:current_page]\n end", "title": "" }, { "docid": "f2f69171852b0c9990eeee84a3d16f32", "score": "0.57852596", "text": "def current_page\n case params[:controller]\n when 'web/menus'\n :menus\n when 'welcome'\n :home\n when 'enquiries'\n :enquiry\n when 'static_content'\n :static\n when 'web/specials'\n params[:action]\n when 'web/enquiry_confirmation'\n :enquiry_confirmation\n end\n end", "title": "" }, { "docid": "b172bab74391670b48b235b1b59ed78f", "score": "0.57849836", "text": "def current_page\n @collection.current_page\n end", "title": "" }, { "docid": "50a7ff014f0b175eab3fb88235c14ff1", "score": "0.57722056", "text": "def current_resource\n @current_resource ||= @ingredient\n end", "title": "" }, { "docid": "2c5d2a052ed0fb20e43c03fa6f65cf95", "score": "0.5752323", "text": "def fetch_templatable_page!\n parent_page_path = File.dirname(@path)\n parent_page_path = Kms::Page::INDEX_FULLPATH if parent_page_path == \".\"\n parent_page = Kms::Page.published.find_by_fullpath!(parent_page_path)\n templatable_pages = parent_page.children.where(templatable: true)\n templatable_pages.each do |templatable_page|\n return templatable_page if templatable_page.fetch_item(File.basename(@path))\n end\n nil\n end", "title": "" }, { "docid": "859185a72c909b7ff454bcaa24924d6e", "score": "0.5751786", "text": "def resource\n self.class.resource\n end", "title": "" }, { "docid": "859185a72c909b7ff454bcaa24924d6e", "score": "0.5751786", "text": "def resource\n self.class.resource\n end", "title": "" }, { "docid": "9722965d3971c6378a5a4399104fedc8", "score": "0.5750463", "text": "def resource\n return @resource\n end", "title": "" }, { "docid": "9722965d3971c6378a5a4399104fedc8", "score": "0.5750463", "text": "def resource\n return @resource\n end", "title": "" }, { "docid": "9722965d3971c6378a5a4399104fedc8", "score": "0.5750463", "text": "def resource\n return @resource\n end", "title": "" }, { "docid": "9722965d3971c6378a5a4399104fedc8", "score": "0.5750463", "text": "def resource\n return @resource\n end", "title": "" }, { "docid": "9ce484d75dee075df066bd712dcd4af8", "score": "0.573892", "text": "def page_params\n @current_resource ||= @page\n end", "title": "" }, { "docid": "c07e3eb27b040404318900d23ce569f1", "score": "0.57369274", "text": "def resource\n Axel.resources[resource_name]\n end", "title": "" }, { "docid": "aee221b32d26ac90e2cfab88d1d21b07", "score": "0.5732678", "text": "def page\n Page.find(page_id) if page_id\n end", "title": "" }, { "docid": "b6a89023002ee9c6700c10fd4fd5afe5", "score": "0.5728804", "text": "def resource\n resource? ? @resource : nil\n end", "title": "" }, { "docid": "f70b14963bab9db985d6e353399960ff", "score": "0.5724242", "text": "def resource\n get_resource_ivar || set_resource_ivar(current_site.styles.find(params[:id]))\n end", "title": "" }, { "docid": "f61cb3ebc706279992b0d66b0e747f3c", "score": "0.5711397", "text": "def current_page\n self.page_value.try(:to_i)\n end", "title": "" } ]
af630984682f1a0b5a68e6092af0d102
Update properties of this object
[ { "docid": "adc61a3c687f6ad83551f0c570f19b44", "score": "0.0", "text": "def update!(**args)\n @contexts = args[:contexts] if args.key?(:contexts)\n @details = args[:details] if args.key?(:details)\n @type = args[:type] if args.key?(:type)\n end", "title": "" } ]
[ { "docid": "184b1b1ed771473d3eb9f338c0734c38", "score": "0.73066413", "text": "def update *args\n opts = args.extract_options!\n fill_properties opts\n self.save\n end", "title": "" }, { "docid": "5076c5a88404ae72986f958710f5687a", "score": "0.72631145", "text": "def update(properties)\n @__hash__.update(properties)\n end", "title": "" }, { "docid": "60506d5995c168a570c84bcbafd6d01b", "score": "0.7164913", "text": "def update props\n # not an alias because doc\n put props\n end", "title": "" }, { "docid": "ec25850e7b3d73876b69868b5e566a7a", "score": "0.71243227", "text": "def update_properties(hash)\n hash.each do |key, value|\n self.send(\"#{key}=\", value)\n end\n end", "title": "" }, { "docid": "22938231f10efd60d4530259d1ab7161", "score": "0.7061904", "text": "def update_props(properties)\n fail 'not implemented'\n end", "title": "" }, { "docid": "22938231f10efd60d4530259d1ab7161", "score": "0.7061904", "text": "def update_props(properties)\n fail 'not implemented'\n end", "title": "" }, { "docid": "150fa2bdc1fc43d28ac45e2278a1f797", "score": "0.7012263", "text": "def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end", "title": "" }, { "docid": "b46342a57789464175130c5171865a4f", "score": "0.69842774", "text": "def update_properties(props)\n load_properties(force: true)\n\n deep_merge = proc do |_, old_value, new_value|\n if old_value.is_a?(Hash) && new_value.is_a?(Hash)\n old_value.merge(new_value, &deep_merge)\n else\n new_value\n end\n end\n\n props = properties.merge(props || {}, &deep_merge)\n save_properties(properties.merge(props || {}))\n self\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "4aa62f56c7ec71b9c7d914558501001b", "score": "0.67206186", "text": "def update\n update_obj\n end", "title": "" }, { "docid": "10e41ec39ba2af73495ccece21c2d8a3", "score": "0.6709326", "text": "def update!(**args)\n @subobject_properties = args[:subobject_properties] if args.key?(:subobject_properties)\n end", "title": "" }, { "docid": "b0508d605628b9b1ec78fe5f0697a746", "score": "0.67057854", "text": "def update_properties(hash)\n hash.each_pair do |k, v|\n self.set_property_value(k.to_s, v)\n end\n end", "title": "" }, { "docid": "092b765ad7cf3ce4b6bf4e7d8a2e6af7", "score": "0.6696149", "text": "def update(attrs)\n super(attrs)\n end", "title": "" }, { "docid": "092b765ad7cf3ce4b6bf4e7d8a2e6af7", "score": "0.6696149", "text": "def update(attrs)\n super(attrs)\n end", "title": "" }, { "docid": "092b765ad7cf3ce4b6bf4e7d8a2e6af7", "score": "0.6696149", "text": "def update(attrs)\n super(attrs)\n end", "title": "" }, { "docid": "092b765ad7cf3ce4b6bf4e7d8a2e6af7", "score": "0.6696149", "text": "def update(attrs)\n super(attrs)\n end", "title": "" }, { "docid": "092b765ad7cf3ce4b6bf4e7d8a2e6af7", "score": "0.6696149", "text": "def update(attrs)\n super(attrs)\n end", "title": "" }, { "docid": "092b765ad7cf3ce4b6bf4e7d8a2e6af7", "score": "0.6696149", "text": "def update(attrs)\n super(attrs)\n end", "title": "" }, { "docid": "092b765ad7cf3ce4b6bf4e7d8a2e6af7", "score": "0.6696149", "text": "def update(attrs)\n super(attrs)\n end", "title": "" }, { "docid": "d9b090f93fdffad34c5489c4c437c6f3", "score": "0.6662612", "text": "def update_properties(properties_element)\n end", "title": "" }, { "docid": "b7ed68c679d7eaccf546a282fab6e985", "score": "0.66259164", "text": "def apply\n update_keys\n update_columns\n update_properties\n end", "title": "" }, { "docid": "769b77b7f7f9f82ae847f5968eb201dc", "score": "0.6571848", "text": "def update_self obj\n obj.each do |k,v|\n instance_variable_set(\"@#{k}\", v) if v\n end\n end", "title": "" }, { "docid": "769b77b7f7f9f82ae847f5968eb201dc", "score": "0.6571848", "text": "def update_self obj\n obj.each do |k,v|\n instance_variable_set(\"@#{k}\", v) if v\n end\n end", "title": "" }, { "docid": "137759bf2b87f1ca55eb78e668747d15", "score": "0.6539236", "text": "def update!(**args)\n @property = args[:property] if args.key?(:property)\n end", "title": "" }, { "docid": "137759bf2b87f1ca55eb78e668747d15", "score": "0.6539236", "text": "def update!(**args)\n @property = args[:property] if args.key?(:property)\n end", "title": "" }, { "docid": "137759bf2b87f1ca55eb78e668747d15", "score": "0.6539236", "text": "def update!(**args)\n @property = args[:property] if args.key?(:property)\n end", "title": "" }, { "docid": "137759bf2b87f1ca55eb78e668747d15", "score": "0.6539236", "text": "def update!(**args)\n @property = args[:property] if args.key?(:property)\n end", "title": "" }, { "docid": "137759bf2b87f1ca55eb78e668747d15", "score": "0.6539236", "text": "def update!(**args)\n @property = args[:property] if args.key?(:property)\n end", "title": "" }, { "docid": "137759bf2b87f1ca55eb78e668747d15", "score": "0.6539236", "text": "def update!(**args)\n @property = args[:property] if args.key?(:property)\n end", "title": "" }, { "docid": "862f7aa179e3e1751693f78772c09a99", "score": "0.65159345", "text": "def assign_properties(properties); end", "title": "" }, { "docid": "328c68b6c30673dac05ca930f5da533c", "score": "0.6458067", "text": "def update_attributes(attrs)\n self.update(attrs)\n end", "title": "" }, { "docid": "328c68b6c30673dac05ca930f5da533c", "score": "0.6458067", "text": "def update_attributes(attrs)\n self.update(attrs)\n end", "title": "" }, { "docid": "d8b3bf9ec121e23dad3af2edca6e6094", "score": "0.6421526", "text": "def update(attributes); end", "title": "" }, { "docid": "63cce5e99d8dc677403b00708afc27c9", "score": "0.641709", "text": "def update\n @prop.update_attributes(prop_params)\n respond_with @prop, location: backstage_scene_props_path\n end", "title": "" }, { "docid": "3dc790e8b6e9e65eb288c97798a4c7f2", "score": "0.64154994", "text": "def set_properties inst\n model.properties.find_all { |p| model.updatable?(p.name) }.each do |p|\n inst.send(\"#{p.name}=\".to_sym, params[p.name.to_s]) if params.has_key?(p.name.to_s)\n end\n inst\n end", "title": "" }, { "docid": "9373755ebb61f1f274f6c8504a5acace", "score": "0.64146614", "text": "def reload(props = {})\n reset_changes\n super\n assign_attributes(props)\n self\n end", "title": "" }, { "docid": "fb68247cb1373a6c71a42a2aa69f1dcb", "score": "0.64143723", "text": "def update(attrs)\n @attrs = attrs\n self\n end", "title": "" }, { "docid": "fb68247cb1373a6c71a42a2aa69f1dcb", "score": "0.64143723", "text": "def update(attrs)\n @attrs = attrs\n self\n end", "title": "" }, { "docid": "23eb6f5fbeae4bf9f56ac93a4126b4b5", "score": "0.6389745", "text": "def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @object = args[:object] if args.key?(:object)\n end", "title": "" }, { "docid": "71d6a0160cffce28db4d0a25d6dbda13", "score": "0.6385747", "text": "def update!(**args)\n @count = args[:count] if args.key?(:count)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "9b95f8bc66f32e7ebbe7e63224d1ebaf", "score": "0.6364864", "text": "def update(attributes)\n attributes.each do |name, value|\n self[name] = value\n end\n end", "title": "" }, { "docid": "575f3d0c94f466263e302883e13868a6", "score": "0.6330631", "text": "def _update\n update!\n end", "title": "" }, { "docid": "7c6d5966289f9347f75aa7b24903a328", "score": "0.6327251", "text": "def _update!\n self.class.properties.each do |property, predicate|\n if dirty?(property)\n self.class.repository_or_fail.delete([subject, predicate[:predicate], nil])\n if self.class.is_list?(property)\n repo = RDF::Repository.new\n attribute_get(property).each do |value|\n repo << RDF::Statement.new(subject, predicate[:predicate], self.class.build_rdf_value(value, self.class.properties[property][:type]))\n end\n self.class.repository_or_fail.insert(*repo)\n else\n self.class.repository_or_fail.insert(RDF::Statement.new(subject, predicate[:predicate], self.class.build_rdf_value(attribute_get(property), self.class.properties[property][:type]))) unless attribute_get(property).nil?\n end\n end\n @attributes[:original][property] = attribute_get(property)\n @dirty[property] = nil\n @attributes[:copied][property] = NOT_SET\n end\n self.class.repository_or_fail.insert(RDF::Statement.new(@subject, RDF.type, type)) unless type.nil?\n end", "title": "" }, { "docid": "210886bcfd68fae88847f8b3464d4058", "score": "0.6325362", "text": "def update_properties!(scraper)\n log \"Updating assets for #{self.slug}\"\n# only update active properties\n Property.where(source_id: self.id, status: 1).find_each do |prop|\n begin\n scraper.update_property(prop)\n rescue Exception => e\n log \"there was a connection error #{e.message} - #{e.class}\"\n end\n end\n end", "title": "" }, { "docid": "da63345424fc9aecef032928485bd149", "score": "0.6319025", "text": "def update\n \n end", "title": "" }, { "docid": "749afa4ff068e21c7d78bbad94c19d6c", "score": "0.6313444", "text": "def update!(attributes); end", "title": "" }, { "docid": "e8639be61ed6393bc612a8aef27789d3", "score": "0.6312355", "text": "def update!(**args)\n @border = args[:border] if args.key?(:border)\n @fields = args[:fields] if args.key?(:fields)\n @object_id_prop = args[:object_id_prop] if args.key?(:object_id_prop)\n end", "title": "" }, { "docid": "6284f332cbe8c998b16d5e816c5d21ed", "score": "0.6291622", "text": "def update!(**args)\n @display_name = args[:display_name] if args.key?(:display_name)\n @parent = args[:parent] if args.key?(:parent)\n @property = args[:property] if args.key?(:property)\n @property_type = args[:property_type] if args.key?(:property_type)\n end", "title": "" }, { "docid": "6284f332cbe8c998b16d5e816c5d21ed", "score": "0.6291622", "text": "def update!(**args)\n @display_name = args[:display_name] if args.key?(:display_name)\n @parent = args[:parent] if args.key?(:parent)\n @property = args[:property] if args.key?(:property)\n @property_type = args[:property_type] if args.key?(:property_type)\n end", "title": "" }, { "docid": "5a8e82caac01cee661bc875a5b0cf723", "score": "0.6283673", "text": "def refresh\n set_attributes\n end", "title": "" }, { "docid": "9e076ce17f1607b2a6248469b63b9c05", "score": "0.62797445", "text": "def training_updated_properties=(value)\n @training_updated_properties = value\n end", "title": "" }, { "docid": "309d8f89c45737b781ca7c15a61b00a5", "score": "0.6273536", "text": "def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @size_bytes = args[:size_bytes] if args.key?(:size_bytes)\n end", "title": "" }, { "docid": "309d8f89c45737b781ca7c15a61b00a5", "score": "0.6273536", "text": "def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @size_bytes = args[:size_bytes] if args.key?(:size_bytes)\n end", "title": "" }, { "docid": "60d8c4f58de490a0d7cdd918c16a2cce", "score": "0.6269463", "text": "def update(attrs)\n @attrs.update(attrs)\n self\n end", "title": "" }, { "docid": "60d8c4f58de490a0d7cdd918c16a2cce", "score": "0.6269463", "text": "def update(attrs)\n @attrs.update(attrs)\n self\n end", "title": "" }, { "docid": "60d8c4f58de490a0d7cdd918c16a2cce", "score": "0.6269463", "text": "def update(attrs)\n @attrs.update(attrs)\n self\n end", "title": "" }, { "docid": "60d8c4f58de490a0d7cdd918c16a2cce", "score": "0.6269463", "text": "def update(attrs)\n @attrs.update(attrs)\n self\n end", "title": "" }, { "docid": "7a41bc9d5a07220fb8626d1fa90d2d79", "score": "0.62639254", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n @source = args[:source] if args.key?(:source)\n end", "title": "" }, { "docid": "f88ac8dac0e7b4769636f755e65a14ba", "score": "0.6261997", "text": "def update!(**args)\n @fields = args[:fields] if args.key?(:fields)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "f88ac8dac0e7b4769636f755e65a14ba", "score": "0.6261997", "text": "def update!(**args)\n @fields = args[:fields] if args.key?(:fields)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "f88ac8dac0e7b4769636f755e65a14ba", "score": "0.6261997", "text": "def update!(**args)\n @fields = args[:fields] if args.key?(:fields)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "f88ac8dac0e7b4769636f755e65a14ba", "score": "0.6261997", "text": "def update!(**args)\n @fields = args[:fields] if args.key?(:fields)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "f88ac8dac0e7b4769636f755e65a14ba", "score": "0.6261997", "text": "def update!(**args)\n @fields = args[:fields] if args.key?(:fields)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "f88ac8dac0e7b4769636f755e65a14ba", "score": "0.6261997", "text": "def update!(**args)\n @fields = args[:fields] if args.key?(:fields)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "afd53a32bf51a2ff3c438cbf011b1ee6", "score": "0.6261246", "text": "def update!\n saved = false\n retries = RETRIES\n while !saved\n begin\n res = Persistence::Setup.db.save_doc(@properties)\n @properties = Persistence::Setup.db.get(res['id'])\n saved = true\n rescue Exception => ex\n raise ex if ex.http_code != 409\n if(retries > 0)\n @new_properties = Persistence::Setup.db.get(@properties['_id'])\n @properties.each_pair do |k,v|\n if k != \"_rev\" && k != \"_id\"\n @new_properties[k] = v\n end\n end\n @properties = @new_properties\n else\n raise ex\n end\n end\n end\n :ok\n end", "title": "" }, { "docid": "118090da310d688caa13dea348732f3c", "score": "0.62579167", "text": "def update(attributes={})\n self.class.update(self, attributes)\n end", "title": "" }, { "docid": "91dc386ff8fa066852510a5d62b13078", "score": "0.62170374", "text": "def update(attrs)\n @attrs ||= {}\n @attrs.update(attrs)\n self\n end", "title": "" }, { "docid": "91dc386ff8fa066852510a5d62b13078", "score": "0.62170374", "text": "def update(attrs)\n @attrs ||= {}\n @attrs.update(attrs)\n self\n end", "title": "" }, { "docid": "6249943d1eeff63f8f611fcf73254058", "score": "0.62152076", "text": "def update\n \n end", "title": "" }, { "docid": "1c12f310aca206a2cefff8c291007668", "score": "0.6210263", "text": "def update!(**args)\n @property = args[:property] if args.key?(:property)\n @schema = args[:schema] if args.key?(:schema)\n end", "title": "" }, { "docid": "3dfb66c3e13f181393bb4510e9fcd51f", "score": "0.62083745", "text": "def set_update(attrs = {})\n @movement.attributes = attrs.slice(*attributes_for_update)\n set_details\n\n @movement.balance = get_updated_balance\n @movement.gross_total = original_total\n @movement.set_state_by_balance!\n @movement.discounted = ( discount > 0 )\n\n @movement.balance_inventory = balance_inventory\n @movement.delivered = @movement.details.all? {|v| v.balance <= 0}\n\n @errors.new(movement).set_errors\n end", "title": "" }, { "docid": "1c0316f22c6db917fa4719767b5326a9", "score": "0.6204041", "text": "def update!(**args)\n @name = args[:name] if args.key?(:name)\n @options = args[:options] if args.key?(:options)\n @property_definitions = args[:property_definitions] if args.key?(:property_definitions)\n end", "title": "" }, { "docid": "5d229ea224b1dfa7ac9ce6808ca63fc4", "score": "0.62017816", "text": "def update(attributes = {})\n super(attributes)\n retrieve!\n self\n end", "title": "" }, { "docid": "6992c0833b982296b329ec1d8c7289de", "score": "0.6201711", "text": "def update(attributes = {})\n self.attributes = attributes\n _update\n end", "title": "" }, { "docid": "2beb42793217599eea1dac4b91640e41", "score": "0.6196084", "text": "def update_attributes\n server_update_data.each_pair do |key, value|\n instance_variable_set(\"@#{key}\", value)\n end\n end", "title": "" }, { "docid": "67f76e6622d1021031437ad609613c63", "score": "0.6192824", "text": "def update(obj)\n obj.each_pair do |key, value|\n send(\"#{key}=\", value)\n end\n self\n end", "title": "" }, { "docid": "30aa07725af2114280d6e8f916ab079f", "score": "0.6183338", "text": "def update!\n\t\t\tconstruct!(self, &@update)\n\t\t\t@update = nil\n\t\t\t\n\t\t\treturn self\n\t\tend", "title": "" }, { "docid": "f1f71f298690a3bd1f5832b15038d8bb", "score": "0.6174291", "text": "def updated_properties\n @updated_properties ||= ActiveSupport::HashWithIndifferentAccess.new\n end", "title": "" }, { "docid": "e1f766468b11768b786daa133483b157", "score": "0.61730784", "text": "def update\n raise NotImplementedError\n end", "title": "" }, { "docid": "ed1b58af16fd466e308ffc9229115e36", "score": "0.6145399", "text": "def update_attributes(params)\n raise(RHapi::AttributeError, \"The params must be a hash.\") unless params.is_a?(Hash)\n params.each do |name, value|\n self.properties.send(name.to_s + '=', value)\n end\n save # only call API once rather than repeatedly saving with update_attribute calls\n end", "title": "" }, { "docid": "ed1b58af16fd466e308ffc9229115e36", "score": "0.6145399", "text": "def update_attributes(params)\n raise(RHapi::AttributeError, \"The params must be a hash.\") unless params.is_a?(Hash)\n params.each do |name, value|\n self.properties.send(name.to_s + '=', value)\n end\n save # only call API once rather than repeatedly saving with update_attribute calls\n end", "title": "" }, { "docid": "147d62c4df79ff1ca86cbd477112bf7f", "score": "0.61445665", "text": "def update\n end", "title": "" }, { "docid": "147d62c4df79ff1ca86cbd477112bf7f", "score": "0.61445665", "text": "def update\n end", "title": "" }, { "docid": "147d62c4df79ff1ca86cbd477112bf7f", "score": "0.61445665", "text": "def update\n end", "title": "" }, { "docid": "7f11aed7030229ef429116ccba78c00f", "score": "0.61400205", "text": "def update_properties\n # t_init = 0, t_mod = 0, t_formula = 0, t_formula_mod = 0, t_post_init = 0\n # t_update_properties = Benchmark.measure do\n # Reset values for everything except formulas\n # t_init = Benchmark.measure do\n character_properties.reject { |p| p.is_a?(CharacterFormula) }.each do |p|\n p.init(self)\n end\n # end\n\n # Apply modifiers to attributes, skills and resistances (formulas later)\n mods = []\n # t_mod = Benchmark.measure do\n mods << race.property_modifiers if race\n mods << birthsign.property_modifiers if birthsign\n mods.flatten!\n mods.reject { |m| m.property.is_a?(Formula) }.each(&method(:apply_modifier))\n # end\n\n # Now start to process formulas\n # t_formula = Benchmark.measure do\n character_properties.select { |p| p.is_a?(CharacterFormula) }.each do |f|\n f.init(self)\n end\n # end\n\n # Apply modifiers to formulas\n # t_formula_mod = Benchmark.measure do\n mods.select { |m| m.property.is_a?(Formula) }.each(&method(:apply_modifier))\n # end\n\n # t_post_init = Benchmark.measure do\n character_properties.each do |prop|\n prop.post_init(self)\n end\n # end\n # end\n\n # logger.warn(\"## Init: #{(t_init.real*1000).to_i}ms\")\n # logger.warn(\"## Mofifiers: #{(t_mod.real*1000).to_i}ms\")\n # logger.warn(\"## Formula: #{(t_formula.real*1000).to_i}ms\")\n # logger.warn(\"## Formula Modifiers: #{(t_formula_mod.real*1000).to_i}ms\")\n # logger.warn(\"## Post Init: #{(t_post_init.real*1000).to_i}ms\")\n # logger.warn(\"### Update Properties: #{(t_update_properties.real*1000).to_i}ms\")\n end", "title": "" }, { "docid": "22a21a1959eeb926dfe475d8878239d7", "score": "0.6127356", "text": "def update\n connection.put(singleton_path(prefix_options), encode, self.class.headers).tap do |response|\n load_attributes_from_response(response)\n end\n end", "title": "" } ]
178a0304cfe1572ff90982c7dc16a764
Attaches the SPS client to the web browser. The SPS broker must be started before the code can be attached. see start_broker()
[ { "docid": "a71d45b43e750616c4e7bfc5a687a6a3", "score": "0.0", "text": "def attach_console(autohide: true)\n\n @window.activate()\n open_web_console(); sleep 1\n\n clipboard = Clipboard.paste\n Clipboard.copy javascript(); sleep 1\n ctrl_v(); sleep 0.5; carriage_return()\n\n close_web_console() if autohide\n Clipboard.copy clipboard\n\n end", "title": "" } ]
[ { "docid": "f2b730f37f18ecc5ea3d87dd6c02c2b3", "score": "0.5207853", "text": "def acknowledgements\n self.acknowledgements_link\n sleep 1\n wait_for_ajax\n Acknowledgements.new @browser\n end", "title": "" }, { "docid": "0190e03133e8f32ef84e3af72846d266", "score": "0.51939577", "text": "def user_agreement\n self.user_agreement_link\n sleep 1\n #wait_for_ajax\n # New Class goes here.new @browser\n end", "title": "" }, { "docid": "b6cceda40ed29e5a98e1ace6d40f6fb5", "score": "0.51452094", "text": "def open\n @thread = Thread.new{ @wamp_client.open }\n end", "title": "" }, { "docid": "069be6e1eeadcf15d37a0492f5a21844", "score": "0.50120866", "text": "def setup\n\n\tsb = ServerBroker.new\n\tcb = ClientBroker.new(sb)\n\tcp = ClientProxy.new(cb)\n\n\tClient.new(cp)\n\nend", "title": "" }, { "docid": "862f2de819c718fba0aef4c7f7e1f495", "score": "0.49589524", "text": "def setup_browser\n @browser = Browser.new(self)\n end", "title": "" }, { "docid": "5d2dbb375bb91b18fc59fd11ac96edb8", "score": "0.49438956", "text": "def set_client\n @client = Client.find(current_user.client_id)\n end", "title": "" }, { "docid": "52aeb580312f8386309ec5eef9fce3f5", "score": "0.48763946", "text": "def set_client_pid(pid)\n @client.window_pid = pid\n end", "title": "" }, { "docid": "2312571ef5eb850ab5518d7a58180781", "score": "0.4855846", "text": "def setup\n if EXPA.client.nil?\n\t # Sets the client variable in the EXPA module\n\t\t# which can be used for authentication afterwards\n EXPA.client = EXPA::Client.new()\n end\n end", "title": "" }, { "docid": "243fba2f1f1f64ce5d30d50b1206778d", "score": "0.4848944", "text": "def open()\n \n #note we would want to check for the browser being open already\n #so we don't annoy people\n \n event(\"Pre\")\n require 'launchy'\n Launchy.open(\"http://store.mage.dev/admin\") #note this should be from setting file\n event(\"Post\")\n end", "title": "" }, { "docid": "eb2add02cba2bf949aaad5ca9f969d32", "score": "0.48477742", "text": "def client\n @client.push()\n end", "title": "" }, { "docid": "14026db4d5bc5a12f4d34995af9ea3e6", "score": "0.48379996", "text": "def set_broker # :doc:\n\t\t\tif @request.broker_id.present?\n\t\t\t\t@broker = User.where(id: @request.broker_id).first\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "9687911811a89e7343d62b5f8e03d126", "score": "0.4824854", "text": "def show\n load_client\n end", "title": "" }, { "docid": "51949c1dc74d08a3ef80a01a9d1737a5", "score": "0.4818432", "text": "def set_broker\n @broker = Broker.find(params[:id])\n end", "title": "" }, { "docid": "51949c1dc74d08a3ef80a01a9d1737a5", "score": "0.4818432", "text": "def set_broker\n @broker = Broker.find(params[:id])\n end", "title": "" }, { "docid": "2b6bfec2957105b9074eea7ea8ede8e3", "score": "0.48066258", "text": "def start(params = {})\r\n # create a DRb 'front' object\r\n watir_provider = Watir::Provider.new(@driver)\r\n @log.debug(\"Watir provider is : #{watir_provider}\")\r\n architecture = Config::CONFIG['arch']\r\n hostname = ENV['SERVER_NAME'] || %x{hostname}.strip\r\n\r\n # setup the security--remember to call before DRb.start_service()\r\n DRb.install_acl(ACL.new(@acls))\r\n\r\n # start the DRb Server\r\n drb_server = DRb.start_service(\r\n \"druby://#{@drb_server_host}:#{@drb_server_port}\")\r\n\r\n # obtain DRb Server uri\r\n @drb_server_uri = drb_server.uri\r\n @log.info(\"Provider started on : #{@drb_server_uri}\")\r\n\r\n # create a service tuple\r\n @tuple = [\r\n :WatirGrid,\r\n :WatirProvider,\r\n watir_provider,\r\n 'A watir provider',\r\n hostname,\r\n architecture,\r\n @driver,\r\n @browser_type\r\n ]\r\n\r\n # locate the Rinda Ring Server via a UDP broadcast\r\n @log.debug(\"Broadcast Ring Server : druby://#{@ring_server_host}:#{@ring_server_port}\")\r\n find_ring_server\r\n\r\n # advertise this service on the primary remote tuple space\r\n @ring_server.write(@tuple, @renewer)\r\n\r\n # log DRb server uri\r\n @log.info(\"Provider registered : #{@controller_uri}\")\r\n\r\n # wait for explicit stop via ctrl-c\r\n DRb.thread.join if __FILE__ == $0\r\n end", "title": "" }, { "docid": "6be7d2653e3159afe0688f63035f0031", "score": "0.48056749", "text": "def set_client\n @client = Client.find(current_user.client_id)\n end", "title": "" }, { "docid": "c8c5e02e309e4f078591c06f1789fede", "score": "0.47440314", "text": "def set_client_id\n\t\t\t@client = Client.find(session[:CLIENT_ID])\n\t\tend", "title": "" }, { "docid": "135248c505b3d3159045b10e55c4db67", "score": "0.47392038", "text": "def setup\n @client = @@client\n end", "title": "" }, { "docid": "70d1cf6ed99ecafe5904e0b50027e911", "score": "0.4733952", "text": "def set_clients_setting\n @clients = current_client\n end", "title": "" }, { "docid": "9fe1715a410c933405daa0f6fd31f930", "score": "0.47300768", "text": "def activate_observer(client = isimud_client)\n create_queue(client)\n isimud_send_action_message(:update)\n end", "title": "" }, { "docid": "13394a5b857418c90182d0cd94c52662", "score": "0.4708882", "text": "def on_create\n RMQ.debugging = true\n RMQ.caching_enabled = true\n\n mp \"BluePotionApplication on_create\", debugging_only: true\n\n VW::SessionClient.debug = true # Debug network calls\n end", "title": "" }, { "docid": "c140362f6767036d50505d9882cf23dd", "score": "0.4691162", "text": "def app\n Spaceship::Portal::App.set_client(@client)\n end", "title": "" }, { "docid": "9627c77f6c22e4bc5df8ed3aca2e4f0c", "score": "0.46889502", "text": "def set_broker\n @broker = Broker.find(params[:id])\n end", "title": "" }, { "docid": "e6fb8fbba187d37a8be4fcba9f2d832d", "score": "0.4686359", "text": "def start_broker()\n\n Thread.new do\n `ruby -r 'simplepubsub' -e \"SimplePubSub::Broker.start port: '55000'\"`\n end\n\n end", "title": "" }, { "docid": "4e4feda7231523efde40b75f1860a6b3", "score": "0.46825582", "text": "def set_client\n @client = Client.find_by(id: params[:id], user_id: current_user.co_ids)\n end", "title": "" }, { "docid": "f95077304cdcb810a075a22da8e6d181", "score": "0.46212006", "text": "def set_client\n\t\t\t@client = Client.find(params[:id])\n\t\tend", "title": "" }, { "docid": "46f8e308dab5cebb9fe8e99e1fd67b63", "score": "0.4616987", "text": "def set_client\n SoftLayer::Client.default_client = @softlayer_client = SoftLayer::Client.new(\n :username => current_user.ibm_id, # enter your username here\n :api_key => current_user.ibm_key, # enter your api key here\n :endpoint_URL => @API_PUBLIC_ENDPOINT\n )\n end", "title": "" }, { "docid": "b698dc9ecb50773fe9279eabd839d746", "score": "0.46151772", "text": "def init_client; end", "title": "" }, { "docid": "0830886b36603347f1b8851a77487c40", "score": "0.46042827", "text": "def set_client\n if current_user && current_user.is_event_admin?\n @client = Client.find(current_user.client_id)\n elsif current_user && current_user.is_crew?\n @client = Client.find(current_user.client_id)\n else\n redirect_to home_pages_home_path\n end\n end", "title": "" }, { "docid": "85ce6560d882343d0c412ac7f88dd138", "score": "0.45949864", "text": "def add(client); end", "title": "" }, { "docid": "8a6c585bd938afa123751983bc450665", "score": "0.45809156", "text": "def setupMainPanel\n createStatusBarItem\n createWebView\n createButton\n\n # Setup window and add subviews\n @window = PopupPanel.alloc.initPopup(POPUP_WIDTH + 2, POPUP_HEIGHT + 2)\n @window.contentView.addSubview(@web_view)\n @window.contentView.addSubview(@button);\n end", "title": "" }, { "docid": "59e439823d5a34cca31901836028af0c", "score": "0.45765096", "text": "def set_client\n @client = Client.find(params[:id])\n session[:client] = @client.id\n \n end", "title": "" }, { "docid": "6f1ffd2e6142cf9510d8c8a8fc65a74d", "score": "0.45758206", "text": "def use_managed_browser=(value)\n @use_managed_browser = value\n end", "title": "" }, { "docid": "7e2f62146018e3d69d8bfeda6cb6afd0", "score": "0.45654428", "text": "def on_open client\n c = controller(client)\n c.instance_variable_set(CLIENT_NAME, client)\n if client.protocol == :sse\n c.on_sse\n else\n c.on_open\n end\n end", "title": "" }, { "docid": "49e2dfe4cb10ab8d4f501f5235cd26a9", "score": "0.45581013", "text": "def add_client(client)\n @clients.push(client)\n end", "title": "" }, { "docid": "6784f4fac174e94a165e75d351a02118", "score": "0.45532134", "text": "def on_connect(client_id, ip_address)\n @client_manager.add(client_id, ip_address)\n end", "title": "" }, { "docid": "0599344a791b57c293a0815ddf914d78", "score": "0.4550622", "text": "def add_a_message\n @browser.span(:id=>\"newsharecontent_message_arrow\").fire_event('onclick')\n end", "title": "" }, { "docid": "1f259dad152869b0fbb7b3fd0a9cb34d", "score": "0.45466337", "text": "def set_live_client\n @live_client = LiveClient.find(params[:id])\n end", "title": "" }, { "docid": "6b60427655a2bd87460894a8b846766e", "score": "0.45317557", "text": "def set_client\n @client = ::Client.find(params[:id])\n end", "title": "" }, { "docid": "b3e1f0070560cd9ba3d786ab80ca5f22", "score": "0.4531153", "text": "def start\n super\n @producer = Poseidon::Producer.new(@path, @topic)\n end", "title": "" }, { "docid": "7d349962c1f661e1ec23349819ae5552", "score": "0.45288053", "text": "def on_container_start(container)\n # Connecting to broker and creating sender\n container.connect(\n # Set broker URI\n @broker,\n # Enable SASL authentication\n sasl_enabled: true,\n # Enable insecure SASL mechanisms\n sasl_allow_insecure_mechs: true,\n # Set allowed SASL mechanisms\n sasl_allowed_mechs: @sasl_mechs\n ).open_sender(@broker.amqp_address)\n end", "title": "" }, { "docid": "2dadd6255b3d15644158a429a9501a81", "score": "0.4527579", "text": "def enable_hot_configure!\n \n # client side configuration \n boot_client!\n \n LOG.info \"Enabling hot configuration on the client side.\"\n \n ActiveMessaging::System.configure do |my|\n \n my.destination ActiveMessaging::HOT_CONFIG_DEST, \n '/topic/hot_config', \n :drb_uri => 'druby://localhost:8408'\n \n end\n \n # server side configuration - if we haven't called #boot_server!\n # we assume we don't need to do this\n if @server_ready \n \n LOG.info \"Enabling hot configuration on the server side.\"\n\n ActiveMessaging::System.configure do |my|\n my.processor ActiveMessaging::HOT_CONFIG_DEST, \n ActiveMessaging::ConfigurationProcessor\n end\n end\n \n end", "title": "" }, { "docid": "7da2feb890cb26cad7a35422cd379861", "score": "0.45202133", "text": "def set_client\n @client = Client.find(params[:client_id]) if params[:client_id].present?\n end", "title": "" }, { "docid": "ade33843fe1d19c2b66d12cd5d268921", "score": "0.45194942", "text": "def on_container_start(container)\n # Connecting to broker and creating sender\n container.connect(\n # Set broker URI\n @broker,\n # Enable SASL authentication\n sasl_enabled: @sasl_enabled,\n # Enable insecure SASL mechanisms\n sasl_allow_insecure_mechs: true,\n # Set allowed SASL mechanisms\n sasl_allowed_mechs: @sasl_mechs,\n # Set idle timeout\n idle_timeout: @idle_timeout,\n # Set max frame size\n max_frame_size: @max_frame_size,\n ).open_sender({\n # Set target address\n :target => anonymous ? nil : @broker.amqp_address,\n # Set auto settle\n :auto_settle => @auto_settle_off ? false : true,\n })\n end", "title": "" }, { "docid": "f100b4da6f59958102ef3f6f19f5adf8", "score": "0.45110843", "text": "def on_container_start(container)\n # Connecting to broker and creating receiver\n @receiver = container.connect(\n # Set broker URI\n @broker,\n # Enabled SASL authentication\n sasl_enabled: true,\n # Enabled insecure SASL mechanisms\n sasl_allow_insecure_mechs: true,\n # Set allowed SASL mechanisms\n sasl_allowed_mechs: @sasl_mechs\n ).open_receiver(@broker.amqp_address)\n # If browse messages instead of reading\n if browse\n # Set browsing mode\n @receiver.source.distribution_mode = \\\n Qpid::Proton::Terminus::DIST_MODE_COPY\n end\n end", "title": "" }, { "docid": "7e5951b54b002db6f2226856732b9ca5", "score": "0.45094508", "text": "def initialize(client)\n @client = client\n @client.epoint = ENTRY_POINT \n end", "title": "" }, { "docid": "7e5951b54b002db6f2226856732b9ca5", "score": "0.45094508", "text": "def initialize(client)\n @client = client\n @client.epoint = ENTRY_POINT \n end", "title": "" }, { "docid": "87bc90d067f7d2fc6a19703b30100899", "score": "0.45082188", "text": "def activatews(*)\n super\n end", "title": "" }, { "docid": "3cd09d0a3354fd4edd083e41ace5f2aa", "score": "0.45039898", "text": "def start_client\n @client = Client.new(@configure.apis)\n @client.run\n end", "title": "" }, { "docid": "ae5aa69cec609382faa0a3ba2696f9d8", "score": "0.44949967", "text": "def add_content\n self.link(:id=>\"navigation_create_and_add_link\").fire_event(\"onmouseover\")\n self.link(:text=>\"Add content\").click\n self.wait_until { @browser.text.include? \"Collected items\" }\n self.class.class_eval { include AddContentContainer }\n end", "title": "" }, { "docid": "3a291d138b5bdae2ea9d4a72bda062e4", "score": "0.44873706", "text": "def set_client_app_initializers\n return unless request.format == 'html'\n @initializers = { soundcloud: { client_id: ENV['SOUND_CLOUD_CLIENT_ID'] } }\n end", "title": "" }, { "docid": "fa1c4da2b2a1e447151dcefc0ab43aaf", "score": "0.44847068", "text": "def set_client\n\t @client = Client.find(params[:id])\n\t end", "title": "" }, { "docid": "0cfbd64e2795c7f30d05970aa7d4152e", "score": "0.44823816", "text": "def set_client\n @client = Client.find(params[:id])\n \n end", "title": "" }, { "docid": "0262891fa447da300eeb8980030888c9", "score": "0.4477185", "text": "def set_client\n @client = Client.find(params[:id])\n end", "title": "" }, { "docid": "0262891fa447da300eeb8980030888c9", "score": "0.4477185", "text": "def set_client\n @client = Client.find(params[:id])\n end", "title": "" }, { "docid": "0262891fa447da300eeb8980030888c9", "score": "0.4477185", "text": "def set_client\n @client = Client.find(params[:id])\n end", "title": "" }, { "docid": "0262891fa447da300eeb8980030888c9", "score": "0.4477185", "text": "def set_client\n @client = Client.find(params[:id])\n end", "title": "" }, { "docid": "0262891fa447da300eeb8980030888c9", "score": "0.4477185", "text": "def set_client\n @client = Client.find(params[:id])\n end", "title": "" }, { "docid": "0262891fa447da300eeb8980030888c9", "score": "0.4477185", "text": "def set_client\n @client = Client.find(params[:id])\n end", "title": "" }, { "docid": "0262891fa447da300eeb8980030888c9", "score": "0.4477185", "text": "def set_client\n @client = Client.find(params[:id])\n end", "title": "" }, { "docid": "0262891fa447da300eeb8980030888c9", "score": "0.4477185", "text": "def set_client\n @client = Client.find(params[:id])\n end", "title": "" }, { "docid": "0262891fa447da300eeb8980030888c9", "score": "0.4477185", "text": "def set_client\n @client = Client.find(params[:id])\n end", "title": "" }, { "docid": "0262891fa447da300eeb8980030888c9", "score": "0.4477185", "text": "def set_client\n @client = Client.find(params[:id])\n end", "title": "" }, { "docid": "0262891fa447da300eeb8980030888c9", "score": "0.4477185", "text": "def set_client\n @client = Client.find(params[:id])\n end", "title": "" }, { "docid": "0262891fa447da300eeb8980030888c9", "score": "0.4477185", "text": "def set_client\n @client = Client.find(params[:id])\n end", "title": "" }, { "docid": "0262891fa447da300eeb8980030888c9", "score": "0.4477185", "text": "def set_client\n @client = Client.find(params[:id])\n end", "title": "" }, { "docid": "0262891fa447da300eeb8980030888c9", "score": "0.4477185", "text": "def set_client\n @client = Client.find(params[:id])\n end", "title": "" }, { "docid": "0262891fa447da300eeb8980030888c9", "score": "0.4477185", "text": "def set_client\n @client = Client.find(params[:id])\n end", "title": "" }, { "docid": "0262891fa447da300eeb8980030888c9", "score": "0.4477185", "text": "def set_client\n @client = Client.find(params[:id])\n end", "title": "" }, { "docid": "0262891fa447da300eeb8980030888c9", "score": "0.4477185", "text": "def set_client\n @client = Client.find(params[:id])\n end", "title": "" }, { "docid": "0262891fa447da300eeb8980030888c9", "score": "0.4477185", "text": "def set_client\n @client = Client.find(params[:id])\n end", "title": "" }, { "docid": "0262891fa447da300eeb8980030888c9", "score": "0.4477185", "text": "def set_client\n @client = Client.find(params[:id])\n end", "title": "" }, { "docid": "0262891fa447da300eeb8980030888c9", "score": "0.4477185", "text": "def set_client\n @client = Client.find(params[:id])\n end", "title": "" }, { "docid": "0262891fa447da300eeb8980030888c9", "score": "0.4477185", "text": "def set_client\n @client = Client.find(params[:id])\n end", "title": "" }, { "docid": "0262891fa447da300eeb8980030888c9", "score": "0.4477185", "text": "def set_client\n @client = Client.find(params[:id])\n end", "title": "" }, { "docid": "0262891fa447da300eeb8980030888c9", "score": "0.4477185", "text": "def set_client\n @client = Client.find(params[:id])\n end", "title": "" }, { "docid": "0262891fa447da300eeb8980030888c9", "score": "0.4477185", "text": "def set_client\n @client = Client.find(params[:id])\n end", "title": "" }, { "docid": "0262891fa447da300eeb8980030888c9", "score": "0.4477185", "text": "def set_client\n @client = Client.find(params[:id])\n end", "title": "" }, { "docid": "0262891fa447da300eeb8980030888c9", "score": "0.4477185", "text": "def set_client\n @client = Client.find(params[:id])\n end", "title": "" }, { "docid": "0262891fa447da300eeb8980030888c9", "score": "0.4477185", "text": "def set_client\n @client = Client.find(params[:id])\n end", "title": "" }, { "docid": "0262891fa447da300eeb8980030888c9", "score": "0.4477185", "text": "def set_client\n @client = Client.find(params[:id])\n end", "title": "" }, { "docid": "0262891fa447da300eeb8980030888c9", "score": "0.4477185", "text": "def set_client\n @client = Client.find(params[:id])\n end", "title": "" }, { "docid": "0262891fa447da300eeb8980030888c9", "score": "0.4477185", "text": "def set_client\n @client = Client.find(params[:id])\n end", "title": "" }, { "docid": "6aeb827c6cac6a2f369596d2722b736f", "score": "0.44744927", "text": "def after_create_notify_client_service\n\t\t\t\t\trequire \"open-uri\"\n\t\t\t\t\trequire \"net/http\"\n\t\t\t\t\trequire \"openssl\"\n\n\t\t\t\t\turi = URI.parse(self.install_url)\n\t\t\t\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\t\t\t\thttp.use_ssl = true if uri.scheme == \"https\"\n\n\t\t\t\t\trequest = Net::HTTP::Post.new(uri.request_uri)\n\t\t\t\t\trequest[\"Content-Type\"] = \"application/json\"\n\t\t\t\t\trequest.body = {\n\t\t\t\t\t\tclient_id: self.id,\n\t\t\t\t\t\tsecret: self.secret,\n\t\t\t\t\t\turl: ((MicroService::Client.configuration)? MicroService::Client.configuration.url : \"\"),\n\t\t\t\t\t\ttimestamp: self.created_at.to_i,\n\t\t\t\t\t}.to_json\n\n\t\t\t\t\tresponse = http.request(request)\n\n\t\t\t\t\t# Failed to register with external service\n\t\t\t\t\tif !response.kind_of? Net::HTTPSuccess\n\t\t\t\t\t\traise ::MicroService::Client::InstallError\n\t\t\t\t\tend\n\t\t\t\tend", "title": "" }, { "docid": "4882d813d4cde5a8493271cb78ab748f", "score": "0.44642833", "text": "def set_user\n @client = current_client\n end", "title": "" }, { "docid": "d8af8e523c737b7a32c31766509fdc83", "score": "0.44561276", "text": "def set_powerline_adapter\n @powerline_adapter = PowerlineAdapter.find(params[:id])\n end", "title": "" }, { "docid": "244edd81c18b1d589307c00dbe3b79ea", "score": "0.44522968", "text": "def set_client_landing_page\n\t\t\t@client_landing_page = ClientLandingPage.find(params[:id])\n\t\tend", "title": "" }, { "docid": "83011323317fd76b98d3f18d36c361cf", "score": "0.44515675", "text": "def add_client_app\n @client = Strava::OAuth::Client.new(\n client_id: ENV['STRAVA_CLIENT_ID'],\n client_secret: ENV['STRAVA_CLIENT_SECRET']\n )\n end", "title": "" }, { "docid": "62fbf518022d544a21550ee31f550e12", "score": "0.4451524", "text": "def set_client\n @client = Client.find(params[:client_id])\n end", "title": "" }, { "docid": "2fcb05bd81aec6a37f19b81229abee0c", "score": "0.4445852", "text": "def set_policy\n @policy = Policy.find(params[:id])\n @broker = @policy.broker\n end", "title": "" }, { "docid": "d8393c93526f9f4013354042215df4b5", "score": "0.44292226", "text": "def cs_starter_btn\n @staffer_service.delay.cs_starter\n # @staffer_service.cs_starter\n # redirect_to staffers_path\n redirect_to admin_developer_path\n end", "title": "" }, { "docid": "2856e7e33329d0af1807dedb5ce41688", "score": "0.44250685", "text": "def set_client\r\n @client = Client.find(params[:id])\r\n end", "title": "" }, { "docid": "4a2eebc61cb8e0c554ad58a4834808ce", "score": "0.44223005", "text": "def connect\n require 'osc-ruby' unless defined?(::OSC)\n port = additional_params[:port] || 3333\n @client = OSC::Server.new(port)\n super\n end", "title": "" }, { "docid": "5a271d6efded14ce2eeeab8c260ba755", "score": "0.4416491", "text": "def create\n @client = Client.new(params[:client])\n respond_to do |format|\n if @client.save\n @user = @client.complete_user\n flash[:notice] = 'Client was successfully created.'\n set_login_cookie(@user.get_psv)\n format.html { redirect_to(settings_path()) }\n format.xml { render :xml => @client, :status => :created, :location => @client }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @client.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "820262e31906deb60c2883db8cdb7455", "score": "0.44144902", "text": "def set_applicationclient\n @applicationclient = Applicationclient.find(params[:id])\n end", "title": "" }, { "docid": "19188559c317b1ba99ea7afab22be81c", "score": "0.4411412", "text": "def add_client(client)\n clients.push(client)\n end", "title": "" }, { "docid": "cb6f5c77eb20fd5c6cc34edd69547a43", "score": "0.44108474", "text": "def CreateBrowser()\r\n ret = @dispatch._invoke(1610743828, [], [])\r\n @lastargs = WIN32OLE::ARGV\r\n ret\r\n end", "title": "" }, { "docid": "a15158256b754985b2b8fac658974ce9", "score": "0.4406597", "text": "def initialize(client_class)\n @splayed = false\n\n @client_class = client_class\n end", "title": "" }, { "docid": "50eb5d8aad1dde35abcd4c7747024d04", "score": "0.4399979", "text": "def connect!\n start_em\n @client.ensure_connect\n end", "title": "" }, { "docid": "c0e51b8ad65fa516362b4a2b505f69b0", "score": "0.43951923", "text": "def set_client\r\n @client = Client.find(params[:id])\r\n end", "title": "" }, { "docid": "14eaa84086a5419241412a856ced17c1", "score": "0.43917385", "text": "def set_client_policy\n @client_policy = ClientPolicy.find(params[:id])\n end", "title": "" } ]
c98341bc5686ea91c3d0e663a9ac8819
Updates an employee's salary and wages record
[ { "docid": "a8f6e074b0f8c942aba07ff331e2b2f9", "score": "0.7276916", "text": "def update_employee_salary_and_wage(xero_tenant_id, employee_id, salary_and_wages_id, salary_and_wage, opts = {})\n data, _status_code, _headers = update_employee_salary_and_wage_with_http_info(xero_tenant_id, employee_id, salary_and_wages_id, salary_and_wage, opts)\n data\n end", "title": "" } ]
[ { "docid": "e3316e101372966331f956446cbcf6c9", "score": "0.7709596", "text": "def associate_salary_to_employee\n payroll_employee.update_attribute(:salary,new_salary.to_f.round(2))\n payroll_employee.update_value_salary_to_fixed_concept\n end", "title": "" }, { "docid": "429ffbc5bc93c938057f639cb9576c05", "score": "0.76787704", "text": "def update\n @payroll = Payroll.find(params[:id])\n @employe = Employe.find_by_id(params[:employe_id])\n @payroll.calculate_salary(@employe.salary)\n respond_to do |format|\n if @payroll.update_attributes(params[:payroll])\n format.html { redirect_to [@employe, @payroll], notice: 'Payroll was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n end\n end\n end", "title": "" }, { "docid": "0cdeae7b94bcb46be3b1ae3bf2448699", "score": "0.7234223", "text": "def update\n @employee.update(employee_params)\n end", "title": "" }, { "docid": "ca15c24f540dd55c9cbfd3ebbb039236", "score": "0.72191316", "text": "def update\n respond_to do |format|\n if @employee_salary.update(employee_salary_params)\n format.html { redirect_to @employee_salary, notice: 'Employee salary was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee_salary }\n else\n format.html { render :edit }\n format.json { render json: @employee_salary.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9f5a44fee6a138c0482d4010fc9ef7d3", "score": "0.712224", "text": "def update\n @salary = Salary.find(params[:id])\n\n respond_to do |format|\n if @salary.update_attributes(params[:salary])\n format.html { redirect_to(employee_salary_path(@salary.employee, :year => @salary.year_month.year), :notice => 'Salary was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit_salary\" }\n format.xml { render :xml => @salary.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b9d1da38c564a1aa5f1ed4ac67d94c74", "score": "0.70434743", "text": "def update\n\t\t@salary = Salary.find(params[:id])\n\n\t\t@salary.modified_by = 1\n\n\t\tif @salary.update_attributes(params[:da])\n\t\t\tflash[:notice] = 'Salary Account Updated Sucessfully.'\n\t\t\tredirect_to :action => 'show', :id => @salary\n\t\telse\n\t\t\trender :action => 'edit'\n\t\tend\n\tend", "title": "" }, { "docid": "3d3bafef6496ad3cc495a5d25e209963", "score": "0.70315886", "text": "def update\n @policy.update?\n if @employee.update(employee_params)\n success(@employee)\n else\n unprocessable_entity(@employee.errors)\n end\n end", "title": "" }, { "docid": "b9b7de510e30fb0df8609a12ed6731a6", "score": "0.69461906", "text": "def update\n o = SalaryAdjustment.find(params[:id])\n \n if o.update_attributes(:staff_id => params[:staff_id], :inc => params[:inc], \n :month => params[:month], :year => params[:year])\n render :json => { :success => 1, \n :message => 'Salary Adjustment was successfully updated.' }\n \n else\n render :json => PayRateHelper.get_errors(o.errors)\n end\n end", "title": "" }, { "docid": "ba01de95e8176c3aea261d47474f1827", "score": "0.69094557", "text": "def update\n if @employee.update(employee_params)\n redirect_to @employee, notice: \"Employee was successfully updated.\"\n else\n render :edit, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "ede5d610011cdfa3ebfcf76f142fa9f8", "score": "0.68869305", "text": "def update\n @employee = Employee.find(params[:id])\n @employee.update_attributes(params[:employee])\n get_data\n end", "title": "" }, { "docid": "715aa1c6e9fe72488626493732ce86ee", "score": "0.6845842", "text": "def update\n @employee = Employee.find(params[:id])\n @employees = Employee.all\n\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n format.html { redirect_to @employee, :notice=> 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action=> \"edit\" }\n format.json { render :json=> @employee.errors, :status=>unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "034fe9b2630856926dc3ec02a873716b", "score": "0.681587", "text": "def update\n respond_to do |format|\n if @employee_payroll.update(employee_payroll_params)\n format.html { redirect_to @employee_payroll, notice: 'Employee payroll was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee_payroll }\n else\n format.html { render :edit }\n format.json { render json: @employee_payroll.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9e330973cc70dd549b269b344688e885", "score": "0.6814836", "text": "def update\n @current_salary = CurrentSalary.find(params[:id])\n\n respond_to do |format|\n if @current_salary.update_attributes(params[:current_salary])\n format.html { redirect_to @current_salary, notice: 'Current salary was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @current_salary.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "96c9c420a9435c84922b2536962da6c9", "score": "0.6810648", "text": "def update\n @employee_pay = EmployeePay.find(params[:id])\n\n respond_to do |format|\n if @employee_pay.update_attributes(params[:employee_pay])\n format.html { redirect_to @employee_pay, notice: 'Employee pay was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employee_pay.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c93084bab93d41215baa0313a1482a9b", "score": "0.6802914", "text": "def update\n @employee = Employee.find(params[:id])\n if @employee.update(employee_params)\n redirect_to employees_path, :notice => 'Employee successfully updated'\n else\n render 'edit'\n end\n end", "title": "" }, { "docid": "4e265fffa5f2f7466ac01d072238be27", "score": "0.67792875", "text": "def update\n @advance_salary = @instalment.advance_salary\n respond_to do |format|\n if @instalment.update(instalment_params)\n format.html { redirect_to @advance_salary, notice: 'Instalment was successfully updated.' }\n format.json { render :show, status: :ok, location: @instalment }\n else\n format.html { render :edit }\n format.json { render json: @instalment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f4a88dad66db3773dc3ca3354cb3138b", "score": "0.6772373", "text": "def update\n @employee = Employee.find(params[:id])\n \n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "400ec0f28439e1ae1d45870b811c684e", "score": "0.67521614", "text": "def update\n respond_to do |format|\n if @change_salary.update(change_salary_params)\n format.html { redirect_to @change_salary, notice: 'Change salary was successfully updated.' }\n format.json { render :show, status: :ok, location: @change_salary }\n else\n format.html { render :edit }\n format.json { render json: @change_salary.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f5a928ce32774f1ad4cd0d9a7a2207ae", "score": "0.6743121", "text": "def update\n @salary_detail = SalaryDetail.find(params[:id])\n\n respond_to do |format|\n if @salary_detail.update_attributes(params[:salary_detail])\n format.html { redirect_to @salary_detail, notice: 'Salary detail was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @salary_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "df862b7404f8ba749322c8ef8cde657d", "score": "0.67355514", "text": "def update\n @employee = Employee.find params[:id]\n if @employee.update(employee_params)\n render status: :ok \n else \n render status: :bad_request\n end \n end", "title": "" }, { "docid": "d28596c7cc0ad93e9601058b29768397", "score": "0.67326874", "text": "def update\n #raise params.inspect\n @employee = Employee.find(params[:id])\n\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6e268be644c72376165b27e84cb36486", "score": "0.67323804", "text": "def update\n \n \n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ffa31827ffeca7b0fe9e33b1b621d3bb", "score": "0.6729792", "text": "def update\n respond_to do |format|\n if @salon_employee.update(salon_employee_params)\n format.html { redirect_to @salon_employee, notice: 'Salon employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @salon_employee }\n else\n format.html { render :edit }\n format.json { render json: @salon_employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "85e3165bfe000c6346598e064ffb4308", "score": "0.6722528", "text": "def update\n @employee = Employee.find(params[:id])\n \n if @employee.update(employee_params)\n redirect_to @employee\n else\n render 'edit'\n end\n end", "title": "" }, { "docid": "34d32af03c1daf705c2e96d2c64d88ad", "score": "0.6714791", "text": "def update\n respond_to do |format|\n if @salary.update(salary_params)\n format.html { redirect_to @salary, notice: 'Salary was successfully updated.' }\n format.json { render :show, status: :ok, location: @salary }\n else\n format.html { render :edit }\n format.json { render json: @salary.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7a9fd800e958fc9e450c1fcda500d885", "score": "0.6710208", "text": "def update\n @cash_employee.update cash_employee_params\n render 'action'\n end", "title": "" }, { "docid": "019aca25640206cb5e9ea5d1d8fab445", "score": "0.67064667", "text": "def update\n @attendance = Attendance.find(params[:id])\n\n respond_to do |format|\n if @attendance.update_attributes(params[:attendance])\n if Cutofftotalsalary.find_by_employee_name(@attendance.employee.name).nil?\n Cutofftotalsalary.find_by_employee_name(@attendance.employee.name).create(cutoff_id: Cutoff.last.id, name: @attendance.employee.name, salary_for_cutoff: @attendance.employee.cutoff)\n else\n Cutofftotalsalary.find_by_employee_name(@attendance.employee.name).update_attributes(cutoff_id: Cutoff.last.id, salary_for_cutoff: @attendance.employee.cutoff_salary)\n end\n ThirteenthMonthPay.find_by_employee_name(@attendance.employee.name).update_attributes(year: Date.today.strftime(\"%Y\").to_i, amount: @attendance.employee.thirteenth_month_pay)\n format.html { redirect_to current_employee, notice: 'Attendance was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @attendance.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e97865f05131020aa245ed93cecd99f7", "score": "0.6704628", "text": "def employee_structure\n @salary_date = params[:salery_date]\n @employee = Employee.find(params[:employee_id])\n @independent_categories = PayrollCategory.all\n @amount = params[:amount]\n @payroll_category = params[:id]\n @salary = Employee.emp(@employee, @payroll_category, @amount, @salary_date)\n @employee.update_payroll(@payroll_category, @amount, @salary_date)\n authorize! :update, @employee\n end", "title": "" }, { "docid": "6916742fdd608bb3c68e51ad939e5965", "score": "0.669899", "text": "def update\n if @employee.update employee_params\n redirect_to employees_url\n else\n render 'edit'\n end\n end", "title": "" }, { "docid": "64ee03d243775214a9f499d5b7496045", "score": "0.66625166", "text": "def update\n @employee = Employee.find(params[:id])\n\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "65583bb517dd6ba90142e88491b9472b", "score": "0.66614854", "text": "def update\n @employee_grade.update(employee_grade_params)\n @employee_grades = EmployeeGrade.all\n @employee_grade = EmployeeGrade.new\n end", "title": "" }, { "docid": "0895b3aed7b1309aa4db8d69653392fc", "score": "0.66603327", "text": "def update\n @employee = Employee.find(params[:id])\n\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n format.html { redirect_to admin_employee_path(@employee), notice: 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0895b3aed7b1309aa4db8d69653392fc", "score": "0.66603327", "text": "def update\n @employee = Employee.find(params[:id])\n\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n format.html { redirect_to admin_employee_path(@employee), notice: 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ed094703d6af60761080cff81a682204", "score": "0.66530734", "text": "def update\n respond_to do |format|\n if @employee.update_attributes(employee_params)\n format.html { redirect_to admin_employees_url, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "67c17cca7f9e23bbbd2e589192e940fb", "score": "0.6644121", "text": "def update\n respond_to do |format|\n if @bonus_employee.update(bonus_employee_params)\n format.html { redirect_to @bonus_employee, notice: 'Bonus employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @bonus_employee }\n else\n format.html { render :edit }\n format.json { render json: @bonus_employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2bcc921b0e4a60cd8d2415e52bdf4992", "score": "0.6639256", "text": "def update\n @employee = Employee.find(params[:id])\n\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2bcc921b0e4a60cd8d2415e52bdf4992", "score": "0.6639256", "text": "def update\n @employee = Employee.find(params[:id])\n\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2bcc921b0e4a60cd8d2415e52bdf4992", "score": "0.6639256", "text": "def update\n @employee = Employee.find(params[:id])\n\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2bcc921b0e4a60cd8d2415e52bdf4992", "score": "0.6639256", "text": "def update\n @employee = Employee.find(params[:id])\n\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2bcc921b0e4a60cd8d2415e52bdf4992", "score": "0.6639256", "text": "def update\n @employee = Employee.find(params[:id])\n\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2bcc921b0e4a60cd8d2415e52bdf4992", "score": "0.6639256", "text": "def update\n @employee = Employee.find(params[:id])\n\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4cfe780102c192479afe4aad6a4fb901", "score": "0.662182", "text": "def update\n begin\n @employee = Employee.find(params[:id])\n\n @updated_employee = @@data_util.hash_data_to_upper_case(@@data_util.strip_hash_data(params[:employee]),[])\n @updated_employee[:datehired] = Date.strptime(@updated_employee[:datehired], \"%m/%d/%Y\")\n\n if @employee.update_attributes(@updated_employee)\n @@request_result[:success] = true\n @@request_result[:notice] = 'Employee successfully updated.'\n else\n @@request_result[:errormsg] = @employee.errors.full_messages[0]\n end\n\n rescue Exception => e\n @@request_result[:errormsg] = e.message\n end\n\n render json: @@request_result\n end", "title": "" }, { "docid": "ad0e00076ccbc9a2951ba69096a79b2b", "score": "0.66214514", "text": "def update_employee_salary_and_wage_with_http_info(xero_tenant_id, employee_id, salary_and_wages_id, salary_and_wage, options = {})\n opts = options.dup\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PayrollUkApi.update_employee_salary_and_wage ...'\n end\n # verify the required parameter 'xero_tenant_id' is set\n if @api_client.config.client_side_validation && xero_tenant_id.nil?\n fail ArgumentError, \"Missing the required parameter 'xero_tenant_id' when calling PayrollUkApi.update_employee_salary_and_wage\"\n end\n # verify the required parameter 'employee_id' is set\n if @api_client.config.client_side_validation && employee_id.nil?\n fail ArgumentError, \"Missing the required parameter 'employee_id' when calling PayrollUkApi.update_employee_salary_and_wage\"\n end\n # verify the required parameter 'salary_and_wages_id' is set\n if @api_client.config.client_side_validation && salary_and_wages_id.nil?\n fail ArgumentError, \"Missing the required parameter 'salary_and_wages_id' when calling PayrollUkApi.update_employee_salary_and_wage\"\n end\n # verify the required parameter 'salary_and_wage' is set\n if @api_client.config.client_side_validation && salary_and_wage.nil?\n fail ArgumentError, \"Missing the required parameter 'salary_and_wage' when calling PayrollUkApi.update_employee_salary_and_wage\"\n end\n # resource path\n local_var_path = '/Employees/{EmployeeID}/SalaryAndWages/{SalaryAndWagesID}'.sub('{' + 'EmployeeID' + '}', employee_id.to_s).sub('{' + 'SalaryAndWagesID' + '}', salary_and_wages_id.to_s)\n\n # camelize keys of incoming `where` opts\n opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?\n\n # query parameters\n query_params = opts[:query_params] || {}\n \n # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:\n query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?\n query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'Xero-Tenant-Id'] = xero_tenant_id\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(salary_and_wage) \n\n # return_type\n return_type = opts[:return_type] || 'SalaryAndWageObject' \n\n # auth_names\n auth_names = opts[:auth_names] || ['OAuth2']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path, \"PayrollUkApi\", new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PayrollUkApi#update_employee_salary_and_wage\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "c72393a5c3eb8787ff21fcdad75a4119", "score": "0.66208225", "text": "def update\n @breadcrumb = 'update'\n @worker_salary_item = WorkerSalaryItem.find(params[:id])\n @worker_salary_item.updated_by = current_user.id if !current_user.nil?\n \n respond_to do |format|\n if @worker_salary_item.update_attributes(params[:worker_salary_item])\n format.html { redirect_to worker_salary_item_path(@worker_salary_item, salary: @worker_salary_item.worker_salary),\n notice: (crud_notice('updated', @worker_salary_item) + \"#{undo_link(@worker_salary_item)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @worker_salary_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7f9c4666d1f6d99c45894cdc6bde4c98", "score": "0.66184556", "text": "def update\n @employee = Employee.find(params[:id])\n\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n format.html { redirect_to @employee, notice: @employee.name.to_s + ' was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6bdd0d34ec169722b2c1cba34f46d0d8", "score": "0.661792", "text": "def update\n @employee = Employee.find(params[:id])\n\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n format.html { redirect_to @employee, notice: \"#{@employee.name} was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9c2030b8f9a9f37694283b8822b60ae9", "score": "0.66178864", "text": "def update_payroll(payroll_id, amount, salary_date)\n @payrolls = PayrollCategory.where(payroll_category_id: payroll_id)\n unless @payrolls.nil?\n @payrolls.each do |payrol|\n p_amount = (amount.to_f * payrol.percentage.to_f) / 100\n @payroll_salary = EmployeeSaleryStructure.where(employee_id: id, payroll_category_id: payrol.id).take\n if @payroll_salary.nil?\n EmployeeSaleryStructure.create(employee_id: id, payroll_category_id: payrol.id, amount: p_amount)\n else\n @payroll_salary.update(amount: p_amount)\n end\n update_payroll(payrol.id, p_amount, salary_date)\n end\n end\n end", "title": "" }, { "docid": "c990f10bf2217e725c3e7cb5c42c88bb", "score": "0.65886796", "text": "def update\n @employee = Employee.find(params[:id])\n\n respond_to do |format|\n @employee.assign_attributes(params.require(:employee).permit(:first_name, :last_name, :ssn, :store_id))\n parok = validateEmployee?(@employee)\n okUrl, errAction = setSaveAction('edit', employees_url)\n saveok = false\n if parok\n saveok = @employee.save\n end\n if parok and saveok\n format.html { redirect_to okUrl,\n notice: 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n prepFormVariables\n format.html { render action: errAction }\n format.json { render json: @employee.errors,\n status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "379c6ad83acc0084608410617040c481", "score": "0.65869606", "text": "def salary=(new_salary)\n\t\t@salary = new_salary\n\t\tchanged\n\t\tnotify_observers(self)\n\tend", "title": "" }, { "docid": "3c6655ea8231ae76c773391fe957f175", "score": "0.6578276", "text": "def update\n if @employee.update(employee_params)\n flash[:success] = \"Employee successfully updated\"\n redirect_to action: \"index\"\n else\n render 'edit'\n end\n end", "title": "" }, { "docid": "cc83f2bd911c0d581a26bb17cf492153", "score": "0.6577594", "text": "def set_employee_salary\n @employee_salary = EmployeeSalary.find(params[:id])\n end", "title": "" }, { "docid": "da45b5c4c0588166c707f9e7efbfa79e", "score": "0.6575588", "text": "def update\n @employee = Employee.find(params[:id])\n if @employee.update(add_employee_request)\n redirect_to @employee\n else\n render 'edit'\n end\n end", "title": "" }, { "docid": "11678f4f82b6c20ffab4d94767d5f0b7", "score": "0.6573541", "text": "def update\n @employee_post.update(employee_post_params)\n end", "title": "" }, { "docid": "5d93866bdfaef6c7a8588afe8c40c39c", "score": "0.65718025", "text": "def update\n params[:employee][:skill_ids] ||= []\n @employee = Employee.find(params[:id])\n\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n format.html { redirect_to(employees_path, :notice => 'Employee was successfully updated.') }\n format.xml { head :ok }\n else\n prepare\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @employee.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c34ec383f92b8d23eb15e8df34e27f23", "score": "0.6570201", "text": "def update\n respond_to do |format|\n if @emp_monthly_salary.update(emp_monthly_salary_params)\n format.html { redirect_to @emp_monthly_salary, notice: 'Emp monthly salary was successfully updated.' }\n format.json { render :show, status: :ok, location: @emp_monthly_salary }\n else\n format.html { render :edit }\n format.json { render json: @emp_monthly_salary.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f1165729aa722a01d79ab86219abdac9", "score": "0.6568846", "text": "def salary=(new_salary)\n @salary = new_salary\n notify_observers\n end", "title": "" }, { "docid": "5c491a2f2dcfa9db1d4f72c5e2add80e", "score": "0.65606046", "text": "def update\n if @employee.update(employee_params)\n redirect_to @employee, notice: 'Параметры изменены.'\n else\n render :edit\n end\n end", "title": "" }, { "docid": "5a5a600856a9407b09c4b092d934b354", "score": "0.6554946", "text": "def update\n respond_to do |format|\n if @salary_break_up.update(salary_break_up_params)\n format.html { redirect_to salary_break_ups_path, notice: 'Salary break up was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @salary_break_up.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7f5a4322eb55787158ba7ee48ec89dd3", "score": "0.65504843", "text": "def update\n @employee = Employee.find(params[:id])\n\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n format.html { if @office.nil?\n redirect_to employees_path, notice: 'Employee was successfully updated.'\n else\n redirect_to office_employees_path(@office), notice: 'Employee was successfully updated.'\n end }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c534982e565526e671d010d467a890f0", "score": "0.6543518", "text": "def update\np \"+++++++params updaye+++++=\"\np params \np \"++++++++\"\n @employee = Employee.find(params[:id])\n\n respond_to do |format|\n if @employee.update_attributes(params[:employee]) \n format.json { render json: nil, status: :ok }\n else \n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2fbbe5266eca2715f08550ce558b95a1", "score": "0.65405744", "text": "def update_employee_salary_and_wage_with_http_info(xero_tenant_id, employee_id, salary_and_wages_id, salary_and_wage, options = {})\n opts = options.dup\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PayrollNzApi.update_employee_salary_and_wage ...'\n end\n # verify the required parameter 'xero_tenant_id' is set\n if @api_client.config.client_side_validation && xero_tenant_id.nil?\n fail ArgumentError, \"Missing the required parameter 'xero_tenant_id' when calling PayrollNzApi.update_employee_salary_and_wage\"\n end\n # verify the required parameter 'employee_id' is set\n if @api_client.config.client_side_validation && employee_id.nil?\n fail ArgumentError, \"Missing the required parameter 'employee_id' when calling PayrollNzApi.update_employee_salary_and_wage\"\n end\n # verify the required parameter 'salary_and_wages_id' is set\n if @api_client.config.client_side_validation && salary_and_wages_id.nil?\n fail ArgumentError, \"Missing the required parameter 'salary_and_wages_id' when calling PayrollNzApi.update_employee_salary_and_wage\"\n end\n # verify the required parameter 'salary_and_wage' is set\n if @api_client.config.client_side_validation && salary_and_wage.nil?\n fail ArgumentError, \"Missing the required parameter 'salary_and_wage' when calling PayrollNzApi.update_employee_salary_and_wage\"\n end\n # resource path\n local_var_path = '/Employees/{EmployeeID}/SalaryAndWages/{SalaryAndWagesID}'.sub('{' + 'EmployeeID' + '}', employee_id.to_s).sub('{' + 'SalaryAndWagesID' + '}', salary_and_wages_id.to_s)\n\n # camelize keys of incoming `where` opts\n opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?\n\n # query parameters\n query_params = opts[:query_params] || {}\n \n # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:\n query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?\n query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'Xero-Tenant-Id'] = xero_tenant_id\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(salary_and_wage) \n\n # return_type\n return_type = opts[:return_type] || 'SalaryAndWageObject' \n\n # auth_names\n auth_names = opts[:auth_names] || ['OAuth2']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path, \"PayrollNzApi\", new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PayrollNzApi#update_employee_salary_and_wage\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "43b2c6e8e88ca2be90f2917942aad321", "score": "0.65391445", "text": "def update\n if @employee.update_attributes(params[:employee])\n flash[:notice] = t('messages.employee.success.save')\n else\n flash[:alert] = t('messages.employee.errors.save')\n end\n\n redirect_to partner_employees_url(@partner)\n end", "title": "" }, { "docid": "bbace33e3357f2dc74dafa62c553cbe5", "score": "0.65344983", "text": "def update\n @employee = Employee.find(params[:id])\n \n if @employee.update(employee_params)\n redirect_to @employee else\n render 'edit'\n end\n end", "title": "" }, { "docid": "26dfe40284bf7f3598dbf0b79e5baec4", "score": "0.65312964", "text": "def update\n @salary_level = SalaryLevel.find(params[:id])\n\n respond_to do |format|\n if @salary_level.update_attributes(params[:salary_level])\n flash[:notice] = \"SalaryLevel #{@salary_level.name} was successfully updated.\"\n format.html { redirect_to_index }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @salary_level.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0e0685f17ed938b523c2263cf7c589cb", "score": "0.6529568", "text": "def update\n @employee = Employee.find(params[:id])\n @employee.availability_rules = availability_rules_from_params\n \n reassign_employee_memberships\n \n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n flash[:notice] = 'Employee was successfully updated.'\n format.html { redirect_to(@employee) }\n format.xml { head :ok }\n else\n format.html do\n flash[:error] = @employee.errors.full_messages\n redirect_to :action => \"edit\"\n end\n format.xml { render :xml => @employee.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "14a1bbf34bbb8c36dd0fa529195c3d64", "score": "0.65256643", "text": "def update\n\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2d436ec8e6f0e7e0534e5fac94d1a563", "score": "0.65251744", "text": "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to employees_path, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: employees_path}\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9d3695d748578af968b11c756bd825c6", "score": "0.6522251", "text": "def update\r\n @employee = Employee.find(params[:id])\r\n @skills = Skill.all\r\n \r\n if @employee.update_attributes(params[:employee])\r\n sign_in @employee\r\n @employee.to_developer_skills(@employee.current_skills)\r\n @employee.to_desired_skills(@employee.skills_interested_in)\r\n redirect_to @employee\r\n else\r\n render 'edit'\r\n end\r\n end", "title": "" }, { "docid": "89417372e35af108bd5ae9385bcbde3f", "score": "0.6522203", "text": "def update\n @employee_record = EmployeeRecord.find(params[:id])\n\n respond_to do |format|\n if @employee_record.update_attributes(params[:employee_record])\n format.html { redirect_to @employee_record, notice: 'Employee record was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employee_record.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "05c13ad3ae131c0f3a04cd674e225276", "score": "0.6521184", "text": "def update\n #raise params[:employee].inspect\n\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n format.html { redirect_to(@employee, :notice => t('scaffold.notice.updated', :item=> Employee.model_name.human)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @employee.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cd07431ff8e1ccb169483ab2227ee4e8", "score": "0.6513082", "text": "def update\n @employee_expense = EmployeeExpense.find(params[:id])\n\n respond_to do |format|\n if @employee_expense.update_attributes(params[:employee_expense])\n format.html { redirect_to(@employee_expense, :notice => 'Employee expense was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @employee_expense.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "25e204aceb264f5c2890b228893fbd0d", "score": "0.6495726", "text": "def update\n @employee = Employee.find(params[:id])\n\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n format.html { redirect_to(@employee, :notice => 'Employee was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @employee.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "25e204aceb264f5c2890b228893fbd0d", "score": "0.6495726", "text": "def update\n @employee = Employee.find(params[:id])\n\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n format.html { redirect_to(@employee, :notice => 'Employee was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @employee.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "25e204aceb264f5c2890b228893fbd0d", "score": "0.6495726", "text": "def update\n @employee = Employee.find(params[:id])\n\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n format.html { redirect_to(@employee, :notice => 'Employee was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @employee.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c44337d289a7098eea97ce9143b31394", "score": "0.6489984", "text": "def update \n if @employee.update(employee_edit_params)\n redirect_to employees_path \n else\n render 'edit' \n end \n end", "title": "" }, { "docid": "7c3a8ae245a3e2bc942bce828dc814d4", "score": "0.6484938", "text": "def update\n @employee = Employee.find(params[:id])\n\n respond_to do |format|\n if @employee.update_attributes(employee_params)\n format.html { redirect_to @employee, notice: 'El empleado ha sido actualizado correctamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9eb2bd9c17636e92e5df87eb10179b34", "score": "0.6482632", "text": "def update\n if @employee.update(employee_params)\n render :show, status: :ok\n else\n render json: @employee.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "c01a556c1b50f0aa0f80428172f9572e", "score": "0.6481324", "text": "def update\n respond_to do |format|\n if @overtime_salary.update(overtime_salary_params)\n format.html { redirect_to @overtime_salary, notice: 'Overtime salary was successfully updated.' }\n format.json { render :show, status: :ok, location: @overtime_salary }\n else\n format.html { render :edit }\n format.json { render json: @overtime_salary.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2dd31ffe60851873e8fbbf6fbf4d0465", "score": "0.6464082", "text": "def update\n @salary_rate = SalaryRate.find(params[:id])\n\n respond_to do |format|\n if @salary_rate.update_attributes(params[:salary_rate])\n format.html { redirect_to @salary_rate, notice: 'Salary rate was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @salary_rate.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5bb9a26eb4efb49ec0cafbd9a56a27a8", "score": "0.64584255", "text": "def update\n\n if @employee.update(employee_params)\n redirect_to employees_path, notice: '员工信息已保存.'\n\n else\n render :edit\n\n end\n\n end", "title": "" }, { "docid": "108f959e33c8f84f856e1e1000f7b189", "score": "0.6457984", "text": "def update\n @msalary = Msalary.find(params[:id])\n\n respond_to do |format|\n if @msalary.update_attributes(params[:msalary])\n format.html { redirect_to @msalary, notice: 'Msalary was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @msalary.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0c199cc5aaf615ed8c322ae7115eaa98", "score": "0.6454596", "text": "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to [@store,@employee], notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9077e83dd490731238e97e3b6e6546b9", "score": "0.64545494", "text": "def update\n id = get_employee_id\n o = Employee.find(id)\n \n if EmployeeHelper.update_info(o, params)\n render :json => { :success => 1, \n :message => 'Personal Details was successfully updated.' }\n \n else\n render :json => EmployeeHelper.get_errors(o.errors)\n end\n end", "title": "" }, { "docid": "e63e5e1e1807d3327a6a9f27b76582dd", "score": "0.64541364", "text": "def update\n access(:update)\n checked_params = check_params(EMPLOYEE_PROPERTIES)\n checked_params[\"office\"] = Office.find(employee_params[:office_id])\n respond_to do |format|\n if @employee.update(checked_params)\n format.html { redirect_to @employee}\n format.json { render :show, status: :ok, location: @employee }\n else\n @offices = Office.all\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b1b9266c5a35842c21e60cbae69bb4a1", "score": "0.6452623", "text": "def update\n @incentive_effect_on_employee = IncentiveEffectOnEmployee.find(params[:id])\n\n respond_to do |format|\n if @incentive_effect_on_employee.update_attributes(params[:incentive_effect_on_employee])\n format.html { redirect_to(@incentive_effect_on_employee, :notice => 'Incentive effect on employee was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @incentive_effect_on_employee.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "85248f2e36bbcc5e850c7c3e5a4a05b3", "score": "0.64507425", "text": "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "85248f2e36bbcc5e850c7c3e5a4a05b3", "score": "0.64507425", "text": "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "85248f2e36bbcc5e850c7c3e5a4a05b3", "score": "0.64507425", "text": "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "85248f2e36bbcc5e850c7c3e5a4a05b3", "score": "0.64507425", "text": "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "85248f2e36bbcc5e850c7c3e5a4a05b3", "score": "0.64507425", "text": "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "85248f2e36bbcc5e850c7c3e5a4a05b3", "score": "0.64507425", "text": "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "85248f2e36bbcc5e850c7c3e5a4a05b3", "score": "0.64507425", "text": "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "85248f2e36bbcc5e850c7c3e5a4a05b3", "score": "0.64507425", "text": "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "85248f2e36bbcc5e850c7c3e5a4a05b3", "score": "0.64507425", "text": "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "85248f2e36bbcc5e850c7c3e5a4a05b3", "score": "0.64507425", "text": "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "85248f2e36bbcc5e850c7c3e5a4a05b3", "score": "0.64507425", "text": "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "85248f2e36bbcc5e850c7c3e5a4a05b3", "score": "0.64507425", "text": "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "85248f2e36bbcc5e850c7c3e5a4a05b3", "score": "0.64507425", "text": "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "85248f2e36bbcc5e850c7c3e5a4a05b3", "score": "0.64507425", "text": "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
a791f9d5801e4d5abfd2c152c60717a8
......................................................................................................... process chat messages .........................................................................................................
[ { "docid": "660a737924d5d668adabfe3e2ab2a3bf", "score": "0.0", "text": "def on_message_chat(pipe, stanza)\n params = {:xmlns => 'message:chat', :to => stanza.from.to_s, :from => stanza.from.to_s, \n :id => stanza.id, :body => stanza.body}\n AgentXmpp.logger.info \"RECEIVED CHAT MESSAGE FROM: #{stanza.from.to_s}\"\n Controller.new(pipe, params).invoke_chat\n end", "title": "" } ]
[ { "docid": "5da1fd32d706ba3772e0c8ae4830e3a1", "score": "0.7299133", "text": "def on_chat_message(data)\n begin\n message = data['attrs']['text']\n user = @userlist[data['attrs']['name']]\n $logger.info \"<#{user.name}> #{message}\"\n @handlers[:message].each { |handler| handler.call(message, user) }\n rescue => e\n $logger.fatal e\n end\n end", "title": "" }, { "docid": "1da18fcaca6394b2168617c292ba3818", "score": "0.7281658", "text": "def handle_messages()\n ##\n end", "title": "" }, { "docid": "21b5c99fa3d159e40e30d32d150d6a5a", "score": "0.7269506", "text": "def chatroom_message(msg)\n body = msg.body.to_s\n out(\"received chatroom message #{body}\")\n\n # update room status every config[\"msgs_until_refresh\"] messages\n # Use a countdown and not mod to avoid skips happenning if multiple messages come at once\n if(@time_until_list <= 0)\n respond(msg, \"/list\")\n @time_until_list = @config[\"msgs_until_refresh\"]\n else\n @time_until_list -= 1\n end\n\n # redo the /list whenever anybody changes their name or joins the room\n if(/^\\'(.*)\\' is now known as \\'(.*)\\'/.match(body) ||\n /^.* has joined the channel with the alias '.*'/.match(body) )\n out(\"sending /list because of user change\")\n respond(msg, \"/list\")\n return\n end\n\n # handle /list result when it comes in\n if(/^Listing members of '#{@config[\"room_name\"]}'\\n/.match(body))\n out(\"received a room listing.\")\n listing_refresh(body)\n return\n end\n\n # messages starting and ending with '_' are config[\"emotes\"]\n if body[0].chr == '_' && body[body.length - 1].chr == '_'\n chatroom_emote(msg)\n return\n end\n\n # getting here means the message was a regular comment from a user\n regular_user_chatroom_message(msg)\n end", "title": "" }, { "docid": "a87a3738507936c7cc586f8522da3430", "score": "0.7193148", "text": "def process_incoming_message\r\n\t response = \"\"\r\n\t sid = (params[:screen] || \"1\").to_i\r\n screen = Screen.find_or_create_by_id(sid)\r\n\t phone_num = params[:phone_number]\r\n\t body = params[:body]\r\n\t \r\n\t if phone_num && body\r\n \t displayed = true\r\n \t user = User.find_or_initialize_by_phone_num(:phone_num => phone_num, :on_list => false)\r\n\r\n if user.new_record? || user.update_expired_seq_num\r\n # New record or new session\r\n user.save!\r\n displayed = false\r\n response = MSG_WELCOME.gsub('[ID]', user.seq_num.to_s)\r\n \r\n # This is an unusual case, but we cover it as it may appear in debugging / demoing.\r\n # Usually the first thing we see from new phones is the Keyword.\r\n response = \"\" if ALL_COMMANDS.include?(body.downcase.strip)\r\n else\r\n case body.downcase\r\n when CMD_SUBSCRIBE\r\n user.update_attribute(:on_list, true)\r\n displayed = false\r\n response = MSG_SUBSCRIBE\r\n when CMD_HELP\r\n displayed = false\r\n response = MSG_HELP if user.on_list\r\n when CMD_UNSUBSCRIBE\r\n displayed = false\r\n if user.on_list\r\n user.update_attribute(:on_list, false)\r\n response = MSG_UNSUBSCRIBE\r\n end\r\n else\r\n # Normal message\r\n if Message::personal?(body)\r\n recipient = Message::recipient(body)\r\n if recipient.nil?\r\n displayed = false\r\n else\r\n body = Message::textual_body(body)\r\n send_message(recipient.phone_num, \"#{user.seq_num}: #{body}\", screen)\r\n end\r\n end\r\n end\r\n end\r\n\r\n \t message = Message.create(:body => body, :user => user, :displayed => displayed, :screen => screen, :recipient => recipient)\r\n\r\n \t logger.error(\"Saving of the message errored: #{message.errors.inspect}\") if message.new_record?\r\n\t end\r\n\t \r\n\t render :text => set_storename(response, screen.name)\r\n end", "title": "" }, { "docid": "c6e645d499983265d0a744435b72c190", "score": "0.7187432", "text": "def chatroom_message(msg, cl, state)\n body = msg.body.to_s\n \n # update room status every MSGS_UNTIL_REFRESH messages\n # Use a countdown and not mod to avoid skips happenning if multiple messages come at once\n if(state[:time_until_list] <= 0)\n respond(msg, cl, \"/list\")\n state[:time_until_list] = MSGS_UNTIL_REFRESH\n else\n state[:time_until_list] -= 1\n end\n\n # redo the /list whenever anybody changes their name or joins the room\n if(/^\\'(.*)\\' is now known as \\'(.*)\\'/.match(body) ||\n /^.* has joined the channel with the alias '.*'/.match(body) )\n out(\"sending /list because of user change\")\n respond(msg, cl, \"/list\")\n return\n end\n \n # handle /list result when it comes in\n if(/^Listing members of '#{ROOM_NAME}'\\n/.match(body))\n out(\"received a room listing.\")\n listing_refresh(state, body)\n return\n end \n \n # messages starting and ending with '_' are emotes \n if body[0].chr == '_' && body[body.length - 1].chr == '_'\n chatroom_emote(msg, cl, state)\n return\n end\n\n # getting here means the message was a regular comment from a user\n regular_user_chatroom_message(msg, cl, state)\nend", "title": "" }, { "docid": "68ce6fb91f68bf1c1cf0cba72b64596e", "score": "0.7149113", "text": "def listen_for_messages\n queue = @channel.queue(\"Hello\")\n queue.bind(@exchange).subscribe do |delivery_info, metadata, payload|\n data = JSON.parse(payload)\n display_message(data['user'], data['message'])\n \n#Part that after uncommenting allows to chat beetwen two \n#chat.rb apps (send and recive messages)\n #user = data.match(\" \").pre_match\n #message = data.match(\" \").post_match\n #display_message(user, message)\n end\n end", "title": "" }, { "docid": "d10d6722dded89b63de5f923df1bdc5b", "score": "0.70869017", "text": "def process_message(message)\n end", "title": "" }, { "docid": "c94d1e901a6c16602b3d8c3881ab1b7f", "score": "0.70073354", "text": "def handle_message(message); end", "title": "" }, { "docid": "58edfd10d3dd290d9bbef1b826bc9462", "score": "0.7003744", "text": "def chat; end", "title": "" }, { "docid": "caaf66e528c9eb7738188263c13fda85", "score": "0.7002065", "text": "def process_messages\n\n # if any accounts have authorized, add to forwarding list\n @connection.new_subscriptions do |account|\n @authorized_targets << account\n end\n\n # forward all messages received\n @connection.received_messages do |msg|\n @logger.info { \"#{msg.from.to_s}: #{msg.body}\" }\n email = msg.from.to_s[/(.*)\\//, 1] || msg.from.to_s\n nickname = email[/(.*)\\@/,1] #everything before the \"@\"\n\n # don't send message back to sender\n targets.reject{|t| t == email}.each do |account|\n if msg.type == :chat\n @connection.deliver(account, \"[#{nickname}] #{msg.body}\")\n end\n end\n end\n \n end", "title": "" }, { "docid": "4c3c0a2aa358fa58d55f9887768251ff", "score": "0.6993781", "text": "def receive_message(msg)\r\n end", "title": "" }, { "docid": "4d120602e249911998a84c752fb0c782", "score": "0.6979469", "text": "def on_message(msg); end", "title": "" }, { "docid": "4d120602e249911998a84c752fb0c782", "score": "0.6979469", "text": "def on_message(msg); end", "title": "" }, { "docid": "075ee9fc87ffb81ffc483168ec81c9f0", "score": "0.6952215", "text": "def receive_message ( msg )\n msg.strip!\n if /^PING :(.+)$/i =~ msg # Reply to PINGs to keep the connection alive\n send \"PONG :#{$1}\"\n @log.info \"ping received at [#{Time.now.strftime('%H:%M:%S')}] \\n\"\n \n else\n @log.info \"<-- #{msg}\\n\"\n log_raw msg\n \n # Messages from Server should come as follows:\n # :<nick>!<userName>@<userDomain> <action> <action-specific-parameters>\n process_message $1, $2, $3 if /^:(.+?)\\s(.+?)\\s(.*)/ =~ msg\n end\n end", "title": "" }, { "docid": "b93494472c640c05b12c482b4448e573", "score": "0.68627495", "text": "def messaging; end", "title": "" }, { "docid": "816e049d48949030d36bfb4c3f3ee60c", "score": "0.683912", "text": "def receive_msg(msg); end", "title": "" }, { "docid": "fc99bbbff5f5dd5fe573499b32d28b90", "score": "0.6838158", "text": "def start_message_callback\n @xmpp_client.add_message_callback do |m|\n # Only process messages from people on our approved list\n if @buddies.include? m.from.strip.to_s\n # Only process chat messages with a body\n if m.type == :chat && !m.body.nil?\n json_msg = {:from => m.from, :body => m.body}.to_json\n # By pushing onto the the list, we effectively queue up \n # something for the backend to process.\n @redis_client.lpush(@redis_in_key, json_msg)\n end\n end\n end\n end", "title": "" }, { "docid": "1cfb451c464201234fd4996fe25cbd75", "score": "0.6833965", "text": "def process(message); end", "title": "" }, { "docid": "ab49c7281dfd67a62a07750f8a6f4a71", "score": "0.68038565", "text": "def process_message(notification, raw_text, socket, root_obj, list)\r\n\tfrom = notification[3]\r\n\t\r\n\t# split the raw text sent from the server\r\n\tserver_message = raw_text.split\r\n\t\r\n\t# switch on the code that was sent\r\n\tcase server_message.first\r\n\t\r\n\t\t# 140 means a user connected. Get the username, and add them to the list of connected users\r\n\t\twhen \"140\"\r\n\t\t\t# Create a new hash\r\n\t\t\tuser_hash = Hash.new\r\n\t\t\t\r\n\t\t\tmessage = server_message[3]\r\n\t\t\t\r\n\t\t\t# get the username\r\n\t\t\tuser=message.split('@')\r\n\t\t\tuser_hash[\"name\"] = user[0]\r\n\t\t\t\r\n\t\t\t# push it into our local user list\r\n\t\t\tlist << user_hash\r\n\t\t\t\r\n\t\t\t# add the user to the user_list window\r\n\t\t\troot_obj.user_list.insert(\"end\", list[list.length - 1][\"name\"] + \"\\n\")\r\n\t\t\t\r\n\t\t\troot_obj.chat_window.insert(\"end\", raw_text)\r\n\t\t\t\r\n\t\t# 150 means that the message is a unicast, so construct the message to look a bit different from broadcasts\r\n\t\twhen \"150\"\r\n\t\t\tfrom = notification[2]\r\n\t\t\tcode = server_message.shift\r\n\t\t\tmessage = server_message.join \" \"\r\n\t\t\tunicast_message = \"Message to you from \" + from + \" \" + message + \"\\n\"\r\n\t\t\troot_obj.chat_window.insert(\"end\", unicast_message)\r\n\t\t\t\r\n\t\t# 190 means a user disconnected\r\n\t\twhen \"190\"\r\n\t\t\t# variable to use for the index\r\n\t\t\tind = 0\r\n\t\t\t\r\n\t\t\tmessage = server_message[1]\r\n\t\t\t\r\n\t\t\t# get the username that just disconnected\r\n\t\t\tuser_raw=message.split('@')\r\n\t\t\tuser=user_raw.shift\r\n\t\t\t\r\n\t\t\t# find the user in our local list of users\r\n\t\t\tlist.each_with_index do |item, index|\r\n\t\t\t\tif item[\"name\"] == user\r\n\t\t\t\t\tind = index\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\t\t\r\n\t\t\t# delete the user from our local array\r\n\t\t\tlist.delete_at(ind)\r\n\t\t\t\r\n\t\t\t# clear and re-populate the user list window\r\n\t\t\troot_obj.user_list.delete('0.0', 'end')\r\n\t\t\tlist.each do |item|\r\n\t\t\t\troot_obj.user_list.insert('end', item[\"name\"] + \"\\n\")\r\n\t\t\tend\r\n\t\t\t\r\n\t\t\troot_obj.chat_window.insert(\"end\", raw_text)\r\n\t\t\t\r\n\t\telse\r\n\t\t\troot_obj.chat_window.insert(\"end\", from + \": \" + raw_text)\r\n\tend # end case\r\nend", "title": "" }, { "docid": "357d81ce226747d6245cceb5b355bfd5", "score": "0.67825186", "text": "def handle(msg); end", "title": "" }, { "docid": "61d2cbf89f7e89af24cc1cac31896420", "score": "0.67779875", "text": "def process_msg( sender, msg )\n self.check_connections\n @clients.each do |user, io|\n io.puts( \"<#{sender}> #{msg}\") unless sender == user\n end\n end", "title": "" }, { "docid": "e64a08612deb8a5bad2a34400f84667e", "score": "0.6746485", "text": "def process(message)\n end", "title": "" }, { "docid": "596a0b2a21a2e345a6dcce8bdc3383c3", "score": "0.67244375", "text": "def read_messages\n end", "title": "" }, { "docid": "5e11aeb352d45545d714078ca995ac8e", "score": "0.66864204", "text": "def receive\n\t\t\t#repeat until the user want to quit\n\t\t\twhile @mess!=\"bye\" do\n\t\t\t\t#method that reads the revceived message and puts in msg variable\n\t\t\t\t@jabber.received_messages do |msg| \n\t\t\t\t\tif msg.from.node == @to_username\n\t\t\t\t\t\tputs \"==============================================\" \t\t\t\n\t\t\t\t\t\tputs @to_username.colorize(:color => :black,:background => :yellow) +\": \" + msg.body.colorize(:green) \t#display message in screen\n\t\t\t\t\t\tputs Time.now.to_s.colorize(:gray)\t\t\t\t\t\t#display the time of message received\n\t\t\t\t\t\tsystem('espeak \"Got message\" > /dev/null 2>&1')\n\t\t\t\t\t \tputs \"**********************************************\" \n\t\t\t\t\t\tsleep(2)\t#for multithreading\n\t\t\t\t\tend\n\t\t\t \tend\n\t\t\tend\n\t\t\t#quit\n\t\tend", "title": "" }, { "docid": "3753840e4c1b798937fe82c70031beff", "score": "0.6682471", "text": "def process_message\n message_a = @incoming_message_body.split\n cmd = message_a.first.downcase\n case cmd\n when /tasks/\n @response_message = process_tasks_msg\n when /^[0-9]+$/ #TODO: should return the description along with menu AND also set task context\n @response_message = process_describe_msg(cmd)\n set_task_context(cmd)\n when /describe/\n @response_message = process_describe_msg(message_a[1]) #TODO: EDIT: if no number in message_a[1], should look for context and describe that task\n set_task_context(message_a[1])\n when /more/ # note: untested\n @response_message = process_more_msg\n #when /^say [0-9]+ .*$/ # dennis: please fix, happens when user texts in 'say comment_body' while in a task context\n when /^finish/\n finish_task\n when /^say/\n comment_body = message_a.values_at(1..(message_a.size)).join(\" \").rstrip\n @response_message = process_comment_msg(comment_body)\n #when //\n #when /complete/\n #when /notes/ #get the comments (assumes a task context)\n else\n @response_message = process_help_msg\n end\n save_excess if @excess\n end", "title": "" }, { "docid": "b52d9b8d5e9b1e01e6ab3b3cb682efa4", "score": "0.6666182", "text": "def process\n send_message if !message_empty? && message_to_bot?\n end", "title": "" }, { "docid": "e75dfee0ee14a04876f0df23b2979314", "score": "0.66621524", "text": "def received_message(event)\n sender_id = event['sender']['id']\n recipient_id = event['recipient']['id']\n time_of_message = event['timestamp']\n message = event['message']\n\n puts \"Received message for user #{sender_id} and page #{recipient_id} at #{time_of_message} with message: #{message}\"\n puts JSON.pretty_generate(message)\n\n message_id = message['mid']\n puts \"message_id => #{message_id}\"\n\n # You may get a text or attachment but not both\n message_text = message['text']\n message_attachments = message['attachments']\n\n if message_text\n\n # If we receive a text message, check to see if it matches any special\n # keywords and send back the corresponding example. Otherwise, just echo\n # the text we received.\n case message_text\n when 'image'\n send_image_message(sender_id)\n when 'gif'\n send_gif_message(sender_id)\n when 'audio'\n send_audio_message(sender_id)\n when 'video'\n send_video_message(sender_id)\n when 'file'\n send_file_message(sender_id)\n when 'button'\n send_button_message(sender_id)\n when 'generic'\n send_generic_message(sender_id)\n when 'receipt'\n send_receipt_message(sender_id)\n when'quick reply'\n send_quick_reply(sender_id)\n when 'read receipt'\n send_read_receipt(sender_id)\n when 'typing on'\n send_typing_on(sender_id)\n when 'typing off'\n send_typing_off(sender_id)\n when 'account linking'\n send_account_linking(sender_id)\n else\n send_text_message(sender_id, message_text)\n end\n elsif message_attachments\n send_text_message(sender_id, 'Message with attachment received')\n end\nend", "title": "" }, { "docid": "3ccb77aa61b3e708d6d6c875fc7a8895", "score": "0.6660035", "text": "def process_messages\n unprocessed_messages.each do |message|\n response = assemble_response(message)\n send_reply_to_message(message, response) unless response.nil?\n end\n end", "title": "" }, { "docid": "549d9b1b2f4a27c033b0279f91f8171b", "score": "0.66589457", "text": "def receive_messages(message_return_value_hash); end", "title": "" }, { "docid": "a0e13fcff4aa3e8b5bdc5f7de488aaf6", "score": "0.66563886", "text": "def receive_message; end", "title": "" }, { "docid": "7ffe635c868cb97f875a1616e9e25670", "score": "0.66494197", "text": "def on_message(m)\n\tend", "title": "" }, { "docid": "98868d48478c4c40d78b73ef4e0aa42c", "score": "0.6640366", "text": "def handle_message(ws, msg)\n puts \"Received message: #{msg}\"\n msg = JSON.parse(msg)\n client = @clients[ws]\n\n # New User\n if (msg.has_key?(\"new_user\"))\n client.name = assign_name(msg['new_user'])\n if (client.name.start_with?('TV'))\n @tv_clients[ws] = client\n ws.send JSON.generate({\n tv_client: client.name,\n })\n puts 'TV connected'\n else\n send_all \"New user: #{client.name}!\".to_json\n ws.send \"Welcome on the server #{client.name}!\".to_json\n ws.send \"All users: #{client_names.join(\",\")}\".to_json\n ws.send JSON.generate({\n client_name: client.name,\n all_participants: build_all_participants_hash\n })\n end\n\n # User Logout\n elsif (msg.has_key?(\"user_logout\"))\n @quiz_participants.each do |_, participants|\n participants.delete(client)\n end\n send_all JSON.generate({\n disconnected_client: client.name,\n })\n\n # New Quiz Participant\n elsif (msg.has_key?(\"new_quiz_participant\"))\n quiz_id = msg[\"new_quiz_participant\"][\"quiz_id\"].to_i\n @quiz_participants[quiz_id] = [] if @quiz_participants[quiz_id].nil?\n @quiz_participants[quiz_id] << client\n\n send_all JSON.generate({\n new_quiz_participant: {\n user_name: client.name,\n quiz_id: quiz_id,\n }\n })\n\n # Quiz Participant Quits\n elsif (msg.has_key?(\"quiz_participant_quit\"))\n quiz_id = msg[\"quiz_participant_quit\"][\"quiz_id\"].to_i\n @quiz_participants.each do |_, participants|\n participants.delete(client)\n end\n\n send_all JSON.generate({\n quiz_participant_quit: {\n user_name: client.name,\n quiz_id: quiz_id,\n }\n })\n\n # Start Quiz\n elsif (msg.has_key?(\"start_quiz\"))\n quiz_id = msg[\"start_quiz\"].to_i\n reset_quiz(quiz_id)\n\n send_all_quiz_participants quiz_id, JSON.generate({\n start_quiz: quiz_id\n })\n @quiz_participants[quiz_id].each do |client|\n client.tta[msg[\"first_question\"].to_i] = Time.now.to_i\n end\n\n # Question Answered\n elsif (msg.has_key?(\"question_answered\"))\n question_id = msg[\"question_answered\"].to_i\n handle_client_answer(client, question_id, msg[\"answer_id\"], msg[\"correct_answer\"])\n quiz_id = msg[\"quiz_id\"].to_i\n unless (client.tta[question_id].nil?) \n client.tta[question_id] = Time.now.to_i - client.tta[question_id]\n else\n client.tta[question_id] = 15\n end\n\n send_all_quiz_participants quiz_id, JSON.generate({\n user_answered: client.name,\n })\n\n if (all_participants_ready(quiz_id))\n send_all_quiz_participants quiz_id, JSON.generate({\n finish_question: question_id,\n question_answers: @question_answers[question_id],\n participants: build_participants_hash(quiz_id),\n })\n end\n\n # Next Question\n elsif (msg.has_key?(\"next_question\"))\n client.answered = true\n quiz_id = msg[\"quiz_id\"].to_i\n waiting_time = msg[\"show_results_timer\"] || 5\n\n if (all_participants_ready(quiz_id))\n sleep waiting_time # seconds\n\n send_all_quiz_participants quiz_id, JSON.generate({\n new_question_id: msg[\"next_question\"].to_i,\n participants: build_participants_hash(quiz_id),\n })\n @quiz_participants[quiz_id].each do |client|\n client.tta[msg[\"next_question\"].to_i] = Time.now.to_i\n end\n end\n\n # Finish Quiz\n elsif (msg.has_key?(\"finish_quiz\"))\n client.answered = true\n quiz_id = msg[\"finish_quiz\"].to_i\n waiting_time = msg[\"show_results_timer\"] || 5\n\n if (all_participants_ready(quiz_id))\n sleep waiting_time # seconds\n\n send_all_quiz_participants quiz_id, JSON.generate({\n finish_quiz: quiz_id,\n winner_names: get_winner_names(quiz_id),\n participants: build_participants_hash(quiz_id),\n })\n log_quiz_details(quiz_id)\n reset_quiz(quiz_id)\n @quiz_participants[quiz_id] = []\n end\n end\n end", "title": "" }, { "docid": "dd553a0823894497b6898ef7f127e852", "score": "0.66393363", "text": "def main()\r\n\r\n\tDir.mkdir \"chats\" if !File.directory? \"chats\"\r\n\tDir.mkdir \"userconfig\" if !File.directory? \"userconfig\"\r\n\t#Crear una array de usuarios donde guardarlos a todos.\r\n\t#Create an array of users to store them all\r\n\tusers = Array.new\r\n\t\r\n\t#Loop principal que escucha nuevos mensajes.\r\n\t#Main loop that listens to new messages.\r\n\tBOT.listen do |message|\r\n\t\r\n\t\t#Crear una variable user para tener un acceso mas comodo al usuario en si.\r\n\t\t#Create the user variable to access the user easier in the code.\r\n\t\tuser = set_user(users,message)\r\n\t\tuser.message = message\r\n\t\tI18n.locale = set_locale(user)\r\n\t\t\r\n\t\tcase message\r\n\t\twhen Telegram::Bot::Types::Message\r\n\t\t\tif message.text != nil\r\n\t\t\t\tif message.text[0] == '/'\r\n\t\t\t\t\r\n\t\t\t\t\t#Commmand\r\n\t\t\t\t\tDir[File.expand_path(\"commands\") + \"/*/*.rb\"].each do |path|\r\n\t\t\t\t\t\r\n\t\t\t\t\t\tif \"#{message.text.stop_at_space}.rb\" == \"/#{File.basename(path)}\"\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tload path\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\trun(user)\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tuser.command = message.text.stop_at_space.sub(\"/\",\"\")\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\tend\r\n\t\t\t\t\t\t\r\n\t\t\t\t\tend\r\n\t\t\t\t\t\r\n\t\t\t\telsif message.reply_to_message != nil && message.reply_to_message.from.username == NAME\r\n\t\t\t\t\t#Reply\r\n\t\t\t\t\tcheck_status(user)\r\n\t\t\t\t\t\r\n\t\t\t\tend\r\n\t\t\telsif message.chat.type == 'private'\r\n\t\t\t\tmultim(user)\r\n\t\t\t\tuser.dump = true\r\n\t\t\telse\r\n\t\t\t\tuser.dump = true\r\n\t\t\tend\r\n\t\twhen Telegram::Bot::Types::CallbackQuery\r\n\t\t\tcheck_status(user)\r\n\t\tend\r\n\t\t\r\n\t\t\r\n\t\tif user.dump == true\r\n\t\t\tusers.delete(user)\r\n\t\tend\r\n\t\r\n\t\r\n\tend\r\n\r\nend", "title": "" }, { "docid": "043b2b0ca6382a059b94fcac150e148c", "score": "0.66376305", "text": "def got_MSG(message)\r\n p \"-I got a message! YAY!-\"\r\n chara = message['character']\r\nif message['message'].downcase =~ /^!random (.*)?/i\r\nmsglist = message['message'].split(/random (.*)?/i)\r\nmsg = \"/me \" + @random.deal() + \" \" + msglist[1] + \"!\"\r\n self.send('MSG',message['channel'],msg)\r\n sleep(1)\r\nelsif message['message'].downcase =~ /^!deal (.*)?/i\r\nmsglist = message['message'].split(/deal (.*)?/i)\r\nmsg = msglist[1] + \": \" + @deck.deal()\r\n self.send('MSG',message['channel'],msg)\r\n sleep(1)\r\nelsif message['message'].downcase =~ /^!monsterize/\r\nmsg = \"/me shoots a beam of light at \"+ message['character'] + \" turning them into a \" + @monsterize.deal()\r\n self.send('MSG',message['channel'],msg)\r\n sleep(1)\r\nelsif message['message'].downcase =~ /^!invite (.*)?/i\r\nmsglist = message['message'].split(/invite (.*)?/i)\r\nmsg = @CIU + msglist[1]\r\n self.send('CIU',msglist[1],msg)\r\n sleep(1)\r\n elsif message['message'] =~ /^!deal/\r\n\t msg = message['character'] + \": \" + @deck.deal()\r\n self.send('MSG',message['channel'],msg)\r\n\tsleep(1)\r\n\telsif message['message'].downcase =~ /^!desc/\r\n\t\tmsg = @rooms[message['channel']]['characters'].push(message['character']['identity'])\r\n self.send('MSG',message['channel'],msg)\r\n sleep(1)\r\nend\r\nend", "title": "" }, { "docid": "b01f82571e2b9b8e5f71445a8673a25d", "score": "0.66293854", "text": "def message\n @chuser = @w = MChannel.select(\"user_id\").where(\"channel_id=?\", session[:clickchannel_id])\n @ary = Array.new\n @chuser.each { |ch|\n @ary.push(ch.user_id)\n }\n if @ary.include?(session[:user_id])\n mention_name = params[:channel][:memtion_name]\n mention_name[0] = \"\"\n mention_u = MUser.find_by(user_name: mention_name)\n @t_chmsg = TChannelMessage.new\n\n @t_chmsg.chsender_id = session[:user_id]\n @t_chmsg.channel_id = session[:clickchannel_id]\n @t_chmsg.chmessage = params[:channel][:chmessage]\n\n if mention_u\n @t_mention = TMention.new\n @t_mention.mentioned_id = mention_u.user_id\n @t_mention.login_user_id = session[:user_id]\n @t_mention.workspace_id = session[:workspace_id]\n @t_mention.mention_message = params[:channel][:chmessage]\n @t_mention.chmsgmen_id = session[:clickchannel_id]\n @t_mention.save\n end\n @t_chmsg.save\n\n main\n @chmsg = TChannelMessage.find_by(\"chsender_id=? and channel_id=? and chmessage=?\", session[:user_id], @t_chmsg.channel_id, @t_chmsg.chmessage)\n @clickchannel = MChannel.find_by(\"channel_id=?\", session[:clickchannel_id])\n @m_clickuser = MUser.joins(\"join m_channels on m_channels.user_id=m_users.user_id\")\n .where(\"m_channels.channel_name=? and m_channels.workspace_id=?\", session[:clickchannel_name], session[:workspace_id])\n @m_clickuser.each { |chuser|\n @tchmsg = TChunreadMessage.new\n @tchmsg.chmsg_id = @chmsg.chmsg_id\n @tchmsg.chuser_id = chuser.user_id\n if chuser.user_id == session[:user_id]\n @tchmsg.is_read = false\n else\n @tchmsg.is_read = true\n end\n @tchmsg.save\n }\n redirect_back(fallback_location: chmessage_path)\n else\n redirect_to home_path\n end\n end", "title": "" }, { "docid": "c8fe24347845b6445bdfa7d38b049905", "score": "0.6608364", "text": "def compose\n return unless request.post?\n invalid_user = []\n params[:message][:to].split(',').each do |user|\n # remove the whitespaces\n user.strip!\n # find the follower(s)\n follower=User.find_by_login(user)\n # follower must exist.\n (invalid_user << user; next) if follower.nil? || follower == current_user\n # saving the message\n new_message = Message.new(:originator => current_user, :follower => follower, :title => params[:message][:title], :body => params[:message][:body])\n # composing a message starts a thread, hence storing status of thread\n new_message.status = MessageStatus.new(:originator_inbox => MessageStatus::STATUS['deleted'], :originator_outbox => MessageStatus::STATUS['read'], :follower_inbox => MessageStatus::STATUS['unread'], :follower_outbox => MessageStatus::STATUS['deleted'])\n # it will save the status of thread\n new_message.save! \n # update the thread id with self.id\n new_message.update_attribute(:thread_id, new_message.id)\n end\n flash[:notice] = (invalid_user.empty? ? \"Your message has been sent.\" : \"User #{invalid_user.join(' ')} seems invalid. Mail has been sent to rest of users.\")\n redirect_to :action => 'outbox'\n end", "title": "" }, { "docid": "ffd621bcde7cf6f77d435122e62e13bd", "score": "0.660095", "text": "def messages\n Joined[:user_id => session[:user].id, :room_id => request[:room]].save\n\n msgs = \"\"\n Message.filter(:room_id => request[:room]).order(:id).each do |msg|\n msgs << \"<p>#{msg.user.name}: #{msg.message}</p>\"\n end\n\n msgs\n end", "title": "" }, { "docid": "86551d10e33135e8ecb6d3ee8d775409", "score": "0.6599716", "text": "def listen guards = @guards, handler\n return false unless guarded?\n throw \"Handler not defined for command\" if self.class.handler.nil?\n\n # Make regexps to match message\n\n # TODO Implement before filter\n message :chat?, normalized_guards(guards) do |message|\n\n # Store message\n @message = message\n\n # Store command name\n command_name = self.class.to_s\n logger.info \"#{message.from}##{command_name}: #{message.body}\"\n\n puts parse_parameters(message.body).inspect\n\n params = normalize_parameters(parse_parameters(message.body))\n\n begin\n logger.info \"#{command_name} executing\"\n\n # Execute handler for this message\n output = self.instance_exec(message, params, &handler)\n\n unless output.nil?\n # If output is a string just respond with it\n if output.kind_of? String\n reply = message.reply\n reply.body = output\n # If output is a message use it\n elsif output.kind_of? Blather::Stanza::Message\n reply = output.clone\n end\n\n # Default formatted message to body\n reply.xhtml = reply.body if reply.xhtml.blank?\n\n # In case of output come with formmatation, create default unformatted message\n reply.body = Sanitize.clean reply.body\n\n # TODO see if is to send message back to the user\n write_to_stream reply\n\n # Broadcast command result and user message to other people\n if Ariera.configuration[:mode] === :room\n\n run_callbacks :receive do\n\n # Broadcast user message\n Ariera.room.receive Ariera::Room::Message.new(Ariera.room, message)\n\n # Switch body to broadcast Command\n message.body = reply.body\n Ariera.room.receive(Ariera::Room::Command.new(Ariera.room, message, output))\n\n end\n end\n end\n rescue Exception => e\n r = message.reply\n r.body = 'Youbaa!! ' + e.message.capitalize\n r.xhtml = '<span style=\"color: #df0c0a\">Youbaa!! ' + e.message.capitalize + '</span>'\n write_to_stream r\n\n # TODO colorir o console\n logger.error \"Command::#{command_name}\" + \"\\n\" + e.message + \"\\n\"\n puts e.backtrace\n end\n\n # Mark as a command handled\n Commandable.handled = true\n end\n\n # Show some routes information\n logger.debug 'Command: listening to ' + normalized_guards(guards).inspect\n end", "title": "" }, { "docid": "2e058d2c6bc220e1d64843beade82b84", "score": "0.65992635", "text": "def process_messages\n execute_sql_query(\n 'select * from messages where processed = 0 and direction = \\'in\\';'\n ).each do |msg|\n execute_sql_statement(\n 'update messages set processed = \\'1\\' ' \\\n \"where id = '#{msg[0]}';\"\n )\n activate(payload: msg[3], flag: msg[2])\n end\n end", "title": "" }, { "docid": "87f0b6333034be4fbf8c1cb30010be80", "score": "0.6597465", "text": "def process\n return unless @message['sent']\n\n irc_connection.channels.values.each do |channel|\n channel_user = channel.find_user_by_id(@user.id)\n channel_user.update_last_activity(@message['sent']) if channel_user\n end\n end", "title": "" }, { "docid": "11ae09ff84acb397f73dfd093e42ff8b", "score": "0.65901476", "text": "def on_message(message)\n end", "title": "" }, { "docid": "1db83a2e3c5e1a33059e5db5b9192754", "score": "0.6585621", "text": "def receive(msg)\n return if msg.empty?\n return if msg =~ /^\\d+$/\n\n json = JSON.parse(msg)\n json.each do |msg|\n case msg.first\n when 0 then set_id(msg.last)\n when @id then @room.joined_room(msg.last)\n when 'ready' then set_avatar(msg.last, json)\n when 'position' then set_positions(msg.last)\n when 'point' then set_point(msg.last)\n when 'die' then set_dead(msg.last)\n when 'property' then set_property(msg.last)\n when MESSAGE then parse_message(*msg)\n else\n puts \"RECEIVED UNHANDLED MESSAGE: #{msg}\"\n end\n end\n # rescue Exception => e\n # puts \"Exception: #{e}\"\n # puts \"Mesasge Content:\"\n # puts \"----\"\n # puts \"#{msg}\"\n # puts \"----\"\n end", "title": "" }, { "docid": "650cdadfabd056834257fe5f816b5b08", "score": "0.6577666", "text": "def on_message(m)\n\t\tend", "title": "" }, { "docid": "18956c9c3a5c38bff81df923ae148b47", "score": "0.6567793", "text": "def getting_user_message\n Telegram::Bot::Client.run(TOKEN) do |bot|\n bot.listen do |message|\n def getting_msg\n return if Message.where(name: 'welcome_msg').empty?\n\n Message.select(:name, :description).to_hash\n end\n\n getting_btn2 = lambda {\n return if Button.where(name: '0_btn').empty?\n\n Button.all\n }\n\n m_name = message.from.first_name.capitalize\n case message\n when Telegram::Bot::Types::CallbackQuery\n break unless message.data.to_i # removed return\n\n if timer(message.as_json['message']['chat']['first_name'])\n user = User.find_or_create_by(user_reply(message))\n chat = Chat.find_or_create_by(chat_reply(message).merge(user_id: user.id))\n\n chat.statebuttons.create(chat_params(message).merge(chat_id: chat.id))\n bot.api.send_message(chat_id: message.from.id, text: m_name + getting_msg['thanks_msg'])\n\n else\n bot.api.send_message(chat_id: message.from.id, text: m_name + getting_msg['warning_msg'])\n end\n when Telegram::Bot::Types::Message\n case message.text\n when '/start'\n bot.api.send_message(chat_id: message.chat.id, text: m_name + getting_msg['welcome_msg'])\n bot.api.send_message(chat_id: message.chat.id, text: getting_msg['desc_msg'])\n\n # buttons array\n kb = getting_btn2.call.map do |button|\n Telegram::Bot::Types::InlineKeyboardButton.new(text: button.description, callback_data: button.button_value)\n end\n\n markup = Telegram::Bot::Types::InlineKeyboardMarkup.new(inline_keyboard: kb)\n bot.api.send_message(chat_id: message.chat.id, text: m_name + getting_msg['req_msg'], reply_markup: markup)\n when '/stop'\n bot.api.send_message(chat_id: message.chat.id, text: m_name + getting_msg['bye_msg'])\n else\n answer = User.class_variable_get :@@answers\n bot.api.send_message(chat_id: message.chat.id, text: m_name + answer.sample)\n end\n end\n end\n end\n end", "title": "" }, { "docid": "a3e84c37f52eecfe6f69d0af1be3242c", "score": "0.6554084", "text": "def on_message(data)\n\n typing(data['channel'])\n say(\"#{data['uname']} said: #{data['text'].inspect}\", data['channel'])\n #p [ :on_message, user_name(data), data['text'] ]\n end", "title": "" }, { "docid": "3fa98fd1fd58bb3de7010c95429c5ddf", "score": "0.65432924", "text": "def parse\n if pre_parse\n messages = @file_reader.other_lines.map do |line|\n basic_message_match = @line_regex.match(line)\n meta_message_match = @line_regex_status.match(line)\n if basic_message_match\n create_message(basic_message_match)\n elsif meta_message_match\n create_status_or_event_message(meta_message_match)\n end\n end\n\n Chat.new(messages, @metadata)\n end\n end", "title": "" }, { "docid": "f9bfd90f8ac5c0517f6a6dc72b505d31", "score": "0.65378296", "text": "def run\n self.getResponse \n chat = Chat.new(\n self.apiResponse['chat_room']['qiscus_room_id'],\n self.apiResponse['message']['text'],\n self.apiResponse['message']['type'],\n self.apiResponse['from']['fullname']\n )\n \n #cek pesan dari chat tidak kosong & cari chat yang mengandung '/' untuk menjalankan command bot\n find_slash = chat.message.scan('/')\n if chat.message != nil && find_slash[0] == '/'\n #ambil nilai text setelah karakter '/'\n command = chat.message.split('/')\n if command[1] != nil\n case command[1]\n when 'location'\n self.replyCommandLocation(chat.room_id)\n when 'carousel'\n self.replyCommandCarousel(chat.room_id)\n when 'button'\n self.replyCommandButton(chat.sender, chat.room_id)\n when 'card'\n self.replyCommandCard(chat.room_id)\n else\n self.replyCommandText(chat.sender, chat.message_type, chat.room_id) \n end\n else\n self.replyCommandText(chat.sender, chat.message_type, chat.room_id)\n end\n end\n end", "title": "" }, { "docid": "a90f95da918f2e40facee8a48b7f75f7", "score": "0.6526592", "text": "def listen_user_messages( client_ID, client )\n puts \"in listen_user_messages\"\n loop {\n msg = JSON.parse(client.gets.chomp)\n puts sprintf(\"msg.inpect : %s\\n\", msg.inspect)\n command = msg[0]\n if command == 'MSG'\n @clients.each do |other_name, other_client|\n if other_name == client_ID\n client.puts [0x00, \"Success\"].to_json\n else\n other_client.puts [\"#{client_ID.to_s}: #{msg[1]}\"].to_json\n end\n end\n elsif command == 'DISCONNECT'\n puts sprintf(\"disconnecting user '%s'\", client_ID)\n client.puts [0x00, \"DISCONNECT\"].to_json\n @clients.remove client\n elsif command == 'CLIST'\n client.puts [0x00, \"CLIST\", @clients.keys].to_json\n else # catchall for wrong format\n puts \"unknown message format\"\n client.puts [0xFF].to_json\n end\n }\n puts \"outside listen loop\"\n end", "title": "" }, { "docid": "b3a4c8759dbdee61c2e2bba1ba74acf8", "score": "0.6522661", "text": "def my_messages\n session[:user_info_id] = current_user.id.to_i\n @current_user_name = User.find_by_user_info_id(current_user.id)\n\t@messages = Message.received_messages(current_user.id).paginate(:page => params[:page], :per_page => 12)\n\tif request.post?\n \t\t@message=Message.new(params[:message])\n\t\trender :update do |page|\n\t\t\tif @message.save\n\t\t\t @receiver= User.find_by_user_info_id(@message.receiver_id).first_name\n\t\t\t\t @receiver_email= UserInfo.find_by_id(@message.receiver_id).email\n\t\t\t\t flash=\"Message has been sent successfully.\"\n\t\t\t\t Notifier::deliver_mail_for_reply(@message,@current_user_name,@receiver,@receiver_email,request.host_with_port)\n page.replace_html \"notice_#{params[:message_id]}\", \"<span class='flash'>#{flash}</span>\" #\"<span style='color:red'>#{flash}</span>\"\n\t\t\t\t page.hide \"reply_#{params[:message_id]}\"\n\t\t\t\t page.hide \"replytext_#{params[:message_id]}\"\n\t\t\telse\n\t\t\t\t flash=(!@message.message.match(\"<\").nil?) ? \"Please don't enter html code.\" : \"Reply can't be blank.\"\n\t\t\t\t page.replace_html \"notice_#{params[:message_id]}\", \"<span style='color:red;padding-left:80px'>#{flash}</span>\"\n\t\t\t\t page.show \"reply_#{params[:message_id]}\"\n\t\t\t\t page.show \"replytext_#{params[:message_id]}\"\n\t\t\tend\n \t\t end\n\tend\n\tcheck_for_active_tab\n end", "title": "" }, { "docid": "6d346d6bad57052ac76793a87259839e", "score": "0.6522398", "text": "def chat(msg)\n message = strip_username(msg)\n\n case message.partition(' ')[0]\n when TIMEAT_CMD.strip\n time_check(message)\n when TIMEPOPULARITY_CMD.strip\n stat_check(message)\n end\n end", "title": "" }, { "docid": "f1450ec67b43338f44164eea8b114610", "score": "0.65149444", "text": "def create\n @message = Message.new(params[:message])\n #sender_chat_id = \"-#{@user}@chat.facebook.com\"\n #receiver_chat_id = \"-#{@user}@chat.facebook.com\"\n\n#refactor to own controller\n\nreceiver_id = @message.receiver_id\nreceiver_chat_id = \"-#{receiver_id}@chat.facebook.com\"\nmessage_body = @message.message_body\nmessage_subject = \"chat with @messenger.receiver_id\"\nputs \"message received\"\n\njabber_message = Jabber::Message.new(receiver_chat_id, message_body)\njabber_message.subject = message_subject\n #chat client connect\n puts \"@client\"\n client = Message.connect(current_user)\n client.send(jabber_message)\n client.close\n puts \"client closed\"\n @graph = Koala::Facebook::API.new(current_user.oauth_token)\n @chats = @graph.fql_query(\"SELECT author_id,message_id,body FROM message WHERE thread_id in (SELECT thread_id FROM thread WHERE folder_id = 0 and #{@message.receiver_id} IN recipients)\")\n \n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: \"Connected ! Sent message to #{sender_chat_id.strip.to_s}.\" }\n format.js \n format.json { render json: @message, status: :created, location: @message }\n else\n format.html { render action: \"new\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n \n end", "title": "" }, { "docid": "233c332eb18d55e0c73f21dff38c39de", "score": "0.65047777", "text": "def handle_messages!()\n messages_to_handle.each do |message| \n puts \"abstract message handler called; doing nothing to message \" + message.id.to_s\n end \n end", "title": "" }, { "docid": "0a2b0c1bf6d71a3606572f838678eb34", "score": "0.6502938", "text": "def messages(params, client, msg)\n\n message %r{(send_to|send2)\\s+([^\\s]+)\\s+(.*)} do\n\n user, msgout = params[:captures].values_at 1,2 \n\n client.say(body: msgout, from: @jid, to: user, type: \"chat\") \n end\n\n message 'help' do\n msgout = 'available commands: help, send_to'\n client.reply(body: msgout, to: msg) \n end\n\n message '.*' do\n\n msgout = 'need some help? type help'\n client.reply(body: msgout, to: msg) \n end\n\n end", "title": "" }, { "docid": "6f0d2887f4687ab6b2d6672f3c640cf2", "score": "0.65002316", "text": "def receive_message\n end", "title": "" }, { "docid": "02dac20ffa0f18568bf4cb431aba2eab", "score": "0.64691067", "text": "def received(message)\n if message.respond_to?(:encoding) && message.encoding != 'UTF-8'\n message.force_encoding 'UTF-8'\n end\n data = JSON.parse message, :symbolize_names => true\n\n case data[:type]\n when 'text'\n return if @nonces.include?(data[:nonce])\n @nonces << data[:nonce]\n room.message @user, data[:text], @name_color, data[:client_ts]\n when 'av-invite', 'av-accept', 'av-close'\n return if @nonces.include?(data[:nonce])\n @nonces << data[:nonce]\n av_message data\n when 'sync'\n @last_event_id = data[:last_event_id].to_i\n sync_events\n when 'ping'\n respond pong: { nonce: data[:nonce], client_ts: data[:client_ts] }\n when 'relay'\n return if @nonces.include?(data[:nonce])\n @nonces << data[:nonce]\n room.relay @user, data[:to], data[:body], data[:client_ts]\n end\n end", "title": "" }, { "docid": "d04386f2014c4f1a4025762269b740df", "score": "0.6436259", "text": "def chat\n @messages = [] # @channel.mesages.paginate(per_page: 10, page: @page).order('created_at ASC')\n @show_chat_panel = false\n @page = 1\n respond_to do |format|\n format.html\n end\n end", "title": "" }, { "docid": "bc82eaa84b129b75ed4173d20d2a7ed7", "score": "0.64328736", "text": "def process_message(message)\n bare, full = message.from.stripped.to_s, message.from.to_s\n forward_to = nil\n\n if from_service?(message)\n jid = message.xpath('/message/ns:jid', 'ns' => NS).first\n jid = Blather::JID.new(jid.content) rescue nil\n return unless jid\n bare, full = jid.stripped.to_s, jid.to_s\n forward_to = full\n end\n\n return unless valid_user?(bare)\n session = @sessions[full] ||= Shell.new(bare, @permissions)\n \n # [AM] Create a TickLoop to collect shell output and send \n # back to recipient by portions. This is needed to \n # implement non-blocking, but not annoying on the other hand\n # service. E. g. “ls” im most cases will return immediately, \n # while “ping google.com” will send back stanzas every second\n \n session.on_output = lambda {|output| @task_responses[message.id] += output }\n session.on_error = lambda {|error| @task_responses[message.id] += \"⇒ #{error}\" }\n\n @task_responses[message.id] = \"\"\n task_response_tickloop = EM.tick_loop do\n unless @task_responses[message.id].empty?\n @stream.write(reply(message, @task_responses[message.id], forward_to)) \n @task_responses[message.id] = \"\"\n end\n sleep 1\n end\n session.run(message.body.strip) do |output, exitstatus|\n task_response_tickloop.stop\n task_response_tickloop = nil \n unless @task_responses[message.id].empty?\n @stream.write(reply(message, @task_responses[message.id], forward_to)) \n end\n @task_responses.delete message.id\n if exitstatus && exitstatus != 0 \n @stream.write(reply(message, \"#{exitstatus} ↵ #{message.body}\", forward_to))\n end\n end\n end", "title": "" }, { "docid": "cb19163bcc70b8c893db7624064e2ceb", "score": "0.64191324", "text": "def process_recv_message(client, msg)\n\n # msg has two fixed field, type and id.\n type = msg[:type]\n view = @coll_sessions.find({ id: msg[:id] })\n\n # # this is for loading msg.\n # # record the msg\n # data_json = msg.to_json\n # if msg[:type] == 7 || msg[:type] == 8\n # file = File.new(__dir__ + \"/../../msg_lib_payment/#{msg[:type]}.json\", \"w\")\n # file.syswrite(data_json)\n # elsif msg[:type] == 6\n # if msg[:msg_type] == \"payment\"\n # file = File.new(__dir__ + \"/../../msg_lib_payment/#{msg[:type]}.json\", \"w\")\n # else\n # file = File.new(__dir__ + \"/../../msg_lib_closing/#{msg[:type]}.json\", \"w\")\n # end\n # file.syswrite(data_json)\n # elsif msg[:type] < 6\n # file = File.new(__dir__ + \"/../../msg_lib_establishment/#{msg[:type]}.json\", \"w\")\n # file.syswrite(data_json)\n # elsif msg[:type] == 9\n # file = File.new(__dir__ + \"/../../msg_lib_closing/#{msg[:type]}.json\", \"w\")\n # file.syswrite(data_json)\n # end\n\n # if there is no record and the msg is not the first step.\n @logger.info(\"#{@key.pubkey} msg#{type} comes, the number of record in the db is #{view.count_documents()}, id: #{msg[:id]}\")\n if view.count_documents() == 0 && type != 1\n msg_reply = generate_text_msg(msg[:id], \"sry, the msg's type is inconsistent with the type in local database!\")\n client.puts (msg_reply)\n return false\n # if there is a record, just check the msg type is same as local status.\n elsif view.count_documents() == 1 && (![-2, -1, 0].include? type)\n view.each do |doc|\n if doc[\"status\"] != type\n msg_reply = generate_text_msg(msg[:id], \"sry, the msg's type is inconsistent with the type in local database! Your version is #{type} I expect #{doc[\"status\"]}\")\n @logger.info(\"sry, the msg's type is inconsistent with the type in local database! Your version is #{type} I expect #{doc[\"status\"]}\")\n client.puts (msg_reply)\n return false\n end\n end\n # one id, one record.\n elsif view.count_documents() > 1\n msg_reply = generate_text_msg(msg[:id], \"sry, there are more than one record about the id.\")\n client.puts (msg_reply)\n return false\n end\n\n case type\n\n # when -2 # Reset the status.\n # recover_stage = msg[:recover_stage]\n\n # # case 1: revert to the establishment stage.\n\n # # case 2: revert to the\n # local_stage < 6\n # # get the nearest camp.\n\n # re-send\n when -1\n msg_reply_json = @coll_sessions.find({ id: msg[:id] }).first[:msg_cache]\n msg_reply = JSON.parse(msg_reply_json, symbolize_names: true)\n client.puts (msg_reply)\n return true\n # Just the plain text.\n when 0\n puts msg[:text]\n return true\n when 1\n @logger.info(\"#{@key.pubkey} receive msg 1.\")\n # parse the msg\n remote_pubkey = msg[:pubkey]\n remote_cells = msg[:cells].map { |cell| CKB::Types::Input.from_h(cell) }\n remote_fee_fund = msg[:fee_fund]\n remote_change = hash_to_cell(msg[:change])\n remote_asset = msg[:asset]\n remote_stx_info = hash_to_info(msg[:stx_info])\n timeout = msg[:timeout].to_i\n local_pubkey = CKB::Key.blake160(@key.pubkey)\n lock_hashes = [@lock_hash]\n refund_lock_script = @lock\n change_lock_script = refund_lock_script\n\n @logger.info(\"#{@key.pubkey} check msg_1: msg parse finished.\")\n\n remote_asset = remote_asset.map() { |key, value| [key.to_s, value] }.to_h\n\n remote_investment = convert_hash_to_text(remote_asset)\n\n @logger.info(\"#{@key.pubkey} check msg_1: checking negtive remote input begin.\")\n\n for amount in remote_asset.values()\n if amount < 0\n record_result({ \"sender_step1_error_amount_negative\": amount })\n return false\n end\n end\n\n record_result({ \"sender_step1_error_fee_negative\": remote_fee_fund }) if remote_fee_fund < 0\n return false if remote_fee_fund < 0\n\n @logger.info(\"#{@key.pubkey} check msg_1: checking negtive remote input finished.\")\n remote_cell_check_result, remote_cell_check_value = check_cells(remote_cells, remote_asset, remote_fee_fund, remote_change, remote_stx_info)\n\n # check remote cells.\n if remote_cell_check_result != \"success\"\n client.puts(generate_text_msg(msg[:id], \"sry, there are some problem abouty your cells.\"))\n record_result({ \"receiver_step1_\" + remote_cell_check_result => remote_cell_check_value })\n return false\n end\n\n # Ask whether willing to accept the request, the capacity is same as negotiations.\n puts \"#{remote_pubkey} wants to establish channel with you #{remote_investment}\"\n puts \"The fund fee is #{remote_fee_fund}.\"\n puts \"Tell me whether you are willing to accept this request.\"\n\n commands = load_command()\n\n @logger.info(\"#{@key.pubkey} check msg_1: finished.\")\n\n # read data from json file.\n while true\n # testing\n response = commands[:recv_reply]\n # response = \"yes\"\n if response == \"yes\"\n break\n elsif response == \"no\"\n msg_reply = generate_text_msg(msg[:id], \"sry, remote node refuses your request.\")\n client.puts(msg_reply)\n return false\n else\n puts \"your input is invalid\"\n end\n end\n\n # Get the capacity and fee. These code need to be more robust.\n while true\n puts \"Please input the amount and fee you want to use for funding\"\n local_funding = commands[:recv_fund]\n\n for asset_type in local_funding.keys()\n local_funding[asset_type] = asset_type == :ckb ? CKB::Utils.byte_to_shannon(BigDecimal(local_funding[asset_type])) : BigDecimal(local_funding[asset_type])\n local_funding[asset_type] = local_funding[asset_type].to_i\n end\n local_fee_fund = commands[:recv_fund_fee].to_i\n break\n end\n local_asset = convert_text_to_hash(local_funding)\n\n @logger.info(\"#{@key.pubkey} send msg_2: input finished.\")\n\n # check all amount are positive.\n for funding_amount in local_asset.values()\n if funding_amount < 0\n record_result({ \"receiver_gather_funding_error_negative\": funding_amount }) if funding_amount < 0\n return false\n end\n end\n\n if local_fee_fund < 0\n record_result({ \"receiver_gather_fee_error_negative\": local_fee_fund })\n return false\n end\n\n @logger.info(\"#{@key.pubkey} send msg_2: gather input begin.\")\n # gather local fund inputs.\n local_cells = gather_inputs(local_asset, local_fee_fund, lock_hashes, change_lock_script,\n refund_lock_script, @coll_cells)\n\n @logger.info(\"#{@key.pubkey} send msg_2: gather input finished.\")\n\n if local_cells.is_a? Numeric\n record_result({ \"receiver_gather_funding_error_insufficient\": local_cells })\n return false\n end\n\n return false if local_cells == nil\n\n msg_digest = ((remote_cells + local_cells).map(&:to_h)).to_json\n channel_id = Digest::MD5.hexdigest(msg_digest)\n\n @logger.info(\"#{@key.pubkey} send msg_2: generate settlement info and change: begin\")\n\n # generate the settlement infomation.\n local_empty_stx = @tx_generator.generate_empty_settlement_info(local_asset, refund_lock_script)\n stx_info = merge_stx_info(remote_stx_info, local_empty_stx)\n stx_info_h = info_to_hash(Marshal.load(Marshal.dump(stx_info)))\n refund_capacity = local_empty_stx[:outputs][0].capacity\n local_empty_stx_h = info_to_hash(Marshal.load(Marshal.dump(local_empty_stx)))\n\n # calculate change.\n local_change = @tx_generator.construct_change_output(local_cells, local_asset, local_fee_fund, refund_capacity, change_lock_script)\n\n gpc_capacity = get_total_capacity(local_cells + remote_cells)\n\n @logger.info(\"#{@key.pubkey} send msg_2: generate settlement info and change: finished.\")\n @logger.info(\"#{@key.pubkey} send msg_2: generate fund tx: begin.\")\n\n outputs = Array.new()\n outputs_data = Array.new()\n for cell in remote_change + local_change\n outputs << cell[:output]\n outputs_data << cell[:output_data]\n end\n\n for output in outputs\n gpc_capacity -= output.capacity\n end\n\n # generate the info of gpc output\n gpc_capacity -= (remote_fee_fund + local_fee_fund)\n\n udt_type_script_hash = load_type()\n total_asset = {}\n\n total_asset[\"\"] = [local_asset, remote_asset].map { |h| h[\"\"] }.sum\n total_asset[udt_type_script_hash] = [local_asset, remote_asset].map { |h| h[udt_type_script_hash] }.sum\n\n gpc_cell = @tx_generator.construct_gpc_output(gpc_capacity, total_asset,\n channel_id, timeout, remote_pubkey[2..-1], local_pubkey[2..-1])\n\n @logger.info(\"#{@key.pubkey} send msg_2: gpc output generation: finished.\")\n outputs.insert(0, gpc_cell[:output])\n outputs_data.insert(0, gpc_cell[:output_data])\n\n # generate the inputs and witness of fund tx.\n fund_cells = remote_cells + local_cells\n fund_witnesses = Array.new()\n for iter in fund_cells\n fund_witnesses << CKB::Types::Witness.new\n end\n\n type_dep = []\n for asset_type in total_asset.keys()\n current_type = find_type(asset_type)\n type_dep.append(current_type[:type_dep]) if current_type[:type_dep] != nil\n end\n\n # Let us create the fund tx!\n fund_tx = @tx_generator.generate_fund_tx(fund_cells, outputs, outputs_data, fund_witnesses, type_dep)\n local_cells_h = local_cells.map(&:to_h)\n @logger.info(\"#{@key.pubkey} send msg_2: generate fund tx: finished.\")\n # send it\n msg_reply = { id: msg[:id], updated_id: channel_id, type: 2, asset: local_asset,\n fee_fund: local_fee_fund, fund_tx: fund_tx.to_h, stx_info: local_empty_stx_h,\n pubkey: local_pubkey }.to_json\n client.puts(msg_reply)\n\n # update database.\n doc = { id: channel_id, local_pubkey: local_pubkey, remote_pubkey: remote_pubkey,\n status: 3, nounce: 0, ctx_info: 0, stx_info: stx_info_h.to_json,\n local_cells: local_cells_h, fund_tx: fund_tx.to_h, msg_cache: msg_reply,\n timeout: timeout.to_s, local_asset: local_asset, stage: 0, settlement_time: 0,\n sig_index: 1, closing_time: 0, stx_info_pend: 0, ctx_info_pend: 0 }\n record_result({ \"id\" => channel_id })\n @logger.info(\"#{@key.pubkey} send msg_2: insert record #{channel_id}\")\n return insert_with_check(@coll_sessions, doc) ? true : false\n when 2\n @logger.info(\"#{@key.pubkey} receive msg 2.\")\n\n # parse the msg.\n fund_tx = CKB::Types::Transaction.from_h(msg[:fund_tx])\n remote_asset = msg[:asset].map() { |key, value| [key.to_s, value] }.to_h\n remote_pubkey = msg[:pubkey]\n remote_fee_fund = msg[:fee_fund]\n timeout = @coll_sessions.find({ id: msg[:id] }).first[:timeout].to_i\n remote_stx_info_h = msg[:stx_info]\n remote_stx_info = hash_to_info(Marshal.load(Marshal.dump(remote_stx_info_h)))\n remote_updated_id = msg[:updated_id]\n\n # load local info.\n local_cells = (@coll_sessions.find({ id: msg[:id] }).first[:local_cells]).map(&:to_h)\n local_cells = local_cells.map { |cell| JSON.parse(cell.to_json, symbolize_names: true) }\n local_pubkey = @coll_sessions.find({ id: msg[:id] }).first[:local_pubkey]\n local_asset = JSON.parse(@coll_sessions.find({ id: msg[:id] }).first[:local_asset])\n local_fee_fund = @coll_sessions.find({ id: msg[:id] }).first[:fee_fund]\n local_change = hash_to_cell(JSON.parse(@coll_sessions.find({ id: msg[:id] }).first[:local_change], symbolize_names: true))\n local_stx_info = hash_to_info(JSON.parse(@coll_sessions.find({ id: msg[:id] }).first[:stx_info], symbolize_names: true))\n sig_index = @coll_sessions.find({ id: msg[:id] }).first[:sig_index]\n\n # generate investment info\n remote_investment = convert_hash_to_text(remote_asset)\n\n # get remote cells.\n remote_cells = fund_tx.inputs.map(&:to_h) - local_cells\n remote_cells = remote_cells.map { |cell| CKB::Types::Input.from_h(cell) }\n local_cells = local_cells.map { |cell| CKB::Types::Input.from_h(cell) }\n\n # load gpc output.\n gpc_output = fund_tx.outputs[0]\n gpc_output_data = fund_tx.outputs_data[0]\n\n # construct total asset.\n udt_type_script_hash = load_type()\n\n total_asset = {}\n total_asset[\"\"] = [local_asset, remote_asset].map { |h| h[\"\"] }.sum\n total_asset[udt_type_script_hash] = [local_asset, remote_asset].map { |h| h[udt_type_script_hash] }.sum\n\n @logger.info(\"#{@key.pubkey} check msg_2: msg parsed.\")\n\n # check updated_id.\n\n msg_digest = ((local_cells + remote_cells).map(&:to_h)).to_json\n local_updated_id = Digest::MD5.hexdigest(msg_digest)\n if local_updated_id != remote_updated_id\n client.puts(generate_text_msg(msg[:id], \"sry, the channel ids are inconsistent.\"))\n record_result({ \"sender_step2_id_inconsistent\" => true })\n return false\n end\n\n # require there is no my cells in remote cells.\n # otherwise, if remote party uses my cell as his funding.\n # My signature is misused.\n local_cell_lock_lib = Set[]\n for cell in local_cells\n output = @api.get_live_cell(cell.previous_output).cell.output\n local_cell_lock_lib.add(output.lock.compute_hash)\n end\n\n commands = load_command()\n # About the one way channel.\n\n if remote_asset.values().sum == 0\n puts \"It is a one-way channel, tell me whether you want to accept it.\"\n while true\n # response = STDIN.gets.chomp\n response = commands[:one_way_channel_permission]\n if response == \"yes\"\n break\n elsif response == \"no\"\n msg_reply = generate_text_msg(msg[:id], \"sry, remote node refuses your request since it is one-way channel.\")\n client.puts(msg_reply)\n return false\n else\n puts \"your input is invalid\"\n end\n end\n end\n\n # check there is no my cells in remote cell.\n for cell in remote_cells\n if @api.get_live_cell(cell.previous_output).status != \"live\"\n client.puts(generate_text_msg(msg[:id], \"sry, cell dead.\"))\n record_result({ \"sender_step2_error_cell_dead\" => true })\n return false\n end\n output = @api.get_live_cell(cell.previous_output).cell.output\n return false if local_cell_lock_lib.include? output.lock.compute_hash\n end\n\n change_outputs_all = fund_tx.outputs[1..-1]\n change_outputs_data_all = fund_tx.outputs_data[1..-1]\n change_all = []\n\n for index in (0..(change_outputs_all.length() - 1))\n change_all << { output: change_outputs_all[index], output_data: change_outputs_data_all[index] }\n end\n\n # the local change.\n change_all_h = cell_to_hash(change_all)\n local_change_h = cell_to_hash(local_change)\n change_all_set = change_all_h.to_set()\n local_change_set = local_change_h.to_set()\n\n if !local_change_set.subset?(change_all_set)\n client.puts(generate_text_msg(msg[:id], \"sry, something wrong with my local change.\"))\n record_result({ \"sender_step2_local_change_modified\" => true })\n return false\n end\n\n remote_change_h = (change_all_set - local_change_set).to_a\n remote_change = hash_to_cell(remote_change_h)\n\n @logger.info(\"#{@key.pubkey} check msg_2: separte remote change.\")\n\n # assemble remote change\n @logger.info(\"#{@key.pubkey} check msg_2: start to check remote cells.\")\n # check the cells remote party providing is right.\n remote_cell_check_result, remote_cell_check_value = check_cells(remote_cells, remote_asset, remote_fee_fund, remote_change, remote_stx_info)\n\n if remote_cell_check_result != \"success\"\n client.puts(generate_text_msg(msg[:id], \"sry, there are some problem abouty your cells.\"))\n record_result({ \"sender_step2_\" + remote_cell_check_result => remote_cell_check_value })\n return false\n end\n\n @logger.info(\"#{@key.pubkey} check msg_2: remote cells have been checked.\")\n\n # gpc outptu checked.\n gpc_capacity = local_stx_info[:outputs][0].capacity + remote_stx_info[:outputs][0].capacity\n\n # regenerate the cell by myself, and check remote one is same as it.\n\n gpc_cell = @tx_generator.construct_gpc_output(gpc_capacity, total_asset,\n local_updated_id, timeout, local_pubkey[2..-1], remote_pubkey[2..-1])\n\n if !(gpc_cell[:output].to_h == gpc_output.to_h && gpc_cell[:output_data] == gpc_output_data)\n client.puts(generate_text_msg(msg[:id], \"sry, gpc output goes wrong.\"))\n record_result({ \"sender_step2_error_gpc_modified\": true })\n return false\n end\n\n @logger.info(\"#{@key.pubkey} check msg_2: gpc output has been checked.\")\n #-------------------------------------------------\n # I think is is unnecessary to do in a prototype...\n # just verify the other part (version, deps, )\n # verify_result = verify_tx(fund_tx)\n # if verify_result == -1\n # client.puts(generate_text_msg(\"sry, the fund tx has some problem...\"))\n # return -1\n # end\n # check the remote capcity is satisfactory.\n\n puts \"#{remote_pubkey} reply you with: The remote fund amount: #{remote_investment}.\"\n puts \"The fund fee is #{remote_fee_fund}.\"\n puts \"Tell me whether you are willing to accept this request\"\n while true\n response = commands[:sender_reply]\n # response = STDIN.gets.chomp\n if response == \"yes\"\n break\n elsif response == \"no\"\n client.puts(generate_text_msg(msg[:id], \"sry, remote node refuses your request.\"))\n return false\n else\n puts \"your input is invalid\"\n end\n end\n\n @logger.info(\"#{@key.pubkey} check msg_2: read input finished.\")\n\n # generate empty witnesses.\n # the two magic number is flag of witness and the nounce.\n # The nounce of first pair of stx and ctx is 1.\n witness_closing = @tx_generator.generate_empty_witness(local_updated_id, 1, 1)\n witness_settlement = @tx_generator.generate_empty_witness(local_updated_id, 0, 1)\n # merge the stx_info.\n stx_info = merge_stx_info(local_stx_info, remote_stx_info)\n # generate and sign ctx and stx.\n ctx_info = @tx_generator.generate_closing_info(local_updated_id, gpc_output, gpc_output_data, witness_closing, sig_index)\n stx_info = @tx_generator.sign_settlement_info(local_updated_id, stx_info, witness_settlement, sig_index)\n\n # convert the info into json to store and send.\n ctx_info_h = info_to_hash(Marshal.load(Marshal.dump(ctx_info)))\n stx_info_h = info_to_hash(Marshal.load(Marshal.dump(stx_info)))\n\n @logger.info(\"#{@key.pubkey} send msg_3: stx and ctx construction finished.\")\n\n # send the info\n msg_reply = { id: local_updated_id, type: 3, ctx_info: ctx_info_h, stx_info: stx_info_h }.to_json\n client.puts(msg_reply)\n\n @logger.info(\"#{@key.pubkey} send msg_3: msg sent.\")\n\n # update the database.\n @coll_sessions.find_one_and_update({ id: msg[:id] }, { \"$set\" => { remote_pubkey: remote_pubkey, fund_tx: msg[:fund_tx], ctx_info: ctx_info_h.to_json,\n stx_info: stx_info_h.to_json, status: 4, msg_cache: msg_reply, nounce: 1, id: local_updated_id } })\n return true\n when 3\n @logger.info(\"#{@key.pubkey} receive msg 3.\")\n # load many info...\n fund_tx = @coll_sessions.find({ id: msg[:id] }).first[:fund_tx]\n local_stx_info = hash_to_info(JSON.parse(@coll_sessions.find({ id: msg[:id] }).first[:stx_info], symbolize_names: true))\n remote_pubkey = @coll_sessions.find({ id: msg[:id] }).first[:remote_pubkey]\n sig_index = @coll_sessions.find({ id: msg[:id] }).first[:sig_index]\n fund_tx = CKB::Types::Transaction.from_h(fund_tx)\n remote_ctx_info = hash_to_info(msg[:ctx_info])\n remote_stx_info = hash_to_info(msg[:stx_info])\n\n # check the ctx_info and stx_info args are right.\n # just generate it by myself and compare.\n witness_closing = @tx_generator.generate_empty_witness(msg[:id], 1, 1)\n witness_settlement = @tx_generator.generate_empty_witness(msg[:id], 0, 1)\n\n output = Marshal.load(Marshal.dump(fund_tx.outputs[0]))\n local_ctx_info = @tx_generator.generate_closing_info(msg[:id], output, fund_tx.outputs_data[0], witness_closing, sig_index)\n local_stx_info = @tx_generator.sign_settlement_info(msg[:id], local_stx_info, witness_settlement, sig_index)\n\n # set the witness to empty and then check everything is consistent.\n if !verify_info_args(local_ctx_info, remote_ctx_info) || !verify_info_args(local_stx_info, remote_stx_info)\n client.puts(generate_text_msg(msg[:id], \"sry, the args of closing or settlement transaction have problem.\"))\n record_result({ \"receiver_step3_error_info_modified\": true })\n return false\n end\n\n # veirfy the remote signature is right.\n # sig_index is the the signature index. 0 or 1.\n # So I just load my local sig_index, 1-sig_index is the remote sig_index.\n remote_ctx_result = verify_info_sig(remote_ctx_info, \"closing\", remote_pubkey, 1 - sig_index)\n remote_stx_result = verify_info_sig(remote_stx_info, \"settlement\", remote_pubkey, 1 - sig_index)\n if !remote_ctx_result || !remote_stx_result\n client.puts(generate_text_msg(msg[:id], \"The signatures are invalid.\"))\n record_result({ \"receiver_step3_error_signature_invalid\": true })\n return false\n end\n\n output = Marshal.load(Marshal.dump(fund_tx.outputs[0]))\n\n # sign\n ctx_info = @tx_generator.generate_closing_info(msg[:id], output, fund_tx.outputs_data[0], remote_ctx_info[:witnesses][0], sig_index)\n stx_info = @tx_generator.sign_settlement_info(msg[:id], local_stx_info, remote_stx_info[:witnesses][0], sig_index)\n\n ctx_info_h = info_to_hash(ctx_info)\n stx_info_h = info_to_hash(stx_info)\n\n # send the info\n msg_reply = { id: msg[:id], type: 4, ctx_info: ctx_info_h, stx_info: stx_info_h }.to_json\n client.puts(msg_reply)\n\n @coll_sessions.find_one_and_update({ id: msg[:id] }, { \"$set\" => { ctx_info: ctx_info_h.to_json, stx_info: stx_info_h.to_json,\n status: 5, msg_cache: msg_reply, nounce: 1 } })\n\n return true\n when 4\n @logger.info(\"#{@key.pubkey} receive msg 4.\")\n remote_pubkey = @coll_sessions.find({ id: msg[:id] }).first[:remote_pubkey]\n local_pubkey = @coll_sessions.find({ id: msg[:id] }).first[:local_pubkey]\n local_inputs = @coll_sessions.find({ id: msg[:id] }).first[:local_cells]\n local_inputs = local_inputs.map { |cell| CKB::Types::Input.from_h(cell) }\n\n sig_index = @coll_sessions.find({ id: msg[:id] }).first[:sig_index]\n\n # check the data is not modified!\n # the logic is\n # 1. my signature is not modified\n # 2. my signature can still be verified.\n local_ctx_info_h = JSON.parse(@coll_sessions.find({ id: msg[:id] }).first[:ctx_info], symbolize_names: true)\n local_stx_info_h = JSON.parse(@coll_sessions.find({ id: msg[:id] }).first[:stx_info], symbolize_names: true)\n\n local_ctx_info = hash_to_info(Marshal.load(Marshal.dump(local_ctx_info_h)))\n local_stx_info = hash_to_info(Marshal.load(Marshal.dump(local_stx_info_h)))\n\n remote_ctx_info = hash_to_info(msg[:ctx_info])\n remote_stx_info = hash_to_info(msg[:stx_info])\n\n local_ctx_sig = @tx_generator.parse_witness_lock(@tx_generator.parse_witness(local_ctx_info[:witnesses][0]).lock)[:sig_A]\n remote_ctx_sig = @tx_generator.parse_witness_lock(@tx_generator.parse_witness(remote_ctx_info[:witnesses][0]).lock)[:sig_A]\n\n local_stx_sig = @tx_generator.parse_witness_lock(@tx_generator.parse_witness(local_stx_info[:witnesses][0]).lock)[:sig_A]\n remote_stx_sig = @tx_generator.parse_witness_lock(@tx_generator.parse_witness(remote_stx_info[:witnesses][0]).lock)[:sig_A]\n\n local_ctx_result = verify_info_sig(remote_ctx_info, \"closing\", local_pubkey, sig_index)\n local_stx_result = verify_info_sig(remote_stx_info, \"settlement\", local_pubkey, sig_index)\n\n # make sure my signatures are consistent.\n if local_ctx_sig != remote_ctx_sig ||\n local_stx_sig != remote_stx_sig\n client.puts(generate_text_msg(msg[:id], \"Signature inconsistent.\"))\n record_result({ \"sender_step4_error_signature_inconsistent\": true })\n return false\n end\n\n # verify signature to make sure the data is not modified\n if !local_ctx_result || !local_stx_result\n record_result({ \"sender_step4_error_info_modified\": true })\n client.puts(generate_text_msg(msg[:id], \"The data is modified.\"))\n return false\n end\n\n # check the remote signature\n remote_ctx_result = verify_info_sig(remote_ctx_info, \"closing\", remote_pubkey, 1 - sig_index)\n remote_stx_result = verify_info_sig(remote_stx_info, \"settlement\", remote_pubkey, 1 - sig_index)\n\n if !remote_ctx_result || !remote_stx_result\n record_result({ \"sender_step4_error_signature_invalid\": true })\n client.puts(generate_text_msg(msg[:id], \"The signatures are invalid.\"))\n return false\n end\n\n # sign and send the fund_tx\n fund_tx = @coll_sessions.find({ id: msg[:id] }).first[:fund_tx]\n fund_tx = CKB::Types::Transaction.from_h(fund_tx)\n\n # the logic is, I only sign the inputs in my local cells.\n fund_tx = @tx_generator.sign_tx(fund_tx, local_inputs).to_h\n\n msg_reply = { id: msg[:id], type: 5, fund_tx: fund_tx }.to_json\n client.puts(msg_reply)\n # update the database\n @coll_sessions.find_one_and_update({ id: msg[:id] }, { \"$set\" => { fund_tx: fund_tx, ctx_info: local_ctx_info_h.to_json, stx_info: local_stx_info_h.to_json,\n status: 6, msg_cache: msg_reply } })\n\n client.close()\n return \"done\"\n when 5\n @logger.info(\"#{@key.pubkey} receive msg 5.\")\n remote_pubkey = @coll_sessions.find({ id: msg[:id] }).first[:remote_pubkey]\n local_inputs = @coll_sessions.find({ id: msg[:id] }).first[:local_cells]\n local_inputs = local_inputs.map { |cell| CKB::Types::Input.from_h(cell) }\n fund_tx_local = @coll_sessions.find({ id: msg[:id] }).first[:fund_tx]\n fund_tx_local = CKB::Types::Transaction.from_h(fund_tx_local)\n\n fund_tx_remote = msg[:fund_tx]\n fund_tx_remote = CKB::Types::Transaction.from_h(fund_tx_remote)\n\n # check signature.\n fund_tx_check_result = verify_fund_tx_sig(fund_tx_remote, remote_pubkey)\n if !fund_tx_check_result\n record_result({ \"receiver_step5_error_signature_invalid\": true })\n client.puts(generate_text_msg(msg[:id], \"The signatures are invalid.\"))\n return false\n end\n\n fund_tx_local_hash = fund_tx_local.compute_hash\n fund_tx_remote_hash = fund_tx_remote.compute_hash\n\n if fund_tx_local_hash != fund_tx_remote_hash\n record_result({ \"receiver_step5_error_fund_tx_modified\": true })\n client.puts(generate_text_msg(msg[:id], \"fund tx is not consistent.\"))\n return false\n end\n\n fund_tx = @tx_generator.sign_tx(fund_tx_remote, local_inputs)\n\n # send the fund tx to chain.\n while true\n exist = @api.get_transaction(fund_tx.hash)\n break if exist != nil\n @api.send_transaction(fund_tx)\n end\n # update the database\n\n @coll_sessions.find_one_and_update({ id: msg[:id] }, { \"$set\" => { fund_tx: fund_tx.to_h, status: 6 } })\n\n return \"done\"\n when 6\n id = msg[:id]\n sig_index = @coll_sessions.find({ id: id }).first[:sig_index]\n msg_type = msg[:msg_type]\n remote_pubkey = @coll_sessions.find({ id: id }).first[:remote_pubkey]\n stage = @coll_sessions.find({ id: id }).first[:stage]\n\n @logger.info(\"#{@key.pubkey} check msg 6: basic value parsed.\")\n\n # check the stage.\n if stage != 1\n puts \"the fund tx is not on chain, so the you can not make payment now...\"\n return false\n end\n\n # there are two type msg when type is 6.\n # 1. payment request.\n # 2. closing request.\n if msg_type == \"payment\"\n @logger.info(\"#{@key.pubkey} check msg 6: branch payment.\")\n local_pubkey = @coll_sessions.find({ id: id }).first[:local_pubkey]\n sig_index = @coll_sessions.find({ id: id }).first[:sig_index]\n type_hash = @coll_sessions.find({ id: id }).first[:type_hash]\n payment = msg[:payment].map() { |key, value| [key.to_s, value] }.to_h\n remote_investment = convert_hash_to_text(payment)\n\n # recv the new signed stx and unsigned ctx.\n remote_ctx_info = hash_to_info(msg[:ctx_info])\n remote_stx_info = hash_to_info(msg[:stx_info])\n\n @logger.info(\"#{@key.pubkey} check msg 6 payment: msg parsed.\")\n local_ctx_info = @coll_sessions.find({ id: id }).first[:ctx_info]\n local_stx_info = @coll_sessions.find({ id: id }).first[:stx_info]\n\n local_ctx_info = hash_to_info(JSON.parse(local_ctx_info, symbolize_names: true))\n local_stx_info = hash_to_info(JSON.parse(local_stx_info, symbolize_names: true))\n\n @logger.info(\"#{@key.pubkey} check msg 6 payment: load local ctx and stx.\")\n\n local_update_stx_info = @tx_generator.update_stx(payment, local_stx_info, remote_pubkey, local_pubkey)\n local_update_ctx_info = @tx_generator.update_ctx(local_ctx_info)\n\n @logger.info(\"#{@key.pubkey} check msg 6 payment: construct local stx and ctx.\")\n\n # check the payment is positive.\n for payment_value in payment.values()\n if payment_value < 0\n record_result({ \"receiver_step6_make_payments_error_negative\": payment_value })\n return false\n end\n end\n\n # check the balance is enough.\n if local_update_stx_info.is_a? Numeric\n record_result({ \"receiver_step6_make_payments_error_insufficient\": local_update_stx_info })\n return false\n end\n\n # this is becase the output capacity is not consistent.\n if !verify_info_args(local_update_ctx_info, remote_ctx_info) || !verify_info_args(local_update_stx_info, remote_stx_info)\n record_result({ \"receiver_step6_make_payments_error_info_inconsistent\": true })\n return false\n end\n if !verify_info_sig(remote_stx_info, \"settlement\", remote_pubkey, 1 - sig_index)\n record_result({ \"receiver_step6_make_payments_error_signature_invalid\": true })\n return false\n end\n\n @logger.info(\"#{@key.pubkey} check msg 6 payment: check stx and ctx are consistent.\")\n\n commands = load_command()\n\n # ask users whether the payments are right.\n puts \"The remote node wants to pay you #{remote_investment} in channel #{id}.\"\n puts \"Tell me whether you are willing to accept this payment.\"\n while true\n response = commands[:payment_reply]\n # response = STDIN.gets.chomp\n if response == \"yes\"\n break\n elsif response == \"no\"\n client.puts(generate_text_msg(msg[:id], \"sry, remote node refuses your request.\"))\n return false\n else\n puts \"your input is invalid\"\n end\n end\n\n # generate the signed message.\n msg_signed = generate_msg_from_info(remote_stx_info, \"settlement\")\n\n # sign ctx and stx and send them.\n witness_new = Array.new()\n for witness in remote_stx_info[:witnesses]\n witness_new << @tx_generator.generate_witness(id, 1, witness, msg_signed, sig_index)\n end\n remote_stx_info[:witnesses] = witness_new\n msg_signed = generate_msg_from_info(remote_ctx_info, \"closing\")\n\n # sign ctx and stx and send them.\n witness_new = Array.new()\n for witness in remote_ctx_info[:witnesses]\n witness_new << @tx_generator.generate_witness(id, 0, witness, msg_signed, sig_index)\n end\n remote_ctx_info[:witnesses] = witness_new\n\n # update the database.\n ctx_info_h = info_to_hash(remote_ctx_info)\n stx_info_h = info_to_hash(remote_stx_info)\n\n msg = { id: id, type: 7, ctx_info: ctx_info_h, stx_info: stx_info_h }.to_json\n client.puts(msg)\n @logger.info(\"#{@key.pubkey} send msg_7: msg sent.\")\n # update the local database.\n @coll_sessions.find_one_and_update({ id: id }, { \"$set\" => { ctx_pend: ctx_info_h.to_json,\n stx_pend: stx_info_h.to_json,\n status: 8, msg_cache: msg } })\n elsif msg_type == \"closing\"\n @logger.info(\"#{@key.pubkey} check msg 6: branch closing.\")\n\n fund_tx = @coll_sessions.find({ id: id }).first[:fund_tx]\n fund_tx = CKB::Types::Transaction.from_h(fund_tx)\n local_stx_info = hash_to_info(JSON.parse(@coll_sessions.find({ id: id }).first[:stx_info], symbolize_names: true))\n remote_change = CKB::Types::Output.from_h(msg[:change])\n remote_fee_cells = msg[:fee_cell].map { |cell| CKB::Types::Input.from_h(cell) }\n\n nounce = @coll_sessions.find({ id: id }).first[:nounce]\n type_hash = @coll_sessions.find({ id: id }).first[:type_hash]\n current_height = @api.get_tip_block_number\n\n @logger.info(\"#{@key.pubkey} check msg 6 closing: msg parsed.\")\n\n # check cell is live.\n for cell in remote_fee_cells\n validation = @api.get_live_cell(cell.previous_output)\n if validation.status != \"live\"\n record_result({ \"receiver_step6_error_cell_dead\": true })\n client.puts(generate_text_msg(msg[:id], \"sry, the cells you offer are dead.\"))\n return false\n end\n end\n\n remote_fee = get_total_capacity(remote_fee_cells) - remote_change.capacity\n # check sufficient.\n if remote_fee < 0\n record_result({ \"receiver_step6_error_fee_negative\": remote_fee })\n client.puts(generate_text_msg(msg[:id], \"sry, you fee is not enough as you claimed.\"))\n return false\n end\n # check container sufficient.\n if remote_change.capacity < 61 * 10 ** 8\n record_result({ \"receiver_step6_error_change_container_insufficient\": remote_change.capacity - 61 * 10 ** 8 })\n client.puts(generate_text_msg(msg[:id], \"sry, the container of change is not enough.\"))\n return false\n end\n puts \"#{remote_pubkey} wants to close the channel with id #{id}. Remote fee is #{remote_fee}\"\n puts \"Tell me whether you are willing to accept this request\"\n commands = load_command()\n while true\n response = commands[:closing_reply]\n # response = STDIN.gets.chomp\n if response == \"yes\"\n break\n elsif response == \"no\"\n msg_reply = generate_text_msg(msg[:id], \"sry, remote node refuses your request.\")\n client.puts(msg_reply)\n return false\n else\n puts \"your input is invalid\"\n end\n end\n while true\n puts \"Please input fee you want to use for settlement\"\n local_fee = commands[:recv_settle_fee].to_i\n break\n end\n\n @logger.info(\"#{@key.pubkey} check msg 6 closing: fee get.\")\n\n local_change_output = CKB::Types::Output.new(\n capacity: 0,\n lock: @lock,\n type: nil,\n )\n\n get_total_capacity = local_change_output.calculate_min_capacity(\"0x\") + local_fee\n local_fee_cell = gather_fee_cell([@lock_hash], get_total_capacity, @coll_cells, 0)\n fee_cell_capacity = get_total_capacity(local_fee_cell)\n return false if local_fee_cell == nil\n local_change_output.capacity = fee_cell_capacity - local_fee\n\n input_fund = @tx_generator.convert_input(fund_tx, 0, 0) # index and since.\n inputs = [input_fund] + remote_fee_cells + local_fee_cell\n\n outputs = local_stx_info[:outputs] + [remote_change, local_change_output]\n outputs_data = local_stx_info[:outputs_data] + [\"0x\", \"0x\"]\n witnesses = local_stx_info[:witnesses]\n\n # add witnesses of change.\n witnesses << CKB::Types::Witness.new\n witnesses << CKB::Types::Witness.new\n\n witnesses = witnesses.map do |witness|\n case witness\n when CKB::Types::Witness\n witness\n else\n @tx_generator.parse_witness(witness)\n end\n end\n\n type_dep = []\n\n for output in local_stx_info[:outputs]\n if output.type != nil\n current_type = find_type(output.type.compute_hash)\n type_dep.append(current_type[:type_dep]) if current_type[:type_dep] != nil\n end\n end\n type_dep = type_dep.map(&:to_h)\n type_dep = type_dep.to_set.to_a\n type_dep = type_dep.map { |dep| CKB::Types::CellDep.from_h(dep) }\n\n terminal_tx = @tx_generator.generate_terminal_tx(id, nounce, inputs, outputs, outputs_data, witnesses, sig_index, type_dep)\n terminal_tx = @tx_generator.sign_tx(terminal_tx, local_fee_cell).to_h\n\n @logger.info(\"#{@key.pubkey} check msg 6 closing: terminal_tx .\")\n\n msg_reply = { id: msg[:id], type: 9, terminal_tx: terminal_tx }.to_json\n client.puts(msg_reply)\n @coll_sessions.find_one_and_update({ id: msg[:id] }, { \"$set\" => { stage: 2, closing_time: current_height + 20 } })\n end\n when 7\n\n # It is the feedback msg of payments.\n id = msg[:id]\n remote_pubkey = @coll_sessions.find({ id: id }).first[:remote_pubkey]\n local_pubkey = @coll_sessions.find({ id: id }).first[:local_pubkey]\n sig_index = @coll_sessions.find({ id: id }).first[:sig_index]\n stage = @coll_sessions.find({ id: id }).first[:stage]\n local_ctx_info = hash_to_info(JSON.parse(@coll_sessions.find({ id: msg[:id] }).first[:ctx_pend], symbolize_names: true))\n local_stx_info = hash_to_info(JSON.parse(@coll_sessions.find({ id: msg[:id] }).first[:stx_pend], symbolize_names: true))\n nounce = @coll_sessions.find({ id: id }).first[:nounce]\n\n remote_ctx_info = hash_to_info(msg[:ctx_info])\n remote_stx_info = hash_to_info(msg[:stx_info])\n\n if stage != 1\n puts \"the fund tx is not on chain, so the you can not make payment now...\"\n return false\n end\n @logger.info(\"#{@key.pubkey} check msg 7: begin to check the info.\")\n\n verify_info_sig(remote_stx_info, \"settlement\", remote_pubkey, 1 - sig_index)\n # check both the signatures are right.\n if !verify_info_args(local_ctx_info, remote_ctx_info) || !verify_info_args(local_stx_info, remote_stx_info)\n record_result({ \"sender_step7_error_info_inconsistent\": true })\n client.puts(generate_text_msg(msg[:id], \"sry, the args of closing or settlement transaction have problem.\"))\n client.close()\n return false\n end\n\n if !verify_info_sig(remote_ctx_info, \"closing\", remote_pubkey, 1 - sig_index) || !verify_info_sig(remote_stx_info, \"settlement\", remote_pubkey, 1 - sig_index)\n record_result({ \"sender_step7_error_signature_invalid\": true })\n client.puts(generate_text_msg(msg[:id], \"sry, the sig of closing or settlement transaction have problem.\"))\n client.close()\n return false\n end\n\n # generate the signed msg from info.\n msg_signed = generate_msg_from_info(remote_ctx_info, \"closing\")\n witness_new = Array.new()\n for witness in remote_ctx_info[:witnesses]\n witness_new << @tx_generator.generate_witness(id, 0, witness, msg_signed, sig_index)\n end\n remote_ctx_info[:witnesses] = witness_new\n\n ctx_info_h = info_to_hash(remote_ctx_info)\n stx_info_h = info_to_hash(remote_stx_info)\n\n msg = { id: id, type: 8, ctx_info: ctx_info_h }.to_json\n client.puts(msg)\n\n # update the local database.\n @coll_sessions.find_one_and_update({ id: id }, { \"$set\" => { ctx_info: ctx_info_h.to_json,\n stx_info: stx_info_h.to_json,\n nounce: nounce + 1,\n stx_pend: 0, ctx_pend: 0,\n status: 6, msg_cache: msg } })\n client.close\n when 8\n # it is the final step of making payments.\n # the payer just check the remote signatures are right,\n # and send the signed ctx to him.\n id = msg[:id]\n remote_pubkey = @coll_sessions.find({ id: id }).first[:remote_pubkey]\n local_pubkey = @coll_sessions.find({ id: id }).first[:local_pubkey]\n sig_index = @coll_sessions.find({ id: id }).first[:sig_index]\n stage = @coll_sessions.find({ id: id }).first[:stage]\n local_ctx_info_pend = hash_to_info(JSON.parse(@coll_sessions.find({ id: msg[:id] }).first[:ctx_pend], symbolize_names: true))\n local_stx_info_pend = hash_to_info(JSON.parse(@coll_sessions.find({ id: msg[:id] }).first[:stx_pend], symbolize_names: true))\n nounce = @coll_sessions.find({ id: id }).first[:nounce]\n\n @logger.info(\"#{@key.pubkey} check msg 8: msg parsed.\")\n\n remote_ctx_info = hash_to_info(msg[:ctx_info])\n\n @logger.info(\"#{@key.pubkey} check msg 8: ctx_info checked.\")\n\n if !verify_info_args(local_ctx_info_pend, remote_ctx_info)\n record_result({ \"receiver_step8_error_info_inconsistent\": true })\n client.puts(generate_text_msg(msg[:id], \"sry, the args of closing transaction have problem.\"))\n return false\n end\n\n if !verify_info_sig(remote_ctx_info, \"closing\", remote_pubkey, 1 - sig_index)\n record_result({ \"receiver_step8_error_signature_invalid\": true })\n client.puts(generate_text_msg(msg[:id], \"sry, the sig of closing transaction have problem.\"))\n return false\n end\n\n ctx_info_h = info_to_hash(remote_ctx_info)\n stx_info_h = info_to_hash(local_stx_info_pend)\n\n @logger.info(\"#{@key.pubkey} check msg 8: finished.\")\n\n @coll_sessions.find_one_and_update({ id: id }, { \"$set\" => { ctx_info: ctx_info_h.to_json, stx_info: stx_info_h.to_json,\n status: 6, stx_pend: 0, ctx_pend: 0,\n nounce: nounce + 1 } })\n @logger.info(\"payment done, now the version in local db is #{nounce + 1}\")\n return \"done\"\n when 9\n id = msg[:id]\n terminal_tx = CKB::Types::Transaction.from_h(msg[:terminal_tx])\n sig_index = @coll_sessions.find({ id: id }).first[:sig_index]\n local_fee_cell = @coll_sessions.find({ id: id }).first[:settlement_fee_cell]\n local_change_output = JSON.parse(@coll_sessions.find({ id: msg[:id] }).first[:settlement_fee_change], symbolize_names: true)\n remote_pubkey = @coll_sessions.find({ id: id }).first[:remote_pubkey]\n local_stx_info = hash_to_info(JSON.parse(@coll_sessions.find({ id: msg[:id] }).first[:stx_info], symbolize_names: true))\n fund_tx = @coll_sessions.find({ id: id }).first[:fund_tx]\n fund_tx = CKB::Types::Transaction.from_h(fund_tx)\n local_fee_cell = local_fee_cell.map { |cell| JSON.parse(cell.to_json, symbolize_names: true) }\n input_fund = @tx_generator.convert_input(fund_tx, 0, 0)\n\n @logger.info(\"#{@key.pubkey} check msg 9: msg parsed.\")\n\n for output in local_stx_info[:outputs].map(&:to_h)\n if !terminal_tx.outputs.map(&:to_h).include? output\n record_result({ \"sender_step9_error_stx_inconsistent\": true })\n msg_reply = generate_text_msg(msg[:id], \"sry, the settlement outputs are inconsistent with my local one.\")\n return false\n end\n end\n\n @logger.info(\"#{@key.pubkey} check msg 9: settlement is right.\")\n\n terminal_tx = CKB::Types::Transaction.from_h(msg[:terminal_tx])\n remote_fee_cells = terminal_tx.inputs.map(&:to_h) - local_fee_cell - [input_fund.to_h]\n remote_fee_cells = remote_fee_cells.map { |cell| CKB::Types::Input.from_h(cell) }\n remote_change_output = terminal_tx.outputs.map(&:to_h) - [local_change_output] - local_stx_info[:outputs].map(&:to_h)\n\n remote_change_output = remote_change_output.map { |output| CKB::Types::Output.from_h(output) }\n # check cell is live.\n for cell in remote_fee_cells\n validation = @api.get_live_cell(cell.previous_output)\n if validation.status != \"live\"\n record_result({ \"sender_step9_error_cell_dead\": true })\n client.puts(generate_text_msg(msg[:id], \"sry, the cells you offer are dead.\"))\n return false\n end\n end\n\n @logger.info(\"#{@key.pubkey} check msg 9: cell all live.\")\n\n remote_change_capacity = remote_change_output.map(&:capacity).inject(0, &:+)\n remote_fee = get_total_capacity(remote_fee_cells) - remote_change_capacity\n\n if remote_fee < 0\n record_result({ \"receiver_step9_error_fee_negative\": remote_fee })\n client.puts(generate_text_msg(msg[:id], \"sry, you fee is not enough as you claimed.\"))\n return false\n end\n # check container sufficient.\n if remote_change_capacity < 61 * 10 ** 8\n record_result({ \"receiver_step9_error_change_container_insufficient\": remote_change_capacity - 61 * 10 ** 8 })\n client.puts(generate_text_msg(msg[:id], \"sry, the container of change is not enough.\"))\n return false\n end\n\n # check signature.\n verify_result = verify_fund_tx_sig(terminal_tx, remote_pubkey)\n if !verify_result\n record_result({ \"receiver_step9_error_signature_invalid\": true })\n client.puts(generate_text_msg(msg[:id], \"The signatures are invalid.\"))\n return false\n end\n\n puts \"#{remote_pubkey} reply your closign request about id #{id}. Remote fee is #{remote_fee}\"\n puts \"Tell me whether you are willing to accept this request\"\n commands = load_command()\n\n while true\n response = commands[:closing_reply]\n # response = STDIN.gets.chomp\n if response == \"yes\"\n break\n elsif response == \"no\"\n msg_reply = generate_text_msg(msg[:id], \"sry, remote node refuses your request.\")\n client.puts(msg_reply)\n return false\n else\n puts \"your input is invalid\"\n end\n end\n\n @logger.info(\"#{@key.pubkey} check msg 9: begin to constrct terminal transaction.\")\n # add my signature and send it to blockchain.\n local_fee_cell = local_fee_cell.map { |cell| CKB::Types::Input.from_h(cell) }\n terminal_tx = @tx_generator.sign_tx(terminal_tx, local_fee_cell)\n terminal_tx.witnesses[0] = @tx_generator.generate_witness(id, 0, terminal_tx.witnesses[0], terminal_tx.hash, sig_index)\n\n exist = @api.get_transaction(terminal_tx.hash)\n begin\n @api.send_transaction(terminal_tx) if exist == nil\n rescue Exception => e\n end\n return \"done\"\n end\n end", "title": "" }, { "docid": "4089bb2c934becd38514a6687b3eb1aa", "score": "0.64146537", "text": "def start_listener_thread\n @jabber.add_message_callback do |m|\n message = m.body\n if message && message != '' && !m.composing?\n parse_command( m.from, message )\n end\n end\n end", "title": "" }, { "docid": "33f01c9e371a306cc4e874c3d5c9f738", "score": "0.64034575", "text": "def create\n \n @message = Message.new(params[:message]) \n\n @message.sender_tags.each do |initials|\n user = User.find_by_initials(initials)\n @message.message_senders << user if user.present?\n end\n\n @message.recipient_tags.each do |initials|\n user = User.find_by_initials(initials)\n @message.message_recipients << user if user.present?\n end\n\n pattern = /#([\\w\\.]+)/\n @message.text.scan(pattern).map(&:first).map(&:downcase).uniq.each do |name|\n channel = Channel.find_by_name(name)\n channel = Channel.new(name: name) unless channel.present?\n\n channel_message = ChannelMessage.new(channel: channel, message: @message)\n @message.channelMessages << channel_message\n end\n\n respond_to do |format|\n if @message.save\n flash[:notice] = 'Message was successfully created.'\n format.html { redirect_to action: \"index\" }\n format.json { render json: @message, status: :created, location: @message }\n else\n format.html { render action: \"new\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dd1ff0d293b90ecf834ccc07f140e06f", "score": "0.63950056", "text": "def callback\n unless is_validate_signature\n render :nothing => true, status: 470\n end\n # result = params[:result][0]\n # logger.info({from_line: result})\n \n #受信したメッセージ\n # text_message = result['content']['text']\n #メッセージ送信者のID\n # replyToken =result['content']['from']\n \n event = params[:events][0]\n event_type = event[\"type\"]\n replyToken = event[\"replyToken\"]\n #受信したメッセージ\n text_message = event['message']['text']\n #メッセージ送信者のID\n userId =event[\"source\"][\"userId\"]\n \n client = LineClient.new(CHANNEL_ACCESS_TOKEN, OUTBOUND_PROXY)\n # client = LineClient.new(CHANNEL_ID, CHANNEL_SECRET, CHANNEL_MID, OUTBOUND_PROXY)\n \n case event_type\n when \"message\"\n #メッセージ送信者の履歴が過去になければ(質問フローの中にいないなら)\n if Talk.find_by(:user => userId)==nil then\n res = client.reply(replyToken, [\"ようこそMOCCAへ\\n素敵なプレゼントを\\n一緒に探そう!\", \"どうやって探す?\\n\\nQ:質問に答えて探す!\\nR:運に任せて探す!\"])\n # res = client.reply(replyToken, \"どうやって探す?\\n\\nQ:質問に答えて探す!\\nR:運に任せて探す!\")\n @talk=Talk.create(:user => userId, :text => \"\")\n else\n \n #前回使用より30分以上経過していたらリセット***************************************************(1)\n if (Time.now - Talk.find_by(:user => userId).updated_at )> 30*60 then\n @talk=Talk.find_by(:user => userId)\n @talk.update(:text => \"\")\n else\n end\n \n if Talk.find_by(:user => userId).text==\"\" then\n #メッセージが\"Q\"なら質問フローを開始する\n case text_message.upcase\n when \"Q\",\"Q\" then\n #ランダムに質問5個を取ってきてTalkモデルに送信者IDと共に格納\n @questions=Question.order(\"RANDOM()\").limit(5)\n qarray=\"0\"\n @questions.each do |q|\n qarray+=\",\"\n qarray+=q.id.to_s\n end\n # res = client.reply(replyToken, [\"プレゼントを渡す相手を想像して...\",\"はい(y)/いいえ(n)で答えてね\\nまずは5問!\"])\n # res = client.reply(replyToken, \"はい(y)/いいえ(n)で答えてね\\nまずは5問!\")\n # res = client.reply(replyToken, \"まずは5問!\")\n message=@questions[0].body\n @talk=Talk.find_by(:user => userId)\n @talk.update(:text => \"0\",:question => qarray)\n res = client.reply(replyToken, [\"プレゼントを渡す相手を想像して...\",\"はい(y)/いいえ(n)で答えてね\\nまずは5問!\", message])\n # res = client.reply(replyToken, message)\n when \"R\",\"R\" then\n # res = client.reply(replyToken, \"今日の運はどうかな?\")\n # res = client.reply(replyToken, \"今日の運はこんな感じ!\")\n @gift=Gift.offset( rand(Gift.count) ).first\n message=message=@gift.name+\"/\"+@gift.company_name+\"\\n\"+@gift.url+\"\\n\"\n \n #画像送信とりあえず今は無し\n # res = client.sendImage([replyToken], \"https://mocca-giftfinder.herokuapp.com/gifts/\"+@gift.id.to_s+\"/img\", \"https://mocca-giftfinder.herokuapp.com/gifts/\"+@gift.id.to_s+\"/img\" )\n # res = client.reply(replyToken, message)\n \n # message=\"Web版も試してね!\\nhttps://mocca-giftfinder.herokuapp.com/\"\n # res = client.reply(replyToken, message)\n res = client.reply(replyToken, [\"今日の運はこんな感じ!\", message, \"もっと探す?\\n\\nQ:質問に答えて探す!\\nR:運に任せて探す!\"])\n # res = client.reply(replyToken, \"もっと探す?\\n\\nQ:質問に答えて探す!\\nR:運に任せて探す!\")\n else\n #\"Q\"\"R\"以外のメッセージが来た場合\n res = client.reply(replyToken, [\"どうやって探す?\\n\\nQ:質問に答えて探す!\\nR:運に任せて探す!\"])\n end\n \n else\n #メッセージ送信者の履歴が過去にあれば(質問フローの中にいれば)\n #Talkモデルに格納したデータを取ってくる\n @talk=Talk.find_by(:user => userId)\n @qarray=@talk.question.split(\",\")\n @ansarray=@talk.text.split(\",\")\n i=@ansarray.count\n # はいと判断するメッセージ\n yes_array=[/はい!*/, /はい!*/,/うん!*/, /うん!*/,/YES!*/i,/y/i,/1/]\n no_array=[/いいえ!*/, /いいえ!*/,/いーえ!*/,/いや!*/, /いや!*/,/NO!*/i,/n/i,/2/]\n up_array=[/.*いい.*/,/.*最高.*/,/.*さいこー.*/,/.*good.*/i,/.*よい.*/,/.*良.*/,/おっけー!*/,/オッケー!*/,/OK!*/i]\n #答えた質問が5個未満なら\n case i\n when 0,1,2,3,4 then\n case text_message\n when *yes_array then\n message=Question.find_by_id(@qarray[i+1]).body\n @talk.update(:text => @talk.text+\",1\")\n res = client.reply(replyToken, [message])\n when *no_array then\n message=Question.find_by_id(@qarray[i+1]).body\n @talk.update(:text => @talk.text+\",2\")\n res = client.reply(replyToken, [message])\n else\n # message=\"はい/いいえで答えてね\"\n # res = client.reply(replyToken, message)\n \n #質問の再表示****************************************************************************(2)\n message=Question.find_by_id(@qarray[i]).body\n res = client.reply(replyToken, [\"はい/いいえで答えてね\", message])\n # ここでもう一度質問を表示したい\n end\n #答えた質問が5個なら \n when 5 then\n case text_message\n # ↓YES--------------------------------------------------------------------------\n when *yes_array then\n # res = client.reply(replyToken, \"こんなプレゼントはどうかな...\")\n # res = client.reply(replyToken, \"ちょっと待っててね...\")\n @talk.update(:text => @talk.text+\",1\")\n # ベイズ計算をする。というか@expTop1を生成する\n bayes_calc\n \n #評価初期\n up_calc(@expTop1.id,1)\n down_calc(@expTop1.id,1)\n \n #@expTop1のギフトに関して,その画像,名前(会社名も),URLと価格帯を送信\n message=@expTop1.name+\"/\"+@expTop1.company_name+\"\\n\"+@expTop1.url+\"\\n\"\n \n # res = client.sendImage([replyToken], \"https://mocca-giftfinder.herokuapp.com/gifts/\"+@expTop1.id.to_s+\"/img\", \"https://mocca-giftfinder.herokuapp.com/gifts/\"+@expTop1.id.to_s+\"/img\" )\n res = client.reply(replyToken, [\"ちょっと待っててね...\", message, \"このプレゼントどうかな?\\nいい?ちょっと違う?\"])\n \n # message=\"このプレゼントどうかな?\\nいい?ちょっと違う?\"\n # message=\"Web版も試してね!\\nhttps://mocca-giftfinder.herokuapp.com/\"\n # res = client.reply(replyToken, message)\n #Talkモデルのquestionの最後(6番目)にギフトのidを付加する\n @talk.update(:question => @talk.question+\",\"+@expTop1.id.to_s)\n # message=@expTop1.id.to_s\n # res = client.reply(replyToken, message)\n # @talk.update(:text => \"\")\n # ↑YES--------------------------------------------------------------------------\n # ↓NO----------------------------------------------------------------------------\n when *no_array then\n # res = client.reply(replyToken, \"こんなプレゼントはどうかな...\")\n # res = client.reply(replyToken, \"ちょっと待っててね...\")\n @talk.update(:text => @talk.text+\",2\")\n # ベイズ計算をする。というか@expTop1を生成する\n bayes_calc\n \n #評価初期\n up_calc(@expTop1.id,1)\n down_calc(@expTop1.id,1)\n \n #@expTop1のギフトに関して,その画像,名前(会社名も),URLと価格帯を送信\n message=message=@expTop1.name+\"/\"+@expTop1.company_name+\"\\n\"+@expTop1.url+\"\\n\"\n \n # res = client.sendImage([replyToken], \"https://mocca-giftfinder.herokuapp.com/gifts/\"+@expTop1.id.to_s+\"/img\", \"https://mocca-giftfinder.herokuapp.com/gifts/\"+@expTop1.id.to_s+\"/img\" )\n res = client.reply(replyToken, [\"ちょっと待っててね...\", message,\"このプレゼントどうかな?\\nいい?ちょっと違う?\"] )\n \n # message=\"このプレゼントどうかな?\\nいい?ちょっと違う?\"\n # message=\"Web版もお試し下さい\\nhttps://mocca-giftfinder.herokuapp.com/\"\n # res = client.reply(replyToken, message)\n #Talkモデルのquestionの最後(6番目)にギフトのidを付加する\n @talk.update(:question => @talk.question+\",\"+@expTop1.id.to_s)\n # message=@expTop1.id.to_s\n # res = client.reply(replyToken, message)\n # @talk.update(:text => \"\")\n \n # ↑NO----------------------------------------------------------------------------\n else\n message=\"はい/いいえで答えてね\"\n res = client.reply(replyToken, [message])\n end\n \n else\n case text_message\n when *up_array then\n up_calc(@qarray[6],1)\n down_calc(@qarray[6],-1)\n # res = client.reply(replyToken, \"ありがとう!\\nWeb版も使ってみてね!\\nhttps://mocca-giftfinder.herokuapp.com\")\n res = client.reply(replyToken, [\"ありがとう!\\nまた一緒に探そうね!\"])\n @talk.update(:text => \"\")\n # message=@qarray[6].to_s+\"up\"\n # res = client.reply(replyToken, message)\n else\n up_calc(@qarray[6],-1)\n down_calc(@qarray[6],1)\n # res = client.reply(replyToken, \"そっか...またチャレンジしてね!\\nWeb版も試してね!\\nhttps://mocca-giftfinder.herokuapp.com/\")\n res = client.reply(replyToken, [\"もう一回やってみて!質問が変わるよ!\"])\n @talk.update(:text => \"\")\n # message=@qarray[6].to_s+\"down\"\n # res = client.reply(replyToken, message)\n end\n res = client.reply(replyToken, [\"どうやって探す?\\n\\nQ:質問に答えて探す!\\nR:運に任せて探す!\"])\n end\n end\n end\n end\n\n if res.status == 200\n logger.info({success: res})\n else\n logger.info({fail: res})\n end\n render :nothing => true, status: :ok\n end", "title": "" }, { "docid": "afb9a0ee75fc06e367252ec03406cb3e", "score": "0.63838506", "text": "def loop()\n\t\tline = @socket.gets\n\t\tuserposting = line[/^:([\\|\\.\\-0-9a-zA-Z]*)!/, 1]\n\t\tif line.match(/^:.*\\ PRIVMSG\\ #{@nick}\\ \\:.*/)\n channel = userposting\n\t\telse\n\t\t\tchannel = line[/\\ (#[\\|\\.\\-0-9a-zA-Z]*)\\ :/, 1]\n\t\tend\n\t\tif userposting.eql?(\"kbenson\")\n\t\t\treturn\n\t\tend\t\n\t\tif line.match(/.*\\:#{@nick}[\\,\\:\\ ]+.*/) then\n\t\t\tparams = line[/.*\\:#{@nick}[\\,\\:\\ ]+(.*)/, 1]\n\t\t\tcase\n\t\t\twhen params.match(/^join\\ \\#[\\-\\_\\.\\'0-9a-zA-Z]+/)\n\t\t\t\tchannel_to_join = params[/^join\\ (\\#[\\-\\_\\.\\'0-9a-zA-Z]+)/, 1]\n\t\t\t\tjoin_chan(channel_to_join)\n\t\t\twhen params.match(/^leave/)\n\t\t\t\tif channel == userposting\n\t\t\t\t\tsendchn(\"Say it in the channel you want me to leave.\", channel)\n\t\t\t\telse\n\t\t\t\t\tleave_chan(channel)\n\t\t\t\tend\n\t\t\twhen params.match(/^[\\-\\_\\.\\'\\.0-9a-zA-Z]*\\ is\\ .*\\r/)\n\t\t\t\tword_to_define = params[/([\\-\\_\\.\\'0-9a-zA-Z]*)\\ is/, 1]\n\t\t\t\tdefinition = params[/[\\-\\_\\ \\.\\'0-9a-zA-Z]*\\ is\\ (.*)\\r/, 1]\n\t\t\t\tadd_definition(word_to_define, definition, channel)\n\t\t\twhen params.match(/^[\\-\\_\\.0-9a-zA-Z]*\\?\\r/)\n\t\t\t\tword_to_echo_def = params[/([\\-\\_\\.0-9a-zA-Z]*)?/, 1]\n\t\t\t\techo_definition(word_to_echo_def, channel)\n\t\t\twhen params.match(/^forget\\ [\\-\\_\\ 0-9a-zA-Z]*\\r/)\n\t\t\t\tword_to_forget = params[/forget\\ ([\\-\\_\\ 0-9a-zA-Z]*)\\r/, 1]\n\t\t\t\tforget_definition(word_to_forget, channel)\n\t\t\twhen params.match(/^addquote.*\\r/)\n\t\t\t\tuser_to_quote = line[/addquote\\ ([0-9a-zA-Z]*)\\ /, 1]\n\t\t\t\tnew_quote = line[/addquote\\ [0-9a-zA-Z]*\\ (.*)/, 1]\n\t\t\t\tif user_to_quote.eql?(nil)\n\t\t\t\t\terror(\"syntax\", channel)\n\t\t\t\t\t \n\t\t\t\tend\n\t\t\t\tif new_quote.eql?(nil)\n\t\t\t\t\terror(\"syntax\", channel)\n\t\t\t\t\t \t\n\t\t\t\tend\n\t\t\t\taddquote(new_quote, user_to_quote, channel)\t\t\t\t\n\t\t\t\t \n\t\t\twhen params.match(/^quote.*\\r/)\n\t\t\t\tif params.eql?(\"quote\\r\")\n\t\t\t\t\techoquote(\"rand\", channel)\n\t\t\t\telse\n\t\t\t\t\techoquote(params[/quote\\ (.*)\\r$/, 1], channel)\n\t\t\t\tend\n\t\t\twhen params.match(/^rank.*\\r/)\n\t\t\t\tif params.eql?(\"rank\\r\")\n\t\t\t\t\trank(\"all\", channel)\n\t\t\t\telse\n\t\t\t\t\tuser_to_rank = params[/rank\\ (.*)\\r$/, 1]\n\t\t\t\t\trank(user_to_rank, channel)\n\t\t\t\tend\n\t\t\twhen params.eql?(\"time\\r\")\n\t\t\t\ttime = Time.new\n\t\t\t\ttimenow = time.inspect\n\t\t\t\tsendchn(\"The current time is #{timenow}\", channel)\n\t\t\twhen params.eql?(\"weather\\r\")\n\t\t\t\t# Yahoo Weather Variables\n yahoo_url = 'http://query.yahooapis.com/v1/public/yql?format=json&q='\n query = \"SELECT * FROM weather.forecast WHERE location = 27606\"\n url = URI.encode(yahoo_url + query)\n # Pull and parse data\n weather_data = JSON.parse(open(url).read)\n weather_results = weather_data[\"query\"][\"results\"][\"channel\"]\n sendchn(\"------------------Weather For 27606---------------\", channel)\n\t\t\t\tsendchn(\"Current conditions: #{weather_results[\"wind\"][\"chill\"]} degrees and #{weather_results[\"item\"][\"forecast\"][0][\"text\"]}\", channel)\n sendchn(\"Windspeed: #{weather_results[\"wind\"][\"speed\"]}mph\", channel)\n sendchn(\"High: #{weather_results[\"item\"][\"forecast\"][0][\"high\"]} degrees\", channel)\n sendchn(\"Low: #{weather_results[\"item\"][\"forecast\"][0][\"low\"]} degrees\", channel)\n sendchn(\"-----------------------------------------------------------\", channel)\n\t\t\t\n\t\t\twhen params.eql?(\"simpsons\\r\")\n\t\t\t\tquote = pick_random_line(@simpsons)\n sendchn(\"#{quote}\", channel)\n\t\t\twhen params.eql?(\"anchorman\\r\")\n\t\t\t\tquote = pick_random_line(@anchorman)\n sendchn(\"#{quote}\", channel)\n\t\t\twhen params.eql?(\"blowmymind\\r\")\n quote = pick_random_line(@blowmymind)\n sendchn(\"#{quote}\", channel)\n\t\t\twhen params.match(/^help.*\\r/)\n case \n when params.eql?(\"help\\r\")\n sendchn(\"#{@nick}: help [command]\", channel)\n\t\t\t\t\tsendchn(\"#{@nick}: <noun> is <definition>\", channel)\n\t\t\t\t\tsendchn(\"#{@nick}: <noun>?\", channel)\n sendchn(\"#{@nick}: addquote <name> <quote WITHOUT \\\"\\\">\", channel)\n sendchn(\"#{@nick}: quote [name]\", channel)\n sendchn(\"<name>++\", channel)\n sendchn(\"<name>--\", channel)\n\t\t\t\t\tsendchn(\"#{@nick} rank\", channel)\n\t\t\t\t\tsendchn(\"#{@nick} rank <name>\", channel)\n sendchn(\"#{@nick}: time\", channel)\n sendchn(\"#{@nick}: weather\", channel)\n sendchn(\"#{@nick}: simpsons\", channel)\n sendchn(\"#{@nick}: anchorman\", channel)\n\t\t\t\t\tsendchn(\"#{@nick}: blowmymind\", channel)\n\t\t\t\t\tsendchn(\"#{@nick}: leave\", channel)\n\t\t\t\t\tsendchn(\"#{@nick}: join <#channel>\", channel) \n when params.eql?(\"help addquote\\r\")\n sendchn(\"Usage: #{@nick}: addquote <name> <quote WITHOUT \\\"\\\">\", channel)\n sendchn(\"Adds a quote to the quote database\", channel)\n sendchn(\"Quotes can be recalled with #{@nick}: quote [name]\", channel)\n \n when params.eql?(\"help quote\\r\")\n sendchn(\"Usage: #{@nick}: quote [name]\", channel)\n sendchn(\"Returns a quote from the quote database\", channel)\n sendchn(\"If no name is supplied, a random quote will be returned\", channel)\n \n when params.eql?(\"help time\\r\")\n sendchn(\"I don't know why you want help with this one #{userposting}...\", channel)\n sendchn(\"It was more of a way to test getting the time\", channel)\n sendchn(\"Eventually, the time will be used for other commands\", channel)\n \n when params.eql?(\"help weather\\r\")\n sendchn(\"PLACEHOLDER\", channel)\n \n when params.eql?(\"help simpsons\\r\")\n sendchn(\"Returns a random quote from The Simpsons\", channel)\n \n when params.eql?(\"help anchorman\\r\")\n sendchn(\"Returns a random quote from Anchorman\", channel)\n \n\t\t\t\twhen params.eql?(\"help blowmymind\\r\")\n sendchn(\"I will blow your mind\", channel)\n \n\t\t\t\telse\n\t\t\t\t\terror(\"no_command\", channel)\t\n end\n\t\t\tend\n\t\telse\n\t\t\tcase\n\t\t\t# This one is super important\n\t\t\t# It makes sure swagbot doesn't get disconnected\n\t\t\twhen line.match(/^PING :(.*)$/)\n\t\t\t\tsend \"PONG #{$~[1]}\"\n\n\t\t\t# Accept invites to channels\n\t\t\twhen line.match(/\\ INVITE #{@nick}\\ \\:\\#.*\\r/)\n\t\t\t\tinvited_channel = line[/#{@nick}\\ \\:(\\#.*)\\r/, 1]\n\t\t\t\tjoin_chan(invited_channel)\n\t\t\t\tsendchn(\"I was invited here by #{userposting}. If I am not welcome type \\\"#{@nick} leave\\\"\", invited_channel)\n\t\t\t\n\t\t\t# Karma assignments\n\t\t\twhen line.match(/^.*[\\-\\.\\'\\.\\|0-9a-zA-Z]+[\\+\\-]{2}.*/)\n\t\t\t\tif channel != userposting\n\t\t\t\t\tline.split.each do |x| \n\t\t\t\t\t\tif x.match(/[\\-\\.\\'\\.\\|0-9a-zA-Z]+\\+\\+/)\n\t\t\t\t\t\t\tuser = x[/([\\-\\.\\'\\.\\|0-9a-zA-Z]*)\\+\\+/, 1]\n\t\t\t\t\t\t\tif user == userposting\n\t\t\t\t\t\t\t\tsendchn(\"Lol, yeah right.\", channel)\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\teditkarma(user, \"add\", channel)\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\t\tif x.match(/[\\-\\.\\'\\.\\|0-9a-zA-Z]+\\-\\-/)\n\t\t\t\t\t\t\tuser = x[/([\\-\\.\\'\\.\\|0-9a-zA-Z]*)\\-\\-/, 1]\n\t\t\t\t\t\t\tif user == userposting\n\t\t\t\t\t\t\t\tsendchn(\"#{userposting}, you okay? I'm not going to let you subtract karma from yourself.\", channel)\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\teditkarma(user, \"subtract\", channel)\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\tsendchn(\"Karma can only be assigned in a channel\", channel)\n\t\t\t\tend\n\n\t\t\tend\n\tend\n\treturn nil\nend", "title": "" }, { "docid": "89f3f4189798cdde9df411a1dafc525d", "score": "0.638342", "text": "def messages(raw)\n @buffer.write(raw)\n @buffer.pos = 0\n truncated_msg = nil\n msgs = []\n\n rollback_pos = catch :truncated do\n # This is not pretty code.\n # I've tried to keep the number of blocks and method calls low.\n while !@buffer.eof?\n msg_start = @buffer.pos\n case @buffer.read(1)\n when \"-\"\n bmsg = \"\"\n @buffer.pos = @buffer.pos.tap{ @buffer.pos = msg_start; bmsg += @buffer.read }\n raise ::Yaram::CommunicationError, \"redis message was not received correctly: #{bmsg}\"\n when \"*\"\n # get the argument count\n cnt = \"\"\n throw(:truncated, msg_start) if @buffer.eof?\n true while ( cnt << @buffer.read(1) )[-2..-1] != \"\\r\\n\" && !@buffer.eof?\n throw(:truncated, msg_start) if @buffer.eof?\n cnt = cnt[0..-3]\n raise ParseError, \"expected count '#{cnt}' to be 3\" unless cnt == '3'\n \n # get the type\n len = \"\"\n true while ( ( len << @buffer.read(1) )[-2..-1] != \"\\r\\n\" && !@buffer.eof?)\n throw(:truncated, msg_start) if @buffer.eof?\n raise ParseError, \"expected first argument length '#{len[1..-3]}' to be 7\" unless '7' == len[1..-3]\n type = @buffer.read(7)\n @buffer.read(2) # pull off the CRLF\n throw(:truncated, msg_start) if @buffer.eof?\n raise ParseError, \"expected type '#{type}' to be 'message'\" unless 'message' == type\n \n # get the topic\n len = \"\"\n true while ( ( len << @buffer.read(1) )[-2..-1] != \"\\r\\n\" && !@buffer.eof?)\n throw(:truncated, msg_start) if @buffer.eof?\n len = len[1..-3].to_i\n topic = @buffer.read(len)\n @buffer.read(2) # pull off the CRLF\n throw(:truncated, msg_start) if @buffer.eof?\n \n # get the message\n len = \"\"\n true while ( ( len << @buffer.read(1) )[-2..-1] != \"\\r\\n\" && !@buffer.eof?)\n throw(:truncated, msg_start) if @buffer.eof?\n len = len[1..-3].to_i\n msg = @buffer.read(len)\n throw(:truncated, msg_start) if len != msg.length && @buffer.eof?\n msgs.push(msg)\n @buffer.read(2) # pull off the CRLF\n when \"\"\n # we're at the end of the buffer\n raise ParseError, \"expected to be at the end of the buffer\" unless @buffer.eof?\n end # !@buffer.eof?\n end # io.pos != io.length\n end # :truncated\n\n if rollback_pos.nil?\n @buffer.truncate(0)\n else\n @buffer.pos = rollback_pos\n contents = @buffer.read\n @buffer.truncate(0)\n @buffer.write(contents)\n end # rollback_pos.nil?\n \n msgs\n end", "title": "" }, { "docid": "96e95582986d9c2a2acde1e0185a70d7", "score": "0.6382464", "text": "def receive(data)\n chat = Chat.find_by(uuid: params[:chat_uuid])\n\n message = chat.messages.create!(\n content: data['content'],\n user_name: data['user_name']\n )\n\n # broadcast checkin to subscribers\n # message.attributes: object to hash\n ActionCable.server.broadcast(\"chat_#{params[:chat_uuid]}\", message.attributes)\n end", "title": "" }, { "docid": "85f18b3172995251f10353384f1dfe39", "score": "0.63818973", "text": "def got_MSG(message)\n p \"------\"\nif message['message'].downcase =~ /^!slap (.*)?/i\nmsglist = message['message'].split(/slap (.*)?/i)\nmsg = \"/me slaps \" + msglist[1] + \" around a bit with a large penis.\"\nself.send('MSG',message['channel'],msg)\nelsif message['message'].downcase =~ /^!fuck (.*)?/i\nmsglist = message['message'].split(/fuck (.*)?/i)\nmsg = \"/me grabs \" + msglist[1] + \" and tears off his/her pants and boxers/panties, sliding a my dick in their asshole!\"\nself.send('MSG',message['channel'],msg)\nelsif message['message'].downcase =~ /^!fuckgirl (.*)?/i\nmsglist = message['message'].split(/fuckgirl (.*)?/i)\nmsg = \"/me grabs \" + msglist[1] + \" and tears off her pants(or)skirt and panties, sliding my dick in her pussy\"\nself.send('MSG',message['channel'],msg)\nelsif message['message'].downcase =~ /^!deepthroat (.*)?/i\nmsglist = message['message'].split(/deepthroat (.*)?/i)\nmsg = message['character'] + \" tears off his pants and grabs \" + msglist[1] + \" asking him/her to suck his penis.\"\nself.send('MSG',message['channel'],msg)\n elsif message['message'].downcase =~ /^!deal/\n msg = message['character'] + \": \" + @deck.draw()\n self.send('MSG',message['channel'],msg)\n sleep(1)\n elsif message['message'].downcase =~ /^!kissme/\n msg = \"/me grabs \" + message['character'] + \" and pulls \" +message['character'] + \" into a deep kiss\"\n self.send('MSG',message['channel'],msg)\n elsif message['message'].downcase =~ /^!draw1/\n msg = message['character'] + \": \" + @deck.draw1()\n self.send('MSG',message['channel'],msg)\n elsif message['message'].downcase =~ /^!draw2/\n msg = message['character'] + \": \" + @deck.draw2()\n self.send('MSG',message['channel'],msg)\n elsif message['message'].downcase =~ /^!draw3/\n msg = message['character'] + \": \" + @deck.draw3()\n self.send('MSG',message['channel'],msg)\n elsif message['message'].downcase =~ /^!rules/\n msg = \"For drawing purposes- !deal\n \n Try to use your grammar and literacy. No kik su-n-us or ur turn.\n \n Have fun! This is a game meant to have fun! So try to show your teasing side a bit, okay? Unless you don't have fun doing that. Then... just show us something!\n \n Also, please be courteous and if your intentions are more than just teasing or flirting, take it to another room so as to not interrupt the flow of the game too much!\n \n Rule 1) Five pieces of clothing at a minimum. There is no SET maximum, but it's recommended not to go over eight pieces. One accessory is allowed per person.\n \n Rule 2) Once the dealer calls the winning hand (PLEASE refrain from calling it before the dealer! Help is appreciated in PMs, but it's confusing on occasion when someone other than the dealer calls the hands!) the person who wins picks one person to remove one piece of clothing.\n \n Rule 3) If it is the last piece of the person called, the one who called it removes it themselves. The naked person is then removed from play, to either sit on the lap of the person who called them.\n \n Rule 4) The game continues until one person is left clothed. Good luck, and have fun.\n -------------\n Other commands\n --------------\n --------------\n !mms-softly fire m&ms randomly\n !rules-Displays this message.\n !draw1-Draws 1 card.\n !draw2-Draws 2 cards.\n !draw3-Draws 3 cards.\"\n self.send('MSG',message['channel'],msg)\n elsif message['message'].downcase =~ /^!desc/\n msg = \"Welcome to Ygvarland! Where the lolis are willing, or perhaps 'not'for those forcing types, and the pervy pulsing phalluses are always able and at attention! Not into Loli's? That's okay, there's usually plenty of grown girls as well. However, don't force yourself on to the unwilling.\n\nCome on in, make yourself at home, the rules are quite simple:\n\nBe respectful (unless of course it's part of the kinky fun, hehe. This includes: not criticizing literacy, gender, race, species, orientation or kinks, and definitely no forcing beliefs on others.) \nNo means no, unless it doesn't mean no, in which case you'll ...know...\nIf you're a naughty star or starlet please feel free to show off your skills in the main room, we love exhibitionists here!\nPrivate fun is of course also acceptable, though the public play is always ALWAYS welcome so all can share in the fun.\n\nOther than these guidelines have fun, this is a free range arena and anything else goes, however if someone does end up having a problem with it, please respect that if it is a shared feeling by others. We don't want to chase anyone off, do we?\n\nAbove all else we just want you to have fun and get naughty... so bring your friends, your family, your slaves, pets, masters, and don't forget the whips, chains, swings, and toys! (if you're into that sort of stuff)\n\nYgvarland: Where anything can happen and your fantasies might just become a little more of reality.\n\nOwner: [user]Lotte_Ygvar[/user] Lotte\n\nMods: [user]Dadson Brothers[/user] Dadson [user]Fang Swiftwing[/user] Fang [user]SSS[/user] SSS [user]Ezomori Nozomu[/user] Nozomu\n\nWorkers: [user]Minamoto_Chizuru[/user] Chizuru\"\nself.send('MSG',message['channel'],msg)\nelsif message['message'].downcase =~ /^!fuckme/\nmsg = \"/me grabs \" + message['character'] + \" and tears off her pants(or)skirt and panties, sliding my dick in her pussy\"\nself.send('MSG',message['channel'],msg)\n# Fix\nelsif message['message'].downcase =~ /^!kiss (.*)?/i\nmsglist = message['message'].split(/kiss (.*)?/i)\n msg = message['character'] + \" grabs \" + msglist[1] + \" and pulls \" + msglist[1] + \" into a deep kiss\"\n self.send('MSG',message['channel'],msg)\nelsif message['message'].downcase =~ /^!mms (.*)?/i\nmsglist = message['message'].split(/mms (.*)?/i)\nmsg = \"/me turns into a giant M&M cannon and launches a giant M&M at \" + msglist[1] + \" knocking \" + msglist[1] + \" out and covering \" + msglist[1] + \" in chocolate!\"\nself.send('MSG',message['channel'],msg)\nend\n end", "title": "" }, { "docid": "58f9422412478bcc01d6bf89803443c4", "score": "0.6376843", "text": "def handle_message(message)\n\n sender = \"\"\n time_stamp = nil\n\n err_msg = \"\"\n err_trc = \"\"\n err_snd = false\n\n # Check if all needed variables are in the message, and send it to the processing function\n begin\n\n requested_command = ''\n\n @dbaccess.write_to_log(2,message.to_s)\n\n sender = (message.has_key? 'fromUuid' ) ? message['fromUuid'] : ''\n @dbaccess.write_to_log(2,\"sender #{sender}\")\n\n if message.has_key? 'payload'\n @message = message['payload']\n if @message.has_key? 'message_type'\n requested_command = message['payload'][\"message_type\"].to_s.downcase\n @dbaccess.write_to_log(2,\"message_type = #{requested_command}\")\n else\n @dbaccess.write_to_log(2,'message has no message type')\n\n time_stamp = (message['payload'].has_key? 'time_stamp') ? message['payload']['time_stamp'] : nil\n @dbaccess.write_to_log(2,\"time stamp = #{time_stamp}\")\n\n if sender != ''\n send_error(sender, '', 'unknown message type')\n end\n end\n else\n @dbaccess.write_to_log(2,'message has no payload')\n if sender != ''\n send_error(sender, '', 'message has no payload')\n end\n end\n\n if whitelist.include?(requested_command)\n self.send(requested_command, message)\n else\n @dbaccess.write_to_log(2,'message type not in white list')\n send_error(sender, time_stamp, 'message type not in white list')\n end\n rescue Exception => e\n err_snd = true\n err_msg = e.message\n err_trc = e.backtrace.inspect\n end\n\n # in case of an error, send error message as a reply\n begin\n if err_snd == true\n if sender != \"\"\n send_error(sender, time_stamp, \" #{err_msg} @ #{err_trc}\")\n @dbaccess.write_to_log(2,'Error in message handler.\\nError #{err_msg} @ #{err_trc}')\n end\n end\n rescue Exception => e\n puts 'Error while sending error message: #{e.message}'\n end\n\n end", "title": "" }, { "docid": "5056ab34aeea8515500a2ac878abc0b0", "score": "0.6369537", "text": "def onmessage(data)\n message = Chat::Message.new(@chat, self, { :type => :text, :text => data.encode(\"UTF-8\"), :user => @user })\n message.execute! if message.executable?\n\n if message.public?\n @room.push(message.to_json)\n else\n @socket.send(message.to_json)\n end\n end", "title": "" }, { "docid": "4b69776d24c508dd461c7014ebede186", "score": "0.63538134", "text": "def process_msg( sender, msg )\n @clients.each do |user, io|\n if io.closed?\n client_left( user )\n next\n end\n next if sender == user\n io.puts( \"#{sender} >> #{msg}\")\n end\n end", "title": "" }, { "docid": "183bdb289ff0db2b27217ac039b46238", "score": "0.6344367", "text": "def create\n if User.find_by_username(params[:message][:to]) != nil && User.find_by_username(params[:message][:to]) != current_user\n @to = User.find_by_username(params[:message][:to])\n @body = params[:message][:body]\n if !current_user.messages.are_to(@to).blank?\n @old_message = current_user.messages.are_to(@to).last\n @message = current_user.reply_to(@old_message, @body)\n if (@message.errors.blank?)\n Pusher['private-'+@to.id.to_s].trigger('reply_message', {conversation: @message.conversation.order(\"created_at\").last.body.truncate(30, separator: ' '), \n message_id: @message.id.to_s, from: current_user.username, to: @message.to.username, message_body: @message.body, message_time: @message.created_at.strftime(\"%H:%M\")})\n Pusher['private-'+@to.id.to_s].trigger('message_notification', {conversation: @message.conversation.order(\"created_at\").last.body.truncate(30, separator: ' '), \n from: current_user.username, total_message_count: @to.messages.are_to(@to).unreaded.count, message_count: @to.messages.are_from(current_user).unreaded.count})\n end\n redirect_to chat_message_path(@old_message)\n elsif !current_user.messages.are_from(@to).blank?\n @old_message = current_user.messages.are_from(@to).last\n @message = current_user.reply_to(@old_message, @body)\n if (@message.errors.blank?)\n Pusher['private-'+@to.id.to_s].trigger('reply_message', {conversation: @message.conversation.order(\"created_at\").last.body.truncate(30, separator: ' '), \n message_id: @message.id.to_s, from: current_user.username, to: @message.to.username, message_body: @message.body, message_time: @message.created_at.strftime(\"%H:%M\")})\n Pusher['private-'+@to.id.to_s].trigger('message_notification', {conversation: @message.conversation.order(\"created_at\").last.body.truncate(30, separator: ' '), \n from: current_user.username, total_message_count: @to.messages.are_to(@to).unreaded.count, message_count: @to.messages.are_from(current_user).unreaded.count})\n end\n redirect_to chat_message_path(@old_message)\n elsif !@to.messages.are_from(current_user).blank?\n @old_message = @to.messages.are_from(current_user).last\n @message = current_user.reply_to(@old_message, @body)\n if (@message.errors.blank?)\n Pusher['private-'+@to.id.to_s].trigger('reply_message', {conversation: @message.conversation.order(\"created_at\").last.body.truncate(30, separator: ' '), \n message_id: @message.id.to_s, from: current_user.username, to: @message.to.username, message_body: @message.body, message_time: @message.created_at.strftime(\"%H:%M\")})\n Pusher['private-'+@to.id.to_s].trigger('message_notification', {conversation: @message.conversation.order(\"created_at\").last.body.truncate(30, separator: ' '), \n from: current_user.username, total_message_count: @to.messages.are_to(@to).unreaded.count, message_count: @to.messages.are_from(current_user).unreaded.count})\n end\n redirect_to chat_message_path(@message)\n else\n @message = current_user.send_message(@to, @body)\n if (@message.errors.blank?)\n flash[:success] = \"Message sent\"\n Pusher['private-'+@to.id.to_s].trigger('new_message', {from: current_user.username})\n Pusher['private-'+@to.id.to_s].trigger('message_notification', {conversation: @message.conversation.order(\"created_at\").last.body.truncate(30, separator: ' '), \n from: current_user.username, total_message_count: @to.messages.are_to(@to).unreaded.count, message_count: @to.messages.are_from(current_user).unreaded.count})\n redirect_to messages_path\n else\n flash[:error] = \"Message not sent\"\n redirect_to new_message_path\n end\n end\n elsif User.find_by_username(params[:message][:to]) == current_user\n flash.now[:error] = \"Can't message yourself\"\n render 'new'\n else\n flash.now[:error] = \"User not found\"\n render 'new'\n end\n end", "title": "" }, { "docid": "56dd28f377df7a5d2ffb8f76cfe0100b", "score": "0.63387537", "text": "def message(msg)\n # puts \"SENDING MESSAGE: #{msg} #{msg.to_s.length}\"\n # raise \"Message over 512 characters\" if msg.to_s.length MAX_MESSAGE_SIZE \n \n # Splits the message, presuming that the final parameter is going to be\n # the longest one (in the case of most messages, this is true)\n if msg.to_s.length > MAX_MESSAGE_SIZE \n log.debug \"Message is too long\"\n m = Message.new(msg)\n prefix_length = m.to_s.length - m.params[-1].to_s.length\n \n raise \"Message prefix too long\" if prefix_length > (MAX_MESSAGE_SIZE - 10) # max irc message length, with a bit of space for actual content\n \n log.debug \"Splitting message...\"\n payload = m.params[-1]\n count = 0\n while(payload.to_s.length > 0 and count < MAX_MESSAGE_CHUNKS)\n # take a copy of the message\n new_msg = m.dup\n cutoff = MAX_MESSAGE_SIZE - prefix_length - ELLIPSIS.length\n\n # change its payload\n new_msg.params[-1] = payload[0.. (cutoff) ] + \"#{(payload.length > cutoff) ? ELLIPSIS : ''}\"\n\n # remove the first n chars from the payload\n payload = payload[(cutoff + 1)..-1]\n\n # add to the list\n @queue << new_msg.to_s\n\n log.debug \"---> '#{payload}' remaining\"\n end\n\n # puts \"--> #{m}, #{m.to_s.length}\"\n else\n @queue << msg\n end\n end", "title": "" }, { "docid": "688ff4da504d06f95e5c0ec1539d71eb", "score": "0.6327321", "text": "def processMessage(message)\n puts \"Received message from #{message.from}: #{message.body}\"\n\n # grab the first word of the incoming message in lower case, removing the first \\ if present\n com = message.body.split(\" \",2)[0].downcase.sub(/^\\//,'')\n \n # request for help (ie the command list)\n if (com.eql?(\"commands\") || com.eql?(\"help\")) then\n @loaded.each { |mod|\n @im.deliver(message.from, mod.name)\n mod.commands.each { |command, desc|\n response = \"#{command.upcase} - #{desc}\"\n @im.deliver(message.from, response)\n }\n }\n return\n else\n # request to one of the modules\n @loaded.each { |mod|\n # hunt through the command list, looking for a match\n mod.commands.each_key { |command|\n if (com.eql?(command.downcase)) then\n # send command to module in lower case removing the leading / if present\n request = message.body.downcase.sub(/^\\//,'')\n answer, recipients = mod.doCommand(request, message.from.to_s)\n \n # if no recipient specified, default to the person who sent the message\n if (recipients == nil) then\n recipients = [message.from]\n end\n\n if (answer != nil) then\n # if there is an answer, broadcast it to each user line by line\n recipients.each { |recipient|\n answer.each { |line|\n @im.deliver(recipient, line)\n }\n }\n end\n return\n end\n }\n }\n end\n # if all else fails, echo back\n @im.deliver(message.from, message.body)\nend", "title": "" }, { "docid": "9191352604a60da2b35ab6c9a6deaab7", "score": "0.6320491", "text": "def privmsg(msg)\n\n # convert twitter urls to tweets\n if msg =~ %r(^https://twitter.com/(\\w+)/status/(\\d+)$)\n room.tweet(msg) { } # async, no-op callback\n else\n # convert ACTIONs\n msg.sub! /^\\01ACTION (.*)\\01$/, '*\\1*'\n\n users.values.each do |user|\n msg.sub!(/\\b#{user.nick}\\b/, user.name)\n end\n\n room.text(msg) { } # async, no-op callback\n end\n\n end", "title": "" }, { "docid": "676d5851f7f359ce6eb2187345065523", "score": "0.6320422", "text": "def sendChatMessage(a_to, a_text)\n# \t\tp 'JabberClient.sendChatMessage'\n\t\tsendMessage(a_to,a_text,:chat)\n\tend", "title": "" }, { "docid": "50b1f5469165e8926e6df994fd282c5b", "score": "0.6318095", "text": "def process_messages\n count = nil\n @server.message_handler.clear_last_msg!\n try{ @maxl.get_messages }.each do |msg|\n msg =~ /(\\w+) - (\\d+) - (.+)/\n level, msg_num, msg_text = $1, $2.to_i, $3\n msg_lvl = case level\n when /info/i then MessageHandler::MSG_LVL_INFO\n when /warn/i then MessageHandler::MSG_LVL_WARN\n when /error/i then MessageHandler::MSG_LVL_ERROR\n when /fatal/i then MessageHandler::MSG_LVL_FATAL\n when /debug/i then MessageHandler::MSG_LVL_DEBUG\n end\n @server.message_handler.process_message(msg_num, msg_lvl, msg_text)\n count = (/Records returned: \\[(\\d+)\\]/.match(msg_text)[1].to_i) if msg_num == 1241044\n end\n count\n end", "title": "" }, { "docid": "1a942a8d4afa68a66bbd5af15ec62ec7", "score": "0.63068855", "text": "def loop()\n\tline = @socket.gets\n line = line.strip\n\t\t \n # Grab the nick of the @userposting\n @userposting = line[/^:([\\|\\.\\-0-9a-zA-Z]*)!/, 1]\n\tif line.match(/^:.*\\ PRIVMSG\\ #{@nick}\\ \\:.*/)\n @chan = @userposting\n\telse\n\t\t@chan = line[/\\ (#[\\|\\.\\-0-9a-zA-Z]*)\\ :/, 1]\n\tend\n\t\n # Ignore unifiedbot\n if @userposting.eql?(\"unifiedbot\")\n return\n\tend\n\n # Add the user to the users table if they do not exist\n if !@userposting.blank?\n if Users.where(user: @userposting).blank?\n new_user = Users.create(user: @userposting)\n new_user.save\n end\t\n end\n\n\tif line.match(/.*\\:#{@nick}[\\,\\:\\ ]+.*/) then\n\t\tparams = line[/.*\\:#{@nick}[\\,\\:\\ ]+(.*)/, 1]\n\t\tcase\n\t\twhen params.match(/^join\\ \\#[\\-\\_\\.\\'0-9a-zA-Z]+/)\n\t\t\tchannel_to_join = params[/^join\\ (\\#[\\-\\_\\.\\'0-9a-zA-Z]+)/, 1]\n\t\t\tjoin_chan(channel_to_join)\n\t\twhen params.match(/^leave/)\n\t \tif @chan == @userposting\n\t\t\t sendchn(\"Say it in the channel you want me to leave.\")\n\t\t else\n\t\t\t\t\tleave_chan(@chan)\n\t\t\tend\n\t\twhen params.match(/^[\\-\\_\\.\\'\\.0-9a-zA-Z]*\\ is\\ .*/)\n\t\t\tword_to_define = params[/([\\-\\_\\.\\'0-9a-zA-Z]*)\\ is/, 1]\n\t\t\tdefinition = params[/[\\-\\_\\ \\.\\'0-9a-zA-Z]*\\ is\\ (.*)/, 1]\n\t\t\tadd_definition(word_to_define, definition, @userposting)\n\t\twhen params.match(/^[\\-\\_\\.0-9a-zA-Z]*\\?/)\n\t\t\tif !Definitions.count.zero?\n word_to_echo_def = params[/([\\-\\_\\.0-9a-zA-Z]*)?/, 1]\n\t\t\t echo_definition_by_word(word_to_echo_def)\n end\n\t\twhen params.match(/^forget\\ [\\-\\_\\ 0-9a-zA-Z]*/)\n\t\t\tword_to_forget = params[/forget\\ ([\\-\\_\\ 0-9a-zA-Z]*)/, 1]\n\t\t\tforget_definition(word_to_forget)\n\t\twhen params.match(/^addquote.*/)\n\t\t\tuser_to_quote = line[/addquote\\ ([0-9a-zA-Z\\-\\_\\.\\|]+)\\ .*/, 1]\n\t\t\tnew_quote = line[/addquote\\ [0-9a-zA-Z\\-\\_\\.\\|]+\\ (.*)/, 1]\n\t\t\taddquote(@userposting, user_to_quote, new_quote)\t\t\t\t\n\t\twhen params.match(/^quote.*/)\n if params.match(/quote\\ [0-9]+$/)\n\t \t echo_quote_by_id(params[/quote\\ (.*)/, 1])\n elsif params.match(/quote\\ [a-zA-Z0-9\\.\\_\\-\\|]+/)\n echo_quote_by_user(params[/quote\\ (.*)/, 1])\n else\n echo_random_quote(@chan) \n\t\t end\n\t\twhen params.match(/^rank.*/)\n\t\t\tif params.eql?(\"rank\")\n\t\t\t\trank(\"all\")\n\t\t\telsif params.match(\"rank\\ [a-zA-Z0-9\\.\\-\\_\\|]+\")\n\t\t\t\tuser_to_rank = params[/rank\\ (.*)/, 1]\n\t\t\t\trank(user_to_rank)\n\t\t\tend\n\t\twhen params.eql?(\"time\")\n\t\t\ttime = Time.new\n\t\t\ttimenow = time.inspect\n\t\t\tsendchn(\"The current time is #{timenow}\")\n\t\twhen params.eql?(\"weather\")\n\t\t\t# Yahoo Weather Variables\n yahoo_url = 'http://query.yahooapis.com/v1/public/yql?format=json&q='\n query = \"SELECT * FROM weather.forecast WHERE location = 27606\"\n url = URI.encode(yahoo_url + query)\n # Pull and parse data\n weather_data = JSON.parse(open(url).read)\n weather_results = weather_data[\"query\"][\"results\"][\"channel\"]\n sendchn(\"------------------Weather For 27606---------------\")\n\t\t\tsendchn(\"Current conditions: #{weather_results[\"wind\"][\"chill\"]} degrees and #{weather_results[\"item\"][\"forecast\"][0][\"text\"]}\")\n sendchn(\"Windspeed: #{weather_results[\"wind\"][\"speed\"]}mph\")\n sendchn(\"High: #{weather_results[\"item\"][\"forecast\"][0][\"high\"]} degrees\")\n sendchn(\"Low: #{weather_results[\"item\"][\"forecast\"][0][\"low\"]} degrees\")\n sendchn(\"-----------------------------------------------------------\")\n\t\t\t\n\t\t\twhen params.match(/^help.*/)\n case \n when params.eql?(\"help\")\n sendchn(\"#{@nick}: help [command]\")\n\t\t\t\t\tsendchn(\"#{@nick}: <noun> is <definition>\")\n\t\t\t\t\tsendchn(\"#{@nick}: <noun>?\")\n sendchn(\"#{@nick}: addquote <name> <quote WITHOUT \\\"\\\">\")\n sendchn(\"#{@nick}: quote [name]\")\n sendchn(\"<name>++\")\n sendchn(\"<name>--\")\n\t\t\t\t\tsendchn(\"#{@nick} rank\")\n\t\t\t\t\tsendchn(\"#{@nick} rank <name>\")\n sendchn(\"#{@nick}: time\")\n sendchn(\"#{@nick}: weather\")\n\t\t\t\t\tsendchn(\"#{@nick}: leave\")\n\t\t\t\t\tsendchn(\"#{@nick}: join <#channel>\") \n when params.eql?(\"help addquote\")\n sendchn(\"Usage: #{@nick}: addquote <name> <quote WITHOUT \\\"\\\">\")\n sendchn(\"Adds a quote to the quote database\")\n sendchn(\"Quotes can be recalled with #{@nick}: quote [name]\") when params.eql?(\"help quote\")\n sendchn(\"Usage: #{@nick}: quote [name]\")\n sendchn(\"Returns a quote from the quote database\")\n sendchn(\"If no name is supplied, a random quote will be returned\") when params.eql?(\"help time\")\n sendchn(\"I don't know why you want help with this one #{@userposting}...\")\n sendchn(\"It was more of a way to test getting the time\")\n sendchn(\"Eventually, the time will be used for other commands\") when params.eql?(\"help weather\")\n sendchn(\"PLACEHOLDER\") \n end\n\t\t\tend\n\t\telse\n puts line\n\t\t\tcase\n\t\t\t# This one is super important\n\t\t\t# It makes sure swagbot doesn't get disconnected\n\t\t\twhen line.match(/^PING :(.*)$/)\n\t\t\t\tsend \"PONG #{$~[1]}\"\n\n\t\t\t# Accept invites to channels\n\t\t\twhen line.match(/\\ INVITE #{@nick}\\ \\:\\#.*/)\n\t\t\t\tinvited_channel = line[/#{@nick}\\ \\:(\\#.*)/, 1]\n\t\t\t\tjoin_chan(invited_channel)\n\t\t\t\tsendchn(\"I was invited here by #{@userposting}. If I am not welcome type \\\"#{@nick} leave\\\"\")\n\t\t\t\n\t\t\t# Karma assignments\n\t\t\twhen line.match(/^.*[\\-\\.\\'\\.\\|0-9a-zA-Z]+[\\+\\-]{2}.*/)\n\t\t\t\tif @chan != @userposting\n\t\t\t\t\tline.split.each do |x| \n\t\t\t\t\t\tif x.match(/[\\-\\.\\'\\.\\|0-9a-zA-Z]+\\+\\+/)\n\t\t\t\t\t\t\tuser = x[/([\\-\\.\\'\\.\\|0-9a-zA-Z]*)\\+\\+/, 1]\n\t\t\t\t\t\t\tif user == @userposting\n\t\t\t\t\t\t\t\tsendchn(\"Lol, yeah right.\")\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\teditkarma(@userposting, user, \"add\")\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\t\tif x.match(/[\\-\\.\\'\\.\\|0-9a-zA-Z]+\\-\\-/)\n\t\t\t\t\t\t\tuser = x[/([\\-\\.\\'\\.\\|0-9a-zA-Z]*)\\-\\-/, 1]\n\t\t\t\t\t\t\tif user == @userposting\n\t\t\t\t\t\t\t\tsendchn(\"#{@userposting}, you okay? I'm not going to let you subtract karma from yourself.\")\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\teditkarma(@userposting, user, \"subtract\")\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\tsendchn(\"Karma can only be assigned in a channel\")\n\t\t\t\tend\n when line.match(/.*\\:[\\-\\.\\'\\.\\|0-9a-zA-Z]+\\?$/)\n word_to_echo_def = line[/([\\-\\_\\.0-9a-zA-Z]*)\\?/, 1]\n echo_definition_by_word(word_to_echo_def)\n\n when line.match(/.*#{@nick}\\ \\:\\!op$/)\n send(\"MODE #{@chan} +o #{@userposting}\") \n \n when line.match(/.*http[s]*:\\/\\/[w\\.]*bugzilla\\.redhat\\.com\\/show_bug.cgi\\?id=[a-zA-Z0-9]+[\\ ]*/)\n url = line[/.*(http[s]*:\\/\\/[w\\.]*bugzilla\\.redhat\\.com\\/show_bug.cgi\\?id=[a-zA-Z0-9]+)[\\ ]*/, 1]\n bugzilla(url)\n\n when line.match(/.*http[s]*:\\/\\/[w\\.]*youtube.com\\/watch.*/)\n url = line[/.*(http[s]*:\\/\\/[w\\.]*youtube.com\\/watch\\?v=[a-zA-Z0-9\\-\\_]+)[\\ ]*/, 1]\n youtube(url)\n \n when line.match(/.*http[s]*:\\/\\/[i\\.]*imgur.com\\/gallery\\/.*/)\n url = line[/.*(http[s]*:\\/\\/[i\\.]*imgur.com\\/gallery\\/[a-zA-Z0-9\\-\\_]+).*/, 1]\n imgur(url)\n\n when line.match(/.*http[s]*:\\/\\/[i\\.]*imgur.com\\/.*/)\n url = line[/.*(http[s]*:\\/\\/[i\\.]*imgur.com\\/[a-zA-Z0-9\\-\\_]+).*/, 1]\n imgur(url)\n when line.match(/.*\\!http\\ [1-5]{1}[0-9]{2}/)\n url = line[/.*\\!http\\ ([1-5]{1}[0-9]{2})/, 1]\n sendchn(\"http://httpstatusdogs.com/\" + url)\n\t\t\tend\n\tend\n\treturn nil\nend", "title": "" }, { "docid": "c0aaff8fdc8463d4e480d30d88874418", "score": "0.62885255", "text": "def process\n\n #see if it is a command text first\n if message[:message][:entities] != nil\n if message[:message][:entities][0][:type] == \"bot_command\"\n text = message[:message][:text]\n if text.start_with?('/rut')\n require 'chilean_rut'\n text.slice!('/rut')\n text.gsub(/\\s+/, \"\")\n text.insert(text.length-1,\"-\")\n rut = text.strip\n if RUT::validate(rut)\n #next message and save rut\n user.user_info = user.user_info.merge(rut: rut)\n user.save\n command = BotCommand::GoodRut.new(user, message)\n command.start\n else\n #not valid rut message\n command = BotCommand::BadRut.new(user, message)\n command.start\n end\n elsif text.start_with?('/cuenta')\n command = BotCommand::GetDebt.new(user, message)\n command.start\n elsif text.start_with?('/email')\n user.user_info = user.user_info.merge(email_text: text)\n user.save\n command = BotCommand::SomeMessage.new(user, \"Listo, guardé tu correo, te avisaré cuando esté listo.\")\n command.start\n end\n end\n else\n min_attributes = false\n if user.user_info[\"rut\"] != nil\n min_attributes = true\n end\n #if not min_attributes ask user for rut and phone\n if !min_attributes\n start_command = BotCommand::Start.new(user, message)\n start_command.start\n else\n command = BotCommand::GetDebt.new(user, message)\n command.start\n end\n #if user has all his minimum attributes (rut and phone) it should pass to process message\n \n end\n\n \n \n\n # if user.get_next_bot_command\n # bot_command = user.get_next_bot_command.safe_constantize.new(user, message)\n\n # if bot_command.should_start?\n # bot_command.start\n # else\n # unknown_command\n # end\n # else\n # start_command = BotCommand::Start.new(user, message)\n\n # if start_command.should_start?\n # start_command.start\n # else\n # unknown_command\n # end\n # end\n end", "title": "" }, { "docid": "82e58b7733cadffa7ce5153d5d0b8bda", "score": "0.6283878", "text": "def handle_message(message)\n\n #puts \"> message received at #{Time.now}\"\n #puts message\n\n $info_last_msg_received = Time.now\n $info_nr_msg_received += 1\n\n if message.class.to_s == 'Hash'\n #@message_handler.handle_message(message)\n MessageQueue.current.push message\n end\n\n if message.class.to_s == 'String'\n #message_hash = JSON.parse(message)\n #@message_handler.handle_message(message_hash)\n MessageQueue.current.push message\n end\n\n rescue\n raise \"Runtime error while attempting to parse message: #{message}.\"\n end", "title": "" }, { "docid": "17298ef13d20b3e4153964a2252a32e2", "score": "0.6280833", "text": "def on_bot_text(room, mes)\n end", "title": "" }, { "docid": "46378e75e56869627693508d9ec97b67", "score": "0.6279563", "text": "def receive_message\n\t if params[:entry]\n\t messaging_events = params[:entry][0][:messaging]\n messaging_events.each do |event|\n sender = event[:sender][:id]\n \tif event[:message] != nil\n \t\tfind_reply(sender, event[:message][:text])\n \telsif event[:postback] != nil\n \t\t#Do a case statement here\n \t\tif event[:postback][:payload] == \"test\"\n \t\t\tsend_post_message(sender, \"Postback Message received, Yes\")\n \t\telsif event[:postback][:payload] == \"EXTERMINATE\"\n \t\t\tsend_post_message(sender, \"Postback Message received, No\")\n \t\tend\n \tend \n \t end\n\t end\n\t render nothing: true\n\tend", "title": "" }, { "docid": "58823f536f87d2dbdd11888e13d8f138", "score": "0.62789303", "text": "def handle(message)\n end", "title": "" }, { "docid": "bc64d4fc387efb62dd1fd35494a0acad", "score": "0.627599", "text": "def incoming_message(e)\n # We don't respond to \"private\" messages\n return if e.pm?\n\n text = e.message\n\n # Check all the various conditions for responding to the message and including the message\n is_it_loud?(text) do |status, reason|\n case status\n when :bad\n @irc.log.debug \"Ignoring message: #{reason}\"\n return\n\n when :rejected\n random_message(e.channel)\n @irc.log.debug \"Rejecting message: #{reason}\"\n\n when :loud\n @irc.log.debug \"IT WAS LOUD! #{text.inspect}\"\n random_message(e.channel)\n @messages.add(:text => text, :author => @message.nick)\n end\n end\nend", "title": "" }, { "docid": "c5dbf4930a6b14e1e0190b9e524271bb", "score": "0.6268586", "text": "def chat_message(message)\n r = Skype.send_ :command => \"chatmessage #{@chat_id} #{message}\"\n raise SkypeError(\"Error occurred on chat_message: #{r.message}\") if r =~ /ERROR/\n r\n end", "title": "" }, { "docid": "a2ad8195ed7797dfe888c0e1d46e5f0a", "score": "0.62683064", "text": "def parseMessage input\n\t\taction = input.split[1]\n\t\tnickname = input.split(':')[1].split('!')[0]\n\t\tmsg\t= ''\n\t\tunless input.split(' :').nil?\n\t\t\tpayload = input.slice(input.split(' :')[0].length + 2, input.length - input.split(' :')[0].length + 2)\n\t\tend\n\n\t\tcase input.split[1]\n\t\twhen 'PRIVMSG'\n\t\t\tif input.split[2] == @channel then\n\t\t\t\tif payload.start_with?([\"\\x01\"][0]+'ACTION') then\n\t\t\t\t\tmsg += '* ' + nickname + payload.delete([\"\\x01\"][0]).delete([\"\\x01\"][0]+'ACTION')\n\t\t\t\telse\n\t\t\t\t\tif payload.start_with?(\"!\") then\n\t\t\t\t\t\tmsg = handleCommand payload, nickname\n\t\t\t\t\tend\n\t\t\t\t\tmsg += '<'+nickname+'> ' + payload\n\t\t\t\tend\n\t\t\telsif input.split[2] == @nickname then\n\t\t#\t\thandleCommand input\n\t\t\tend\n\t\twhen 'TOPIC'\n\t\t\tmsg += \"! \" + nickname + \" has changed the topic: \" + payload\n\t\twhen 'JOIN'\n\t\t\tmsg += \"! \" + nickname + \" has joined.\"\n\t\twhen 'PART'\n\t\t\tmsg += \"! \" + nickname + \" has left the channel.\"\n\t\t\tmsg += \" (\" + payload + \")\" unless payload.nil? or payload.empty?\n\t\twhen 'QUIT'\n\t\t\tmsg += \"! \" + nickname + \" has quit.\"\n\t\t\tmsg += \" (\" + payload + \")\" unless payload.empty?\n\t\twhen 'KICK'\n\t\t\tmsg += \"! \" + input.split[3] + ' got kicked by ' + nickname\n\t\t\tmsg += \" (\" + payload + \")\" unless payload.empty?\n\t\twhen 'NICK'\n\t\t\tmsg += \"! \" + nickname + \" is now known as \" + payload\n\t\twhen '353' ## NAMES List\n\t\t\tmsg += \"! Users in channel: \" + payload.split.sort.join(' ')\n\t\tend\n\t\t\n\t\tunless msg.empty?\n\t\t\tmsg = \"[\"+(\"%02d\"%Time.now.hour)+\":\"+(\"%02d\"%Time.now.min)+\":\"+(\"%02d\"%Time.now.sec)+\"] \"+msg\n\t\t\tp msg if DEBUG\n\t\t\treturn msg\n\t\tend\n\tend", "title": "" }, { "docid": "7ee28f3c1b4b89885379cba5a3740f8c", "score": "0.62609917", "text": "def handle_message m\n @logger.info \"Get a messsage #{m.message_id}, received at #{Time.now}\"\n @logger.info \"Object body: #{m.body}\"\n json = JSON.parse(m.body)\n action = json['message'].downcase\n if json['timestamp']\n @logger.info \"Message was sent at #{json['timestamp']}\"\n end\n if action == 'unfreeze'\n @logger.info \"Launching a command\"\n system(Settings.exec_command)\n @logger.info \"Command execution code: #{$?}\"\n end\n rescue StandardError => e\n log_exception \"Non-fatal error parsing a message\", e\n end", "title": "" }, { "docid": "a8e7b677a2e8a149aeff9a4ee3869770", "score": "0.6248312", "text": "def on_message(env, msg)\n log(\"received\", msg)\n\n from_email, *rest = msg.split(\"#!#\").last.split('#')\n to_email = rest.first\n\n if (to_email == 'broadcast')\n @clients.each do |client|\n if client != self.connection\n client.send_data(msg.split(\"#!#\").last)\n end\n end\n else\n destination_client = Client.find(:last, :conditions => ['client_email = ?', to_email])\n puts destination_client.client_id\n self.connection.application.connections[destination_client.client_id].send_data(msg.split(\"#!#\").last)\n end\n if (msg.split(\"#!#\").first == 'sajith123')\n begin\n current_client = Client.find(:first, :conditions => ['client_id = ?', self.connection.id])\n current_client.client_email = msg.split(\"#!#\").last.split('#').first.gsub(\"\\\"\", \"\")\n current_client.save\n rescue => e\n print e.message\n end\n end\n \n \n Message.new(@connection, msg).dispath\n end", "title": "" }, { "docid": "152514c64698ec3b0d1a857f049d8605", "score": "0.6248042", "text": "def process_queue\n @starling = Starling.new('127.0.0.1:11211')\n th = Thread.new do\n Thread.current.abort_on_exception = true\n loop do\n item = @starling.get('listener')\n unless item.nil?\n jitem = JSON.parse(item) rescue nil\n msg = Message::new(jitem[\"from\"])\n msg.type=:chat\n if jitem[\"success\"] == true\n msg.body = \"\\n\"\n msg.body += jitem[\"message\"] + \"\\n\"\n msg.body += \"Current temp: #{jitem[\"details\"][\"current_temperature\"]}\\n\"\n msg.body += \"Winds: #{jitem[\"details\"][\"winds\"]}\\n\\n\"\n msg.body += \"<b>TODAY</b>\\n\"\n msg.body += jitem[\"details\"][\"today\"][\"condition\"] + \"\\n\"\n msg.body += \"Min/Max : #{jitem[\"details\"][\"today\"][\"low_f\"]} / \"\n msg.body += jitem[\"details\"][\"today\"][\"high_f\"] + \" (\"\n msg.body += jitem[\"details\"][\"today\"][\"low_c\"] + \" / \"\n msg.body += jitem[\"details\"][\"today\"][\"high_c\"] + \") \\n\\n\"\n\n msg.body += \"<b>TOMORROW</b>\\n\"\n msg.body += jitem[\"details\"][\"tomorrow\"][\"condition\"] + \"\\n\"\n msg.body += \"Min/Max : #{jitem[\"details\"][\"tomorrow\"][\"low_f\"]} /\"\n msg.body += jitem[\"details\"][\"tomorrow\"][\"high_f\"] + \" (\"\n msg.body += jitem[\"details\"][\"tomorrow\"][\"low_c\"] + \" / \"\n msg.body += jitem[\"details\"][\"tomorrow\"][\"high_c\"] + \") \\n\"\n\n msg.add_element(prepare_html(msg.body))\n msg.body = msg.body.gsub(/<.*?>/, '')\n else\n msg.body = jitem[\"message\"]\n end\n @client.send(msg)\n\n end\n end\n end\n end", "title": "" }, { "docid": "d355ec910da12f738ec32b4fb5cb28f2", "score": "0.62406605", "text": "def process_messages\n trace \"Processing Messages\"\n @running = true\n while @running\n begin\n message = @io.gets\n if message and !message.class.to_s.index(\"Worker\").nil?\n trace \"Received message from worker\"\n trace \"\\t#{message.inspect}\"\n message.handle(self)\n else\n @io.write Ping.new\n end\n rescue IOError => ex\n trace \"Runner lost Worker\"\n stop\n end\n end\n trace \"Stopped Processing Messages\"\n end", "title": "" }, { "docid": "64d8135f70febc07bcc45f53f8de3fa0", "score": "0.6238941", "text": "def post_message\n chat = Chat.find(params[:chat_id])\n message = Message.new\n message.chat_id = chat.id\n\n user = ChatUser.user(session)\n message.user_id = user.id\n \n # escapes &, <, > in rails\n message.message = CGI::escapeHTML(params[:message])\n\n payload = message.attributes\n payload[:user] = user.attributes\n\n if message.save\n Pusher[\"presence-\" + chat.channel].trigger('send_message', payload)\n render :text => \"sent\"\n else\n render :text => \"failed\"\n end\n end", "title": "" }, { "docid": "1db4810f116ab2486b126ffb04f06dc0", "score": "0.6238451", "text": "def on_message(message)\n end", "title": "" }, { "docid": "43fa710e1c1bef0e99c9369b7e385874", "score": "0.62376446", "text": "def process_msg( sender, msg )\n @clients.each do |nick, io|\n if io.closed?\n client_left( nick )\n next\n end\n next if sender == nick\n io.puts( \"#{sender} >> #{msg}\")\n end\n end", "title": "" }, { "docid": "821b64f3bdd3d0e73d2e5c8c4193b073", "score": "0.6232136", "text": "def create_chat\n # Eck... not proud of this\n flash[:warning] = \"You do not have permission to send messages\" and redirect_to root_url and return unless @current_user.has_permission? \"can_send_private_messages\"\n message_params = params.require(:private_message).permit(:body, {user: :id}).to_h\n @users = User.find(message_params[\"user\"].map { |x| x[1][\"id\"] })\n @users << @current_user\n\n existing_chat = Chat.existing_chat?(@users)\n redirect_to \"/messages/#{existing_chat.first.id}\" and return unless existing_chat.empty?\n\n chat = Chat.new(users: @users)\n chat.save\n @message = PrivateMessage.new(chat: @chat, body: message_params[\"body\"], user: @current_user)\n chat.private_messages << @message\n respond_to do |format|\n if @message.valid?\n chat.save\n MessageCountIncrementJob.perform_later(@message)\n format.html { redirect_to \"/messages/#{chat.id}\" }\n format.json { head :no_content }\n else\n @message.body = @message.decrypted_body # If we don't do this, the message field on the template is filled with garbage.\n chat.destroy\n @users = @users - [@current_user]\n format.html {\n flash[:alert] = @message.errors.full_messages.join(\"\\n\")\n render template: 'user/direct_message'\n }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8b7cfcdda70c8c7b6607e48ef591e023", "score": "0.622395", "text": "def messages\n @messages = []\n\n # If has parameter last_msg_time, then use the method append_messages\n if params[:last_msg_time] && params[:last_msg_time]!=\"undefined\" then\n append_messages\n return\n else\n # Search Message for current_user as sender\n Message.where(sender_id: current_user.id, receiver_id: params[:talk_to]).find_each do |message|\n @messages.append(message)\n end\n # Search Message for current_user as receiver\n Message.where(sender_id: params[:talk_to], receiver_id: current_user.id).find_each do |message|\n @messages.append(message)\n end\n # Sort the result messages by time\n @messages.sort_by! do |message|\n message.created_at\n end\n @talk_to_name = User.find_by_id(params[:talk_to]).name\n @message = Message.new\n end\n\n end", "title": "" }, { "docid": "1ea97591ffba88891397d3889e244402", "score": "0.6220512", "text": "def channelchat\n @clickchannel = MChannel.find_by(\"channel_id=?\", params[:clickchannelid])\n clickchannel @clickchannel\n TChunreadMessage.joins(\"join t_channel_messages on t_channel_messages.chmsg_id=t_chunread_messages.chmsg_id\")\n .where(\"chuser_id=? and t_channel_messages.channel_id =? \", session[:user_id], @clickchannel.channel_id)\n .update_all(is_read: false)\n main\n @chmesg = TChannelMessage.select(\"m_users.user_name,t_channel_messages.chmsg_id,t_channel_messages.count,t_channel_messages.chmessage,t_channel_messages.created_at,t_channel_messages.updated_at\")\n .joins(\"join m_users on m_users.user_id=t_channel_messages.chsender_id\")\n .where(\"channel_id=?\", session[:clickchannel_id]).order(\"t_channel_messages.created_at ASC\")\n @chmesg.each { |thread|\n @thredcount = HChmessageReply.select(\"*\")\n .joins(\"join t_channel_messages on t_channel_messages.chmsg_id=h_chmessage_replies.chmsg_id\")\n .where(\"h_chmessage_replies.chmsg_id=?\", thread.chmsg_id)\n thread.count = (@thredcount.size).to_s\n }\n @chstar = TChmsgstar.select(\"t_chmsgstars.chmsgstarid\")\n .joins(\"join t_channel_messages on t_chmsgstars.chmsgstarid=t_channel_messages.chmsg_id\")\n .where(\"channel_id=? and t_chmsgstars.chstar_userid=?\", session[:clickchannel_id], session[:user_id])\n @charray = Array.new\n @chstar.each { |r|\n @charray.push(r.chmsgstarid)\n }\n @muser = MUser.select(\"m_users.user_id, m_users.user_name\")\n .joins(\"join m_channels on m_users.user_id=m_channels.user_id \")\n .where(\"m_channels.channel_id=? and m_users.user_id !=?\", session[:clickchannel_id], session[:user_id])\n end", "title": "" }, { "docid": "6e8d0cdc9efa8a6e182f5f4f301f6671", "score": "0.62165225", "text": "def api_chatmessage(chat, message)\n result_pattern = /MESSAGE (\\S+) STATUS (\\S+)/\n result = command(\"CHATMESSAGE #{chat} #{message}\")\n unless message_match = result_pattern.match(result)\n return nil\n end\n message_match[2]\n end", "title": "" }, { "docid": "05032ea8e7f5c53d33abeb65812bdb0e", "score": "0.6216124", "text": "def processMessage\n \t\tlogger.info \"Loading sms_handler processMessage\"\n \t\ttext = params[:text]\n \t\tlogger.debug \"Received text message: #{text.inspect}\"\n \t\tsender = params[:sender]\n \t\tlogger.debug \"Received sender number: #{sender.inspect}\"\n \t\t#First determine if phone-number is valid - https://www.debuggex.com - test regex her\n \t\t#Husk at i Rails skal ^ og $ erstattes af henholdsvis \\A og \\z. Ellers virker det ikke\n \t\t#Regel: Vi tillader forskelige formater når de kommer direkte fra gatewayen. Senere laves de om\n \t\t#i klasse-metoden for member så alle telefonnumre er med +45. Det er vigtigt at alle telefonnumre\n \t\t#er fuldstændig ens i databasen.\n \t\tif text.present? && sender.present? \n \t\t\tlogger.debug \"Sender number and text present. Proceeding....\"\n \t\t\ttext = text.downcase\n \t\t\tlogger.debug \"Text message downcased: #{text.inspect}\"\n \t\t\tsender = sender.strip\n \t\t\tlogger.debug \"Sender stripped for whitespaces: #{sender.inspect}\"\n\n \t\t\tlogger.debug \"Checking if incoming phone number is valid\"\n \t\t\tif SMSUtility::SMSFactory.validate_phone_number_incoming?(sender) #/\\A(45|\\+45|0045)?[1-9][0-9]{7}\\z/.match(sender)\n\t \t\t\tlogger.debug \"Incoming phone number valid\"\n\n\t \t\t\tlogger.debug \"Trying to determine type of message: opt-in or opt-out\"\n\t \t\t\tif text.downcase.include? \"stop\"\n\t \t\t\t\tlogger.debug \"Opt-out request received. Calling stopStoreSubscription method..background process\"\n\t \t\t\t\tSMSUtility::BackgroundWorker.new.delay.stopStoreSubscription(sender, text)\n\t \t\t\telsif text.downcase.include? \"nej\"\n\t \t\t\t\tlogger.debug \"Invalid signup from people under 18 years old. Member must be deleted\"\n\t \t\t\t\tSMSUtility::BackgroundWorker.new.delay.stopStoreSubscriptionMinor(sender, text)\t\n\t \t\t\telse\n\t \t\t\t\tlogger.debug \"Opt-in request received. Calling signupMember method...background process\"\n\t \t\t\t\tSMSUtility::BackgroundWorker.new.delay.signupMember(sender, text)\n\t \t\t\tend\n\t \t\telse\n\t \t\t\tlogger.fatal \"Error: Incoming phone number not valid\"\n\t \t\t\tlogger.debug \"Error: Incoming phone number not valid\"\n\t \t\t\tMessageError.create!(recipient: sender, text: text, error_type: \"invalid_phone_number\")\n\t \t\tend\n \t\telse\n \t\t\tlogger.fatal \"Error: Missing phone number or text\"\n\t \t\tlogger.debug \"Error: Missing phone number or text\"\n \t\t\tMessageError.create!(recipient: sender, text: text, error_type: \"missing_attributes\")\n \t\t\t#Default response with OK status\n \t\tend\n \t\t#Return this no matter what\n \t\trender :nothing => true, :status => :ok \t\n \tend", "title": "" }, { "docid": "87f1722f5eaee5dce0c75bd9c8c57331", "score": "0.6215603", "text": "def chat(*jids)\n Log.logger.debug(\"Received call for chat method\")\n fetch_stdin\n unless jids.kind_of?(Array)\n Log.logger.error(\"Throwing ArgumentError because Jids is not an array.\")\n raise ArgumentError, \"Jids needs to be an Array got #{jids.class}\"\n end\n\n check_messagequeue\n\n Message.batch do\n jids.each do |jid|\n Message.message_to_room(jid)\n end\n end\n\n end", "title": "" }, { "docid": "39fd293246496725b1164b76087b21a0", "score": "0.62030137", "text": "def reply\n return unless request.post?\n # find the thread\n thread = Message.find(params[:id])\n # find the last message of thread\n last_message = Message.find(:all, :conditions => [\"thread_id = ?\", thread.id], :order => 'created_at').last\n # if originator is sending more than 1 messages, handle it \n if last_message.originator == current_user\n new_message = Message.create(:originator => current_user, :follower => last_message.follower, :title => \"re: #{thread.title}\", :body => params[:message][:body], :thread_id => thread.id)\n # check if the message has been deleted by the follower or originator, we need to restore that\n thread.status.update_attribute(:follower_inbox, MessageStatus::STATUS['read']) if thread.status.follower_inbox == MessageStatus::STATUS['deleted']\n thread.status.update_attribute(:originator_inbox, MessageStatus::STATUS['read']) if thread.status.originator_inbox == MessageStatus::STATUS['deleted']\n # normal case, follower replying to originator's message\n else\n # create a new message\n new_message = Message.create(:originator => current_user, :follower => last_message.originator, :title => \"re: #{thread.title}\", :body => params[:message][:body], :thread_id => thread.id)\n # check who is replying in the thread, is it follower or originator and update the flags as needed \n if thread.follower == current_user\n thread.status.update_attributes(:originator_inbox => MessageStatus::STATUS['unread'], :follower_inbox => MessageStatus::STATUS['read'])\n else\n thread.status.update_attributes(:originator_inbox => MessageStatus::STATUS['read'], :follower_inbox => MessageStatus::STATUS['unread'])\n end\n # update the flags for outbox that are global\n thread.status.update_attributes(:originator_outbox => MessageStatus::STATUS['read'], :follower_outbox => MessageStatus::STATUS['read'])\n end\n \n redirect_to :action => 'inbox'\n end", "title": "" }, { "docid": "6ba300a4097050c106ae9a3379921539", "score": "0.62022024", "text": "def message\n #determine the message, message will be called in server.rb\nend", "title": "" }, { "docid": "9667c440d79237ad81e99db62e0b82e9", "score": "0.6200861", "text": "def parse_messages(messages)\n messages.each do |message|\n action = extract_action message if message =~ /^\\//\n if action\n reply = Bot::Actions.send(action[:method], action[:param])\n GroupMe.send_message(group, reply)\n end\n end\n end", "title": "" }, { "docid": "f4dc37da0c5216d9aa7d4e7806503210", "score": "0.6197629", "text": "def handle_message(time, nick, text)\n handled = false\n bot_query = bot_nick + ': '\n stripped_msg = text.strip\n\n if stripped_msg.start_with?(bot_query)\n message = stripped_msg.gsub(/^#{Regexp.escape(bot_query)}/, '')\n handled = handle_direct_message(time, nick, message)\n end\n\n handled\n end", "title": "" }, { "docid": "267adb4cefe7845d805cc99f38b84737", "score": "0.61897403", "text": "def conversation\n\n end", "title": "" } ]
44470526b2447181da763f215e3bf339
DELETE /programations/1 DELETE /programations/1.json
[ { "docid": "e553ba467bb25a42868338dd61b5f3ba", "score": "0.72044355", "text": "def destroy\n @programation.destroy\n respond_to do |format|\n format.html { redirect_to programations_url, notice: 'Programation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "3999aa12378683cfad98840a115d1720", "score": "0.76333356", "text": "def destroy\n @program.destroy\n respond_to do |format|\n format.html { redirect_to programs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3999aa12378683cfad98840a115d1720", "score": "0.76333356", "text": "def destroy\n @program.destroy\n respond_to do |format|\n format.html { redirect_to programs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3999aa12378683cfad98840a115d1720", "score": "0.76333356", "text": "def destroy\n @program.destroy\n respond_to do |format|\n format.html { redirect_to programs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3999aa12378683cfad98840a115d1720", "score": "0.76333356", "text": "def destroy\n @program.destroy\n respond_to do |format|\n format.html { redirect_to programs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3999aa12378683cfad98840a115d1720", "score": "0.76333356", "text": "def destroy\n @program.destroy\n respond_to do |format|\n format.html { redirect_to programs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "61bb9845f347c7db516b779804d0bf8f", "score": "0.76252234", "text": "def destroy\n @program = Program.find(params[:id])\n @program.destroy\n\n respond_to do |format|\n format.html { redirect_to programs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "61bb9845f347c7db516b779804d0bf8f", "score": "0.76252234", "text": "def destroy\n @program = Program.find(params[:id])\n @program.destroy\n\n respond_to do |format|\n format.html { redirect_to programs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "61bb9845f347c7db516b779804d0bf8f", "score": "0.76252234", "text": "def destroy\n @program = Program.find(params[:id])\n @program.destroy\n\n respond_to do |format|\n format.html { redirect_to programs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "229b8dff34c8e22103e0acb9e98e194a", "score": "0.762028", "text": "def destroy\n @program.destroy\n respond_to do |format|\n format.html { redirect_to '/admin' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f8eebaff3dc314bbc151a522b751e8f1", "score": "0.760806", "text": "def destroy\n @program = Program.find(params[:id])\n @program.destroy\n\n respond_to do |format|\n format.html { redirect_to programs_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "f8eebaff3dc314bbc151a522b751e8f1", "score": "0.760806", "text": "def destroy\n @program = Program.find(params[:id])\n @program.destroy\n\n respond_to do |format|\n format.html { redirect_to programs_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "e2338760ba11e338cfa749197cb9ac1f", "score": "0.75599945", "text": "def destroy\n @action_program = ActionProgram.find(params[:id])\n @action_program.destroy\n\n respond_to do |format|\n format.html { redirect_to action_programs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "42550b9becc39c1ea4bf31500e6cd5ef", "score": "0.7546696", "text": "def destroy\n @program.destroy\n respond_to do |format|\n format.html { redirect_to programs_url, notice: t('.destroy.notice') }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "cd566af80cf8003860232705c7caeab6", "score": "0.74773544", "text": "def destroy\n @client_program = ClientProgram.find(params[:id])\n @client_program.destroy\n\n respond_to do |format|\n format.html { redirect_to(client_programs_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "701e6532bb7617dd656ec011ff8462a5", "score": "0.7446928", "text": "def destroy\n @user_program = UserProgram.find(params[:id])\n @user_program.destroy\n\n respond_to do |format|\n format.html { redirect_to user_programs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9554ad8e0af7f9cab1813735a59e8aab", "score": "0.7433364", "text": "def destroy\n @programa = Programa.find(params[:id])\n @programa.destroy\n\n respond_to do |format|\n format.html { redirect_to programas_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "0c76768c6d86cd27a8982d2fb5779603", "score": "0.74177635", "text": "def destroy\n @program = Program.find(params[:id])\n @program.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "8ea98161309f6e1eb2b173c8f0ea983a", "score": "0.7410202", "text": "def destroy\n @collection_program.destroy\n respond_to do |format|\n format.html { redirect_to collection_programs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4fda7f33eb8d22fe051709171d6a5b94", "score": "0.7409174", "text": "def destroy\n @postulate_collection_program.destroy\n respond_to do |format|\n format.html { redirect_to postulate_collection_programs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "8e8a1f9835766fe499d589dd46d3a158", "score": "0.74013525", "text": "def destroy\n @aq_program = AqProgram.find(params[:id])\n @aq_program.destroy\n\n respond_to do |format|\n format.html { redirect_to aq_programs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2c9e2eda44fd729e054304f94f402939", "score": "0.7396258", "text": "def destroy\n @commission_program.destroy\n respond_to do |format|\n format.html { redirect_to commission_programs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3c38da2731112f0147e34fd3b17f3956", "score": "0.7389797", "text": "def destroy\n @program.destroy\n respond_to do |format|\n format.html { redirect_to programs_url, notice: 'Program was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3c38da2731112f0147e34fd3b17f3956", "score": "0.7389797", "text": "def destroy\n @program.destroy\n respond_to do |format|\n format.html { redirect_to programs_url, notice: 'Program was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3c38da2731112f0147e34fd3b17f3956", "score": "0.7389797", "text": "def destroy\n @program.destroy\n respond_to do |format|\n format.html { redirect_to programs_url, notice: 'Program was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3c38da2731112f0147e34fd3b17f3956", "score": "0.7389797", "text": "def destroy\n @program.destroy\n respond_to do |format|\n format.html { redirect_to programs_url, notice: 'Program was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3c38da2731112f0147e34fd3b17f3956", "score": "0.7389797", "text": "def destroy\n @program.destroy\n respond_to do |format|\n format.html { redirect_to programs_url, notice: 'Program was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3c38da2731112f0147e34fd3b17f3956", "score": "0.7389327", "text": "def destroy\n @program.destroy\n respond_to do |format|\n format.html { redirect_to programs_url, notice: 'Program was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ffd8dc052d972c56111967369e188528", "score": "0.7351952", "text": "def destroy\n @raw_program = RawProgram.find(params[:id])\n @raw_program.destroy\n\n respond_to do |format|\n format.html { redirect_to raw_programs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "be4a743ab16a404075a7d8ba15b3340e", "score": "0.73409843", "text": "def destroy\n @program = Program.find(params[:id])\n @program.destroy\n\n respond_to do |format|\n format.html { redirect_to(programs_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "ff7d667e75f73b5d11b20a46a011ec38", "score": "0.7329654", "text": "def destroy\n program = Program.find(@programuser.program_id)\n Comparison.where(program_id: program).destroy_all\n Programuser.where(program_id: program).destroy_all\n CustomField.where(program_id: program).destroy_all\n program.delete\n\n respond_to do |format|\n format.html { redirect_to programs_path, notice: 'program was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "dc46c37965ee51ad434a2cdb89452d16", "score": "0.7284891", "text": "def destroy\n @bonus_program.destroy\n respond_to do |format|\n format.html { redirect_to bonus_programs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "68d7f5e2b19a065f0147f304362147f4", "score": "0.7284811", "text": "def destroy\n @program.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_programs_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "e9923e18e37046cc91f26b15989ab2bc", "score": "0.7264178", "text": "def destroy\n @odeme_program = Odeme::Program.find(params[:id])\n @odeme_program.destroy\n\n respond_to do |format|\n format.html { redirect_to odeme_programs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "5141c58aaeaa1089b4f388111feb4b43", "score": "0.72624594", "text": "def destroy\n @programme = Programme.find(params[:id])\n @programme.destroy\n\n respond_to do |format|\n format.html { redirect_to programmes_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1002bb2910eff918c8bd1264573b027c", "score": "0.72451615", "text": "def destroy\n @programset = Programset.find(params[:id])\n @programset.destroy\n\n respond_to do |format|\n format.html { redirect_to programsets_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "90f5ac3ba1f4a5b6ade0639be8b34f99", "score": "0.7240033", "text": "def destroy\n @program_enrollment.destroy\n respond_to do |format|\n format.html { redirect_to programs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "745bdd6dcadff77373e71b68dfdf335e", "score": "0.72383654", "text": "def destroy\n @program_item.destroy\n respond_to do |format|\n format.html { redirect_to program_items_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6d5e8150ab9e6b2cc0d3417e6d180d79", "score": "0.72342426", "text": "def destroy\n @program = Program.find(params[:id])\n @program.destroy\n\n respond_to do |format|\n\n #format.html { redirect_to(programs_url) }\n format.html { redirect_to(\"/programs?mine=1\") }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "41cca50067212b5661d67f75d3bf9834", "score": "0.7232171", "text": "def destroy\n @program.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Program was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "5d45c509facab137aa6299d99c1b2573", "score": "0.72226095", "text": "def destroy\n @program.destroy\n flash[:success] = \"Program deleted\"\n respond_to do |format|\n format.html { redirect_to programs_url, notice: 'Program was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9d2267d31c15c5622b751ece3077b66b", "score": "0.72077984", "text": "def destroy\n @programme.destroy\n respond_to do |format|\n format.html { redirect_to programmes_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "794a91aa4604aca9746c6bbd02bf32b3", "score": "0.72016543", "text": "def destroy\n @related_program.destroy\n respond_to do |format|\n format.html { redirect_to related_programs_url, notice: 'Related program was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3902d70e9728638f3b0b5c66bdc4d0e9", "score": "0.71973634", "text": "def destroy\n @a_setting_program = ASettingProgram.find(params[:id])\n @a_setting_program.destroy\n\n respond_to do |format|\n format.html { redirect_to a_setting_programs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6762eafd56117e1d3f3e2a0a4cb14c04", "score": "0.71859235", "text": "def destroy\n @personal_program.destroy\n respond_to do |format|\n format.html { redirect_to personal_programs_url, :flash => { :success => 'Personal program was successfully destroyed.' } }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9d4914b5030674188a6096179af5c4e6", "score": "0.7182534", "text": "def destroy\n @programme_request.destroy\n respond_to do |format|\n format.html { redirect_to programme_requests_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f4aaf010d2e42fe9c3805e642e13a82f", "score": "0.7144701", "text": "def destroy\n @program.destroy\n redirect_to programs_url\n end", "title": "" }, { "docid": "f4aaf010d2e42fe9c3805e642e13a82f", "score": "0.7144701", "text": "def destroy\n @program.destroy\n redirect_to programs_url\n end", "title": "" }, { "docid": "1b5cd1d364d219024610a9c543da7499", "score": "0.7140771", "text": "def destroy\n @live_program.destroy\n respond_to do |format|\n format.html { redirect_to live_programs_url, notice: 'Live program was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1b5cd1d364d219024610a9c543da7499", "score": "0.7140771", "text": "def destroy\n @live_program.destroy\n respond_to do |format|\n format.html { redirect_to live_programs_url, notice: 'Live program was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a2c649e8aa63a80c79bb8f2b1254befd", "score": "0.71351516", "text": "def destroy\n @study_program.destroy\n respond_to do |format|\n format.html { redirect_to study_programs_url, notice: 'Study program was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "70c2010eb69311a45bd0ff11c11ce5ad", "score": "0.7101896", "text": "def destroy\n @tour_program.destroy\n respond_to do |format|\n format.html { redirect_to tour_programs_url, notice: 'Tour program was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4cb1d0c2a40a96c6b0176ceb07b03bdd", "score": "0.7063755", "text": "def destroy\n @programacion.destroy\n respond_to do |format|\n format.html { redirect_to programacions_url, notice: 'Programacion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "77dacab00295cb44500fdbfe2dfbe0b2", "score": "0.70513344", "text": "def destroy\n @affiliate_program.destroy\n respond_to do |format|\n format.html { redirect_to affiliate_programs_url, notice: 'Affiliate program was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ab8e75bd600d7bff75300560fd24b2c1", "score": "0.70321465", "text": "def destroy\n @programme.destroy\n respond_to do |format|\n format.html { redirect_to services_url, notice: \"Programme was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a43fba637fe1de18286bda0430d9b6be", "score": "0.70220894", "text": "def destroy\n @program_choice.destroy\n respond_to do |format|\n format.html { redirect_to program_choices_url, notice: 'Program choice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f11ea1f725bec7e3c63312a40c8e4281", "score": "0.7021148", "text": "def destroy\n authorize @study_program\n @study_program.destroy\n respond_to do |format|\n format.html { redirect_to study_programs_url, notice: 'Študijski program označen kot neveljaven.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "54b46f074e7ad3c2668b1909d3cac7bb", "score": "0.70185065", "text": "def destroy\n @program = TvProgram.find(params[:id])\n @program.destroy\n \n redirect_to :action => :index\n end", "title": "" }, { "docid": "b3a57a04c705edf99c4584fc84608df5", "score": "0.70074856", "text": "def destroy\n @program.delete_sounds\n @program.destroy\n respond_to do |format|\n format.html { redirect_to programs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "5a3d02caf9d2486c4b81a28b6105a491", "score": "0.7004107", "text": "def destroy\n @program.destroy\n end", "title": "" }, { "docid": "d83d5ee024d413e52ae28b0b1caddb59", "score": "0.7001586", "text": "def destroy\n @watanprogram.destroy\n respond_to do |format|\n format.html { redirect_to watanprograms_url, notice: 'Watanprogram was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "dd8692d2fff159694287cd4fdffe156e", "score": "0.69888353", "text": "def destroy\n p = Programme.find_by_id(params[:id])\n \n puts params[:id]\n puts \"DEstroy it\"\n puts p\n \n p.destroy if p != nil\n\n respond_to do |format|\n format.html { redirect_to visualisations_url, notice: 'Programme was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "867c13797920a15ac64360145799dbca", "score": "0.69873184", "text": "def destroy\n authorize! :destroy, Program\n @program.destroy\n end", "title": "" }, { "docid": "8cfa171df9f767239f08807b72b03d51", "score": "0.6986628", "text": "def destroy\n @subprogram.destroy\n respond_to do |format|\n format.html { redirect_to subprograms_url, notice: 'El subprograma ha sido eliminado.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1604547ecfd7775d3a090e362e57ab48", "score": "0.6985483", "text": "def destroy\n @entrepreneur_program.destroy\n respond_to do |format|\n format.html { redirect_to entrepreneur_programs_url, notice: 'Entrepreneur program was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b0078bddc3dbdf92c86efa475052d548", "score": "0.69826066", "text": "def destroy\n @program_staff.destroy\n respond_to do |format|\n format.html { redirect_to program_staffs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ff3f463e9808d8e208b3c7a049869541", "score": "0.6975112", "text": "def destroy\n @program_location.destroy\n respond_to do |format|\n format.html { redirect_to programs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "5c35d314f73c2d4b004b044d70f223f0", "score": "0.69731", "text": "def destroy\n authorize @declared_program\n\n @declared_program.destroy\n respond_to do |format|\n format.html { redirect_to declared_programs_url, notice: 'Declared program was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4f8d49872f8fe19fe8369b5def81bb00", "score": "0.69678575", "text": "def destroy\n\n @watanprogram.destroy\n respond_to do |format|\n format.html { redirect_to watanprograms_url, notice: 'Watanprogram was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "8a13e63ad9c6d010fc33e912d07c0756", "score": "0.6966606", "text": "def destroy\n @program = Program.find(params[:program_id])\n @chef_resource = ChefResource.find(params[:chef_id])\n @program.program_chefs.find_by(chef_resource_id: @chef_resource.id).destroy\n #@program_chef.destroy\n respond_to do |format|\n format.html { redirect_to edit_program_path(@program), notice: 'Chef resource was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d7f2ef8ca21f472b30ae62ac0a56d5c4", "score": "0.6966195", "text": "def destroy\n @personal_program = PersonalProgram.find(params[:personal_program_id])\n @personal_chef_resource.destroy\n respond_to do |format|\n format.html { redirect_to personal_program_personal_chef_resources_path(@personal_program), :flash => { :success => \"Action was successfully destroyed.\" } }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9306bef459e14969176e9ba4e97e57b4", "score": "0.6966115", "text": "def destroy\n @vendor_program.destroy\n respond_to do |format|\n format.html { redirect_to vendor_programs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3af4489eda90c69dc9848b0937520e47", "score": "0.69632804", "text": "def destroy\n @program_volunteer.destroy\n respond_to do |format|\n format.html { redirect_to program_volunteers_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1c000be8f708930f7c16ce47fb5adaeb", "score": "0.6958929", "text": "def destroy\n authorize! :destroy, @admin_online_program\n\n @admin_online_program.destroy\n respond_to do |format|\n format.html { redirect_to admin_online_programs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "92772aa10bfe73b749e49d3e2f3c8ffc", "score": "0.6957344", "text": "def destroy\n @program_development.destroy\n respond_to do |format|\n format.html { redirect_to program_developments_url, notice: 'Program development was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "00d622cb2f79b6ced420b90253e6db5a", "score": "0.6954136", "text": "def destroy\n @program = Program.find(params[:id])\n @program.destroy\n flash[:notice] = \"Program ’#{@program.name}’ deleted.\"\n redirect_to programs_path\n end", "title": "" }, { "docid": "312fbdefefce6507c4cd190f151d36b4", "score": "0.69500333", "text": "def destroy\n @program_manifest = ProgramManifest.find(params[:id])\n @program_manifest.destroy\n\n respond_to do |format|\n format.html { redirect_to program_manifests_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "67445659aa33f68a9251e788c18e12b2", "score": "0.6946189", "text": "def destroy\n @az_scetch_program = AzScetchProgram.find(params[:id])\n @az_scetch_program.destroy\n\n respond_to do |format|\n format.html { redirect_to(az_scetch_programs_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "95be7af8c2a2fc984a9f7578199356af", "score": "0.69450223", "text": "def destroy\n @academic_program.destroy\n respond_to do |format|\n format.html { redirect_to academic_programs_url, notice: 'Academic program was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a05d606fabe8067f7ab6a68e6589d612", "score": "0.693883", "text": "def destroy\n @programari.destroy\n respond_to do |format|\n format.html { redirect_to programaris_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6562023d738fc86b550d42897c44742d", "score": "0.69375867", "text": "def destroy\n @programme2013.destroy\n respond_to do |format|\n format.html { redirect_to programme2013s_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7f502e1d7eda4e495137c3c4b553290c", "score": "0.6932696", "text": "def destroy\n @program_attendance.destroy\n respond_to do |format|\n format.html { redirect_to program_attendances_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "39b7324de747729c536e0bf25ea454f7", "score": "0.6930874", "text": "def destroy\n @applicant_foi_program.destroy\n respond_to do |format|\n format.html { redirect_to applicant_foi_programs_url, notice: 'Applicant Field Of Interest Entry was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "36d30186b49c91e6283ee7199a96bb48", "score": "0.6927138", "text": "def destroy\n @programme.destroy\n respond_to do |format|\n format.html { redirect_to programmes_url, notice: 'Programme was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7e8754e366e5d8dc2c2c8a929065add3", "score": "0.6907625", "text": "def destroy\n @program.destroy\n redirect_to programs_path\n end", "title": "" }, { "docid": "ff7680fb10fed661a017853aace355d0", "score": "0.690504", "text": "def destroy\n @program.destroy\n redirect_to programs_url, notice: 'Program was successfully destroyed.'\n end", "title": "" }, { "docid": "ed3e7ccea1926537d27064f020aad5af", "score": "0.6899244", "text": "def destroy\n @programa.destroy\n respond_to do |format|\n format.html { redirect_to grupos_url, notice: \"Programa ha sido borrado.\" }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "86970b911dbf42c563a109c17ba921b1", "score": "0.6891214", "text": "def destroy\n @degreeprogram.destroy\n respond_to do |format|\n format.html { redirect_to degreeprograms_url, notice: 'Degreeprogram was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e822c74a290ac2de3cf49bc874ac7c97", "score": "0.6885952", "text": "def destroy\n @program = Program.find(params[:id])\n @program.destroy\n\n respond_to do |format|\n flash[:notice] = \"Program '#{@program}' was destroyed.\"\n format.html { redirect_to programs_url }\n format.xml { head :ok }\n format.js # destroy.rjs\n end\n end", "title": "" }, { "docid": "a55e150b7a9f064e15790244b6d606e7", "score": "0.6866927", "text": "def destroy\n @programa.destroy\n respond_to do |format|\n format.html { redirect_to programas_url, notice: 'O programa foi excluído com sucesso.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "63c7b61b21946234deab8398e4fa9d63", "score": "0.68661726", "text": "def destroy\n @programme_type = ProgrammeType.find(params[:id])\n @programme_type.destroy\n\n respond_to do |format|\n format.html { redirect_to programme_types_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7c9ee3ac391aa873a853ef198a2cd6a7", "score": "0.6864135", "text": "def destroy\n @program = Program.find(params[:id])\n if @current_user.id == @program.user_id\n @program.remove_files!\n @program.destroy\n\n respond_to do |format|\n format.html { redirect_to programs_url }\n format.json { head :no_content }\n end\n else\n flash[:notice] = 'You may only delete programs you own!'\n redirect_to program_path(@program)\n end\n end", "title": "" }, { "docid": "0f2317947b044ffa38d3f16ba699009a", "score": "0.68598694", "text": "def destroy\n @program_step = ProgramStep.find(params[:id])\n @program_step.destroy\n\n respond_to do |format|\n format.html { redirect_to(scaffold_program_steps_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "69542a26612e93c7305ace6b8d411534", "score": "0.68498135", "text": "def destroy\n @programmer = Programmer.find(params[:id])\n @programmer.destroy\n\n respond_to do |format|\n format.html { redirect_to programmers_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "689b57bbd737a38f6f8671fd99889f72", "score": "0.6845298", "text": "def destroy\n @priority_program = PriorityProgram.find(params[:id])\n @priority_program.destroy\n\n respond_to do |format|\n format.html { redirect_to priority_programs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1d0e54714b3a5e98de5d6f6637cf08ce", "score": "0.6838499", "text": "def destroy\n @week_program.destroy\n respond_to do |format|\n format.html { redirect_to week_programs_url, notice: 'Week program was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6d79cfe4817e7cb9e5c9f3c0e5ca8884", "score": "0.68347", "text": "def destroy\n @programs_target_program.destroy\n respond_to do |format|\n format.html { redirect_to action: 'list', town: @programs_target_program.programs_town_id }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b1a17c1ee1af05c79fe156622df44818", "score": "0.680275", "text": "def delete(path)\n begin\n response = client[path].delete :accept => 'application/json'\n rescue Exception => e\n puts e.inspect\n end\n end", "title": "" }, { "docid": "76af3d7a7d69fff9648852a9c15464f9", "score": "0.6800339", "text": "def destroy\n @program_model.destroy\n respond_to do |format|\n format.html { redirect_to program_models_url, notice: 'Program model was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9d6304f2d140e1b930c3aa6f2694bc80", "score": "0.67956334", "text": "def destroy\n @program_examan.destroy\n respond_to do |format|\n format.html { redirect_to program_examen_url, notice: 'Program examan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "97080e78c973f6cfeddad15428d7dbcc", "score": "0.6787974", "text": "def destroy\n @program_uses_relation.destroy\n respond_to do |format|\n format.html { redirect_to program_uses_relations_url, notice: 'Program uses relation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" } ]
06d30e67306d24a00e28c7c257dc4fc3
determine if there is a safe path to a captive
[ { "docid": "6c301c5714bd9764f2c7e3c09f7291e3", "score": "0.7511023", "text": "def safePathToCaptive?(look)\n s0 = look[0]\n s1 = look[1]\n s2 = look[2]\n if (s0.captive? or s1.captive? or s2.captive?)\n if (!(s1.enemy? or s2.enemy? or s0.enemy?))\n return true\n end\n else\n return false \n end\n end", "title": "" } ]
[ { "docid": "6f2b73c79cb514248d2c4640da550268", "score": "0.6536076", "text": "def secured_path?(path)\n path_match? secured_paths, path\n end", "title": "" }, { "docid": "5b2c94c128a930c82454a712a05f68ca", "score": "0.63925934", "text": "def dead?\n !Pathname.new(@path).realpath rescue true\n end", "title": "" }, { "docid": "851d14ffbf60d24ff86ae67eb1bf9b4f", "score": "0.62743634", "text": "def unc_path?(path)\n (path =~ %r{^\\\\\\\\[^\\\\]+\\\\[^\\\\]+})\nend", "title": "" }, { "docid": "443096290b2bdd5d122d3d5456d1bdb7", "score": "0.6253926", "text": "def path_present?(path)\n path.to_s.strip != \"\"\n end", "title": "" }, { "docid": "d316245bc802b9ec23c025813463018e", "score": "0.62174", "text": "def path_ok? path\n # comparing fixnums are much faster than comparing strings\n path.hash == (@empty_string_hash ||= '' .hash) || # faster than path.empty?\n path[0].hash == (@slash_hash ||= '/'.hash) # faster than path =~ /^\\//\n end", "title": "" }, { "docid": "7d33d88b94cdb44a95e26dbc10d00081", "score": "0.61900413", "text": "def path_ok?\n\n \tif !path.nil? and !path.blank?\n \t\tif File.file?(path) or File.directory?(path)\n \t\t\treturn true\n \t\tend\n \tend\n\n \treturn false\n\n end", "title": "" }, { "docid": "e348a3a7f5931ffd6c78fc0dc0d6751d", "score": "0.61805123", "text": "def _remote_path?(path)\n # not exactly foolproof, but it will do for now\n path.include? ':'\n end", "title": "" }, { "docid": "1833817c262370438babcfa4bd08c077", "score": "0.617757", "text": "def unloadable_cpath?(cpath); end", "title": "" }, { "docid": "a463685f8ec0cd88e55e0cb172a56783", "score": "0.6173059", "text": "def pass?\n not @path.exist? ? @path.mime_type.nil? : @path.variants?\n end", "title": "" }, { "docid": "5d757aade6897c26bd0d0f86afb723d0", "score": "0.6150731", "text": "def can_rotate?\n !!@path\n end", "title": "" }, { "docid": "61f6d96109a4039c1442110658870056", "score": "0.61432207", "text": "def absolute_path?(path); end", "title": "" }, { "docid": "61f6d96109a4039c1442110658870056", "score": "0.61432207", "text": "def absolute_path?(path); end", "title": "" }, { "docid": "c582f95c6fac00d349c664d8d9af0b3f", "score": "0.6135089", "text": "def valid_path?\r\n true\r\n end", "title": "" }, { "docid": "473ebbcd8a23ed419dc273a12ea288ef", "score": "0.61004555", "text": "def protected?\n result = false\n path = resolve\n # puts path\n path_array = path[1..-1].split /\\//\n path_array.pop # remove the file name\n dir_array = [\"/\"]\n path_array.each do |e|\n dir_array.push e\n ac_file = \"#{File.join dir_array}/#{@conf.access_file_name}\"\n result = File.exists? (ac_file)\n # @auth_user_file = auth_user_file ac_file\n # print \"#{ac_file} exists? #{result}\\n\"\n if result then break result end\n end\n result\n end", "title": "" }, { "docid": "187169852e6bcaeda10d5bb6a2c51f3b", "score": "0.6095224", "text": "def part_of_path?\n !!root_path\n end", "title": "" }, { "docid": "11ead675339419cee0d622eec4388490", "score": "0.60853124", "text": "def valid_path?(path)\n return true\n end", "title": "" }, { "docid": "a89ed4234f79ce3fedf1a85f8bd125e1", "score": "0.6080803", "text": "def check_path path\n !!PATH_RE.match(path)\n end", "title": "" }, { "docid": "420a9fdcb29663ef610041effd5fd4b5", "score": "0.6066336", "text": "def directory_traversal_attack?(path)\n abs_path = (current_dir / path).expand_path.to_s\n abs_current_dir_path = current_dir.expand_path.to_s\n !abs_path.start_with?(abs_current_dir_path)\n end", "title": "" }, { "docid": "5c4a86d36fa88710f28a0e4d44db19e4", "score": "0.60379946", "text": "def allows_sub_ca?()\n return false if @path_length.nil?\n return @path_length > 0\n end", "title": "" }, { "docid": "5c4a86d36fa88710f28a0e4d44db19e4", "score": "0.60379946", "text": "def allows_sub_ca?()\n return false if @path_length.nil?\n return @path_length > 0\n end", "title": "" }, { "docid": "63bc44cef61af05a4405b7f37ac8aced", "score": "0.60292315", "text": "def blacklisted_path?(uri)\r\n\t\tshare_path = \"/#{@share_name}\"\r\n\t\tpayload_path = \"#{share_path}/#{@basename}.exe\"\r\n\t\tcase uri\r\n\t\twhen payload_path\r\n\t\t\treturn false\r\n\t\twhen share_path\r\n\t\t\treturn false\r\n\t\telse\r\n\t\t\treturn true\r\n\t\tend\r\n\tend", "title": "" }, { "docid": "e403d5033f0d1b2a40995032792bed85", "score": "0.60285914", "text": "def blacklisted_path?(uri)\r\n\t\tshare_path = \"/#{@share_name}\"\r\n\t\tpayload_path = \"#{share_path}/#{@basename}.exe\"\r\n\t\tcase uri\r\n\t\t\twhen payload_path\r\n\t\t\t\treturn false\r\n\t\t\twhen share_path\r\n\t\t\t\treturn false\r\n\t\t\telse\r\n\t\t\t\treturn true\r\n\t\tend\r\n\tend", "title": "" }, { "docid": "99851f4a5295a33ffff304e77fd03d37", "score": "0.60277194", "text": "def path?\n defined? @path\n end", "title": "" }, { "docid": "c221e68a2a07c8c3e8e742181937bab2", "score": "0.6026783", "text": "def exists?\n return true if base64?\n\n !resolved_path.nil?\n end", "title": "" }, { "docid": "ce5001fa3ab4180bca74fa77caf73d07", "score": "0.6007229", "text": "def validate_path(candidate); end", "title": "" }, { "docid": "5bf9615e0d9f13b56f4e09a9880c2861", "score": "0.5980878", "text": "def check_path path, type = :source\n if path.include? ':'\n host = path.split(':').first.split('@').last\n Mixlib::ShellOut.new(\"ping -o -t 1 #{host}\").run_command.status.success?\n else\n abs_path = File.expand_path path\n abs_path = File.dirname abs_path if type == :destination\n File.exist? abs_path\n end\n end", "title": "" }, { "docid": "968193d4fc9e21785954a194f954313c", "score": "0.59692776", "text": "def fs_path?\n request.path[%r!(_|/)(dir|file|check)[^a-zA-Z]+\\Z!]\n end", "title": "" }, { "docid": "3a3ad59d4915a0b6edccc6301c5bfd24", "score": "0.59667873", "text": "def is_allowed?(path)\n return allowed_paths.include? path\n end", "title": "" }, { "docid": "46fe0ca28514af75181161a1e6189660", "score": "0.59660304", "text": "def absolute?(path); end", "title": "" }, { "docid": "4518e46d962994cf17ec887005089806", "score": "0.59561527", "text": "def route_path_usable? path\n res = path.respond_to?( :~ ) || # skip regex\n path =~ /(?:\\:\\w+)|\\*/ || # keys and splats\n path =~ /[\\%\\\\]/ || # special chars\n path[0..-2].include?(\"?\") # an ending ? is acceptable, it'll be chomped\n !res\n end", "title": "" }, { "docid": "347f774f8085c4627bdeb42ea9787975", "score": "0.5941476", "text": "def browser_safe?\n %w(jpg gif png).include?(url.split('.').last.sub(/\\?.+/, \"\").downcase)\n end", "title": "" }, { "docid": "435b0fa265705b7fd3e1ea362e655dfd", "score": "0.593344", "text": "def matches?(path)\n false\n end", "title": "" }, { "docid": "727a8dc2590a7e9e04497341640e7f62", "score": "0.59286934", "text": "def present?\n !!path\n end", "title": "" }, { "docid": "bad550a7524c46e80f4a4e6e5898cdef", "score": "0.5927127", "text": "def remote_file_exists?(full_path)\n \t'true' == capture(\"if [ -e #{full_path} ]; then echo 'true'; fi\").strip\n end", "title": "" }, { "docid": "31c3166cf453feb7953311ecedb2bebb", "score": "0.5922923", "text": "def blacklisted_path?(uri)\r\n share_path = \"/#{@share_name}\"\r\n payload_path = \"#{share_path}/#{@basename}.dll\"\r\n case uri\r\n when payload_path\r\n return false\r\n when share_path\r\n return false\r\n else\r\n return true\r\n end\r\n end", "title": "" }, { "docid": "8a0232527d72fcc11d874624668e559e", "score": "0.59216523", "text": "def hold?\n !!@held_path\n end", "title": "" }, { "docid": "640ac383d75cde2d7682c32c1cd9342e", "score": "0.59216094", "text": "def check_for_file\n File.exist? @fullpath \n end", "title": "" }, { "docid": "2e0c29aa866e93a0c7a7f162fe5f855b", "score": "0.59204227", "text": "def insure_paths_to_enemy_bases_not_blocked\n # assume the unit is not a capturer\n raise \"insure_paths_to_enemy_bases_not_blocked called for a CAPTURER\" if CAPTURERS.include?(@type)\n return false if surrounded_by?(6, @game.units)\n capturers = @game.my_capturers\n return false if capturers.size == 0\n return false if @game.enemy_bases.size == 0\n # take the nearest capturer, calcul its path to nearest base\n # if blocked, move away from base\n n = nearest(capturers, []) # no exclusions\n path_size = shortest_path(n, []).size\n return false if path_size > n.speed(1)-2 # -2 to let space to go away\n b = nearest(@game.enemy_bases, []) # no exclusions\n path = n.shortest_path(b, [])\n if path.include?(@hex)\n puts \"! moving away from #{b} as #{n} could go to it dist_between(n)=#{dist_between(n)}\"\n return move_away_from([b])\n end\n false\n end", "title": "" }, { "docid": "e49f38fb066c0e27708c89e8fc2f518c", "score": "0.58983225", "text": "def validate_path(candidate)\n return false if candidate.nil?\n\n directory = File.dirname(candidate)\n File.writable?(directory)\n end", "title": "" }, { "docid": "d75784a70222c58916d53b517ccf4576", "score": "0.58926994", "text": "def check_path\n if(File.directory?(\"#{Dir.pwd()}/public/img/\"))\n return true\n else\n puts \"\\033[31m|!| #{$0} must be ran from Serpico root directory to work! Please cd to correct dir!\\033[0m\"\n return false\n end\nend", "title": "" }, { "docid": "884c2853cf4def0599789eceb75c0096", "score": "0.58911234", "text": "def path_ok?\n \t\t\tFile.exists?(self.file_path)\n \t\tend", "title": "" }, { "docid": "a6babfc33664bb277112711a5e99762d", "score": "0.58888716", "text": "def allows_sub_ca?\n return false unless is_ca?\n return true if @path_length.nil?\n @path_length > 0\n end", "title": "" }, { "docid": "182af24f10216a71c9f89a83ab606e5b", "score": "0.58866054", "text": "def qualified?(path)\n path =~ /^([~\\/]|\\.\\.?\\/)/\n end", "title": "" }, { "docid": "f640560b56a07c86154e6a38f22c7e7f", "score": "0.58828473", "text": "def authenticated?\n return !@paths.empty?\n end", "title": "" }, { "docid": "d63e778c1fdbbc0eabd667637428bf32", "score": "0.588003", "text": "def valid?\n File.exists? path_data\n end", "title": "" }, { "docid": "b9f739d54a94b7e88ecaa7bc7d4f1730", "score": "0.5872236", "text": "def is_in_current_path(real_path_info, spected_path_info)\n result = real_path_info =~ /#{spected_path_info}/\n !result.nil?\n end", "title": "" }, { "docid": "172b97c434e9b723a96918864e5e436e", "score": "0.58678883", "text": "def path?(input)\n return true unless (%r{^\\./} =~ input).nil?\n\n false\n end", "title": "" }, { "docid": "49bd9095f177da5b1fcba411fe80fa4d", "score": "0.5856728", "text": "def local_path?(key)\n key.to_s.split('_').last == 'path' && !key.to_s.include?('remote')\n end", "title": "" }, { "docid": "096f5b50283cd9e90180a0d0979722ed", "score": "0.58530784", "text": "def valid_path?(disk_file_path)\n realpath = File.realpath(disk_file_path)\n realpath == public_dir || realpath.start_with?(public_dir + \"/\")\n end", "title": "" }, { "docid": "cb6b5f42829537bfe13df3d8e7016cb1", "score": "0.5851476", "text": "def remote_file_exists?(full_path)\n 'true' == capture(\"if [ -e #{full_path} ]; then echo 'true'; fi\").strip\nend", "title": "" }, { "docid": "cb6b5f42829537bfe13df3d8e7016cb1", "score": "0.5851476", "text": "def remote_file_exists?(full_path)\n 'true' == capture(\"if [ -e #{full_path} ]; then echo 'true'; fi\").strip\nend", "title": "" }, { "docid": "cb6b5f42829537bfe13df3d8e7016cb1", "score": "0.5851476", "text": "def remote_file_exists?(full_path)\n 'true' == capture(\"if [ -e #{full_path} ]; then echo 'true'; fi\").strip\nend", "title": "" }, { "docid": "cb6b5f42829537bfe13df3d8e7016cb1", "score": "0.5851476", "text": "def remote_file_exists?(full_path)\n 'true' == capture(\"if [ -e #{full_path} ]; then echo 'true'; fi\").strip\nend", "title": "" }, { "docid": "cb6b5f42829537bfe13df3d8e7016cb1", "score": "0.5851476", "text": "def remote_file_exists?(full_path)\n 'true' == capture(\"if [ -e #{full_path} ]; then echo 'true'; fi\").strip\nend", "title": "" }, { "docid": "cb6b5f42829537bfe13df3d8e7016cb1", "score": "0.5851476", "text": "def remote_file_exists?(full_path)\n 'true' == capture(\"if [ -e #{full_path} ]; then echo 'true'; fi\").strip\nend", "title": "" }, { "docid": "cb6b5f42829537bfe13df3d8e7016cb1", "score": "0.5851476", "text": "def remote_file_exists?(full_path)\n 'true' == capture(\"if [ -e #{full_path} ]; then echo 'true'; fi\").strip\nend", "title": "" }, { "docid": "cb6b5f42829537bfe13df3d8e7016cb1", "score": "0.5851476", "text": "def remote_file_exists?(full_path)\n 'true' == capture(\"if [ -e #{full_path} ]; then echo 'true'; fi\").strip\nend", "title": "" }, { "docid": "cb6b5f42829537bfe13df3d8e7016cb1", "score": "0.5851476", "text": "def remote_file_exists?(full_path)\n 'true' == capture(\"if [ -e #{full_path} ]; then echo 'true'; fi\").strip\nend", "title": "" }, { "docid": "cb6b5f42829537bfe13df3d8e7016cb1", "score": "0.5851476", "text": "def remote_file_exists?(full_path)\n 'true' == capture(\"if [ -e #{full_path} ]; then echo 'true'; fi\").strip\nend", "title": "" }, { "docid": "7600bcf323dd238af6adf74cd72a4d88", "score": "0.5847455", "text": "def exists\n \treturn @path != \"\"\n end", "title": "" }, { "docid": "3372d390353af86eb22d5f351ea83846", "score": "0.58324033", "text": "def valid_path? path\n !path.nil? && File.directory?(path) && File.file?(File.join(path, 'Turplefile'))\n end", "title": "" }, { "docid": "b661a42ac2f06e2fdcc96c4408920e14", "score": "0.5828899", "text": "def there_is_a_path?\n true # assume there is for now\nend", "title": "" }, { "docid": "1c99e081a903b381aee8c062f674051b", "score": "0.58269876", "text": "def blacklisted_path?(uri)\r\n return true if uri =~ /\\.exe/i\r\n return true if uri =~ /\\.(config|manifest)/i\r\n return true if uri =~ /desktop\\.ini/i\r\n return true if uri =~ /lib.*\\.dll/i\r\n return true if uri =~ /\\.tmp$/i\r\n return true if uri =~ /(pcap|packet)\\.dll/i\r\n false\r\n end", "title": "" }, { "docid": "53abf33674063c8dc7e14c0e2995d475", "score": "0.5823847", "text": "def reachable?\n Dir.exists?(path)\n end", "title": "" }, { "docid": "d2f8b1e3aa04cba34df8f156ff0b5bae", "score": "0.58209974", "text": "def remote_file_exists?(full_path)\n 'true' == capture(\"if [ -e #{full_path} ]; then echo 'true'; fi\").strip\n end", "title": "" }, { "docid": "d2f8b1e3aa04cba34df8f156ff0b5bae", "score": "0.58209974", "text": "def remote_file_exists?(full_path)\n 'true' == capture(\"if [ -e #{full_path} ]; then echo 'true'; fi\").strip\n end", "title": "" }, { "docid": "d2f8b1e3aa04cba34df8f156ff0b5bae", "score": "0.58209974", "text": "def remote_file_exists?(full_path)\n 'true' == capture(\"if [ -e #{full_path} ]; then echo 'true'; fi\").strip\n end", "title": "" }, { "docid": "58417692bc0734683d88d6f460b8cb6f", "score": "0.5813479", "text": "def image_path(full_path)\n if full_path.index(\"/#{SPLIT_CHAR}/\")\n image_path = full_path.split(\"/#{SPLIT_CHAR}/\")\n\n if image_path.length >= 2\n image_path.last\n else\n false\n end\n else\n full_path\n end\nend", "title": "" }, { "docid": "a212ca43ef936e7f6c4303a8d29ac3df", "score": "0.58110976", "text": "def blacklisted_path?(uri)\r\n\t\treturn true if uri =~ /\\.exe/i\r\n\t\treturn true if uri =~ /\\.(config|manifest)/i\r\n\t\treturn true if uri =~ /desktop\\.ini/i\r\n\t\treturn true if uri =~ /lib.*\\.dll/i\r\n\t\treturn true if uri =~ /\\.tmp$/i\r\n\t\treturn true if uri =~ /(pcap|packet)\\.dll/i\r\n\t\tfalse\r\n\tend", "title": "" }, { "docid": "374e9e1ca001c827baa3b13e08430b65", "score": "0.5810768", "text": "def file?\n !!realpath\n end", "title": "" }, { "docid": "374e9e1ca001c827baa3b13e08430b65", "score": "0.5810768", "text": "def file?\n !!realpath\n end", "title": "" }, { "docid": "374e9e1ca001c827baa3b13e08430b65", "score": "0.5810768", "text": "def file?\n !!realpath\n end", "title": "" }, { "docid": "e0aa16b7ab648cd9b0bcd9e6457ecb75", "score": "0.57990426", "text": "def well_formed?\n @kwds.has_key?(:path)\n end", "title": "" }, { "docid": "4f8ff2472ef48f51c12a97e410ec4654", "score": "0.57947665", "text": "def maybe_hidden_file?(path); end", "title": "" }, { "docid": "4f8ff2472ef48f51c12a97e410ec4654", "score": "0.57947665", "text": "def maybe_hidden_file?(path); end", "title": "" }, { "docid": "2fce382931095424e5731df297046bb2", "score": "0.579206", "text": "def invalid_path?(path)\n !File.exist?(path) && !path.include?('http')\n end", "title": "" }, { "docid": "fed43bfca9925c4338be2d87e015e588", "score": "0.5791469", "text": "def is_path?; end", "title": "" }, { "docid": "e22432848ee435efa6dc0beabeef795b", "score": "0.579116", "text": "def local_path?(path)\n (path =~ %r{^.:(/|\\\\)})\nend", "title": "" }, { "docid": "37f0523ff39f249992cdf2b9f93b353c", "score": "0.5790296", "text": "def matched?(path)\n true\n end", "title": "" }, { "docid": "78f5541ffbe01303c9bc207e49088098", "score": "0.57874423", "text": "def requesting_a_part?\n parts.any? && requested_path && requested_path != base_path\n end", "title": "" }, { "docid": "b8629afec42958e6e0e776c3d4ac3512", "score": "0.57872665", "text": "def ensure_path(path)\n\t\t ret = false\n\t\t remote_path = File.join(@root_path, path)\n\t\t result = @connection.propfind(remote_path)\n\t\t \n\t\t if result[:header].status.to_s =~ /2\\d{2}/\n\t\t # Directory exists\n\t\t ret = true\n\t\t else\n\t\t # Directory must be created\n\t\t result = @connection.mkcol remote_path\n\t\t ret = true if (result[:header].status.to_s =~ /2\\d{2}/)\n\t\t end\n\t\t \n\t\t ret\n\t\tend", "title": "" }, { "docid": "a3aca15f08860c34d3309e3f3f87982c", "score": "0.57762474", "text": "def check_driver_path\n \n end", "title": "" }, { "docid": "4b593c24f2843c80341b9c8f74d96ef6", "score": "0.57629687", "text": "def name_safe?\n cleanpath = Pathname.new(@name).cleanpath\n return false unless cleanpath.relative?\n\n root = ::File::SEPARATOR\n naive_expanded_path = ::File.join(root, cleanpath.to_s)\n ::File.absolute_path(cleanpath.to_s, root) == naive_expanded_path\n end", "title": "" }, { "docid": "e8fb5d704ce78f65789d3c80f222b550", "score": "0.57591397", "text": "def path_match?(base_path, target_path); end", "title": "" }, { "docid": "26c0874656d1c5417e3748af222fd612", "score": "0.57401055", "text": "def can_serve(path_info)\n\n req_path = HttpRequest.unescape(path_info)\n # Add the drive letter or root path\n req_path = File.join(@path, req_path) if @path\n req_path = File.expand_path req_path\n \n if File.exist? req_path and (!@path or req_path.index(@path) == 0)\n # It exists and it's in the right location\n if File.directory? req_path\n # The request is for a directory\n index = File.join(req_path, @index_html)\n if File.exist? index\n # Serve the index\n return index\n elsif @listing_allowed\n # Serve the directory\n return req_path\n else\n # Do not serve anything\n return nil\n end\n else\n # It's a file and it's there\n return req_path\n end\n else\n # does not exist or isn't in the right spot\n return nil\n end\n end", "title": "" }, { "docid": "c5f400ee06e86eefd37a3b4c8c2f420e", "score": "0.57392097", "text": "def valid_path?(origin, destination)\n piece = self[origin].piece\n return false if piece.nil?\n return valid_knight_path?(origin, destination) if piece.is_a? Knight\n return valid_pawn_path?(origin, destination) if piece.is_a? Pawn\n\n valid_general_path?(origin, destination)\n end", "title": "" }, { "docid": "bb6d088c3e4ab4f310b952942f99c94a", "score": "0.5734233", "text": "def valid?(path)\n fp = full_path path\n fp.start_with?(::File.expand_path public_dir) &&\n ::File.file?(fp) && ::File.executable?(fp)\n end", "title": "" }, { "docid": "41de33a71e01c88c0891c2e1b38a9c6f", "score": "0.57262564", "text": "def capified?\n File.exists? \"#{APPLICATION_PATH}/Capfile\"\nend", "title": "" }, { "docid": "f0aa8644c84900c1b0552f40ae8be39b", "score": "0.57260025", "text": "def legal_path?(path, kind)\n patharr = path.split('.')\n @@grove.each do |k,v|\n curr = v[\"tree\"]\n if curr.s_u_name.eql?(patharr[0])\n patharr.each_index do |index|\n next if index == 0\n name = patharr[index]\n if Tree.has_child?(curr, name)\n curr = Tree.get_child(curr, name)\n else\n return false unless index == patharr.length-1\n end\n return true if index == patharr.length-1 && curr.kind.eql?(kind)\n end\n end\n end\n false\n end", "title": "" }, { "docid": "f0aa8644c84900c1b0552f40ae8be39b", "score": "0.57260025", "text": "def legal_path?(path, kind)\n patharr = path.split('.')\n @@grove.each do |k,v|\n curr = v[\"tree\"]\n if curr.s_u_name.eql?(patharr[0])\n patharr.each_index do |index|\n next if index == 0\n name = patharr[index]\n if Tree.has_child?(curr, name)\n curr = Tree.get_child(curr, name)\n else\n return false unless index == patharr.length-1\n end\n return true if index == patharr.length-1 && curr.kind.eql?(kind)\n end\n end\n end\n false\n end", "title": "" }, { "docid": "c84c2260d92d8d4647f21348d199a7ab", "score": "0.5725356", "text": "def stronger_or_equal\n path\n end", "title": "" }, { "docid": "0a18d131f9d3af0a452f1efb96014188", "score": "0.5718642", "text": "def valid_path?(path)\n path.to_s.match(/^http(s)?:\\/\\//).present?\n end", "title": "" }, { "docid": "b8b21f7eae48dca2d122555e1b0f5657", "score": "0.5704992", "text": "def path_blacklisted? env\n path = \"#{env['SCRIPT_NAME']}#{env['PATH_INFO']}\"\n path = \"/#{path}\" unless path.start_with? \"/\"\n @path_blacklist.find { |p| p === path }\n end", "title": "" }, { "docid": "b902588ac399e40d828e0b8efa3836f3", "score": "0.57025975", "text": "def properly_contained?\n !file_path.empty?\n end", "title": "" }, { "docid": "aae9b6db72afaf373dd0e82dc2daf293", "score": "0.5701574", "text": "def path_allowed?(path)\n acl = @_aclize_acl.get_acl_for(get_current_role)\n return acl.paths.permitted?(path)\n end", "title": "" }, { "docid": "7465b63ea639e4dbe50a939b7d97d30e", "score": "0.56931174", "text": "def validate(path)\r\n\r\n # empty/nonexistant\r\n if not path or path.length == 0\r\n print \"No path specified.\\n\"\r\n return false\r\n end\r\n \r\n # garbage chars present\r\n if path =~ /[\\|\\*\\\"\\<\\>\\?]/\r\n print \"Illegal character present in path: \",$&,\"\\n\"\r\n return false\r\n end\r\n \r\n # c:, u:, or \\, /\r\n if path =~ /^[A-Za-z]:$/ or path == \"\\\\\" or path == \"/\"\r\n print \"IAN requires a full path as an installation target.\\n\"\r\n return false\r\n end\r\n\r\n # c:\\ u:\\ etc.\r\n if path =~ /^[A-Za-z]:(\\\\|\\/)+$/\r\n print \"IAN requires that a subdirectory is specified as an installation target.\\n\"\r\n return false\r\n end\r\n \r\n # c:\\fred, c:\\fred\\, c:\\fred\\joe, c:\\fred\\joe\\, \\fred, fred, fred\\, fred\\joe,\r\n # fred\\joe\\, ., .., .\\, .\\joe, .\\.\\.\r\n\r\n tmp = path.dup\r\n \r\n # optionally match leading drive designation\r\n if tmp =~ /^[A-Za-z]\\:(.*)/\r\n tmp = $1\r\n end\r\n\r\n # optionally match leading slash\r\n if tmp =~ /^(\\\\|\\/)(.*)/\r\n tmp = $2\r\n end\r\n \r\n while tmp and tmp.length != 0\r\n \r\n # match subdir to end of string\r\n if tmp =~ /^[\\s\\w\\`\\~\\!\\@\\#\\$\\%\\^\\&\\(\\)\\-\\_\\+\\=\\{\\}\\[\\]\\;\\'\\,\\.]+$/\r\n \r\n tmp = \"\"\r\n \r\n # match subdir to next slash\r\n elsif tmp =~ /^[\\s\\w\\`\\~\\!\\@\\#\\$\\%\\^\\&\\(\\)\\-\\_\\+\\=\\{\\}\\[\\]\\;\\'\\,\\.]+\\\\|\\/(.*)/\r\n \r\n tmp = $1\r\n \r\n else # no subdir to match\r\n \r\n print \"Illegal path syntax.\\n\"\r\n return false\r\n \r\n end\r\n\r\n end\r\n \r\n return true\r\nend", "title": "" }, { "docid": "5ce23629151a44f48c436d7c81afeb33", "score": "0.5691248", "text": "def image_exist?(path)\n begin\n open path\n return path\n rescue\n # File at disk or url does not exist\n return false\n end\n end", "title": "" }, { "docid": "aee6ddaba2e8de5b0ebc4c5289f6dcd4", "score": "0.5691174", "text": "def protected?\n flag = false\n appended_path = \"\"\n @path.split(File::SEPARATOR).map do |subdir|\n appended_path.concat(subdir==\"\" ? File::SEPARATOR :\n File::SEPARATOR + subdir)\n\n if(File.exists?(@doc_root + appended_path + \"/.htaccess\")) \n @file_path = @doc_root + appended_path + \"/.htaccess\" \n flag = true\n break\n end\n end\n flag\n end", "title": "" }, { "docid": "62106eadb29a117d44c402e08efafae9", "score": "0.56885767", "text": "def reference_path?(path)\n path.include?(\"]: \")\n end", "title": "" }, { "docid": "86cf31113466227c086651316b4abd28", "score": "0.5677269", "text": "def asset_request?\n ::Warden::asset_paths.any? { |r| env['PATH_INFO'].to_s.match(r) }\n end", "title": "" } ]
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "56a25f7bc06a544925a952569a230803", "score": "0.0", "text": "def set_question_response\n @question_response = QuestionResponse.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60310465", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.60152966", "text": "def on_setup_callbacks; end", "title": "" }, { "docid": "311e95e92009c313c8afd74317018994", "score": "0.5920606", "text": "def setup_actions\n domain = @apps.domain\n path_user = '/a/feeds/'+domain+'/user/2.0'\n path_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n path_email_list = '/a/feeds/'+domain+'/emailList/2.0'\n path_group = '/a/feeds/group/2.0/'+domain\n\n @apps.register_action(:domain_login, {:method => 'POST', :path => '/accounts/ClientLogin' })\n @apps.register_action(:user_create, { :method => 'POST', :path => path_user })\n @apps.register_action(:user_retrieve, { :method => 'GET', :path => path_user+'/' })\n @apps.register_action(:user_retrieve_all, { :method => 'GET', :path => path_user })\n @apps.register_action(:user_update, { :method => 'PUT', :path => path_user +'/' })\n @apps.register_action(:user_delete, { :method => 'DELETE', :path => path_user +'/' })\n @apps.register_action(:nickname_create, { :method => 'POST', :path =>path_nickname })\n @apps.register_action(:nickname_retrieve, { :method => 'GET', :path =>path_nickname+'/' })\n @apps.register_action(:nickname_retrieve_all_for_user, { :method => 'GET', :path =>path_nickname+'?username=' })\n @apps.register_action(:nickname_retrieve_all_in_domain, { :method => 'GET', :path =>path_nickname })\n @apps.register_action(:nickname_delete, { :method => 'DELETE', :path =>path_nickname+'/' })\n @apps.register_action(:group_create, { :method => 'POST', :path => path_group })\n @apps.register_action(:group_update, { :method => 'PUT', :path => path_group })\n @apps.register_action(:group_retrieve, { :method => 'GET', :path => path_group })\n @apps.register_action(:group_delete, { :method => 'DELETE', :path => path_group })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>'' })\n end", "title": "" }, { "docid": "8315debee821f8bfc9718d31b654d2de", "score": "0.5912896", "text": "def initialize(*args)\n super\n @action = :setup\nend", "title": "" }, { "docid": "8315debee821f8bfc9718d31b654d2de", "score": "0.5912896", "text": "def initialize(*args)\n super\n @action = :setup\nend", "title": "" }, { "docid": "bfea4d21895187a799525503ef403d16", "score": "0.5898134", "text": "def define_action_helpers\n super\n define_validation_hook if runs_validations_on_action?\n end", "title": "" }, { "docid": "352de4abc4d2d9a1df203735ef5f0b86", "score": "0.5887081", "text": "def required_action\n # TODO: implement\n end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5887026", "text": "def actions; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5887026", "text": "def actions; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5887026", "text": "def actions; end", "title": "" }, { "docid": "8713cb2364ff3f2018b0d52ab32dbf37", "score": "0.5876557", "text": "def define_action_helpers\n if action == :save\n if super(:create_or_update)\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n else\n super\n end\n end", "title": "" }, { "docid": "a80b33627067efa06c6204bee0f5890e", "score": "0.5860066", "text": "def actions\n\n end", "title": "" }, { "docid": "930a930e57ae15f432a627a277647f2e", "score": "0.5807812", "text": "def setup_actions\n domain = @apps.domain\n path_base = '/a/feeds/emailsettings/2.0/'+domain+'/'\n\n @apps.register_action(:create_label, {:method => 'POST', :path => path_base })\n @apps.register_action(:create_filter, { :method => 'POST', :path => path_base })\n @apps.register_action(:create_send_as, { :method => 'POST', :path => path_base })\n @apps.register_action(:update_webclip, { :method => 'PUT', :path => path_base })\n @apps.register_action(:update_forward, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_pop, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_imap, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_vacation, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_signature, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_language, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_general, { :method => 'PUT', :path =>path_base })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>nil })\n end", "title": "" }, { "docid": "33ff963edc7c4c98d1b90e341e7c5d61", "score": "0.57404715", "text": "def setup\n common_setup\n end", "title": "" }, { "docid": "a5ca4679d7b3eab70d3386a5dbaf27e1", "score": "0.57310694", "text": "def perform_setup\n end", "title": "" }, { "docid": "ec7554018a9b404d942fc0a910ed95d9", "score": "0.5715928", "text": "def before_setup(&block)\n pre_setup_actions.unshift block\n end", "title": "" }, { "docid": "9c186951c13b270d232086de9c19c45b", "score": "0.5701527", "text": "def callbacks; end", "title": "" }, { "docid": "c85b0efcd2c46a181a229078d8efb4de", "score": "0.569245", "text": "def custom_setup\n\n end", "title": "" }, { "docid": "100180fa74cf156333d506496717f587", "score": "0.5669733", "text": "def do_setup\n\t\tget_validation\n\t\tprocess_options\n\tend", "title": "" }, { "docid": "2198a9876a6ec535e7dcf0fd476b092f", "score": "0.56503016", "text": "def initial_action; end", "title": "" }, { "docid": "b9b75a9e2eab9d7629c38782c0f3b40b", "score": "0.5648064", "text": "def setup_intent; end", "title": "" }, { "docid": "471d64903a08e207b57689c9fbae0cf9", "score": "0.5636733", "text": "def setup_controllers &proc\n @global_setup = proc\n self\n end", "title": "" }, { "docid": "468d85305e6de5748477545f889925a7", "score": "0.5623887", "text": "def inner_action; end", "title": "" }, { "docid": "bb445e7cc46faa4197184b08218d1c6d", "score": "0.56089544", "text": "def pre_action\n # Override this if necessary.\n end", "title": "" }, { "docid": "48804b0fa534b64e7885b90cf11bff31", "score": "0.559635", "text": "def execute_callbacks; end", "title": "" }, { "docid": "432f1678bb85edabcf1f6d7150009703", "score": "0.5595486", "text": "def target_callbacks() = commands", "title": "" }, { "docid": "5aab98e3f069a87e5ebe77b170eab5b9", "score": "0.55868655", "text": "def api_action!(*args)\n type = self.class.name.split(\"::\").last.downcase\n run_callbacks_for([\"before_#{type}\", :before], *args)\n result = nil\n begin\n result = yield if block_given?\n run_callbacks_for([\"after_#{type}\", :after], *args)\n result\n rescue => err\n run_callbacks_for([\"failed_#{type}\", :failed], *(args + [err]))\n raise\n end\n end", "title": "" }, { "docid": "9efbca664902d80a451ef6cff0334fe2", "score": "0.55584484", "text": "def global_callbacks; end", "title": "" }, { "docid": "9efbca664902d80a451ef6cff0334fe2", "score": "0.55584484", "text": "def global_callbacks; end", "title": "" }, { "docid": "482481e8cf2720193f1cdcf32ad1c31c", "score": "0.5507632", "text": "def required_keys(action)\n\n end", "title": "" }, { "docid": "353fd7d7cf28caafe16d2234bfbd3d16", "score": "0.55033326", "text": "def assign_default_callbacks(action_name, is_member=false)\n if ResourceController::DEFAULT_ACTIONS.include?(action_name)\n DefaultActions.send(action_name, self)\n elsif is_member\n send(action_name).build { load_object }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => object }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { render :xml => object.errors }\n else\n send(action_name).build { load_collection }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => collection }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { head 500 }\n end\n end", "title": "" }, { "docid": "2f6ef0a1ebe74f4d79ef0fb81af59d40", "score": "0.5466339", "text": "def on_setup(&block); end", "title": "" }, { "docid": "dcf95c552669536111d95309d8f4aafd", "score": "0.54640555", "text": "def layout_actions\n \n end", "title": "" }, { "docid": "8ab2a5ea108f779c746016b6f4a7c4a8", "score": "0.54472816", "text": "def testCase_001\n test_case_title # fw3_actions.rb\n setup # fw3_global_methods.rb\n \n get_page_url # fw3_actions.rb\n validate_page_title # fw3_actions.rb\n validate_page_link_set # fw3_actions.rb\n \n teardown # fw3_global_methods.rb\nend", "title": "" }, { "docid": "e3aadf41537d03bd18cf63a3653e05aa", "score": "0.54455507", "text": "def before(action)\n invoke_callbacks *options_for(action).before\n end", "title": "" }, { "docid": "6bd37bc223849096c6ea81aeb34c207e", "score": "0.54398936", "text": "def post_setup\n end", "title": "" }, { "docid": "07fd9aded4aa07cbbba2a60fda726efe", "score": "0.5415934", "text": "def testCase_001\n testTitle # fw2_actions.rb\n setup # fw2_global_methods.rb\n get_page_url # fw2_actions.rb\n validate_title # fw2_actions.rb\n teardown # fw2_global_methods.rb\nend", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5407991", "text": "def action_methods; end", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5407991", "text": "def action_methods; end", "title": "" }, { "docid": "9358208395c0869021020ae39071eccd", "score": "0.54", "text": "def post_setup; end", "title": "" }, { "docid": "c5904f93614d08afa38cc3f05f0d2365", "score": "0.5394463", "text": "def before_setup; end", "title": "" }, { "docid": "c5904f93614d08afa38cc3f05f0d2365", "score": "0.5394463", "text": "def before_setup; end", "title": "" }, { "docid": "cb5bad618fb39e01c8ba64257531d610", "score": "0.5391065", "text": "def define_model_action(methods,action,default_options={:validate => true})\n default_options.merge!(methods.extract_options!)\n actions = [action,\"#{action}!\".to_sym]\n actions.each do |a|\n define_method(a) do |opts = {}|\n rslt = nil\n options = default_options.merge(opts)\n options[:raise_exception] = a.to_s.match(/\\!$/)\n run_callbacks(action) do\n rslt = run_model_action(methods,options)\n end\n run_after_any\n rslt\n end\n end\n end", "title": "" }, { "docid": "a468b256a999961df3957e843fd9bdf4", "score": "0.5388469", "text": "def _setup\n setup_notification_categories\n setup_intelligent_segments\n end", "title": "" }, { "docid": "f099a8475f369ce73a38d665b6ee6877", "score": "0.5376582", "text": "def action_run\n end", "title": "" }, { "docid": "2c4e5a90aa8efaaa3ed953818a9b30d2", "score": "0.5355932", "text": "def execute(setup)\n @action.call(setup)\n end", "title": "" }, { "docid": "725216eb875e8fa116cd55eac7917421", "score": "0.5348422", "text": "def setup\n @controller.setup\n end", "title": "" }, { "docid": "39c39d6fe940796aadbeaef0ce1c360b", "score": "0.53466004", "text": "def setup_phase; end", "title": "" }, { "docid": "118932433a8cfef23bb8a921745d6d37", "score": "0.53451854", "text": "def register_action(action); end", "title": "" }, { "docid": "bd03e961c8be41f20d057972c496018c", "score": "0.5343858", "text": "def post_setup\n controller.each do |name,ctrl|\n ctrl.post_setup\n end\n end", "title": "" }, { "docid": "c6352e6eaf17cda8c9d2763f0fbfd99d", "score": "0.5339292", "text": "def initial_action=(_arg0); end", "title": "" }, { "docid": "207a668c9bce9906f5ec79b75b4d8ad7", "score": "0.532725", "text": "def before_setup\n\n end", "title": "" }, { "docid": "669ee5153c4dc8ee81ff32c4cefdd088", "score": "0.53038853", "text": "def ensure_before_and_after; end", "title": "" }, { "docid": "c77ece7b01773fb7f9f9c0f1e8c70332", "score": "0.52850133", "text": "def setup!\n adding_handlers do\n check_arity\n apply_casting\n check_validation\n end\n end", "title": "" }, { "docid": "1e1e48767a7ac23eb33df770784fec61", "score": "0.52815986", "text": "def set_minimum_up_member_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "title": "" }, { "docid": "63a9fc1fb0dc1a7d76ebb63a61ed24d7", "score": "0.5257178", "text": "def define_callbacks(*args)\n if abstract_class\n all_shards.each do |model|\n model.define_callbacks(*args)\n end\n end\n\n super\n end", "title": "" }, { "docid": "4ad1208a9b6d80ab0dd5dccf8157af63", "score": "0.5257024", "text": "def rails_controller_callbacks(&block)\n rails_controller_instance.run_callbacks(:process_action, &block)\n end", "title": "" }, { "docid": "fc88422a7a885bac1df28883547362a7", "score": "0.5248709", "text": "def pre_setup_actions\n @@pre_setup_actions ||= []\n end", "title": "" }, { "docid": "8945e9135e140a6ae6db8d7c3490a645", "score": "0.5244428", "text": "def action_awareness\n if action_aware?\n if !@options.key?(:allow_nil)\n if @required\n @allow_nil = false\n else\n @allow_nil = true\n end\n end\n if as_action != \"create\"\n @required = false\n end\n end\n end", "title": "" }, { "docid": "7b3954deb2995cf68646c7333c15087b", "score": "0.5239302", "text": "def after_setup\n end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.5235414", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.5235414", "text": "def action; end", "title": "" }, { "docid": "1dddf3ac307b09142d0ad9ebc9c4dba9", "score": "0.5230717", "text": "def external_action\n raise NotImplementedError\n end", "title": "" }, { "docid": "5772d1543808c2752c186db7ce2c2ad5", "score": "0.52270764", "text": "def actions(state:)\n raise NotImplementedError\n end", "title": "" }, { "docid": "64a6d16e05dd7087024d5170f58dfeae", "score": "0.5222752", "text": "def setup_actions(domain)\n\t\t\tpath_user = '/a/feeds/'+domain+'/user/2.0'\n\t\t\tpath_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n\t\t\tpath_group = '/a/feeds/group/2.0/'+domain # path for Google groups\n\n\t\t\taction = Hash.new\n\t\t\taction[:domain_login] = {:method => 'POST', :path => '/accounts/ClientLogin' }\n\t\t\taction[:user_create] = { :method => 'POST', :path => path_user }\n\t\t\taction[:user_retrieve] = { :method => 'GET', :path => path_user+'/' }\n\t\t\taction[:user_retrieve_all] = { :method => 'GET', :path => path_user } \n\t\t\taction[:user_update] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_rename] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_delete] = { :method => 'DELETE', :path => path_user +'/' }\n\t\t\taction[:nickname_create] = { :method => 'POST', :path =>path_nickname }\n\t\t\taction[:nickname_retrieve] = { :method => 'GET', :path =>path_nickname+'/' }\n\t\t\taction[:nickname_retrieve_all_for_user] = { :method => 'GET', :path =>path_nickname+'?username=' }\n\t\t\taction[:nickname_retrieve_all_in_domain] = { :method => 'GET', :path =>path_nickname }\n\t\t\taction[:nickname_delete] = { :method => 'DELETE', :path =>path_nickname+'/' }\n\t\t\taction[:group_create] = { :method => 'POST', :path =>path_group }\n\t\t\taction[:group_update] = { :method => 'PUT', :path =>path_group+'/' }\n\t\t\taction[:group_delete] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:groups_retrieve] = { :method => 'GET', :path =>path_group+'?member=' }\n\t\t\taction[:all_groups_retrieve] = { :method => 'GET', :path =>path_group }\n\t\t\taction[:membership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:membership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:membership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_members_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:ownership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:ownership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:ownership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_owners_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\n\t\t\t# special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n\t\t\taction[:next] = {:method => 'GET', :path =>nil }\n\t\t\treturn action \t\n\t\tend", "title": "" }, { "docid": "6350959a62aa797b89a21eacb3200e75", "score": "0.5222485", "text": "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "title": "" }, { "docid": "db0cb7d7727f626ba2dca5bc72cea5a6", "score": "0.52205867", "text": "def process_params\n set_params_authable if process_params_authable?\n set_params_ownerable if process_params_ownerable?\n set_params_sub_action\n end", "title": "" }, { "docid": "8d7ed2ff3920c2016c75f4f9d8b5a870", "score": "0.52127427", "text": "def pick_action; end", "title": "" }, { "docid": "7bbfb366d2ee170c855b1d0141bfc2a3", "score": "0.52127236", "text": "def proceed_with(action, *arguments)\n self.class.decouplings.each do |decoupler|\n decoupler.run_on(self, action, *arguments)\n end\n end", "title": "" }, { "docid": "78ecc6a2dfbf08166a7a1360bc9c35ef", "score": "0.520801", "text": "def define_action_helpers\n if action_hook\n @action_hook_defined = true\n define_action_hook\n end\n end", "title": "" }, { "docid": "6a98e12d6f15af80f63556fcdd01e472", "score": "0.5204501", "text": "def perform_setup\n ## Run global setup before example\n Alfred.configuration.setup.each do |setup|\n @request.perform_setup(&setup)\n end\n\n ## Run setup blocks for scenario\n setups.each { |setup| @request.perform_setup(&setup) }\n end", "title": "" }, { "docid": "2aba2d3187e01346918a6557230603c7", "score": "0.5204178", "text": "def ac_action(&blk)\n @action = blk\n end", "title": "" }, { "docid": "4c23552739b40c7886414af61210d31c", "score": "0.52039874", "text": "def execute_pre_setup_actions(test_instance,runner=nil)\n self.class.pre_setup_actions.each do |action|\n action.call test_instance\n end\n end", "title": "" }, { "docid": "d56f4ec734e3f3bc1ad913b36ff86130", "score": "0.52032334", "text": "def create_setup\n \n end", "title": "" }, { "docid": "691d5a5bcefbef8c08db61094691627c", "score": "0.5198697", "text": "def performed(action)\n end", "title": "" }, { "docid": "ad33138fb4bd42d9785a8f84821bfd88", "score": "0.51944995", "text": "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "title": "" }, { "docid": "ad33138fb4bd42d9785a8f84821bfd88", "score": "0.51944995", "text": "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "title": "" }, { "docid": "7fca702f2da4dbdc9b39e5107a2ab87d", "score": "0.51913106", "text": "def add_transition_callbacks\n %w(before after).each {|type| owner_class.define_callbacks(\"#{type}_transition_#{attribute}\") }\n end", "title": "" }, { "docid": "063b82c93b47d702ef6bddadb6f0c76e", "score": "0.5178707", "text": "def setup(instance)\n action(:setup, instance)\n end", "title": "" }, { "docid": "9f1f73ee40d23f6b808bb3fbbf6af931", "score": "0.51781213", "text": "def setup( *args )\n\t\t\tself.class.setupMethods.each {|sblock|\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\tend", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.5172379", "text": "def setup(resources) ; end", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.5172379", "text": "def setup(resources) ; end", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.5172379", "text": "def setup(resources) ; end", "title": "" }, { "docid": "7a0c9d839516dc9d0014e160b6e625a8", "score": "0.5163576", "text": "def setup(request)\n end", "title": "" }, { "docid": "e441ee807f2820bf3655ff2b7cf397fc", "score": "0.5152934", "text": "def after_setup; end", "title": "" }, { "docid": "1d375c9be726f822b2eb9e2a652f91f6", "score": "0.5142308", "text": "def before *actions, &proc\n actions = ['*'] if actions.size == 0\n actions.each { |a| @callbacks[:a][a] = proc }\n end", "title": "" }, { "docid": "2fcff037e3c18a5eb8d964f8f0a62ebe", "score": "0.51392764", "text": "def setup(params)\n end", "title": "" }, { "docid": "c594a0d7b6ae00511d223b0533636c9c", "score": "0.51391184", "text": "def code_action_provider; end", "title": "" }, { "docid": "faddd70d9fef5c9cd1f0d4e673e408b9", "score": "0.51387095", "text": "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "title": "" }, { "docid": "111fd47abd953b35a427ff0b098a800a", "score": "0.51351416", "text": "def setup\n make_notification_owner\n load_superusers\n admin_sets.each do |as|\n @logger.debug \"Attempting to make admin set for #{as}\"\n make_admin_set_from_config(as)\n end\n load_workflows\n everyone_can_deposit_everywhere\n give_superusers_superpowers\n end", "title": "" }, { "docid": "f2ac709e70364fce188bb24e414340ea", "score": "0.5115222", "text": "def setup_defaults\n add_help\n @handler = Cliqr::Util.forward_to_help_handler if @handler.nil? && help? && actions?\n @actions.each(&:setup_defaults)\n end", "title": "" }, { "docid": "3b4fb29fa45f95d436fd3a8987f12de7", "score": "0.51131564", "text": "def setup\n transition_to(:setup)\n end", "title": "" }, { "docid": "4c7a1503a86fb26f1e4b4111925949a2", "score": "0.51114494", "text": "def scaffold_setup_helper\n include ScaffoldingExtensions::Helper\n include ScaffoldingExtensions::MerbControllerHelper\n include ScaffoldingExtensions::PrototypeHelper\n include ScaffoldingExtensions::Controller\n include ScaffoldingExtensions::MerbController\n before :scaffold_check_nonidempotent_requests\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5107052", "text": "def action\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5107052", "text": "def action\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5107052", "text": "def action\n end", "title": "" }, { "docid": "63849e121dcfb8a1b963f040d0fe3c28", "score": "0.51055247", "text": "def perform_action(action, item)\n if action == :approve\n approve(item.fullid)\n elsif action == :remove\n remove(item.fullid)\n elsif action == :alert\n #perform_alert() check condition alert params and proceed\n else\n #something isn't cool, pass or error \n end\nend", "title": "" }, { "docid": "f04fd745d027fc758dac7a4ca6440871", "score": "0.5102995", "text": "def block_actions options ; end", "title": "" }, { "docid": "0d1c87e5cf08313c959963934383f5ae", "score": "0.50979155", "text": "def on_action(action)\n @action = action\n self\n end", "title": "" }, { "docid": "916d3c71d3a5db831a5910448835ad82", "score": "0.50949734", "text": "def do_action(action)\n case action\n when \"a\"\n @user_manager.create_user\n when \"b\"\n @user_manager.delete_user\n when \"c\"\n @user_manager.get_info\n when \"d\"\n @user_manager.list_all_users\n when \"quit\", \"exit\"\n bail\n end\n end", "title": "" }, { "docid": "076c761e1e84b581a65903c7c253aa62", "score": "0.5091706", "text": "def add_callbacks(base); end", "title": "" } ]
d18298b841ab84b98b88989d1623d648
Passes if actual's attribute values match the expected attributes hash. This works no matter how you define your attribute readers.
[ { "docid": "683ec70587d245407e64741331824f6c", "score": "0.7339407", "text": "def have_attributes(expected); end", "title": "" } ]
[ { "docid": "d0d8719239c51e90fc279f3f3c0f9e88", "score": "0.7259978", "text": "def attribute_match(attributes, expected)\n attributes.each do |attribute, value|\n assert (expected[attribute.intern] - value).abs <= 1\n end\n end", "title": "" }, { "docid": "70614cca49616d8819f4001d4d9f468f", "score": "0.7173738", "text": "def test_attribute_detection\n verify_method :is_attribute?, with: [\n {param: ' attr_reader :a', expect: true},\n {param: ' attr_accessor :a1', expect: true},\n {param: ' attr_writer :a_a', expect: true},\n {param: ' attr_reader :a?', expect: true},\n {param: ' attr_accessor :a-', expect: true},\n {param: ' def attr_accessor :a', expect: false},\n {param: ' attr_accessor = :a', expect: false}\n ]\n end", "title": "" }, { "docid": "68ddbf9d07783ca4a4eb769d6be98918", "score": "0.7067358", "text": "def check_attrs(attr_hash, obj)\n not_equal = []\n attr_hash.each do |attr_name, value|\n actual = obj.send(attr_name)\n next if value == actual\n\n not_equal << <<~MSG\n Attribute #{attr_name}\n Expected: \"#{value}\"\n Actual: \"#{actual}\"\n MSG\n end\n assert not_equal.empty?,\n <<~MSG\n The following attributtes are not equal:\n #{not_equal.join \"\\n\"}\n MSG\n end", "title": "" }, { "docid": "d62cedaf1f56ca0b1ea96a2fcf6ed8ad", "score": "0.6722061", "text": "def attr_match(cond)\n cond.each_pair { |k, v| return false unless v == @attributes[k.to_sym] || v == @attributes[k.to_s] }\n true\n end", "title": "" }, { "docid": "d643bd91c57a87ba75513fdeb7db3bff", "score": "0.6691928", "text": "def check_attribute_values(resource, class_type, name, additional_values = {})\n default_values = {:type => class_type.to_s, :name => name}\n values = default_values.merge(additional_values)\n expect(resource).to have_attributes(values)\n end", "title": "" }, { "docid": "f6a88c0f300806ebffbd4f1d32fac1e2", "score": "0.66671205", "text": "def valid_attributes_compare_down\n valid_attributes = Hash.new\n valid_attributes = {\n 'demographic_density' => true,\n 'fleet' => true,\n 'gini' => true,\n 'violence' => true,\n }\n end", "title": "" }, { "docid": "1aced998c398da45439affa0f1e0ab1c", "score": "0.6652913", "text": "def expected_for_diff\n if respond_to_failed\n matchers.an_object_having_attributes(\n @expected.select { |k, v| !@actual.respond_to?(k) }\n )\n else\n matchers.an_object_having_attributes(@expected)\n end\n end", "title": "" }, { "docid": "2b95575beb7637e7c4de063079b445d5", "score": "0.6629721", "text": "def check_attribute_values(resource, ems_ref, class_type, name = nil, additional_values = {})\n default_values = {:ems_ref => ems_ref, :type => class_type.to_s}\n default_values[:name] = name unless name.nil?\n values = default_values.merge(additional_values)\n expect(resource).to have_attributes(values)\n end", "title": "" }, { "docid": "7e0c67bd9ce99a855868fc55714c1f74", "score": "0.6629611", "text": "def valid_attributes_compare_up\n valid_attributes = Hash.new\n valid_attributes = {\n 'population' => true,\n 'area' => true,\n 'idh' => true,\n 'health' => true\n }\n end", "title": "" }, { "docid": "2647a88f2755a29d57494ba5446651cc", "score": "0.6618295", "text": "def assert_attributes(anEngine, attributes)\n attributes.each_pair do |attr_name, expected_val|\n msg = attr_name.to_sym()\n actual = anEngine.send(msg)\n error_msg = \"Expected #{expected_val} for #{attr_name}, actual was: #{actual}\"\n assert(actual == expected_val)\n end\n end", "title": "" }, { "docid": "4fea9cb3c340e04dd5d7692811ba473b", "score": "0.66042006", "text": "def it_should_default_attributes(hash_attribute_values)\n hash_attribute_values.each_pair do |a,v|\n it \"should default #{a} attribute to #{v}\" do\n class_or_instance.new.send(a).should == v\n end\n end\n end", "title": "" }, { "docid": "153b45ee9e17f104e42417688976c51c", "score": "0.6593856", "text": "def compare_attributes(attrs)\n\t\t\t\tattrs.each do |name, value|\n\t\t\t\t\tnext true if compare_attribute(name, value)\n\t\t\t\t\tbreak false\n\t\t\t\tend\n\t\t\tend", "title": "" }, { "docid": "a89f376baff343155bba7441d0c20479", "score": "0.6571388", "text": "def tolerant_match?(other, attributes)\n attributes.all? { |pa| Resource.tolerant_value_match?(send(pa), other.send(pa)) }\n end", "title": "" }, { "docid": "577029ebbf77720100f649312f5ed692", "score": "0.6554035", "text": "def ==(other)\n attrs == other.attrs\n end", "title": "" }, { "docid": "123c95069ddb6ca7fed67d05e3107f27", "score": "0.65493816", "text": "def check_hash(expected, actual)\n op = @should_match ? :'==' : :'!='\n\n unless actual.class.send(op, expected.class)\n @errors << MatchError.new(@parameter, expected, actual, !@should_match)\n return false\n end\n\n return false unless expected.keys.size.send(op, actual.keys.size)\n\n expected.keys.all? do |key|\n check(expected[key], actual[key])\n end\n end", "title": "" }, { "docid": "9066f054b53ee8c3e3f95f84046a6aaa", "score": "0.6513866", "text": "def ==(other)\n @attributes == other.instance_variable_get('@attributes')\n end", "title": "" }, { "docid": "1dc098d5c1f2d9c48851ad5e59445153", "score": "0.64956445", "text": "def same_attributes?(attr1,attr2)\n attr1.each do |k,v|\n if attr2.has_key?(k)\n a1v = v.value\n a2v = attr2[k].value\n if a1v != a2v\n return false\n end\n else\n return false\n end\n end\n # do it the other way so no key is left out\n attr2.each do |k,v|\n if !attr1.has_key?(k)\n return false\n end\n end\n return true\nend", "title": "" }, { "docid": "ff6e6b3382ccd825c0b42fb0a08afcac", "score": "0.6478742", "text": "def verify_that_saved_matches_fetched(expected, actual)\n expected.class.saved_nondomain_attributes.each do |pa|\n # available_quantity broken for spc type Not Specified; see quirk above.\n # TODO - Compare attributes that are fetched and set on create.\n prop = expected.class.property(pa)\n if verify_saved_attribute?(prop) then\n eval = expected.database.lazy_loader.suspend { expected.send(pa) }\n next if eval.nil_or_empty?\n aval = actual.send(pa)\n if eval.nil? then\n assert_nil(aval, \"#{expected.qp} was saved without a #{pa} value, but was stored in the database with value #{actual.qp}\")\n else\n assert_not_nil(aval, \"#{expected.qp} was saved with #{pa} value #{eval.qp}, but this value was not found in the database.\")\n if pa == :available_quantity and expected.specimen_type == 'Not Specified' and eval != aval then\n logger.warn(\"Skipped broken caTissue unspecified specimen type available comparison.\")\n else\n assert(Jinx::Resource.value_equal?(eval, aval), \"#{expected.qp} was saved with #{pa} value #{eval.qp} that does not match the database value #{aval.qp}\")\n end\n end\n end\n end\n verify_dependents_match(expected, actual)\n end", "title": "" }, { "docid": "873f18a48582ccf05c8541a4cdecedee", "score": "0.64716697", "text": "def have_attributes(*names)\n Matchers::Attributes.new(*names)\n end", "title": "" }, { "docid": "657c0eb268c34b6c2a898a1c6cf33dc0", "score": "0.6450632", "text": "def register_expected_attributes\n expected_attributes.each{|attr| self[attr] ||= nil }\n end", "title": "" }, { "docid": "d19c4976455231cf87e62f1db70e31b2", "score": "0.64158064", "text": "def test_attributes_2\n ds = Bio::NeXML::State.new( 'ds1', 'A' )\n ss = Bio::NeXML::State.new( 'ss1', '1' )\n\n ae1 = { :symbol => 'A' }\n ae2 = { :symbol => '1' }\n\n aa1 = @writer.send( :attributes, ds, :symbol )\n aa2 = @writer.send( :attributes, ss, :symbol )\n\n assert_equal ae1, aa1\n assert_equal ae2, aa2\n end", "title": "" }, { "docid": "3ae7c6508451d6e578a04f6d13cd63c8", "score": "0.6414406", "text": "def ==( other )\n other.kind_of?(Attribute) and other.name==name and other.value==value\n end", "title": "" }, { "docid": "cc4a5d1fc2b5e8ba2be5e4df99fc1787", "score": "0.6384828", "text": "def == other\n return false unless other.respond_to? :attrs\n self.attrs == other.attrs\n end", "title": "" }, { "docid": "f8e1b69d30dff048dad14cb91d21e627", "score": "0.63736427", "text": "def ==(other)\n other.attributes == @attributes\n end", "title": "" }, { "docid": "c4281a1fbab3115ca713d4f486b8b501", "score": "0.6372602", "text": "def attrs?(attrs)\n attrs.each { |k, v| return false unless send(k) == v }\n true\n end", "title": "" }, { "docid": "00d29aa100fdc00d5171b229fb1a37dd", "score": "0.6368555", "text": "def attr_equal?(o)\n self == o and\n self.instance_variables_compare(o).empty? and\n self.attributes == o.attributes\n end", "title": "" }, { "docid": "00d29aa100fdc00d5171b229fb1a37dd", "score": "0.6368555", "text": "def attr_equal?(o)\n self == o and\n self.instance_variables_compare(o).empty? and\n self.attributes == o.attributes\n end", "title": "" }, { "docid": "6c59827132384193cbe0ae738e25ccd0", "score": "0.6367901", "text": "def attr_equal?(arr)\n if ( (arr[0] == arr[1]) && (arr[0] == arr[2] ) )\n true\n else\n false\n end\n end", "title": "" }, { "docid": "0b7e67c55c3e0775443da81388f4c8eb", "score": "0.6361828", "text": "def eql_attributes?(other)\n return false if key != other.key\n return true if repository == other.repository && !dirty? && !other.dirty?\n\n loaded, not_loaded = properties.partition do |property|\n attribute_loaded?(property.name) && other.attribute_loaded?(property.name)\n end\n\n # check all loaded properties, and then all unloaded properties\n (loaded + not_loaded).all? { |p| p.get(self) == p.get(other) }\n end", "title": "" }, { "docid": "ffddef1f1e8396b4b5585b4a012694ed", "score": "0.6327639", "text": "def test_should_know_which_spec_attributes_belong_to_it\n assert_equal([@valid_attr_type.id]*2, @valid_attr_type.spec_attributes.collect {|s| s.attr_type_id})\n end", "title": "" }, { "docid": "93a1b2a29c1da00a4e501fdf0c09c108", "score": "0.6322617", "text": "def ==(other)\n self.class == other.class &&\n self.class.registered_attributes.keys.all? do |attr|\n send(attr) == other.send(attr)\n end\n end", "title": "" }, { "docid": "c24e4d9eceac12272f3caa18acff845d", "score": "0.63022715", "text": "def values_match?(expected, actual); end", "title": "" }, { "docid": "d26d2646508a6eeeb4b8abda71084812", "score": "0.62982225", "text": "def eql?(other)\n return true if self == other\n @@ATTRIBUTES.each do |att|\n return false unless self.send(att).eql?(other.send(att))\n end\n true\n end", "title": "" }, { "docid": "ed8b0d60df02fdf3dc26942f75e03dad", "score": "0.6290366", "text": "def verify_category_attributes\n category_families.keys.each do |key|\n cat = Category.find_by_name(key.to_s)\n a1 = cat.product_attributes.map {|a| a.name =~ /^attr(\\d*)/ ; Integer($1)}\n a2 = category_attributes[key]\n a1.sort.should == a2.sort\n end\n end", "title": "" }, { "docid": "12cc2c89c5c893ec5f4c20439e3a4b45", "score": "0.62721276", "text": "def attr?(name, expect = nil)\n name = name.to_s if name.is_a?(Symbol)\n if expect.nil?\n if @attributes.has_key? name\n true\n elsif self != @document\n @document.attributes.has_key? name\n else\n false\n end\n else\n if @attributes.has_key? name\n @attributes[name] == expect\n elsif self != @document && @document.attributes.has_key?(name)\n @document.attributes[name] == expect\n else\n false\n end\n end\n end", "title": "" }, { "docid": "681bd8984d054e36be4e2d01e63acbc2", "score": "0.62294066", "text": "def diff_attributes?\n ::FileUtils.mkdir_p(\"/var/lib/inspec_handler/cache/\") unless ::File.directory?(\"/var/lib/inspec_handler/cache/\")\n cache = ::File.open(\"/var/lib/inspec_handler/cache/attributes\", ::File::RDWR | ::File::CREAT, 750)\n cache_content = cache.read\n gen_attr = \"Default=> #{node.default.to_s} Override=> #{node.override.to_s}\"\n if !gen_attr.eql? cache_content then \n cache.close\n ::FileUtils.cp(\"/var/lib/inspec_handler/cache/attributes\", \"/var/lib/inspec_handler/cache/attributes.old\")\n cache = ::File.open(\"/var/lib/inspec_handler/cache/attributes\", ::File::RDWR | ::File::TRUNC | ::File::CREAT, 750)\n cache.write(gen_attr)\n Chef::Log.warn(\"#{@_string_mod_name} #{@_string_diff_attr_list}\")\n cache.close\n return true\n else\n return false\n end\n end", "title": "" }, { "docid": "80a7e0c45eca5367568740c1bd41459e", "score": "0.6225799", "text": "def test_attributes_7\n n1 = Bio::NeXML::Node.new 'n1'\n n2 = Bio::NeXML::Node.new 'n2'\n e = Bio::NeXML::IntEdge.new 'e1', :source => n1, :target => n2\n re = Bio::NeXML::RootEdge.new 're1', :target => n1, :length => 2\n\n ae1 = { :source => 'n1', :target => 'n2', :length => '0' }\n ae2 = { :target => 'n1', :length => '2' }\n\n aa1 = @writer.send( :attributes, e, :source, :target, :length )\n aa2 = @writer.send( :attributes, re, :source, :target, :length )\n\n assert_equal ae1, aa1\n assert_equal ae2, aa2\n end", "title": "" }, { "docid": "f1a980c2af89557db1bde727ee6b74c6", "score": "0.6209895", "text": "def ==(other)\n return attributes == other.attributes if other\n end", "title": "" }, { "docid": "50bb66f72958d3b8d51e49f1e7a893ce", "score": "0.620589", "text": "def ==(other)\n other.respond_to?(:attributes) ? (self.attributes == other.attributes) : false\n end", "title": "" }, { "docid": "f9262df96bb4bb9a23e6de3322fc71ba", "score": "0.6203128", "text": "def attr?(name, expect = nil, inherit = true)\n name = name.to_s if name.is_a?(Symbol)\n inherit = false if self == @document\n if expect.nil?\n @attributes.has_key?(name) || (inherit && @document.attributes.has_key?(name))\n elsif inherit\n expect == (@attributes[name] || @document.attributes[name])\n else\n expect == @attributes[name]\n end\n end", "title": "" }, { "docid": "c75c7972d231b9bed7cb43b392df5e95", "score": "0.6202208", "text": "def ==(other)\n !attributes.keys.map { |attribute| send(attribute) == other.send(attribute) }.include?(false)\n end", "title": "" }, { "docid": "c75c7972d231b9bed7cb43b392df5e95", "score": "0.6202208", "text": "def ==(other)\n !attributes.keys.map { |attribute| send(attribute) == other.send(attribute) }.include?(false)\n end", "title": "" }, { "docid": "0879f553f7ee3ffd86ce92a6f227a9f9", "score": "0.61826164", "text": "def test_attributes_6\n cc = Bio::NeXML::ContinuousCell.new\n cc.char = Bio::NeXML::Char.new( 'cc1' )\n cc.state = '-0.9'\n dc = Bio::NeXML::Cell.new\n dc.char = Bio::NeXML::Char.new( 'dc1', nil )\n dc.state = Bio::NeXML::State.new 'ds1', 'A'\n\n ae1 = { :char => 'cc1', :state => '-0.9' }\n ae2 = { :char => 'dc1', :state => 'ds1' }\n\n aa1 = @writer.send( :attributes, cc, :char, :state )\n aa2 = @writer.send( :attributes, dc, :char, :state )\n\n assert_equal ae1, aa1\n assert_equal ae2, aa2\n end", "title": "" }, { "docid": "aeb0602637957106028f87156d2b353f", "score": "0.6175964", "text": "def test_attributes_8\n ds = Bio::NeXML::States.new( 'ds1' )\n dc = Bio::NeXML::Char.new( 'dc1', :states => ds )\n\n ae = { :states => 'ds1' }\n\n aa = @writer.send( :attributes, dc, :states )\n\n assert_equal ae, aa\n end", "title": "" }, { "docid": "dcb729ae06ef3087c17f7cbc51f29d49", "score": "0.6175368", "text": "def ==(other)\n @@attributes.each do |name, default|\n return false unless self.send(name) == other.send(name)\n end\n true\n end", "title": "" }, { "docid": "1c74469a137a42b3793682bc2e350c2e", "score": "0.6171804", "text": "def ==(other)\n self.class.roxml_attrs.map(&:accessor).all? {|attr| send(attr) == other.send(attr) }\n end", "title": "" }, { "docid": "1c74469a137a42b3793682bc2e350c2e", "score": "0.6171804", "text": "def ==(other)\n self.class.roxml_attrs.map(&:accessor).all? {|attr| send(attr) == other.send(attr) }\n end", "title": "" }, { "docid": "a2b1ecbeede64d7faa863adf2b090bfd", "score": "0.61687607", "text": "def ==(other)\n return attributes == other if other.is_a?(Hash)\n\n other.class == self.class && other.attributes == attributes\n end", "title": "" }, { "docid": "87b5c5036c64de585842fb3ea19014f9", "score": "0.6160979", "text": "def ==(other)\n return false if other.class != self.class\n attr_hash == other.attr_hash\n end", "title": "" }, { "docid": "87b5c5036c64de585842fb3ea19014f9", "score": "0.6160979", "text": "def ==(other)\n return false if other.class != self.class\n attr_hash == other.attr_hash\n end", "title": "" }, { "docid": "b5f639c3c968a40b137e27c8623b3c97", "score": "0.61421406", "text": "def test_attributes_1\n otu1 = Bio::NeXML::Otu.new( 'o1', :label => 'otu 1' )\n otu2 = Bio::NeXML::Otu.new( 'o2' )\n\n ae1 = { :id => 'o1', :label => 'otu 1' }\n ae2 = { :id => 'o2' }\n\n aa1 = @writer.send( :attributes, otu1, :id, :label )\n aa2 = @writer.send( :attributes, otu2, :id, :label )\n\n assert_equal ae1, aa1\n assert_equal ae2, aa2\n end", "title": "" }, { "docid": "6d7cf2d43d411f69355fb28282d69e5f", "score": "0.61344165", "text": "def valid_attributes\n attributes.inject({}){|h,k| (v=self.send(k)) ? h.merge({k=>v}) : h }\n end", "title": "" }, { "docid": "c631efa57f80bc2c264311eaae3f8485", "score": "0.61286795", "text": "def valid_attribute? key\n attributes.include?(key)\n end", "title": "" }, { "docid": "cc9f6e12eb65fd134705ca1ed9e7149f", "score": "0.6127377", "text": "def attributes?()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "7fbd82108c195577f81ce7793ff6fb57", "score": "0.612662", "text": "def should_accept(attr, value)\n k=attr.to_sym\n with(valid_params_with({k => value}))[k].should == value\n end", "title": "" }, { "docid": "6116481353e0f0ca7013e10c66d7d724", "score": "0.6125173", "text": "def eql?(other)\n case\n when equal?(other)\n true\n when self.class != other.class, length != other.length\n false\n else\n other.attributes.each_pair do |key, value|\n return false unless attributes[key].eql?(value)\n end\n\n true\n end\n end", "title": "" }, { "docid": "88e34130ef83e2a6e4573662fb2caa2c", "score": "0.61228764", "text": "def attributes_valid?\n attributes.each do |key, value|\n next unless column_class = column_for(key.to_s)\n return false unless column_class.value_valid?(value)\n end\n end", "title": "" }, { "docid": "53c733b0ee13fea6ae8f7c6345fb7780", "score": "0.61201566", "text": "def check_attributes\n attributes_keys = Pod::Specification::DSL.attributes.keys.map(&:to_s)\n platform_keys = Specification::DSL::PLATFORMS.map(&:to_s)\n valid_keys = attributes_keys + platform_keys\n attributes_hash = consumer.spec.attributes_hash\n keys = attributes_hash.keys\n Specification::DSL::PLATFORMS.each do |platform|\n if attributes_hash[platform.to_s]\n keys += attributes_hash[platform.to_s].keys\n end\n end\n unknown_keys = keys - valid_keys\n\n unknown_keys.each do |key|\n results.add_warning('attributes', \"Unrecognized `#{key}` key.\")\n end\n\n Pod::Specification::DSL.attributes.each do |_key, attribute|\n declared_value = consumer.spec.attributes_hash[attribute.name.to_s]\n validate_attribute_occurrence(attribute, declared_value)\n validate_attribute_type(attribute, declared_value)\n if attribute.name != :platforms\n value = value_for_attribute(attribute)\n validate_attribute_value(attribute, value) if value\n end\n end\n end", "title": "" }, { "docid": "9921a2e3eb535c4cf143b07b3dce3aba", "score": "0.611147", "text": "def ruby_model_has_attributes(ruby_contents, attributes)\n attributes.each do |attribute|\n expect(ruby_contents.include?(attribute)).to be true\n end\n end", "title": "" }, { "docid": "2b6348600bc8dc3c22b9756b60357d75", "score": "0.61060315", "text": "def matches?(target)\n @errors = []\n @attrs.each do |attr, val|\n if target.include?(\"#{attr}=\\\"#{val}\\\"\")\n @errors << \"Should not include #{attr}=\\\"#{val}\\\", but was #{target}\"\n end\n end\n @errors.size == 0\n end", "title": "" }, { "docid": "f6c654620b822a071dfcbbce11ad570e", "score": "0.6097429", "text": "def matches? actual\n @actual = actual\n\n true\n end", "title": "" }, { "docid": "379fbd0b8433278d89e89d654519faaa", "score": "0.6094024", "text": "def assert_produces_object_with_attributes\n attrs = generate_attr_hash\n obj = yield attrs\n check_attrs(attrs, obj)\n end", "title": "" }, { "docid": "467fe2e833fe36a7e092d7ebe95a7dc5", "score": "0.6064557", "text": "def _test_attr # test_attr object attribute ?(label)\r\n obj_id, attribute = @operands\r\n\r\n branch (zobj obj_id).has_attribute? attribute\r\n end", "title": "" }, { "docid": "5da63d314d28525f4de5130bda90b9b2", "score": "0.60639644", "text": "def ==(other)\n return false unless other.is_a?(self.class)\n other.attributes == attributes\n end", "title": "" }, { "docid": "477daded5fe1fcf4833feef5d28df0b8", "score": "0.6052052", "text": "def valid_attribute?(attr_name)\n attribute_names.include?(attr_name)\n end", "title": "" }, { "docid": "d52d1042a4b5533455a8d5852ae59fd7", "score": "0.6051495", "text": "def eql?(other)\n self.class.attributes.each do |attr|\n return false unless send(attr).eql?(other.send(attr))\n end\n end", "title": "" }, { "docid": "bd69176b971e923f7cf61b38db34ad6a", "score": "0.6045455", "text": "def test_new_specification_should_not_be_valid_if_attribute_and_unit_are_different_attr_types\n\t\t@new_specification = Specification.new(\n :spec_value => @valid_specification.spec_value,\n :spec_attribute_id => spec_attributes(:height).id,\n :unit_id => units(:pound).id )\n assert !@new_specification.valid?\n\tend", "title": "" }, { "docid": "774a366b9f69fd65cf48be53dd57842f", "score": "0.60446745", "text": "def valid_attribute?(attr_name)\n attribute_names.include?(attr_name)\n end", "title": "" }, { "docid": "56d7ffc36d63da1532e44ef7acd79987", "score": "0.6036556", "text": "def attribute_check(attr1, attr2, attr3)\n result = (attr1 == attr2 && attr1 == attr3)\n result = result || (attr1 != attr2 && attr1 != attr3 && attr2 != attr3)\n result\n end", "title": "" }, { "docid": "58e53693bdbe8b620a79e4375b3d3663", "score": "0.6027833", "text": "def equality_with_same_attributes?\n left_equality? &&\n right_equality? &&\n same_attribute? &&\n constant_value?\n end", "title": "" }, { "docid": "8af77bfe9042ba58c41ea01817739a4d", "score": "0.6027488", "text": "def ==(other)\n kind == other.kind && attr_name == other.attr_name && options == other.options\n end", "title": "" }, { "docid": "2c9e911c7b1529136d4d1d8619f8382f", "score": "0.6025741", "text": "def ==(other)\n other.instance_of?(self.class) && attributes.eql?(other.attributes)\n end", "title": "" }, { "docid": "d04fd9387d2c470a43cd4a09e3b65f36", "score": "0.60246503", "text": "def test_all_attributes\n assert_equal(\n { :name => \"Name\", \n :age => \"Age\", \n :calorie_intake => \"% Daily value USDA recommended intake\", \n :auspicious_fortune => \"Auspicious fortune\", \n :zodiac_sign => \"Zodiac sign\"\n },\n @field_defs.all_attributes\n )\n end", "title": "" }, { "docid": "7658e95e7547faf0a2e4332e220cc609", "score": "0.6024393", "text": "def test_attributes_are_readable\n assert_equal @book.send(:id), @books.last.id\n assert_equal @more_book.send(:id), @more_books.first.id\n assert_equal @book.send(:title), 'The Fabric of the Cosmos'\n assert_equal @more_book.send(:title), 'Cosmos'\n assert_equal @book.send(:author), 'Brian Greene'\n assert_equal @more_book.send(:author), 'Carl Sagan'\n assert_raises(NoMethodError) { @book.send(:avoid)}\n assert_raises(NoMethodError) { @more_book.send(:noid)}\n end", "title": "" }, { "docid": "7e1cf03ada75c5c0c29ef78131b65d3c", "score": "0.6010848", "text": "def check_attributes\n self.class.type.property_names.each do |property|\n type_check_property(property) if @values.has_key?(property)\n end\n end", "title": "" }, { "docid": "bacb5a1114b33d820dd6eab0521a19c4", "score": "0.6005826", "text": "def strict_match\n @expected == @actual\n end", "title": "" }, { "docid": "6572792204e16457d44f514850696729", "score": "0.6003775", "text": "def ==(other)\n other.class == self.class && other.attributes == attributes\n end", "title": "" }, { "docid": "ed17b06b3f7a911afc65a30f00f8c4ed", "score": "0.59989595", "text": "def ==(other)\n other.is_a?(self.class) &&\n other.attribute == attribute &&\n other.validation == validation &&\n other.expected == expected &&\n other.actual == actual\n end", "title": "" }, { "docid": "c3ee427828f061e568b0a4123f436fe4", "score": "0.59805304", "text": "def assert_contained_attribute(**args)\n Bucky::Utils::BuckyLogger.write('assert_contained_attribute', args)\n part = @pages.get_part(args)\n verify_rescue { assert(part[args[:attribute]].include?(args[:expect]&.to_s), \"Not Contain Expected Attribute.\\nexpect: #{args[:expect].to_s.bg_green.black}\\nactual: #{part[args[:attribute]].to_s.bg_red.black}\") }\n end", "title": "" }, { "docid": "7327035197248a77ea60a1795b399815", "score": "0.5975159", "text": "def ==(other)\n return false if other.class != self.class\n hash_attr_diff(self) == hash_attr_diff(other)\n end", "title": "" }, { "docid": "d2d15c957a93da3bcb4477974ddbba97", "score": "0.5968312", "text": "def diff_attributes(other,&block)\n x = self.attribute_nodes\n y = other.attribute_nodes\n res = true\n x.each do |attri|\n if other[attri.name].nil?\n yield '-', attri if block\n res = false\n return res unless block\n elsif other[attri.name].eql?(attri.value)\n yield ' ', attri if block\n else\n yield '-', attri if block\n yield '+', other.attribute(attri.name) if block\n res = false\n return res unless block\n end \n end\n y.each do |attri|\n if self[attri.name].nil?\n yield '+', attri if block\n res = false\n return res unless block\n end \n end\n return res\n end", "title": "" }, { "docid": "d4a8874646f96ebd3234b19b3fb61165", "score": "0.59551364", "text": "def check_element_attribute(access_type, attribute_name, attribute_value, access_name, test_case)\n\t\n\tattr_val=get_element_attribute(access_type, access_name, attribute_name)\n\t\n\tif test_case\n\t\tif(attr_val!=attribute_value)\t\n\t\t\traise TestCaseFailed ,\"Attribute Value Not Matched\"\n\t\tend\n\telse\n\t\tif(attr_val==attribute_value)\t\n\t\t\traise TestCaseFailed ,\"Attribute Value Matched\"\n\t\tend\n\tend\nend", "title": "" }, { "docid": "7dd27b01c4fa85e9bd342450f349ed26", "score": "0.5954584", "text": "def it_should_verify_uniqueness_of(attrs)\n attrs.each_pair do |key, val|\n it \"should only allow one #{key}\" do\n item = model_class.new(valid_attributes)\n item.send(\"#{key}=\", val)\n item.save\n\n dupl = model_class.new(valid_attributes)\n dupl.send(\"#{key}=\", val)\n dupl.should_not be_valid\n end\n end\n end", "title": "" }, { "docid": "35f4c5d8fa9e863c01fcf1018e5daf18", "score": "0.5934088", "text": "def test_attr_protected\r\n [ :password, :password_confirmation, :password_salt, :password_hash_type ].each do |key|\r\n assert TestUser.attr_protected.include?(key)\r\n end\r\n end", "title": "" }, { "docid": "3be9d130750f101cd334afeae8f63aee", "score": "0.593159", "text": "def it_should_protect_attributes(*attributes)\n get_options!(attributes)\n klass = self.described_type\n\n attributes.each do |attribute|\n attribute = attribute.to_sym\n describe \"protects #{attribute} from mass updates\" do\n protected = klass.protected_attributes || []\n accessible = klass.accessible_attributes || []\n\n it \"should be protected\" do\n (protected.include?(attribute.to_s) ||\n (!accessible.empty? && !accessible.include?(attribute.to_s))).should be_true\n end \n end\n end\n end", "title": "" }, { "docid": "0ea4620bb37ae06c40397f9cfad632f2", "score": "0.59128743", "text": "def should_have_readonly_attributes(*attributes)\n get_options!(attributes)\n\n attributes.each do |attribute|\n matcher = have_readonly_attribute(attribute)\n should matcher.description do\n assert_accepts matcher, subject\n end\n end\n end", "title": "" }, { "docid": "5843e8083318bfb62569fe51c9537f3b", "score": "0.5909757", "text": "def compare_meta_attributes(is, should)\n return unless is.is_a?(Hash) && should.is_a?(Hash)\n is_without_state = is.reject do |k, _v|\n pacemaker_options[:status_meta_attributes].include? k.to_s\n end\n should_without_state = should.reject do |k, _v|\n pacemaker_options[:status_meta_attributes].include? k.to_s\n end\n result = is_without_state == should_without_state\n debug \"compare_meta_attributes: #{result}\"\n result\n end", "title": "" }, { "docid": "e15d0adf1505afdf7827114bba8b8ef2", "score": "0.5908259", "text": "def test_it_has_readable_attributes\n # create the queen of diamonds\n card = Card.new(:diamond, 'Queen', 12)\n # Check that the card's attributes are readable and correct\n assert_equal :diamond, card.suit\n assert_equal 'Queen', card.value\n assert_equal 12, card.rank\n end", "title": "" }, { "docid": "05e786f8d6ccefea8e47f5c327a3413d", "score": "0.59071016", "text": "def ==(other)\n self.class == other.class && attributes == other.attributes\n end", "title": "" }, { "docid": "33cc05dc7d2e4bd44018ea59210f4939", "score": "0.5905695", "text": "def valid_attributes\n # check basic correctnes of input hash\n ATTRIBUTES.each { |attr| return false unless @post_data.keys.include? attr }\n # check \"data\" attribute to contain 2 elements, as stated in task description\n data = @post_data[\"data\"]\n return false unless data.is_a?(Array) && data.size == INPUT_OBJECTS_COUNT\n # check \"data\" array to contain valid data\n data.each do |h|\n next if valid_data_hash? h\n return false\n end\n # input data is valid enough to process it\n true\n end", "title": "" }, { "docid": "123d0591937c3c1f95ada79b5d45962e", "score": "0.589999", "text": "def valid?\n MANDATORY_ATTRIBUTES.each{|a| return false unless self[a]}\n true\n end", "title": "" }, { "docid": "123d0591937c3c1f95ada79b5d45962e", "score": "0.589999", "text": "def valid?\n MANDATORY_ATTRIBUTES.each{|a| return false unless self[a]}\n true\n end", "title": "" }, { "docid": "842b2e858ce3036281e06de480b1c0ef", "score": "0.5897905", "text": "def valid_attributes\n { \"guid\" => \"xxxxx\",\n \"title\" => \"xxxxx\",\n \"content_raw\" => \"xxxxx\",\n \"content_hash\" => \"MyString\",\n \"user_id\" => \"1\"}\n end", "title": "" }, { "docid": "7873b461f0b5619dfbe725311b8f70af", "score": "0.5890491", "text": "def eql?(other)\n self.class.attributes.all?{|attr| send(attr).eql?(other.send(attr))}\n end", "title": "" }, { "docid": "bc381d220261d0c14294b0afffdd2a1a", "score": "0.5885298", "text": "def attrib_bits_valid; end", "title": "" }, { "docid": "3f622b925ceb3a0f124640194f3c022e", "score": "0.5885282", "text": "def should_have_readonly_attributes(*attributes)\n get_options!(attributes)\n klass = model_class\n\n attributes.each do |attribute|\n matcher = have_readonly_attribute(attribute)\n should matcher.description do\n assert_accepts matcher, klass.new\n end\n end\n end", "title": "" }, { "docid": "dac32f831b94fe128cf9695c2f22bd6c", "score": "0.5874921", "text": "def has_attributes(node, string)\n if node.nil?\n raise \"your xml node is nil!!!\"\n end\n if node == []\n raise \"you gave me an empty array instead of a node\"\n end\n # strips the tail end quote mark, also\n string.strip!\n string.chomp!('\"')\n string.split(/\"\\s+/).each do |str|\n (key,val) = str.split('=',2)\n val=val[1..-1] if val[0,1] == '\"' \n if node[key] != val\n puts \"FAILING\"\n puts \"EXPECT: #{key} => #{val} ACTUAL => #{val}\"\n puts \"NODE KEYS: \"\n p node.keys\n puts \"NODE VALUES: \"\n p node.values\n end\n node[key].should == val\n end\n end", "title": "" }, { "docid": "73d9287e18ce69c49198d0276c477e88", "score": "0.5873665", "text": "def test_attributes_4\n o = Bio::NeXML::Otu.new( 'o1' )\n n1 = Bio::NeXML::Node.new( 'n1', :otu => o, :root => true )\n n2 = Bio::NeXML::Node.new( 'n2' )\n\n ae1 = { :otu => 'o1', :root => 'true' }\n ae2 = {}\n\n aa1 = @writer.send( :attributes, n1, :otu, :root )\n aa2 = @writer.send( :attributes, n2, :otu, :root )\n\n assert_equal ae1, aa1\n assert_equal ae2, aa2\n end", "title": "" }, { "docid": "1c34b5931b58e8734ca996d9d168b4b9", "score": "0.5869114", "text": "def assert_models_match(model1, model2)\n clazz = model1.class\n attributes = clazz.attr_accessible[:default]\n \n attributes.each do |attribute|\n if attribute.size > 0\n assert_equal model1.send(attribute),model2.send(attribute), \n \"#{model1} compared to #{model2} but failed\"\n end \n end\n end", "title": "" }, { "docid": "319a3a450dd9ecea8d2d82c7a2b61adb", "score": "0.5858515", "text": "def attribute_allowed?(attr)\n opts.fetch(:all_attributes, config[:all_attributes], allowed_attributes.include?(attr))\n end", "title": "" } ]
ceadcdd6414ef282b538cb6bb3ba56aa
containing values (integers) and operations must be performed in order they appear in the string OUTPUT: the result of the operations only if the print command is given in the input string this is a stand alone program, the register would not be passed to anything else RULES: this program is a minilanguage running from a stack (array contaning integer values) and a register that stores a value the register will be initialized at 0 the stack will be initialized as an empty array all program inputs will be correct start with a set of defined commands that will be part of the input program strings ALGORITHM initialize empty stack initialize register at 0 split program string into program_array iterate over program_array for each command run the appropriate routine (method)
[ { "docid": "09a74dbcd2f1d7c436191140b1d38942", "score": "0.0", "text": "def number?(string)\n string.to_i.to_s == string \nend", "title": "" } ]
[ { "docid": "66a288cbb0562d1cb65c3406952a256d", "score": "0.6688904", "text": "def run_program(intcode_program)\n program = intcode_program.clone.map(&:clone)\n\n i = 0\n until program[i] == 99\n puts program[i]\n instruction = program[i].to_s.rjust(4, '0').split('')\n\n res = program[i+3]\n\n opcode = instruction[2..3].join.to_i\n x = instruction[1] == \"0\" ? program[program[i+1]] : program[i+1]\n y = instruction[0] == \"0\" ? program[program[i+2]] : program[i+2]\n\n if opcode == 1\n program[res] = add(x, y)\n i += 4\n elsif opcode == 2\n program[res] = multiply(x, y)\n i += 4\n elsif opcode == 3 \n puts \"Enter a number to be saved at address #{program[i+1]}:\"\n program[program[i+1]] = gets.chomp.to_i\n i += 2\n elsif opcode == 4\n puts \"Value at address #{program[i+1]}: #{program[program[i+1]]}\"\n i += 2\n elsif opcode == 5\n if x != 0 \n i = y \n else\n i += 3\n end\n elsif opcode == 6\n if x == 0\n i = y \n else\n i += 3\n end\n elsif opcode == 7\n program[res] = x < y ? 1 : 0\n i += 4\n elsif opcode == 8\n program[res] = x == y ? 1 : 0\n i += 4\n end\n end\n program[0]\nend", "title": "" }, { "docid": "defb396cd8acaacf4a6b90ea60cb8212", "score": "0.6511722", "text": "def minilang(command_string)\n stack = []\n register = 0\n \n command_string.split.each do |command|\n case\n when command == 'PUSH'\n stack << register\n when command == 'ADD'\n register = (register + stack.pop)\n when command == 'SUB'\n register = (register - stack.pop)\n when command == 'MULT'\n register = (register * stack.pop)\n when command == 'DIV'\n register = (register / stack.pop)\n when command == 'MOD'\n register = (register % stack.pop)\n when command == 'POP'\n register = stack.pop\n when command == 'PRINT'\n puts register\n else\n register = command.to_i\n end\n end\nend", "title": "" }, { "docid": "d0e696326172bd6bb89cccd921252394", "score": "0.6502949", "text": "def minilang(program)\n stack = []\n register = 0\n \n program.split.each do |command|\n case\n when command == \"PUSH\"\n stack.push(register)\n when command == \"ADD\"\n return p \"Empty stack error.\" if stack.empty?\n # I don't like the repetitive nature of this error check,\n # but I don't want to go down a rabbit hole right now.\n register += stack.pop\n when command == \"SUB\"\n return p \"Empty stack error.\" if stack.empty?\n register -= stack.pop\n when command == \"MULT\"\n return p \"Empty stack error.\" if stack.empty?\n register *= stack.pop\n when command == \"DIV\"\n return p \"Empty stack error.\" if stack.empty?\n register /= stack.pop\n when command == \"MOD\"\n return p \"Empty stack error.\" if stack.empty?\n register %= stack.pop\n when command == \"POP\"\n return p \"Empty stack error.\" if stack.empty?\n register = stack.pop\n when command == \"PRINT\"\n p register\n when !!(command =~ /\\A[-+]?[0-9]+\\z/) # error checking for integer string\n register = command.to_i # this was originally the else condition, but added error checking for further exploration\n else\n p \"Invalid command prompt.\"\n return\n end\n end\nend", "title": "" }, { "docid": "28ba833d627ee6dbeb0826a950ede8f5", "score": "0.64841986", "text": "def minilang(string)\n register = 0\n stack = []\n return nil if string == ''\n\n program = string.split\n\n program.each_with_index do |method, index|\n if %w(PUSH POP SUB MULT DIV MOD PRINT ADD).include?(method) == false &&\n method.to_i.to_s != method\n puts \"invalid program input number #{index + 1}\"\n return nil\n\n else\n case method\n when 'PUSH'\n stack.push(register)\n when 'POP'\n register = stack.popf\n when 'SUB'\n register = register - stack.pop\n when 'MULT'\n register = register * stack.pop\n when 'DIV'\n register = register/stack.pop\n when 'MOD'\n register = register % stack.pop\n when 'PRINT'\n puts register\n when 'ADD'\n register = stack.pop + register\n else\n register = method.to_i\n end\n # puts \"register = #{register}; stack = #{stack}\"\n end\n end\nend", "title": "" }, { "docid": "aaeee93a8983f91605fc90b9875267f1", "score": "0.64714396", "text": "def run_program(registers, instructions)\n i = 0\n while i < instructions.length\n instr, arg0, arg1 = instructions[i].split\n case instr\n when \"cpy\"\n registers[arg1] = registers[arg0] != nil ? registers[arg0] : arg0.to_i\n when \"inc\"\n registers[arg0] += 1\n when \"dec\"\n registers[arg0] -= 1\n when \"jnz\"\n if registers[arg0] != 0 || arg0.to_i != 0\n i += arg1.to_i == 0 ? registers[arg1] : arg1.to_i\n next\n end\n when \"tgl\"\n affected_instruction = i + registers[arg0]\n if affected_instruction < instructions.length\n target, t_arg0, t_arg1 = instructions[affected_instruction].split\n if t_arg1 == nil\n instructions[affected_instruction] = target == \"inc\" ? \"dec #{t_arg0}\" : \"inc #{t_arg0}\"\n else\n instructions[affected_instruction] = target == \"jnz\" ? \"cpy #{t_arg0} #{t_arg1}\" : \"jnz #{t_arg0} #{t_arg1}\"\n end\n end\n end\n i += 1\n end\nend", "title": "" }, { "docid": "cea55138dd55e0d53ce14795efddbf32", "score": "0.6370384", "text": "def minilang(commands)\n @register = 0\n @stack = []\n\n def push\n @stack << @register.to_s\n end\n\n def add\n @register += @stack.pop.to_i\n end\n\n def sub\n @register -= @stack.pop.to_i\n end\n\n def mult\n @register *= @stack.pop.to_i\n end\n\n def div\n @register /= @stack.pop.to_i\n end\n\n def mod\n @register %= @stack.pop.to_i\n end\n\n def pop\n @register = @stack.pop.to_i\n end\n\n def print\n puts @register.to_s\n end\n\n commands.downcase.split.each do |command|\n if /\\d/ =~ command\n @register = command.to_i\n next\n end\n\n eval command\n end\n\n puts \"---\"\nend", "title": "" }, { "docid": "0d24c47cb868fc455b062367200df8ad", "score": "0.6369851", "text": "def minilang(program)\n stack = []\n register = 0\n program.split.each do |token|\n case token \n when 'ADD' then register += stack.pop\n when 'DIV' then register /= stack.pop \n when 'MULT' then register *= stack.pop \n when 'MOD' then register %= stack.pop \n when 'SUB' then register -= stack.pop \n when 'PUSH' then stack.push(register)\n when 'POP' then register = stack.pop\n when 'PRINT' then puts register \n else register = token.to_i \n end \n end\nend", "title": "" }, { "docid": "64c1dbbb3c6ffc73f4b48a9a58d2b0c5", "score": "0.63642985", "text": "def minilang(program)\n stack = []\n register = 0\n program.split.each do |token|\n case token\n when 'ADD' then register += stack.pop\n when 'DIV' then register /= stack.pop\n when 'MULT' then register %= stack.pop\n when 'MOD' then register -= stack.pop\n when 'SUB' then register -= stack.pop\n when 'PUSH' then stack.push(register)\n when 'POP' then register = stack.pop\n when 'PRINT' then puts register\n else register = token.to_i\n end\n end\nend", "title": "" }, { "docid": "60d444b0006153126421f663a05293c9", "score": "0.63537836", "text": "def minilang(program)\n stack = []\n register = 0\n program.split.each do |token|\n case token\n when 'ADD' then register += stack.pop\n when 'DIV' then register /= stack.pop\n when 'MULT' then register *= stack.pop\n when 'MOD' then register %= stack.pop\n when 'SUB' then register -= stack.pop\n when 'PUSH' then stack.push(register)\n when 'POP' then register = stack.pop\n when 'PRINT' then puts register\n else register = token.to_i\n end\n end\nend", "title": "" }, { "docid": "60d444b0006153126421f663a05293c9", "score": "0.6353459", "text": "def minilang(program)\n stack = []\n register = 0\n program.split.each do |token|\n case token\n when 'ADD' then register += stack.pop\n when 'DIV' then register /= stack.pop\n when 'MULT' then register *= stack.pop\n when 'MOD' then register %= stack.pop\n when 'SUB' then register -= stack.pop\n when 'PUSH' then stack.push(register)\n when 'POP' then register = stack.pop\n when 'PRINT' then puts register\n else register = token.to_i\n end\n end\nend", "title": "" }, { "docid": "612bd30939d810e5a13f6579078cdce0", "score": "0.6351971", "text": "def minilang(program)\n stack = []\n register = 0\n tokens = program.split\n\n tokens.each do |token|\n return puts \"ERROR: #{token} is not a valid token\" unless valid_token?(token)\n return puts \"ERROR: Empty stack\" if stack.empty? && %w(ADD SUB MULT DIV MOD POP).include?(token)\n\n stack, register = execute_command(token, stack, register)\n end\n nil\nend", "title": "" }, { "docid": "7a35d260cc8694befcd9f46b1d15925e", "score": "0.63351274", "text": "def minilang(program)\n stack = []\n register = 0\n program.split.each do |token|\n case token\n when 'ADD' then register += stack.pop\n when 'DIV' then register /= stack.pop\n when 'MULT' then register *= stack.pop\n when 'MOD' then register %= stack.pop\n when 'SUB' then register -= stack.pop\n when 'PUSH' then stack.push(register)\n when 'POP' then register = stack.pop\n when 'PRINT' then puts register\n else register = token.to_i\n end\n end\nend", "title": "" }, { "docid": "0960fcb48b8830934921e1ef607fe736", "score": "0.62851006", "text": "def minilang(commands)\n register = 0\n stack = []\n instructions = commands.split \n \n for instruction in instructions\n case instruction\n when 'PUSH' then stack << register\n when 'POP' then register = stack.pop\n when 'ADD' then register += stack.pop\n when 'SUB' then register -= stack.pop\n when 'MULT' then register *= stack.pop\n when 'DIV' then register /= stack.pop\n when 'MOD' then register %= stack.pop\n when 'PRINT' then puts register\n else register = instruction.to_i\n end\n end\nend", "title": "" }, { "docid": "69b1281adcffc9a3e40c1b66875ce244", "score": "0.62638193", "text": "def minilang(string)\n register = 0\n stack = []\n commands_list = string.split\n commands_list.each do |command|\n case command\n when \"PUSH\" then stack << register\n when \"ADD\" then register = register + stack.pop\n when \"SUB\" then register = register - stack.pop\n when \"MULT\" then register = register * stack.pop\n when \"DIV\" then register = register / stack.pop\n when \"MOD\" then register = register % stack.pop\n when \"POP\" then register = stack.pop\n when \"PRINT\" then puts register\n else register = command.to_i\n end\n end\nend", "title": "" }, { "docid": "e96e7fbf680bcd5dfd1ff2dcc3554db7", "score": "0.6252388", "text": "def minilang(commands)\n orders = commands.split(' ')\n register = 0\n stack = []\n \n orders.each do |command|\n case command\n when command.to_i.to_s then register = command.to_i\n when 'PUSH' then stack << register\n when 'ADD' then register += stack.pop\n when 'SUB' then register -= stack.pop\n when 'MULT' then register *= stack.pop\n when 'DIV' then register /= stack.pop\n when 'MOD' then register %= stack.pop\n when 'POP' then register = stack.pop\n when 'PRINT' then puts register\n end\n end\n \n p stack\n p register\nend", "title": "" }, { "docid": "6ec233854132fab134b572011980b251", "score": "0.62352884", "text": "def minilang(string)\n stack = []\n register = 0\n command_idx = 0\n \n string.split(\" \").each do |command|\n case command\n when 'PUSH' then stack.push(register)\n when 'ADD' then register += stack.pop\n when 'SUB' then register -= stack.pop\n when 'MULT' then register *= stack.pop\n when 'DIV' then register /= stack.pop\n when 'MOD' then register %= stack.pop\n when 'POP' then register = stack.pop\n when 'PRINT' then puts register\n else register = command.to_i\n end\n end\nend", "title": "" }, { "docid": "b2d915d7dd3d472b0841dd79cda9230c", "score": "0.62337685", "text": "def minilang(str)\n register = 0\n stack = []\n \n str.split.each do |command|\n case command\n when /[0-9]/ then register = command.to_i\n when 'ADD' then register = register + stack.pop \n when 'PUSH' then stack << register \n when 'SUB' then register = register - stack.pop \n when 'MULT' then register = register * stack.pop \n when 'DIV' then register = register / stack.pop \n when 'MOD' then register = register % stack.pop \n when 'POP' then register = stack.pop\n when 'PRINT' then puts register\n end\n end\nend", "title": "" }, { "docid": "27275cf14d8c6778077f7eba5247bc63", "score": "0.6224121", "text": "def minilang(program)\n register = 0\n stack = []\n program.split.each_with_object(nil) do |token, _|\n case token\n when /[0-9]/ then register = token.to_i\n when 'PUSH' then stack.push(register)\n when 'ADD'\n stack.empty? ? (return('Stack is empty!')) : register += stack.pop\n when 'SUB'\n stack.empty? ? (return('Stack is empty!')) : register -= stack.pop\n when 'MULT'\n stack.empty? ? (return('Stack is empty!')) : register *= stack.pop\n when 'DIV'\n stack.empty? ? (return('Stack is empty!')) : register /= stack.pop\n when 'MOD'\n stack.empty? ? (return('Stack is empty!')) : register %= stack.pop\n when 'POP'\n stack.empty? ? (return('Stack is empty!')) : register = stack.pop\n when 'PRINT' then puts register\n else\n return 'Invalid token!'\n end\n end\nend", "title": "" }, { "docid": "c94a54040cdf8c275d5d3049bb55591d", "score": "0.6222107", "text": "def execute(program=nil, input=nil)\n\t\tif program\n\t\t\tself.ram = program\n\t\t\t@op_ptr = 0\n\t\tend\n\t\t@input << input if input\n\t\t@output_result = nil\n\n\t\tloop do\n\t\t\tnext_op_ptr = 4\n\t\t\tinstruction = Instruction.new(ram[@op_ptr], @op_ptr)\n\t\t\t@op_count += 1\n\t\t\ta = [ addr(instruction.p1, @op_ptr + 1),\n\t\t\t\t\taddr(instruction.p2, @op_ptr + 2),\n\t\t\t\t\taddr(instruction.p3, @op_ptr + 3)\n\t\t\t\t]\n\t\t\t@v = [ ram[a[0]] , ram[a[1]], ram[a[2]] ]\n\t\t\t@v1 = ram[a[0]]\n\t\t\t@v2 = ram[a[1]]\n\t\t\t@v3 = ram[a[2]]\nputs 'i: %d %p refs: %s vals: %s,%s,%s rbase: %s' % [@op_count, instruction, a.join(','), @v1, @v2, @v3, @relative_base]\n\n\t\t\tcase instruction.opcode\n\t\t\twhen 1\n\t\t\t\tram[a[2]] = @v1 + @v2\n\t\t\twhen 2\n\t\t\t\tram[a[2]] = @v1 * @v2\n\t\t\twhen 3\n\t\t\t\tnext_op_ptr = op_input(a)\n\t\t\t\treturn @output_result if next_op_ptr == 0\n\t\t\twhen 4\n\t\t\t\tnext_op_ptr = op_output(instruction)\n\t\t\twhen 5\n\t\t\t\tif @v1 != 0\n\t\t\t\t\t@op_ptr = @v2\n\t\t\t\t\tnext\n\t\t\t\tend\n\t\t\t\tnext_op_ptr = 3\n\t\t\twhen 6\n\t\t\t\tif @v1 == 0\n\t\t\t\t\t@op_ptr = @v2\n\t\t\t\t\tnext\n\t\t\t\tend\n\t\t\t\tnext_op_ptr = 3\n\t\t\twhen 7\n\t\t\t\tvalue = @v1 < @v2 ? 1 : 0\n\t\t\t\tram[a[2]] = value\n\t\t\twhen 8\n\t\t\t\tvalue = @v1 == @v2 ? 1 : 0\n\t\t\t\tram[a[2]] = value\n\t\t\twhen 9\n\t\t\t\t@relative_base += @v1\n\t\t\t\tnext_op_ptr = 2\n\t\t\twhen 99\n\t\t\t\t@halted = true\n\t\t\t\tbreak\n\t\t\telse\n\t\t\t\traise \"Bad opcode #{opcode}\"\n\t\t\tend\n\t\t\t@op_ptr += next_op_ptr\n\t\tend\n\t\t@output_result.to_i\n\tend", "title": "" }, { "docid": "b831ba538eee61f50c0d2aac40020842", "score": "0.6221203", "text": "def minilang(commands)\n register = 0\n stack = []\n\n commands_arr = commands.split\n \n commands_arr.each do |command|\n case \n when command.to_i.to_s == command\n register = command.to_i\n when command == 'PUSH'\n stack << register\n when command == 'ADD'\n register += stack.pop\n when command == 'SUB'\n register -= stack.pop\n when command == 'MULT'\n register *= stack.pop\n when command == 'DIV'\n register /= stack.pop\n when command == 'MOD'\n register %= stack.pop\n when command == 'POP'\n register = stack.pop\n when command == 'PRINT'\n puts register\n end\n end\nend", "title": "" }, { "docid": "29f3a8de70d264d31e704e7c3ee1266a", "score": "0.62177026", "text": "def minilang(str)\n stack = []\n register = 0\n\n str.split.each do |command|\n case command\n when 'PUSH' then stack << register\n when 'ADD' then register += stack.pop\n when 'SUB' then register -= stack.pop\n when 'MULT' then register *= stack.pop\n when 'DIV' then register /= stack.pop\n when 'MOD' then register %= stack.pop\n when 'POP' then register = stack.pop\n when 'PRINT' then puts register\n else register = command.to_i\n end\n end\n\nend", "title": "" }, { "docid": "56a382f9d0b5aad977eca6148d24ae2e", "score": "0.6204974", "text": "def equation_printer(equation_string)\n operators = []\n program = []\n return \"invalid input\" unless valid?(equation_string)\n equation = equation_processor(equation_string)\n equation.each do |string|\n if string == '('\n next\n elsif OPS.keys.include?(string)\n program << 'PUSH'\n operators << OPS[string]\n elsif string == ')'\n program << operators.pop\n else\n program << string\n end\n end\n program << operators.pop until operators.empty?\n program << 'PRINT'\n program.join(' ')\nend", "title": "" }, { "docid": "1573840c234e2e49150df0ad1cf49683", "score": "0.620431", "text": "def minilang(command)\n register = 0\n stack = []\n \n command.split.each do |operation|\n case operation\n when /['0-9']/ then register = operation.to_i\n when 'PUSH' then stack << register\n when 'ADD' then register += stack.pop\n when 'SUB' then register -= stack.pop\n when 'MULT' then register *= stack.pop\n when 'DIV' then register /= stack.pop\n when 'MOD' then register %= stack.pop\n when 'POP' then register = stack.pop\n when 'PEEK' then puts stack.last\n when 'PRINT' then puts register \n end\n end\n # puts \"Register value = #{register}.\"\n # puts \"Stack Array = #{stack}.\"\nend", "title": "" }, { "docid": "c1c998e6bbee15ff1b4d8bd9a2d19381", "score": "0.6202664", "text": "def minilang(str)\n stack = []\n register = 0\n\n str.split.each do |command|\n case command\n when 'PUSH' then stack.push(register)\n when 'ADD' then register += stack.pop\n when 'SUB' then register -= stack.pop\n when 'MULT' then register *= stack.pop\n when 'DIV' then register /= stack.pop\n when 'MOD' then register %= stack.pop\n when 'POP' then register = stack.pop\n when 'PRINT' then puts register\n else register = command.to_i\n end\n end\nend", "title": "" }, { "docid": "ba33a96b25467f5c91982dc7d041882f", "score": "0.6166836", "text": "def minilang(commands)\n stack = []\n register = 0\n commands.split.each do |command|\n case command\n when 'PRINT'then puts register\n when 'PUSH' then stack.push(register)\n when 'POP' then register = stack.pop\n when 'ADD' then register += stack.pop\n when 'SUB' then register -= stack.pop\n when 'MULT' then register *= stack.pop\n when 'DIV' then register /= stack.pop\n when 'MOD' then register %= stack.pop\n else register = command.to_i\n end \n end\nend", "title": "" }, { "docid": "75ec0e347c12b50a37cacd71fe0f1594", "score": "0.6165994", "text": "def minilang(input)\n stack = []\n register = 0\n\n input.split.each do |command|\n if command.to_i.to_s == command\n register = command.to_i\n else\n case command\n when \"PUSH\"\n stack.push(register)\n when \"ADD\"\n register += stack.pop\n when \"SUB\"\n register -= stack.pop\n when \"MULT\"\n register *= stack.pop\n when \"DIV\"\n register /= stack.pop\n when \"MOD\"\n register %= stack.pop\n when \"POP\"\n register = stack.pop\n when \"PRINT\"\n puts register\n end\n end\n end\nend", "title": "" }, { "docid": "524cdf6235a00a64405eed06b5c7bb84", "score": "0.61456335", "text": "def perform(my_array)\n my_array.each do |string|\n if operand_or_operator(string)\n operator_stack_gestion(string)\n elsif string == \"(\"\n @operator_stack << string\n elsif string == \")\"\n until @operator_stack.last == \"(\"\n @array_output << @operator_stack.pop\n end\n @operator_stack.pop\n else\n @array_output << string\n end\n end\n output_print\n end", "title": "" }, { "docid": "b58845ec599d9d83ee960eee5ba7c576", "score": "0.6107354", "text": "def runCode (operationalString)\n\n #First, run the code with operationalString\n @jStdIn.print (operationalString)\n @jStdIn.print (\"System.out.println(\\\"\" + @options['OUTPUTCATCH'] + \"\\\");\\n\")\n @jStdIn.print (\"System.err.println(\\\"\" + @options['OUTPUTCATCH'] + \"\\\");\\n\")\n @jStdIn.flush()\n\n #Gather results from both STDIN and STDOUT\n output1 = ''\n stdOut = ''\n stdErr = ''\n\n #Reads Standard out and std error\n\n #Reads standard out until the string catch is called\n output1 = @jStdOut.readline;\n\n while !output1.include? (@options['OUTPUTCATCH'])\n stdOut+= output1\n output1 = @jStdOut.readline;\n end\n\n #Reads standard error until the string catch is called\n output1 = @jStdErr.readline;\n\n while !output1.include? (@options['OUTPUTCATCH'])\n stdErr+= output1\n output1 = @jStdErr.readline;\n end\n\n #Create the array and add Standard Out and Standard Error\n resultsArray = Array.new()\n #Replace the bsh % with empty string because we do not want them in output\n #Strip (remove) BSH characters from strings, as these are not needed\n stdOut = stdOut.gsub(\"bsh %\", \"\")\n stdErr = stdErr.gsub(\"bsh %\", \"\")\n\n #Strip (remove) new lines and excess characters (whitepsace) as these are not needed\n resultsArray.push(stdOut.gsub(\"\\n\", \"\").strip())\n resultsArray.push(stdErr.gsub(\"\\n\", \"\").strip())\n\n #Return a size 2 array\n return resultsArray\n end", "title": "" }, { "docid": "632f03911422004ad4a7124855c960a0", "score": "0.6106082", "text": "def minilang(commands)\n register = 0\n stack = []\n commands = commands.split\n\n commands.each do |command|\n case\n when command.to_i.to_s == command\n register = command.to_i\n when command == \"PUSH\"\n stack.push(register)\n when command == \"ADD\"\n register += stack.pop\n when command == \"SUB\"\n register -= stack.pop\n when command == \"MULT\"\n register *= stack.pop\n when command == \"DIV\"\n register /= stack.pop\n when command == \"MOD\"\n register %= stack.pop\n when command == \"POP\"\n register = stack.pop\n when command == \"PRINT\"\n puts register\n end\n end\nend", "title": "" }, { "docid": "4da71d309222a768f9f3dcd72244edfe", "score": "0.6102323", "text": "def writeArithmetic(command)\n assembly_builder = []\n # Add\n if command == 'add'\n assembly_builder.push(\n '@SP',\n 'AM=M-1',\n 'D=M',\n 'A=M-1',\n 'M=M+D'\n )\n\n elsif command == 'sub'\n assembly_builder.push(\n '@SP',\n 'AM=M-1',\n 'D=M',\n 'A=M-1',\n 'M=M-D'\n )\n\n # y = -y\n elsif command == 'neg'\n assembly_builder.push(\n '@SP',\n 'A=M-1',\n 'M=-M',\n )\n\n # x == y ? -1 : 0\n elsif command == 'eq'\n assembly_builder.push(\n '@SP',\n 'AM=M-1', # M = 257\n 'D=M', # D = 4\n 'A=A-1', # @256\n 'D=M-D', # D = 5 - 4 = 1\n 'M=-1', # M[256] = -1\n '@EQEND', # if D == 0 → EQEND\n 'D;JEQ', #\n '@SP',\n 'A=M-1',\n 'M=0',\n '(EQEND)'\n )\n\n # x > y ? -1 : 0\n elsif command == 'gt'\n assembly_builder.push(\n '@SP',\n 'AM=M-1', # M = 257\n 'D=M', # D = 4\n 'A=A-1', # @256\n 'D=M-D', # D = 5 - 4 = 1\n 'M=-1', # M[256] = -1\n '@GTEND', # if D == 0 → EQEND\n 'D;JGT', #\n '@SP',\n 'A=M-1',\n 'M=0',\n '(GTEND)'\n )\n # x < y ? -1 : 0\n elsif command == 'lt'\n assembly_builder.push(\n '@SP',\n 'AM=M-1', # M = 257\n 'D=M', # D = 4\n 'A=A-1', # @256\n 'D=M-D', # D = 5 - 4 = 1\n 'M=-1', # M[256] = -1\n '@LTEND', # if D == 0 → EQEND\n 'D;JLT', #\n '@SP',\n 'A=M-1',\n 'M=0',\n '(LTEND)'\n )\n # x & y\n elsif command == 'and'\n assembly_builder.push(\n '@SP',\n 'AM=M-1', # M = 257\n 'D=M', # D = 4\n 'A=A-1', # @256\n 'M=D&M'\n )\n # x | y\n elsif command == 'or'\n assembly_builder.push(\n '@SP',\n 'AM=M-1', # M = 257\n 'D=M', # D = 4\n 'A=A-1', # @256\n 'M=D|M'\n )\n # not y\n elsif command == 'not'\n assembly_builder.push(\n '@SP',\n 'A=M-1', # M = 257\n 'M=!M'\n )\n end\n return assembly_builder\n end", "title": "" }, { "docid": "36e6a0cca29268de10bf58e927d933e0", "score": "0.6100981", "text": "def minilang(program)\n\tregister = 0\n\tstack = []\n\tprogram.split.each do |token|\n\t\tcase token\n\t\twhen 'ADD' \t\tthen register += stack.pop\n\t\twhen 'DIV' \t\tthen register /= stack.pop\n\t\twhen 'MULT'\t\tthen register *= stack.pop\n\t\twhen 'MOD' \tthen register %= stack.pop\n\t\twhen 'SUB' \tthen register -= stack.pop\n\t\twhen 'PUSH' \tthen stack.push(register)\n\t\twhen 'POP' \t\tthen register = stack.pop\n\t\twhen 'PRINT' \tthen puts register\n\t\telse\t\t\t\t \t\t\t register = token.to_i \n\t end \t\t\n\tend\t\t\t\t\t\t\nend", "title": "" }, { "docid": "8c6a634816339d7384af58c0875e5f44", "score": "0.60994846", "text": "def minilang(commands)\n register = 0\n stack = []\n\n commands.split.each do |command|\n # if command == command.to_i.to_s\n # register = command.to_i\n # end\n\n case command\n when 'PRINT' then puts register\n when 'PUSH' then stack << register\n when 'POP' then register = stack.pop\n when 'ADD' then register += stack.pop\n when 'SUB' then register -= stack.pop\n when 'MULT' then register *= stack.pop\n when 'DIV' then register /= stack.pop\n when 'MOD' then register = register.remainder(stack.pop)\n else register = command.to_i\n end\n end\nend", "title": "" }, { "docid": "c4761bf1bb854eaaa482647af9e244e4", "score": "0.60958046", "text": "def main\n#--------------------------------------------\n# \tRead Each Instruction From Input\t\t#\n#--------------------------------------------\n\n\twhile asm = Readline.readline('irasm > ', true)\n\t\tasm = asm.chomp\t\t\t\t\t\t#Get assembly instruction\n\t\tif /(quit|(?<!s)exit)/i.match(asm)\t\t#If it's quit or exit\n\t\t\texit\t\t\t\t\t\t\t\t#\tExit the script\n\t\tend\t\t\t\t\t\t\t\t\t\t#Otherwise start looking for instruction names\n\t\t\n\t\tif asm.empty?\n\t\t\tnext\n\t\tend\n\n#--------------------------------------------\n# \tRoutines for Each Instruction\t\t\t#\n#--------------------------------------------\n\n\tcase\n\t\twhen asm.match(/^aaa/i)\n\t\t\t#ASCII Adjust After Addition\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", '37', 'aaa')\n\t\twhen asm.match(/^aad/i)\n\t\t\t#ASCII Adjust AX Before Division\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'D50A', 'aad')\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'D5XX', 'aad imm8 (Machine Code Only, XX is base)')\n\t\twhen asm.match(/^aam/i)\n\t\t\t#ASCII Adjust AX After Multiply\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'D40A', 'aam')\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'D4XX', 'aam imm8 (Machine Code Only, XX is base)')\t\n\t\twhen asm.match(/^aas/i)\n\t\t\t#ASCII Adjust AL After Subtraction\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", '3F', 'aas')\n\t\twhen asm.match(/^adc[^x]/i)\n\t\t\t#Add with Carry\n\t\t\tif alimm8(asm, '14', '80D0')\t\n\t\t\telsif aximm16(asm, '6615', '6681D0', '6683D0')\n\t\t\telsif eaximm32(asm, '15', '81D0', '83D0')\t\t\n\t\t\telsif modrmimm(asm, 'adc', '80', '2')\n\t\t\telsif modrmmodrm(asm, '10')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^adcx/i)\n\t\t\t#Unsigned Integer Addition of Two Operands with Cary Flag\n\t\t\tif modrmmodrm(asm, '660F38F6')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^add/i)\n\t\t\t#Add\n\t\t\tif alimm8(asm, '04', '80C0')\n\t\t\telsif aximm16(asm, '6605', '6681C0', '6683C0')\n\t\t\telsif eaximm32(asm, '05', '81C0', '83C0')\n\t\t\telsif modrmimm(asm, 'add', '80', '0')\t\n\t\t\telsif modrmmodrm(asm, '00')\t\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^adox/i)\n\t\t\t#Unsigned Integer Addition of Two Operands with Overflow Flag\n\t\t\tif modrmmodrm(asm, 'F30F38F6')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^and/i)\n\t\t\t#Logical AND\n\t\t\tif alimm8_b(asm, '25', '81E0', '6625', '6681E0', '24', '80E0', '6683E0')\n\t\t\telsif aximm16_b(asm, '25', '81E0', '6625', '6681E0', '24', '80E0', '6683E0')\n\t\t\telsif eaximm32_b(asm, '25', '81E0', '6625', '6681E0', '24', '80E0', '6683E0')\n\t\t\telsif modrmimm(asm, 'and', '80', '4')\t\n\t\t\telsif modrmmodrm(asm, '20')\t\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^arpl/i)\n\t\t\t#Unsigned Integer Addition of Two Operands with Overflow Flag\n\t\t\tif modrmmodrm(asm, '63')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^bound/i)\n\t\t\t#Bound\n\t\t\tif modrmmodrm(asm, '62')\t\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^bsf/i)\n\t\t\t#Bit Scan Forward\n\t\t\tif modrmmodrm(asm, '0FBC')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^bsr/i)\n\t\t\t#Bit Scan Reverse\n\t\t\tif modrmmodrm(asm, '0FBD')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^bswap/i)\n\t\t\t#Compare Two Operands\n\t\t\tif plusreg(asm, '0FC8')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^call\\s/i)\n\t\t\t#Call\n\t\t\tif jcc(asm, 'E8')\n\t\t\telsif ptr(asm, '9A')\t\n\t\t\telsif opmodrm(asm, 'FE', '2')\t#Actually FF, but gets converted just fine\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^cbw/i)\n\t\t\t#Convert Byte to Word\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", '6698', 'cbw')\n\t\twhen asm.match(/^cflush\\s/i)\n\t\t\t#Flush Case Line\n\t\t\tif opmodrm(asm, '0FAE', '7')\t#Actually FF, but gets converted just fine\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^cwde/i)\n\t\t\t#Convert Word to Doubleword\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", '98', 'cwde')\n\t\twhen asm.match(/^clac/i)\n\t\t\t#Clear AC Flag in EFLAGS Register\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", '0F01CA', 'clac')\n\t\twhen asm.match(/^clc/i)\n\t\t\t#Clear Carry Flag\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'F8', 'clc')\n\t\twhen asm.match(/^cld/i)\n\t\t\t#Clear Direction Flag\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'FC', 'cld')\n\t\twhen asm.match(/^cli/i)\n\t\t\t#Clear Interupt Flag\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'FA', 'cli')\n\t\twhen asm.match(/^clts/i)\n\t\t\t#Clear Task-Switched Flag in CR0\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", '0F06', 'clts')\n\t\twhen asm.match(/^cmc/i)\n\t\t\t#Complement Carry Flag\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'F5', 'cmc')\n\t\twhen asm.match(/^cmova\\s/i)\n\t\t\t#Move if Above\n\t\t\tif modrmmodrm(asm, '0F47')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^cmovae\\s/i)\n\t\t\t#Move if Above or Equal\n\t\t\tif modrmmodrm(asm, '0F43')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^cmovb\\s/i)\n\t\t\t#Move if Below\n\t\t\tif modrmmodrm(asm, '0F42')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^cmovbe\\s/i)\n\t\t\t#Move if Below or Equal\n\t\t\tif modrmmodrm(asm, '0F46')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^cmovc\\s/i)\n\t\t\t#Move if Carry\n\t\t\tif modrmmodrm(asm, '0F42')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^cmove\\s/i)\n\t\t\t#Move if Equal\n\t\t\tif modrmmodrm(asm, '0F44')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^cmovg\\s/i)\n\t\t\t#Move if Greater Than\n\t\t\tif modrmmodrm(asm, '0F4F')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^cmovge\\s/i)\n\t\t\t#Move if Greater Than or Equal\n\t\t\tif modrmmodrm(asm, '0F4D')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^cmovl\\s/i)\n\t\t\t#Move if Lesser Than\n\t\t\tif modrmmodrm(asm, '0F4C')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^cmovle\\s/i)\n\t\t\t#Move if Lesser Than or Equal\n\t\t\tif modrmmodrm(asm, '0F4E')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^cmovna\\s/i)\n\t\t\t#Move if Not Above\n\t\t\tif modrmmodrm(asm, '0F46')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^cmovnae\\s/i)\n\t\t\t#Move if Not Above or Equal\n\t\t\tif modrmmodrm(asm, '0F42')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^cmovnb\\s/i)\n\t\t\t#Move if Not Below\n\t\t\tif modrmmodrm(asm, '0F43')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^cmovnbe\\s/i)\n\t\t\t#Move if Not Below or Equal\n\t\t\tif modrmmodrm(asm, '0F47')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^cmovnc\\s/i)\n\t\t\t#Move if Not Carry\n\t\t\tif modrmmodrm(asm, '0F43')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^cmovne\\s/i)\n\t\t\t#Move if Not Equal\n\t\t\tif modrmmodrm(asm, '0F45')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^cmovng\\s/i)\n\t\t\t#Move if Not Greater Than\n\t\t\tif modrmmodrm(asm, '0F4E')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^cmovnl\\s/i)\n\t\t\t#Move if Not Lesser Than\n\t\t\tif modrmmodrm(asm, '0F4D')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^cmovnle\\s/i)\n\t\t\t#Move if Not Lesser Than or Equal\n\t\t\tif modrmmodrm(asm, '0F4F')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^cmovno\\s/i)\n\t\t\t#Move if Not Over\n\t\t\tif modrmmodrm(asm, '0F41')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^cmovnp\\s/i)\n\t\t\t#Move if Not Parity\n\t\t\tif modrmmodrm(asm, '0F4B')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^cmovns\\s/i)\n\t\t\t#Move if Not Sign Flag\n\t\t\tif modrmmodrm(asm, '0F49')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^cmovnz\\s/i)\n\t\t\t#Move if Not Zero\n\t\t\tif modrmmodrm(asm, '0F45')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^cmovo\\s/i)\n\t\t\t#Move if Over\n\t\t\tif modrmmodrm(asm, '0F40')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^cmovp\\s/i)\n\t\t\t#Move if Parity\n\t\t\tif modrmmodrm(asm, '0F4A')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^cmovpe\\s/i)\n\t\t\t#Move if Parity Even\n\t\t\tif modrmmodrm(asm, '0F4A')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^cmovpo\\s/i)\n\t\t\t#Move if Parity Odd\n\t\t\tif modrmmodrm(asm, '0F4B')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^cmovs\\s/i)\n\t\t\t#Move if Sign Flag\n\t\t\tif modrmmodrm(asm, '0F48')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^cmovz\\s/i)\n\t\t\t#Move if Zero\n\t\t\tif modrmmodrm(asm, '0F44')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^cmp[^sx]/i)\n\t\t\t#Compare Two Operands\n\t\t\tif alimm8_c(asm, '3C', '80F8')\n\t\t\telsif aximm16_c(asm, '663D', '6681F8', '6683F8')\n\t\t\telsif eaximm32_c(asm, '3D', '81F8', '83F8')\n\t\t\telsif modrmimm(asm, 'cmp', '80', '7')\t\n\t\t\telsif modrmmodrm(asm, '38')\t\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^cmpsb/i)\n\t\t\t#Compare String Operands (Byte)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'A6', 'cmpsb')\n\t\twhen asm.match(/^cmpsw/i)\n\t\t\t#Compare String Operands (Word)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", '66A7', 'cmpsw (WORD PTR ds:[esi],WORD PTR es:[edi])')\n\t\twhen asm.match(/^cmpsd/i)\n\t\t\t#Compare String Operands (Doubleword)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'A7', 'cmpsd (DWORD PTR ds:[esi],DWORD PTR es:[edi])')\n\t\twhen asm.match(/^cmpxchg/i)\n\t\t\t#Compare Two Operands\n\t\t\tif modrmmodrm(asm, '0FB0')\t\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^cpuid/i)\n\t\t\t#CPU Identification\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", '0FA2', 'cpuid')\n\t\twhen asm.match(/^crc32\\s/i)\n\t\t\t#Accumulate CRC32 Value\n\t\t\tif modrmmodrm(asm, 'F20F38F1')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^cwd/i)\n\t\t\t#Convert Word to Doubleword\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", '6699', 'cwd')\n\t\twhen asm.match(/^cdq/i)\n\t\t\t#Convert Doubleword to Quadword\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", '99', 'cdq')\n\t\twhen asm.match(/^daa/i)\n\t\t\t#Decimal Adjust AL after Addition\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", '27', 'daa')\n\t\twhen asm.match(/^das/i)\n\t\t\t#Decimal Adjust AL after Subtraction\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", '2F', 'das')\n\t\twhen asm.match(/^dec/i)\n\t\t\t#Compare Two Operands\n\t\t\tif opmodrm(asm, 'FE', '1')\t\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^div/i)\n\t\t\t#Compare Two Operands\n\t\t\tif opmodrm(asm, 'F6', '6')\t\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^emms/i)\n\t\t\t#Empty MMX Technology State\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", '0F77', 'emms')\n\t\twhen asm.match(/^enter/i)\n\t\t\tif imm16imm8(asm, 'C8')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^f2xm1/i)\n\t\t\t#Compute 2^x-1\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'D9F0', 'f2xm1')\n\t\twhen asm.match(/^fabs/i)\n\t\t\t#Absolute Value\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'D9E1', 'fabs')\n\t\twhen asm.match(/^faddp/i)\n\t\t\t#Floating Point Add\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'DEC1', 'faddp (faddp st(1),st)')\n\t\twhen asm.match(/^fchs/i)\n\t\t\t#Change Sign\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'D9E0', 'fchs')\n\t\twhen asm.match(/^fclex/i)\n\t\t\t#Clear Exceptions\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", '9BDBE2', 'fclex')\n\t\twhen asm.match(/^fnclex/i)\n\t\t\t#Clear Exceptions\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'DBE2', 'fnclex')\n\t\twhen asm.match(/^fcom$/i)\n\t\t\t#Compare Floating Point Values\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'D8D1', 'fcom (st(1))')\n\t\twhen asm.match(/^fcomp$/i)\n\t\t\t#Compare Floating Point Values and Pop\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'D8D9', 'fcomp (st(1))')\n\t\twhen asm.match(/^fcompp/i)\n\t\t\t#Compare Floating Point Values and Pop Twice\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'DED9', 'fcompp')\n\t\twhen asm.match(/^fcos/i)\n\t\t\t#Cosine\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'D9FF', 'fcos')\n\t\twhen asm.match(/^fdecstp/i)\n\t\t\t#Decrement Stack-Top Pointer\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'D9F6', 'fdecstp')\n\t\twhen asm.match(/^fdivp/i)\n\t\t\t#Divide\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'DEF9', 'fdivp (st(1),st)')\n\t\twhen asm.match(/^fdivrp/i)\n\t\t\t#Reverese Divide\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'DEF1', 'fdivrp (st(1),st)')\n\t\twhen asm.match(/^fincstp/i)\n\t\t\t#Increment Stack-Top Pointer\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'D9F7', 'fincstp')\n\t\twhen asm.match(/^finit/i)\n\t\t\t#Initialize Floating-Point Unit\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", '9BDBE3', 'finit')\n\t\twhen asm.match(/^fninit/i)\n\t\t\t#Initialize Floating-Point Unit\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'DBE3', 'fninit')\n\t\twhen asm.match(/^fld1$/i)\n\t\t\t#Load Constant (Push +1.0 onto the FPU register stack)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'D9E8', 'fld1')\n\t\twhen asm.match(/^fldl2t$/i)\n\t\t\t#Load Constant (Push log2,10 onto the FPU register stack)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'D9E9', 'fldl2t')\t\t\t\t\n\t\twhen asm.match(/^fldl2e$/i)\n\t\t\t#Load Constant (Push log2,e onto the FPU register stack)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'D9EA', 'fldl2e')\n\t\twhen asm.match(/^fldpi$/i)\n\t\t\t#Load Constant (Push pi onto the FPU register stack)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'D9EB', 'fldpi')\n\t\twhen asm.match(/^fldlg2$/i)\n\t\t\t#Load Constant (Push log10,2 onto the FPU register stack)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'D9EC', 'fldlg2')\n\t\twhen asm.match(/^fldln2$/i)\n\t\t\t#Load Constant (Push log e,2 onto the FPU register stack)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'D9ED', 'fldln2')\n\t\twhen asm.match(/^fldz$/i)\n\t\t\t#Load Constant (Push +0.0 onto the FPU register stack)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'D9EE', 'fldz')\n\t\twhen asm.match(/^fmulp/i)\n\t\t\t#Multiply\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'DEC9', 'fmulp (st(1),st)')\n\t\twhen asm.match(/^fnop$/i)\n\t\t\t#Floating Point NOP\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'D9D0', 'fnop')\n\t\twhen asm.match(/^fpatan$/i)\n\t\t\t#Partial Arctangent\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'D9F3', 'fpatan')\n\t\twhen asm.match(/^fprem$/i)\n\t\t\t#Partial Remainder\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'D9F8', 'fprem')\n\t\twhen asm.match(/^fprem1$/i)\n\t\t\t#Partial Remainder\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'D9F5', 'fprem1')\n\t\twhen asm.match(/^fptan$/i)\n\t\t\t#Partial Tangent\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'D9F2', 'fptan')\n\t\twhen asm.match(/^frndint$/i)\n\t\t\t#Round to Integer\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'D9FC', 'frndint')\n\t\twhen asm.match(/^fscale$/i)\n\t\t\t#Scale\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'D9FD', 'fscale')\n\t\twhen asm.match(/^fsin$/i)\n\t\t\t#Sine\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'D9FE', 'fsin')\n\t\twhen asm.match(/^fsincos$/i)\n\t\t\t#Sine and Cosine\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'D9FB', 'fsincos')\n\t\twhen asm.match(/^fsqrt$/i)\n\t\t\t#Square Root\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'D9FA', 'fsqrt')\n\t\twhen asm.match(/^fstswax$/i)\n\t\t\t#Store x87 FPU Status Word\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", '9BDFE0', 'fstsw ax')\n\t\twhen asm.match(/^fnstswax$/i)\n\t\t\t#Store x87 FPU Status Word (without checking for pending unmasked floating-point exceptions)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'DFE0', 'fnstsw ax')\n\t\twhen asm.match(/^fsubp$/i)\n\t\t\t#Subtract\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'DEE9', 'fsubp')\n\t\twhen asm.match(/^fsubrp$/i)\n\t\t\t#Reverse Subtract\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'DEE1', 'fsubrp')\n\t\twhen asm.match(/^ftst$/i)\n\t\t\t#Test\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'D9E4', 'ftst')\n\t\twhen asm.match(/^fucom$/i)\n\t\t\t#Unordered Compare Floating Point Values\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'DDE1', 'fucom (st(1))')\n\t\twhen asm.match(/^fucomp$/i)\n\t\t\t#Unordered Compare Floating Point Values and pop register stack\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'DDE9', 'fucomp (st(1))')\n\t\twhen asm.match(/^fucompp$/i)\n\t\t\t#Unordered Compare Floating Point Values and pop register stack twice\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'DAE9', 'fucompp')\n\t\twhen asm.match(/^fxam$/i)\n\t\t\t#Examine ModR/M\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'D9E5', 'fxam')\n\t\twhen asm.match(/^fxch$/i)\n\t\t\t#Exchange Register Contents\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'D9C9', 'fxch (st(1))')\n\t\twhen asm.match(/^fxtract$/i)\n\t\t\t#Extract Exponent and Significand\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'D9F4', 'fxtract') \n\t\twhen asm.match(/^fyl2x$/i)\n\t\t\t#Compute y * log2, x\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'D9F1', 'fyl2x')\n\t\twhen asm.match(/^fyl2xp1$/i)\n\t\t\t#Compute y * log2(x+1)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'D9F9', 'fyl2xp1')\n\t\twhen asm.match(/^hlt$/i)\n\t\t\t#Halt\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'F4', 'hlt')\n\t\twhen asm.match(/^idiv\\s/i)\n\t\t\t#Compare Two Operands\n\t\t\tif opmodrm(asm, 'F6', '7')\t\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^imul\\s/i)\n\t\t\t#Compare Two Operands\n\t\t\tif modrmmodrm(asm, '0FAF')\t\t\n\t\t\telsif opmodrm(asm, 'F6', '5')\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^in\\s/i)\n\t\t\t#Input from Port\n\t\t\tif alimm8_d(asm, 'E4', 'E5')\n\t\t\telsif inaldx(asm)\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^int(3$|\\s)/i)\n\t\t\t#Interupt\n\t\t\tif opimm8(asm, 'CD')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^inc\\s/i)\n\t\t\t#Compare Two Operands\n\t\t\tif opmodrm(asm, 'FE', '0')\t\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^insb$/i)\n\t\t\t#Input from Port to String (Byte)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", '6C', 'insb (BYTE PTR es:[edi],dx)')\n\t\twhen asm.match(/^insw$/i)\n\t\t\t#Input from Port to String (Word)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", '666D', 'insw (WORD PTR es:[edi],dx)')\n\t\twhen asm.match(/^insd$/i)\n\t\t\t#Input from Port to String (DWword)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", '6D', 'insd (DWORD PTR es:[edi],dx)')\n\t\twhen asm.match(/^into$/i)\n\t\t\t#Call to Interrupt Procedure\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'CE', 'into')\n\t\twhen asm.match(/^invd$/i)\n\t\t\t#Invalidate Internal Caches\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", '0F08', 'invd')\n\t\twhen asm.match(/^invlpg\\s/i)\n\t\t\t#Invalidate TLB Entries\n\t\t\tif opmodrm(asm, '0F01', '7')\t\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^iretw$/i)\n\t\t\t#Interrupt Return (Word)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", '66CF', 'iretw')\n\t\twhen asm.match(/^iretd?$/i)\n\t\t\t#Interrupt Return, this applies for IRET and IRTED\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'CF', asm)\n\t\twhen asm.match(/^ja\\s/i)\n\t\t\t#Jump if Above\n\t\t\tif jcc(asm, '77')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^jae\\s/i)\n\t\t\t#Jump if Above or Equal\n\t\t\tif jcc(asm, '73')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^jb\\s/i)\n\t\t\t#Jump if Below\n\t\t\tif jcc(asm, '72')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^jbe\\s/i)\n\t\t\t#Jump if Below or Equal\n\t\t\tif jcc(asm, '76')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^jc\\s/i)\n\t\t\t#Jump if Carry\n\t\t\tif jcc(asm, '72')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^je\\s/i)\n\t\t\t#Jump if Equal\n\t\t\tif jcc(asm, '74')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^jg\\s/i)\n\t\t\t#Jump if Greater Than\n\t\t\tif jcc(asm, '7F')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^jge\\s/i)\n\t\t\t#Jump if Greater Than or Equal\n\t\t\tif jcc(asm, '7D')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^jl\\s/i)\n\t\t\t#Jump if Lesser Than\n\t\t\tif jcc(asm, '7C')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^jle\\s/i)\n\t\t\t#Jump if Lesser Than or Equal\n\t\t\tif jcc(asm, '7E')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^jna\\s/i)\n\t\t\t#Jump if Not Above\n\t\t\tif jcc(asm, '76')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^jnae\\s/i)\n\t\t\t#Jump if Not Above or Equal\n\t\t\tif jcc(asm, '72')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^jnb\\s/i)\n\t\t\t#Jump if Not Below\n\t\t\tif jcc(asm, '73')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^jnbe\\s/i)\n\t\t\t#Jump if Not Below or Equal\n\t\t\tif jcc(asm, '77')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^jnc\\s/i)\n\t\t\t#Jump if Not Carry\n\t\t\tif jcc(asm, '73')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^jne\\s/i)\n\t\t\t#Jump if Not Equal\n\t\t\tif jcc(asm, '75')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^jng\\s/i)\n\t\t\t#Jump if Not Greater Than\n\t\t\tif jcc(asm, '7E')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^jnl\\s/i)\n\t\t\t#Jump if Not Lesser Than\n\t\t\tif jcc(asm, '7D')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^jnle\\s/i)\n\t\t\t#Jump if Not Lesser Than or Equal\n\t\t\tif jcc(asm, '7F')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^jno\\s/i)\n\t\t\t#Jump if Not Over\n\t\t\tif jcc(asm, '71')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^jnp\\s/i)\n\t\t\t#Jump if Not Parity\n\t\t\tif jcc(asm, '7B')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^jns\\s/i)\n\t\t\t#Jump if Not Sign Flag\n\t\t\tif jcc(asm, '79')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^jnz\\s/i)\n\t\t\t#Jump if Not Zero\n\t\t\tif jcc(asm, '75')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^jo\\s/i)\n\t\t\t#Jump if Over\n\t\t\tif jcc(asm, '70')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^jp\\s/i)\n\t\t\t#Jump if Parity\n\t\t\tif jcc(asm, '7A')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^jpe\\s/i)\n\t\t\t#Jump if Parity Even\n\t\t\tif jcc(asm, '7A')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^jpo\\s/i)\n\t\t\t#Jump if Parity Odd\n\t\t\tif jcc(asm, '7B')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^js\\s/i)\n\t\t\t#Jump if Sign Flag\n\t\t\tif jcc(asm, '78')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^jmp\\s/i)\n\t\t\t#Jump\n\t\t\tif jcc(asm, 'EB')\t\n\t\t\telsif ptr(asm, 'EA')\n\t\t\telsif opmodrm(asm, 'FE', '4')\t#Actually FF, but gets converted just fine\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^jz\\s/i)\n\t\t\t#Jump if Zero\n\t\t\tif jcc(asm, '74')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^lahf$/i)\n\t\t\t#Load Status Flags into AH Register\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", '9F', 'lahf')\n\t\twhen asm.match(/^lea\\s/i)\n\t\t\t#lea\n\t\t\tif modrmmodrm(asm, '8D')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^leave$/i)\n\t\t\t#High Level Procedure Exit\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'C9', 'leave') \n\t\twhen asm.match(/^leavew$/i)\n\t\t\t#High Level Procedure Exit (Word)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", '66C9', 'leavew')\n\t\twhen asm.match(/^lfence$/i)\n\t\t\t#Load Fence\n\t\t\tfence('lfence', '0FAE', 'E8')\n\t\twhen asm.match(/^lldt\\s/i)\n\t\t\t#Load Local Descriptor Table Register\n\t\t\tif opmodrm(asm, '0F00', '2')\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^lmsw\\s/i)\n\t\t\t#Load Machine Status Word\n\t\t\tif opmodrm(asm, '0F01', '6')\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^lock$/i)\n\t\t\tlock(asm)\t\t\t\t\t#Find a way to handle\n\t\twhen asm.match(/^lodsb$/i)\n\t\t\t#Load String (Byte)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'AC', 'lodsb')\n\t\twhen asm.match(/^lodsw$/i)\n\t\t\t#Load String (Word)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", '66AD', 'lodsw')\n\t\twhen asm.match(/^lodsd$/i)\n\t\t\t#Load String (Doubleword)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'AD', 'lodsd')\n\t\twhen asm.match(/^loop\\s/i)\n\t\t\t#Loop\n\t\t\tif rel8(asm, 'E2')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^loope\\s/i)\n\t\t\t#Loop if Equal\n\t\t\tif rel8(asm, 'E1')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^loopne\\s/i)\n\t\t\t#Loop if Not Equal\n\t\t\tif rel8(asm, 'E0')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^ltr\\s/i)\n\t\t\t#Load Task Register\n\t\t\tif opmodrm(asm, '0F00', '3')\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^mov\\s/i)\n\t\t\t#Move\n\t\t\tif modrmimm(asm, 'mov', 'C6', '0')\n\t\t\telsif modrmmodrm(asm, '88')\t\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^mfence$/i)\n\t\t\t#Memory Fence\n\t\t\tfence('mfence', '0FAE', 'F0')\n\t\twhen asm.match(/^monitor$/i)\n\t\t\t#Set Up Monitor Address\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", '0F01C8', 'monitor')\n\t\twhen asm.match(/^movsb$/i)\n\t\t\t#Move Data from String to String (Byte)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'A4', 'movsb')\n\t\twhen asm.match(/^movsw$/i)\n\t\t\t#Move Data from String to String (Word)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", '66A5', 'movsw')\n\t\twhen asm.match(/^movsd$/i)\n\t\t\t#Move Data from String to String (Doubleword)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'A5', 'movsd')\n\t\twhen asm.match(/^mwait$/i)\n\t\t\t#Monitor Wait\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", '0F01C9', 'mwait')\n\t\twhen asm.match(/^nop$/i)\n\t\t\t#No Operation\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", '90', 'nop')\n\t\twhen asm.match(/^nop\\s/i)\n\t\t\t#No Operation as a 'multibyte asm'\n\t\t\tif opmodrm(asm, '0F1F', '0')\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^or\\s/i)\n\t\t\t#Logical Inclusive OR\n\t\t\tif alimm8_e(asm, '0D', '81C8', '660D', '6681C8', '0C', '80C8')\n\t\t\telsif aximm16_e(asm, '0D', '81C8', '660D', '6681C8', '0C', '80C8', '6683C8')\n\t\t\telsif eaximm32_e(asm, '0D', '81C8', '660D', '6681C8', '0C', '80C8', '83C8')\n\t\t\telsif modrmimm(asm, 'or', '80', '1')\t\t\n\t\t\telsif modrmmodrm(asm, '08')\t\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^outsb$/i)\n\t\t\t#Output String to Port (Byte)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", '6E', 'outsb')\n\t\twhen asm.match(/^outsw$/i)\n\t\t\t#Output String to Port (Word)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", '666F', 'outsw')\n\t\twhen asm.match(/^outsd$/i)\n\t\t\t#Output String to Port (Doubleword)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", '6F', 'outsd') \n\t\twhen asm.match(/^pause$/i)\n\t\t\t#Spin Loop Hint\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'F390', 'pause')\n\t\twhen asm.match(/^pop\\s/i)\n\t\t\t#Compare Two Operands\n\t\t\tif opmodrm(asm, '8F', '0')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^popaw$/i)\n\t\t\t#Pop All General-Purpose Registers (Word)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", '6661', 'popaw')\n\t\twhen asm.match(/^popad?$/i)\n\t\t\t#Pop All General-Purpose Registers\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", '61', asm) \n\t\twhen asm.match(/^popcnt/i)\n\t\t\t#Return the Count of Number of Bits set to 1\n\t\t\tif modrmmodrm(asm, 'F30FB8')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^popfw$/i)\n\t\t\t#Pop Stack into EFLAGS Registers (Word)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", '669D', 'popfw')\n\t\twhen asm.match(/^popfd?$/i)\n\t\t\t#Pop Stack into EFLAGS Registers\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", '9D', asm)\n\t\twhen asm.match(/^prefetch0\\s/i)\n\t\t\t#Compare Two Operands\n\t\t\tif opmodrm(asm, '0F18', '1')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^prefetch1\\s/i)\n\t\t\t#Compare Two Operands\n\t\t\tif opmodrm(asm, '0F18', '2')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^prefetch2\\s/i)\n\t\t\t#Compare Two Operands\n\t\t\tif opmodrm(asm, '0F18', '3')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^prefetchnta\\s/i)\n\t\t\t#Compare Two Operands\n\t\t\tif opmodrm(asm, '0F18', '0')\t\t\n\t\t\telse nasm(asm) end \n\t\twhen asm.match(/^prefetchw\\s/i)\n\t\t\t#Compare Two Operands\n\t\t\tif opmodrm(asm, '0F0D', '1')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^prefetchwt1\\s/i)\n\t\t\t#Compare Two Operands\n\t\t\tif opmodrm(asm, '0F0D', '2')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^push\\s/i)\n\t\t\t#Push data to the stack\n\t\t\tif opmodrm(asm, 'FE', '6')\t\t#Actually FF, but gets converted just fine\n\t\t\telsif pushimm(asm)\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^pushaw$/i)\n\t\t\t#Push All General-Purpose Registers (Word)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", '6660', 'pushaw')\n\t\twhen asm.match(/^pushad?$/i)\n\t\t\t#Push All General-Purpose Registers\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", '60', asm)\n\t\twhen asm.match(/^pushfw$/i)\n\t\t\t#Push EFLAGS Register onto the Stack (Word)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", '669C', 'pushfw')\n\t\twhen asm.match(/^pushfd?$/i)\n\t\t\t#Push EFLAGS Register onto the Stack\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", '9C', asm)\n\t\twhen asm.match(/^rcl/i)\n\t\t\t#Rotate with Carry to the Left\n\t\t\tif modrmimm(asm, 'rcl', 'C0', '2')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^rcr/i)\n\t\t\t#Rotate with Carry to the Right\n\t\t\tif modrmimm(asm, 'rcr', 'C0', '3')\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^rdmsr$/i)\n\t\t\t#Read from Model Specific Register\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", '0F32', 'rdmsr')\n\t\twhen asm.match(/^rdpmc$/i)\n\t\t\t#Read Performance-Monitoring Counters\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", '0F33', 'rdpmc')\n\t\twhen asm.match(/^rdrand\\s/i)\n\t\t\t#Random\n\t\t\tif plusreg(asm, '0FC7F0')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^rdseed\\s/i)\n\t\t\t#Create Seed for Random\n\t\t\tif plusreg(asm, '0FC7F8')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^rdtsc$/i)\n\t\t\t#Read Time-Stamp Counter\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", '0F31', 'rdtsc')\n\t\twhen asm.match(/^rdtscp$/i)\n\t\t\t#Read Time-Stamp Counter and Processor ID\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", '0F01F9', 'rdtscp')\n\t\twhen asm.match(/^ret$/i)\n\t\t\t#Return from Procedure\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'C3', 'ret')\n\t\twhen asm.match(/^retf$/i)\n\t\t\t#Return from Procedure (Far)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'CB', 'retf')\n\t\twhen asm.match(/^rep\\sinsb$/i)\n\t\t\t#Return from Procedure (Far)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'F36C', 'rep insb')\n\t\twhen asm.match(/^rep\\sinsw$/i)\n\t\t\t#Return from Procedure (Far)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'F3666D', 'rep insw')\n\t\t\tprintf(\"%-34s%-15s (prefix swap)\\n\\n\", '66F36D', 'rep insw')\n\t\twhen asm.match(/^rep\\sinsd$/i)\n\t\t\t#Return from Procedure (Far)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'F36D', 'rep insd')\n\t\twhen asm.match(/^rep\\smovsb$/i)\n\t\t\t#Return from Procedure (Far)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'F3A4', 'rep movsb')\n\t\twhen asm.match(/^rep\\smovsw$/i)\n\t\t\t#Return from Procedure (Far)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'F366A5', 'rep movsw')\n\t\t\tprintf(\"%-34s%-15s (prefix swap)\\n\\n\", '66F3A5', 'rep movsw')\n\t\twhen asm.match(/^rep\\smovsd$/i)\n\t\t\t#Return from Procedure (Far)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'F3A5', 'rep movsd')\n\t\twhen asm.match(/^rep\\soutsb$/i)\n\t\t\t#Return from Procedure (Far)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'F36E', 'rep outsb')\n\t\twhen asm.match(/^rep\\soutsw$/i)\n\t\t\t#Return from Procedure (Far)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'F3666F', 'rep outsw')\n\t\t\tprintf(\"%-34s%-15s (prefix swap)\\n\\n\", '66F36F', 'rep outsw')\n\t\twhen asm.match(/^rep\\soutsd$/i)\n\t\t\t#Return from Procedure (Far)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'F36F', 'rep outsd')\n\t\twhen asm.match(/^rep\\slodsb$/i)\n\t\t\t#Return from Procedure (Far)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'F3AC', 'rep lodsb')\n\t\twhen asm.match(/^rep\\slodsw$/i)\n\t\t\t#Return from Procedure (Far)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'F366AD', 'rep lodsw')\n\t\t\tprintf(\"%-34s%-15s (prefix swap)\\n\\n\", '66F3AD', 'rep lodsw')\n\t\twhen asm.match(/^rep\\slodsd$/i)\n\t\t\t#Return from Procedure (Far)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'F3AD', 'rep lodsd')\n\t\twhen asm.match(/^rep\\sstosb$/i)\n\t\t\t#Return from Procedure (Far)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'F3AA', 'rep stosb')\n\t\twhen asm.match(/^rep\\sstosw$/i)\n\t\t\t#Return from Procedure (Far)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'F366AB', 'rep stosw')\n\t\t\tprintf(\"%-34s%-15s (prefix swap)\\n\\n\", '66F3AB', 'rep stosw')\n\t\twhen asm.match(/^rep\\sstosd$/i)\n\t\t\t#Return from Procedure (Far)\n\t\tprintf(\"%-34s%-15s\\n\\n\", 'F3AB', 'rep lodsd')\n\t\twhen asm.match(/^repe\\scmpsb$/i)\n\t\t\t#Return from Procedure (Far)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'F3A6', 'repe cmpsb')\n\t\twhen asm.match(/^repe\\scmpsw$/i)\n\t\t\t#Return from Procedure (Far)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'F366A7', 'repe cmpsw')\n\t\t\tprintf(\"%-34s%-15s (prefix swap)\\n\\n\", '66F3A7', 'repe cmpsw')\n\t\twhen asm.match(/^repe\\scmpsd$/i)\n\t\t\t#Return from Procedure (Far)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'F3A7', 'repe cmpsd')\n\t\twhen asm.match(/^repz\\scmpsb$/i)\n\t\t\t#Return from Procedure (Far)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'F3A6', 'repe cmpsb')\n\t\twhen asm.match(/^repz\\scmpsw$/i)\n\t\t\t#Return from Procedure (Far)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'F366A7', 'repe cmpsw')\n\t\t\tprintf(\"%-34s%-15s (prefix swap)\\n\\n\", '66F3A7', 'repe cmpsw')\n\t\twhen asm.match(/^repz\\scmpsd$/i)\n\t\t\t#Return from Procedure (Far)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'F3A7', 'repe cmpsd')\n\t\twhen asm.match(/^repe\\sscasb$/i)\n\t\t\t#Return from Procedure (Far)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'F3AE', 'repe scasb')\n\t\twhen asm.match(/^repe\\sscasw$/i)\n\t\t\t#Return from Procedure (Far)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'F366AF', 'repe scasw')\n\t\t\tprintf(\"%-34s%-15s (prefix swap)\\n\\n\", '66F3AF', 'repe scasw')\n\t\twhen asm.match(/^repe\\sscasd$/i)\n\t\t\t#Return from Procedure (Far)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'F3AF', 'repe scasd')\n\t\twhen asm.match(/^repz\\sscasb$/i)\n\t\t\t#Return from Procedure (Far)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'F3AE', 'repe scasb')\n\t\twhen asm.match(/^repz\\sscasw$/i)\n\t\t\t#Return from Procedure (Far)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'F366AF', 'repe scasw')\n\t\t\tprintf(\"%-34s%-15s (prefix swap)\\n\\n\", '66F3AF', 'repe scasw')\n\t\twhen asm.match(/^repz\\sscasd$/i)\n\t\t\t#Return from Procedure (Far)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'F3AF', 'repe scasd')\n\t\twhen asm.match(/^repne\\scmpsb$/i)\n\t\t\t#Return from Procedure (Far)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'F2A6', 'repne cmpsb') \n\t\twhen asm.match(/^repne\\scmpsw$/i)\n\t\t\t#Return from Procedure (Far)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'F266A7', 'repne cmpsw')\n\t\t\tprintf(\"%-34s%-15s (prefix swap)\\n\\n\", '66F2A7', 'repne cmpsw')\n\t\twhen asm.match(/^repne\\scmpsd$/i)\n\t\t\t#Return from Procedure (Far)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'F2A7', 'repne cmpsd')\n\t\twhen asm.match(/^repnz\\scmpsb$/i)\n\t\t\t#Return from Procedure (Far)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'F2A6', 'repne cmpsb') \n\t\twhen asm.match(/^repnz\\scmpsw$/i)\n\t\t\t#Return from Procedure (Far)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'F266A7', 'repne cmpsw')\n\t\t\tprintf(\"%-34s%-15s (prefix swap)\\n\\n\", '66F2A7', 'repne cmpsw')\n\t\twhen asm.match(/^repnz\\scmpsd$/i)\n\t\t\t#Return from Procedure (Far)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'F2A7', 'repne cmpsd')\n\t\twhen asm.match(/^repne\\sscasb$/i)\n\t\t\t#Return from Procedure (Far)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'F2AE', 'repne scasb')\n\t\twhen asm.match(/^repne\\sscasw$/i)\n\t\t\t#Return from Procedure (Far)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'F266AF', 'repne scasw')\n\t\t\tprintf(\"%-34s%-15s (prefix swap)\\n\\n\", '66F3AF', 'repne scasw')\n\t\twhen asm.match(/^repne\\sscasd$/i)\n\t\t\t#Return from Procedure (Far)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'F2AF', 'repne scasd')\n\t\twhen asm.match(/^repnz\\sscasb$/i)\n\t\t\t#Return from Procedure (Far)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'F2AE', 'repne scasb')\n\t\twhen asm.match(/^repnz\\sscasw$/i)\n\t\t\t#Return from Procedure (Far)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'F266AF', 'repne scasw')\n\t\t\tprintf(\"%-34s%-15s (prefix swap)\\n\\n\", '66F3AF', 'repne scasw')\n\t\twhen asm.match(/^repnz\\sscasd$/i)\n\t\t\t#Return from Procedure (Far)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'F2AF', 'repne scasd')\n\t\twhen asm.match(/^rol/i)\n\t\t\t#Rotate to the Left\n\t\t\tif modrmimm(asm, 'rol', 'C0', '0')\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^ror/i)\n\t\t\t#Rotate to the Right\n\t\t\tif modrmimm(asm, 'ror', 'C0', '1')\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^rsm$/i)\n\t\t\t#Resume from System Management Mode\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", '0FAA', 'rsm')\n\t\twhen asm.match(/^sahf$/i)\n\t\t\t#Store AH into Flags\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", '9E', 'sahf')\n\t\twhen asm.match(/^sal/i)\n\t\t\t#Shift Arithmetic Left (SHL is the official for this)\n\t\t\tif modrmimm(asm, 'sal', 'C0', '6')\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^sar/i)\n\t\t\t#Shift Arithmetic Right\n\t\t\tif modrmimm(asm, 'sar', 'C0', '7')\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^sbb/i)\n\t\t\t#Integer Subtraction with Borrow\n\t\t\tif alimm8(asm, '1C', '80D8')\n\t\t\telsif aximm16(asm, '661D', '6681D8', '6683D8')\n\t\t\telsif eaximm32(asm, '1D', '81D8', '83D8')\t\n\t\t\telsif modrmimm(asm, 'sbb', '80', '3')\t\n\t\t\telsif modrmmodrm(asm, '18')\t\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^scasb$/i)\n\t\t\t#Scan String (Byte)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'AE', 'scasb')\n\t\twhen asm.match(/^scasw$/i)\n\t\t\t#Scan String (Word)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", '66AF', 'scasw')\n\t\twhen asm.match(/^scasd$/i)\n\t\t\t#Scan String (Doubleword)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'AF', 'scasd')\n\t\twhen asm.match(/^sfence$/i)\n\t\t\t#Store Fence\n\t\t\tfence('sfence', '0FAE', 'F8')\n\t\twhen asm.match(/^sgdt\\s/i)\n\t\t\t#Store Global Descriptor Table Register\n\t\t\tif opmodrm(asm, '0F01', '0')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^shl/i)\n\t\t\t#Shift Left\n\t\t\tif modrmimm(asm, 'shl', 'C0', '4')\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^sidt\\s/i)\n\t\t\t#Store Interrupt Descriptor Table\n\t\t\tif opmodrm(asm, '0F01', '1')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^shr/i)\n\t\t\t#Shift Right\n\t\t\tif modrmimm(asm, 'shr', 'C0', '5')\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^smsw\\s/i)\n\t\t\t#Store Machine Status Word r32/m16\n\t\t\tif opmodrm(asm, '0F01', '4')\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^stac$/i)\n\t\t\t#Set AC Flag in EFLAGS Register\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", '0F01CB', 'stac')\n\t\twhen asm.match(/^stc$/i)\n\t\t\t#Set Carry Flag\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'F9', 'stc')\n\t\twhen asm.match(/^std$/i)\n\t\t\t#Set Direction Flag\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'FD', 'std')\n\t\twhen asm.match(/^sti$/i)\n\t\t\t#Set Interrupt Flag\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'FB', 'sti')\n\t\twhen asm.match(/^stosb$/i)\n\t\t\t#Store String (Byte)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'AA', 'stosb')\n\t\twhen asm.match(/^stosw$/i)\n\t\t\t#Store String (Word)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", '66AB', 'stosw')\n\t\twhen asm.match(/^stosd$/i)\n\t\t\t#Store String (Doubleword)\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'AB', 'stosd')\n\t\twhen asm.match(/^str\\s/i)\n\t\t\t#Store Task Register\n\t\t\tif opmodrm(asm, '0F00', '1')\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^sub/i)\n\t\t\t#Subtract\n\t\t\tif alimm8(asm, '2C', '80E8')\n\t\t\telsif aximm16(asm, '662D', '6681E8', '6683E8')\n\t\t\telsif eaximm32(asm, '2D', '81E8', '83E8')\n\t\t\telsif modrmimm(asm, 'sub', '80', '5')\t\n\t\t\telsif modrmmodrm(asm, '28')\t\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^swapgs/i)\n\t\t\t#Swap GS Base Register\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", '0F01F8', 'swapgs') \n\t\twhen asm.match(/^syscall/i)\n\t\t\t#Fast System Call\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", '0F05', 'syscall')\n\t\twhen asm.match(/^sysenter/i)\n\t\t\t#Fast System Call\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", '0F34', 'sysenter')\n\t\twhen asm.match(/^sysexit/i)\n\t\t\t#Fast Return from Fast System Call\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", '0F35', 'sysexit')\n\t\twhen asm.match(/^sysret/i)\n\t\t\t#Return From Fast System Call\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", '0F07', 'sysret')\n\t\twhen asm.match(/^test/i)\n\t\t\t#Logical Compare\n\t\t\tif alimm8_c(asm, 'A8', 'F6C0')\n\t\t\telsif aximm16_c(asm, '66A9', '66F7C0', 'invalid')\n\t\t\telsif eaximm32_c(asm, 'A9', 'F7C0', 'invalid')\t\t\n\t\t\telsif modrmimm(asm, 'test', 'F6', '0')\t\n\t\t\telsif modrmmodrm(asm, '84')\t\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^tzcnt/i)\n\t\t\t#Count the number of trailing zero bits\n\t\t\tif modrmmodrm(asm, 'F30FBC')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^ud2$/i)\n\t\t\t#Undefined asm\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", '0F0B', 'ud2')\n\t\twhen asm.match(/^verr\\s/i)\n\t\t\t#Store Task Register\n\t\t\tif opmodrm(asm, '0F00', '4')\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^verw\\s/i)\n\t\t\t#Store Task Register\n\t\t\tif opmodrm(asm, '0F00', '5')\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^vmwrite/i)\n\t\t\t#VMWrite\n\t\t\tif modrmmodrm(asm, '0F79')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^vmread/i)\n\t\t\t#VMRead\n\t\t\tif modrmmodrm(asm, '0F78')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^f?wait$/i)\n\t\t\t#Wait\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", '9B', 'wait')\n\t\twhen asm.match(/^wbinvd$/i)\n\t\t\t#Write Back and Invalidate Cache\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", '0F09', 'wbinvd')\n\t\twhen asm.match(/^wrmsr$/i)\n\t\t\t#Write to Model Specific Register\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", '0F30', 'wrmsr')\n\t\twhen asm.match(/^xabort\\s/i)\n\t\t\t#Transactional Abort\n\t\t\tif opimm8(asm, 'C6F8')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^xbegin/i)\n\t\t\t#Transactional Begin\n\t\t\tif jcc(asm, 'C7F8')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^xchg/i)\n\t\t\t#Exchange two registers\n\t\t\tif plusreg(asm, '90')\t\n\t\t\telsif modrmmodrm(asm, '86')\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^xgetbv$/i)\n\t\t\t#Get Value of Extended Control Register\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", '0F01D0', 'xgetbv')\n\t\twhen asm.match(/^xlat$/i)\n\t\t\t#Table Look-up Translation\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", 'D7', 'xlat (BYTE PTR ds:[ebx])')\n\t\twhen asm.match(/^xor/i)\n\t\t\t#Logical Exlusive OR\n\t\t\tif alimm8_c(asm, '34', '80F0')\n\t\t\telsif aximm16_c(asm, '6635', '6681F0', '6683F0')\n\t\t\telsif eaximm32_c(asm, '35', '81F0', '83F0')\t\n\t\t\telsif modrmimm(asm, 'xor', '80', '6')\t\n\t\t\telsif modrmmodrm(asm, '30')\t\t\n\t\t\telse nasm(asm) end\n\t\twhen asm.match(/^xsetbv/i)\n\t\t\t#Set Extended Control Register\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", '0F01D1', 'xsetbv')\n\t\twhen asm.match(/^xtest/i)\n\t\t\t#Test If in Transactional Execution\n\t\t\tprintf(\"%-34s%-15s\\n\\n\", '0F01D6', 'xtest')\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\telse \n\t\t\tnasm(asm) \n\t\tend\n\tend\n\t\n\nrescue TypeError\n\tnasm(asm)\n\tmain\nend", "title": "" }, { "docid": "00304fec20ad6c2e592b2715e19cb16c", "score": "0.6094776", "text": "def basic_output()\n temp_string = String.new()\n \n if (@utype != \"\")\n temp_string = temp_string + \"#{@utype} = \"\n end\n temp_string = temp_string + @commandName\n temp_string = temp_string + \"\\n\"\n\n #sprintf(\"%17s %04x\", 123, 123)\n #@keywordPairs.each {|array| temp_string = temp_string + \"\\s\\s\\s#{array[0]} = #{shortenValue(array[1])}\\n\" }\n @keywordPairs.each {|array| temp_string = temp_string + shortenValue( array[0],array[1]) }\n temp_string = temp_string + \"..\\n\"\n \n #temp_string = temp_string + \"$Parents\\n\"\n #@parents.each do |array|\n # temp_string = temp_string + \"$\\t#{array.utype} = #{array.commandName}\\n\"\n #end\n #temp_string = temp_string + \"..\\n\"\n \n #temp_string = temp_string + \"$Children\\n\"\n #@children.each {|array| temp_string = temp_string + \"$\\t#{array.utype} = #{array.commandName}\\n\" }\n #temp_string = temp_string + \"..\\n\"\n return temp_string\n end", "title": "" }, { "docid": "0ca205b6087bc5875ade5c252332c016", "score": "0.60726", "text": "def run_program(phase_setting, input_signal, intcodes)\n pointer = 0\n input_count = 0\n instruction = intcodes[pointer]\n opcode = instruction % 100\n modes = (instruction / 100).digits\n\n while opcode != 99\n mode1 = modes[0] || 0\n mode2 = modes[1] || 0\n\n param1 = mode1.zero? ? intcodes[intcodes[pointer + 1]] : intcodes[pointer + 1]\n param2 = mode2.zero? ? intcodes[intcodes[pointer + 2]] : intcodes[pointer + 2]\n param3 = intcodes[pointer + 3]\n\n case opcode\n when 1\n intcodes[param3] = param1 + param2\n pointer += 4\n when 2\n intcodes[param3] = param1 * param2\n pointer += 4\n when 3\n if input_count.zero?\n intcodes[intcodes[pointer + 1]] = phase_setting\n input_count += 1\n else\n intcodes[intcodes[pointer + 1]] = input_signal\n end\n\n pointer += 2\n when 4\n return intcodes[intcodes[pointer + 1]]\n when 5\n if param1.zero?\n pointer += 3\n else\n pointer = param2\n end\n when 6\n if param1.zero?\n pointer = param2\n else\n pointer += 3\n end\n when 7\n intcodes[param3] = if param1 < param2\n 1\n else\n 0\n end\n\n pointer += 4\n when 8\n intcodes[param3] = if param1 == param2\n 1\n else\n 0\n end\n\n pointer += 4\n else\n break\n end\n\n instruction = intcodes[pointer]\n opcode = instruction % 100\n modes = (instruction / 100).digits\n end\nend", "title": "" }, { "docid": "0842435fb04add323bbc11e66f7490e6", "score": "0.6072275", "text": "def resolve(instr, input)\n# resolve input based on the values in instr\n#print '>>> entering resolve for \"', input, '\" with instructions: ', instr, \"\\n\"\nresult = ''\ninput_array = input.split\nindex = 0\nwhile index < input_array.length\n\titem = input_array[index]\n\tif item =~ /^\\d+$/\n\t\t# we have a number\n\t\tnumber = item.to_i\n\t\t#print 'Instruction \"', result, '\" gets appended with \"', instr[number], '\"', \"\\n\"\n\t\tresult+=instr[number]\n\telsif item == '|'\n\t\tresult+='|'\n\tend\n\tindex += 1\nend\n#print '<<< leaving resolve for \"', input, '\" returning: ', result, \"\\n\"\nreturn(result)\n#\nend", "title": "" }, { "docid": "934d86bda306d011be90c8b63d78826b", "score": "0.6058712", "text": "def minilang(commands)\n register = 0\n stack = []\n\n commands.split.each do |command|\n case command\n when 'PRINT' then puts register\n when 'PUSH' then stack.push(register)\n when 'ADD' then register += stack.pop \n when 'SUB' then register -= stack.pop\n when 'MULT' then register *= stack.pop\n when 'DIV' then register /= stack.pop\n when 'MOD' then register %= stack.pop\n when 'POP' then register = stack.pop\n else register = command.to_i\n end\n end\nend", "title": "" }, { "docid": "203e4b967fc426fc42cb8bd5e466f670", "score": "0.60583824", "text": "def minilang(input)\n commands = input.split\n register = 0\n stack = []\n commands.each do |command|\n # binding.pry\n case command\n when 'PUSH'\n stack << register\n when 'ADD'\n register += stack.pop\n when 'SUB'\n register -= stack.pop\n when 'MULT'\n register *= stack.pop\n when 'DIV'\n register /= stack.pop\n when 'MOD'\n register %= stack.pop\n when 'POP'\n register = stack.pop\n when 'PRINT'\n puts register\n else\n register = command.to_i\n end\n end\n # p register\n # p stack\nend", "title": "" }, { "docid": "aaaa1759b1ecb58a19feb37983e52eb6", "score": "0.6045424", "text": "def parse_string string, variables={}, verbose=false\n s = string.dup\n recounter = 0\n while /\\(\\S|\\S\\)/.match(s)\n s.gsub!(/([()])([A-Zn(]{1})/, \"\\\\1 \\\\2\")\n s.gsub!(/([A-Zt)]{1})([()])/, \"\\\\1 \\\\2\")\n if (recounter += 1) >= 5\n puts \"Can't parse in less than 5 steps. Try entering the formula with spaces between parentheses\"\n raise ArgumentError\n end\n end\n operators = {\"not\" => Not.new(), \"or\" => Or.new(), \"and\" => And.new(), \"->\" => If.new(), \"<->\" => Iff.new(), \"(\" => LeftParen.new()}\n sentinel = Sentinel.new\n output_queue = OutputQueue.new()\n operator_stack = [sentinel]\n# wff_stack = []\n# vars = []\n elements = s.split\n elements.each do |e|\n if (\"A\"..\"Z\").include? e\n variables[e] = Variable.new(e) unless variables.has_key? e\n output_queue << variables[e]\n# print \"Vars after adding #{e}: \\t\" + output_queue.to_s + \"\\n\"\n elsif [\"not\", \"and\", \"or\", \"->\", \"<->\"].include? e\n while (not operator_stack[-1].is_a? Sentinel) and operator_stack[-1] > operators[e]\n output_queue << operator_stack.pop\n end\n operator_stack << operators[e]\n# print \"OP after adding #{e}: \\t\" + operator_stack.to_s + \"\\n\"\n elsif e == \"(\"\n operator_stack << operators[e]\n elsif e == \")\"\n until operator_stack[-1].is_a? LeftParen or operator_stack[-1].is_a? Sentinel\n output_queue << operator_stack.pop\n end\n# print \"After paren\"\n operator_stack.pop\n# print operator_stack.to_s + \"\\n\"\n else\n raise ArgumentError\n end\n end\n# print operator_stack\n# print output_queue\n until operator_stack[-1].is_a? Sentinel\n x = operator_stack.pop\n if x.is_a? LeftParen\n raise MismatchedParenthesis\n else\n output_queue << x\n end\n end\n\n# print \"\\n\" + output_queue.map{|x| x.to_s}.join(\"\\t\") + \"\\n\"\n\n return variables, output_queue.get_wff\n\nend", "title": "" }, { "docid": "6bb1d8d97dd7b4a5945efa0ad904775a", "score": "0.60433215", "text": "def minilang(commands)\n register = 0\n stack = []\n commands.split(' ').each do |command|\n register = command.to_i if command.to_i.to_s == command\n case command\n when 'PUSH' then stack.push(register)\n when 'ADD' then register += stack.pop\n when 'SUB' then register -= stack.pop\n when 'MULT' then register *= stack.pop\n when 'DIV' then register /= stack.pop\n when 'MOD' then register %= stack.pop\n when 'POP' then register = stack.pop\n when 'PRINT' then puts register\n end\n end\nend", "title": "" }, { "docid": "4817338c02125b561caf697a03e32eb4", "score": "0.60296404", "text": "def calculate(program)\n operator = ''\n a = 0\n b = 0\n thearray = program.split(\",\").map { |s| s.to_i }\n thearray.each_with_index do | val, key |\n case key.divmod(4)[1]\n when 0\n case val\n when 1\n operator = 'add'\n when 2\n operator = 'multiply'\n when 99\n break\n else\n @result = \"program input invalid\"\n break\n end\n when 1\n a = thearray.at(val)\n puts \"A is #{a}\"\n when 2\n b = thearray.at(val)\n #puts \"B is #{b}\"\n else\n case operator\n when 'add'\n thearray[val] = a + b\n else\n thearray[val] = a * b\n end\n end\n end\n @result = thearray.join(\",\")\n end", "title": "" }, { "docid": "90621adecc75e4620b3b00f92e8b5bf8", "score": "0.59575576", "text": "def execute(state)\n memory = state[:memory].dup\n pos = state[:pos]\n instr = parse_instruction(memory[pos])\n\n a = memory[pos + 1]\n b = memory[pos + 2]\n c = memory[pos + 3]\n\n v1 = instr[:args_immediate][1] ? a : memory[a]\n v2 = instr[:args_immediate][2] ? b : memory[b]\n\n new_pos = pos\n halted = false\n\n if instr[:opcode] == '01'\n puts \"memory[#{c}] = #{v1} + #{v2}\"\n memory[c] = v1 + v2\n new_pos += 4\n\n elsif instr[:opcode] == '02'\n puts \"memory[#{c}] = #{v1} * #{v2}\"\n memory[c] = v1 * v2\n new_pos += 4\n\n elsif instr[:opcode] == '03'\n input = 1 # part 1\n # input = 5 # part 2\n puts \"memory[#{a}] = #{input}\"\n memory[a] = input\n new_pos += 2\n\n elsif instr[:opcode] == '04'\n puts \"OUTPUT: #{v1}\"\n new_pos += 2\n\n elsif instr[:opcode] == '05'\n if v1 != 0\n new_pos = v2\n puts \"JMP #{v2}\"\n else\n new_pos += 3\n end\n\n elsif instr[:opcode] == '06'\n if v1 == 0\n puts \"JMP #{v2}\"\n new_pos = v2\n else\n new_pos += 3\n end\n\n elsif instr[:opcode] == '07'\n memory[c] = v1 < v2 ? 1 : 0\n new_pos += 4\n\n elsif instr[:opcode] == '08'\n memory[c] = v1 == v2 ? 1 : 0\n new_pos += 4\n\n elsif instr[:opcode] == '99'\n halted = true\n else\n raise \"dunno what to do with #{instr[:opcode]}\"\n end\n\n return {\n memory: memory,\n pos: new_pos,\n halted: halted\n }\nend", "title": "" }, { "docid": "a642e3943a543a886d890814b397526f", "score": "0.5952959", "text": "def runOperation (operationalString, lValueOPString, rValueOPString)\n #Create an array\n cmdResultsArray = Array.new()\n\n #Run the first operation\n if operationalString != ''\n #Run the code\n resultsArray = runCode(operationalString)\n\n #Add contents\n cmdResultsArray.push(resultsArray.at(0))\n cmdResultsArray.push(resultsArray.at(1))\n else\n #Push empty results\n cmdResultsArray.push('')\n cmdResultsArray.push('')\n end\n\n #Run the second operation\n if lValueOPString != ''\n #Run the code\n resultsArray = runCode(lValueOPString)\n\n #Add contents\n cmdResultsArray.push(resultsArray.at(0))\n cmdResultsArray.push(resultsArray.at(1))\n else\n #Push empty results\n cmdResultsArray.push('')\n cmdResultsArray.push('')\n end\n\n #Run the third operation\n if rValueOPString != ''\n #Run the code\n resultsArray = runCode(rValueOPString)\n\n #Add contents\n cmdResultsArray.push(resultsArray.at(0))\n cmdResultsArray.push(resultsArray.at(1))\n else\n #Push empty results\n cmdResultsArray.push('')\n cmdResultsArray.push('')\n end\n\n return cmdResultsArray\n end", "title": "" }, { "docid": "b81988fcde97475f4a50c20a38a7c195", "score": "0.5941069", "text": "def calc_ruby(string)\n keyword_hash = {\"add\" => :+, \"subtract\" => :-, \"multiply\" => :*, \"plus\" => :+, \n \"minus\" => :-, \"power\" => :**, \"divide\" => :/, \"divided\" => :/}\n calculate_array = []\n question = []\n # input_array = string.split(\" \")\n input_array = string.scan(/[\\w'\\s]+/)\n \n input_array.each do |x| \n x.split(\" \") \n question << x\n puts question.to_s + \" here1 \"\n puts input_array.to_s + \" here2 \"\n puts question.to_s + \" here3 \" \n\n question.each do |word| \n question = question.shift.split(\" \")\n if keyword_hash.keys.include?(word)\n calculate_array << keyword_hash[word]\n elsif /\\d/.match(word)\n calculate_array << word.to_f\n end\n puts question.join\n end\n puts eval(calculate_array.join)\n end\nend", "title": "" }, { "docid": "87db746a24c11363d9430158c2294cb7", "score": "0.5911558", "text": "def minilang(string)\n commands = string.split(\" \")\n stack = []\n register = 0\n commands.map! do |element|\n if element.match?(/\\d/)\n element.to_i\n else\n element\n end\n end\n commands.each do |element|\n if element.class == Integer\n register = element\n elsif element.class == String\n case element\n when \"PUSH\"\n stack << register\n when \"ADD\"\n register += stack.pop\n when \"SUB\"\n register -= stack.pop\n when \"MULT\"\n register *= stack.pop\n when \"DIV\"\n register /= stack.pop\n when \"MOD\"\n register %= stack.pop\n when \"POP\"\n register = stack.pop\n when \"PRINT\"\n p register\n end\n end\n end\nend", "title": "" }, { "docid": "b1cfdf7132bd6fb0532b4bba7de3f85c", "score": "0.5909006", "text": "def mathString(input)\n\tcalc_stack = input.split(\" \").reverse!\n\tsolution = []\n\t\n\t# Reversing the input allows us pop segments in order\n\twhile !calc_stack.empty?\n\t\tsegment = calc_stack.pop\n\t\toperation = 0\n\t\t\n\t\t# check for double operand\n\t\tif [\"*\",\"/\",\"-\",\"+\"].include? segment\n\t\t\tif [\"*\",\"/\",\"-\",\"+\"].include? calc_stack.last\n\t\t\t\treturn \"not a valid expression\"\n\t\t\tend\n\t\tend\n\t\t\n\t\t# handle multiplication/division first\n\t\tcase segment\n\t\twhen \"/\"\n\t\t\tif calc_stack.last.is_int?\n\t\t\t\toperation = solution.pop / calc_stack.pop.to_f\n\t\t\tend\n\t\t\tsolution << operation\n\t\twhen \"*\"\n\t\t\tif calc_stack.last.is_int?\n\t\t\t\toperation = solution.pop * calc_stack.pop.to_f\n\t\t\tend\n\t\t\tsolution << operation\n\t\twhen \"+\", \"-\"\n\t\t\tsolution << segment #save for later\n\t\telse\n\t\t\tif segment.is_int?\n\t\t\t\tsolution << segment.to_i\n\t\t\telse\n\t\t\t\treturn \"not a valid expression\"\n\t\t\tend\n\t\tend\n\tend\n\t\n\t# Reverse left over operations for popping\n\tsolution = solution.reverse!\n\tbuffer = nil\n\t\n\t# Adding and subtracting, until only solution is left\n\twhile solution.length > 1\n\t\tsegment = solution.pop\n\t\t\n\t\tcase segment\n\t\twhen \"+\"\n\t\t\toperation = buffer.to_f + solution.pop.to_f\n\t\t\tsolution << operation\n\t\t\tbuffer = nil\n\t\twhen \"-\"\n\t\t\toperation = buffer.to_f - solution.pop.to_f\n\t\t\tsolution << operation\n\t\t\tbuffer = nil\n\t\telse\n\t\t\tbuffer = segment # store current segment in buffer\n\t\tend\n\t\t\n\tend\n\t\n\t# return string with answer\n\tsolution.first.to_s\nend", "title": "" }, { "docid": "4b8b157a1a1422524df8f59c21625e34", "score": "0.5906812", "text": "def process(commandsstr, input)\n tracelog {\"process(commands, input).\"}\n output = input.dup\n commandsstr.each_line do |line|\n #tracelog {\"process line #{line}\"}\n output = process_cmd(line, output)\n end\n output\nend", "title": "" }, { "docid": "4b8b157a1a1422524df8f59c21625e34", "score": "0.5906812", "text": "def process(commandsstr, input)\n tracelog {\"process(commands, input).\"}\n output = input.dup\n commandsstr.each_line do |line|\n #tracelog {\"process line #{line}\"}\n output = process_cmd(line, output)\n end\n output\nend", "title": "" }, { "docid": "6cc53e482bd13b764785766f20eefb00", "score": "0.59022766", "text": "def run_program(registers, instructions)\n i = 0\n while i < instructions.length\n instr, arg0, arg1 = instructions[i].split\n case instr\n when \"cpy\"\n registers[arg1] = registers[arg0] != nil ? registers[arg0] : arg0.to_i\n when \"inc\"\n registers[arg0] += 1\n when \"dec\"\n registers[arg0] -= 1\n when \"jnz\"\n if registers[arg0] != 0 || arg0.to_i != 0\n i += arg1.to_i\n next\n end\n end\n i += 1\n end\nend", "title": "" }, { "docid": "bf2a24afae7cf9ce3747fe2fbfef1775", "score": "0.58993846", "text": "def program\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 2 )\n\n\n begin\n # at line 74:10: PROGRAM ID DDOT ( estatute | dim_dec | var_dec | cte_dec | comments )* FIN PROGRAM\n match( PROGRAM, TOKENS_FOLLOWING_PROGRAM_IN_program_492 )\n\n # --> action\n $quads.fill_main_quad() \n # <-- action\n\n match( ID, TOKENS_FOLLOWING_ID_IN_program_496 )\n match( DDOT, TOKENS_FOLLOWING_DDOT_IN_program_498 )\n # at line 74:55: ( estatute | dim_dec | var_dec | cte_dec | comments )*\n while true # decision 4\n alt_4 = 6\n case look_4 = @input.peek( 1 )\n when ID, IF, PRINT, WHILE then alt_4 = 1\n when VAR then look_4_3 = @input.peek( 2 )\n\n if ( look_4_3 == ID )\n look_4_6 = @input.peek( 3 )\n\n if ( look_4_6 == DDOT )\n look_4_7 = @input.peek( 4 )\n\n if ( look_4_7 == BOOLEAN || look_4_7 == FLOAT || look_4_7 == ID || look_4_7 == INTEGER || look_4_7 == STRING || look_4_7 == VOID )\n look_4_8 = @input.peek( 5 )\n\n if ( look_4_8 == LKEY )\n alt_4 = 2\n elsif ( look_4_8 == EQUAL || look_4_8 == SEMI )\n alt_4 = 3\n\n end\n\n end\n\n end\n\n end\n when CTE then alt_4 = 4\n when DIV then alt_4 = 5\n end\n case alt_4\n when 1\n # at line 74:57: estatute\n @state.following.push( TOKENS_FOLLOWING_estatute_IN_program_502 )\n estatute\n @state.following.pop\n\n when 2\n # at line 74:68: dim_dec\n @state.following.push( TOKENS_FOLLOWING_dim_dec_IN_program_506 )\n dim_dec\n @state.following.pop\n\n when 3\n # at line 74:78: var_dec\n @state.following.push( TOKENS_FOLLOWING_var_dec_IN_program_510 )\n var_dec\n @state.following.pop\n\n when 4\n # at line 74:88: cte_dec\n @state.following.push( TOKENS_FOLLOWING_cte_dec_IN_program_514 )\n cte_dec\n @state.following.pop\n\n when 5\n # at line 74:98: comments\n @state.following.push( TOKENS_FOLLOWING_comments_IN_program_518 )\n comments\n @state.following.pop\n\n else\n break # out of loop for decision 4\n end\n end # loop for decision 4\n\n match( FIN, TOKENS_FOLLOWING_FIN_IN_program_523 )\n match( PROGRAM, TOKENS_FOLLOWING_PROGRAM_IN_program_525 )\n\n # --> action\n $manager.finish() \n # <-- action\n\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 2 )\n\n\n end\n\n return \n end", "title": "" }, { "docid": "bedbeca2ca7141570ab7abe3662aec6c", "score": "0.5893845", "text": "def minilang(string)\n commands = string.split\n register = [0]\n stack = []\n\n commands.map! do |cmd|\n cmd.to_i.to_s == cmd ? cmd.to_i : cmd\n end\n\n commands.each do |cmd|\n if cmd.is_a?(Numeric)\n register << cmd\n else\n case cmd\n when 'PUSH' then stack << register.last\n when 'ADD' then register[-1] += stack.pop\n when 'SUB' then register[-1] -= stack.pop\n when 'MULT' then register[-1] *= stack.pop\n when 'DIV' then register[-1] /= stack.pop\n when 'MOD' then register[-1] %= stack.pop\n when 'POP' then register << stack.pop\n when 'PRINT' then p register.last\n end\n end\n end\nend", "title": "" }, { "docid": "9f74801e583cf45ea78493944bddbeb3", "score": "0.58893067", "text": "def minilang(input)\n register = 0\n stack = []\n\n cmd_str = input.split\n cmd_str.each do |cmd|\n register = cmd.to_i if cmd == cmd.to_i.to_s # replace register if command is int\n case cmd\n when 'PUSH'\n stack.push(register)\n when 'POP'\n register = stack.pop\n when 'PRINT'\n puts register\n when 'ADD'\n register = stack.pop + register\n when 'SUB'\n register = stack.pop - register\n when 'MULT'\n register = stack.pop * register\n when 'DIV'\n register /= stack.pop\n when 'MOD'\n register %= stack.pop\n end\n end\n\n return nil # minilang shouldn't return anything\nend", "title": "" }, { "docid": "7913e58074604cac351dc605e4661e2d", "score": "0.58731943", "text": "def output_print\n until @operator_stack.empty?\n @array_output << @operator_stack.pop\n end\n @array_output = @array_output.reverse\n final_array = []\n var = 0\n until @array_output.count == 1\n @array_output.each_with_index do |elem, index|\n next_elem = @array_output[index+1]\n next_next_elem = @array_output[index+2]\n if operand_or_operator(elem) && !operand_or_operator(next_elem) && !operand_or_operator(next_next_elem) && next_elem != nil\n final_array << ['(', elem, next_elem, next_next_elem, ')']\n 2.times do \n @array_output.delete_at(index)\n end\n @array_output[index] = var\n var += 1\n end\n end \n end\n last_elem = final_array.last\n final_string = []\n replace_all(last_elem, final_array, final_string)\n \n puts final_string.join(\" \")\n end", "title": "" }, { "docid": "ef28605c6e63ed05966d4b7749279f4f", "score": "0.58575237", "text": "def stack_machine(command)\n commands = command.split\n stack = []\n register = 0\n\n commands.each do |item|\n case item\n when \"PUSH\" then stack << register.to_i\n when \"ADD\" then register += stack.pop\n when \"SUB\" then register -= stack.pop\n when \"MULT\" then register *= stack.pop\n when \"DIV\" then register /= stack.pop\n when \"MOD\" then register %= stack.pop\n when \"POP\" then register = stack.pop\n when \"PRINT\" then puts register\n else register = item.to_i\n end\n end\n\n puts \"\\n\"\nend", "title": "" }, { "docid": "f3e76a95921a93e511ab155b6c960be2", "score": "0.58562434", "text": "def minilang(commands)\n commands = commands.split\n register = 0\n stack = []\n \n valid_commands = %w(PRINT PUSH ADD SUB MULT DIV MOD POP)\n\n commands.each do |command|\n if command.to_i.to_s != command &&\n valid_commands.include?(command) == false\n puts \"Invalid command. Terminating.\"\n return \"Error\"\n end\n\n case command\n when \"PRINT\"\n mini_print(register)\n when \"PUSH\"\n stack << register\n when \"ADD\"\n register = register + stack.pop\n when \"SUB\"\n register = register - stack.pop\n when \"MULT\"\n register = register * stack.pop\n when \"DIV\"\n register = register / stack.pop\n when \"MOD\"\n register = register % stack.pop\n when \"POP\"\n register = stack.pop\n else # for n (ints)\n register = command.to_i\n end\n end\n\n return nil\nend", "title": "" }, { "docid": "4b04c5508432dc5a86d8b9727c08ff22", "score": "0.58526176", "text": "def program\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 4 )\n\n\n begin\n # at line 118:5: PROGRAM ID COLON ( estatute | dim_dec | var_dec )* R_END PROGRAM\n match( PROGRAM, TOKENS_FOLLOWING_PROGRAM_IN_program_832 )\n\n # --> action\n $quads.fill_program_quad() \n # <-- action\n\n match( ID, TOKENS_FOLLOWING_ID_IN_program_836 )\n match( COLON, TOKENS_FOLLOWING_COLON_IN_program_838 )\n # at line 118:54: ( estatute | dim_dec | var_dec )*\n while true # decision 5\n alt_5 = 4\n look_5_0 = @input.peek( 1 )\n\n if ( look_5_0.between?( ID, IF ) || look_5_0 == PRINT || look_5_0 == WHILE )\n alt_5 = 1\n elsif ( look_5_0 == DEFINE )\n look_5_3 = @input.peek( 2 )\n\n if ( look_5_3 == ID )\n look_5_4 = @input.peek( 3 )\n\n if ( look_5_4 == AS )\n look_5_5 = @input.peek( 4 )\n\n if ( look_5_5 == ID || look_5_5 == R_BOOL || look_5_5.between?( R_FLOAT, R_STRING ) || look_5_5 == VOID )\n look_5_6 = @input.peek( 5 )\n\n if ( look_5_6 == LBRACK )\n alt_5 = 2\n elsif ( look_5_6 == ASGN || look_5_6 == DOT )\n alt_5 = 3\n\n end\n\n end\n\n end\n\n end\n\n end\n case alt_5\n when 1\n # at line 118:56: estatute\n @state.following.push( TOKENS_FOLLOWING_estatute_IN_program_842 )\n estatute\n @state.following.pop\n\n when 2\n # at line 119:47: dim_dec\n @state.following.push( TOKENS_FOLLOWING_dim_dec_IN_program_890 )\n dim_dec\n @state.following.pop\n\n when 3\n # at line 120:47: var_dec\n @state.following.push( TOKENS_FOLLOWING_var_dec_IN_program_938 )\n var_dec\n @state.following.pop\n\n else\n break # out of loop for decision 5\n end\n end # loop for decision 5\n\n match( R_END, TOKENS_FOLLOWING_R_END_IN_program_987 )\n match( PROGRAM, TOKENS_FOLLOWING_PROGRAM_IN_program_989 )\n\n # --> action\n $program.finish() \n # <-- action\n\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 4 )\n\n\n end\n\n return \n end", "title": "" }, { "docid": "31ede1f179b5ab2aadd0f92d451cb59c", "score": "0.5843747", "text": "def program( data=\"1111\", membank=1, offset = \"00\", mask_strongest=true)\r\n \r\n # An idea... Mask the strongest tag we see in the field. This is good for \r\n # single tag programming in the presence of other tags a little away from \r\n # the antenna... \r\n if mask_strongest\r\n self.mask_strongest_tag\r\n end\r\n \r\n #Strip spaces...\r\n data.gsub!(\" \",\"\")\r\n words_to_program = data.length/4\r\n \r\n \r\n # Our reader has the option to do multiple write operations at once... \r\n # kinda cool, but I'm going to limit it to one in this function...\r\n if self.version > \"1.3.3\"\r\n #Newer Firmware: Enable the write descriptor =3 to allow change of pc word.\r\n if membank==1 #programming epc offset data by 2 words\r\n sr=execute(\"xw03#{membank}#{words_to_program}02#{data}\")\r\n else\r\n sr=execute(\"xw03#{membank}#{words_to_program}#{offset}#{data}\")\r\n end\r\n \r\n else\r\n #Older Firmware: Enable the write descriptor =2 to allow change of pc word.\r\n if membank==1 #programming epc offset data by 2 words\r\n sr=execute(\"xw02#{membank}#{words_to_program}02#{data}\")\r\n else\r\n sr=execute(\"xw02#{membank}#{words_to_program}#{offset}#{data}\")\r\n end\r\n \r\n end\r\n \r\n #make up to three attempts\r\n sr=execute(\"t61\")\r\n \r\n if sr.include?(\"XWR0=SUCCESS\")\r\n retvalue=true\r\n else\r\n retvalue=false\r\n end\r\n \r\n #Disable programming.\r\n sr=execute(\"xw00\")\r\n \r\n if mask_strongest\r\n self.clear_epc_mask\r\n end\r\n\r\n return retvalue\r\n \r\n end", "title": "" }, { "docid": "afb25a2dfaab0dbe9b4552df8d6f1c5c", "score": "0.5835795", "text": "def run_program()\n final_words()\n segmented_output()\n end", "title": "" }, { "docid": "b645858535707e956ab9fdd2059bbc33", "score": "0.58353406", "text": "def minilang(prog)\n stack = Array.new\n reg = 0\n\n instructions = prog.split(' ')\n\n #read instructions\n instructions.each do |instr|\n case instr\n when 'PUSH'\n stack.push(reg)\n when 'ADD'\n reg += stack.pop\n when 'SUB'\n reg -= stack.pop\n when 'MULT'\n reg *= stack.pop\n when 'DIV'\n reg /= stack.pop\n when 'MOD'\n reg = reg % stack.pop\n when 'POP'\n reg = stack.pop\n when 'PRINT'\n puts reg\n else\n if instr.to_i.to_s == instr\n reg = instr.to_i\n else\n puts \"Syntax error! Program interupted!\"\n return -1\n end\n end\n end\n return nil\nend", "title": "" }, { "docid": "eede9fd2aaceb96565ddabd3d4f35aa3", "score": "0.5793029", "text": "def build_meta_instructions\n # (1)\n # Find and replace '[-]' combination with the zero instruction\n $l.debug \"Identifying zero-setting pattern [-]...\"\n while(i = @i.map{|x| x.type}.sub_index([Instruction::LS, Instruction::DDV, Instruction::LE])) do\n @i.replace_at!(i, 3, [Instruction.new(Instruction::ZDV, @i[i].token, \n {:repeat => 1, :all_instructions => [@i[i].token, @i[i+1].token, @i[i+2].token], :depth => @i[i].payload[:depth]-1, :token_id => @i[i].token.payload[:token_id]})])\n end\n\n # (2)\n # Compute in-place-print sequence .>.>.>.>.>\n # Find patterns, and progressively replace them\n # Ruby doesn't like multiple assignment in conditionals, hence the duplication of the start, run assignment line\n $l.debug \"Identifying in-place print candidate patterns...\"\n pattern = [[Instruction::OC, 1], [Instruction::IDP, 1]] # only work where repeat => 1\n start, run = @i.map{|x| [x.type, x.payload[:repeat]]}.find_pattern_run( pattern )\n while(start and run)\n prt = run # print this many chars\n sft = run # shift this many chars\n ist = run * pattern.length # Replace this many instructions\n \n #puts \"i.length: #{@i.length}, #{start+ist}\"\n\n # Catch an edge case where the last print does not shift\n if @i.length > start+ist and @i[start+ist].type == Instruction::OC and @i[start+ist].payload[:repeat] == 1 then\n ist += 1\n prt += 1\n end\n\n # back up old instructions\n old_instructions = @i[start..start+ist-1]\n #puts old_instructions.join(\" * \\n\")\n\n # Replace the entries in the array\n @i.replace_at!(start, ist, [Instruction.new(Instruction::IPP, @i[start].token, \n {:print => prt, :shift => sft, :repeat => 1, :all_instructions => old_instructions, :depth => @i[start].token.payload[:depth], :token_id => @i[start].token.payload[:token_id]})])\n\n # Scan again\n start, run = @i.map{|x| [x.type, x.payload[:repeat]]}.find_pattern_run( pattern )\n end\n end", "title": "" }, { "docid": "3eceaba20a48a343f9a9dbb7426b2c90", "score": "0.5773453", "text": "def command_string\n jcl_jobcard +\n \"//S1 EXEC ASMACLG,PARM.L='AC(1)'\\n\" \\\n \"//C.SYSLIB DD DSN=SYS1.SISTMAC1,DISP=SHR\\n\" \\\n \"// DD DSN=SYS1.MACLIB,DISP=SHR\\n\" \\\n \"//L.SYSLMOD DD DISP=SHR,DSN=#{datastore['APFLIB']}(APFPRIV)\\n\" \\\n \"//C.SYSIN DD *,DLM=ZZ\\n\" \\\n \" TITLE 'APF MISCONFIG PRIVESC FOR MSF'\\n\" \\\n \"APFPRIV CSECT\\n\" \\\n \"***********************************************************************\\n\" \\\n \"* SETUP registers and save areas *\\n\" \\\n \"***********************************************************************\\n\" \\\n \"MAIN STM 14,12,12(13) # Save caller reg\\n\" \\\n \" LR 8,15 # Base register\\n\" \\\n \" USING MAIN,8 # R8 for addressability\\n\" \\\n \" GETMAIN RU,LV=72 # for our savearea\\n\" \\\n \" ST 13,4(,1) # Store Caller's SA address\\n\" \\\n \" ST 1,8(,13) # Put my SA addr in caller's SA\\n\" \\\n \" LR 13,1 # R13 has addr of our SA\\n\" \\\n \" DS 0H # halfword boundaries\\n\" \\\n \"***********************************************************************\\n\" \\\n \"* MAIN PROGRAM STMTS HERE *\\n\" \\\n \"***********************************************************************\\n\" \\\n \" BAL 6,AUTHUSR # branch authuser routine\\n\" \\\n \" B EXITP # exit time\\n\" \\\n \"***********************************************************************\\n\" \\\n \"* AUTHUSER ROUTINE *\\n\" \\\n \"***********************************************************************\\n\" \\\n \"AUTHUSR MODESET KEY=ZERO,MODE=SUP # let's get into supervisor mode!\\n\" \\\n \" L 11,X'224' # R11 points to ASCB\\n\" \\\n \" L 11,X'6C'(11) # R11 points to ASXB\\n\" \\\n \" L 11,X'C8'(11) # R11 points to ACEE\\n\" \\\n \" NI X'26'(11),X'00' # Clear Byte x'26'\\n\" \\\n \" OI X'26'(11),X'B1' # Add Oper & Special to userproc\\n\" \\\n \" NI X'27'(11),X'00' # Clear Byte x'27\\n\" \\\n \" OI X'27'(11),X'80' # ALTER access to all resource\\n\" \\\n \" MODESET KEY=NZERO,MODE=PROB # back to normal\\n\" \\\n \" XR 15,15 # set rc=0 regardless\\n\" \\\n \" BR 6 # R6 has return reg\\n\" \\\n \"***********************************************************************\\n\" \\\n \"* Cleanup and exit - R15 has exit code *\\n\" \\\n \"***********************************************************************\\n\" \\\n \"EXITP LR 1,13 # Move my SA into R1\\n\" \\\n \" LR 2,15 # SAVE RC\\n\" \\\n \" L 13,4(,13) # RST Caller SA Addr\\n\" \\\n \" L 14,12(13) # Reload R14\\n\" \\\n \" FREEMAIN RU,A=(1),LV=72\\n\" \\\n \" LR 15,2 # RESTORE RC\\n\" \\\n \" LM 0,12,20(13) # Reload all but 14/15\\n\" \\\n \" BCR 15,14 # Branch back to caller\\n\" \\\n \" END APFPRIV # end pgm\\n\" \\\n \"ZZ\\n\" \\\n \"//S2 EXEC PGM=IKJEFT01\\n\" \\\n \"//SYSTSIN DD *\\n\" \\\n \" ALU #{datastore['FTPUSER']} SPECIAL\\n\" \\\n \" PE BPX.SUPERUSER CLASS(FACILITY) ID(#{datastore['FTPUSER']}) ACCESS(READ)\\n\" \\\n \" SETR RACL(FACILITY) REF\\n\" \\\n \"/*\\n\" \\\n \"//SYSIN DD DUMMY\\n\" \\\n \"//SYSTSPRT DD SYSOUT=*\\n\" \\\n \"//S3 EXEC PGM=IDCAMS\\n\" \\\n \"//SYSPRINT DD SYSOUT=*\\n\" \\\n \"//TEMPDD DD DSN=#{datastore['APFLIB']},DISP=SHR\\n\" \\\n \"//SYSIN DD *\\n\" \\\n \" DELETE #{datastore['APFLIB']}(APFPRIV) FILE(TEMPDD)\\n\" \\\n \"/*\\n\" \\\n end", "title": "" }, { "docid": "65be9b62a291e086028c00fc996564fb", "score": "0.57629967", "text": "def minilang(str)\n operations = str.split(' ')\n stack = []\n register = [0]\n operations.each do |op|\n perform_op(op, stack, register)\n end\nend", "title": "" }, { "docid": "2ebb48c710e91d0d1659419486ca0f84", "score": "0.57602096", "text": "def computeStringVal(inputStr)\n\n #if we didn't get any input, just cease\n #execution\n if inputStr == nil\n return\n end \n\n #convert input string to array structure\n #for convenient computing\n inputArray = inputStr.split(' ')\n\n #initialize a stack to hold numbers that \n #we've already seen separately\n numbersStack = Array.new\n\n inputArray.each do |current|\n\n #if we see an operator, perform necessary arithmetic \n #and place result in the number stack\n if [\"+\", \"-\", \"*\", \"/\"].include?(current)\n\n rightOperand = numbersStack.pop\n leftOperand = numbersStack.pop\n\n #do some error checking\n\n #if we run out of arguments, end execution\n if leftOperand == nil || rightOperand == nil\n puts \"not enough arguments\"\n return\n end \n\n #if arguments are invalid, end execution\n if leftOperand == \"!\" || rightOperand == \"!\"\n puts \"invalid number(s)\"\n return\n end \n\n #do our arithmetic\n newVal = binaryOp(current, leftOperand, rightOperand)\n\n #put our result back into the stack because\n #we will need it later\n numbersStack.push(newVal)\n\n elsif current == \"sqrt\"\n \n operand = numbersStack.pop\n\n #error checking for single operand\n\n #not enough arguments\n if operand == nil \n puts \"not enough arguments\"\n return\n end\n\n #invalid character\n if operand == \"!\"\n puts \"invalid argument\"\n return\n end \n\n #do our arithmetic\n newVal = unaryOp(current, operand)\n\n #push result of unary operation back into stack\n numbersStack.push(newVal)\n\n\n #otherwise, if we see a number, just convert it to an\n #integer and store it in the stack\n elsif current != nil\n numbersStack.push(stringToInt(current))\n end \n\n end \n\n #we're done. print our final result\n puts numbersStack.pop\n\nend", "title": "" }, { "docid": "30de52b0054768d986bc2f4af97f78fe", "score": "0.5756357", "text": "def robotProgram\n\t\n\t\t# Program\n\t\t# 11111111112 \n\t\t# 12345678901234567890\n\t\t# | |\n\t\tmain = \"A,A,B,C,B,A,C,B,C,A\";\n\t\tfuncA = \"L,6,R,12,L,6,L,8,L,8\";\n\t\tfuncB = \"L,6,R,12,R,8,L,8\";\n\t\tfuncC = \"L,4,L,4,L,6\";\n\t\tdoVideo = (@video ? \"y\" : \"n\");\n\t\t\n\t\ttheText = [main, funcA, funcB, funcC, doVideo].join(\"\\n\") + \"\\n\";\n\t\ttheProgram = theText.chars.map(&:ord);\n\n\t\treturn theProgram;\n\n\tend", "title": "" }, { "docid": "1db668b48238f77a7b18e6d384276645", "score": "0.5753219", "text": "def interpreter(program)\n skip = Array.new\n program.chars.each_with_index do |char, index|\n next if skip.include?(index)\n case char\n when '>'\n @pointer += 1\n when '<'\n @pointer -= 1 unless @pointer == 0\n when '+'\n @tape[@pointer] += 1\n when '-'\n @tape[@pointer] -= 1\n when '.'\n print @tape[@pointer].chr\n when ','\n @tape[@pointer] = STDIN.getch.ord\n when '['\n program_loop = program[index+1 .. -1]\n until @tape[@pointer] == 0\n stop = interpreter(program_loop)\n end\n skip += (index+1 .. index+1+stop).to_a\n when ']'\n return index\n when '!'\n next unless @debug\n puts \"Code Near Breakpoint\"\n puts program[index-20..index+20] if index > 20\n puts program[0..index+20] if index <= 20\n puts \"BrainFuck Debugger, type help\"\n loop do\n command = STDIN.gets.chomp\n case command\n when \"exit\"\n break\n when \"tape\"\n puts @tape.to_s\n when \"pointer\"\n puts @pointer\n when \"cell\"\n puts @tape[@pointer]\n when \"byebug\"\n byebug\n when \"help\"\n puts \"Commands\"\n puts \"exit - Stops debugger and continues execution\"\n puts \"tape - Display contents of memory tape (all cells)\"\n puts \"pointer - Display the index of the cell currenly selected\"\n puts \"cell - Display contets of cell currently selected\"\n puts \"byebug - Start byebug ruby debugger (debug interpreter)\"\n puts \"\"\n puts \"Type any command, or brainfuck code to execute\"\n else\n interpreter(command)\n end\n end\n end\n end\nend", "title": "" }, { "docid": "03616ecae36f0744e9b9296ff22a4325", "score": "0.5748953", "text": "def minilang(string)\n stack = []\n register = 0\n\n string.split.each do |input| \n\n case input\n when 'PUSH'\n stack << register\n when 'ADD'\n register = register + stack.pop\n when 'SUB'\n register = register - stack.pop\n when 'MULT'\n register = register * stack.pop\n when 'DIV'\n register = register / stack.pop\n when 'MOD'\n register = register % stack.pop\n when 'POP'\n register = stack.pop\n when 'PRINT'\n puts \"#{register}\"\n else\n register = input.to_i\n end\n end\n\nend", "title": "" }, { "docid": "a1f77bbb796dc75cbc8b3b4b5e0a0dd6", "score": "0.571524", "text": "def parse(input_file, label_count)\n output = []\n\n input_file.each_line do |line|\n next if line.match(/\\/\\/.*/) \n\n # TODO: pointer: 3 + index, temp: 5 + index, this: 3, that: 4\n # local: 1, argument: 0, static: starting with 16\n if match = line.match(/push (?<segment>.+) (?<index>.+)/)\n push_asm = %{\n @%s\n D=A\n @SP\n A=M\n M=D\n @SP\n M=M+1\n }\n if match[:segment] == \"constant\"\n output << (push_asm % match[:index].strip).split\n end\n end\n\n math_asm = %{\n @SP\n D=M\n AM=D-1\n D=M\n A=A-1\n M=M%sD\n }\n output << (math_asm % \"+\").split if line.match(/add/)\n output << (math_asm % \"-\").split if line.match(/sub/)\n\n binary_logic_asm = %{\n @SP\n D=M\n AM=D-1\n D=M\n A=A-1\n M=D%sM\n }\n output << (binary_logic_asm % \"|\").split if line.match(/or/)\n output << (binary_logic_asm % \"&\").split if line.match(/and/)\n\n unary_logic_asm = %{\n @SP\n A=M-1\n D=M\n M=%sD\n }\n output << (unary_logic_asm % \"-\").split if line.match(/neg/)\n output << (unary_logic_asm % \"!\").split if line.match(/not/)\n\n comp_asm = %{\n @SP\n AM=M-1\n D=M\n A=A-1\n D=M-D\n @L#{label_count}\n D;%s\n D=0\n @L#{label_count + 1}\n 0;JMP\n (L#{label_count})\n D=-1\n (L#{label_count + 1})\n @SP\n A=M-1\n M=D\n }\n if line.match(/eq/)\n output << (comp_asm % \"JEQ\").split\n label_count = label_count + 2\n end\n if line.match(/gt/)\n output << (comp_asm % \"JGT\").split\n label_count = label_count + 2\n end\n if line.match(/lt/)\n output << (comp_asm % \"JLT\").split\n label_count = label_count + 2\n end\n end\n return [output, label_count]\nend", "title": "" }, { "docid": "64a2bd85cd5fdb21209015dc6df84068", "score": "0.5697739", "text": "def minilang(operations)\n register = 0\n stack = []\n\n operations.split.each do |op|\n if op == 'ADD'\n register += stack.pop\n elsif op == 'SUB'\n register -= stack.pop\n elsif op == 'MULT'\n register *= stack.pop\n elsif op == 'DIV'\n register /= stack.pop\n elsif op == 'MOD'\n register %= stack.pop\n elsif op == 'POP'\n register = stack.pop\n elsif op == 'PUSH'\n stack << register\n elsif op == 'PRINT'\n puts register\n else\n register = op.to_i\n end\n end\nend", "title": "" }, { "docid": "0155490fa6ddc97c9c5c673128746833", "score": "0.5691127", "text": "def program\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 7 )\n\n\n __ID7__ = nil\n\n\n begin\n # at line 177:5: PROGRAM ID START ( attributes )* ( estatutes )* R_END\n match( PROGRAM, TOKENS_FOLLOWING_PROGRAM_IN_program_843 )\n __ID7__ = match( ID, TOKENS_FOLLOWING_ID_IN_program_845 )\n\n # --> action\n $scope = __ID7__.text\n # <-- action\n\n match( START, TOKENS_FOLLOWING_START_IN_program_849 )\n\n # --> action\n $numTemp = $cuads.num\n # <-- action\n\n\n # --> action\n $cuads.fill_main\n # <-- action\n\n # at line 177:88: ( attributes )*\n while true # decision 13\n alt_13 = 2\n look_13_0 = @input.peek( 1 )\n\n if ( look_13_0.between?( BOOL, CHAR ) || look_13_0 == FLOAT || look_13_0 == INTEGER )\n alt_13 = 1\n\n end\n case alt_13\n when 1\n # at line 177:89: attributes\n @state.following.push( TOKENS_FOLLOWING_attributes_IN_program_855 )\n attributes\n @state.following.pop\n\n else\n break # out of loop for decision 13\n end\n end # loop for decision 13\n\n\n # --> action\n $program.add_func(__ID7__.text, \"void\", 0, $numTemp)\n # <-- action\n\n # at line 177:155: ( estatutes )*\n while true # decision 14\n alt_14 = 2\n look_14_0 = @input.peek( 1 )\n\n if ( look_14_0 == FOR || look_14_0.between?( ID, IF ) || look_14_0 == INPUT || look_14_0 == PRINT || look_14_0 == RETURN || look_14_0 == WHILE )\n alt_14 = 1\n\n end\n case alt_14\n when 1\n # at line 177:156: estatutes\n @state.following.push( TOKENS_FOLLOWING_estatutes_IN_program_862 )\n estatutes\n @state.following.pop\n\n else\n break # out of loop for decision 14\n end\n end # loop for decision 14\n\n match( R_END, TOKENS_FOLLOWING_R_END_IN_program_866 )\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 7 )\n\n\n end\n\n return \n end", "title": "" }, { "docid": "85f2ba9072807a488ca9d0251e355077", "score": "0.56769395", "text": "def handle_instruction(instruction, state)\n output = state[:output].dup\n stack = state[:stack].dup\n code_pointer = state[:code_pointer].dup\n code_direction = state[:code_direction].dup\n\n # Numbers\n if ('0'..'9').include? instruction\n stack.push(instruction.to_i)\n\n # Binary Stack Operations\n elsif ['+', '-', '*', '/', '%', '`'].include? instruction\n a = stack.pop\n b = stack.pop\n\n value = case instruction\n when '+' then b + a\n when '*' then b * a\n when '-' then b - a\n when '/' then b / a\n when '%' then b % a\n when '`' then b > a ? 1 : 0\n end\n\n stack.push(value)\n\n # Setter, Getter\n elsif ['p', 'g'].include? instruction\n y = stack.pop\n x = stack.pop\n case instruction\n when 'p' then @code_array[y][x] = stack.pop.chr\n when 'g' then stack.push @code_array[y][x].ord\n end\n\n # Operations with one stack value\n elsif ['!', '$', '.', ','].include? instruction\n a = stack.pop\n\n case instruction\n when '!' then stack.push(a == 0 ? 1 : 0)\n when '.' then output.push(a)\n when ',' then output.push(a.chr)\n end\n\n # Direction changes\n elsif ['>', '<', 'v', '^', '?', '_', '|'].include? instruction\n code_direction = case instruction\n when '>' then DIRECTIONS[:right]\n when '<' then DIRECTIONS[:left]\n when 'v' then DIRECTIONS[:down]\n when '^' then DIRECTIONS[:up]\n when '?' then DIRECTIONS.values.sample\n when '_' then DIRECTIONS[stack.pop == 0 ? :right : :left]\n when '|' then DIRECTIONS[stack.pop == 0 ? :down : :up]\n end\n\n # String Mode\n elsif instruction == '\"'\n code_pointer = move_pointer(code_pointer, code_direction) # Skip the first quote\n\n loop do\n instruction = get_instruction(code_pointer)\n break if instruction == '\"'\n stack.push(instruction.ord)\n code_pointer = move_pointer(code_pointer, code_direction)\n end\n\n # Swap\n elsif instruction == '\\\\'\n if stack.size == 1\n stack.push(0)\n else\n stack[-1], stack[-2] = stack[-2], stack[-1]\n end\n\n # Duplicate\n elsif instruction == \":\"\n stack.push(stack.empty? ? 0 : stack.last)\n\n # Skip\n elsif instruction == '#'\n code_pointer = move_pointer(code_pointer, code_direction)\n\n elsif instruction != ' '\n raise \"Invalid Instruction '#{instruction}'\"\n end\n\n {\n code_pointer: move_pointer(code_pointer, code_direction),\n code_direction: code_direction,\n stack: stack,\n output: output\n }\n end", "title": "" }, { "docid": "5c13f718bc01336ec2d6da754dc305ec", "score": "0.5676408", "text": "def process(in_array, in_cursor_pos)\n the_instruction = in_array[in_cursor_pos]\n the_opcode = the_instruction % 100\n\n # position modes:\n param1_mode = param2_mode = param3_mode = PARAM_MODE_POSITION # default: position mode\n param1_mode = (the_instruction / 100) % 10\n param2_mode = (the_instruction / 1000) % 10\n param3_mode = (the_instruction / 10000) % 10\n\n if the_opcode == OPCODE_HALT\n puts \"HALT\"\n return 0\n end\n\n if the_opcode == OPCODE_ADD\n pos1 = param1_mode == PARAM_MODE_POSITION ? in_array[in_cursor_pos + 1] : in_cursor_pos + 1\n pos2 = param2_mode == PARAM_MODE_POSITION ? in_array[in_cursor_pos + 2] : in_cursor_pos + 2\n pos3 = param3_mode == PARAM_MODE_POSITION ? in_array[in_cursor_pos + 3] : in_cursor_pos + 3\n\n in_array[pos3] = in_array[pos1] + in_array[pos2]\n return in_cursor_pos + 4\n elsif the_opcode == OPCODE_MULT\n pos1 = param1_mode == PARAM_MODE_POSITION ? in_array[in_cursor_pos + 1] : in_cursor_pos + 1\n pos2 = param2_mode == PARAM_MODE_POSITION ? in_array[in_cursor_pos + 2] : in_cursor_pos + 2\n pos3 = param3_mode == PARAM_MODE_POSITION ? in_array[in_cursor_pos + 3] : in_cursor_pos + 3\n\n in_array[pos3] = in_array[pos1] * in_array[pos2]\n return in_cursor_pos + 4\n elsif the_opcode == OPCODE_INPUT\n pos1 = param1_mode == PARAM_MODE_POSITION ? in_array[in_cursor_pos + 1] : in_cursor_pos + 1\n in_array[pos1] = THE_NOT_SO_MANUAL_INPUT\n return in_cursor_pos + 2\n elsif the_opcode == OPCODE_OUTPUT\n pos1 = param1_mode == PARAM_MODE_POSITION ? in_array[in_cursor_pos + 1] : in_cursor_pos + 1\n puts \"Output: #{in_array[pos1]}\"\n return in_cursor_pos + 2\n elsif the_opcode == OPCODE_JUMP_IF_TRUE\n pos1 = param1_mode == PARAM_MODE_POSITION ? in_array[in_cursor_pos + 1] : in_cursor_pos + 1\n pos2 = param2_mode == PARAM_MODE_POSITION ? in_array[in_cursor_pos + 2] : in_cursor_pos + 2\n return in_array[pos1] != 0 ? in_array[pos2] : in_cursor_pos + 3\n elsif the_opcode == OPCODE_JUMP_IF_FALSE\n pos1 = param1_mode == PARAM_MODE_POSITION ? in_array[in_cursor_pos + 1] : in_cursor_pos + 1\n pos2 = param2_mode == PARAM_MODE_POSITION ? in_array[in_cursor_pos + 2] : in_cursor_pos + 2\n return in_array[pos1] == 0 ? in_array[pos2] : in_cursor_pos + 3\n elsif the_opcode == OPCODE_LESS_THAN\n pos1 = param1_mode == PARAM_MODE_POSITION ? in_array[in_cursor_pos + 1] : in_cursor_pos + 1\n pos2 = param2_mode == PARAM_MODE_POSITION ? in_array[in_cursor_pos + 2] : in_cursor_pos + 2\n pos3 = param3_mode == PARAM_MODE_POSITION ? in_array[in_cursor_pos + 3] : in_cursor_pos + 3\n\n in_array[pos3] = in_array[pos1] < in_array[pos2] ? 1 : 0\n return in_cursor_pos + 4\n elsif the_opcode == OPCODE_EQUALS\n pos1 = param1_mode == PARAM_MODE_POSITION ? in_array[in_cursor_pos + 1] : in_cursor_pos + 1\n pos2 = param2_mode == PARAM_MODE_POSITION ? in_array[in_cursor_pos + 2] : in_cursor_pos + 2\n pos3 = param3_mode == PARAM_MODE_POSITION ? in_array[in_cursor_pos + 3] : in_cursor_pos + 3\n\n in_array[pos3] = in_array[pos1] == in_array[pos2] ? 1 : 0\n return in_cursor_pos + 4\n end\n return 0\nend", "title": "" }, { "docid": "b6ee4df2228e29d83570b48d9fe25b7d", "score": "0.56716", "text": "def calculate_input(x)\n if x == 'done'\n puts \"Thank you, this has been awesome.\"\n exit\n else\n ## There's no need to initialize this variable with an empty array, since you just replace the value on the next line.\n operation = []\n operation = x.split\n p operation\n a = operation[0]\n op = operation[1]\n c = operation[2]\n\n ## .to_i doesn't change the value of a; it returns a new value, which you'd need to store in a variable to use later. For example, you could have done\n ## \n ## a = operation[0].to_i\n\n a.to_i\n c.to_i\n\n ## Splitting and then evaling doesn't really accomplish much; you almost might as well just eval the input directly. \n ## \n ## I think what they're going for here is for you to check the operator string yourself (using if/elsif) and do the appropriate thing with the operands. That's both more flexible (you could support custom operators) and safer (evaling user input is basically always a bad idea, since it could do anything, like delete all your files)\n\n p eval \"#{a} #{op} #{c}\"\n\n ## A function calling itself is a good way to keep it going, but this is a little backwards. You're asking for and taking input after you process it. What I would do is probably split this function into two: \n ## - a function that just attempts to calculate the math\n ## - a function that handles the input loop (asking for input, deciding when to exit vs. repeat) and calls the other function if necessary\n\n puts \" Request an operation, like '4 + 5':\\nOr type 'done' to exit.\"\n next_operation = gets.chomp\n calculate_input(next_operation)\n end\nend", "title": "" }, { "docid": "720afe5e0c9cae91ffca8171fe85cd03", "score": "0.56711495", "text": "def calculator\n\tloop do\n\t\tprint '> '\n\t\tinput = gets.chomp.split(' ')\n\t\t# p input\n\t\tcommand = input[0].downcase\n\t\t# parallel assignment\n\t\targ1, arg2 = input[1,2].map! { |n| n.to_f }\n\t\t# p command, arg1, arg2\n\t\tcase command\n\t\twhen \"quit\"\n\t\t\tbreak\n\t\twhen \"add\", \"sum\", \"plus\", \"+\"\n\t\t\tputs arg1 + arg2\n\t\twhen \"multiply\", \"product\", \"*\", \"times\"\n\t\t\tputs arg1 * arg2\n\t\twhen \"subtract\", \"minus\", \"-\", \"difference\"\n\t\t\tputs arg1 - arg2\n\t\twhen \"divide\", \"/\"\n\t\t\tputs arg1 / arg2\n\t\telse\n\t\t\tputs \"I don't understand that\"\n\t\tend\n\t\tputs\n\tend\n\tputs \"goodbye\"\nend", "title": "" }, { "docid": "b68079043893f4b013f16904ff58fa88", "score": "0.56514406", "text": "def dump_prog\n @prog.each do |instr|\n print instr[0].to_s, \" \"\n print instr[1].to_s if instr[1]\n print \", \", instr[2].to_s if instr[2]\n print \"\\n\"\n end\n end", "title": "" }, { "docid": "43dc31ddd72e6268a3ea7dbe2f246e03", "score": "0.5647558", "text": "def assemble_a_command(instruction)\n \tcommand = \"0\"\n \tcommand << constant(instruction[1..-1])\n end", "title": "" }, { "docid": "9352d389c00245da25773e0ceb207bbf", "score": "0.56341857", "text": "def translate_arithmetic_sub(command, line)\n [\n \"\\n// #{command} line:#{line}\",\n '@SP', # A=0, M = RAM[SP], M = *SP\n 'AM=M-1', # A = RAM[SP] - 1 , M = RAM[RAM[SP] - 1]\n 'D=M', # D = RAM[RAM[SP] - 1]\n 'A=A-1', # A = RAM[SP] - 2, M = RAM[RAM[SP] -2]\n 'M=M-D' # RAM[RAM[SP] -2] = RAM[RAM[SP] - 1] + RAM[RAM[SP] -2]\n ]\n end", "title": "" }, { "docid": "717c2a9b4b0cacf05fd220f66045c4b4", "score": "0.5624913", "text": "def place_input(inp, format_arr)\n\n state = true\n answer_array = []\n\n sub_length = 0\n segment_length = 0\n m = 0\n count = 0\n while state && m < format_arr.length\n\n count = count + 1\n\n # Here we list through the array to detect segments of instructions from the input\n val = nil\n callback = nil\n i = 0\n j = 1\n k = 0\n\n while (inp[sub_length + i] != ' ' && inp[sub_length + i] != format_arr[m][1]) && (sub_length + i < inp.length - 1)\n i = i + 1\n end\n\n if format_arr[m][1] != ' ' && inp[sub_length + i] == ' '\n while (inp[sub_length + i + k] != format_arr[m][1]) && (sub_length + i + k < inp.length - 1)\n k = k + 1\n end\n end\n\n while (inp[sub_length + i + j + k] == ' ') && (sub_length + i + j + k < inp.length - 1)\n j = j + 1\n end\n \n\n\n\n # Test to see if format is violated\n if !((inp[sub_length + i] == format_arr[m][1]) || format_arr[m][1] == '')\n state = false\n end\n\n\n\n\n # InputObject is where the methods for processing all the different type of format combinations. A new InputObject is\n # created and the relevant arguments are passed. If the developer has not supplied InputObject code, then rather than\n # causing an error, it will give a warning.\n begin\n input_object = InputObject.new(inp, sub_length, i, format_arr[m][0])\n callback = input_object.process_input()\n state = callback[0]\n segment_length = callback[1]\n answer_array.push(callback[2])\n sub_length = sub_length + segment_length + format_arr[m][1].length + (j - 1) + k\n m = m + 1\n\n rescue\n callback = nil\n puts \"Unable to continue as input class has not been defined for place_input method\"\n end\n\n end\n\n\n if state\n\n if !(sub_length == inp.length)\n state = false\n end\n\n end\n\n if state\n return answer_array\n end\n \n\n return nil\n\nend", "title": "" }, { "docid": "7f2f6af020fd174257a389888c0122d3", "score": "0.5614859", "text": "def run()\r\n\t\tinput = gets\r\n\t\tupperCase = input[0,1].upcase\r\n\t\twhile(!upperCase.eql?(\"Q\"))\r\n\t\t\tif upperCase.upcase.eql?(\"S\")\r\n\t\t\t\tsum()\r\n\t\t\telsif upperCase.upcase.eql?(\"A\")\r\n\t\t\t\tvector = input[1,input.length];\r\n\t\t\t\tappend(vector)\r\n\t\t\telsif upperCase.upcase.eql?(\"D\")\r\n\t\t\t\tvector = input[1,input.length];\r\n\t\t\t\tdeleteTV(vector)\r\n\t\t\telsif upperCase.upcase.eql?(\"M\")\r\n\t\t\t\tscalar = input[1,input.length];\r\n\t\t\t\tmultipy(scalar)\r\n\t\t\telsif upperCase.upcase.eql?(\"P\")\r\n\t\t\t\tprint()\r\n\t\t\telse \r\n\t\t\t\tputs upperCase + \" is not a valid command!\"\r\n\t\t\tend\r\n\t\t\tinput = gets.chomp\r\n\t\t\tupperCase = input[0,1].upcase\r\n\t\tend\r\n\t\tputs \"Normal Termination of Program 1\"\r\n\tend", "title": "" }, { "docid": "32a774a82fa32401a8d00d70737ec25b", "score": "0.56122214", "text": "def parse(lines,out)\n\t# line index\n\tln = 0\n\t# iterate through each line of the \n\tlines.each do |line|\n\t\t# switch statement on the type of the command\n\t\t# Note that we do not handle the 'L' case here. This is because\n\t\t# this get handled in the stripWhiteSpace function i.e. during\n\t\t# the initial file parsing\n\t\tcase commandType(line)\n\t\twhen 'A'\n\t\t\t# get rid of the '@' symbol\n\t\t\tline[0] = ''\n\t\t\t# check to see if we can interpret this \n\t\t\t# line as an integer\n\t\t\tval = make_address_from_int(line)\n\t\t\t# if this statement is true, it means we got an\n\t\t\t# error from make_address_from_int i.e. we gave it a \n\t\t\t# non-integer-looking argument\n\t\t\tif val.class == Integer\n\t\t\t\t# does the symbol exist\n\t\t\t\tbool = query_symbol(line)\n\t\t\t\t# if yes, get its address, o.w. return false\n\t\t\t\tval = bool ? bool[:address] : false\n\t\t\t\t# if the symbol didnt exist, add it and increment the index\n\t\t\t\tif !val then val = make_address_from_sym(line,@symbol_index); @symbol_index += 1 end\n\t\t\tend\n\t\t\t# if we got an error anywhere in here we'll see this line \n\t\t\te = \"Address error in line \" + ln.to_s\n\t\twhen 'C'\n\t\t\t# get the result of comp,dest, and jump\n\t\t\tc,d,j = comp(line), dest(line), jump(line)\n\t\t\t# if we didnt get any weird values, create our binary string\n\t\t\tval = \"111\" + c + d + j if ![c,d,j].any?{|x| x.class == Integer}\n\t\t\t# the error for C commands\n\t\t\te = \"C Command error in line \" + ln.to_s\n\t\telse\n\t\t\te = \"Unrecognized command error in line \"+ ln.to_s \n\t\tend\n\t\tln += 1\n\t\t# if the val is recognized, add it to the out array o.w. return an error\n\t\tif val then out << val+\"\\n\" else return e end\n\tend\n\treturn \"Successfully parsed \"+ lines.length.to_s + \" lines of code.\"\nend", "title": "" }, { "docid": "075670057dfca25e7e427a3053090934", "score": "0.5612111", "text": "def pandig_string()\r\n\t# We have 10! combinations possible\r\n\tproc_adder = Proc.new{ |add, condition, tmp, num, index|\r\n\t\tnext unless([add].flatten == [add].flatten.uniq)\r\n\t\tnext unless(num - [add].flatten == num)\r\n\t\tnext unless(condition)\r\n\t\tto_add = num.clone\r\n\t\t[index].flatten.each_with_index{ |i, ii| \r\n\t\t\tto_add[i] = [add].flatten[ii]\r\n\t\t}\r\n\t\ttmp << to_add\r\n\t}\r\n\r\n\t# The returner\r\n\tthe_nums = []\r\n\r\n\t# x4x5x6 % 5 ==> x6 == {0, 5}\r\n\tthe_nums << [nil, nil, nil, nil, nil, 0, nil, nil, nil, nil]\r\n\tthe_nums << [nil, nil, nil, nil, nil, 5, nil, nil, nil, nil]\r\n\r\n\t# All special runs are over -- next can be systemized\r\n\tcheks = [\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# ADD DIGITS:\r\n\t\t\t\t[ 9, Proc.new{ |a, n| a % 2 == 0 }, 3],\t# 4: x2x3x4 % 2 ==> x4 % 2\r\n\t\t\t\t[98, Proc.new{ |a, n| (a[0] + n[3] + a[1]) % 3 == 0 }, [2, 4]],\t# 3, 5: x3x4x5 % 3 ==> x3+x4+x5 % 3\r\n\t\t\t\t[ 9, Proc.new { |a, n| (n[4]*10 + n[5] - 2*a) % 7 == 0 }, 6],\t# 7: x5x6x7 % 7 == > x5x6 - 2*x7 % 7\r\n\t\t\t\t[ 9, Proc.new { |a, n| \"#{n[5]}#{n[6]}#{a}\".to_i % 11 == 0 }, 7],\t# 8: x6x7x8 % 11\r\n\t\t\t\t[ 9, Proc.new { |a, n| \"#{n[6]}#{n[7]}#{a}\".to_i % 13 == 0 }, 8],\t# 9: x7x8x9 % 13\r\n\t\t\t\t[ 9, Proc.new { |a, n| \"#{n[7]}#{n[8]}#{a}\".to_i % 17 == 0 }, 9],\t# 10: x8x9x10 % 17\r\n\t\t\t\t[ 9, Proc.new { |a, n| true }, 0], \t# 1: x1 can be any\r\n\t\t\t\t[ 9, Proc.new { |a, n| true }, 1]\t# 2: x2 can be any\r\n\t\t\t]\r\n\r\n\tcheks.each{ |max_num, the_proc, the_index| \r\n\t\ttmp = []\r\n\t\tthe_nums.each{ |num|\r\n\t\t\t(0..max_num).each{ |add|\r\n\t\t\t\tto_add = add\r\n\t\t\t\tif(max_num.to_s.size > 1)\r\n\t\t\t\t\tto_add = '0'*(max_num.to_s.size - add.to_s.size) + add.to_s\r\n\t\t\t\t\tto_add = to_add.split('').map{ |a| a.to_i }\r\n\t\t\t\tend\r\n\t\t\t\tproc_adder.call(to_add, the_proc.call(to_add, num), tmp, num, the_index)\r\n\t\t\t}\r\n\t\t}\r\n\t\tthe_nums = tmp\r\n\t}\r\n\r\n\tthe_nums.each{ |num| puts num.join(',') }\r\n\t\r\n#\tputs '________________'\r\n\treturner = the_nums.map{ |row| row.join('').to_i }\r\n\treturn returner.inject(0){ |sum, num| sum + num.to_i }\r\nend", "title": "" }, { "docid": "0a5424c1f7e4e8d33515ff99977aafbf", "score": "0.56102955", "text": "def translate(assem)\n parsingObject = Parser.new(assem)\n codeObject = Code.new\n loc = 0\n\n while (parsingObject.hasMoreCommands)\n if (parsingObject.commandType == 'A_COMMAND')\n $machineCode[loc] = codeObject.toBinary(parsingObject.symbol.to_i)\n elsif (parsingObject.commandType == 'C_COMMAND')\n $machineCode[loc] = \"111\" + codeObject.comp(parsingObject.comp) + codeObject.dest(parsingObject.dest) + \n codeObject.jump(parsingObject.jump)\n end\n parsingObject.advance\n loc += 1\n end\nend", "title": "" }, { "docid": "743af1af7f56fcf49f431e3d45336eb6", "score": "0.5602441", "text": "def get_command_from_string(command_string)\n #Split the command based on the equal '=' sign.\n remove = \"\"\n keyword=\"\"\n value=\"\"\n \n if (command_string != \"\")\n #Get command and u-value\n if ( command_string.match(/(^\\s*(\\\".*?\\\")\\s*\\=\\s*(\\S+)\\s*)/) )\n @commandName=$3.strip\n @utype = $2.strip\n remove = Regexp.escape($1)\n \n else\n # if no u-value, get just the command.\n command_string.match(/(^\\s*(\\S*)\\s*)/ )\n remove = Regexp.escape($1)\n @commandName=$2.strip\n end\n #Remove command from string.\n \n command_string.sub!(/#{remove}/,\"\")\n \n \n #Loop throught the keyword values. \n while ( command_string.length > 0 )\n\n #Parameter type command.\n if ( command_string.match(/(^\\s*(\".*?\")\\s*(\\=?)\\s*(\\S*)\\s*)/) and @commandName == \"PARAMETER\" )\n #puts \"Quotes\"\n keyword = $2\n value = $4.strip\n remove = Regexp.escape($1)\n \n\n #DOEMaterial, or SCHEDULES\n elsif ( command_string.match(/(^\\s*(MATERIAL)\\s*(\\=?)\\s*(.*)\\s*)(THICKNESS.*|INSIDE-FILM-RES.*)/))\n #puts \"Bracket\"\n keyword = $2.strip\n value = $4.strip\n remove = Regexp.escape($1)\n\n elsif ( command_string.match(/(^\\s*(MATERIAL|DAY-SCHEDULES|WEEK-SCHEDULES)\\s*(\\=?)\\s*(.*)\\s*)/))\n #puts \"Bracket\"\n keyword = $2.strip\n value = $4.strip\n remove = Regexp.escape($1)\n #Stars\n elsif ( command_string.match(/(^\\s*(\\S*)\\s*(\\=?)\\s*(\\*.*?\\*)\\s*)/))\n #puts \"Bracket\"\n keyword = $2.strip\n value = $4.strip\n remove = Regexp.escape($1)\n \n #Brackets\n elsif ( command_string.match(/(^\\s*(\\S*)\\s*(\\=?)\\s*(\\(.*?\\))\\s*)/))\n #puts \"Bracket\"\n keyword = $2.strip\n value = $4.strip\n remove = Regexp.escape($1)\n # Curly Brackets\n elsif ( command_string.match(/(^\\s*(\\S*)\\s*(\\=?)\\s*(\\{.*?\\})\\s*)/))\n #puts \"Bracket\"\n keyword = $2.strip\n value = $4.strip\n remove = Regexp.escape($1)\n\n #Quotes\n elsif ( command_string.match(/(^\\s*(\\S*)\\s*(\\=?)\\s*(\".*?\")\\s*)/) )\n #puts \"Quotes\"\n keyword = $2\n value = $4.strip\n remove = Regexp.escape($1)\n #single command\n elsif command_string.match(/(^\\s*(\\S*)\\s*(\\=?)\\s*(\\S+)\\s*)/)\n #puts \"Other\"\n keyword = $2\n value = $4.strip\n remove = Regexp.escape($1)\n end\n #puts \"DOE22::DOECommand: #{command_string}\"\n #puts \"K = #{keyword} V = #{value}\\n\"\n if (keyword != \"\")\n set_keyword_value(keyword,value)\n end\n command_string.sub!(/#{remove}/,\"\")\n end\n #puts \"Keyword\"\n #puts keywordPairs\n end \n end", "title": "" }, { "docid": "067d5120bb512e2f573bcfd8e3218160", "score": "0.558758", "text": "def disassemble(raw_program_counter)\n\n case @hexchars[raw_program_counter]\n when nil\n trace = sprintf(\"%03x: 0000 Abnormal exit!\", raw_program_counter)\n proc = lambda { @running = false }\n Instruction.new(trace, proc)\n when '0'\n trace = sprintf(\"%03x: 0000 Exit\", raw_program_counter)\n proc = lambda { @running = false }\n Instruction.new(trace, proc)\n when '1'\n address = get__NNN(raw_program_counter)\n trace = sprintf(\"%03x: 1%03x Jump to the address %03x of the file\",\n raw_program_counter, address, address)\n proc = lambda { |address| @program_counter = _address }\n Instruction.new(trace, proc, address)\n when '3'\n register, value = get__XKK(raw_program_counter)\n trace = sprintf( \\\n \"%03x: 3%s%02x Skip next instruction if V%s == %02x\",\n raw_program_counter, register.hexchar, value,\n register.hexchar, value)\n proc = lambda do |_register, _value|\n @program_counter += 4\n @program_counter += 4 if (_register.value == _value)\n end\n Instruction.new(trace, proc, register, value)\n when '6'\n register, value = get__XKK(raw_program_counter)\n trace = sprintf(\"%03x: 6%s%02x V%s = %02x\", raw_program_counter,\n register.hexchar, value, register.hexchar, value)\n proc = lambda do |_register, _value|\n _register.value = _value\n @program_counter += 4\n end\n Instruction.new(trace, proc, register, value)\n when '7'\n register, value = get__XKK(raw_program_counter)\n trace = sprintf(\"%03x: 7%s%02x V%s = V%s + %02x\",\n raw_program_counter, register.hexchar, value, register.hexchar,\n register.hexchar, value)\n proc = lambda do |_register, _value|\n newValue = _register.value + _value\n if (newValue > 0x00ff)\n _register.value = newValue & 0x00ff\n @registers[15].value = 1\n else\n _register.value = newValue\n @registers[15].value = 0\n end\n @program_counter += 4\n end\n Instruction.new(trace, proc, register, value)\n when '8'\n register1, register2, type = get__XYn(raw_program_counter)\n case type\n when '0'\n trace = sprintf(\"%03x: 8%s%s0 V%s = V%s\", raw_program_counter,\n register1.hexchar, register2.hexchar,\n register1.hexchar, register2.hexchar)\n proc = lambda do |_register1, _register2|\n _register1.value = _register2.value\n @program_counter += 4\n end\n Instruction.new(trace, proc, register1, register2)\n when '1'\n trace = sprintf(\"%03x: 8%s%s1 V%s = V%s OR V%s\",\n raw_program_counter, register1.hexchar, register2.hexchar,\n register1.hexchar, register1.hexchar, register2.hexchar)\n proc = lambda do |_register1, _register2|\n _register1.value |= _register2.value\n @program_counter += 4\n end\n Instruction.new(trace, proc, register1, register2)\n when '2'\n trace = sprintf(\"%03x: 8%s%s2 V%s = V%s AND V%s\",\n raw_program_counter, register1.hexchar, register2.hexchar,\n register1.hexchar, register1.hexchar, register2.hexchar)\n proc = lambda do |_register1, _register2|\n _register1.value &= _register2.value\n @program_counter += 4\n end\n Instruction.new(trace, proc, register1, register2)\n when '3'\n trace = sprintf(\"%03x: 8%s%s3 V%s = V%s XOR V%s\",\n raw_program_counter, register1.hexchar, register2.hexchar,\n register1.hexchar, register1.hexchar, register2.hexchar)\n proc = lambda do |_register1, _register2|\n _register1.value ^= _register2.value\n @program_counter += 4\n end\n Instruction.new(trace, proc, register1, register2)\n when '4'\n trace = sprintf(\"%03x: 8%s%s4 V%s = V%s + V%s\",\n raw_program_counter, register1.hexchar, register2.hexchar,\n register1.hexchar, register1.hexchar, register2.hexchar)\n proc = lambda do |_register1, _register2|\n newValue = _register1.value + _register2.value\n if (newValue > 0x00ff)\n _register1.value = newValue & 0x00ff\n @registers[15].value = 1\n else\n _register1.value = newValue\n @registers[15].value = 0\n end\n @program_counter += 4\n end\n Instruction.new(trace, proc, register1, register2)\n when '5'\n trace = sprintf(\"%03x: 8%s%s5 V%s = V%s - V%s\",\n raw_program_counter, register1.hexchar, register2.hexchar,\n register1.hexchar, register1.hexchar, register2.hexchar)\n proc = lambda do |_register1, _register2|\n if (_register1.value >= _register2.value)\n _register1.value -= _register2.value\n @registers[15].value = 1\n else\n _register1.value += 0x0100 - _register2.value\n @registers[15].value = 0\n end\n @program_counter += 4\n end\n Instruction.new(trace, proc, register1, register2)\n when '6'\n trace = sprintf(\"%03x: 8%s06 V%s = V%s SHIFT RIGHT 1\",\n raw_program_counter,\n register1.hexchar, register1.hexchar, register1.hexchar)\n proc = lambda do |_register|\n @registers[15].value = _register.value & 0x0001\n _register.value >>= 1\n @program_counter += 4\n end\n Instruction.new(trace, proc, register1)\n when '7'\n trace = sprintf(\"%03x: 8%s%s7 V%s = V%s - V%s\",\n raw_program_counter, register1.hexchar, register2.hexchar,\n register1.hexchar, register2.hexchar, register1.hexchar)\n proc = lambda do |_register1, _register2|\n if (_register2.value >= _register1.value)\n _register1.value = _register2.value - _register1.value\n @registers[15].value = 1\n else\n _register1.value \\\n = _register2.value + 0x0100 - _register1.value\n @registers[15].value = 0\n end\n @program_counter += 4\n end\n Instruction.new(trace, proc, register1, register2)\n when 'e'\n trace = sprintf(\"%03x: 8%s0e V%s = V%s SHIFT LEFT 1\",\n raw_program_counter,\n register1.hexchar, register1.hexchar, register1.hexchar)\n proc = lambda do |_register|\n @registers[15].value = _register.value & 0x0080\n _register.value <<= 1\n _register.value &= 0x00ff\n @program_counter += 4\n end\n Instruction.new(trace, proc, register1)\n else\n raise ArgumentError,\n sprintf(\"Invalid instruction 8%s%s%s at %03x\",\n @hexchars[raw_program_counter + 1],\n @hexchars[raw_program_counter + 2],\n @hexchars[raw_program_counter + 3], raw_program_counter)\n end\n when 'c'\n register, value = get__XKK(raw_program_counter)\n trace = sprintf(\"%03x: C%s%02x V%s = Random number AND %02x\",\n raw_program_counter,\n register.hexchar, value, register.hexchar, value)\n proc = lambda do |_register, _value|\n _register.value = rand(256) & value\n @program_counter += 4\n end\n Instruction.new(trace, proc, register, value)\n else\n raise ArgumentError,\n sprintf(\"Invalid instruction %s%s%s%s at %03x\",\n @hexchars[raw_program_counter],\n @hexchars[raw_program_counter + 1],\n @hexchars[raw_program_counter + 2],\n @hexchars[raw_program_counter + 3], raw_program_counter)\n end\n end", "title": "" }, { "docid": "9849380299284320af34bfeaf95627e2", "score": "0.5577547", "text": "def minilang(string)\n register = 0\n stack = []\n orders = string.split\n orders.each do |item|\n case item\n when 'PUSH' then stack << register\n when 'ADD' then register = register + stack.pop\n when 'SUB' then register = register - stack.pop\n when 'MULT' then register = register * stack.pop\n when 'DIV' then register = register / stack.pop\n when 'MOD' then register = register % stack.pop\n when 'POP' then register = stack.pop\n when 'PRINT' then puts register\n else \n register = item.to_i\n end\n end\nend", "title": "" }, { "docid": "2b75920a53cb93d7d5ad558f01dc9a4a", "score": "0.5575869", "text": "def to_s\n <<-EOF\n Program name = #{program_name}\n\n Tempo = #{@program.tempo} BPM\n Octave = #{@program.octave}\n\n VCO1 Wave = #{@program.vco1_wave}\n VCO1 Octave = #{@program.vco1_octave}\n VCO1 Pitch = #{vco1_pitch}\n VCO1 Shape = #{vco1_shape}\n\n VCO2 Wave = #{@program.vco2_wave}\n VCO2 Octave = #{@program.vco2_octave}\n VCO2 Pitch = #{vco2_pitch}\n VCO2 Shape = #{vco2_shape}\n\n VCO2 Cross Mod Depth = #{vco2_cross_mod_depth}\n VCO2 Pitch EG Int = #{vco2_pitch_eg_int}\n VCO2 Sync = #{@program.vco2_sync}\n VCO2 Ring = #{@program.vco2_ring}\n\n Mixer for VCO1 = #{mixer_vco1}\n Mixer for VCO2 = #{mixer_vco2}\n Mixer for Noise = #{mixer_noise}\n\n Filter Cutoff = #{filter_cutoff}\n Filter Resonance = #{filter_resonance}\n Filter EG Int = #{filter_eg_int}\n Filter Pole = #{filter_pole}\n Filter Key Track = #{filter_key_track}\n Filter Velocity = #{filter_velocity}\n\n AMP EG Attack = #{amp_eg_attack}\n AMP EG Decay = #{amp_eg_decay}\n AMP EG Sustain = #{amp_eg_sustain}\n AMP EG Release = #{amp_eg_release}\n\n EG Attack = #{eg_attack}\n EG Decay = #{eg_decay}\n EG Sustain = #{eg_sustain}\n EG Release = #{eg_release}\n\n LFO Wave = #{@program.lfo_wave}\n LFO EG Mod = #{@program.lfo_eg_mod}\n LFO Rate = #{lfo_rate}\n LFO Int = #{lfo_int}\n LFO Target = #{@program.lfo_target}\n\n Delay Hi Pass Cutoff = #{delay_hi_pass_cutoff}\n Delay Time = #{delay_time}\n Delay Feedback = #{delay_feedback}\n Delay Output Routing = #{@program.delay_output_routing}\n\n Voice Mode Depth = #{voice_mode_depth}\n Voice Mode = #{@program.voice_mode}\n \n EOF\n end", "title": "" }, { "docid": "fd2727579751e76a287da0ecb1f7f156", "score": "0.55700874", "text": "def shunt(input) #input string\r\n index = 0 #input string index\r\n output = Array.new #output queue (TODO: make efficient)\r\n ops = Array.new #operator stack\r\n\r\n #load token\r\n while(index < input.length)\r\n token = '' #token holder\r\n case input[index..-1]\r\n when /^\\d+/ #number token\r\n token = $~.to_s\r\n output.push(token)\r\n when /^[d\\-\\+\\/\\*]/ #operator token\r\n #more complex, expand for precedence\r\n token = $~.to_s\r\n ops.push(token)\r\n when /^\\(/ #left paren\r\n token = $~.to_s\r\n ops.push(token)\r\n when /^\\)/ #right paren\r\n token = $~.to_s\r\n #shift operators to the output queue until we find the matching paren\r\n last_op = ops.pop()\r\n while not last_op == '(' and not ops.empty?\r\n output.push(last_op)\r\n last_op = ops.pop()\r\n end\r\n\r\n if last_op != '('\r\n puts 'mismatched parentheses'\r\n return\r\n end\r\n\r\n\r\n else\r\n puts 'invalid'\r\n\r\n end\r\n\r\n index += token.length #step the token position\r\n\r\n end\r\n\r\n #finalize\r\n while not ops.empty?\r\n token = ops.pop()\r\n if token == '(' or token == ')'\r\n puts 'mismatched parentheses'\r\n return\r\n else\r\n output.push(token)\r\n end\r\n end\r\n\r\n\r\n\r\n puts 'output: ' + output.to_s\r\n puts 'ops: ' + ops.to_s\r\n\r\n ostr = ''\r\n output.each do |t|\r\n ostr += t += ' '\r\n end\r\n ostr = ostr[0..-2] #truncate trailing space\r\n puts ostr\r\n\r\n output\r\nend", "title": "" }, { "docid": "0b8cea19f64b5a2a034a673f7314bf19", "score": "0.55544686", "text": "def test_instructions_string\n instructions = [\n make(Opcode::ADD, []),\n make(Opcode::CONSTANT, [2]),\n make(Opcode::CONSTANT, [65_535])\n ]\n\n expected = <<~EXP\n 0000 OpAdd\n 0001 OpConstant 2\n 0004 OpConstant 65535\n EXP\n concatted = instructions.flatten\n assert_equal(expected, format_instructions(concatted))\n end", "title": "" }, { "docid": "51c835e719e6e0f6986ab16893a7d9fa", "score": "0.5552942", "text": "def parse_Program\n ary = []\n\n while (e = parse_Expression) do\n ary << e\n end\n\n AST::Program.new(ary)\n end", "title": "" }, { "docid": "9e7fc016beeeae2ce14b2a43e39f3bbc", "score": "0.55317295", "text": "def assemble(program)\n p = program.flatten.map { |i|\n (i.class == String) ? self[i] : i\n }\n\n return p.pack('V*')\n end", "title": "" }, { "docid": "ed81f2ac927bcdd2173118b997e293ec", "score": "0.5514784", "text": "def program_user_4( data=[\"1111\",\"2222\",\"3333\",\"4444\"], membank=3, offset = [\"00\",\"08\",\"10\",\"18\"], mask_strongest=true)\r\n \r\n # An idea... Mask the strongest tag we see in the field. This is good for \r\n # single tag programming in the presence of other tags a little away from \r\n # the antenna... \r\n \r\n\r\n if mask_strongest\r\n self.mask_strongest_tag\r\n end\r\n \r\n #Strip spaces...\r\n data.each do |entry|\r\n if entry\r\n entry.gsub!(\" \",\"\")\r\n end\r\n end\r\n \r\n words_to_program = data[0].length/4\r\n \r\n # Our reader has the option to do multiple write operations at once... \r\n # kinda cool, but I'm going to limit it to one in this function...\r\n \r\n if self.version > \"1.3.3\"\r\n #Newer Firmware: Enable the write descriptor =3 to allow change of pc word.\r\n if membank==1 #programming epc offset data by 2 words\r\n else\r\n if data[0] \r\n sr=execute(\"xw03#{membank}#{words_to_program}#{offset[0]}#{data[0]}\")\r\n end\r\n if data[1] \r\n sr=execute(\"xw13#{membank}#{words_to_program}#{offset[1]}#{data[1]}\")\r\n end\r\n if data[2] \r\n sr=execute(\"xw23#{membank}#{words_to_program}#{offset[2]}#{data[2]}\")\r\n end\r\n if data[3] \r\n sr=execute(\"xw33#{membank}#{words_to_program}#{offset[3]}#{data[3]}\")\r\n end\r\n \r\n end\r\n \r\n else\r\n raise \"Funciton not supported on older firmware\"\r\n end\r\n \r\n\r\n #make up to three attempts\r\n sr=execute(\"t61\")\r\n \r\n if sr.include?(\"XWR0=SUCCESS\")\r\n retvalue=true\r\n else\r\n retvalue=false\r\n end\r\n \r\n #Disable programming.\r\n sr=execute(\"xwr\")\r\n \r\n if mask_strongest\r\n self.clear_epc_mask\r\n end\r\n\r\n return retvalue\r\n \r\n end", "title": "" }, { "docid": "2efb6f4b9f75abb7ad0541676d5b6f01", "score": "0.5512351", "text": "def do_opcode(indexZero, someIntProgram)\n case someIntProgram[indexZero] #run each opcode/set of four\n when 99\n #puts \"hit 99, program finished\"\n when 1\n #puts \"add\"\n pos1 = someIntProgram[indexZero+1] \n pos2 = someIntProgram[indexZero+2]\n pos3 = someIntProgram[indexZero+3]\n val1 = someIntProgram[pos1]\n val2 = someIntProgram[pos2]\n sum = val1 + val2\n someIntProgram[pos3] = sum\n when 2\n #puts \"multiply\"\n pos1 = someIntProgram[indexZero+1]\n pos2 = someIntProgram[indexZero+2]\n pos3 = someIntProgram[indexZero+3]\n val1 = someIntProgram[pos1]\n val2 = someIntProgram[pos2]\n product = val1 * val2\n someIntProgram[pos3] = product\n else\n # puts\"Error\"\n end\nend", "title": "" }, { "docid": "d58246ab382b7680ef8712eb6cd9f077", "score": "0.5511782", "text": "def parse_program()\n # puts \"parsing program\"\n parse_statement\n if @tokens.first.kind == Token::EOL\n return\n elsif @tokens.first.kind == Token::EOF\n abort\n else\n puts \"Error: invalid input\"\n abort\n end\n end", "title": "" }, { "docid": "abe709eac2bfc9e86a760242459f7f58", "score": "0.5510744", "text": "def program\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 1 )\n return_value = ProgramReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n functions1 = nil\n\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 58:4: functions\n @state.following.push( TOKENS_FOLLOWING_functions_IN_program_52 )\n functions1 = functions\n @state.following.pop\n @adaptor.add_child( root_0, functions1.tree )\n # --> action\n return_value.result = ProgramTree.new(( functions1.nil? ? nil : functions1.list ))\n # <-- action\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 1 )\n\n end\n \n return return_value\n end", "title": "" }, { "docid": "e2efb5c3b025aa8e357a0f9883a47c3f", "score": "0.55089194", "text": "def command(comstr)\n if(comstr.is_a?(Array)) \n comstr.each{ |com| command(com) ; } ;\n end\n \n @strm.print(comstr) ;\n @strm.print(\"\\n\") ;\n end", "title": "" }, { "docid": "d70eb218a022415191a74a75efa02863", "score": "0.5502061", "text": "def get_machine_code\n all = []\n while has_more_commands?\n advance\n if command_type == :C_COMMAND\n all << '111' + comp + dest + jump\n elsif command_type == :A_COMMAND\n all << symbol\n end\n end\n return all.join(\"\\n\") + \"\\n\"\n end", "title": "" }, { "docid": "181ab6e19b103543dcef532f11c0bc26", "score": "0.55003923", "text": "def run_program(instructions)\n state = instructions.each_with_index.map { |x, i| [i, x] }.to_h\n\n (0...instructions.length).each_slice(4) do |is|\n op_num, a1, a2, a3 = is.map { |i| state[i] }\n\n op = resolve_op(op_num)\n\n break if op == :break\n\n state[a3] = state.fetch(a1).send(op, state.fetch(a2))\n end\n\n state\nend", "title": "" }, { "docid": "181ab6e19b103543dcef532f11c0bc26", "score": "0.55003923", "text": "def run_program(instructions)\n state = instructions.each_with_index.map { |x, i| [i, x] }.to_h\n\n (0...instructions.length).each_slice(4) do |is|\n op_num, a1, a2, a3 = is.map { |i| state[i] }\n\n op = resolve_op(op_num)\n\n break if op == :break\n\n state[a3] = state.fetch(a1).send(op, state.fetch(a2))\n end\n\n state\nend", "title": "" }, { "docid": "69f1ee8b2af1ff0ef8f7ffca99a0e359", "score": "0.5498179", "text": "def calculate_instructions\n self.instructions = self.instructions_s.to_s.strip.gsub(/\\s+/, \"\").split(\"\") if self.instructions_s.present?\n end", "title": "" }, { "docid": "a84402152e4541f09d922a893d0b11fe", "score": "0.549113", "text": "def registers_io\n instructions = []\n\n IO.foreach(\"../input/input23-registers-computer.txt\") do |line|\n data = line.chomp.split\n \n command = data[0]\n \n if data[1][-1] == \",\"\n target = data[1][0]\n elsif data[1][0] == \"+\" || data[1][0] == \"-\"\n target = data[1].to_i\n else\n target = data[1]\n end\n\n if data[2]\n instructions << [command, target, data[2][1..-1].to_i]\n else\n instructions << [command, target]\n end\n end\n\n instructions\nend", "title": "" }, { "docid": "9498125cf31654970f9d1ac9c554d6e5", "score": "0.5486178", "text": "def string_operation\n buffer.ask 'Ruby code: ', value: 'str.' do |code, action|\n case action\n when :attempt\n begin\n string_operation!(code)\n rescue Exception => ex\n VER.warn(ex)\n buffer.warn(ex)\n else\n clear\n finish\n :abort\n end\n end\n end\n end", "title": "" }, { "docid": "92870bcd4087b11ddf2d802d8bae548d", "score": "0.54788685", "text": "def push_string(s)\n\t\tputs \"intcode:> #{s}\"\n\t\tpush_all(s.each_byte.to_a)\n\t\t@inputs << 10\n\tend", "title": "" } ]
ed4a8fa90011b6cbc6dded569a7f1dfa
Add a breakpoint for when application control flow enters a class.
[ { "docid": "803e721f4496579687a8be1b4f2a2fd7", "score": "0.7017796", "text": "def add_class_entry_breakpoint(class_filter)\n return if @class_entry_breakpoints[class_filter]\n\n bp = @mgr.createMethodEntryRequest\n bp.setSuspendPolicy(EventRequest.SUSPEND_ALL);\n bp.addClassFilter(class_filter);\n bp.enable();\n\n @class_entry_breakpoints[class_filter] = bp\n end", "title": "" } ]
[ { "docid": "cff4c3352fd1507b03f64ffb27cd5aed", "score": "0.6614684", "text": "def add_breakpoints(klass, method)\n return if klass.respond_to?(\"_before_breakpoint_#{method}\")\n klass.send(:alias_method, :\"_before_breakpoint_#{method}\", method)\n klass.send(:define_method, method) do |*args|\n Breakpoints.break(:\"before_#{method}\")\n ret_val = self.send(:\"_before_breakpoint_#{method}\", *args)\n Breakpoints.break(:\"after_#{method}\")\n ret_val\n end\n end", "title": "" }, { "docid": "a055d78a0dcedd68b75769a1f5352ca4", "score": "0.648037", "text": "def breakpoint()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "ca02e0e7b0c909ef0f557fedddcf04e5", "score": "0.6474059", "text": "def add_break\n\t\tcheck_if_myself\n\t\t@break = Break.new\n\tend", "title": "" }, { "docid": "e2ec0fedf8be5f3031a8c847601442c8", "score": "0.6253358", "text": "def breakpoint binding; IRB.start_with_binding binding end", "title": "" }, { "docid": "fa3b993832bf54ce82e6623a1b8fe096", "score": "0.6172016", "text": "def set_breakpoint(source, pos, condition = nil)\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "4e1f86311eb4923ebba209858980372d", "score": "0.6060079", "text": "def add_breakpoint(file, line, expr=nil)\n breakpoint = Breakpoint.new(file, line, expr)\n breakpoints << breakpoint\n breakpoint\n end", "title": "" }, { "docid": "9e4725acd083c4cb53500f45eff79003", "score": "0.6021709", "text": "def debug it\n PryByebug::BreakCommand.new.send :add_breakpoint, \"Testo::Test#run\", nil\n # How to \"next next step\" automatically when the breakpoint is hit?\n\n begin\n run it\n raise \"Cannot reproduce. It might be a heisebug.\"\n rescue\n $!\n end\nend", "title": "" }, { "docid": "4752e0c506dcda76e6e5cd029e352a11", "score": "0.5962583", "text": "def enable_breakpoint(bp)\n bp.enable\n end", "title": "" }, { "docid": "1df0e6554b9e03c481852fbca7cd8a6d", "score": "0.59490234", "text": "def break(breakpoint)\n if ::Thread.current[:breakpoints] &&\n ::Thread.current[:breakpoints].include?(breakpoint)\n ::Thread.current[:breakpoints_reached] << breakpoint\n puts \"breaking on #{breakpoint}\"\n self.main_thread.run\n ::Thread.stop\n end\n end", "title": "" }, { "docid": "4341ebb57eb8046359f58ae2e9521523", "score": "0.5801312", "text": "def set_breakpoints\n (breakpoints - @instance_breakpoints).each {|b| set_breakpoint(b) }\n @instance_breakpoints += breakpoints\n end", "title": "" }, { "docid": "a0152ab296026f49e0f729afdb77b8a1", "score": "0.5791809", "text": "def trigger_breakpoint\n local_var = 6 * 7\n local_var\n end", "title": "" }, { "docid": "a1fe8190027e2e592999212715e47ff2", "score": "0.5695556", "text": "def at_breakpoint(breakpoint)\n @pry ||= Pry.new\n\n output.puts bold(\"\\n Breakpoint #{breakpoint.id}. \") + n_hits(breakpoint)\n\n expr = breakpoint.expr\n return unless expr\n\n output.puts bold(\"Condition: \") + expr\n end", "title": "" }, { "docid": "d56732ed6c9c6b67ddc5ad8f2b373741", "score": "0.5689498", "text": "def set_breakpoint(ip, obj)\n Rubinius.primitive :compiledmethod_set_breakpoint\n raise ArgumentError, \"Unable to set breakpoint on #{inspect} at invalid bytecode address #{ip}\"\n end", "title": "" }, { "docid": "46792b97202d35afe78d80643a15abe7", "score": "0.5664532", "text": "def at_breakpoint(_context, breakpoint)\n @pry ||= Pry.new\n\n output.puts bold(\"\\n Breakpoint #{breakpoint.id}. \") + n_hits(breakpoint)\n\n expr = breakpoint.expr\n return unless expr\n\n output.puts bold('Condition: ') + expr\n end", "title": "" }, { "docid": "cfa769abd18c2cab606c8acef630ba32", "score": "0.5648032", "text": "def test_parent_breakpoint\n # skip \"Need to add ISEQ parent link to 1.9.2 and further check of old code\"\n # require_relative '../../lib/trepanning'\n line = __LINE__ # This is the line we set the breakpoint for.\n 1.times do\n tf = RubyVM::Frame.get\n @cmdproc.frame_setup(tf)\n run_cmd(@my_cmd, [@name, line.to_s])\n assert_equal(true, @cmdproc.errmsgs.empty?, @cmdproc.errmsgs)\n assert_equal(0, @cmdproc.msgs[0] =~ @brkpt_set_pat, @cmdproc.msgs[0])\n reset_cmdproc_vars\n end\n end", "title": "" }, { "docid": "ddbb6e686acd5361b5705173bb61fd0e", "score": "0.562317", "text": "def set_breakpoint(cm, ip)\n @breakpoint_tracker.on(cm, :ip => ip)\n end", "title": "" }, { "docid": "6c854df676e1704ce5969205cd78be37", "score": "0.5608079", "text": "def breakpoint?\n type == :breakpoint\n end", "title": "" }, { "docid": "bfe7b202686759036e8eff1634a92b30", "score": "0.5566011", "text": "def set_breakpoint(cm, ip, condition=nil)\n @breakpoint_tracker.on(cm, :ip => ip, :condition => condition)\n end", "title": "" }, { "docid": "529b5d20f0dc88dd3df447c738cd9f50", "score": "0.5510573", "text": "def info_breakpoints\n @queue << \"i b\"\n end", "title": "" }, { "docid": "546b782f4deb2d83d40c17e1acddc545", "score": "0.5432771", "text": "def break\n @break = true\n end", "title": "" }, { "docid": "7f64c659a54d862cb96409bc7c2fec13", "score": "0.5402438", "text": "def breakpoint_initialize\n @brkpts = BreakpointMgr.new\n @brkpt = nil\n end", "title": "" }, { "docid": "98ee25ea95d5940ee90b1756b44d3cff", "score": "0.53938466", "text": "def pass_in_breakpoint!(temporal_type, task)\n if task[:breakpoint]\n case task.temporal_type\n when :sequential\n if subtask = task.subtasks.first\n subtask[:breakpoint] = true\n end\n when :concurrent\n task.subtasks.map { |subtask| subtask[:breakpoint] = true }\n end\n end\n end", "title": "" }, { "docid": "ed17f010aa4dd682e4cfde5d19b0a54c", "score": "0.5370163", "text": "def break!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 18 )\n\n type = BREAK\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 139:9: 'break'\n match( \"break\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 18 )\n\n end", "title": "" }, { "docid": "462522d4e358420cafc1b1563e122b79", "score": "0.5353884", "text": "def break!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 27 )\n\n type = BREAK\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 329:9: 'break'\n match( \"break\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 27 )\n\n end", "title": "" }, { "docid": "0045814143a586c177e6fcefc911917f", "score": "0.5350133", "text": "def break\n if ! advance? then return self end\n @@logger.debug \"Handle break.\"\n SandboxModule::set_break\n @break_at = SandboxModule::line_count\n return self\n end", "title": "" }, { "docid": "cb8238f27651d45d0dddaa02458920ab", "score": "0.5321146", "text": "def BRK(address:)\n set_flag(SR_BREAK)\n set_flag(SR_UNUSED)\n @running = false\n end", "title": "" }, { "docid": "f00eabc788d32cab4f38ea0502ac66e8", "score": "0.5270125", "text": "def break=(point)\n @queue << \"break #{point}\"\n end", "title": "" }, { "docid": "0b2f43a2e68824452b723f6d7a365832", "score": "0.5206513", "text": "def activate_debugger(thread, ctxt, bp_list)\n @debug_thread = thread\n @interface.at_breakpoint(self, thread, ctxt, bp_list)\n end", "title": "" }, { "docid": "2ad31ecd8e6057198cdc7d46478b5add", "score": "0.5197198", "text": "def sample_snappoint\n file_path = \"acceptance/debugger_helper.rb\"\n line = method(:trigger_breakpoint).source_location.last + 2\n\n breakpoint_hash = {\n \"location\" => {\n \"path\" => file_path,\n \"line\" => line\n },\n \"create_time\" => {\n \"seconds\" => Time.now.to_i,\n \"nanos\" => Time.now.nsec\n },\n \"expressions\" => [\"local_var\"]\n }\n\n Google::Cloud::Debugger::V2::Breakpoint.new breakpoint_hash\n end", "title": "" }, { "docid": "aa0cd9b14c520e90b4a3b493392784b9", "score": "0.5184265", "text": "def activate_debugger(thread, ctxt, bp)\n puts \"[Debugger activated]\" unless bp.kind_of? StepBreakpoint\n @debug_thread = thread\n @eval_context = @debug_context = ctxt\n\n # Load debugger commands if we haven't already\n load_commands unless @commands\n\n file = @debug_context.file.to_s\n line = @debug_context.line\n\n puts \"\"\n puts \"#{file}:#{line} (#{@debug_context.method.name}) [IP:#{@debug_context.ip}]\"\n output = Output.new\n output.set_line_marker\n output.set_color :cyan\n if bp.kind_of? StepBreakpoint and bp.step_by == :ip\n bc = @debug_context.method.decode\n inst = bc[bc.ip_to_index(@debug_context.ip)]\n output.set_columns([\"%04d:\", \"%-s \", \"%-s\"])\n output << [inst.ip, inst.opcode, inst.args.map{|a| a.inspect}.join(', ')]\n else\n lines = source_for(file)\n unless lines.nil?\n output.set_columns(['%d:', '%-s'])\n output << [line, lines[line-1].chomp]\n end\n end\n output.set_color :clear\n puts output\n\n @prompt = \"\\nrbx:debug> \"\n until @done do\n inp = Readline.readline(@prompt)\n inp.strip!\n if inp.length > 0\n process_command(inp)\n @last_inp = inp\n elsif @last_inp\n process_command(@last_inp)\n end\n end\n\n # Clear any references to the debuggee thread and context\n @debug_thread = nil\n @debug_context = nil\n @eval_context = nil\n end", "title": "" }, { "docid": "7b49f5a3a7a023664f4f4c388113520e", "score": "0.5167283", "text": "def in_class(name)\n @class_stack.unshift(name)\n yield\n @class_stack.shift\n end", "title": "" }, { "docid": "7203df567b15bfb2fe11e8ee769904dd", "score": "0.51459444", "text": "def breakpoint?(ip)\n Rubinius.primitive :compiledmethod_is_breakpoint\n raise ArgumentError, \"Unable to retrieve breakpoint status on #{inspect} at bytecode address #{ip}\"\n end", "title": "" }, { "docid": "d21b42ce78df3a731cad15f87b2fec0e", "score": "0.510862", "text": "def custom_set_codeline_class\n @codeline_class = CodeLine\n puts \"[Application Error]\".colorize(:color => :white, :background => :red) + \" [#{__FILE__}][Need to override #{__method__} method in #{self.class} class]\".red\n return false\n end", "title": "" }, { "docid": "63ec523d7b4fae7831f26472b2ea4456", "score": "0.5068412", "text": "def breakpoint!(text='Click anywhere to continue...', timeout=0)\n puts \">> breakpoint reached. click anywhere in the browser to continue\"\n\n text = text.gsub(\"\\\"\", \"\\\\\\\"\")\n\n execute_scopejs_script %(\n document.body.appendChild(div(\n {\n id: '_breakpoint_overlay',\n style: 'background-color: rgba(0, 0, 0, 0.6); position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 10; text-align: center;',\n onClick: function() { App.remove_element('_breakpoint_overlay'); }\n },\n p({ style: 'margin: 150px 100px; line-height: 60px; font-size: 50px; color: white; text-shadow: 3px 3px #000' }, \"#{text}\"))\n );\n if (#{timeout} > 0) setTimeout(function() {\n var e = document.getElementById('_breakpoint_overlay');\n e.parentNode.removeChild(e);\n }, #{timeout});\n console.log(\"** Breakpoint reached **\");\n )\n\n while execute_scopejs_script(\"return document.getElementById('_breakpoint_overlay');\") do\n sleep 0.25 # waiting a little\n end\n\n puts \">> continuing from breakpoint\"\n end", "title": "" }, { "docid": "caa6012abf7fd3202323cd41617df638", "score": "0.5064055", "text": "def break(filename, linenum, &block)\n raise \"#{filename} has not been compiled\" unless @compiled_scripts.key?(filename)\n\n compiled_script = @compiled_scripts[filename]\n set_trap(compiled_script, linenum, block)\n end", "title": "" }, { "docid": "c1ae8ce28ac2986ede994f736c5e91da", "score": "0.50368863", "text": "def on_break(*args, &block)\n if block_given?\n @on_break = block\n else\n @on_break.call(*args) if @on_break\n end\n end", "title": "" }, { "docid": "6d9cb67c2dfd8d1618e8de8b3188ceca", "score": "0.5028666", "text": "def breakpoint_recipe\n recipe = tag_value(BREAKPOINT_TAG)\n end", "title": "" }, { "docid": "146a0a83c33a77f8a9fa8d7325e1929d", "score": "0.4988769", "text": "def activate\n @@active = true\n bb_stack = []\n fn = lambda do |e, f, l, m, b, k|\n unless k == TracePoint or (k == Kernel && m == :set_trace_func)\n #(p e, f, l, m, b, k, @@bb_stack; puts \"---\") if $DEBUG\n if ['call','c-call','class'].include?(e)\n bb_stack << b\n elsif ['return','c-return','end'].include?(e)\n bb = bb_stack.pop\n end\n b = bb if ! b # this sucks!\n tp = TracePoint.new(e, f, l, m, b, bb)\n @@procs.each{ |fn| fn.call(tp) }\n end\n end\n set_trace_func(fn)\n end", "title": "" }, { "docid": "af22d692c292506013ee68ce0fda998e", "score": "0.4981122", "text": "def break()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "04e4e0e5b21d06fc87594e71f3318ff1", "score": "0.49508268", "text": "def on_start(_klass, _method); end", "title": "" }, { "docid": "f4ec6b9c4f17ff6a2f52da36fcdd7338", "score": "0.4933152", "text": "def break?\n @break\n end", "title": "" }, { "docid": "78f1c6b283c564c21ec328d1f22a5fbe", "score": "0.4911107", "text": "def at_line\n resume_pry\n end", "title": "" }, { "docid": "77201171c405e589baf1338a46d8785c", "score": "0.49048916", "text": "def in_klass name\n @class_stack.unshift name\n yield\n @class_stack.shift\n end", "title": "" }, { "docid": "7dda4cf13cccf77fd3f6415994232a26", "score": "0.48972893", "text": "def breakpoint_line(line_number, initial_iseq, temp=false)\n # FIXME: handle breakpoint conditions.\n found_iseq = initial_iseq.child_iseqs.detect do |iseq|\n iseq.lineoffsets.keys.member?(line_number)\n end\n unless found_iseq\n found_iseq = initial_iseq.parent\n while found_iseq do\n break if found_iseq.lineoffsets.keys.member?(line_number)\n found_iseq = found_iseq.parent\n end\n end\n offset =\n if found_iseq\n # FIXME\n found_iseq.line2offsets(line_number)[1] ||\n found_iseq.line2offsets(line_number)[0]\n else\n nil\n end\n unless offset\n place = \"in #{iseq.source_container.join(' ')} \" if found_iseq\n errmsg(\"No line #{line_number} found #{place}for breakpoint.\")\n return nil\n end\n @brkpts.add(found_iseq, offset, :temp => temp)\n end", "title": "" }, { "docid": "70c8b5e61d07d5157d559a9ad47dd116", "score": "0.48700798", "text": "def initialize\n @breakpoint_tracker = BreakpointTracker.new do |thread, ctxt, bp|\n activate_debugger thread, ctxt, bp\n end\n\n # Register this debugger as the default debug channel listener\n Rubinius::VM.debug_channel = @breakpoint_tracker.debug_channel\n\n @quit = false\n @breakpoint_listener = Thread.new { handle_breakpoints }\n Thread.pass until waiting_for_breakpoint?\n end", "title": "" }, { "docid": "148e48756460aa4be88e58049bb6214d", "score": "0.4861766", "text": "def initialize\n # HACK readline causes `rake spec` to hang in ioctl()\n require 'readline-native'\n\n @breakpoint_tracker = BreakpointTracker.new do |thread, ctxt, bp|\n activate_debugger thread, ctxt, bp\n end\n\n # Register this debugger as the default debug channel listener\n Rubinius::VM.debug_channel = @breakpoint_tracker.debug_channel\n\n @quit = false\n @breakpoint_listener = Thread.new do\n thrd = nil\n until @quit do\n @done = false\n begin\n thrd = @breakpoint_tracker.wait_for_breakpoint\n @breakpoint_tracker.wake_target(thrd) unless @quit # defer wake until we cleanup\n rescue Error => e\n puts \"An exception occured while processing a breakpoint:\"\n puts e\n end\n end\n # Release singleton, since our loop thread is exiting\n Debugger.__clear_instance\n\n # Remove all remaining breakpoints\n @breakpoint_tracker.clear_breakpoints\n\n # De-register debugger on the global debug channel\n Rubinius::VM.debug_channel = nil\n\n if thrd\n # thrd will be nil if debugger was quit from other than a debug thread\n puts \"[Debugger exiting]\"\n @breakpoint_tracker.wake_target(thrd)\n end\n @breakpoint_tracker.release_waiting_threads\n end\n Thread.pass until waiting_for_breakpoint?\n end", "title": "" }, { "docid": "f75aa700ac2b6cdecb906bd546d0d0ff", "score": "0.48574954", "text": "def after_class(class_node); end", "title": "" }, { "docid": "2de5513deda2001999be15f5b2aee0ae", "score": "0.48460683", "text": "def run(args)\n\n ## FIXME: DRY this code, tbreak and break.\n unless args.size == 1\n describe, klass_name, which, name, line, ip = \n @proc.breakpoint_position(args[1..-1])\n unless describe\n errmsg \"Can't parse temporary breakpoint location\"\n return \n end\n if name.kind_of?(Rubinius::CompiledMethod)\n bp = @proc.set_breakpoint_method(describe, name, line, ip,\n {:temp=>true, :event =>'tbrkpt'})\n unless bp\n errmsg \"Trouble setting temporary breakpoint\"\n return \n end\n else\n return unless klass_name\n begin\n klass = @proc.debug_eval(klass_name, settings[:maxstring])\n rescue NameError\n errmsg \"Unable to find class/module: #{klass_name}\"\n return\n end\n \n begin\n if which == \"#\"\n method = klass.instance_method(name)\n else\n method = klass.method(name)\n end\n rescue NameError\n errmsg \"Unable to find method '#{name}' in #{klass}\"\n return\n end\n arg_str = args[1..-1].join(' ')\n bp = @proc.set_breakpoint_method(arg_str.strip, method, line, nil,\n {:temp=>true, :event =>'tbrkpt'})\n unless bp\n errmsg \"Trouble setting temporary breakpoint\"\n return \n end\n end\n end\n @proc.continue('continue')\n end", "title": "" }, { "docid": "14508b8b00ed10d632c73579a1b1dbeb", "score": "0.48301715", "text": "def breakpoints\n @breakpoints ||= []\n end", "title": "" }, { "docid": "db4d898c7399afa641d385d687d4981a", "score": "0.47921792", "text": "def in_class(name)\n name = class_name_from_sexp(name) if name.kind_of?(Sexp)\n @class_stack.unshift name\n yield\n @class_stack.shift\n end", "title": "" }, { "docid": "71a5526afe4245d34caecfebd8a6d7eb", "score": "0.47425508", "text": "def print_full_breakpoint(breakpoint)\n header = \"Breakpoint #{breakpoint.id}:\"\n status = breakpoint.enabled? ? \"Enabled\" : \"Disabled\"\n code = breakpoint.source_code.with_line_numbers.to_s\n condition = if breakpoint.expr\n \"#{bold('Condition:')} #{breakpoint.expr}\\n\"\n else\n \"\"\n end\n\n output.puts <<-BREAKPOINT.gsub(/ {8}/, \"\")\n\n #{bold(header)} #{breakpoint} (#{status}) #{condition}\n\n #{code}\n\n BREAKPOINT\n end", "title": "" }, { "docid": "ba8ddfbaabf1ab573bd22ba50df14f50", "score": "0.4725756", "text": "def add_break(options)\n self << Break.new(options.merge(max: 1048575, man: true))\n last\n end", "title": "" }, { "docid": "001e47dde9d5534362542d6fccc3f0b9", "score": "0.4721598", "text": "def change(id, expression = nil)\n validate_expression expression\n\n breakpoint = find_by_id(id)\n breakpoint.expr = expression\n breakpoint\n end", "title": "" }, { "docid": "bd9d8da391aa2eaae7d2cf9e011e2abc", "score": "0.46943873", "text": "def start_class(class_node)\n @first_sentences = {}\n\n class_node.body.children.each do |child_node|\n break if PROTECTED_PRIVATE_CALLS.include? child_node\n remember_first_sentence(child_node) if :defn == child_node.node_type\n end\n @first_sentences.each do |first_sentence, defn_nodes|\n if defn_nodes.size > @customize_count\n add_error \"use before_filter for #{defn_nodes.collect(&:method_name).join(',')}\", class_node.file, defn_nodes.collect(&:line).join(',')\n end\n end\n end", "title": "" }, { "docid": "ee0e15d243b467ac0c88a7d2a8cf58cf", "score": "0.46934968", "text": "def start_debugger\n # First try the more modern 'byebug'\n begin\n require \"byebug\"\n byebug\n rescue LoadError\n # If that fails, try the older debugger\n begin\n require 'debugger'\n debugger\n rescue LoadError\n self.log.info \"No debugger found, can't break on failures.\"\n end\n end\n end", "title": "" }, { "docid": "13483e6a70e382d044cb0adf19f1ba8a", "score": "0.4672337", "text": "def process_class exp\n if exp.class_name == :Application\n @inside_config = true\n process_all exp.body if sexp? exp.body\n @inside_config = false\n end\n\n exp\n end", "title": "" }, { "docid": "8814b895420ef5f425c092e93cd261d8", "score": "0.4658746", "text": "def custom_set_codeline_class\n @codeline_class = SASSLine\n end", "title": "" }, { "docid": "404de0625f6dfcd666604755249c303b", "score": "0.46550047", "text": "def get_breakpoint(cm, ip)\n @breakpoint_tracker.get_breakpoint(cm, ip)\n end", "title": "" }, { "docid": "c09706a8140459674e2a47a6c0a21ef7", "score": "0.46512702", "text": "def listen(step_into=false)\n @breakpoint = nil\n while true\n if @channel\n if step_into\n @channel << :step\n else\n @channel << true\n end\n end\n\n # Wait for someone to stop\n @breakpoint, @debugee_thread, @channel, @vm_locations = \n @local_channel.receive\n\n # Uncache all frames since we stopped at a new place\n @frames = []\n\n set_frame(0)\n\n if @breakpoint\n # Some breakpoints are frame specific. Check for this. hit!\n # also removes the breakpoint if it was temporary and hit.\n break if @breakpoint.hit!(@vm_locations.first.variables)\n else\n @processor.step_bp.remove! if @processor.step_bp\n break\n end\n end\n\n event = \n if @breakpoint\n @breakpoint.event || 'brkpt'\n else\n # Evan assures me that the only way the breakpoint can be nil\n # is if we are stepping and enter a function.\n 'step-call'\n end\n @processor.instance_variable_set('@event', event)\n\n if @variables[:show_bytecode]\n decode_one\n end\n\n end", "title": "" }, { "docid": "045940be7ed9486fed02afa8742b74bb", "score": "0.46511543", "text": "def trace\n set_trace_func proc { |event, _file, _line, id, binding, classname|\n if event == watched && id != :log && classes.include?(classname.to_s)\n vars = variables(binding)\n\n if vars.empty?\n log_this(sprintf(\"%s %-25s #%-20s\",\n class_count, classname, id))\n\n else\n log_this(sprintf(\"%s %-25s #%-20s\\n%s\\n\",\n class_count, classname, id, vars))\n\n end\n end\n } if trace?\n end", "title": "" }, { "docid": "7e31a2227194ff2652bd7e5a131308d8", "score": "0.46474472", "text": "def begin_block(name, opts)\n @block_name_stack << name\n @block_opts_stack << opts\n @block_break_type_stack << \"entry-break\"\n end", "title": "" }, { "docid": "508ebb33580216d95c38b7509644ffd9", "score": "0.46395767", "text": "def run_until(breakpoint=nil)\n Breakpoints.main_thread = ::Thread.current\n if breakpoint && @thread\n @thread[:breakpoints] ||= Set.new\n @thread[:breakpoints_reached] ||= Set.new\n @thread[:breakpoints] << breakpoint\n self.finish_wait\n return\n end\n\n @thread ||= ::Thread.new do\n if breakpoint\n ::Thread.current[:breakpoints] ||= Set.new\n ::Thread.current[:breakpoints_reached] ||= Set.new\n ::Thread.current[:breakpoints] << breakpoint\n begin\n @block_to_run.call\n unless ::Thread.current[:breakpoints_reached].include?(breakpoint)\n raise \"Breakpoint #{breakpoint} not reached!\"\n end\n end\n else\n @block_to_run.call\n end\n # return control back to main thread\n Breakpoints.main_thread.run\n end\n ::Thread.stop\n end", "title": "" }, { "docid": "4d75efb79e1629047044878e12da4641", "score": "0.46394926", "text": "def in_klass name\n if Sexp === name then\n name = case name.sexp_type\n when :colon2 then\n name = name.flatten\n name.delete :const\n name.delete :colon2\n name.join(\"::\")\n when :colon3 then\n name.last.to_s\n else\n raise \"unknown type #{name.inspect}\"\n end\n end\n\n @class_stack.unshift name\n\n with_new_method_stack do\n yield\n end\n ensure\n @class_stack.shift\n end", "title": "" }, { "docid": "eca0bd1db6007f1e3618c6636926fdc4", "score": "0.46339425", "text": "def game_flow_human_codebreaker\n @secret_code = define_secret_code\n game_start_human_codebreaker\n while continue?\n one_round_human_codebreaker\n add_one_round\n end\n end_of_game_logic\n end", "title": "" }, { "docid": "765787ced2cf0f706df73664ea76479e", "score": "0.46253407", "text": "def inject_blacklight_controller_behavior \n# prepend_file(\"app/controllers/application_controller.rb\", \"require 'blacklight/controller'\\n\\n\")\n inject_into_class \"app/controllers/application_controller.rb\", \"ApplicationController\" do\n \" # Adds a few additional behaviors into the application controller \\n \" + \n \" include Blacklight::Controller\\n\" + \n \" # Please be sure to impelement current_user and user_session. Blacklight depends on \\n\" +\n \" # these methods in order to perform user specific actions. \\n\\n\"\n end\n end", "title": "" }, { "docid": "b4c2b6149ec863f45097a59dd2033517", "score": "0.46137062", "text": "def trace_hook(event, file, line, id, binding, klass)\n tf = RubyVM::Frame::current.prev\n\n # FIXME: Clean this mess up. And while your at it, understand\n # what's going on better.\n tf_check = tf\n\n while %w(IFUNC CFUNC).member?(tf_check.type) do \n tf_check = tf_check.prev \n end\n return unless tf_check\n\n begin \n if tf_check.method && !tf_check.method.empty?\n meth_name = tf_check.method.gsub(/^.* in /, '')\n meth = eval(\"self.method(:#{meth_name})\", tf_check.binding)\n if @excluded.member?(meth.to_s)\n # Turn off tracing for any calls from this frame. Note\n # that Ruby turns of tracing in the thread of a hook while\n # it is running, but I don't think this is as good as\n # turning it off in the frame and frames called from that.\n # Example: if a trace hook yields to or calls a block\n # outside not derived from the frame, then tracing should\n # start again. But either way, since RubyVM::Frame\n # allows control over tracing *any* decision is not\n # irrevocable, just possibly unhelpful.\n tf_check.trace_off = true\n return \n end\n end\n rescue NameError\n rescue SyntaxError\n rescue ArgumentError\n end\n while %w(IFUNC).member?(tf.type) do \n tf = tf.prev \n end\n\n # There is what looks like a a bug in Ruby where self.class for C\n # functions are not set correctly. Until this is fixed in what I\n # consider a more proper way, we'll hack around this by passing\n # the binding as the optional arg parameter.\n arg = \n if 'CFUNC' == tf.type && NilClass != klass \n klass \n elsif 'raise' == event\n # As a horrible hack to be able to get the raise message on a\n # 'raise' event before the event occurs, I changed RubyVM to store\n # the message in the class field.\n klass\n else\n nil\n end\n\n retval = @hook_proc.call(event, tf, arg)\n if retval.respond_to?(:ancestors) && retval.ancestors.include?(Exception)\n raise retval \n end\n end", "title": "" }, { "docid": "af7e9dbab6c5c46c7ac32d037983df79", "score": "0.45975015", "text": "def run(args)\n\n ## FIXME: DRY this code, tbreak and break.\n unless args.size == 1\n cm, line, ip, condition, negate = \n @proc.breakpoint_position(@proc.cmd_argstr, false)\n if cm\n opts={:event => 'tbrkpt', :temp => true}\n bp = @proc.set_breakpoint_method(cm, line, ip, opts)\n bp.set_temp!\n else\n errmsg \"Trouble setting temporary breakpoint\"\n return \n end\n end\n @proc.continue('continue')\n end", "title": "" }, { "docid": "1b1474a08e900e9eca951b30c4061aca", "score": "0.45861596", "text": "def waiting_for_breakpoint?\n @breakpoint_listener.status == 'sleep'\n end", "title": "" }, { "docid": "93cec86afb4eda82920699e2f4bc815e", "score": "0.4585983", "text": "def run\n puts \"Asked to run w/o breakpoint\"\n Breakpoints.main_thread = ::Thread.current\n\n @thread ||= ::Thread.new do\n @block_to_run.call\n end\n end", "title": "" }, { "docid": "816f051e82cab8a8dc24f861bd2ba667", "score": "0.45859328", "text": "def break!\n if @broke\n puts \"Cup is already broken! calm yourself!\"\n else\n @broke = true\n puts \"Splat!!!\"\n end\n end", "title": "" }, { "docid": "75c53ad2d84b9f5282516916bfb201b3", "score": "0.45854023", "text": "def get_breakpoint(cm, ip)\n @breakpoint_tracker.get_breakpoint(cm, ip)\n end", "title": "" }, { "docid": "c0971b4011ee592e8af7d3722ef1f824", "score": "0.45791203", "text": "def run(args)\n\n ## FIXME: DRY this code, tbreak and break.\n unless args.size == 1\n filename = @proc.frame.file\n line_number = @proc.get_an_int(args[1])\n return unless line_number\n syntax_errors = Trepan::ruby_syntax_errors(filename)\n if syntax_errors\n msg [\"File #{filename} is not a syntactically correct Ruby program.\",\n \"Therefore we can't check line numbers.\"]\n return unless confirm('Set breakpoint anyway?', false)\n end\n unless LineCache.trace_line_numbers(filename).member?(line_number)\n errmsg(\"Line %d is not a stopping point in file \\\"%s\\\".\\n\" %\n [line_number, filename])\n return\n end\n @proc.state.context.set_breakpoint(filename, line_number)\n end\n @proc.continue\n @proc.leave_cmd_loop = true\n end", "title": "" }, { "docid": "20f9f46151289e80cf5e70464deaa1fb", "score": "0.45755625", "text": "def inject_blacklight_controller_behavior \n # prepend_file(\"app/controllers/application_controller.rb\", \"require 'blacklight/controller'\\n\\n\")\n inject_into_class \"app/controllers/application_controller.rb\", \"ApplicationController\" do\n \" # Adds a few additional behaviors into the application controller \\n \" + \n \" include Blacklight::Controller\\n\" + \n \" # Please be sure to impelement current_user and user_session. Blacklight depends on \\n\" +\n \" # these methods in order to perform user specific actions. \\n\\n\" +\n \" layout 'blacklight'\\n\\n\"\n end\n end", "title": "" }, { "docid": "ae4627677b8240908a8ee7f05ee43b15", "score": "0.45685586", "text": "def code_point; end", "title": "" }, { "docid": "67b5b47ccc92ba0192d660ecd935446e", "score": "0.4565068", "text": "def begin_backtrack(level)\n # System.out.println(\"enter backtrack \"+level);\n @num_backtrack_decisions += 1\n end", "title": "" }, { "docid": "bf99b3b1051c92164f9f573512ad6f18", "score": "0.45607328", "text": "def waiting_for_breakpoint?\n @breakpoint_listener.status == 'sleep'\n end", "title": "" }, { "docid": "237524c06e2bcb4939d08875fb14e101", "score": "0.45573905", "text": "def continue\n\n # FIXME: with the ruby-supported stepping, we might not\n # need the below any more.\n # I'm guessing the stack size can't ever reach this\n @next_level = 32000\n\n @next_thread = nil\n if @settings[:traceprint]\n @core.step_count = 1 # traceprint will avoid stopping\n else\n @core.step_count = -1 # No more event stepping\n end\n @leave_cmd_loop = true # Break out of the processor command loop.\n end", "title": "" }, { "docid": "7e793bd4fd421df342d7f3638a86d52d", "score": "0.4553968", "text": "def h1\r\n puts 'foo-begin'\r\n h2 { puts 'break'; break } # break jumps after this statement\r\n puts 'foo-end'\r\nend", "title": "" }, { "docid": "56718119e408be0bf20ef0225e8829f4", "score": "0.4546254", "text": "def k_class!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 23 )\n\n\n\n type = K_CLASS\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 345:4: 'class'\n match( \"class\" )\n\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 23 )\n\n\n end", "title": "" }, { "docid": "065e7c3747f9452b22442575a7bbeec0", "score": "0.45321885", "text": "def add_instance_hook(hook, &block)\n instance_hooks(hook).send(BEFORE_HOOKS.include?(hook) ? :unshift : :push, block)\n end", "title": "" }, { "docid": "9083b39a17b5ad2624027acb890eaa83", "score": "0.4528497", "text": "def on_class(class_node)\n previous_category = nil\n previous_node_end_line = -1\n previous_method_name = nil\n walk_over_nested_class_definition(class_node) do |node, category|\n next unless node.respond_to?(:method_name)\n if previous_category && category != previous_category && node.loc.first_line - previous_node_end_line < 2\n add_offense(node, message: MSG)\n end\n\n if previous_method_name && previous_method_name == node.method_name && node.loc.first_line - previous_node_end_line > 1\n add_offense(node, message: \"Don't Use empty lines between same categories.\")\n end\n previous_category = category\n previous_node_end_line = node.loc.last_line\n previous_method_name = node.method_name\n end\n end", "title": "" }, { "docid": "9ca121ed44def9298831f08176252722", "score": "0.45207974", "text": "def set_block_break_type(type)\n @block_break_type_stack[@block_break_type_stack.size-1] = type\n end", "title": "" }, { "docid": "90b24176f323764a5f53c8439653c650", "score": "0.4520367", "text": "def add_page_break()\n @main_doc.add_xml_fragment(create_page_break_fragment)\n end", "title": "" }, { "docid": "a40ed435919279bbfaaa203b03bc76ba", "score": "0.45174456", "text": "def run(&_block)\n @state ||= Byebug::RegularState.new(\n Byebug.current_context,\n [],\n Byebug.current_context.frame_file,\n interface,\n Byebug.current_context.frame_line\n )\n\n return_value = nil\n\n command = catch(:breakout_nav) do # Throws from PryByebug::Commands\n return_value = yield\n {} # Nothing thrown == no navigational command\n end\n\n # Pry instance to resume after stepping\n @pry = command[:pry]\n\n perform(command[:action], command[:options])\n\n return_value\n end", "title": "" }, { "docid": "117b2cb8b46b06206cf2c27bfbc57a30", "score": "0.45055038", "text": "def add_class(new_class)\n @classes << new_class\n end", "title": "" }, { "docid": "169a47898f4bfb3a5833b767afc7721f", "score": "0.4500007", "text": "def trackClass(clazz)\n @classes.push clazz\n end", "title": "" }, { "docid": "f27c697ee7e3d71d558ffafb0c126ad3", "score": "0.44940853", "text": "def run(args, temp=false)\n\n arg_str = args.size == 1 ? @proc.frame.line.to_s : @proc.cmd_argstr\n cm, file, line, position_type, expr, negate = \n @proc.breakpoint_position(arg_str, true)\n if file.nil?\n unless @proc.context\n errmsg 'We are not in a state that has an associated file.'\n return \n end\n file = @proc.frame.file\n if line.nil? \n # Set breakpoint at current line\n line = @proc.frame.line\n end\n end\n\n if line\n if LineCache.cache(file, settings[:reload_source_on_change])\n last_line = LineCache.size(file)\n if line > last_line\n errmsg(\"There are only %d lines in file \\\"%s\\\".\" % [last_line, \n @proc.canonic_file(file)]) \n return\n end\n syntax_errors = Trepan::ruby_syntax_errors(file)\n if syntax_errors\n msg [\"File #{file} is not a syntactically correct Ruby program.\",\n \"Therefore we can't check line numbers.\"]\n return unless confirm('Set breakpoint anyway?', false)\n else\n unless LineCache.trace_line_numbers(file).member?(line)\n errmsg('Line %d is not a stopping point in file \"%s\".' % \n [line, @proc.canonic_file(file)])\n return\n end\n end\n else\n errmsg('No source file named %s' % @proc.canonic_file(file))\n return unless confirm('Set breakpoint anyway?', false)\n end\n \n unless @proc.context\n errmsg 'We are not in a state we can add breakpoints.'\n return \n end\n\n expr = \"!(#{expr})\" if negate\n if temp\n @proc.state.context.set_breakpoint(file, line, expr)\n msg(\"Temporary breakpoint set at file %s, line %d\" % [file, line])\n else \n b = Debugger.add_breakpoint file, line, expr\n msg(\"Breakpoint %d file %s, line %d\" % \n [b.id, @proc.canonic_file(file), line])\n end\n # unless syntax_valid?(expr)\n # errmsg(\"Expression \\\"#{expr}\\\" syntactically incorrect; breakpoint disabled.\\n\")\n # b.enabled = false\n # end\n # else\n # method = line.intern.id2name\n # b = Debugger.add_breakpoint class_name, method, expr\n # print \"Breakpoint %d at %s::%s\\n\", b.id, class_name, method.to_s\n end\n end", "title": "" }, { "docid": "e7e5bda60c6721ebc54b4907c2c917e9", "score": "0.4490706", "text": "def add_class(name); end", "title": "" }, { "docid": "e7e5bda60c6721ebc54b4907c2c917e9", "score": "0.4490706", "text": "def add_class(name); end", "title": "" }, { "docid": "ca84d91ea88a798cfffba142dbb1b0e0", "score": "0.4489383", "text": "def test_debugger_base\n assert_equal(false, Debugger.started?, \n 'Debugger should not initially be started.')\n Debugger.start_\n # we need to add the breakpoint to force enabling trace points\n Debugger.add_breakpoint(__FILE__, 1)\n assert(Debugger.started?, \n 'Debugger should now be started.')\n assert_equal(false, Debugger.debug,\n 'Debug variable should not be set.')\n assert_equal(false, Debugger.post_mortem?,\n 'Post mortem debugging should not be set.')\n a = Debugger.contexts\n assert_equal(1, a.size, \n 'There should only be one context.')\n assert_equal(Array, a.class, \n 'Context should be an array.')\n ensure\n Debugger.stop\n assert_equal(false, Debugger.started?, \n 'debugger should no longer be started.')\n end", "title": "" }, { "docid": "f635ff8a7f3878bbc8022143c07c9bda", "score": "0.4488681", "text": "def in_sklass\n @sclass.push true\n\n with_new_method_stack do\n yield\n end\n ensure\n @sclass.pop\n end", "title": "" }, { "docid": "fa1ed8ba4e563e524dcca8508172c711", "score": "0.44855624", "text": "def intercept(klass,mname,&blk)\n unless klass.class == Class || klass.class == Module\n fail \"first arg to intercept_method should be a class or module\"\n end\n mname = mname.to_sym\n old_method = klass.instance_method mname\n # old_method is unbound at this point\n\n# new_meth = instrument_method(klass,mname,old_method,blk)\n# klass.class_eval {define_method mname, &new_meth}\n @klasses[klass] = {} unless @klasses.key? klass \n @klasses[klass][mname] = [old_method,blk]\n @frame_skips[klass] = {} unless @frame_skips.key? klass\n @frame_skips[klass][mname] = 1\n end", "title": "" }, { "docid": "6ee599d146946e99a974b18457e947e2", "score": "0.44770592", "text": "def function_breakpoint_names\n result = @function_breakpoints.map(&:name)\n # Also add the debug::break function which mimics puppet-debug behaviour\n # https://github.com/nwops/puppet-debug#usage\n result << 'debug::break'\n end", "title": "" }, { "docid": "67ec242f205c357594506f8a4a970fa2", "score": "0.44753096", "text": "def insert_hook(label)\n @codegen.insert_hook(label)\n end", "title": "" }, { "docid": "16217d78c3fa165176031497d734fec3", "score": "0.4469558", "text": "def test\n\tputs \"Entering method\"\n\tp = Proc.new { puts \"Entering Proc\"; break }\n\tbegin \n\t\tp.call # => LocalJumpError\n\trescue \n\t\tputs \"We got an error breaking!\" \n\tend\n\tputs \"Exiting method\"\nend", "title": "" }, { "docid": "f82f45226bfde6fe7e4dfb1fac958862", "score": "0.4446015", "text": "def process_class exp\n exp\n end", "title": "" }, { "docid": "7810871ad1b0979d8e798be009c77be5", "score": "0.44410795", "text": "def after_sclass(class_node); end", "title": "" }, { "docid": "cee071b1921e2bea1386194921107848", "score": "0.44282606", "text": "def breakpoints\n @breakpoint_tracker.global_breakpoints\n end", "title": "" }, { "docid": "fc7197dfac36efed4549e3131b47700b", "score": "0.44248047", "text": "def test\r\n puts \"Enter in methods\"\r\n p = Proc.new { p \"Entering proc\"; break }\r\n p.call\r\n p \"Existing methods\"\r\nend", "title": "" }, { "docid": "5e828b5ae895930a00f85e7a2937f7e7", "score": "0.44240955", "text": "def insert_exit_point\n @output_continue = true\n end", "title": "" } ]
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "285704ea745949a567033b65a9b34434", "score": "0.0", "text": "def set_country\n @country = Country.find(params[:id])\n end", "title": "" } ]
[ { "docid": "bd89022716e537628dd314fd23858181", "score": "0.6163754", "text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "title": "" }, { "docid": "3db61e749c16d53a52f73ba0492108e9", "score": "0.6045816", "text": "def action_hook; end", "title": "" }, { "docid": "b8b36fc1cfde36f9053fe0ab68d70e5b", "score": "0.5944853", "text": "def run_actions; end", "title": "" }, { "docid": "3e521dbc644eda8f6b2574409e10a4f8", "score": "0.59169096", "text": "def define_action_hook; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.58892167", "text": "def actions; end", "title": "" }, { "docid": "bfb8386ef5554bfa3a1c00fa4e20652f", "score": "0.58342934", "text": "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "title": "" }, { "docid": "6c8e66d9523b9fed19975542132c6ee4", "score": "0.5776148", "text": "def add_actions; end", "title": "" }, { "docid": "9c186951c13b270d232086de9c19c45b", "score": "0.57057375", "text": "def callbacks; end", "title": "" }, { "docid": "9c186951c13b270d232086de9c19c45b", "score": "0.57057375", "text": "def callbacks; end", "title": "" }, { "docid": "6ce8a8e8407572b4509bb78db9bf8450", "score": "0.56534296", "text": "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "title": "" }, { "docid": "1964d48e8493eb37800b3353d25c0e57", "score": "0.56209534", "text": "def define_action_helpers; end", "title": "" }, { "docid": "5df9f7ffd2cb4f23dd74aada87ad1882", "score": "0.54244673", "text": "def post_setup\n end", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.54101455", "text": "def action_methods; end", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.54101455", "text": "def action_methods; end", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.54101455", "text": "def action_methods; end", "title": "" }, { "docid": "c5904f93614d08afa38cc3f05f0d2365", "score": "0.53951085", "text": "def before_setup; end", "title": "" }, { "docid": "f099a8475f369ce73a38d665b6ee6877", "score": "0.5378493", "text": "def action_run\n end", "title": "" }, { "docid": "2c4e5a90aa8efaaa3ed953818a9b30d2", "score": "0.53563684", "text": "def execute(setup)\n @action.call(setup)\n end", "title": "" }, { "docid": "0464870c8688619d6c104d733d355b3b", "score": "0.53399915", "text": "def define_action_helpers?; end", "title": "" }, { "docid": "0e7bdc54b0742aba847fd259af1e9f9e", "score": "0.5338049", "text": "def set_actions\n actions :all\n end", "title": "" }, { "docid": "5510330550e34a3fd68b7cee18da9524", "score": "0.53307265", "text": "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "title": "" }, { "docid": "97c8901edfddc990da95704a065e87bc", "score": "0.5312121", "text": "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "title": "" }, { "docid": "210e0392ceaad5fc0892f1335af7564b", "score": "0.5298173", "text": "def setup_handler\n end", "title": "" }, { "docid": "4f9a284723e2531f7d19898d6a6aa20c", "score": "0.5296388", "text": "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "title": "" }, { "docid": "83684438c0a4d20b6ddd4560c7683115", "score": "0.52952695", "text": "def before_actions(*logic)\n self.before_actions = logic\n end", "title": "" }, { "docid": "a997ba805d12c5e7f7c4c286441fee18", "score": "0.5258086", "text": "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "title": "" }, { "docid": "1d50ec65c5bee536273da9d756a78d0d", "score": "0.52430934", "text": "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.5237911", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.5237911", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.5237911", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.5237911", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.5237911", "text": "def action; end", "title": "" }, { "docid": "e34cc2a25e8f735ccb7ed8361091c83e", "score": "0.52335346", "text": "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "title": "" }, { "docid": "635288ac8dd59f85def0b1984cdafba0", "score": "0.5232943", "text": "def workflow\n end", "title": "" }, { "docid": "78b21be2632f285b0d40b87a65b9df8c", "score": "0.5226392", "text": "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "title": "" }, { "docid": "6350959a62aa797b89a21eacb3200e75", "score": "0.52221715", "text": "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "title": "" }, { "docid": "923ee705f0e7572feb2c1dd3c154b97c", "score": "0.5217978", "text": "def process_action(...)\n send_action(...)\n end", "title": "" }, { "docid": "b89a3908eaa7712bb5706478192b624d", "score": "0.52136153", "text": "def before_dispatch(env); end", "title": "" }, { "docid": "d89a3e408ab56bf20bfff96c63a238dc", "score": "0.52076435", "text": "def setup\n # override and do something appropriate\n end", "title": "" }, { "docid": "7115b468ae54de462141d62fc06b4190", "score": "0.52067244", "text": "def after_actions(*logic)\n self.after_actions = logic\n end", "title": "" }, { "docid": "62c402f0ea2e892a10469bb6e077fbf2", "score": "0.5175402", "text": "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "title": "" }, { "docid": "72ccb38e1bbd86cef2e17d9d64211e64", "score": "0.5174649", "text": "def setup(_context)\n end", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.5173085", "text": "def setup(resources) ; end", "title": "" }, { "docid": "1fd817f354d6cb0ff1886ca0a2b6cce4", "score": "0.5165201", "text": "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "title": "" }, { "docid": "5531df39ee7d732600af111cf1606a35", "score": "0.5162052", "text": "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "title": "" }, { "docid": "bb6aed740c15c11ca82f4980fe5a796a", "score": "0.5157932", "text": "def determine_valid_action\n\n end", "title": "" }, { "docid": "b38f9d83c26fd04e46fe2c961022ff86", "score": "0.5152905", "text": "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "title": "" }, { "docid": "199fce4d90958e1396e72d961cdcd90b", "score": "0.5152353", "text": "def startcompany(action)\n @done = true\n action.setup\n end", "title": "" }, { "docid": "994d9fe4eb9e2fc503d45c919547a327", "score": "0.5150909", "text": "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "title": "" }, { "docid": "62fabe9dfa2ec2ff729b5a619afefcf0", "score": "0.514719", "text": "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "title": "" }, { "docid": "faddd70d9fef5c9cd1f0d4e673e408b9", "score": "0.5138596", "text": "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "title": "" }, { "docid": "adb8115fce9b2b4cb9efc508a11e5990", "score": "0.51333916", "text": "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "title": "" }, { "docid": "e1dd18cf24d77434ec98d1e282420c84", "score": "0.51139015", "text": "def setup(&block)\n define_method(:setup, &block)\n end", "title": "" }, { "docid": "3b4fb29fa45f95d436fd3a8987f12de7", "score": "0.5113431", "text": "def setup\n transition_to(:setup)\n end", "title": "" }, { "docid": "3b4fb29fa45f95d436fd3a8987f12de7", "score": "0.5113431", "text": "def setup\n transition_to(:setup)\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5109581", "text": "def action\n end", "title": "" }, { "docid": "f54964387b0ee805dbd5ad5c9a699016", "score": "0.51066816", "text": "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "title": "" }, { "docid": "35b302dd857a031b95bc0072e3daa707", "score": "0.5091428", "text": "def config(action, *args); end", "title": "" }, { "docid": "bc3cd61fa2e274f322b0b20e1a73acf8", "score": "0.5089407", "text": "def setup\n @setup_proc.call(self) if @setup_proc\n end", "title": "" }, { "docid": "246840a409eb28800dc32d6f24cb1c5e", "score": "0.5082971", "text": "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "title": "" }, { "docid": "5c3cfcbb42097019c3ecd200acaf9e50", "score": "0.50822043", "text": "def before_action \n end", "title": "" }, { "docid": "dfbcf4e73466003f1d1275cdf58a926a", "score": "0.50668514", "text": "def action\n end", "title": "" }, { "docid": "36eb407a529f3fc2d8a54b5e7e9f3e50", "score": "0.5055155", "text": "def matt_custom_action_begin(label); end", "title": "" }, { "docid": "b6c9787acd00c1b97aeb6e797a363364", "score": "0.50525695", "text": "def setup\n # override this if needed\n end", "title": "" }, { "docid": "9fc229b5b48edba9a4842a503057d89a", "score": "0.50499475", "text": "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "title": "" }, { "docid": "9fc229b5b48edba9a4842a503057d89a", "score": "0.50499475", "text": "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "title": "" }, { "docid": "fd421350722a26f18a7aae4f5aa1fc59", "score": "0.5034445", "text": "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "title": "" }, { "docid": "d02030204e482cbe2a63268b94400e71", "score": "0.50249445", "text": "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "title": "" }, { "docid": "4224d3231c27bf31ffc4ed81839f8315", "score": "0.5022226", "text": "def after(action)\n invoke_callbacks *options_for(action).after\n end", "title": "" }, { "docid": "24506e3666fd6ff7c432e2c2c778d8d1", "score": "0.50167644", "text": "def pre_task\n end", "title": "" }, { "docid": "0c16dc5c1875787dacf8dc3c0f871c53", "score": "0.5014211", "text": "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "title": "" }, { "docid": "c99a12c5761b742ccb9c51c0e99ca58a", "score": "0.4999924", "text": "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "title": "" }, { "docid": "791f958815c2b2ac16a8ca749a7a822e", "score": "0.49996212", "text": "def setup_signals; end", "title": "" }, { "docid": "0cff1d3b3041b56ce3773d6a8d6113f2", "score": "0.49978727", "text": "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "title": "" }, { "docid": "6e44984b54e36973a8d7530d51a17b90", "score": "0.4989682", "text": "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "title": "" }, { "docid": "6e44984b54e36973a8d7530d51a17b90", "score": "0.4989682", "text": "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "title": "" }, { "docid": "5aa51b20183964c6b6f46d150b0ddd79", "score": "0.49851838", "text": "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "title": "" }, { "docid": "67e7767ce756766f7c807b9eaa85b98a", "score": "0.49817684", "text": "def after_set_callback; end", "title": "" }, { "docid": "7647b99591d6d687d05b46dc027fbf23", "score": "0.4979687", "text": "def initialize(*args)\n super\n @action = :set\nend", "title": "" }, { "docid": "2a2b0a113a73bf29d5eeeda0443796ec", "score": "0.49787104", "text": "def setup\n #implement in subclass;\n end", "title": "" }, { "docid": "63e628f34f3ff34de8679fb7307c171c", "score": "0.49688423", "text": "def lookup_action; end", "title": "" }, { "docid": "a5294693c12090c7b374cfa0cabbcf95", "score": "0.49664098", "text": "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "title": "" }, { "docid": "4aceccac5b1bcf7d22c049693b05f81c", "score": "0.49564412", "text": "def around_hooks; end", "title": "" }, { "docid": "57dbfad5e2a0e32466bd9eb0836da323", "score": "0.49561828", "text": "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "title": "" }, { "docid": "5b6d613e86d3d68152f7fa047d38dabb", "score": "0.49547398", "text": "def release_actions; end", "title": "" }, { "docid": "2318410efffb4fe5fcb97970a8700618", "score": "0.4953481", "text": "def save_action; end", "title": "" }, { "docid": "64e0f1bb6561b13b482a3cc8c532cc37", "score": "0.4952925", "text": "def setup(easy)\n super\n easy.customrequest = @verb\n end", "title": "" }, { "docid": "fbd0db2e787e754fdc383687a476d7ec", "score": "0.4946049", "text": "def action_target()\n \n end", "title": "" }, { "docid": "b280d59db403306d7c0f575abb19a50f", "score": "0.494379", "text": "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "title": "" }, { "docid": "9f7547d93941fc2fcc7608fdf0911643", "score": "0.49319315", "text": "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "title": "" }, { "docid": "da88436fe6470a2da723e0a1b09a0e80", "score": "0.49313048", "text": "def before_setup\n # do nothing by default\n end", "title": "" }, { "docid": "21d75f9f5765eb3eb36fcd6dc6dc2ec3", "score": "0.49269778", "text": "def default_action; end", "title": "" }, { "docid": "3ba85f3cb794f951b05d5907f91bd8ad", "score": "0.49263066", "text": "def setup(&blk)\n @setup_block = blk\n end", "title": "" }, { "docid": "17ffe00a5b6f44f2f2ce5623ac3a28cd", "score": "0.49257493", "text": "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "title": "" }, { "docid": "80834fa3e08bdd7312fbc13c80f89d43", "score": "0.4924526", "text": "def callback_phase\n super\n end", "title": "" }, { "docid": "f1da8d654daa2cd41cb51abc7ee7898f", "score": "0.49212465", "text": "def advice\n end", "title": "" }, { "docid": "99a608ac5478592e9163d99652038e13", "score": "0.49173486", "text": "def _handle_action_missing(*args); end", "title": "" }, { "docid": "0fe8b3b5573f8eb57ec1752658a62e4e", "score": "0.4915802", "text": "def call\n setup_context\n super\n end", "title": "" }, { "docid": "9e264985e628b89f1f39d574fdd7b881", "score": "0.49151486", "text": "def duas1(action)\n action.call\n action.call\nend", "title": "" }, { "docid": "0dccebcb0ecbb1c4dcbdddd4fb11bd8a", "score": "0.49150333", "text": "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "title": "" }, { "docid": "6e0842ade69d031131bf72e9d2a8c389", "score": "0.49147308", "text": "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend", "title": "" } ]
e0c13d5a41ce8a04c6e0a9917706000a
Format a CSS background setting value based on this product family's custom settings
[ { "docid": "44a6c4618ab19ffcde09546083382c54", "score": "0.67239255", "text": "def custom_background\n css = \"\"\n css += \"background-color: #{self.background_color};\" unless self.background_color.blank?\n if self.background_image_file_name.blank?\n css += \"background-image: none; \"\n else\n css += \"background-image: url('#{self.background_image.url(\"original\", false)}'); \"\n css += \"background-position: center top; \"\n css += \"background-repeat: repeat-y; \"\n end\n css\n end", "title": "" } ]
[ { "docid": "2c3009da563dcc785c7c0a5c9cffc145", "score": "0.65425295", "text": "def background(value = nil)\n return options[:background] unless value\n\n bg = Vedeu::Colours::Background.coerce(value)\n\n options[:background] = colour_attributes(background: bg)\n .fetch(:background)\n end", "title": "" }, { "docid": "f9c27fc8b9c931bf5a3798ed11b23314", "score": "0.65246344", "text": "def create_background_shorthand! # :nodoc:\n # When we have a background-size property we must separate it and distinguish it from\n # background-position by preceeding it with a backslash. In this case we also need to\n # have a background-position property, so we set it if it's missing.\n # http://www.w3schools.com/cssref/css3_pr_background.asp\n if @declarations.has_key?('background-size') and not @declarations['background-size'][:is_important]\n unless @declarations.has_key?('background-position')\n @declarations['background-position'] = {:value => 'initial'}\n end\n\n @declarations['background-size'][:value] = \"/ #{@declarations['background-size'][:value]}\"\n end\n\n create_shorthand_properties! BACKGROUND_PROPERTIES, 'background'\n end", "title": "" }, { "docid": "a75398d5a89ea5167e3cd63b3d8771aa", "score": "0.644547", "text": "def create_background_shorthand! # :nodoc:\n # When we have a background-size property we must separate it and distinguish it from\n # background-position by preceding it with a backslash. In this case we also need to\n # have a background-position property, so we set it if it's missing.\n # http://www.w3schools.com/cssref/css3_pr_background.asp\n if (declaration = declarations['background-size']) && !declaration.important\n declarations['background-position'] ||= '0% 0%'\n declaration.value = \"/ #{declaration.value}\"\n end\n\n create_shorthand_properties! BACKGROUND_PROPERTIES, 'background'\n end", "title": "" }, { "docid": "7db88a7d164b60fbc17c805fa59b3f71", "score": "0.64423573", "text": "def cps_bg(value)\n case value\n when (0..1500) then 'bg-primary'\n when (1500..3000) then 'bg-success'\n when (3000..6000) then 'bg-warning'\n when (6000..10000) then 'bg-danger'\n else 'bg-gray'\n end\n end", "title": "" }, { "docid": "ff0c893fa1a75b7e7bc9cda6dd653070", "score": "0.63705605", "text": "def background=(value)\n @background = Vedeu::Colours::Background.coerce(value)\n end", "title": "" }, { "docid": "319f2f7f8367972863c07c7a417bacb6", "score": "0.6303236", "text": "def background\n get_factbook_property(\"background\")\n end", "title": "" }, { "docid": "e34dcb960b27cdecc320014d69058a3a", "score": "0.6300666", "text": "def set_Background(value)\n set_input(\"Background\", value)\n end", "title": "" }, { "docid": "bef0a62a8d121cfa62eb90c0edbe0d87", "score": "0.6300201", "text": "def background\n @background ||= Background.escape_sequence(attributes[:background])\n end", "title": "" }, { "docid": "b9e2a0c9369b2d260d42109057197089", "score": "0.6272859", "text": "def bg_color\n return \"transparent\" if self.format == :png\n return @attributes[:bg_color] || @@default[:bg_color]\n end", "title": "" }, { "docid": "c9bd7c0a83c09137da0444226d63af1e", "score": "0.6174527", "text": "def background!\n normal = find_highlight(:Normal)\n return @background = 'dark' unless normal && normal.guibg\n @background = normal.guibg[1..-1].to_i(16) < 8421504 ? 'dark' : 'light'\n end", "title": "" }, { "docid": "dd57be8b54724a52ec09fe587443efa8", "score": "0.6122328", "text": "def bg_color\n BG_COLOR_CODES.index(read_attribute(:bg_color))\n end", "title": "" }, { "docid": "2168837f19b6a2f4499c7a45d0d9b19b", "score": "0.6087296", "text": "def bg_color!\n teal = BG_COLORS[:teal]\n pink = BG_COLORS[:pink]\n blue = BG_COLORS[:blue]\n \n teal_code = BG_COLOR_CODES[BG_COLORS[:teal]]\n pink_code = BG_COLOR_CODES[BG_COLORS[:pink]]\n blue_code = BG_COLOR_CODES[BG_COLORS[:blue]]\n\n bg = if parent && self.argument_type != 'com'\n if parent.bg_color == blue\n self.argument_type == 'pro' ? teal_code : (self.argument_type == 'con' ? pink_code : blue_code)\n else\n if (parent.bg_color == pink && self.argument_type != 'pro') || (parent.bg_color == teal && self.argument_type == 'pro')\n teal_code\n elsif (parent.bg_color == pink && self.argument_type == 'pro') || (parent.bg_color == teal && self.argument_type != 'pro')\n pink_code\n end\n end\n else\n # no parent\n self.argument_type == 'pro' ? teal_code : (self.argument_type == 'con' ? pink_code : blue_code)\n end\n \n update_attribute :bg_color, bg\n end", "title": "" }, { "docid": "f37704c99d509ccd4e925c27709ec15e", "score": "0.60799813", "text": "def set_a_background(name)\n if name < 8\n self.background = SET_A_COLORS.fetch(name)\n else\n self.background = ANSI_COLORS.fetch(name)\n end\n\n update_tag\n end", "title": "" }, { "docid": "fcc4e97d7076bb2ba51346f47d11aefd", "score": "0.6039329", "text": "def background=(value)\n @background = colour.background = value\n @_colour = @colour = colour\n end", "title": "" }, { "docid": "0705b71c43e3a514bbe9b83ffd118e61", "score": "0.60263604", "text": "def background_image\n @data['display']['bgImage']\n end", "title": "" }, { "docid": "5b418ac8834b1e8b9c68e001ed3ba8a6", "score": "0.60035443", "text": "def background_color=(value)\n @background_color = value\n end", "title": "" }, { "docid": "76558a2515f51a70f64208407f479661", "score": "0.60007834", "text": "def background(*values)\n wrap_with_sgr(Color.build(:background, values).codes)\n end", "title": "" }, { "docid": "716b16ea01e4ad4b57a31820a63c720c", "score": "0.5970179", "text": "def render_background\n case @theme_options[:background_colors]\n when Array\n @base_image = render_gradiated_background(*@theme_options[:background_colors])\n when String\n @base_image = render_solid_background(@theme_options[:background_colors])\n else\n @base_image = render_image_background(*@theme_options[:background_image])\n end\n end", "title": "" }, { "docid": "1b49c0e948369e4115baaf3d04585571", "score": "0.5952798", "text": "def bg_color=(v); end", "title": "" }, { "docid": "d1a5002f15b4e311d0845c562f1c29b5", "score": "0.59465325", "text": "def background=(value)\n @colour = Vedeu::Colours::Colour.coerce(\n background: Vedeu::Colours::Background.coerce(value),\n foreground: colour.foreground)\n end", "title": "" }, { "docid": "9c25f8b86c5f0000553a3865174d4282", "score": "0.59270006", "text": "def background(value = nil)\n @background = value unless value.nil?\n @background ||= self.first\n end", "title": "" }, { "docid": "36bfa9ac3e7a6e680bd247e178e4f9c1", "score": "0.59122485", "text": "def bg_color; end", "title": "" }, { "docid": "f39a3fcc50ceb311a719fae865b89cc3", "score": "0.5885772", "text": "def background\n get_or_inherit_color(:background, Cura::Color.black)\n end", "title": "" }, { "docid": "bca85865427cdb8d3546340426c98f8e", "score": "0.5822189", "text": "def style_for_backgound_image(url)\n \"background-image: url(#{url});\"\n end", "title": "" }, { "docid": "4adc919afe58084515a27aec29daf08d", "score": "0.58033556", "text": "def expand_background_shorthand! # :nodoc:\n return unless (declaration = declarations['background'])\n\n value = declaration.value.dup\n\n replacement =\n if value.match(CssParser::RE_INHERIT)\n BACKGROUND_PROPERTIES.map { |key| [key, 'inherit'] }.to_h\n else\n {\n 'background-image' => value.slice!(CssParser::RE_IMAGE),\n 'background-attachment' => value.slice!(CssParser::RE_SCROLL_FIXED),\n 'background-repeat' => value.slice!(CssParser::RE_REPEAT),\n 'background-color' => value.slice!(CssParser::RE_COLOUR),\n 'background-size' => extract_background_size_from(value),\n 'background-position' => value.slice!(CssParser::RE_BACKGROUND_POSITION)\n }\n end\n\n declarations.replace_declaration!('background', replacement, preserve_importance: true)\n end", "title": "" }, { "docid": "ec24e2184ea5e46a0c7dc87cb6880dd6", "score": "0.5800711", "text": "def styles_string\n product_string ConfigReader::DEFAULT_STYLE_PRODUCT\n end", "title": "" }, { "docid": "2bcd2889ef87efc3a2905a2b9f07d435", "score": "0.57986826", "text": "def settings_color\n return unless @scanner.match?(self.class::REGULAR_EXPRESSIONS[:settings_color])\n return unless @scanner[2].length == 4 || @scanner[2].length == 7\n scanned_color = scan(self.class::REGULAR_EXPRESSIONS[:settings_color])\n script_color = ::Sass::Script::Value::Color.from_hex(@scanner[2])\n script_color.instance_variable_set(\"@representation\", @scanner[0].gsub(/^'/, '').gsub(/'$/, ''))\n [:color, script_color]\n end", "title": "" }, { "docid": "8a5efeda0dbd7391f04e286172f291b5", "score": "0.5782382", "text": "def popup_style(e, pr)\n unless e.img_dimensions.blank?\n pr = pr.round\n @width = e.img_dimensions.first.to_i/2\n @height = e.img_dimensions.last.to_i/2\n url = ((pr > 1.5) ? e.img.url(:compressed) : e.img.url(:half))\n \"background-image: url(#{url}); background-size: cover; background-position: center center; width:#{@width}px; height:#{@height}px;\"\n else\n \"background: url(#{e.img.url}) center center no-repeat; background-size: cover;\"\n end\n end", "title": "" }, { "docid": "24b4a7f0cf36793139494955a2f8cb2a", "score": "0.57733727", "text": "def bgColor; end", "title": "" }, { "docid": "246ae0935f3a806edf60459dfe36d689", "score": "0.5762569", "text": "def bg(c)\n get_color('AB',c) if c\n end", "title": "" }, { "docid": "53db2abd52cb491bb229466dffa858ac", "score": "0.5698098", "text": "def background_color\n return @background_color\n end", "title": "" }, { "docid": "f30bc202cbf3f2567f77b3394c35d19a", "score": "0.56788516", "text": "def entry_inline_style(e)\n # (e.background_colour.present? && \"background-color:#{e.background_colour};\") + (e.colour.present? && \"color:#{e.colour}\")\n c = ''\n e.background_colour.present? && c += \"background-color:#{e.background_colour};\"\n e.colour.present? && c += \"color:#{e.colour};\"\n c.present? ? c : false\n end", "title": "" }, { "docid": "1811f4a456e02a14a0bc78b7af16f077", "score": "0.56532687", "text": "def set_background\n @background = BACKGROUNDS.sample\n end", "title": "" }, { "docid": "4a1cb3f226df74b246406618b689929f", "score": "0.564632", "text": "def setupBackground\n\t\t\t#theme = Settings.instance.theme\n\t\t\t#setStyleSheet(\"background-color: #{theme.color[:board_background]};\")\n\t\tend", "title": "" }, { "docid": "860ce530b436ed91784564c727c44676", "score": "0.56412405", "text": "def bgoffset\n\t\t@bgoffset ||= \"bg-offset\" if @brand && @brand.default_website && File.exists?(Rails.root.join(\"app\", \"assets\", \"images\", @brand.default_website.folder, \"toolkit-background.jpg\"))\n\tend", "title": "" }, { "docid": "e31db798d7f2e2a7b44ee97239bc613c", "score": "0.5637715", "text": "def background_colour\n\t\t@label.background_colour\n\tend", "title": "" }, { "docid": "eeb724843b53b4935e23e69975463440", "score": "0.56354845", "text": "def best_color_settings; end", "title": "" }, { "docid": "ad1eeb596212e45f3edb3401fc4d3ac2", "score": "0.56289774", "text": "def value=(options)\n unless options.is_a? Hash\n raise ArgumentError, \"Argument must be a hash of background properties\"\n end\n \n PROPERTIES.each do |name, value|\n plural = (name.to_s + \"s\").to_sym\n self.send(:\"#{name.to_s}=\", options[name]) if options[name]\n self.send(:\"#{name.to_s}s=\", options[plural]) if options[plural]\n end\n end", "title": "" }, { "docid": "706973be7c949f6eefe25d360c700004", "score": "0.5611933", "text": "def to_css\n css_parts = []\n background = [flattened[:background_color].to_s, flattened[:background].to_s].join(\" \").strip\n css_parts.push(\"background: #{background}\") if background && (background != \"\")\n css_parts.push(\"color: #{flattened[:color]}\") if flattened[:color]\n css_parts.join(\"; \")\n end", "title": "" }, { "docid": "bcf7714d3a0dcac97221b1606d763002", "score": "0.5607064", "text": "def bg_color_attribute_for_payer_name(make_payer_name_readonly)\n if !make_payer_name_readonly.blank?\n 'background-color:#A9A9A9'\n else\n ''\n end\n end", "title": "" }, { "docid": "ab7cc5423206696e44f89c374ae9ae8b", "score": "0.56033736", "text": "def expand_background_shorthand! # :nodoc:\n return unless @declarations.has_key?('background')\n\n value = @declarations['background'][:value]\n\n if value =~ CssParser::RE_INHERIT\n BACKGROUND_PROPERTIES.each do |prop|\n split_declaration('background', prop, 'inherit')\n end\n end\n\n split_declaration('background', 'background-image', value.slice!(Regexp.union(CssParser::URI_RX, CssParser::RE_GRADIENT, /none/i)))\n split_declaration('background', 'background-attachment', value.slice!(CssParser::RE_SCROLL_FIXED))\n split_declaration('background', 'background-repeat', value.slice!(CssParser::RE_REPEAT))\n split_declaration('background', 'background-color', value.slice!(CssParser::RE_COLOUR))\n split_declaration('background', 'background-size', extract_background_size_from(value))\n split_declaration('background', 'background-position', value.slice(CssParser::RE_BACKGROUND_POSITION))\n\n @declarations.delete('background')\n end", "title": "" }, { "docid": "49d407343df350f6289af6572e97bdf5", "score": "0.55954546", "text": "def css_overrides\n styles = \"<style>\\n\"\n styles += \" #top-bar {\\n background-color: ##{AppSettings['css.top_bar']};\\n }\\n\" if AppSettings['css.top_bar'] != '3cceff'\n styles += \" #home-search, #page-title, h1, ul.breadcrumb {\\n background-color: ##{AppSettings['css.search_background']};\\n }\\n\" if AppSettings['css.search_background'] != 'feffe9'\n styles += \" #get-help-wrapper {\\n background-color: ##{AppSettings['css.still_need_help']};\\n }\\n\" if AppSettings['css.top_bar'] != 'FFDF91'\n styles += \" div.add-form {\\n background-color: ##{AppSettings['css.form_background']};\\n }\\n\" if AppSettings['css.form_background'] != 'F0FFF0'\n styles += \" .navbar-default .navbar-brand, .navbar-default .navbar-nav > li > a {\\n color: ##{AppSettings['css.link_color']};\\n }\\n\" if AppSettings['css.link_color'] != '004084'\n styles += \"</style>\"\n styles.html_safe\n end", "title": "" }, { "docid": "eba387461a40a0fc33dd0fc2de201b7d", "score": "0.5594803", "text": "def use_default_bg?; !(custom_bg_set? or in_auto_background_map?); end", "title": "" }, { "docid": "fd59b14b6025cdd80d2216262b4efe39", "score": "0.55839336", "text": "def background=(value)\n raise ArgumentError, \"background must respond to :to_i\" unless value.respond_to?(:to_i)\n \n @background = value.to_i\n end", "title": "" }, { "docid": "6076f5da3d77bec87e962dad23f340be", "score": "0.5577169", "text": "def color\n if UI_CONFIG[self.type].blank?\n \"#999999\"\n else\n UI_CONFIG[self.type][\"color\"]\n end\n end", "title": "" }, { "docid": "805a0b1d8cd93e4f1a4e360e04762b83", "score": "0.5574322", "text": "def block_thumbnail_div_background_style block\n block.thumbnail? ? \"background-image: url(#{ block.thumbnail.small.url })\" : ''\n end", "title": "" }, { "docid": "2a34a766020a3f889e4e50c238a25902", "score": "0.5568655", "text": "def green_bg\n return colorize(42)\n end", "title": "" }, { "docid": "de8343b550484344f9383850fb50247b", "score": "0.5568407", "text": "def background\n @background ||= if colour && present?(colour.background)\n colour.background\n\n elsif named_colour?\n named_colour.background\n\n elsif parent? && present?(parent.background)\n parent.background\n\n else\n Vedeu::Colours::Background.new\n\n end\n end", "title": "" }, { "docid": "435c3df21489fde5e74180daa50a3f84", "score": "0.5504304", "text": "def change_background_image\n # get the current image path\n image_path = download_current_image\n\n # construct the system command\n set_background_cmd = @config.get_property(:cmd) + image_path\n\n # set the background image\n system(set_background_cmd)\n\n # update the existing config\n update_config\n end", "title": "" }, { "docid": "b18e498134efbfaa0fc86ef9db381e97", "score": "0.55014837", "text": "def white_bg\n return colorize(47)\n end", "title": "" }, { "docid": "66aa6a440d17036a57d8040b4753e4a8", "score": "0.54784214", "text": "def red_bg\n return colorize(41)\n end", "title": "" }, { "docid": "cbb568c4c703fdc85c10af36e8706429", "score": "0.5461887", "text": "def generate_style_colors\n colors = { }\n color_for_tint = new_color($properties['tintColor'])\n secondary_tint = new_color($properties['secondaryTintColor'] || DEFAULT_SECONDARY_TINT_COLOR)\n\n button_end_color = Image.read(\"#{$master_dir}/button-enabled.png\").first.pixel_color_grav(SouthGravity)\n button_active_end_color = Image.read(\"#{$master_dir}/button-active.png\").first.pixel_color_grav(NorthGravity)\n dialog_titlebar_end_color = Image.read(\"#{$master_dir}/dialog-titlebar.png\").first.pixel_color_grav(SouthGravity)\n slider_light_color = Image.read(\"#{$master_dir}/slider-horiz-full.png\").first.pixel_color_grav(NorthGravity)\n slider_dark_color = Image.read(\"#{$master_dir}/slider-horiz-full.png\").first.pixel_color_grav(SouthGravity)\n titlebar_end_color = Image.read(\"#{$master_dir}/titlebar.png\").first.pixel_color_grav(SouthGravity)\n titlebar_active_end_color = Image.read(\"#{$master_dir}/titlebar-active.png\").first.pixel_color_grav(SouthGravity)\n titlebar_hover_end_color = Image.read(\"#{$master_dir}/titlebar-hover.png\").first.pixel_color_grav(SouthGravity)\n\n if $properties['dark']\n\n # TODO: finish support for dark themes\n colors['primary-background-color'] = new_color('#202020')\n colors['primary-text-color'] = new_color('#FFFFFF')\n\n else\n\n colors['primary-background-color'] = new_color('#FFFFFF')\n colors['primary-text-color'] = new_color('#000000')\n\n colors['autocomplete-highlight-color'] = secondary_tint.color_with_alpha(0.5)\n\n colors['button-background-color'] = button_end_color.tint(color_for_tint, 100)\n colors['button-border-color'] = new_color('#666666').tint(color_for_tint, 100)\n colors['button-active-background-color'] = button_active_end_color.tint(color_for_tint, 100)\n colors['button-active-border-color'] = new_color('#666666').tint(color_for_tint, 100)\n colors['button-disabled-background-color'] = button_end_color\n colors['button-disabled-border-color'] = new_color('#A3A3A3')\n colors['button-disabled-text-color'] = new_color('#7F7F7F')\n colors['button-disabled-text-shadow-color'] = new_color('#F5F5F5')\n colors['button-hover-background-color'] = button_end_color.tint(color_for_tint, 100)\n colors['button-hover-border-color'] = new_color('#BBBBBB').tint(color_for_tint, 100)\n colors['button-hover-border-bottom-color'] = new_color('#999999').tint(color_for_tint, 100)\n colors['button-text-color'] = new_color('#202020').tint(color_for_tint, 100)\n colors['button-text-shadow-color'] = new_color('#EBEBEB')\n colors['checkbox-hover-background-color'] = secondary_tint.color_with_alpha(0.5)\n colors['combobutton-separator-color'] = new_color('#DBDBDB').tint(color_for_tint, 100)\n colors['combobutton-disabled-separator-color'] = new_color('#DBDBDB')\n\n colors['calendar-adjacent-month-date-label-color'] = new_color('#8B8B8B')\n colors['calendar-border-color'] = new_color('#666666').tint(color_for_tint, 100)\n colors['calendar-dayofweek-text-color'] = new_color('#404040').tint(color_for_tint, 100)\n colors['calendar-disabled-background-color'] = new_color('#BBBBBC')\n colors['calendar-current-month-date-border-color'] = new_color('#E3E3E3').tint(color_for_tint, 100)\n colors['calendar-hover-date-background-color'] = new_color('#EEEEEE').tint(secondary_tint, 100)\n colors['calendar-year-background-color'] = new_color('#D0D0D0').tint(color_for_tint, 100)\n colors['calendar-year-selected-border-color'] = new_color('#666666').tint(color_for_tint, 100)\n colors['calendar-year-prevnext-border-color'] = new_color('#666666').tint(color_for_tint, 100)\n\n colors['container-border-color'] = new_color('#666666').tint(color_for_tint, 100)\n\n colors['dialog-background-color'] = dialog_titlebar_end_color.tint(color_for_tint, 100)\n colors['dialog-border-color'] = new_color('#666666').tint(color_for_tint, 100)\n colors['dialog-box-shadow-color'] = new_color('#000000')\n colors['dialog-underlay-color'] = new_color('#222222')\n\n colors['dnd-avatar-can-drop-color'] = new_color('#07930E')\n colors['dnd-avatar-cannot-drop-color'] = new_color('#FF0000')\n colors['dnd-insert-point-color'] = new_color('#333333')\n\n colors['focus-label-outline-color'] = new_color('#666666')\n colors['focus-ring-color'] = secondary_tint.color_with_alpha(0.95)\n\n colors['input-border-color'] = new_color('#999999').tint(color_for_tint, 100)\n colors['input-disabled-border-color'] = new_color('#999999')\n colors['input-disabled-text-color'] = new_color('#888888')\n colors['input-invalid-background-color'] = new_color('#F9F7BA')\n\n colors['menu-background-color'] = new_color('#F4F4F4')\n colors['menu-border-color'] = new_color('#ACACAC')\n colors['menu-separator-dark-color'] = new_color('#9B9B9B')\n colors['menu-separator-light-color'] = new_color('#E8E8E8')\n colors['menu-text-color'] = colors['primary-text-color']\n colors['menu-text-shadow-color'] = colors['primary-background-color']\n colors['menubar-background-color'] = titlebar_end_color.tint(color_for_tint, 100)\n colors['menubar-text-color'] = colors['primary-text-color']\n\n colors['popup-box-shadow-color'] = new_color('#515151')\n\n colors['progress-bar-empty-background-color'] = new_color('#F0F0F0')\n colors['progress-bar-empty-border-color'] = new_color('#C8C8C8')\n colors['progress-bar-indeterminate-border-color'] = new_color('#8EA8B8')\n colors['progress-bar-text-color'] = new_color('#697A8B')\n colors['progress-bar-tile-background-color'] = secondary_tint\n\n colors['selected-item-background-color'] = secondary_tint\n colors['selected-item-text-color'] = new_color('#FFFFFF')\n\n colors['slider-horiz-progress-background-color'] = slider_dark_color.tint(secondary_tint, 100)\n colors['slider-horiz-progress-border-color'] = slider_dark_color.tint(secondary_tint, 85)\n colors['slider-horiz-remainder-background-color'] = new_color('#CBCBCB')\n colors['slider-horiz-remainder-border-color'] = new_color('#919191')\n colors['slider-vert-progress-background-color'] = slider_dark_color.tint(secondary_tint, 100)\n colors['slider-vert-progress-border-color'] = slider_dark_color.tint(secondary_tint, 85)\n colors['slider-vert-remainder-background-color'] = new_color('#B3B3B3')\n colors['slider-vert-remainder-border-color'] = new_color('#B3B3B3')\n\n colors['splitter-background-color'] = new_color('#F0F0F0').tint(color_for_tint, 100)\n\n colors['tab-background-color'] = new_color('#F0F0F0').tint(color_for_tint, 100)\n colors['tab-glow-color'] = new_color(134, 163, 180, 0.45) #TINT\n\n colors['titlebar-active-background-color'] = titlebar_active_end_color.tint(color_for_tint, 100)\n colors['titlebar-hover-background-color'] = titlebar_hover_end_color.tint(color_for_tint, 100)\n colors['titlebar-background-color'] = titlebar_end_color.tint(color_for_tint, 100)\n\n colors['toolbar-button-background-color'] = new_color('#FFFFFF') #TINT\n\n colors['tooltip-background-color'] = new_color($properties['tooltipBackgroundColor'] || DEFAULT_TOOLTIP_BACKGROUND_COLOR)\n colors['tooltip-border-color'] = new_color($properties['tooltipBorderColor'] || DEFAULT_TOOLTIP_BORDER_COLOR)\n\n end\n\n colors\nend", "title": "" }, { "docid": "d6aa7261756ca73f6c45aa07687633c0", "score": "0.5455972", "text": "def background_colour=(colour)\n\t\t@label.background_colour = colour\n\tend", "title": "" }, { "docid": "a543add1c2349aa8fb66ee4e65c39e42", "score": "0.5434902", "text": "def background\n return @background if @background\n photo_background # modifies the background option\n @background = @options[:processor].new(:color => @options[:background], :width => @options[:width], :height => @options[:height])\n @background.crop_to_fit(@options[:width], @options[:height])\n end", "title": "" }, { "docid": "34500f04b702a8cb76b290ccf7cef6f6", "score": "0.54290116", "text": "def getformat(cell)\n cc = cell\n cf = nil\n if cc\n if cc.effective_format\n cf = cc.effective_format.background_color\n end\n end\n cf\n end", "title": "" }, { "docid": "4b7c6811da2361f02ebaed76d8792b83", "score": "0.54235274", "text": "def adjust_colors (props = {foreground: \"red\", background: \"white\"})\n\tputs \"Foreground: #{props[:foreground]}\" if props[:foreground]\n\tputs \"Background: #{props[:background]}\" if props[:background]\nend", "title": "" }, { "docid": "4b7c6811da2361f02ebaed76d8792b83", "score": "0.54235274", "text": "def adjust_colors (props = {foreground: \"red\", background: \"white\"})\n\tputs \"Foreground: #{props[:foreground]}\" if props[:foreground]\n\tputs \"Background: #{props[:background]}\" if props[:background]\nend", "title": "" }, { "docid": "4c36663b2d2322fb6f7c978fe3a47fc4", "score": "0.54010004", "text": "def as_bg_color\n BgColor.new(code + BgColor::BG_OFFSET, bright?)\n end", "title": "" }, { "docid": "26387948863f3215698876b43c227f95", "score": "0.5394928", "text": "def format_config\n @api.configuration[:format_config] ||\n google_style_config\n end", "title": "" }, { "docid": "3ff937fe0bb354e74accab558f1b456d", "score": "0.53905815", "text": "def im_background(color)\n @image_magick_strings << \"-background #{color} -alpha remove\" \n end", "title": "" }, { "docid": "c189acb2b27a683b0d3deddb8e624444", "score": "0.5380757", "text": "def get_background_for_user\n return \"light\" if current_user.blank? || current_user.background_image_id == 0\n return \"dark\" if current_user.background_image_id == 1\n # catch all just in case...\n return \"light\"\n end", "title": "" }, { "docid": "8680b26f54ade60a1ba30947a5dfe5ad", "score": "0.5371433", "text": "def default_header_background_color\n (255 * (1.0-default_header_background_grey_percent)).to_i.to_s(16) * 3\n end", "title": "" }, { "docid": "f4409f1c27254f2f3da9d4aa026bfcb4", "score": "0.5365108", "text": "def default_background\n \"\\e[49m#{self}\\e[0m\"\n end", "title": "" }, { "docid": "b4e2d9f6e70bcc63237dbc45c2c2432a", "score": "0.53649056", "text": "def background_color_css_selector_for(theme)\n return \"with-colored-background\" if theme == :home_page_style\n return \"with-colored-background\" if theme == :articles_page_style\n return \"\"\n end", "title": "" }, { "docid": "2fcc54d0844e24d71fdc13d599ffc66d", "score": "0.5359824", "text": "def style_attributes(tile_info)\n \"style='background-color: #{tile_info[0]}' title='#{tile_info[1]}'\"\n end", "title": "" }, { "docid": "4c61da5c2264af7d44865a001582bbcc", "score": "0.5358286", "text": "def saveconf_style\n\tif @mode == 'saveconf' then\n\t\t@conf['style'] = @cgi.params['style'][0]\n\tend\nend", "title": "" }, { "docid": "4c61da5c2264af7d44865a001582bbcc", "score": "0.5358286", "text": "def saveconf_style\n\tif @mode == 'saveconf' then\n\t\t@conf['style'] = @cgi.params['style'][0]\n\tend\nend", "title": "" }, { "docid": "1d995f067d16b9a95b3b4374edac929e", "score": "0.5357622", "text": "def bg_color_attribute_for_payer_address(make_payer_address_readonly)\n if !make_payer_address_readonly.blank?\n 'background-color:#A9A9A9'\n else\n ''\n end\n end", "title": "" }, { "docid": "5a98c2a9b3854c09c60b049e94e75af3", "score": "0.53570586", "text": "def background_tag\n if background_image_url\n \"background-image: url(#{background_image_url});\"\n else\n nil\n end\n end", "title": "" }, { "docid": "35a90a7575687723f2f713930220d4cd", "score": "0.5352829", "text": "def color_fmt\n case self\n when /\\dB?$/\n self.blue\n when /\\dKB?$/\n self.green\n when /\\dMB?$/\n self.yellow\n when /\\dGB?$/\n self.red\n else\n self.bold.red\n end\n end", "title": "" }, { "docid": "aea06acee2153379846208b02a6b4f79", "score": "0.53516936", "text": "def bgcolor n\n Attribute.new \"bgcolor = %p\" % [n]\n end", "title": "" }, { "docid": "0b4347e02d74e98da49bb8cd05cf0032", "score": "0.5347458", "text": "def banner_css_options\n css_options = {}\n css_style = ''\n\n background_color = ENV.has_key?('ENVIRONMENT_BANNER_BACKGROUND') ? ENV['ENVIRONMENT_BANNER_BACKGROUND'] : ''\n foreground_color = ENV.has_key?('ENVIRONMENT_BANNER_FOREGROUND') ? ENV['ENVIRONMENT_BANNER_FOREGROUND'] : ''\n\n if !background_color.empty?\n css_style = \"background-color: #{background_color};\"\n end\n\n if !foreground_color.empty?\n css_style += \" color: #{foreground_color};\"\n css_style.strip!\n end\n\n if !css_style.empty?\n css_options[:style] = css_style\n end\n\n css_options[:class] = 'environment-banner'\n css_options\n end", "title": "" }, { "docid": "3a6bb02bf45e34533a43c2e47b4306c0", "score": "0.53428745", "text": "def light_background_logo=(value)\n @light_background_logo = value\n end", "title": "" }, { "docid": "8a488610f9490eba6fdf26fadeb6bc8b", "score": "0.53368336", "text": "def backgroundColor\n\t\t\t@extraInfo.nil? ? nil : @extraInfo.backgroundColor\n\t\tend", "title": "" }, { "docid": "41b4a4428df4ed465b5e399c8e1ea379", "score": "0.533495", "text": "def adjust_colors(props = {foreground: \"Red\", background: \"White\"})\n puts \"Foreground: #{props[:foreground]}\" if props[:foreground]\n puts \"Background: #{props[:background]}\" if props[:background]\nend", "title": "" }, { "docid": "7d2cf97487ab5a419f7af00766cbb679", "score": "0.5317943", "text": "def glow_color\n if enabled?\n Title_Settings::TITLE_BORDER_COLOR\n else\n color = Title_Settings::TITLE_BORDER_COLOR.clone\n color.alpha = Title_Settings::DISABLED_OPACITY\n color\n end\n end", "title": "" }, { "docid": "ac017f1ba59e447f157e5942fa4d1606", "score": "0.53140986", "text": "def getRemediationBackground; @rbackground; end", "title": "" }, { "docid": "91045ad0de999cd50df0bec9932a145a", "score": "0.53106725", "text": "def adjust_color(props = {foreground: \"red\", background: \"white\"})\n puts \"Foreground: #{props[:foreground]}\" if props[:foreground]\n puts \"Background: #{props[:background]}\" if props[:background]\nend", "title": "" }, { "docid": "2f0b47218e1eec2d71eb452c943295d9", "score": "0.5304375", "text": "def local_bg(body)\n opts_array = [ \"background\", @var[:skin][:back_color].to_i ]\n chooser = ColorDialogBox.new(@fox_app, opts_array)\n chooser.create\n if chooser.execute(PLACEMENT_OWNER) == 1\n @var[:skin][:back_color] = opts_array[1]\n @window.apply_skin(@skin)\n _save_env\n end\nend", "title": "" }, { "docid": "9e4754b97cdcb7bdffd23357b2322971", "score": "0.5298312", "text": "def background_colour\n\t\t@button.background_colour\n\tend", "title": "" }, { "docid": "248d5603c3a8bd2f49711c6976cb52ff", "score": "0.5294849", "text": "def background=(background)\r\n @background = background\r\n refresh\r\n end", "title": "" }, { "docid": "c47a627791cc0b3e55e72592b5e679b5", "score": "0.52857894", "text": "def color_class() 'important' end", "title": "" }, { "docid": "13837dcf1e29b0623250ce760d2ddf69", "score": "0.5284142", "text": "def create_custom_bg\n if in_auto_background_map?\n background = get_tile_background\n else\n background = get_variable_background(BATTLEGROUND_VARIABLE)\n end\n create_battleground(background)\n end", "title": "" }, { "docid": "83429c9b1e60ce2ecaf93fffb3e42993", "score": "0.52749693", "text": "def theme_style_url\n theme_color_url\n end", "title": "" }, { "docid": "c796b562878686819b0194213baabb0e", "score": "0.5274314", "text": "def page_bg\n @bg_image = current_page?('/') ? 'bg-image' : ''\n end", "title": "" }, { "docid": "96e3640b1e72c41617e3f3ad9c791f43", "score": "0.52704155", "text": "def bg_blue(str)\n colorize(str, 44)\n end", "title": "" }, { "docid": "74a139e8d6b14b71ffb6ca90d39646a9", "score": "0.52679443", "text": "def colour1\n return self.team.tenant.colour_1 if !self.team.nil? && self.team.config.style_override_colours\n read_attribute(:colour1)\n end", "title": "" }, { "docid": "e2c4aaa8e505f9d039f14ff0b7999a2b", "score": "0.526632", "text": "def yellow_bg\n return colorize(43)\n end", "title": "" }, { "docid": "a04c21ce2b7b5978bd3a58187b413cdd", "score": "0.5265744", "text": "def set_background(file)\r\n # Set Background's Background\r\n background.background = file\r\n end", "title": "" }, { "docid": "1bae7b44bcf2d3a462cf1cdb9a4f8f99", "score": "0.52632797", "text": "def bg_colors\n {\n black: \"\\e[40m\",\n red: \"\\e[41m\",\n green: \"\\e[42m\",\n yellow: \"\\e[43m\",\n blue: \"\\e[44m\",\n magenta: \"\\e[45m\",\n cyan: \"\\e[46m\",\n white: \"\\e[47m\",\n }\n end", "title": "" }, { "docid": "1bae7b44bcf2d3a462cf1cdb9a4f8f99", "score": "0.52632797", "text": "def bg_colors\n {\n black: \"\\e[40m\",\n red: \"\\e[41m\",\n green: \"\\e[42m\",\n yellow: \"\\e[43m\",\n blue: \"\\e[44m\",\n magenta: \"\\e[45m\",\n cyan: \"\\e[46m\",\n white: \"\\e[47m\",\n }\n end", "title": "" }, { "docid": "795d564e56a86d3c33d3ddd81098d380", "score": "0.5257662", "text": "def style_key\n {\n red: 31,\n green: 32,\n orange: 33,\n blue: 94,\n background: 40,\n blinking: 5,\n underline: 4,\n invert: 7\n }\n end", "title": "" }, { "docid": "8df8147f7219d4b74d4616e3b7ce4131", "score": "0.5257253", "text": "def image_dimensions_background_css_rule(input) \n dims=_dimensions(input);\n w = dims[0]\n h = dims[1]\n \"background-size: #{w.ceil}px #{h.ceil}px;\"\n end", "title": "" }, { "docid": "59fa77239592f6be2daa9469ff0c7a59", "score": "0.52570456", "text": "def bg_color\n # Add logic to either get the default color from its organization or update share_button attr.\n self.share_button[:bg_color]\n\n end", "title": "" }, { "docid": "0ce9d5fa66080295cf261cbc6ae02c9e", "score": "0.52548856", "text": "def setBackgroundColor\n \t\t@background_color = session['background_color']\n\tend", "title": "" }, { "docid": "809052692748f6b79add7a1e4504817a", "score": "0.5253601", "text": "def color\n @options[:color].to_s.gsub(/[^\\dA-Z]/i, \"\")\n end", "title": "" }, { "docid": "ceb95b32a205d54698aeef94c3759ede", "score": "0.5253298", "text": "def style=(style); end", "title": "" }, { "docid": "16facbbbda645c556aa31d96db3986e4", "score": "0.5249684", "text": "def backgroundUri\n\t\t\t@extraInfo.nil? ? nil : @extraInfo.backgroundUri\n\t\tend", "title": "" } ]
f484bee157c99e50e2596b6ee72b6b7b
Generate IM Group Chat podspec.
[ { "docid": "8415c2bed9c058ee0ec63f085e43b1a3", "score": "0.8295817", "text": "def generateAVOSCloudIMGroupChat()\n header_files = header_files('AVOSCloudIMGroupChat')\n source_files = source_files('AVOSCloudIMGroupChat')\n public_header_files = public_header_files('AVOSCloudIMGroupChat')\n\n template = File.read('Podspec/AVOSCloudIMGroupChat.podspec.mustache')\n\n podspec = Mustache.render template, {\n 'version' => version,\n 'source_files' => file_list_string(header_files + source_files, 4),\n 'public_header_files' => file_list_string(public_header_files, 4),\n }\n\n write 'AVOSCloudIMGroupChat.podspec', podspec\n end", "title": "" } ]
[ { "docid": "3db7351d795ebe7c168b2d841e6e8de1", "score": "0.54835427", "text": "def groupme_to_peribot(message)\n {\n service: :groupme,\n group: \"groupme/#{message['group_id']}\",\n text: message['text'] || '',\n user_name: message['name'],\n id: message['id'],\n attachments: convert_attachments(message['attachments']),\n original: message\n }\n end", "title": "" }, { "docid": "852ee3feffb85f0f8aa0af4f80f72ceb", "score": "0.5104262", "text": "def agroup_components\n self.add(@msg)\n end", "title": "" }, { "docid": "17ac42bf09a1e77aff1a4d8e7fb4c457", "score": "0.50629014", "text": "def build_spec\n url = database_group_url(@group.to_s)\n if url\n build_group_spec_from_url(url)\n else\n build_spec_from_config\n end\n end", "title": "" }, { "docid": "fe8888bd2a3d1c73110884c31c7f9bb4", "score": "0.50170857", "text": "def get_group_chat\n\t \tp\"------get_group_chat----#{params.inspect}-----------\"\n \t\t@sender = User.find_by(id: params[:sender_id])\n\t\t@group = Group.find_by(id: params[:assoc_id])\n\t\t@group_owner = @group.user_id\n\t\tgroup_member_ids = @group.group_memberships.pluck(:user_id) << @group_owner\n\t if @group.present?\n\t\t # @room = Room.where(\"(sender_id = ? and assoc_id = ? and is_group = ?) or (sender_id = ? and assoc_id = ? and is_group = ?) \", @sender.id,@group.id,true,@group.id,@sender.id,true).first\n\t\t\t@room = Room.where(\"(assoc_id = ? and is_group = ?) \", @group.id,true).first\n\t \tif @room.nil?\n\t\t\t @room = Room.create(:sender_id => params[:sender_id],:assoc_id => @group.id, :is_group => TRUE )\n\t\t\tend\n\t \t@chats = Message.where(\"(assoc_id = ? and is_group = ? )\",@group.id, true).order(:created_timestamp)\n\t\t array = Array.new\n\t\t @chats.each do |chat|\n\t\t read_by = chat.read_by\n\t\t\t read_by << params[:sender_id].to_s unless read_by.include?(params[:sender_id].to_s)\t\n\t\t\t chat.update(read_by: read_by)\n\t\t\t hash = {}\n\t\t\t hash[:id] = chat.id\n\t\t\t chat.body == nil ? hash[:body] = chat.image.url : hash[:body] = chat.body\n\t\t\t hash[:username] = User.find_by_id(chat.sender_id).username\n\t\t\t hash[:upload_type] = chat.upload_type\t\t \n\t\t \t\tp \"=============UPLOAD TYPE==========#{chat.upload_type.inspect}==================================\"\n\t\t\t hash[:is_user_sender] = (chat.sender_id == @sender.id )? true :false\n\t\t\t hash[:created_timestamp] = chat.tstamp\n\t\t\t array << hash\n\t\t\tend\n\t\t render :json => {:response_code => 200,\n\t :response_message => \"Chats fetched Successfuly.\",\n\t :room_id => @room.id,\n\t\t\t :group_member_ids => group_member_ids,\n\t\t\t :group_img => @group.group_image,\n\t :name => @group.group_name,\n\t :user_info => array\t\t\t\t\t \n\t }\n else\n \t\trender_message 500, \"Group does not exist.\"\n end\n end", "title": "" }, { "docid": "5f3bf361a8a69fd3f65d6bd1e955cdeb", "score": "0.49982354", "text": "def build_group_header\n output << \" \\\"#{data.name}\\\":\"\n end", "title": "" }, { "docid": "adb95165c7f0f5ee0d39b43bfc0a30ae", "score": "0.49585262", "text": "def create\n message = ConversationMessage.new(message_params.merge(conversation_id: @conversation.id))\n message.userable = get_current_user\n if message.save\n # current_conversation = message.conversation\n # @conversations = Conversation.send(current_conversation.topic).all_onversations(current_user).paginate(page: params[:page], per_page: 10)\n # @conversations << current_conversation\n # @conversations = @conversations.uniq\n @conversation.chatable.groupables.each do |gm|\n ActionCable.server.broadcast \"Message_#{gm.groupable_type}_#{gm.groupable_id}\",\n msg_id: message.id,\n # msg: message_content,\n msg: message.body,\n img_alt: \"#{message.userable.first_name[0]&.capitalize || 'N'}.#{message.userable.last_name[0]&.capitalize || 'A'}\",\n sender_name: message.userable.full_name.capitalize,\n file_url: message.file_url || '',\n msg_url: message.userable.photo,\n msg_time: message.created_at.strftime('%l:%M%P'),\n # msg_att: message.attachment_file,\n # msg_att_name: message.file_name,\n usr_typ: message.userable.class.to_s,\n usr: message.userable.id,\n recpt_type: gm.groupable_type,\n recpt_id: gm.groupable_id,\n unread_msg_cnt: 0, # Conversation.joins(:conversation_messages).where(\"(senderable_type = ? AND senderable_id = ? ) OR (recipientable_type = ? AND recipientable_id = ?)\", recipient.class.to_s, recipient.id, recipient.class.to_s, recipient.id).where.not(conversation_messages: {is_read: true, userable: recipient}).uniq.count,\n con_id: @conversation.id,\n chat_typ: 'Group',\n grp_id: @conversation.chatable.id,\n dom: \"#conversation_#{@conversation.id}\"\n end\n end\n head :ok\n end", "title": "" }, { "docid": "381b8dfbbc396f9c54e4115ecbe9e221", "score": "0.4954277", "text": "def group_chat(message) \n puts \"This is a Public Group\"\n puts message \n # secure_chat(\"This is confidential\")\n personal_chat(\"hi how are you\") \n end", "title": "" }, { "docid": "7b493ec688f8d988e0ff9e1b782c6737", "score": "0.49538752", "text": "def create_channel_group request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_create_channel_group_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Analytics::Admin::V1alpha::ChannelGroup.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "title": "" }, { "docid": "d2f45a0dac1f0d3ae83dad3b1af948eb", "score": "0.49214178", "text": "def groupChat _obj, _args\n \"_obj groupChat _args;\" \n end", "title": "" }, { "docid": "c805ca017ca8e76dc3a0ad786090bd98", "score": "0.4870077", "text": "def group_builder; end", "title": "" }, { "docid": "0f57cfca768063cc6b36ae52ac3c495d", "score": "0.48600042", "text": "def build_groups # rubocop:disable Metrics/AbcSize\n group_array = []\n @data['controls'].each do |control|\n group = HappyMapperTools::Benchmark::Group.new\n group.id = control['id']\n group.title = control['gtitle']\n group.description = \"<GroupDescription>#{control['gdescription']}</GroupDescription>\" if control['gdescription']\n\n group.rule = HappyMapperTools::Benchmark::Rule.new\n group.rule.id = control['rid']\n group.rule.severity = control['severity']\n group.rule.weight = control['rweight']\n group.rule.version = control['rversion']\n group.rule.title = control['title'].tr(\"\\n\", ' ') if control['title']\n group.rule.description = \"<VulnDiscussion>#{control['desc'].tr(\"\\n\", ' ')}</VulnDiscussion><FalsePositives></FalsePositives><FalseNegatives></FalseNegatives><Documentable>false</Documentable><Mitigations></Mitigations><SeverityOverrideGuidance></SeverityOverrideGuidance><PotentialImpacts></PotentialImpacts><ThirdPartyTools></ThirdPartyTools><MitigationControl></MitigationControl><Responsibility></Responsibility><IAControls></IAControls>\"\n\n if ['reference.dc.publisher', 'reference.dc.title', 'reference.dc.subject', 'reference.dc.type', 'reference.dc.identifier'].any? { |a| @attribute.key?(a) }\n group.rule.reference = build_rule_reference\n end\n\n group.rule.ident = build_rule_idents(control['cci']) if control['cci']\n\n group.rule.fixtext = HappyMapperTools::Benchmark::Fixtext.new\n group.rule.fixtext.fixref = control['fix_id']\n group.rule.fixtext.fixtext = control['fix']\n\n group.rule.fix = build_rule_fix(control['fix_id']) if control['fix_id']\n\n group.rule.check = HappyMapperTools::Benchmark::Check.new\n group.rule.check.system = control['checkref']\n\n # content_ref is optional for schema compliance\n if @attribute['content_ref.name'] || @attribute['content_ref.href']\n group.rule.check.content_ref = HappyMapperTools::Benchmark::ContentRef.new\n group.rule.check.content_ref.name = @attribute['content_ref.name']\n group.rule.check.content_ref.href = @attribute['content_ref.href']\n end\n\n group.rule.check.content = control['check']\n\n group_array << group\n end\n @benchmark.group = group_array\n end", "title": "" }, { "docid": "6abfb97d82449b0ecbfad615d1eaa3e2", "score": "0.4845716", "text": "def example_group_started(notification)\n # there is a super method for this\n super(notification)\n doc = {\n 'type' => 'case',\n 'subtype' => 'describe',\n 'label' => \"#{notification.group.description}\",\n 'level' => @example_group_stack.size\n }\n @example_group_stack << example_group\n return doc\n end", "title": "" }, { "docid": "83c2f066f7bbd0eed4660887212e1c0d", "score": "0.48412952", "text": "def define_command_group name, opts = nil, &blk\n opts = _take_doc(opts)\n # $stderr.puts \"@target = #{@target.inspect}\"\n # $stderr.puts \"define_command_group #{name.inspect}, #{opts.inspect}\"\n \n cmd = _command_manager.define_command_group(name, opts)\n\n cmd._defined_in = @plugin\n\n # @plugin.commands << cmd\n\n _with_target cmd.subcommands, &blk\n\n cmd\n end", "title": "" }, { "docid": "742bd8ce6fd9299f5d2da13796617b44", "score": "0.4827907", "text": "def get_message_specifications\n\t\tend", "title": "" }, { "docid": "b8fdcf568a148f20cda019ad3a720dfa", "score": "0.48061046", "text": "def generate_embed(index)\n embed = Discordrb::Webhooks::Embed.new\n embed.color = 0xFFD700\n\n # If index for a role group is given, generate embed for that group\n if index > 0\n group = AssignableRoleGroup.all[index - 1]\n embed.author = {\n name: \"Group: #{group.name}\",\n icon_url: BOT_AVATAR_URL\n }\n embed.description = <<~DESC.strip\n #{group.description}\n\n #{group.is_exclusive ? '**This group is exclusive; you can only have one role from it at a time.**' : nil}\n DESC\n roles_text = if group.roles.any?\n group.roles.map do |role|\n if role.description\n \"• `!#{role.key}` **#{SERVER.role(role.id).name}** - *#{role.description}*\"\n else\n \"• `!#{role.key}` **#{SERVER.role(role.id).name}**\"\n end\n end.join(\"\\n\")\n else\n 'No roles found.'\n end\n embed.add_field(\n name: 'Roles',\n value: roles_text\n )\n embed.footer = {text: \"Group key: #{group.key}\"}\n\n # Otherwise, generate an embed for ungrouped roles\n else\n roles = AssignableRole.all.reject { |r| r.group }\n\n embed.author = {\n name: \"Ungrouped Roles\",\n icon_url: BOT_AVATAR_URL\n }\n embed.description = <<~DESC_DICHADO.strip\n This is a list of all assignable roles that do not have a group.\n Use a role's command to assign it to you, and use it again to remove it.\n DESC_DICHADO\n roles_text = if roles.any?\n roles.map do |role|\n if role.description\n \"• `!#{role.key}` **#{SERVER.role(role.id).name}** - *#{role.description}*\"\n else\n \"• `!#{role.key}` **#{SERVER.role(role.id).name}**\"\n end\n end.join(\"\\n\")\n else\n 'No roles found.'\n end\n embed.add_field(\n name: 'Roles',\n value: roles_text\n )\n embed.footer = {text: \"Use the reaction buttons to scroll through the groups.\"}\n end\n\n embed\n end", "title": "" }, { "docid": "2e8f8302673bd148d1f713c3eb4bc16e", "score": "0.47699863", "text": "def to_spec\n classifier ? \"#{group}:#{id}:#{type}:#{classifier}:#{version}\" : \"#{group}:#{id}:#{type}:#{version}\"\n end", "title": "" }, { "docid": "cb9198c42717ca1da42ad7b7000bcbb7", "score": "0.47686526", "text": "def add_pod_group(name)\n pods.groups.new('name' => name)\n end", "title": "" }, { "docid": "ca9c65c2d422affb6d9aae55b3cc69f8", "score": "0.47682923", "text": "def im_group_create_with_http_info(body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: IMGroupsApi.im_group_create ...'\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling IMGroupsApi.im_group_create\"\n end\n # resource path\n local_var_path = '/im/groups'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'multipart/form-data'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n auth_names = ['OAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: IMGroupsApi#im_group_create\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "f5d0ee0fdcd39ba11d2de086f98f31e9", "score": "0.47333208", "text": "def group()\n return MicrosoftGraph::Me::JoinedTeams::Item::Group::GroupRequestBuilder.new(@path_parameters, @request_adapter)\n end", "title": "" }, { "docid": "9df22a2b182a7392605b7cd796e4a6dc", "score": "0.47327697", "text": "def generate_id_yml(script)\n native_data = script.native\n native_data[:container][:supplemental_groups] = supplemental_groups(native_data[:container][:supplemental_groups])\n container = helper.container_from_native(native_data[:container], default_env)\n id = generate_id(container.name)\n configmap = helper.configmap_from_native(native_data, id, script.content)\n init_containers = helper.init_ctrs_from_native(native_data[:init_containers], container.env)\n spec = OodCore::Job::Adapters::Kubernetes::Resources::PodSpec.new(container, init_containers: init_containers)\n all_mounts = native_data[:mounts].nil? ? mounts : mounts + native_data[:mounts]\n node_selector = native_data[:node_selector].nil? ? {} : native_data[:node_selector]\n gpu_type = native_data[:gpu_type].nil? ? \"nvidia.com/gpu\" : native_data[:gpu_type]\n\n template = ERB.new(File.read(resource_file), nil, '-')\n\n [template.result(binding), id]\n end", "title": "" }, { "docid": "2b1b9af5b1044d9612ad4cd18f544f9c", "score": "0.4725233", "text": "def groupchats\n @groupchat = []\n @group_comments = GroupComment.all\n @group_comments.each { |comment|\n if (comment.studygroup_id == group_comment_params[:studygroup_id].to_f)\n @groupchat.push(comment)\n end\n }\n render json: @groupchat\n end", "title": "" }, { "docid": "9125f41319bd8b609d31b64025a5547a", "score": "0.47080737", "text": "def create_group\n group new_resource.group do\n gid new_resource.gid\n system true\n end\n end", "title": "" }, { "docid": "d6dcb4eb66d9b1d5afcf7da6a7cba6e0", "score": "0.46960643", "text": "def listgroups(msg, ent, ii, depth)\r\n ent.each do |bit|\r\n next unless bit.is_a?(Sketchup::Group)\r\n bname = bit.name.empty? ? 'no name' : bit.name\r\n spacer = ' ' * depth\r\n msg += spacer + ii.to_s + ' - ' + bname + \"\\n\"\r\n msg = listgroups(msg, bit.entities, ii, depth + 1)\r\n end\r\n msg\r\n end", "title": "" }, { "docid": "067200e57d8445dd83a0c43ecef0ad16", "score": "0.46736497", "text": "def generate_welcome_message\n if default_message.present?\n messages.notification.create(sender_id: owner_id, body: default_message)\n else\n messages.notification.create(sender_id: owner_id, body: \"#{owner.full_name(false)} created this conversation group.\") if is_group_conversation?\n end\n end", "title": "" }, { "docid": "e01697586d9497eade8e72d8bf8b2860", "score": "0.4669436", "text": "def start\n init()\n set_sending_patterns()\n\n membership_str = \"\"\n $groups.each do |g|\n str = \"Member of Group #{g}: \"\n $members[g].each { |n| str << (n.to_s + \" \") }\n membership_str << str << \"\\n\"\n end\n\n all_runs()\n\n puts membership_str\n $patterns_file.close\nend", "title": "" }, { "docid": "a9bbe6bd73147dad952240373c4f2ef9", "score": "0.46478766", "text": "def build_grouping_body\n arr = []\n data.each do |_,group| \n arr << render_group(group, options)\n end\n output << arr.join(\",\\n\")\n end", "title": "" }, { "docid": "6ce4d17b05e6919fd29f765443458e35", "score": "0.46327868", "text": "def add_message(type, message, spec_name, spec_version = nil)\n pods = send(:\"pods_by_#{type}\")\n pods[message] ||= {}\n pods[message][spec_name] ||= []\n pods[message][spec_name] << spec_version\n end", "title": "" }, { "docid": "9793350d51c27aec6bb1e286f91e4ec6", "score": "0.46259764", "text": "def group_name(param)\n \"groupName=#{param}\"\n end", "title": "" }, { "docid": "eccb3d6d9840714d25516258538fd4a1", "score": "0.46207517", "text": "def metadata(msg)\n {\n kind: msg.start_with?('Hello') ? 'hello' : 'regular'\n }\n end", "title": "" }, { "docid": "228abb9cceaab78edbce42292c403110", "score": "0.46187758", "text": "def generateAVOSCloudLiveQuery()\n header_files = header_files('AVOSCloudLiveQuery-iOS')\n source_files = source_files('AVOSCloudLiveQuery-macOS')\n\n public_header_files = public_header_files('AVOSCloudLiveQuery-iOS')\n\n template = File.read('Podspec/AVOSCloudLiveQuery.podspec.mustache')\n\n podspec = Mustache.render template, {\n 'version' => version,\n 'source_files' => \"'AVOS/AVOSCloudLiveQuery/**/*.{h,m}'\",\n 'public_header_files' => file_list_string(public_header_files, 4)\n }\n\n write 'AVOSCloudLiveQuery.podspec', podspec\n end", "title": "" }, { "docid": "be29188e193697745afd230a40f71f58", "score": "0.46126083", "text": "def generate_codebook_time_series_group_item(group)\n html = ''\n cls = 'group-item'\n cls2 = ''\n cls3 = 'grouped-items'\n if group.parent_id.present?\n cls << ' subgroup'\n cls2 = ' subgroup'\n cls3 = 'subgrouped-items'\n end\n html << \"<li class='#{cls}' data-id='#{group.id}'>\"\n html << \"<div class='question-group #{cls2}'>\"\n html << \"<span class='group-title'>#{group.title}</span>\"\n if group.description.present?\n html << \"<span class='group-description'>#{group.description}</span>\"\n end\n html << '</div>'\n html << \"<ul class='list-unstyled #{cls3}'>\"\n\n options = {}\n options[:group] = group.parent_id.present? ? group.parent : group\n options[:subgroup] = group.parent_id.present? ? group : nil\n\n group.arranged_items.each do |item|\n\n if item.class == TimeSeriesGroup\n html << generate_codebook_time_series_group_item(item)\n elsif item.class == TimeSeriesQuestion\n html << generate_codebook_time_series_question_item(item, options)\n end\n\n end\n\n html << '</ul>'\n html << '</li>'\n\n return html\n end", "title": "" }, { "docid": "6dc86cdd8d82de1325b94a11970790a2", "score": "0.46084845", "text": "def build_reply\n new_pm = PrivateMessage.new\n new_pm.author = receiver\n new_pm.receiver = author\n new_pm.title = 'RE: ' + title\n new_pm.message = '> ' + message.gsub(\"\\n\", \"\\n> \") + \"\\n\"\n new_pm\n end", "title": "" }, { "docid": "cc4064ce4b42e8dc334f466fe12f3770", "score": "0.46045217", "text": "def build_components(group: nil)\n heading_links = if group\n {\n pnsi_link: group_made_available_availability_types_laid_papers_paper_type_path(group_id: group.graph_id, paper_type: 'proposed-negative-statutory-instruments'),\n si_link: group_made_available_availability_types_laid_papers_paper_type_path(group_id: group.graph_id, paper_type: 'statutory-instruments'),\n treaty_link: group_made_available_availability_types_laid_papers_paper_type_path(group_id: group.graph_id, paper_type: 'treaties')\n }\n else\n {\n pnsi_link: work_packages_paper_type_path('proposed-negative-statutory-instruments'),\n si_link: work_packages_paper_type_path('statutory-instruments'),\n treaty_link: work_packages_paper_type_path('treaties')\n }\n end\n\n [\n CardFactory.new(\n heading_text: I18n.t('proposed_negative_statutory_instruments.type').pluralize,\n heading_url: heading_links[:pnsi_link]\n ).build_card,\n CardFactory.new(\n heading_text: I18n.t('statutory_instruments.type').pluralize,\n heading_url: heading_links[:si_link]\n ).build_card,\n CardFactory.new(\n heading_text: I18n.t('treaties.type').pluralize,\n heading_url: heading_links[:treaty_link]\n ).build_card\n ]\n end", "title": "" }, { "docid": "e3237129477fb53d9043035f205f06bc", "score": "0.45953354", "text": "def grouped\n # temporary feature flag in case we need a prod 'kill' switch for this feature\n raise ApiErrors::FeatureDisabled unless Panoptes.flipper[:subject_group_selection].enabled?\n\n skip_policy_scope\n\n # setup the selector params from user input, note validation occurs in the operation class\n selector_param_keys = %i[workflow_id subject_set_id num_rows num_columns]\n selector_params = params.permit(*selector_param_keys)\n\n # Sanity check -- use a testing feature flag\n # against an allow listed workflow id env var\n allowed_workflow_ids = ENV.fetch('SUBJECT_GROUP_WORKFLOW_ID_ALLOWLIST').split(',')\n raise ApiErrors::FeatureDisabled unless allowed_workflow_ids.include?(selector_params[:workflow_id])\n\n group_selection_result = SubjectGroups::Selection.run!(\n num_rows: selector_params.delete(:num_rows),\n num_columns: selector_params.delete(:num_columns),\n uploader_id: ENV.fetch('SUBJECT_GROUP_UPLOADER_ID'),\n params: selector_params,\n user: api_user\n )\n # get the list of the groups 'placeholder' group_subject ids\n group_subject_ids = group_selection_result.subject_groups.map(&:group_subject_id)\n\n selected_subject_scope =\n Subject\n .where(id: group_subject_ids)\n .order(\"idx(array[#{group_subject_ids.join(',')}], id)\") # guardrails-disable-line\n\n selection_context = Subjects::SelectorContext.new(\n group_selection_result.subject_selector,\n group_subject_ids\n ).format\n\n # serialize the subject_group's group_subject data\n render json_api: SubjectSelectorSerializer.page(\n group_selection_result.subject_selector.params,\n selected_subject_scope,\n selection_context\n )\n end", "title": "" }, { "docid": "e0bb0be76de5aa223716fe53813908ee", "score": "0.4572378", "text": "def vm_group\n return nil if host_group.nil?\n # TODO TA SG : Derive a shorter unique name (unique across process calls from the host group name only. Using rand will create multiple vm groups with 1 vm each.\n # if host_group.length > 100\n # return \"#{self.rule_type_suffix}-vm_group-#{(0...6).map { (97 + rand(26)).chr }.join}\"\n # end\n host_group + self.rule_type_suffix + CLUSTER_VM_GROUP_SUFFIX\n end", "title": "" }, { "docid": "3851711f1be6435bcb213cbd1160531c", "score": "0.4560813", "text": "def presence_message_generate(channel_name, action, subscriptor)\n presence_channel = \"#{channel_name}-presence\"\n a = { :channel => presence_channel,\n :data => {\n :user_id => subscriptor[:user_id],\n :action => action,\n :data => subscriptor[:data]\n }\n }\n end", "title": "" }, { "docid": "bc75ea917f7cf8ccdff3d47bdc97c614", "score": "0.45580673", "text": "def mccreate_campaign_template(type, opts)\n # setup_mcapi.campaigns.create(\"regular\", {list_id: \"a38ec3df9c\", subject: \"Gibbon is cool\", from_email: \"milton@gr33nmedia.com\", from_name: \"Darth Vader\", template_id: 198041, generate_text: true}, {})\n setup_mcapi.campaigns.create(type, opts, content = nil, segment_opts = nil, type_opts = nil) \n end", "title": "" }, { "docid": "b3887caaa3b057a4d35246a42a47ce0a", "score": "0.4539007", "text": "def create_group\n params[:new_members] = params[:participants]\n params[:new_admins] = params[:admin_ids]\n conversation = current_user.conversations.new(group_params)\n if conversation.save\n render_conversation(conversation)\n else\n render_error_model(conversation)\n end\n end", "title": "" }, { "docid": "84b0315d2d530f29e98909c00ca129a6", "score": "0.45383486", "text": "def dumpGroup\n user = $evm.root['user']\n unless user.nil?\n miq_group = user.miq_group\n unless miq_group.nil?\n $evm.log(\"info\",\"#{@method} - Group:<#{miq_group.description}> Begin Attributes [miq_group.attributes]\")\n miq_group.attributes.sort.each { |k, v| $evm.log(\"info\", \"#{@method} - Group:<#{miq_group.description}> Attributes - #{k}: #{v.inspect}\")} unless $evm.root['user'].miq_group.nil?\n $evm.log(\"info\",\"#{@method} - Group:<#{miq_group.description}> End Attributes [miq_group.attributes]\")\n $evm.log(\"info\", \"\")\n\n $evm.log(\"info\",\"#{@method} - Group:<#{miq_group.description}> Begin Associations [miq_group.associations]\")\n miq_group.associations.sort.each { |assc| $evm.log(\"info\", \"#{@method} - Group:<#{miq_group.description}> Associations - #{assc}\")}\n $evm.log(\"info\",\"#{@method} - Group:<#{miq_group.description}> End Associations [miq_group.associations]\")\n $evm.log(\"info\",\"\")\n\n unless miq_group.tags.nil?\n $evm.log(\"info\",\"#{@method} - Group:<#{miq_group.description}> Begin Tags [miq_group.tags]\")\n miq_group.tags.sort.each { |tag_element| tag_text = tag_element.split('/'); $evm.log(\"info\", \"#{@method} - Group:<#{miq_group.description}> Category:<#{tag_text.first.inspect}> Tag:<#{tag_text.last.inspect}>\")}\n $evm.log(\"info\",\"#{@method} - Group:<#{miq_group.description}> End Tags [miq_group.tags]\")\n $evm.log(\"info\",\"\")\n end\n\n $evm.log(\"info\",\"#{@method} - Group:<#{miq_group.description}> Begin Virtual Columns [miq_group.virtual_column_names]\")\n miq_group.virtual_column_names.sort.each { |vcn| $evm.log(\"info\", \"#{@method} - Group:<#{miq_group.description}> Virtual Columns - #{vcn}: #{miq_group.send(vcn).inspect}\")}\n $evm.log(\"info\",\"#{@method} - Group:<#{miq_group.description}> End Virtual Columns [miq_group.virtual_column_names]\")\n $evm.log(\"info\",\"\")\n end\n end\n end", "title": "" }, { "docid": "043320c13b493c50d9cdb370256d64f6", "score": "0.45354775", "text": "def is_group_conversation?\n group_title.present?\n end", "title": "" }, { "docid": "2d7e419c18fe3e6bf96bed6394e566b6", "score": "0.45260537", "text": "def create_new_vm_group\n end", "title": "" }, { "docid": "6cbc7e28e78ea49fcbd829ca8e18320d", "score": "0.450856", "text": "def create_pod_spec_from_original(pod_spec, app_name)\n {\n \"apiVersion\" => pod_spec[\"apiVersion\"],\n \"kind\" => pod_spec[\"kind\"],\n \"metadata\" => {\n \"generateName\" => pod_spec[\"metadata\"][\"generateName\"] + \"kex-\",\n \"labels\" =>\n pod_spec[\"metadata\"][\"labels\"]\n .merge(\"app\" => pod_spec[\"metadata\"][\"labels\"][\"app\"] + \"-kex\"),\n \"namespace\" => pod_spec[\"metadata\"][\"namespace\"]\n },\n \"spec\" => {\n \"containers\" => patch_containers_for_run(pod_spec[\"spec\"][\"containers\"], app_name),\n \"volumes\" => pod_spec[\"spec\"][\"volumes\"]\n }\n }\nend", "title": "" }, { "docid": "04e51e1380a3f457cae29f8422a0612e", "score": "0.45061657", "text": "def create(name, type)\n configure [\"aaa group server #{type} #{name}\", 'exit']\n end", "title": "" }, { "docid": "7e56d8f8fb32db566c42ede46ce98284", "score": "0.44998717", "text": "def generate_iogroup_channels\n @iogroup = Iogroup.find(params[:iogroup_id])\n @iogroup.iogroupcomponents.each do |iogroupcomponent|\n\n notice = 'done'\n if notice != notice = generate_channels_by_type(iogroupcomponent,'DI')\n notice = 'Nicht alle Kanäle konnten generiert werden!'\n end\n if notice != generate_channels_by_type(iogroupcomponent,'DO')\n notice = 'Nicht alle Kanäle konnten generiert werden!'\n end\n if notice != generate_channels_by_type(iogroupcomponent,'AI')\n notice = 'Nicht alle Kanäle konnten generiert werden!'\n end\n if notice != generate_channels_by_type(iogroupcomponent,'AO')\n notice = 'Nicht alle Kanäle konnten generiert werden!'\n end\n if notice != generate_channels_by_type(iogroupcomponent,'INKR')\n notice = 'Nicht alle Kanäle konnten generiert werden!'\n end\n if notice != generate_channels_by_type(iogroupcomponent,'Z')\n notice = 'Nicht alle Kanäle konnten generiert werden!'\n end\n if notice != generate_channels_by_type(iogroupcomponent,'SSI')\n notice = 'Nicht alle Kanäle konnten generiert werden!'\n end\n if notice != generate_channels_by_type(iogroupcomponent,'SDI')\n notice = 'Nicht alle Kanäle konnten generiert werden!'\n end\n if notice != generate_channels_by_type(iogroupcomponent,'SDO')\n notice = 'Nicht alle Kanäle konnten generiert werden!'\n end\n if notice != generate_channels_by_type(iogroupcomponent,'SAI')\n notice = 'Nicht alle Kanäle konnten generiert werden!'\n end\n if notice != generate_channels_by_type(iogroupcomponent,'SAO')\n notice = 'Nicht alle Kanäle konnten generiert werden!'\n end\n end\n\n redirect_to iogroups_path, :notice => (notice == 'done') ? 'Alle Kanäle wurden erfolgreich erstellt' : notice\n end", "title": "" }, { "docid": "3a79310c62bdba53b623e629304ddf32", "score": "0.44960445", "text": "def response_msg(conversation_id)\n\t\t{\n \t\"conversation_id\": conversation_id,\n\t\t\t\"text\": \"우리멍냥 응답 메세지\",\n\t\t\t\"blocks\": [\n\t\t\t\t{\n\t\t\t\t \"type\": \"text\",\n\t\t\t\t \"text\": \"*감사합니다.* 🐶\",\n\t\t\t\t \"markdown\": true\n\t\t\t\t}\n\t\t\t]\n\t\t}.to_json\n end", "title": "" }, { "docid": "4f84335db682ea0656ea52159c766639", "score": "0.44956008", "text": "def create_message_metadata\n content = self.create_preservation_message_metadata\n metadata = \"<metadata>#{content}</metadata>\"\n metadata\n end", "title": "" }, { "docid": "69f6f735f9105ed2d7c24721216300bd", "score": "0.44879237", "text": "def create_group_discussion(group, discussion)\n logger.info \"Creating group discussion topic named '#{discussion.title}'\"\n navigate_to \"#{Utils.canvas_base_url}/groups/#{group.site_id}/discussion_topics\"\n enter_and_save_discussion discussion\n end", "title": "" }, { "docid": "8edeaf0e56bb3bf381d40b0b2cbdc87c", "score": "0.44797662", "text": "def run_on_appgroup_in_zone(zone_name, appgroup_name, appgroup_data)\n $log.debug(\"Creating specs for appgroup #{appgroup_name}\")\n\n # check controller\n controller_data = appgroup_data[:controller]\n if controller_data[:type] == 'fig'\n # get fig file name\n figfile_part = controller_data[:file] || \"#{zone_name}/fig.yaml\"\n figfile = File.join(File.expand_path(@target_dir), figfile_part)\n\n template = SpecTemplatesContainers.build_template__fig_file_is_valid\n erb = ERB.new(template, nil, '%')\n @spec_code << erb.result(binding)\n\n template = SpecTemplatesContainers.build_template__fig_containers_are_up\n erb = ERB.new(template, nil, '%')\n @spec_code << erb.result(binding)\n end\n\n $log.debug(\"Done for appgroup #{appgroup_name}\")\n end", "title": "" }, { "docid": "5e7cd2bb20001f2d1559b5151c2cbda7", "score": "0.4478525", "text": "def create\n start = Time.now\n debug \"Creating device group: \\\"#{resource[:full_path]}\\\"\"\n connection = self.class.get_connection(resource[:account])\n recursive_group_create(connection,\n resource[:full_path],\n resource[:description],\n resource[:properties],\n resource[:disable_alerting])\n debug \"Finished in #{(Time.now-start)*1000.0} ms\"\n end", "title": "" }, { "docid": "0736f8af440b2069616e314208b77d62", "score": "0.44784486", "text": "def create_group(user_ids)\n raise 'Attempted to create group channel on a non-pm channel!' unless pm?\n\n response = API::Channel.create_group(@bot.token, @id, user_ids.shift)\n channel = Channel.new(JSON.parse(response), @bot)\n channel.add_group_users(user_ids)\n end", "title": "" }, { "docid": "9fb7c09902e1c2ac059809890e26f08c", "score": "0.44731578", "text": "def createGroup\n call :createGroup\n end", "title": "" }, { "docid": "2e86b2babdf7171126d3acb76a324ebd", "score": "0.44646674", "text": "def create\n mygroupreplay = Hash.new\n mygroupreplay[:body] = params[:body]\n mygroupreplay[:user_id] = params[:user_id]\n mygroupreplay[:groupmessage_id] = params[:groupmessage_id]\n #render plain: params[:body]\n @groupreply = Groupreply.new(mygroupreplay)\n\n\n @groupmessage = Groupmessage.find(mygroupreplay[:groupmessage_id])\n # @user = User.find(@groupmessage.user)\n data = Hash.new\n data[:body] = \"There is a comment on your Message \" + @groupmessage.title\n data[:url] = \"/groups/\" + mygroupreplay[:groupmessage_id].to_s\n data[:notificationtype] = \"groupmessagecomment\"\n data[:user_id] = @groupmessage.user.id\n notification = Notification.create(data)\n notification.save\n\n @replayies = @groupmessage.groupreplies\n\n respond_to do |format|\n if @groupreply.save\n\n @replayies.each do |currentreplay|\n data = Hash.new\n data[:body] = \"There is a comment on your Message \" + @groupmessage.title\n data[:url] = \"/groupmessages/\" + @groupmessage.id.to_s\n data[:notificationtype] = \"groupmessagecomment\"\n data[:user_id] = currentreplay.user.id\n notification = Notification.create(data)\n notification.save\n end\n\n\n\n format.html { redirect_to @groupreply, notice: 'Groupreply was successfully created.' }\n format.json { render :show, status: :created, location: @groupreply }\n else\n format.html { render :new }\n format.json { render json: @groupreply.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5e56fa7b532918f4b9d5523c96554d50", "score": "0.44633332", "text": "def describe(topic, *tags, &block)\n settings = {}\n settings[:parent] = @_group\n settings[:subject] = @_group.subject\n settings[:tags] = tags\n\n if Class === topic\n settings[:subject] = topic\n settings[:label] = topic.name\n else\n settings[:label] = topic\n end\n\n group = Context.new(settings, &block)\n\n @_group.specs << group\n\n return group\n end", "title": "" }, { "docid": "a53fc581ef43e62a2cf29beaa053b094", "score": "0.44606766", "text": "def createGroup _args\n \"createGroup _args;\" \n end", "title": "" }, { "docid": "00849c2d050c4e98b52d4c8b851706d1", "score": "0.44556168", "text": "def present_group(metric, group)\n occurences = group.size\n case(metric)\n when :reek\n \"found #{occurences} code smells\"\n when :roodi\n \"found #{occurences} design problems\"\n when :churn\n \"detected high level of churn (changed #{group[0].times_changed} times)\"\n when :flog\n complexity = get_mean(group.column(\"score\"))\n \"#{\"average \" if occurences > 1}complexity is %.1f\" % complexity\n when :saikuro\n complexity = get_mean(group.column(\"complexity\"))\n \"#{\"average \" if occurences > 1}complexity is %.1f\" % complexity\n when :flay\n \"found #{occurences} code duplications\"\n when :rcov\n average_code_uncoverage = get_mean(group.column(\"percentage_uncovered\"))\n \"#{\"average \" if occurences > 1}uncovered code is %.1f%\" % average_code_uncoverage\n else\n raise AnalysisError, \"Unknown metric #{metric}\"\n end\n end", "title": "" }, { "docid": "5401a6c38917ecffd8c1b13b919fb977", "score": "0.44553474", "text": "def show\n #p \"IN GROUP SHOW !!!!!\"\n @id = params[:id]\n #p @id\n @messages = Array.new\n response = RestClient.get 'https://gtcollab.herokuapp.com/api/group-messages/?group=' + @id , {authorization: $token}\n objArray = JSON.parse(response.body)\n p \" DAN!\"\n objArray['results'].each do |msg|\n message = Message.new\n message.content = msg['content']\n message.time = msg['timestamp']\n message.creator = msg['creator']['username']\n message.creator_id = msg['creator']['id']\n @messages << message\n end\n\n response = RestClient.get 'https://gtcollab.herokuapp.com/api/groups/' + @id , {authorization: $token}\n objArray = JSON.parse(response.body)\n p \"dd ||||||\"\n p objArray\n members = Array.new\n @group = Group.new\n @group.id = objArray[\"id\"]\n @group.name = objArray[\"name\"]\n @group.course_id = objArray[\"course\"] #id\n @group.creator_id = objArray[\"creator\"][\"id\"]\n @group.creator_username = objArray[\"creator\"][\"username\"]\n @group.creator_firstname = objArray[\"creator\"][\"first_name\"]\n @group.creator_lastname = objArray[\"creator\"][\"last_name\"]\n @group.creator_email = objArray[\"creator\"][\"email\"]\n \n objArray[\"members\"].each do |member|\n members << member\n end\n @group.members = members\n\n\n response = RestClient.get 'https://gtcollab.herokuapp.com/api/users/?courses_as_member=' + @group.course_id.to_s , {authorization: $token}\n objArray = JSON.parse(response.body)\n #p \"COUNTTT\"\n #p objArray[\"count\"]\n @count = objArray[\"count\"].to_s\n\n mem_list = Array.new\n\n p members\n objArray[\"results\"].each do |member|\n p member[\"id\"].to_i\n if members.include? member[\"id\"].to_i\n p member[\"id\"].to_i\n p \"is a memeber <-\"\n else\n p member[\"id\"].to_i\n p \"not a memeber <-\"\n mem_list << member\n end\n end\n @all_members = mem_list\n\n #hash = group.as_json\n #@mymeetings[hash[\"id\"]] = hash\n end", "title": "" }, { "docid": "6d1bc540de3717bc01fc7e7414712ff4", "score": "0.4455303", "text": "def generate_react_codegen_podspec!(spec, codegen_output_dir, file_manager: File)\n # This podspec file should only be create once in the session/pod install.\n # This happens when multiple targets are calling use_react_native!.\n if @@REACT_CODEGEN_PODSPEC_GENERATED\n Pod::UI.puts \"[Codegen] Skipping React-Codegen podspec generation.\"\n return\n end\n\n relative_installation_root = Pod::Config.instance.installation_root.relative_path_from(Pathname.pwd)\n output_dir = \"#{relative_installation_root}/#{codegen_output_dir}\"\n Pod::Executable.execute_command(\"mkdir\", [\"-p\", output_dir]);\n\n podspec_path = file_manager.join(output_dir, 'React-Codegen.podspec.json')\n Pod::UI.puts \"[Codegen] Generating #{podspec_path}\"\n\n file_manager.open(podspec_path, 'w') do |f|\n f.write(spec.to_json)\n f.fsync\n end\n\n @@REACT_CODEGEN_PODSPEC_GENERATED = true\n end", "title": "" }, { "docid": "b8fe0e284d9221427da188764b1ddc5a", "score": "0.44520268", "text": "def generate_codebook_time_series_group_option(group)\n cls = group.parent_id.present? ? 'subgroup' : 'group'\n content = 'data-content=\\'<span>' + group.title + '</span><span class=\"right-icons\">'\n desc = group.description.present? ? group.description : I18n.t('app.msgs.jumpto_group')\n if group.parent_id.present?\n content << subgroup_icon(desc)\n else\n content << group_icon(desc)\n end\n content << '</span>\\''\n\n return \"<option value='#{group.id}' class='#{cls}' #{content}>#{group.title}</option>\"\n end", "title": "" }, { "docid": "77694ff1cb457067014d1a3b916fa4d7", "score": "0.44509625", "text": "def peer_group\n fail NotImplementedError\n end", "title": "" }, { "docid": "226140271e7abd4ad28f701a4e87027d", "score": "0.4445063", "text": "def __mk_group(gdoc)\n @disp_dic.ext_grp unless @disp_dic.is_a? Disp::Grouping\n gatt = gdoc.to_h\n return if gatt[:enable] == 'false'\n sub = @disp_dic.add_grp(gatt.delete(:id), gatt.delete(:label))\n gdoc.each { |e| __mk_sub_db(e, sub, gatt.dup) }\n end", "title": "" }, { "docid": "8c89be9c769a61d850ad242dad64da27", "score": "0.44401425", "text": "def emit_meeting(cur_mtg_dir, svn_mtg_dir, dt, num_members, quorum_need, num_proxies, attend_irc)\n _div id: \"meeting-#{dt.year}\"\n _whimsy_panel(\"All Meeting Details for #{dt.strftime(DTFORMAT)}\", style: 'panel-info') do\n if Time.now > dt\n _p do\n _ 'At the time of this past meeting, we had:'\n _ul do\n _li \"#{num_members} eligible voting Members,\"\n _li \"#{quorum_need} needed for quorum (one third),\"\n _li \"#{num_proxies} proxy assignments available for the meeting,\"\n _li \"And hoped that at least #{attend_irc} would attend the start of meeting.\"\n end\n attendees_file = File.join(cur_mtg_dir, 'attend')\n if File.exist?(attendees_file)\n attendees = File.readlines(attendees_file)\n _ \"By the end of the meeting, we had a total of #{attendees.count} Members participating (either via attending IRC, sending a proxy, or voting via email)\"\n else\n _p.alert.alert_danger do\n _span \"Unable to calculate participating members (\"\n _code \"attend\"\n _span \"file does not yet exist for meeting)\"\n end\n end\n end\n _p \"These are historical links to the past meeting's record.\"\n else\n _p \"Live links to the upcoming meeting records/ballots/how-tos are below.\"\n end\n _ul do\n ASF::MeetingUtil::MEETING_FILES.each do |f, desc|\n _li do\n emit_link(svn_mtg_dir, f, desc)\n end\n end\n end\n end\nend", "title": "" }, { "docid": "4f574777edac4cfc8c6c158a07478ab1", "score": "0.44375917", "text": "def get_group(string); end", "title": "" }, { "docid": "f381ec5181b800ca3a60f305d0572131", "score": "0.44214982", "text": "def build_group_body\n render_table data, options.to_hash\n end", "title": "" }, { "docid": "246d1c47060d27da7ead0d4d42d7168a", "score": "0.44162676", "text": "def xgroup(subcommand, key, group, id_or_consumer = T.unsafe(nil), mkstream: T.unsafe(nil)); end", "title": "" }, { "docid": "0854e163a3694794ee7a3ee0bbd75fa0", "score": "0.44081247", "text": "def create_port_group\n Puppet.debug \"Entering Create Port Group method.\"\n @networksystem=host.configManager.networkSystem\n if (find_vswitch == false)\n raise Puppet::Error, \"Unable to find the vSwitch \" + resource[:vswitch]\n end\n hostnetworkpolicy = RbVmomi::VIM.HostNetworkPolicy()\n hostportgroupspec = RbVmomi::VIM.HostPortGroupSpec(:name => resource[:portgrp], :policy => hostnetworkpolicy, :vlanId => resource[:vlanid], :vswitchName => resource[:vswitch])\n @networksystem.AddPortGroup(:portgrp => hostportgroupspec)\n\n if (resource[:traffic_shaping_policy] !=nil )\n traffic_shaping\n end\n if (resource[:failback] !=nil )\n set_failback\n end\n if (resource[:overridefailoverorder] !=nil )\n setoverridepolicy\n end\n if (resource[:checkbeacon]!= nil)\n set_checkbeacon\n end\n if (resource[:portgrouptype] == :VMkernel)\n Puppet.debug \"Entering type VMkernel\"\n add_virtual_nic\n\n if (resource[:vmotion] !=nil )\n setupvmotion\n end\n\n if (resource[:mtu] !=nil )\n setupmtu\n end\n end\n Puppet.notice \"Successfully created a portgroup {\" + resource[:portgrp] + \"}\"\n end", "title": "" }, { "docid": "7cd75afde319289cc5848c3bcece2baa", "score": "0.44074944", "text": "def create_new_discussion_topic_groups(group_id,title,message,require_initial_post,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n :title,\n :message,\n :discussion_type,\n :published,\n :delayed_post_at,\n :lock_at,\n :podcast_enabled,\n :podcast_has_student_posts,\n :require_initial_post,\n :assignment,\n :is_announcement,\n :position_after,\n :group_category_id,\n \n ]\n\n # verify existence of params\n raise \"group_id is required\" if group_id.nil?\n raise \"title is required\" if title.nil?\n raise \"message is required\" if message.nil?\n raise \"require_initial_post is required\" if require_initial_post.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :group_id => group_id,\n :title => title,\n :message => message,\n :require_initial_post => require_initial_post\n )\n\n # resource path\n path = path_replace(\"/v1/groups/{group_id}/discussion_topics\",\n :group_id => group_id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:post, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:post, path, query_params, form_params, headers)\n page_params_store(:post, path)\n response\n \n end", "title": "" }, { "docid": "d743b94b1467b2ce5abbeeea019b7d2e", "score": "0.44064388", "text": "def group(options)\n check_secret\n Util.symbolize_keys! options\n group_id = options[:group_id].to_s\n user_id = options[:user_id].to_s\n traits = options[:traits] || {}\n timestamp = options[:timestamp] || Time.new\n context = options[:context] || {}\n\n fail ArgumentError, '.traits must be a hash' unless traits.is_a? Hash\n\n ensure_user group_id\n ensure_user user_id\n check_timestamp timestamp\n add_context context\n\n enqueue({\n :groupId => group_id,\n :userId => user_id,\n :traits => traits,\n :context => context,\n :timestamp => timestamp.iso8601,\n :action => 'group'\n })\n end", "title": "" }, { "docid": "42cf5bf0481ce397e9532836c0f89543", "score": "0.44034004", "text": "def create_study_group(params={})\n sg_name.set params['name']\n sg_oid.set params['oid']\n is_mccadmin_only.set(true) if params['is_mccadmin_only'].downcase.include?('true')\n\n # check if apps are specified\n if params['apps']\n # special case for Test App\n if params['apps'].include?(\"Test App-MCC\")\n select_test_app\n else\n select_apps(params['apps'])\n end\n end\n\n # check if courses are specified\n if params['courses']\n if params['courses'].include?(\"Test Sample Course\")\n test_course.set(true)\n else\n select_courses(params['courses'])\n end\n end\n save_button.click\n sleep 10 #Wait for role assignments\n end", "title": "" }, { "docid": "d6f1236e7528a17435cdd671052e6c66", "score": "0.43987754", "text": "def create_pop_group( name ) \n return \"Group #{name} already exists.\" if NodeGroup.find_by_name( name )\n \n unless File.exists?( SpkDashboard::DATA_PATH + \"/data_#{name}\" )\n return \"No params file found to create group #{name}. FILE: #{SpkDashboard::DATA_PATH + \"/data_#{name}\"}\"\n end\n \n params = self.read_group_params( name )\n \n nodegroup = NodeGroup.new(\n :name => name,\n :node_group_names => [ \"spk_base\" ],\n :parameter_attributes => params )\n \n if nodegroup.save \n return \"Successfully created group #{name}\"\n else\n return \"Failed to create group #{pop}\"\n end\n \n end", "title": "" }, { "docid": "127955ed1d0d16f89502f88dce7526eb", "score": "0.43947652", "text": "def create_pod(pod_spec, kubectl_options)\n sh = Shell.new\n new_pod_json = (sh.echo(pod_spec.to_json) | sh.system(\"kubectl #{kubectl_options} create -o json -f -\")).to_s\n\n new_pod = JSON.parse(new_pod_json)\n pod_name = new_pod[\"metadata\"][\"name\"]\n\n puts \"Created pod: #{pod_name}\"\n pod_name\nend", "title": "" }, { "docid": "19fc28c9f395c9711435aec8a8319cae", "score": "0.43924952", "text": "def build_messages\n proper_message_names.each do |message|\n klass = message.to_s.camelize\n attributes = attributes_for(:message, message)\n struct_attrs = struct_attributes_for(:message, message)\n defaults = defaults_for(:message, message)\n types = types_for(:message, message)\n\n self.module_eval <<-EOS, __FILE__, __LINE__ + 1\n class #{klass} < Struct.new('#{klass}'#{struct_attrs})\n def attributes() @@attributes = #{attributes.inspect} end\n def defaults() @@defaults = #{defaults.inspect} end\n\n def initialize\n super\n attributes.each do |attribute|\n send(\\\"\\#{attribute}=\", Bitcoin::Protocol.lookup(defaults[attribute]))\n end\n instance_eval(&block) if block_given?\n end\n\n # evaluated after initialization so it can reflect upon its own values\n def types() @@types = #{types.inspect} end\n\n def load(buf)\n attributes.each do |a|\n if BtcProto.proper_type_names & [types[a]]\n send(\"\\#{types[a]}=\", BtcProto.class_for(:type, types[a]).load(buf))\n else\n send(\"\\#{types[a]}=\", buf.send(\"read_\\#{types[a]}\"))\n end\n end\n end\n\n def dump(buf)\n attributes.each do |a|\n if BtcProto.proper_type_names.include?(types[a])\n send(a).dump(buf)\n else\n buf.send(\"write_\\#{types[a]}\", send(a))\n end\n end\n end\n end\n EOS\n\n self.messages[:classes].\n merge!(message => Bitcoin::Protocol.const_get(klass))\n end\n\n # add logic for marshalling i.e. load and dump\n # each type should be able to determine its size\n\n # associate class with names\n # new_item = { :class => command }\n # properties.assoc(message).push(new_item)\n end", "title": "" }, { "docid": "5616072fd1f57b0d1e8b228ae8b201af", "score": "0.43898287", "text": "def getGroupObjName\r\n\t\t return \"mfiforce__group__c\"\r\n\t\tend", "title": "" }, { "docid": "8ed398f74427a7f355834e0a3b6c60ec", "score": "0.43877143", "text": "def begin_group kind\n end", "title": "" }, { "docid": "f1bdf2637f98e0cae0e12017bb20c726", "score": "0.43834755", "text": "def yammer_groups\n return { \"1\" => \"rails\" } if Rails.env.test?\n Hash[current_user.yammer_client.get_all_groups.map { |g| [ g.id.to_s, g.name ] }]\n end", "title": "" }, { "docid": "e53aaa2577d9ddce04c32b64a9c3a4b0", "score": "0.4379355", "text": "def group(options)\n symbolize_keys! options\n check_user_id! options\n\n group_id = options[:group_id]\n user_id = options[:user_id]\n traits = options[:traits] || {}\n timestamp = options[:timestamp] || Time.new\n context = options[:context] || {}\n\n fail ArgumentError, '.traits must be a hash' unless traits.is_a? Hash\n\n check_presence! group_id, 'group_id'\n check_timestamp! timestamp\n add_context context\n\n enqueue({\n :groupId => group_id,\n :userId => user_id,\n :traits => traits,\n :integrations => options[:integrations],\n :context => context,\n :timestamp => datetime_in_iso8601(timestamp),\n :type => 'group'\n })\n end", "title": "" }, { "docid": "4ec6acbc9cd644a4c28b34931fec8b15", "score": "0.43669945", "text": "def cloud_desc\n MU::Cloud::AWS.iam(credentials: @config['credentials']).get_group(\n group_name: @mu_name\n )\n end", "title": "" }, { "docid": "b573da68fac449f9d8f4e33c9df7a94a", "score": "0.4343934", "text": "def to_yml\n groups = get_groups\n groups = Hash[Array.new(groups.size) { |index| [\"Group #{index + 1}\", groups[index]] }]\n YAML.dump(groups)\n end", "title": "" }, { "docid": "1f61c805c0947729bbc6dba7a49be743", "score": "0.43398258", "text": "def new\n # 1. Get Frame from Kafka (encoded in base64)\n frame_encoded = Kafka::GetAttendanceFrameService.new(topic_name).execute\n frame_encoded_base64 = 'data:image/jpeg;base64,' + frame_encoded\n # 2. Send Frame to Attendance MicroService along with group students\n group_students = @lecture_instance.group.students.pluck(:student_id)\n params = { image: frame_encoded, ids: group_students }\n results = Attendance::GetAttendanceService.new(params).execute\n\n face_boxes = JSON.parse(JSON.parse(results.body))['face_boxes']\n face_boxes.each do |face_box|\n face_box['boundaries'] = face_box['boundaries'].join(',')\n end\n\n # 3. Return Frame and the Returned Face Boxes\n render json: { image: frame_encoded_base64, face_boxes: face_boxes }, status: :ok\n end", "title": "" }, { "docid": "ed9309e5cb4f9d6a44b47ae073ea53cb", "score": "0.433476", "text": "def create\n @group_me_bot = GroupMeBot.new(group_me_bot_params)\n\n respond_to do |format|\n if @group_me_bot.save\n format.html { redirect_to @group_me_bot, notice: 'Group me bot was successfully created.' }\n format.json { render :show, status: :created, location: @group_me_bot }\n else\n format.html { render :new }\n format.json { render json: @group_me_bot.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e20dce66a5827078dd55dee1603b22d6", "score": "0.43332434", "text": "def createGroupPad(groupID, padName, text=nil)\n params = {:groupID => groupID, :padName => padName}\n params[:text] = text unless text.nil?\n call :createGroupPad, params\n end", "title": "" }, { "docid": "2dc3e13dbd2f73f012b5863b5f291765", "score": "0.43326044", "text": "def twilio_create_group(name,owner_name,members)\n client = twilio_auth!\n twilio_broadcast!(client,members,\"Welcome to #{name} an event created by #{owner_name}\")\n end", "title": "" }, { "docid": "e1575d0dbeec2bfff97bcf2a6eab47eb", "score": "0.43325695", "text": "def say(body, xmlproc=nil, &blk)\n msg = connection.message_stanza(:to => jid, :type => 'groupchat') do\n nodes = []\n nodes << x('body',body,&xmlproc)\n nodes << xmlproc.call if xmlproc\n nodes\n end\n connection.send_stanza msg, &blk\n end", "title": "" }, { "docid": "a4b74172a12bdba2143288421c66aa85", "score": "0.43292388", "text": "def get_channel_group request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_get_channel_group_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Analytics::Admin::V1alpha::ChannelGroup.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "title": "" }, { "docid": "6fe4e6885430bb587c75f184976eeb09", "score": "0.43276107", "text": "def group; end", "title": "" }, { "docid": "ca19d8d1d5892a7e01f9b87d2cda1577", "score": "0.43217662", "text": "def channel_create_format\n if private?\n {\n id: @id.to_s,\n is_private: true,\n recipient: @recipient.compact\n }\n else\n {\n guild_id: @server.id.to_s,\n id: @id.to_s,\n is_private: false,\n name: @name,\n permission_overwrites: permission_overwrites_format,\n position: @position,\n topic: @topic,\n type: @type,\n bitrate: @bitrate\n }\n end\n end", "title": "" }, { "docid": "3f9725cf3f417562afd20e7b9b0f1cba", "score": "0.43190685", "text": "def createGroupIndex(index, group_id)\n\tids = self.class.get(\".kibana/_search?size=1000000\", :body => { \"query\" => { \"match_all\" => {}}})['hits']['hits']\n ids.each do | source |\n\t if source['_id'].include? \"master\"\n\t\tsource['_id'] = source['_id'].sub('master:', \"#{group_id}\")\n\t\tdocument = source['_source']\n\t\tif source['_type'] != 'index-pattern'\t\t\n document['kibanaSavedObjectMeta']['searchSourceJSON'] = document['kibanaSavedObjectMeta']['searchSourceJSON'].sub('group-messages', \"group-messages-#{group_id}\")\n\t\tend\n\t\tif source['_type'].include? 'dashboard'\n\t\t document['title'] = group_id\n\t\t document['panelsJSON'] = document['panelsJSON'].gsub('master:', \"#{group_id}\")\n\t\tend\n\t\tresponse = self.class.put(\".kibana/#{source['_type']}/#{source['_id']}\", :body => document.to_json)\n\t end\n\tend\n self.class.put(index)\n\n # A 'mapping' of property values for our message data\n mapping = { \n 'message' => { \n 'properties' => { \n 'user' => { \n 'type' => 'string', \n 'index' => 'not_analyzed' \n },\n 'image' => {\n 'type' => 'string',\n 'index' => 'not_analyzed'\n },\n 'imagei_avatar' => {\n 'type' => 'string',\n 'index' => 'not_analyzed'\n },\n 'avatar_url' => {\n 'type' => 'string',\n 'index' => 'not_analyzed'\n },\n\t\t 'timestamp' => {\n \t\t'type' => 'date',\n \t\t'format' => 'dateOptionalTime'\n \t },\n } \n } \n }\n\n self.class.put(\"#{index}/_mapping/message\", :body => mapping.to_json)\n end", "title": "" }, { "docid": "9dac920a569c712cd7e876d027f7c0df", "score": "0.43167436", "text": "def groupreply_params\n params.require(:groupreply).permit(:body, :user_id, :groupmessage_id)\n end", "title": "" }, { "docid": "4ed75de1816767a3297d529107bea398", "score": "0.43121165", "text": "def pods\n groups.find { |g| g.name == 'Pods' }\n end", "title": "" }, { "docid": "a15ebb810db4b95a03d1819009ef02d7", "score": "0.430912", "text": "def create_group(user_id,device_token)\n @key_name_prefix=\"grupo_\"\n options = {\n :body =>{\"operation\": \"create\",\n \"notification_key_name\": @key_name_prefix+user_id.to_s,\n \"registration_ids\": [device_token]\n }.to_json,\n :headers => {'Content-Type'=> 'application/json',\n 'Authorization' => 'key = AAAAE0hYQbA:APA91bEdyT2IqQcv0xbWqGrbxaU2ty3KOmV2Fj7-w5-7rU3W03C6pU61WUEwyNSXFhRtq2LO68rljjM4YFYQOpWUNOsSZHulxPQVulQsMgMx5zstPEfvGj900Az_NinDBmXvDEoK7NlW ',\n 'project_id' => '82818122160'\n }\n }\n return results2 = HTTParty.post(\"https://android.googleapis.com/gcm/notification\",options)\n end", "title": "" }, { "docid": "b8cab56fbc335ec73bed9b1228652dc9", "score": "0.43065032", "text": "def group_component_print(group)\n sgc= \"<table>\"\n if(group.components.empty?)\n sgc+= \"<tr><td>No Components Available </td></tr>\"\n else\n for comp in group.components.sort {|x,y| x.name <=> y.name }\n sgc+= \"<tr><td>#{link_to comp.name, comp}</td></tr>\"\n end\n\n sgc+= \"</table>\"\n end\n return sgc\n end", "title": "" }, { "docid": "e74f5cd4115e4c49d919c146f86ba5d1", "score": "0.43064287", "text": "def generate_inventory_groups\n groups_of_groups = {}\n defined_groups = []\n group_vars = {}\n inventory_groups = \"\"\n\n # Verify if host range patterns exist and warn\n if config.groups.any? { |gm| gm.to_s[RANGE_PATTERN] }\n @machine.ui.warn(I18n.t(\"vagrant.provisioners.ansible.ansible_host_pattern_detected\"))\n end\n\n config.groups.each_pair do |gname, gmembers|\n if gname.is_a?(Symbol)\n gname = gname.to_s\n end\n\n if gmembers.is_a?(String)\n gmembers = gmembers.split(/\\s+/)\n elsif gmembers.is_a?(Hash)\n gmembers = gmembers.each.collect{ |k, v| \"#{k}=#{v}\" }\n elsif !gmembers.is_a?(Array)\n gmembers = []\n end\n\n if gname.end_with?(\":children\")\n groups_of_groups[gname] = gmembers\n defined_groups << gname.sub(/:children$/, '')\n elsif gname.end_with?(\":vars\")\n group_vars[gname] = gmembers\n else\n defined_groups << gname\n inventory_groups += \"\\n[#{gname}]\\n\"\n gmembers.each do |gm|\n # TODO : Expand and validate host range patterns\n # against @inventory_machines list before adding them\n # otherwise abort with an error message\n if gm[RANGE_PATTERN]\n inventory_groups += \"#{gm}\\n\"\n end\n inventory_groups += \"#{gm}\\n\" if @inventory_machines.include?(gm.to_sym)\n end\n end\n end\n\n defined_groups.uniq!\n groups_of_groups.each_pair do |gname, gmembers|\n inventory_groups += \"\\n[#{gname}]\\n\"\n gmembers.each do |gm|\n inventory_groups += \"#{gm}\\n\" if defined_groups.include?(gm)\n end\n end\n\n group_vars.each_pair do |gname, gmembers|\n if defined_groups.include?(gname.sub(/:vars$/, \"\")) || gname == \"all:vars\"\n inventory_groups += \"\\n[#{gname}]\\n\" + gmembers.join(\"\\n\") + \"\\n\"\n end\n end\n\n return inventory_groups\n end", "title": "" }, { "docid": "36ede43259afea1e5db4de6cb422164e", "score": "0.430545", "text": "def create_groups(people)\n number_people = people.length\n if number_people < 3\n group_quantity = 1\n else\n group_quantity = number_people / 3\n end\n group_number = 1\n groups_names = Hash.new(\"\")\n people.each do |name|\n if group_number <= group_quantity\n groups_names[group_number] += (name + \", \")\n group_number += 1\n else\n groups_names[1] += (name + \", \")\n group_number = 2\n end\n end\n groups_names.each do |group, name|\n print \"\\n\", \"Group \", group, \"\\n\"\n print name, \"\\n\"\n end\nend", "title": "" }, { "docid": "03b6f3b701a8f3109f0a0a78389c6d7d", "score": "0.42963526", "text": "def register_groupme_starter_for(bot)\n bot.define_singleton_method(:start_groupme_push!) do\n Peribot::GroupMe::Push.start! bot\n end\n end", "title": "" }, { "docid": "9e8982ff8097f76a12f3f32ddba6721f", "score": "0.42952377", "text": "def create_appointment_group(appointment_group__context_codes__,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n :appointment_group__context_codes__,\n :appointment_group__sub_context_codes__,\n :appointment_group__title__,\n :appointment_group__description__,\n :appointment_group__location_name__,\n :appointment_group__location_address__,\n :appointment_group__publish__,\n :appointment_group__participants_per_appointment__,\n :appointment_group__min_appointments_per_participant__,\n :appointment_group__max_appointments_per_participant__,\n :appointment_group__new_appointments_____x__,\n :appointment_group__participant_visibility__,\n \n ]\n\n # verify existence of params\n raise \"appointment_group__context_codes__ is required\" if appointment_group__context_codes__.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :appointment_group__context_codes__ => appointment_group__context_codes__\n )\n\n # resource path\n path = path_replace(\"/v1/appointment_groups\",\n )\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:post, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:post, path, query_params, form_params, headers)\n page_params_store(:post, path)\n response\n \n end", "title": "" }, { "docid": "3071738657b3979972926f199b494174", "score": "0.4290767", "text": "def constructMsg(cmd, nodeType)\n msgstr = String.new(@istr)\n @@cmdSeqNo = @@cmdSeqNo + 1\n seqstr = to_s_i(@@cmdSeqNo)\n msgstr[0] = seqstr[0]\n msgstr[1] = seqstr[1]\n msgstr[2] = seqstr[2]\n msgstr[3] = seqstr[3]\n t = Time.now\n timestr = to_s_i(t.to_i)\n msgstr[4] = timestr[0]\n msgstr[5] = timestr[1]\n msgstr[6] = timestr[2]\n msgstr[7] = timestr[3]\n msgstr[8] = CM_PACKET_FORMAT \n msgstr[9] = 0\n if (cmd == CM_CMD_IDENTIFY_NODE)\n msgstr[10] = CM_CMD_IDENTIFY_NODE\n msgstr[11] = 0\n else\n msgstr[10] = cmd\n msgstr[11] = 0\n end\n ipstr = to_s_i(CM_MYIP)\n msgstr = msgstr + ipstr \n msgstr = msgstr + (CMC_SOFTWARE_VERSION).to_s\n msgstr[18] = nodeType\n msgstr[19] = 0\n msgstr = msgstr + CM_CMSTATUS\n msgstr = msgstr + CM_MAC\n msgstr = msgstr + CM_MAC\n msgstr = msgstr + CM_MAC\n msgstr = msgstr + CM_MAC\n \n return msgstr \n end", "title": "" }, { "docid": "4e8063635ef8d2b1d6209d2343e8297e", "score": "0.42892292", "text": "def build_activity_group group\n return {\n :time => group.max{ |a| a.created_at.to_i }.created_at,\n :type => group.first.trackable_type,\n :activities => group,\n :user_id => group.first.user.id,\n :profile_image => group.first.user.user_fb_data.profile_image,\n :class => group.first.trackable.class.name.downcase\n }\n end", "title": "" }, { "docid": "936b12d2d0a8a258e0c69761a70c03e0", "score": "0.42775768", "text": "def generate_messages(metric_desc, comparison, mon_type)\n if mon_type == 'service check'\n message = [\n \"{{#is_alert}}'#{metric_desc}' is FAILING: {{check_message}}\",\n \"{{/is_alert}}\\n\",\n \"{{#is_warning}}'#{metric_desc}' is WARNING: {{check_message}}\",\n \"{{/is_warning}}\\n\",\n \"{{#is_recovery}}'#{metric_desc}' recovered: {{check_message}}\",\n \"{{/is_recovery}}\\n\",\n \"{{#is_no_data}}'#{metric_desc}' is not reporting data\",\n \"{{/is_no_data}}\\n\",\n # repo path and notify to\n '(monitor and threshold configuration for this alert is managed by ',\n \"#{@repo_path}) #{@notify_to}\"\n ].join('')\n escalation = \"'#{metric_desc}' is still in error state: \" \\\n '{{check_message}}'\n return [message, escalation]\n end\n message = [\n \"{{#is_alert}}'#{metric_desc}' should be #{comparison} {{threshold}}, \",\n \"but is {{value}}.{{/is_alert}}\\n\",\n \"{{#is_recovery}}'#{metric_desc}' recovered (current value {{value}} \",\n \"is #{comparison} threshold of {{threshold}}).{{/is_recovery}}\\n\",\n '(monitor and threshold configuration for this alert is managed by ',\n \"#{@repo_path}) #{@notify_to}\"\n ].join('')\n escalation = \"'#{metric_desc}' is still in error state (current value \" \\\n \"{{value}} is #{comparison} threshold of {{threshold}})\"\n [message, escalation]\n end", "title": "" }, { "docid": "ac7dd9e4fd6edbf0063d7738e7539290", "score": "0.42715502", "text": "def group_create(element)\n name = element[\"group\"]\n auth = element[\"auth\"]\n body = {\n \"jsonrpc\" => \"2.0\",\n \"method\" => \"hostgroup.create\",\n \"params\" => {\n \"name\" => name\n },\n \"auth\" => auth,\n \"id\" => rand(9999)\n }\n result = json_body(body)\n # puts result\n result = result[\"groupids\"]\n result = result[0]\n # puts result\n # return will be group id\n return result\nend", "title": "" }, { "docid": "7347249c0c84cd1f5e11addc806b5537", "score": "0.4268153", "text": "def group(newsgroup)\n ask(\"GROUP #{newsgroup}\")\n if response.code == 211\n # 1371680046 371770795 1743450840 alt.binaries.cores\n total_messages, first_message, last_message, name = response.message.split(\" \")\n [total_messages.to_i, first_message.to_i, last_message.to_i, name]\n else\n false\n end\n end", "title": "" }, { "docid": "c93a34ac422f04847fa4011cb390609b", "score": "0.42673376", "text": "def optional_meeting_tags\n [\n {\n key: \"MeetingType\",\n value: \"PrivateRoom\"\n },\n {\n key: \"RoomId\",\n value: @room.id.to_s\n }\n ]\n end", "title": "" } ]
b2135831ec0e164206cafd655e483de4
GET /groups/1 GET /groups/1.json
[ { "docid": "0dac5fdb6ba7f930cbcce51b533ab18a", "score": "0.0", "text": "def show\n unless @group.users.include?(current_user)\n respond_to do |format|\n format.html { redirect_to root_url }\n end\n end\n\n @messages = @group.messages.paginate(page: params[:page], per_page:5)\n @messages = @messages.to_a\n @messages.sort! {|left, right| right.created_at <=> left.created_at}\n end", "title": "" } ]
[ { "docid": "7761dcbf8079fbe8d9838f059e843811", "score": "0.80164665", "text": "def groups\n @page = 'groups'\n respond_to do |format|\n format.html {\n @groups = Group.find(:all)\n }\n format.json { }\n end\n end", "title": "" }, { "docid": "1f843b01e13360c0143c4faaad1f177d", "score": "0.79828614", "text": "def index\n @groups = Api::V1::Group.all\n\n render json: @groups\n end", "title": "" }, { "docid": "584fc326af7b12a5bf2447061dd516c0", "score": "0.79209113", "text": "def group(id)\n get \"/groups/#{id}\"\n end", "title": "" }, { "docid": "40158a306d172d148ad8c9b38846e2eb", "score": "0.7887537", "text": "def retrieve_groups()\n start.uri('/api/group')\n .get()\n .go()\n end", "title": "" }, { "docid": "c449413110964807364c22a01ac02ab9", "score": "0.7877493", "text": "def retrieve_groups()\n start.uri('/api/group')\n .get()\n .go()\n end", "title": "" }, { "docid": "565c46751df83f2984590f468f460593", "score": "0.7843047", "text": "def index\n @group = Group.find(params[:group_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @group }\n end\n end", "title": "" }, { "docid": "9ec278d946a4a08d671dbb866559feaa", "score": "0.7829059", "text": "def get_groups\n endpoint = '/groups'\n url = self.base_url.to_s + endpoint.to_s + self.format.to_s\n self.get_data(url)\n end", "title": "" }, { "docid": "306c4584b3957f7accbc7faeb089089d", "score": "0.77199566", "text": "def group(id)\n get(\"/groups/#{id}\")\n end", "title": "" }, { "docid": "e90f32f61ab988fe5ac5d1c17a4b68a0", "score": "0.7667589", "text": "def index\n @groups = Group.where(:user_id => user_id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end", "title": "" }, { "docid": "0171df9d90002a604a4b1dc9e4463921", "score": "0.7601177", "text": "def index\n @groups = Group.all.collect {|g| g.to_hash}\n render json: {groups: @groups}, status: :ok\n end", "title": "" }, { "docid": "f268ddd0025756e06d29808fa898b979", "score": "0.7600092", "text": "def index\n response = { groups: Group.all }\n respond_to do |format|\n format.json { render json: response.to_json }\n format.html { render :index }\n end\n end", "title": "" }, { "docid": "dd9497cf4e250bf9cbab308299020c00", "score": "0.7585301", "text": "def group\n @group = Idol.where(group: params[:group])\n render \"group.json.jb\"\n end", "title": "" }, { "docid": "1a5f7fab306778442c6ee64d3651b209", "score": "0.7553582", "text": "def show\n @group = Group.find_by_id(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end", "title": "" }, { "docid": "c8d6f3dd15a254c9d4be1c2f497081bb", "score": "0.7552985", "text": "def index\n @groups = Group.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end", "title": "" }, { "docid": "c8d6f3dd15a254c9d4be1c2f497081bb", "score": "0.7552985", "text": "def index\n @groups = Group.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end", "title": "" }, { "docid": "c8d6f3dd15a254c9d4be1c2f497081bb", "score": "0.7552985", "text": "def index\n @groups = Group.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end", "title": "" }, { "docid": "c8d6f3dd15a254c9d4be1c2f497081bb", "score": "0.7552985", "text": "def index\n @groups = Group.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end", "title": "" }, { "docid": "c8d6f3dd15a254c9d4be1c2f497081bb", "score": "0.7552985", "text": "def index\n @groups = Group.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end", "title": "" }, { "docid": "c8d6f3dd15a254c9d4be1c2f497081bb", "score": "0.7552985", "text": "def index\n @groups = Group.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end", "title": "" }, { "docid": "c8d6f3dd15a254c9d4be1c2f497081bb", "score": "0.7552985", "text": "def index\n @groups = Group.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end", "title": "" }, { "docid": "f7561ae9f31c23495c90889c982f9929", "score": "0.7523467", "text": "def index\r\n @groups = current_user.groups\r\n\r\n render json: @groups\r\n end", "title": "" }, { "docid": "e747cdcab4d0ab62707ca84a905da6e2", "score": "0.7511399", "text": "def groups opts = {}\n get :group, opts\n end", "title": "" }, { "docid": "cb796a9ba6022118208208e4edc3afb1", "score": "0.75026834", "text": "def user_groups\n # render json: User.groups(params[:uid])\n render json: []\n end", "title": "" }, { "docid": "1eda92470b836d76ec11843452fdc0da", "score": "0.7499815", "text": "def show\n @group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end", "title": "" }, { "docid": "1eda92470b836d76ec11843452fdc0da", "score": "0.7499815", "text": "def show\n @group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end", "title": "" }, { "docid": "1eda92470b836d76ec11843452fdc0da", "score": "0.7499815", "text": "def show\n @group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end", "title": "" }, { "docid": "1eda92470b836d76ec11843452fdc0da", "score": "0.7499815", "text": "def show\n @group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end", "title": "" }, { "docid": "1eda92470b836d76ec11843452fdc0da", "score": "0.7499815", "text": "def show\n @group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end", "title": "" }, { "docid": "1eda92470b836d76ec11843452fdc0da", "score": "0.7499815", "text": "def show\n @group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end", "title": "" }, { "docid": "1eda92470b836d76ec11843452fdc0da", "score": "0.7499815", "text": "def show\n @group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end", "title": "" }, { "docid": "1eda92470b836d76ec11843452fdc0da", "score": "0.7499815", "text": "def show\n @group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end", "title": "" }, { "docid": "1eda92470b836d76ec11843452fdc0da", "score": "0.7499815", "text": "def show\n @group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end", "title": "" }, { "docid": "1eda92470b836d76ec11843452fdc0da", "score": "0.7499815", "text": "def show\n @group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end", "title": "" }, { "docid": "1eda92470b836d76ec11843452fdc0da", "score": "0.7499815", "text": "def show\n @group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end", "title": "" }, { "docid": "1eda92470b836d76ec11843452fdc0da", "score": "0.7499815", "text": "def show\n @group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end", "title": "" }, { "docid": "1eda92470b836d76ec11843452fdc0da", "score": "0.7499545", "text": "def show\n @group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end", "title": "" }, { "docid": "97eb5aac4539525f84b93b2d8e97ccab", "score": "0.74931073", "text": "def groups\n\n\t\tif params[:id]\n\n\t\t\trender :json => User.find(params[:id]).groups\n\n\t\telse\n\n\t\t\trender :json => current_user.groups\n\n\t\tend\n\n\tend", "title": "" }, { "docid": "329f092a604fbdd70eb4214bf080deb3", "score": "0.7460678", "text": "def viewgroup\n groups = current_user.groups\n render :json => groups.to_json(:include => [:users => {:except => [:created_at, :updated_at, \n\t\t\t:password_digest, :remember_token]}]), :status => 200\n end", "title": "" }, { "docid": "2405ca278c01aca4c07be4a06aaae6af", "score": "0.7457904", "text": "def get_groups\n self.class.get(\"#{@url}/rest/user-management/groups\", basic_auth: @auth)\n end", "title": "" }, { "docid": "697916271b640c978c6d1c1106f79b09", "score": "0.745118", "text": "def show\n @group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @group }\n end\n end", "title": "" }, { "docid": "84c20bb6b706a631749a76cb5c3742f5", "score": "0.7435317", "text": "def get_groups\n @course = Course.find(params[:course_id])\n\n render json: @course.groups\n end", "title": "" }, { "docid": "e3e36cd3bc023f9fd96c5164b7d59529", "score": "0.742811", "text": "def user_groups\n # render :json => User.groups(params[:uid])\n render :json => [] \n end", "title": "" }, { "docid": "d34fe9ed23657b13b793a4f61b62c618", "score": "0.7425449", "text": "def show\n render json: @group\n end", "title": "" }, { "docid": "d34fe9ed23657b13b793a4f61b62c618", "score": "0.7425449", "text": "def show\n render json: @group\n end", "title": "" }, { "docid": "a850c3ac80e9cb2261c6fe37f95cca0e", "score": "0.7420368", "text": "def index\n @api_v1_groups = Api::V1::Group.all\n end", "title": "" }, { "docid": "b7d9f9ec172e0dc11641fca1f2e3f61d", "score": "0.7394589", "text": "def index\n\t\tputs \"returning all groups belonging to user\"\n\t\t@user = User.find_by(id: session[:user_id])\n\t\tgroups = []\n\t\t@user.user_groups.collect { |a| groups.push(a.group) }\n\n\t\trespond_to do |format|\n\t\t\tformat.json { render :json => groups}\n\t\tend\n\tend", "title": "" }, { "docid": "11ec43838c0baedb633234c226d224b1", "score": "0.73944086", "text": "def index\n #@groups = Group.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end", "title": "" }, { "docid": "fd388205e7ff3fad4ce10ec6e70ff289", "score": "0.73830974", "text": "def show\n @group = Group.find(params[:id])\n\n respond_to do |format|\n #format.json { render json: @group }\n format.json { render_for_api :group, :json => @group }\n end\n end", "title": "" }, { "docid": "dafebb13de67b8973ad2320263e86ec9", "score": "0.7377826", "text": "def index\n render json: Group.all\n end", "title": "" }, { "docid": "e04e6097dbbcedb4b6c02414820b038a", "score": "0.7376012", "text": "def show\n @usergroup = Usergroup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @usergroup }\n end\n end", "title": "" }, { "docid": "3869be431a756eeb7818ecb326d3f4ce", "score": "0.73636216", "text": "def show\n @group = Group.find_key params[:id]\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @group }\n end\n end", "title": "" }, { "docid": "75b14edd2d4a84b67adc6a027a905420", "score": "0.7355441", "text": "def get_groups\n\t\trespond_to do |format|\n if params[:user_id]\n \tuser = User.find(params[:user_id])\n groups = user.groups\n format.json { render :json => groups }\n else\n render :json => \"filtros incompletos\", :status => :unprocessable_entity\n end\n end\t\n end", "title": "" }, { "docid": "23c5edafc94d86bdc37725209b7042a8", "score": "0.7351826", "text": "def index\n @groups = Group.all\n render_json_serializer(@groups)\n end", "title": "" }, { "docid": "a3d5a59020c75fbf14ad9150e599fe50", "score": "0.734785", "text": "def show\n @group = current_user.teached_groups.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end", "title": "" }, { "docid": "a50e37263919d938ced3090e9a987146", "score": "0.734268", "text": "def groups\n result = get(\"groups\")\n end", "title": "" }, { "docid": "df7083fcd90b75347942aaa185d57913", "score": "0.733786", "text": "def index\n @groups = Group.all\n\n respond_to do |format|\n format.html # index.html.erb\n# format.json { render json: @groups }\n end\n end", "title": "" }, { "docid": "86df0ddf701de956a5cf3a1776c4690a", "score": "0.7332182", "text": "def show\n @user_group = UserGroup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_group }\n end\n end", "title": "" }, { "docid": "ef7681884a04aa74a6d8389fd0959d52", "score": "0.73231995", "text": "def index\n @groups = Group.all\n render json: @groups, status: 403\n end", "title": "" }, { "docid": "c334c161590f9d02b5001fe9810e450d", "score": "0.7318752", "text": "def show\n if @group\n render json: representer(@group).to_json\n else\n render status: 404, json: { errors: 'group not found' }\n end\n end", "title": "" }, { "docid": "04a2d0a1e6d41531262f027b7ea7aa88", "score": "0.73185384", "text": "def index\n\t\t@groups = Group.all\n\t\trender json: @groups\n\t end", "title": "" }, { "docid": "0c033c6eef8638f14494fb42dafb78e6", "score": "0.73099446", "text": "def groups_list\n request method: :get,\n url: @base_url + 'components/groups'\n end", "title": "" }, { "docid": "2651a4e06c31451948f2524f75403bd8", "score": "0.73047745", "text": "def show\n\t begin\n @group = Group.find(params[:id])\n\t rescue Exception => e\n\t\t redirect_to root_path, alert: \"This group does not exist.\"\n\t\t return\n\t\tend\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end", "title": "" }, { "docid": "683a772c1f28a9d15ad0c93ec704bbb6", "score": "0.7304429", "text": "def show\n @group_id = params[:id]\n @group_response = HTTParty.get(\"https://rails-api-ipo.herokuapp.com/api/v1/groups/#{@group_id}.json\")\n @group = {}\n @users =[]\n @group['id']=(@group_response['id'])\n @group['group_name']=(@group_response['group_name'])\n @group['group_permissions']=(@group_response['group_permissions'])\n @group['company_id']=(@group_response['company_id'])\n @users = @group_response['users']\n end", "title": "" }, { "docid": "dedb6fa98a83f2a2450a0fc1e8de452e", "score": "0.72892016", "text": "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end", "title": "" }, { "docid": "2ea51c10649f43cc1dd4d335a9a7f76c", "score": "0.72876155", "text": "def index\n @groups = group_scope\n\n respond_to do |format|\n format.json { render json: @groups }\n end\n end", "title": "" }, { "docid": "9d74d1faf9defe08a0c08b1461236fba", "score": "0.72784853", "text": "def viewgroup\n groups = current_user.groups\n render :json => groups.to_json(:include => {\n :users => {:except => [:created_at, :updated_at, :password_digest, :remember_token]},\n :pending_users => {:except => [:created_at, :updated_at,:password_digest, :remember_token]\n }}), :status => 200\n end", "title": "" }, { "docid": "d6cd00f1ca7e9d9a520fb11a4c78d611", "score": "0.7269102", "text": "def show\n #@group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end", "title": "" }, { "docid": "17b7cc4605ed80431d0c691816f84f19", "score": "0.7247665", "text": "def get_group(group_id)\n request :get,\n \"/v3/team/groups/#{group_id}.json\"\n end", "title": "" }, { "docid": "9d1320eed64d15deb86eb9c3ef5ac222", "score": "0.7242651", "text": "def call\n res = client.get('/api/rest/v1/groups.json')\n\n res.map { |i| BrickFTP::Types::Group.new(**i.symbolize_keys) }\n end", "title": "" }, { "docid": "55a3f3bb2e6ac7a072c7bdd91a3209e2", "score": "0.7230154", "text": "def get_group_by_id(id)\n endpoint = '/groups'\n url = self.base_url.to_s + endpoint.to_s + \"/\" + id.to_s + self.format.to_s\n response = self.get_data(url)\n end", "title": "" }, { "docid": "0a6ea808a4b132046d558304d72a9d79", "score": "0.72246474", "text": "def get_user_groups\n path = self.api_root + \"/api/groups\"\n process_firecloud_request(:get, path)\n end", "title": "" }, { "docid": "2edcc132cc26565e66d568460cead4f6", "score": "0.7218367", "text": "def index\n @groups = Group.roots\n if request.format.html?\n if Setting.default_group\n find_group\n return show\n end\n end\n respond_with groups\n end", "title": "" }, { "docid": "199032fc3145e411e563ae50f99e1041", "score": "0.72078586", "text": "def index\n url = @httpIp + '/pet.com/api/group/getAllGroups'\n uri = URI(url)\n response = Net::HTTP.get(uri)\n # @groups = JSON.parse(response, object_class: OpenStruct)\n @groups = Kaminari.paginate_array(JSON.parse(response, object_class: OpenStruct)).page(params[:page]).per(7)\n end", "title": "" }, { "docid": "aad9a3cb5d5cb07ec64f619772d07294", "score": "0.7196193", "text": "def get_group\n send_request(FUNCTION_GET_GROUP, [], '', 4, 'k4')\n end", "title": "" }, { "docid": "712ae4bb4001c50c46797339a3097f5c", "score": "0.7187624", "text": "def index\n @groups = Group.paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end", "title": "" }, { "docid": "b1351d7de4cd32c59a1e587f7876dc89", "score": "0.7178501", "text": "def index\n # @groups = Group.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: Oj.dump(@groups, mode: :compat) }\n end\n end", "title": "" }, { "docid": "acadc79491e669d157eddf6824d4d5a6", "score": "0.7169633", "text": "def retrieve_group(group_id)\n start.uri('/api/group')\n .url_segment(group_id)\n .get()\n .go()\n end", "title": "" }, { "docid": "cb31f2a64a65ceb280360f9a3f4cdce8", "score": "0.7168109", "text": "def show\n render :json => @group.to_json({})\n end", "title": "" }, { "docid": "fbca079e1c60c6e3dd116443a2afb6af", "score": "0.71674263", "text": "def show\n @grp = Grp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @grp }\n end\n end", "title": "" }, { "docid": "bc64b66f2a8cb2e46b8d0b2c1961bbf6", "score": "0.7149959", "text": "def show\n\t\t@user_group = UserGroup.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @user_group }\n\t\tend\n\tend", "title": "" }, { "docid": "98ff2a0b2e2e6b2cea85f71b05d67bd3", "score": "0.7139783", "text": "def index\n @groups = Group\n authorize!(:index, Group)\n apply_scopes_and_pagination\n\n respond_to do |format|\n format.html # index.html.erb\n # format.json { render json: @groups }\n end\n end", "title": "" }, { "docid": "479f642124110bcc4d18bb3a20b9bbe3", "score": "0.71305335", "text": "def show\n\t\t@user = User.find(params[:user_id])\n @group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end", "title": "" }, { "docid": "fc6e83fdfe860f796ee8385afd0822a8", "score": "0.7128541", "text": "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end", "title": "" }, { "docid": "89e6c1811d237ad9750b03ec0075ed87", "score": "0.7114793", "text": "def retrieve_group(group_id)\n start.uri('/api/group')\n .url_segment(group_id)\n .get()\n .go()\n end", "title": "" }, { "docid": "41c598ca8a062bbfbbad8217af83a891", "score": "0.7112366", "text": "def show\n @group = Group.find(params[:id]) || ( not_found and return )\n authorize! :read, @group\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @group }\n end\n end", "title": "" }, { "docid": "609c637c518264c28df66ee4e81c0745", "score": "0.71048427", "text": "def show\n @groups = admin_groups(@groups)\n @groups_user = GroupsUser.where(:group_id => @groups).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @groups_user }\n end\n end", "title": "" }, { "docid": "53ddfc65a3ed915a3d75442e152a5e7d", "score": "0.7104722", "text": "def show\n @agroup = Agroup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @agroup }\n end\n end", "title": "" }, { "docid": "37b5db737bc84a7027f20c1c4f9829e2", "score": "0.7097408", "text": "def index\n @groups = Group.all\n\n respond_with(@groups)\n end", "title": "" }, { "docid": "c7b6bada37148f5b8bb7d7d6067e0e81", "score": "0.7092984", "text": "def group(id, options = {})\n get(\"/groups/#{url_encode id}\", query: options)\n end", "title": "" }, { "docid": "43ad591c88f42419f98c6967f0464f29", "score": "0.7092358", "text": "def index\n if (params[:query])\n @group = Group.find_by(group_name: params[:query])\n if @group\n render json: @group\n else\n respond_to do |format|\n format.json { render json: { errors: \"No Groups found\" }, status: :unprocessable_entity }\n end\n end\n elsif (params[:user_id])\n @groups = User.find(params[:user_id]).groups\n render json: @groups.limit(20).as_json(only: [:id, :title])\n else\n @groups = Group.all.where(instructor_id: params[:instructor_id])\n render json: @groups.limit(20).as_json(only: [:id, :title])\n end\n end", "title": "" }, { "docid": "b548d4d02ece6fd0b6a47b6ce9d8babd", "score": "0.7074031", "text": "def show\n\t\t@group = Group.find_by(id: params[:id])\n\t\tusers = []\n\t\t@group.user_groups.collect { |a| users.push(a.user) }\n\n\t\trespond_to do |format|\n\t\t\tformat.json { render :json => users}\n\t\tend\n\tend", "title": "" }, { "docid": "df45710b26241b16d83a0b960d9d5744", "score": "0.70738596", "text": "def show\n render json: @group_member\n end", "title": "" }, { "docid": "c0abca3be528ae58c008a2ee9b0375b3", "score": "0.7069958", "text": "def groups\n Log.add_info(request, '') # Not to show passwords.\n\n ary = []\n groups = Group.where(nil).to_a\n unless groups.nil?\n groups_cache = {}\n group_obj_cache = Group.build_cache(groups)\n groups.each do |group|\n ary << group.id.to_s + ':' + Group.get_path(group.id, groups_cache, group_obj_cache)\n end\n end\n\n render(:text => ary.join(\"\\n\"))\n end", "title": "" }, { "docid": "53a6d2d72073b1b6d5f27b551d9b9512", "score": "0.70567244", "text": "def index\n if @current_user.isAdmin?\n @groups = Group.all\n else\n @groups = @current_user.groups\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end", "title": "" }, { "docid": "17fb5c15096571769c0a2da471f0fcf7", "score": "0.7049496", "text": "def show\n @groups_user = GroupsUser.where(:group_id => @groups).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @groups_user }\n end\n end", "title": "" }, { "docid": "ecf1359ff237b90f1d3fe71ef187f418", "score": "0.70380515", "text": "def index\n group_ids = current_user.memberships.collect{|g| g.group_id}\n @user = User.find(current_user)\n @groups = Group.all\n @my_groups = Group.where(:id => group_ids )\n \n \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end", "title": "" }, { "docid": "9cc3ec7e938c88e28715d0409b1fc2df", "score": "0.7037601", "text": "def show\n @game_group = GameGroup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game_group }\n end\n end", "title": "" }, { "docid": "d5cd770182a6ae4cf69a79822f3b2e3d", "score": "0.7037439", "text": "def index\n @groups = Group.all.page params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end", "title": "" }, { "docid": "566828c690e6a6d5432af47dd6e380ce", "score": "0.7031737", "text": "def index\n @groups = Group.all\n\n respond_to do |format|\n format.html\n end\n end", "title": "" }, { "docid": "6e2b6765c8738c85c07ff9337a3d4393", "score": "0.703002", "text": "def show\n @groupuser = Groupuser.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @groupuser }\n end\n end", "title": "" }, { "docid": "5a7079657654162e1f9e0b6c37d7f332", "score": "0.7028017", "text": "def show\n render json: @group.as_json(params: params, list_users: true)\n end", "title": "" } ]
677c35597228ede7bf55d5489334fca8
GET /nota_fiscais/1 GET /nota_fiscais/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "7ea7510aa05da425868e3a57dcc57290", "score": "0.6811436", "text": "def show\n @filo = Filo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @filo }\n end\n end", "title": "" }, { "docid": "e11e7a0a54783f313bb5509a48ef4a35", "score": "0.67856383", "text": "def show\n @filiale = Filiale.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @filiale }\n end\n end", "title": "" }, { "docid": "d19904f66ad8857f3be0148a3d8b80ca", "score": "0.67130536", "text": "def show\n @voluntario_pessoa_fisica = VoluntarioPessoaFisica.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @voluntario_pessoa_fisica }\n end\n end", "title": "" }, { "docid": "d8594fbe597973afc90a416d3a68f7ea", "score": "0.661026", "text": "def show\n @filial = Filial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @filial }\n end\n end", "title": "" }, { "docid": "84b9c670445fa61d99bd892b674959b5", "score": "0.65977144", "text": "def get\n response = ApiPago.get_factura(params[:id_factura])\n render json: response\n end", "title": "" }, { "docid": "da40353778f0cb24dc8e7c486547b0c5", "score": "0.6593276", "text": "def show\n @fatura = Fatura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fatura }\n end\n end", "title": "" }, { "docid": "846f69f67be4bb7488c17dc72ba64abe", "score": "0.658053", "text": "def show\n @faixa = Faixa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @faixa }\n end\n end", "title": "" }, { "docid": "733f665d7cdddb335329100f37d74e1f", "score": "0.65695214", "text": "def index\n @fornecedores = Fornecedor.page(params[:page]).per(NUMERO_POR_PAGINA)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fornecedores }\n end\n end", "title": "" }, { "docid": "aa840e9cb888d28bbc71103740810b20", "score": "0.65436417", "text": "def index\n @filmes = Filme.where(ativo: true, usuario_id: current_usuario.id)\n \trender json: @filmes.map(&:encode)\n end", "title": "" }, { "docid": "76fae392847ff2f1aa59ca2adfb00071", "score": "0.65344155", "text": "def index\n @filials = Filial.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @filials }\n end\n end", "title": "" }, { "docid": "352fff3340497c2292af9516820822d3", "score": "0.6527286", "text": "def show\n @frit = Frit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @frit }\n end\n end", "title": "" }, { "docid": "cb62f95c7965d1944ec6cd77238d8209", "score": "0.6517435", "text": "def show\n @noticia = Noticia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @noticia }\n end\n end", "title": "" }, { "docid": "843d58988034007baf9824c6e623dbcb", "score": "0.6513836", "text": "def index\n @feriados = Feriado.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @feriados }\n end\n end", "title": "" }, { "docid": "739be130054f02456a79f58fef1b8e6e", "score": "0.6474747", "text": "def show\n @feriado = Feriado.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feriado }\n end\n end", "title": "" }, { "docid": "cd4093237922c393c92933e97a31046b", "score": "0.645547", "text": "def index\n @nota_fiscais = NotaFiscal.all\n end", "title": "" }, { "docid": "f34f5ac022ee555807032455cc638a38", "score": "0.6452371", "text": "def show\n @oficio = Oficio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @oficio }\n end\n end", "title": "" }, { "docid": "021428551ff138cc69d2cbe0c5a655ad", "score": "0.64405066", "text": "def show\n @filme = Filme.joins(:formato).select(\"formatos.descricao\").select(:titulo, :duracao, :ano, :foto_data, :id).find(params[:id]) \n response = @filme.as_json\n response[:foto_url] = @filme.foto_url\n render json: response\n end", "title": "" }, { "docid": "33aefb0e852e40856a65c7a6389e8fe1", "score": "0.64395636", "text": "def show\n if @noticia\n h = {id: @noticia.id,\n title: @noticia.titular,\n subtitle: @noticia.bajada, \n body: @noticia.cuerpo,\n created_at: @noticia.created_at\n }\n render json: h, status: :ok\n else\n render status: :not_found\n end\n\n end", "title": "" }, { "docid": "497a9308fc758034af6386feff7620b8", "score": "0.64245147", "text": "def show\n @falla = Falla.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @falla }\n end\n end", "title": "" }, { "docid": "499bd4f61092aefc3b74e711d40d8704", "score": "0.64187974", "text": "def show\n @factura = Factura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @factura }\n end\n end", "title": "" }, { "docid": "499bd4f61092aefc3b74e711d40d8704", "score": "0.64187974", "text": "def show\n @factura = Factura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @factura }\n end\n end", "title": "" }, { "docid": "6d9e971c2f5cad5391ef49030bb3e00c", "score": "0.63991195", "text": "def show\n @non_iti = NonIti.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @non_iti }\n end\n end", "title": "" }, { "docid": "521f36bc78527de18afcfe85fbd86820", "score": "0.6393479", "text": "def show\n @notificacao = Notificacao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @notificacao }\n end\n end", "title": "" }, { "docid": "0c9b1c586ac5ff97c0b2bf3de863ebe7", "score": "0.6373689", "text": "def show\n @folha_ciclo = FolhaCiclo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @folha_ciclo }\n end\n end", "title": "" }, { "docid": "16dea3f23d9c7866fdadc18b2c15716e", "score": "0.63712573", "text": "def show\n\tadd_breadcrumb \"Mostrar noticia\", :noticias_path\n @noticia = Noticia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @noticia }\n end\n end", "title": "" }, { "docid": "e00d54ba7ae5c2ac5b5896c006b9c2ae", "score": "0.6353547", "text": "def show\n @faktura = Faktura.find(params[:id])\n\n render json: @faktura\n end", "title": "" }, { "docid": "ed375191250c7ede407cb6056fe0d09f", "score": "0.6340686", "text": "def show\n @pelicula = Pelicula.find_by(id: params[:id])\n if @pelicula\n render json: @pelicula, status: :ok\n else\n render json: {error: 'Not Found'}, status: :not_found\n end\n end", "title": "" }, { "docid": "fcfdd2bc0628f21fc4cf0db5c6e5c422", "score": "0.63248175", "text": "def show\n @finanzen = Finanzen.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @finanzen }\n end\n end", "title": "" }, { "docid": "080de1afd35a4aaa38077eb7d71ff741", "score": "0.63217914", "text": "def show\n @niche = Niche.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @niche }\n end\n end", "title": "" }, { "docid": "48fd5ee95e7806f40f6f1db46b22b6be", "score": "0.63134533", "text": "def index\n @filos = Filo.paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @filos }\n end\n end", "title": "" }, { "docid": "e95a3ba6ada851a6018493d65b263541", "score": "0.6302803", "text": "def show\n @fenlei = Fenlei.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fenlei }\n end\n end", "title": "" }, { "docid": "030d27cab05e8a2d00286c9c898d9aa3", "score": "0.62976", "text": "def show\n @notificacion = Notificacion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @notificacion }\n end\n end", "title": "" }, { "docid": "5940e5e3159b100fe5cc3504ea213faa", "score": "0.62968916", "text": "def index\n @doc_fiscais = DocFiscai.all\n end", "title": "" }, { "docid": "d909a7f1ef93deb51cc224efaf29caf6", "score": "0.6289992", "text": "def show\n @fotosresposta = Fotosresposta.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fotosresposta}\n end\n end", "title": "" }, { "docid": "fe565e4f7f0d90d296fad6ea32e1ddf1", "score": "0.62850666", "text": "def show\n @fetznedition = Fetznedition.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fetznedition }\n end\n end", "title": "" }, { "docid": "952b0fa246975c300623943d2441a4b4", "score": "0.6276185", "text": "def ficha_naturalista_api_nodejs\n if Rails.cache.exist?(\"ficha_naturalista_#{especie_id}\")\n self.jres = Rails.cache.fetch(\"ficha_naturalista_#{especie_id}\")\n return\n end\n\n Rails.cache.fetch(\"ficha_naturalista_#{especie_id}\", expires_in: eval(CONFIG.cache.ficha_naturalista)) do\n if naturalista_id.blank?\n t = especie\n t.ficha_naturalista_por_nombre\n self.jres = t.jres\n\n return unless jres.present?\n end\n\n begin\n resp = RestClient.get \"#{CONFIG.inaturalist_api}/taxa/#{naturalista_id}?all_names=true\"\n ficha = JSON.parse(resp)\n\n if ficha['total_results'] == 1\n { estatus: true, ficha: ficha['results'][0] }\n else\n { estatus: false, msg: 'Tiene más de un resultado, solo debería ser uno por ser ficha' }\n end\n\n rescue => e\n { estatus: false, msg: e }\n end\n end # End cache.fetch\n\n if Rails.cache.exist?(\"ficha_naturalista_#{especie_id}\")\n self.jres = Rails.cache.fetch(\"ficha_naturalista_#{especie_id}\")\n else\n self.jres = { estatus: false, msg: 'Error en el cache' }\n end\n end", "title": "" }, { "docid": "f3d16fd8793e3fd5ba25ef96f05cc374", "score": "0.6272914", "text": "def show\n @fibre_commection = FibreCommection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fibre_commection }\n end\n end", "title": "" }, { "docid": "961fbd226f2063833e31cde4fbea9339", "score": "0.6271792", "text": "def show\n @valor_ficha = ValorFicha.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @valor_ficha }\n end\n end", "title": "" }, { "docid": "0a53f4e8df24b9514e2c2d07dd22e9fe", "score": "0.6269793", "text": "def show\n @frivillig = Frivillig.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @frivillig }\n end\n end", "title": "" }, { "docid": "adb6cdd812555433ac51741458eca4b4", "score": "0.62670636", "text": "def show\n @tipo_nota = TipoNota.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_nota }\n end\n end", "title": "" }, { "docid": "adb6cdd812555433ac51741458eca4b4", "score": "0.62670636", "text": "def show\n @tipo_nota = TipoNota.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_nota }\n end\n end", "title": "" }, { "docid": "717d1f4e0c37793b521c6466d3e2f253", "score": "0.6264891", "text": "def index\n @cliente_fisicos = ClienteFisico.all\n end", "title": "" }, { "docid": "f8a4c8ea49dd931477c954fceb6187df", "score": "0.6259846", "text": "def show\n @pelicula = Pelicula.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pelicula }\n end\n end", "title": "" }, { "docid": "f8a4c8ea49dd931477c954fceb6187df", "score": "0.6259846", "text": "def show\n @pelicula = Pelicula.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pelicula }\n end\n end", "title": "" }, { "docid": "9ec2aa0ca9d72f37d540d68fca72bf6d", "score": "0.6251369", "text": "def show\n @feira_adocao = FeiraAdocao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feira_adocao }\n end\n end", "title": "" }, { "docid": "304769cf2f54c0e6cefbec78ef8d56c3", "score": "0.62507343", "text": "def show\n @folio = Folio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @folio }\n end\n end", "title": "" }, { "docid": "304769cf2f54c0e6cefbec78ef8d56c3", "score": "0.62507343", "text": "def show\n @folio = Folio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @folio }\n end\n end", "title": "" }, { "docid": "ab562415734011277ec7ab35b639fc0c", "score": "0.6247957", "text": "def show\n @facilitation = Facilitation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @facilitation }\n end\n end", "title": "" }, { "docid": "a77f92f1ba21f2ed6772a7e8ea8855d0", "score": "0.6247398", "text": "def show\n @feuille = Feuille.find(params[:id])\n @nom_client = Client.find(@feuille.client_id).nom\n @titre_de_la_fenetre = \"Feuille de temps\"\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feuille }\n end\n end", "title": "" }, { "docid": "d2201ba34f6cd5442567394b98509794", "score": "0.62406886", "text": "def show\n @fatigue = Fatigue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fatigue }\n end\n end", "title": "" }, { "docid": "f6c839b144f006e544ddff1e6ac8ca06", "score": "0.6239212", "text": "def show\n @cancha_futbol = CanchaFutbol.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cancha_futbol }\n end\n end", "title": "" }, { "docid": "15f2bd66d0d2a1616d7b422b55bb6b8b", "score": "0.62316257", "text": "def show\n @core_nota_retida = Core::NotaRetida.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @core_nota_retida }\n end\n end", "title": "" }, { "docid": "6e788bdb780b219a44fba337a4c0f0a6", "score": "0.62308264", "text": "def index\n @itens_faturas = ItensFatura.where(fatura_id: @fatura.id)\n end", "title": "" }, { "docid": "cbd20176102f7956d20c55bc72f9ddd0", "score": "0.62303936", "text": "def index\n @pessoa_fisicas = PessoaFisica.all\n end", "title": "" }, { "docid": "23780d3c999c83c56fc135c8895ea1c1", "score": "0.6220796", "text": "def show\n @foul = Foul.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @foul }\n end\n end", "title": "" }, { "docid": "97d8c3726dbeb1dd3a8ab3da764c128a", "score": "0.6215801", "text": "def show\n @afiliado = Afiliado.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @afiliado }\n end\n end", "title": "" }, { "docid": "85c4835aad2a926e576da8c107bfe6af", "score": "0.6200333", "text": "def index\n @filas = Fila.all\n end", "title": "" }, { "docid": "5c79a8d91e6439afc4a5dcca25683b04", "score": "0.6195304", "text": "def show\n @feast = Feast.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feast }\n end\n end", "title": "" }, { "docid": "1d74f23c22580d0a1a56b41689ce1ec9", "score": "0.6190382", "text": "def show\n @ativo_circulante_financeiro = AtivoCirculanteFinanceiro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ativo_circulante_financeiro }\n end\n end", "title": "" }, { "docid": "16b6bd251a78826e880f2e0eb4cb0cf7", "score": "0.6187111", "text": "def show\n @azione = Azione.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @azione }\n end\n end", "title": "" }, { "docid": "6e92005c9dbbfcd0c47e2422800109b7", "score": "0.61818415", "text": "def show\n @canchas_futbol = CanchasFutbol.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @canchas_futbol }\n end\n end", "title": "" }, { "docid": "c16c6dad3563c728dc697e28dcf62746", "score": "0.6172185", "text": "def obtenerFactura(id)#Validates\n jsonResponse = requestWebWithoutParams('GET', (ENV[\"url_factura\"]+id))\n\n if(jsonResponse==false)\n return jsonResponse\n else\n jsonResponse = jsonResponse.first\n paramsFactura = { _id: jsonResponse['_id'],\n created_at: jsonResponse['created_at'],#fechaCreacion\n proveedor: jsonResponse['proveedor'],\n cliente: jsonResponse['cliente'],\n valorBruto: jsonResponse['bruto'],\n iva: jsonResponse['iva'],\n valorTotal: jsonResponse['total'],\n estadoPago: jsonResponse['estado'],\n updated_at: jsonResponse['updated_at'],#fechaUpdate\n id_Oc: jsonResponse['oc'],\n motivoRechazo: jsonResponse['rechazo'],\n motivoAnulacion: jsonResponse['anulacion']\n }\n return paramsFactura\n end\nend", "title": "" }, { "docid": "98ffbf7f3194b7a17a8a6f2f4bdd6925", "score": "0.6172125", "text": "def show\n @datos_significativo = DatosSignificativo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @datos_significativo }\n end\n end", "title": "" }, { "docid": "316a5a2e07d32033a0a2fd2092597649", "score": "0.61668485", "text": "def show\n @idioma = Idioma.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @idioma }\n end\n end", "title": "" }, { "docid": "5fa43b6bf0814cc4d72db8939aa9b49b", "score": "0.61635745", "text": "def show\n @factura_distribuidor = FacturaDistribuidor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @factura_distribuidor }\n end\n end", "title": "" }, { "docid": "3fc2e685b0c86dddb0d566435b7ad0f1", "score": "0.61627936", "text": "def show\n @filme = Filme.find(params[:id])\n\n render json: @filme, root: \"data\", include: '**', adapter: :json, status: :ok\n end", "title": "" }, { "docid": "ab64aa694c85d41bbf2e6771667338cb", "score": "0.61617273", "text": "def show\n @ofrece = Ofrece.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ofrece }\n end\n end", "title": "" }, { "docid": "0a684b835bde2005b0d3550fb8afbf93", "score": "0.61542124", "text": "def show\n @detallefactura = Detallefactura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @detallefactura }\n end\n end", "title": "" }, { "docid": "944a8ddec7392808990187bbaf2fbfbc", "score": "0.6148617", "text": "def index\n @filieres = Filiere.all\n end", "title": "" }, { "docid": "1545e8221b3af4905798987ccee052b1", "score": "0.61399424", "text": "def index\n @pelicula = Pelicula.all\n render json: @pelicula, status: :ok \n end", "title": "" }, { "docid": "de8f773ad80a2b816d29e8768f7760c1", "score": "0.6139303", "text": "def index\n @afiliados = Afiliado.order(\"apellido_nombre\").page(params[:page]).per(15)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @afiliados }\n end\n end", "title": "" }, { "docid": "fdabeb626fe5becd1f0968174986fb6e", "score": "0.61283743", "text": "def show\n @financiation = Financiation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @financiation }\n end\n end", "title": "" }, { "docid": "c4ba61d076db79e7a66d54f60f64ccc1", "score": "0.6128141", "text": "def show\n @safra_impureza = SafraImpureza.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @safra_impureza }\n end\n end", "title": "" }, { "docid": "c4c8830d5d1930e9039d9efa7e0469b1", "score": "0.61235714", "text": "def show\n @fornecedor = Fornecedor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fornecedor }\n end\n end", "title": "" }, { "docid": "c4c8830d5d1930e9039d9efa7e0469b1", "score": "0.61235714", "text": "def show\n @fornecedor = Fornecedor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fornecedor }\n end\n end", "title": "" }, { "docid": "db94b92109199dd4f61e96128ef2de21", "score": "0.6120398", "text": "def show\n @periferico = Periferico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @periferico }\n end\n end", "title": "" }, { "docid": "60a6e147a42cb015566153075f1e82c0", "score": "0.6108131", "text": "def show\n @classificacao = Classificacao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @classificacao }\n end\n end", "title": "" }, { "docid": "5cf3d6167009c791a480a8bbb5f5349b", "score": "0.6107085", "text": "def show\n @familium = Familium.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @familium }\n end\n end", "title": "" }, { "docid": "055244f4d08607a77bf83f6dda46f61d", "score": "0.6100661", "text": "def show\n @nota_entrega = NotaEntrega.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nota_entrega }\n end\n end", "title": "" }, { "docid": "df3dc69186c631b3a19d1317a5cd329a", "score": "0.6090245", "text": "def show\n @notafiscal = Notafiscal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @notafiscal }\n end\n end", "title": "" }, { "docid": "60cf0efe20c5ed12d25bd23c24307227", "score": "0.60852146", "text": "def show\n @nico_list = NicoList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @nico_list }\n end\n end", "title": "" }, { "docid": "79368f0ae4ddac07285b42a374c537df", "score": "0.6083864", "text": "def uf\n api_url = \"https://mindicador.cl/api/uf/#{(params[:date])}\"\n response = HTTParty.get(api_url)\n responsetohash = JSON.parse(response.read_body)\n if responsetohash['serie'][0].nil?\n return render json: {mensaje:\"Valor no existe en esa fecha\"}\n else \n if request.headers['X-CLIENT'].present?\n Ufvaluerequest.create(client: request.headers['X-CLIENT'], requestedDate: \"#{params[:date]}\", ufvalue: responsetohash['serie'][0]['valor'] )\n render json: responsetohash['serie'][0]['valor']\n else\n return render json: {mensaje:\"falta colocar key = X-CLIENT y en Header su nombre de cliente\"}\n end\n end\n end", "title": "" }, { "docid": "b21b17f15e231cf89c901efa656a157a", "score": "0.60811424", "text": "def show\n @analise_financeira = AnaliseFinanceira.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @analise_financeira }\n end\n end", "title": "" }, { "docid": "94afc7eba1c3582e3e29192aa2385ce0", "score": "0.6076491", "text": "def new\n @filo = Filo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @filo }\n end\n end", "title": "" }, { "docid": "9086dfb14c24748f82f2f71bd7de9c11", "score": "0.6076178", "text": "def show\n @funcionario = Funcionario.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @funcionario }\n end\n end", "title": "" }, { "docid": "f18b1994dbf7234b754f3c605cbe4971", "score": "0.6074157", "text": "def show\n @fabricante = Fabricante.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fabricante }\n end\n end", "title": "" }, { "docid": "7f62c82076a3981fb10ea424f670d1fb", "score": "0.60683775", "text": "def index\n @detalle_factura_venta = DetalleFacturaVentum.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @detalle_factura_venta }\n end\n end", "title": "" }, { "docid": "db337d9cb8bac65485b77e820baf8948", "score": "0.60679024", "text": "def new\n @filiale = Filiale.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @filiale }\n end\n end", "title": "" }, { "docid": "b9a7addf9d010bfee12999e377316e26", "score": "0.6061181", "text": "def show\n @fichier = Fichier.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fichier }\n end\n end", "title": "" }, { "docid": "8da35036b228584caf72f4ae8df210f8", "score": "0.6059545", "text": "def show\n @frooble = Frooble.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @frooble }\n end\n end", "title": "" }, { "docid": "67a92619a5e50c14d3ca5166d71f51d8", "score": "0.6046849", "text": "def show\n @detalle_factura_ventum = DetalleFacturaVentum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @detalle_factura_ventum }\n end\n end", "title": "" }, { "docid": "6fed61d141c06e285327c25f980cc4fc", "score": "0.60398185", "text": "def show\n @serie = Serie.joins(:formato).select(\"formatos.descricao, formatos.id\").select(:titulo, :foto_data).find(params[:id]) \n response = @serie.as_json\n response[:foto_url] = @serie.foto_url\n render json: response\n end", "title": "" }, { "docid": "0d1f8e9052d692d06c13f94915a9619f", "score": "0.6039611", "text": "def index\n @diretorios = Diretorio.where(pessoa_id: params[:usuario]).first\n render json: @diretorios\n end", "title": "" }, { "docid": "5db7630fe0eb564b025fbb7ca1b26949", "score": "0.6035453", "text": "def show\n @filial_stock = FilialStock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @filial_stock }\n end\n end", "title": "" }, { "docid": "d78bd7aa1b0bb4c47c749e3964301036", "score": "0.6029523", "text": "def show\n @nota = Nota.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nota }\n end\n end", "title": "" }, { "docid": "d78bd7aa1b0bb4c47c749e3964301036", "score": "0.60287124", "text": "def show\n @nota = Nota.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nota }\n end\n end", "title": "" }, { "docid": "a2a24bad8ba5ff0674a65e433e6c91ea", "score": "0.6011856", "text": "def show\n @miscellaneou = Miscellaneou.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @miscellaneou }\n end\n end", "title": "" }, { "docid": "1cefc20ede1a7ec4437472e05b8b4ca6", "score": "0.60037196", "text": "def show\n @fine = Fine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fine }\n end\n end", "title": "" }, { "docid": "8834d8efeb766be337366e5b97600a76", "score": "0.60029453", "text": "def show\n @receipe = Receipe.find(params[:id])\n\n render json: @receipe\n end", "title": "" }, { "docid": "8d625bdb2af7caf954cfd6cd45f48d47", "score": "0.5999762", "text": "def index\n @funcionarios = Funcionario.all\n\n render json: @funcionarios, status: :ok\n end", "title": "" }, { "docid": "efe22481afb6cd09d28a4ca945178f34", "score": "0.5999613", "text": "def index\n @filhos = Filho.all\n end", "title": "" } ]
cc17e7574eb0f2fd6e08f4e871eab722
Create transactions Create transactions for the supplied account or the account whose id is given with form parameters. It requires an array of transaction dictionaries.
[ { "docid": "92c68c914b5bd061c2ea8f02f5a28731", "score": "0.0", "text": "def users_id_user_transactions_post_with_http_info(id_user, original_wording, value, date, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BanksApi.users_id_user_transactions_post ...'\n end\n # verify the required parameter 'id_user' is set\n if @api_client.config.client_side_validation && id_user.nil?\n fail ArgumentError, \"Missing the required parameter 'id_user' when calling BanksApi.users_id_user_transactions_post\"\n end\n # verify the required parameter 'original_wording' is set\n if @api_client.config.client_side_validation && original_wording.nil?\n fail ArgumentError, \"Missing the required parameter 'original_wording' when calling BanksApi.users_id_user_transactions_post\"\n end\n # verify the required parameter 'value' is set\n if @api_client.config.client_side_validation && value.nil?\n fail ArgumentError, \"Missing the required parameter 'value' when calling BanksApi.users_id_user_transactions_post\"\n end\n # verify the required parameter 'date' is set\n if @api_client.config.client_side_validation && date.nil?\n fail ArgumentError, \"Missing the required parameter 'date' when calling BanksApi.users_id_user_transactions_post\"\n end\n # resource path\n local_var_path = '/users/{id_user}/transactions'.sub('{' + 'id_user' + '}', id_user.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n form_params['original_wording'] = original_wording\n form_params['value'] = value\n form_params['date'] = date\n form_params['type'] = opts[:'type'] if !opts[:'type'].nil?\n form_params['state'] = opts[:'state'] if !opts[:'state'].nil?\n form_params['rdate'] = opts[:'rdate'] if !opts[:'rdate'].nil?\n form_params['coming'] = opts[:'coming'] if !opts[:'coming'].nil?\n form_params['active'] = opts[:'active'] if !opts[:'active'].nil?\n form_params['date_scraped'] = opts[:'date_scraped'] if !opts[:'date_scraped'].nil?\n form_params['id_account'] = opts[:'id_account'] if !opts[:'id_account'].nil?\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Transaction')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BanksApi#users_id_user_transactions_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" } ]
[ { "docid": "8498d2ad0f78786564be7d3956b82e96", "score": "0.69439673", "text": "def create\n account = Account.find(params[:account_id])\n @transaction = account.transactions.create(params[:transaction])\n\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to account_transactions_path(account), notice: 'Transaction was successfully created.' }\n format.json { render json: @transaction, status: :created, location: [@transaction.account, @transaction] }\n else\n format.html { render action: \"new\" }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f1a923c6b131224fc70b9543c4188ee8", "score": "0.67563033", "text": "def create_transaction( trans_date, trans_account, trans_value )\r\n { date: trans_date, account: trans_account, value: trans_value }\r\n\r\n end", "title": "" }, { "docid": "723e0741be2f75a692878023242db4c0", "score": "0.6743639", "text": "def create_transactions(transactions)\n transactions.values.each do |val|\n device_transaction = DeviceTransaction.find(val[:id])\n device_transaction.update(val.merge(purchase_order_id:self.id))\n end\n end", "title": "" }, { "docid": "c46b3dd15e293c112c8daaf8daad2a51", "score": "0.6641489", "text": "def create\n @transaction = @account.transactions.build(transaction_params)\n\n if @transaction.save\n redirect_to account_transactions_path, notice: 'Transaction was successfully created.'\n else\n render action: 'new'\n end\n end", "title": "" }, { "docid": "1366036797c93a68b048b7a4956e30f5", "score": "0.66338724", "text": "def create\n @transaction = @account.transactions.build(transaction_params).decorate\n\n if @transaction.save\n redirect_to account_transactions_path, notice: 'Transaction was successfully created.'\n else\n render action: 'new'\n end\n end", "title": "" }, { "docid": "1366036797c93a68b048b7a4956e30f5", "score": "0.66338724", "text": "def create\n @transaction = @account.transactions.build(transaction_params).decorate\n\n if @transaction.save\n redirect_to account_transactions_path, notice: 'Transaction was successfully created.'\n else\n render action: 'new'\n end\n end", "title": "" }, { "docid": "a6b93db1d2425023f194f53e75e293c9", "score": "0.6618965", "text": "def create_transaction(model, options={}) path = \"/api/v2/transactions/create\"\n post(path, model, options, AvaTax::VERSION) end", "title": "" }, { "docid": "14fbe8a4050fcc1747b241ca304512bd", "score": "0.65910584", "text": "def create_transaction\n amount = transfer_params['amount']\n description = transfer_params['description']\n date = transfer_params['date']\n\n # Check if any of the parameters are missing\n return if check_missing_transaction_params(transfer_params)\n \n # Check if either account does not exist\n return unless @account_from = check_existing_account(transfer_params['account_from'])\n return unless @account_to = check_existing_account(transfer_params['account_to'])\n\n # Check if source account belongs to logged in user\n return unless check_account_from_belongs_to_user\n \n # Check if transfering to same account\n return if check_transfer_to_same_account\n\n #\n #\n # Execute transaction\n transaction = Transaction.execute(\n account_to: @account_to,\n account_from: @account_from,\n amount: amount.round(2),\n description: description,\n date: date\n )\n\n if transaction \n render json: transaction, status: :ok\n else\n render json: { error: \"Transaction failed to execute\" }, \n status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "be9f29e22eceef780161ecd0c048b7b4", "score": "0.6567554", "text": "def build_transaction(data, account)\n amount = Money.new(data['Importe'] || 0, 'EUR')\n Transaction.new(\n account: account,\n # There is no unique id in the json, so we MD5 the json to create one\n id: Digest::MD5.hexdigest(data.to_json),\n amount: amount,\n effective_date: Date.parse(data['FechaValor']),\n description: data['ConceptoMovimiento'] + ' ' + data['Registros'].join(' '),\n balance: Money.new(data['saldo'] || 0, 'EUR'),\n )\n end", "title": "" }, { "docid": "96cd1a837842a3e02f30cff9e6bd260b", "score": "0.64694625", "text": "def create\n\t\t@transaction = Transaction.new(transaction_params)\n\t\t@transaction.processTransaction(@transaction)\n\n\t\trespond_to do |format|\n\t\t if @transaction.save\n\t\t\tformat.html { redirect_to @transaction, notice: 'Transaction was successfully created.' }\n\t\t\tformat.json { render :show, status: :created, location: @transaction }\n\t\t else\n\t\t\tformat.html { render :new }\n\t\t\tformat.json { render json: @transaction.errors, status: :unprocessable_entity }\n\t\t end\n\t\tend\n\t\t\n\t\t#processTransaction(@transaction.account_id, @transaction.transferee_id, @transaction.amount)\n\tend", "title": "" }, { "docid": "21600a148517be7f07955308fa5d053a", "score": "0.64109236", "text": "def create_transaction(script_id, transaction_name, optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'CreateTransaction'\n\t\targs[:query]['ScriptId'] = script_id\n\t\targs[:query]['TransactionName'] = transaction_name\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tself.run(args)\n\tend", "title": "" }, { "docid": "b3b31dfc6663d27fbd32c8b70fe5499a", "score": "0.6389845", "text": "def build_transaction(data, account)\n Transaction.new(\n account: account,\n id: data['uuid'],\n amount: data['amount'],\n currency: data['EUR'],\n effective_date: data['effectiveDate'],\n description: data['description'],\n balance: data['balance']\n )\n end", "title": "" }, { "docid": "d291f16c9395651aa790474e574a04b0", "score": "0.6366745", "text": "def build_transaction(data, account)\n Transaction.new(\n account: account,\n id: data['id'],\n amount: transaction_amount(data),\n description: data['conceptDescription'] || data['description'],\n effective_date: Date.strptime(data['operationDate'], '%Y-%m-%d'),\n currency: data['currency'],\n balance: transaction_balance(data)\n )\n end", "title": "" }, { "docid": "54bbd40fb8aba9e1ebe0f9c6a6db8ce4", "score": "0.6363048", "text": "def build_transaction(data, account)\n amount = Money.new(data['amount'] * 100, CURRENCY)\n Transaction.new(\n account: account,\n id: data['uuid'],\n amount: amount,\n effective_date: Date.strptime(data['effectiveDate'], '%d/%m/%Y'),\n description: data['description'],\n balance: Money.new(data['balance'] * 100, CURRENCY)\n )\n end", "title": "" }, { "docid": "54bbd40fb8aba9e1ebe0f9c6a6db8ce4", "score": "0.6363048", "text": "def build_transaction(data, account)\n amount = Money.new(data['amount'] * 100, CURRENCY)\n Transaction.new(\n account: account,\n id: data['uuid'],\n amount: amount,\n effective_date: Date.strptime(data['effectiveDate'], '%d/%m/%Y'),\n description: data['description'],\n balance: Money.new(data['balance'] * 100, CURRENCY)\n )\n end", "title": "" }, { "docid": "e877a8cd5d4b7d93a3a3ddc00d659a53", "score": "0.63140404", "text": "def create\n #@transaction = Tranxaction.new(params[:tranxaction])\n @transaction = Tranxaction.new(params.require(:tranxaction).permit(:transaction_date, :description, { transaction_entries_attributes: [:debit_amount, :tranxaction_id, :account_id]}))\n\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to @transaction, :notice => 'Transaction was successfully created.' }\n format.json { render :json => @transaction, :status => :created, :location => @transaction }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @transaction.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d9dc0ee7270aa54032e9c787b4a0152a", "score": "0.63081264", "text": "def create\n @transaction = current_account.transactions.new(params[:transaction])\n\n respond_to do |format|\n if @transaction.save\n format.html {\n redirect_to_target_or_default(\n account_transaction_path(current_account, @transaction),\n notice: 'Transaction was successfully created.' )\n }\n format.json { render json: @transaction, status: :created, location: @transaction }\n else\n format.html { render action: \"new\" }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9f0fdf032c79c8020854a65d1cd4a815", "score": "0.6294042", "text": "def transaction_params\n params.require(:transaction).permit(:amount, :name, :account_id)\n end", "title": "" }, { "docid": "24b4e175759ffac254b1e3f899fc18f3", "score": "0.62911206", "text": "def create_transaction_batch(companyId, model) path = \"/api/v2/companies/#{companyId}/batches/transactions\"\n post(path, model, {}, AvaTax::VERSION) end", "title": "" }, { "docid": "a620bea79bccd6e29826c97a92ae60d2", "score": "0.6288907", "text": "def transaction_params\n params.require(:transaction).permit(:created_at, :updated_at, :user_id, :address_array, :status )\n end", "title": "" }, { "docid": "00b267d8735b40cc2735197d0aa39987", "score": "0.62840986", "text": "def submit_transaction(args = {})\n t = transactions.new\n t.reference = args[:reference].to_s\n t.amount = args[:amount]\n t.contract_id = contract.id\n t.campaign_id = campaign.id\n t.save\n end", "title": "" }, { "docid": "8c145ea549c1ef1e140eb11d17c3d05e", "score": "0.6278736", "text": "def create\n\t# if transaction_params[:orders]\n\t# \ttransaction_params[:orders_attributes] = transaction_params[:orders]\n\t# \ttransaction_params.delete(:orders)\n\t# end \t\n @transaction = Transaction.new(transaction_params)\n respond_to do |format|\n if @transaction.save\n format.json { render json: @transaction, status: :created }\n else\n format.html { render action: 'new' }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f39d96feb6c6123be0a17bfabd3fe3fb", "score": "0.62786245", "text": "def create\n @account_transaction = AccountTransaction.new(account_transaction_params)\n\n respond_to do |format|\n if @account_transaction.save\n format.html { redirect_to @account_transaction, notice: 'Account transaction was successfully created.' }\n format.json { render :show, status: :created, location: @account_transaction }\n else\n format.html { render :new }\n format.json { render json: @account_transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "110c214ab9d61f709115bcc8e7cfee06", "score": "0.62747127", "text": "def create_transaction(body)\r\n # Prepare query url.\r\n _path_url = '/transactions'\r\n _query_builder = Configuration.get_base_uri\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json',\r\n 'content-type' => 'application/json; charset=utf-8'\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.post(\r\n _query_url,\r\n headers: _headers,\r\n parameters: body.to_json\r\n )\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n Transaction.from_hash(decoded)\r\n end", "title": "" }, { "docid": "05249ebb61ff3a7d79c018e9b974eb3a", "score": "0.6258841", "text": "def create\n @transaction = Transaction.new(transaction_params)\n\n respond_to do |format|\n Transaction.transaction do\n begin\n @transaction.save!\n @transaction.account.update_attributes!(:balance => @transaction.account.balance + @transaction.amount)\n\n format.html { redirect_to root_url, notice: 'Transaction was successfully created.' }\n rescue ActiveRecord::RecordInvalid\n format.html { redirect_to root_url }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n \n raise ActiveRecord::Rollback\n end\n end\n end\n end", "title": "" }, { "docid": "49751efc2f91bb07b47c8b08c3006954", "score": "0.6228122", "text": "def transactions(account_id, min_row=1, max_row=100)\n path = \"https://api.mybitx.com/api/1/accounts/#{account_id}/transactions\"\n opt = {\n min_row: min_row,\n max_row: max_row\n }\n authed_request(path, opt)\n end", "title": "" }, { "docid": "fd53404fd4873607bab5702cb844acc3", "score": "0.6216734", "text": "def transaction_params\n params.require(:transaction).permit(:account_id, :amount, :transaction_type)\n end", "title": "" }, { "docid": "a167416e7c45fdb1f7039d016d7c20f7", "score": "0.62060416", "text": "def transactions(options = nil)\n request = Request.new(@client)\n path = \"/customers/\" + CGI.escape(@id) + \"/transactions\"\n data = {\n\n }\n\n response = Response.new(request.get(path, data, options))\n return_values = Array.new\n \n a = Array.new\n body = response.body\n for v in body['transactions']\n tmp = Transaction(@client)\n tmp.fill_with_data(v)\n a.push(tmp)\n end\n\n return_values.push(a)\n \n\n \n return_values[0]\n end", "title": "" }, { "docid": "071906a2c34e4092ef937d775f56c971", "score": "0.6202482", "text": "def transaction_params\n params.require(:transaction).permit(:account_id, :transferee_id, :amount, :message)\n end", "title": "" }, { "docid": "b5b00950452fadc32fc7208926a6c12c", "score": "0.6187244", "text": "def transaction_params\n params.require(:transaction).permit(:account_ver, :account_bel, :valuta, :trx_date, :owner_id, :owner_type, :ttype, :status, :active, :text, :ref, :amount, :object_name, :object_id)\n end", "title": "" }, { "docid": "1d044a83c0528e90fdc27b16e60bddb9", "score": "0.61714834", "text": "def create_transaction(data)\n t = data\n\n t[:id] = all.length + 1\n t[:result] = data[:result]\n t[:created_at] = Time.new.to_s\n t[:updated_at] = Time.new.to_s\n\n new_transaction = Transaction.new(t, self)\n @all << new_transaction\n new_transaction\n end", "title": "" }, { "docid": "c1f5c92553f09d153a5d29ec0369be56", "score": "0.61706436", "text": "def submit_transaction(args = {})\n t = transactions.new\n t.reference = args[:reference].to_s\n t.amount = args[:amount]\n t.campaign_id = campaign.id\n t.save\n end", "title": "" }, { "docid": "2e5a5cc7abef1a065ab556e080a78dd1", "score": "0.61674654", "text": "def build_transaction(data, account)\n amount_cents = data['amount']['value'].scan(/-|\\d/).join('').to_i\n amount = Money.new(amount_cents, data['amount']['currency'])\n\n balance_cents = data['balance']['value'].scan(/-|\\d/).join('').to_i\n balance = Money.new(balance_cents, data['balance']['currency'])\n\n Transaction.new(\n account: account,\n id: data['apuntNumber'],\n amount: amount,\n description: data['concept'],\n description_detail: data['conceptDetail'],\n effective_date: parse_date(data['valueDate']),\n operation_date: parse_date(data['date']),\n balance: balance\n )\n end", "title": "" }, { "docid": "47516332d2ef9c9816219c1d1c63d63e", "score": "0.6167144", "text": "def create_transaction(date, payee, amount, type)\n {date: date, payee: payee, amount: amount, type: type}\nend", "title": "" }, { "docid": "9a0bb1f55382ecc5ca03a3d4ff76520c", "score": "0.6166434", "text": "def create(params)\n post = Api.default_post_for_params(params).merge({\n :orderid => params[:order_no],\n :amount => params[:amount]*100,\n :currency => Epay::CURRENCY_CODES[(params[:currency] || Epay.default_currency).to_sym],\n :description => params[:description],\n :cardholder => params[:cardholder],\n :group => params[:group],\n :instantcapture => params[:instant_capture] ? '1' : '0'\n })\n \n query = Api.authorize(post)\n \n if query['accept']\n # Find the transaction\n transaction = Transaction.find(query[\"tid\"].to_i)\n else\n # Return a new transaction with error code filled\n new(nil, {\n 'failed' => true,\n 'error' => query[\"error\"],\n 'orderid' => post[:orderid],\n 'authamount' => post[:amount],\n 'description' => post[:description],\n 'cardholder' => post[:cardholder],\n 'group' => post[:group],\n 'currency' => post[:currency]\n })\n end\n end", "title": "" }, { "docid": "6f342a4b8a8f911ba787d962f9a99033", "score": "0.6161818", "text": "def transactions(options = {})\n Buxfer.transactions(options.merge(:account => self))\n end", "title": "" }, { "docid": "686f80ebc4b9f8f00e3588cfd178ed82", "score": "0.61537147", "text": "def transactions(options = {})\n options.symbolize_keys!\n\n if account = options.delete(:account)\n options[:accountName] = account.is_a?(Buxfer::Account) ? account.name : account\n end\n\n if tag = options.delete(:tag)\n options[:tagName] = tag.is_a?(Buxfer::Tag) ? tag.name : tag\n end\n\n get_collection('transactions', options)\n end", "title": "" }, { "docid": "40078495215f1ae292f0cb3c4a6702ba", "score": "0.6152555", "text": "def create\n puts transaction_params\n transaction = Transaction.create(transaction_params)\n render json: transaction\n end", "title": "" }, { "docid": "9c1816461bad1032ecd0d0cc13918706", "score": "0.614136", "text": "def create\n params.permit!\n @transaktion = Transaktion.new(params[\"transaktion\"])\n @transaktion.save # see http://stackoverflow.com/a/2618902/948073 \n params[\"entry\"].keys.each do |index|\n entry = params[\"entry\"][index]\n puts entry\n if entry[\"account_id\"]\n\t entry[\"qty\"] = 1 if not entry[\"qty\"]\n\t # price is an integer field, measured in pennies...\n\t is_debit = (index.to_i%2 != 0)\n\t entry[\"is_debit\"] = is_debit\n\t price = (100.0*(entry[\"price\"].to_f)+0.5).to_s\n\t entry[\"price\"] = price\n\t entry[\"transaktion_id\"] = @transaktion.id\n\t Entry.new(entry).save\n end\n end\n\n respond_to do |format|\n if @transaktion.save\n format.html { redirect_to @transaktion, notice: 'Transaktion was successfully created.' }\n format.json { render :show, status: :created, location: @transaktion }\n else\n format.html { render :new }\n format.json { render json: @transaktion.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "226d3e6bfd3226c29a7487795c49b922", "score": "0.6130233", "text": "def create\n @transaction = current_account.transactions.build(transaction_params)\n # Set's values for transaction balance\n @transaction.initial_bal = current_account.balance\n @transaction.final_bal = @transaction.initial_bal - @transaction.amount\n\n respond_to do |format|\n if @transaction.save\n # Updates the balance of the account to reflect the transfer\n current_account.balance = @transaction.final_bal\n current_account.save\n format.html { redirect_to @transaction, notice: 'Transaction was successfully created.' }\n format.json { render :show, status: :created, location: @transaction }\n else\n format.html { render :new }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "10e6c870663c2b8191c7681ba8192c93", "score": "0.612985", "text": "def transaction_params\n params.require(:transaction).permit(:account_id, :payee_id, :amount, :reference, :initial_bal, :final_bal)\n end", "title": "" }, { "docid": "efccefebda059279f9edc864542d3719", "score": "0.61177933", "text": "def transaction_params\n params.require(:transaction).permit(:date, :amount, :user_id, :account_id, :recipient)\n end", "title": "" }, { "docid": "fe7046cf2d9e04ef3c088e5787545936", "score": "0.6101195", "text": "def account_transaction_params\n params.require(:account_transaction).permit(:tag_list, :account_id, :payee_id, :budget_id, :category_id, :amount, :transaction_date, :comments, :reconciled,:transaction_type,:historical_loan_transaction,:historical_account_transaction,:flagged)\n end", "title": "" }, { "docid": "b7754f3372c42ab4b08785ed44ef5be1", "score": "0.6094191", "text": "def create\n if params[:transaction_ids].nil? || params[:transaction_ids].empty? \n @future_transaction = FutureTransaction.new(future_transaction_params)\n @future_transaction.users_id = current_user.id\n make_calcs(@future_transaction,future_transaction_params)\n respond_to do |format|\n if @future_transaction.save\n format.html { redirect_to @future_transaction, notice: 'Future transaction was successfully created.' }\n format.json { render :show, status: :created, location: @future_transaction }\n else\n format.html { render :new }\n format.json { render json: @future_transaction.errors, status: :unprocessable_entity }\n end\n end\n else\n @future_transactions = FutureTransaction.where(id: params[:transaction_ids])\n @future_transactions.each do |mitem|\n @transaction = Transaction.new\n @transaction.users_id = current_user.id\n @transaction.amounttotal = mitem.amounttotal\n @transaction.netamount = mitem.netamount\n @transaction.chart_clones_id = mitem.chart_clones_id\n @transaction.code = mitem.code\n @transaction.gsttype = 0\n @transaction.co = mitem.co\n @transaction.date = DateTime.now\n @transaction.save\n mitem.destroy\n end\n end\n end", "title": "" }, { "docid": "663c853b3707dd0efc58475b111ae66c", "score": "0.60648906", "text": "def transaction_params\n params.require(:transaction).permit(:bank_account_id, :amount, :transaction_type, :user_id)\n end", "title": "" }, { "docid": "7e454d62a8ee2e2ab1483c5799f8f55a", "score": "0.6034751", "text": "def create\n\t@transaction = Transaction.new\n\t@acc_from = Account.find_by_id(params[:transaction][:from_id])\n\t@acc_to = Account.find_by_id(params[:transaction][:to_id])\t\n @transaction.amount = params[:transaction][:amount]\n\t@transaction.description = params[:transaction][:description]\n\t@transaction.to = @acc_to\n\t@transaction.from = @acc_from\n\t@transaction.receipt = params[:transaction][:receipt]\n\t@error = Transaction.validateTransaction(@transaction) \n\tif(@error != \"\")\n\t\t@accounts = Account.where(\"name not like ?\",\"total%\").accessible_by(current_ability)\n\t\trespond_to do |format|\n\t\t\tformat.html { render action: \"new\" }\n\t\t\tformat.json { render json: @transaction.errors, status: :unprocessable_entity }\n\t\tend\n\t\treturn\n\tend\n\t@result = Transaction.saveAndUpdateMainAccounts(@transaction)\n respond_to do |format|\n if ( @result)\n format.html { redirect_to @transaction, notice: 'Transaction was successfully saved.' }\n format.json { render json: @transaction, status: :created, location: @transaction }\n else\n\t\t@accounts = Account.where(\"name not like ?\",\"total%\").accessible_by(current_ability)\n format.html { render action: \"new\" }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "48871d76cc8eb3b016f7ddc031734b87", "score": "0.6027922", "text": "def build_transaction(data)\n Transaction.new(\n account: self,\n id: data['nummov'],\n amount: money(data['importe']),\n description: data['conceptoTabla'],\n effective_date: parse_date(data['fechaValor']),\n operation_date: parse_date(data['fechaOperacion']),\n balance: money(data['saldo'])\n )\n end", "title": "" }, { "docid": "35098fd23f70606f347cf6dea55a8326", "score": "0.6025976", "text": "def execute\n merchant = Merchant.find(inputs[:merchant_id])\n\n transaction = merchant.transactions.create(inputs.except(:merchant_id))\n\n transaction\n end", "title": "" }, { "docid": "47fc681642444d30890e58615a2d071b", "score": "0.60252225", "text": "def create\n @transaction = @current_user.transactions.build(transaction_params)\n \n if @transaction.save\n render json: @transaction, status: :created, location: @transaction\n else\n render json: @transaction.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "e8bbcbeb7f64fd73cc2acc7c15dca30d", "score": "0.60228556", "text": "def transactions(pending: false, account_id: nil,\n start_date: nil, end_date: nil)\n options = { pending: pending }\n options[:account] = account_id if account_id\n options[:gte] = start_date.to_s if start_date\n options[:lte] = end_date.to_s if end_date\n\n response = Connector.new(:connect, :get, auth: true, client: client)\n .post(access_token: access_token,\n options: MultiJson.dump(options))\n update_accounts(response)\n build_objects(response['transactions'], Transaction)\n end", "title": "" }, { "docid": "5bd80b85c43b1f59f2ad25524e3cc9ef", "score": "0.6020597", "text": "def transactions_put transaction\n transaction = @client.query_put \"transactions\", transaction\n end", "title": "" }, { "docid": "1fef514105cf08c53e68ad23a4a75e09", "score": "0.60197544", "text": "def transactions(options = {})\n @gateway.customer.transactions(id, options)\n end", "title": "" }, { "docid": "49eb8ac5df3f6b557d453e6154a20b08", "score": "0.6019061", "text": "def transactions(options = nil)\n request = Request.new(@client)\n path = \"/subscriptions/\" + CGI.escape(@id) + \"/transactions\"\n data = {\n\n }\n\n response = Response.new(request.get(path, data, options))\n return_values = Array.new\n \n a = Array.new\n body = response.body\n for v in body['transactions']\n tmp = Transaction(@client)\n tmp.fill_with_data(v)\n a.push(tmp)\n end\n\n return_values.push(a)\n \n\n \n return_values[0]\n end", "title": "" }, { "docid": "d178d6d42991576303aa8ab695b27660", "score": "0.6005813", "text": "def create\n @account = Account.new(params[:account])\n @account.taxes = Tax.find(params[:tax_ids]) if params[:tax_ids]\n \n respond_to do |format|\n if @account.save\n flash[:notice] = 'Account was successfully created.'\n format.html { redirect_to(@account) }\n format.xml { render :xml => @account, :status => :created, :location => @account }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @account.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a8bae633fa99cc8ded05c4422325885b", "score": "0.59980315", "text": "def transactions(options = {})\n Customer.transactions(id, options)\n end", "title": "" }, { "docid": "078358e310764f972015d9f4f543d9b0", "score": "0.5988525", "text": "def create\n @account = current_user.accounts.last\n \n @tran = @account.trans.create(tran_params)\n\n respond_to do |format|\n if @tran.save\n format.html { redirect_to @tran, notice: 'Betslip was successfully created.' }\n format.json { render :show, status: :created, location: @tran }\n else\n format.html { render :new }\n format.json { render json: @betslip.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9a3ef9cb49578292fc9dd619dbbdff6a", "score": "0.59814394", "text": "def create\n @transaction = current_user.transactions.build(transaction_params)\n @transaction.save\n end", "title": "" }, { "docid": "4773879ff4756fbe64328bf99114156f", "score": "0.5976277", "text": "def user_transactions(params = {})\n request(:post, '/user_transactions', params).each { |t| t.id = t.id.to_s }\n end", "title": "" }, { "docid": "edfff71014f50bf574e5f4364d7a45fe", "score": "0.5967803", "text": "def add_transaction (transaction)\n raise \"No :account_nr given\" if transaction[:account_nr].nil?\n raise \"No :amount given\" if transaction[:amount].nil? && transaction[:amount_in_cents].nil?\n raise \"No :account_owner given\" if transaction[:account_owner].nil?\n @transactions << transaction\n end", "title": "" }, { "docid": "c811990070e2b3d34410a534b2682f1a", "score": "0.5961893", "text": "def create_transaction(transaction_data)\n engine.create_transaction(transaction_data)\n end", "title": "" }, { "docid": "240a04483fb3165dc37d1d398516bbe3", "score": "0.595682", "text": "def transaction_params\n params.require(:transaction).permit(:payee, :date, :memo, :amount, journals_attributes: [:id, :account_id, :amount, :_destroy])\n end", "title": "" }, { "docid": "87e2cfb5d01a390e8de740f33485bcd7", "score": "0.5932448", "text": "def create\n @transaction = Transaction.new(params[:transaction])\n\n respond_to do |format|\n if @transaction.save_all(params)\n format.html { redirect_to @transaction, notice: 'Transaction was successfully created.' }\n format.json { render json: @transaction, status: :created, location: @transaction }\n else\n format.html { render action: 'new' }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7f161115b46ede50f0f9bc7c320dd3b0", "score": "0.5928505", "text": "def transaction_params\n params.require(:transaction).permit(:typepayment_id, :company_id, :companyprovider_id, :accountfinancial_id, :accountbank_id, :doctype_id, :category_id, :data_vencimento, :data_baixa, :historico, :valor_operacao, :valor_acrescimo, :valor_desconto, :valor_liquido, :user_id, {documents:[]})\n end", "title": "" }, { "docid": "c54fdd92a242a45abc07a01ddc9f146e", "score": "0.5915405", "text": "def transaction(*options)\n expanded_options = hashify_options(options)\n query_params = extract_query_params(expanded_options)\n tx = Imperium::Transaction.new\n yield tx\n response = @http_client.put('v1/txn', tx.body, query: query_params)\n Imperium::TransactionResponse.new(response)\n end", "title": "" }, { "docid": "c618af4b9f7e996962ea89a99c566f16", "score": "0.59134436", "text": "def account_params\n params.require(:account).permit(:access_token, :type,:name,\n :owner_id,:owner_type, :transactions_start_date, account_ids:[])\n end", "title": "" }, { "docid": "19afcecb70cc4e1d9ed91016de59b772", "score": "0.5910382", "text": "def create\n @transaction = Accounting::Transaction.new(transaction_params)\n\n respond_to do |format|\n logger.debug(@transaction.inspect)\n logger.debug(@transaction.entries.inspect)\n if @transaction.save\n format.html { redirect_to @transaction, notice: \"Transaction was successfully created.\" }\n format.json { render json: @transaction.to_json(:include => :entries), status: :created, location: @transaction }\n else\n format.html { render action: \"new\" }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "546f6e03ff1a30725fb4e1e0a1fb2829", "score": "0.5907371", "text": "def create\n request = if receivers.empty?\n Request.post('transactions', api_version, params)\n else\n Request.post_xml('transactions/', nil, credentials, xml_params)\n end\n\n Response.new(request, self).serialize\n end", "title": "" }, { "docid": "f1512036e5499fd87d471cde88ef5cca", "score": "0.59011966", "text": "def create\n @account = Account.new(account_params)\n\n respond_to do |format|\n if @account.save\n if params[\"date\"] && params[\"init\"]\n # identify opening balances account\n openingBalancesAccount = Account.find_by name: \"opening balances\"\n # create transaction which initializes account balance:\n transaktion = {}\n transaktion[\"date\"] = params[\"date\"]\n transaktion[\"is_void\"] = false\n tr = Transaktion.new(transaktion)\n tr.save\n # create two entries for account-initializing transaction:\n debit = {}\n debit[\"account_id\"] = @account.id\n debit[\"transaktion_id\"] = tr.id\n debit[\"price\"] = params[\"init\"]\n debit[\"qty\"] = 1\n debit[\"is_debit\"] = true\n Entry.new(debit).save\n credit = debit\n credit[\"account_id\"] = openingBalancesAccount.id\n credit[\"is_debit\"] = false\n Entry.new(credit).save\n end\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json {\n render json: {id: @account.id, friendlyName: friendlyName(@account), input: params[:input]}\n }\n else\n # format.html { render :new }\n # format.json { render json: @account.errors, status: :unprocessable_entity }\n render \"new\"\n end\n end\n end", "title": "" }, { "docid": "656532c6c392d577efcdaff3a32f28a7", "score": "0.5900375", "text": "def relate_transactions(params)\n transactions_list = BelvoManager::Transactions.new\n if transactions_list.listed.empty?\n BelvoManager::Accounts.new.listed.each do |account|\n aux = { 'link': account['link'], 'date_from': params['date_from'], options: { 'date_to': params['date_to'] } }\n transactions_list.create(aux)\n end\n end\n transactions_list.listed\n end", "title": "" }, { "docid": "dfc17dbc79ddae66fe3a39f689080470", "score": "0.59000087", "text": "def add_transaction(t)\n clean_t = {\n :date => t[\"Date\"] || nil,\n :ledger => safe_ledger(t[\"Ledger\"]),\n :company => clean_string(t[\"Company\"]),\n :amount => t[\"Amount\"].to_f || 0.0\n }\n unless @transactions.include? clean_t\n @transactions.push clean_t\n end\n end", "title": "" }, { "docid": "02630ce4e1c7f0b54ee0fc215c4817d1", "score": "0.58998066", "text": "def transaction_params\n params.require(:transaction).permit(:amount, :user_id, :campaign_id)\n end", "title": "" }, { "docid": "5f99fe742c555d55183a3db84cd33975", "score": "0.5889026", "text": "def acct_transaction_params\n params.require(:acct_transaction).permit(:account_id, :recipient_acct, :transaction_type_id, :description, :amount, :adjusted_bal, wire_transfers_attributes:[:id, :acct_transaction_id, :routing])\n end", "title": "" }, { "docid": "1da5bfc9975c007583b5ca8ebb059af0", "score": "0.588661", "text": "def create_automatic_transaction\n @automatic_transaction = FinanceTransactionTrigger.new\\\n (auto_transaction_params)\n @automatic_transaction.save\n flash[:notice] = t('automatic_transaction_create')\n @automatic_transactions ||= FinanceTransactionTrigger.all\n end", "title": "" }, { "docid": "9943600d12ff430f18faaa049369fd01", "score": "0.5874209", "text": "def create_account(params={name:random_string})\n\t\tnew_accounts = accounts[:new]\n\t\tnew_accounts[:params].merge!(params)\n\t\tpost(new_accounts)\n\tend", "title": "" }, { "docid": "b63747cfc934e720deb89ba4575ee696", "score": "0.5867039", "text": "def transactions(options = {})\n options[:start_time] ||= create_time\n options[:end_time] ||= Time.now.utc\n\n start_time = DateTime.parse(options[:start_time].to_s).strftime('%Y-%m-%dT%H:%M:%S.%L%:z')\n end_time = DateTime.parse(options[:end_time].to_s).strftime('%Y-%m-%dT%H:%M:%S.%L%:z')\n\n response = api.get(\"#{path(id)}/transactions\", start_time: start_time, end_time: end_time)\n\n page = Transaction::Page.new(response)\n page.merge!(response)\n page.raise_error!\n page\n end", "title": "" }, { "docid": "eaa2efaba931d65796c4e3dc91beda5a", "score": "0.5857045", "text": "def create\n @transaction = Transaction.create!(transaction_params)\n json_response(@transaction, :created)\n end", "title": "" }, { "docid": "b65dcf2e440b9392ed058f2c210b193f", "score": "0.58500874", "text": "def transaction_params\n params.fetch(:transaction, {})\n params.fetch(:account, {})\n end", "title": "" }, { "docid": "04cab6dc47516c5e856e7098897efee3", "score": "0.5849717", "text": "def transaction_params\n params.require(:transaction).permit(:user_id, :account_no, :transaction_type, :transaction_amount, :mode, :state)\n end", "title": "" }, { "docid": "19fcfdbef5fa9968363ef1a51a86e950", "score": "0.5845", "text": "def transaction_params\n params.require(:transaction).permit(:generated_by, :amount, :transaction_type, :date, :tennant_id, :name, :category, :owner_id)\n end", "title": "" }, { "docid": "21fea620f7a70f800ba5355718d6550e", "score": "0.5838335", "text": "def insertTransactions(databaseConnection, data, bank_account_id)\n data.each do |transaction|\n result = databaseConnection.query(\"SELECT * FROM bank_account_transactions WHERE bank_account_id='#{bank_account_id}' AND date='#{transaction['date']}' AND type='#{transaction['type']}' AND description='#{transaction['description'].gsub(/'/) {|s| \"\\\\'\"}}' AND paid_in='#{transaction['paid_in']}' AND paid_out='#{transaction['paid_out']}' AND balance='#{transaction['balance']}'\")\n if result.num_rows == 0\n databaseConnection.query(\"INSERT INTO bank_account_transactions (bank_account_id, date_fetched, date_fetched_string, date, type, description, paid_in, paid_out, balance) VALUES (#{bank_account_id}, '#{DateTime.now}', '#{DateTime.now}', '#{transaction['date']}', '#{transaction['type']}', '#{transaction['description'].gsub(/'/) {|s| \"\\\\'\"}}', '#{transaction['paid_in']}', '#{transaction['paid_out']}', '#{transaction['balance']}')\")\n end\n end\n end", "title": "" }, { "docid": "c564395fd2392c840f7186d5b3e061fd", "score": "0.58346915", "text": "def account_params\n params.require(:account).permit(:token,:access_token, :type,:name,\n :owner_id,:owner_type, :transactions_start_date, account_ids:[])\n end", "title": "" }, { "docid": "7727b491a6f6a97512f107c6bc1f69a2", "score": "0.58291316", "text": "def create\n @transaction = Transaction.new(transaction_params)\n \n if @transaction.save\n respond_to do |format|\n format.json {\n # Build the success API response\n transaction_response = {\n header: {\n code: 200,\n status: \"OK\",\n msg: \"Created transaction with id=[#{@transaction.id}]\"\n },\n body: {\n transaction: @transaction\n }\n }\n render json: transaction_response\n }\n end\n else\n respond_to do |format|\n format.json {\n # Build the error API response\n transaction_error_response = {\n header: {\n code: 422,\n status: \"ERROR\",\n msg: \"Failed to create transaction\",\n errors: @transaction.errors\n },\n body: {} \n }\n render json: transaction_error_response, status: :unprocessable_entity\n }\n end\n end\n end", "title": "" }, { "docid": "260df9663668319ddd42f492753855d1", "score": "0.58219653", "text": "def create(credentials:,\n institution_id:,\n initial_products:,\n transactions_start_date: nil,\n transactions_end_date: nil,\n transactions_await_results: nil,\n webhook: nil,\n options: nil)\n\n transactions_options = {}\n unless transactions_start_date.nil?\n transactions_options[:start_date] = Plaid.convert_to_date_string(transactions_start_date)\n end\n unless transactions_end_date.nil?\n transactions_options[:end_date] = Plaid.convert_to_date_string(transactions_end_date)\n end\n unless transactions_await_results.nil?\n transactions_options[:await_results] = transactions_await_results\n end\n\n options_payload = {}\n options_payload[:transactions] = transactions_options if transactions_options != {}\n options_payload[:webhook] = webhook unless webhook.nil?\n options_payload = options_payload.merge(options) unless options.nil?\n\n payload = { credentials: credentials,\n institution_id: institution_id,\n initial_products: initial_products,\n options: options_payload }\n @client.post_with_auth('item/create', payload)\n end", "title": "" }, { "docid": "8203cee2b9675bf064b390c842ce46aa", "score": "0.58193064", "text": "def transaction_params\n params.require(:transaction).permit(:wallet_id, :wallet_id, :transaction_type_id, :amount)\n end", "title": "" }, { "docid": "2bdf1f8d6032f22da5f59dab0657a89c", "score": "0.5804917", "text": "def corporate_wallet_transactions(opts = {:accountkey => nil, :characterid => nil, :beforerefid => nil})\n args = postfields(opts)\n h = compute_hash(args.merge(:url => @@corporate_wallet_trans_url))\n return h if h\n process_query(Reve::Classes::CorporateWalletTransaction,opts[:url] || @@corporate_wallet_trans_url,false,args)\n end", "title": "" }, { "docid": "1a210b966656c1f3c8a52fc79738dc32", "score": "0.5796337", "text": "def create\n @account_transaction = user_default_branch.current_accounting_period.account_transactions.build(params[:account_transaction])\n \n respond_to do |format|\n if @account_transaction.save\n flash[:notice] = 'AccountTransaction was successfully created.'\n format.html { redirect_to(@account_transaction) }\n format.xml { render :xml => @account_transaction, :status => :created, :location => @account_transaction }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @account_transaction.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "92ff692c89b6ca9c4f10b47d420c1d8d", "score": "0.5795658", "text": "def transaction_params\n params.require(:transaction).permit(:name, :startDate, :endDate, :phone, :email, :street_1, :street_2, :city, :state, :zip, :image, :desc, :webpage, :search, :tags, :flags, :tagged_with, :tag_ids => [])\n end", "title": "" }, { "docid": "242d498fbddf405fa62200ed0f7d1bc7", "score": "0.5771277", "text": "def transaction_params\n params.require(:transaction).permit(:dt, :account_id, :amount, :remark, :transaction_type)\n end", "title": "" }, { "docid": "9f1cd960c6516ddfa181ff3e053573eb", "score": "0.57704765", "text": "def create\n\n @txn_id = params[:data][:attributes][:transaction_id]\n if @txn_id\n @new_txn = TransactionUser.create!(txn_user_params)\n else\n @new_txn = current_user.transactions.create!(txn_params)\n end\n\n render json: { txn: \"Transaction created\" }\n\n end", "title": "" }, { "docid": "c1ba70cad859569838f55ef1da680e16", "score": "0.57676166", "text": "def transaction_params\n params.require(:transactions).permit(:id, :amount, :type_id, :notes, :user_id, :void, orders_attributes: [:product_id, :name, :price, :quantity])\n end", "title": "" }, { "docid": "4f97af66bf581bc19cfcf25ec81370d7", "score": "0.5767445", "text": "def call(accounts: nil, since: nil)\n txn_data = controller.fetch(accounts: accounts, since: since)\n\n logger.info 'ingesting transactions...'\n\n txn_data.each_pair do |account, txns|\n a = ImportableAccount.find_or_initialize_by(source_id: account)\n a.name = account\n a.save\n\n txns.each do |txn|\n t = ImportableTransaction.find_or_initialize_by(source_id: txn.id)\n\n t.date = txn.date\n t.description = txn.notes\n t.category = 'unknown'\n t.expense = txn.expense?\n t.cents = txn.amount.abs\n t.account = account\n t.account_id = a.source_id\n t.source_id = txn.id\n\n t.save\n end\n end\n end", "title": "" }, { "docid": "df3e26b04e97736654a59d68da875573", "score": "0.5755679", "text": "def create\n unless edit_user? && current_user.wallet.id != params[:wallet_id]\n # TODO change later\n raise \"error\"\n end\n\n merged_data = {wallet_id: params[:wallet_id], name: \"Withdraw to #{transaction_params[:ticker]}\"}\n @transaction = Transaction.new(transaction_params.merge(merged_data))\n\n respond_to do |format|\n if enough_amount && @transaction.save\n format.html { redirect_to wallet_path(current_user), notice: 'Transaction was successfully created.' }\n #format.json { render :show, status: :created, location: @transaction }\n else\n format.html { render :new }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0483f6ca22fd940c7e9c35eb54c48df6", "score": "0.5749533", "text": "def create_simple_transaction(\n name, date, account, amount, commodity, balance_account, is_credit, memo)\n main = Entry.new(\n account: account,\n amount: Money.new(amount, commodity))\n balance = Entry.new(\n account: balance_account,\n amount: Money.new(-amount, commodity))\n entries = is_credit ? [balance, main] : [main, balance]\n Transaction.new(name: name, date: date, entries: entries, memo: memo)\n end", "title": "" }, { "docid": "c22b8890ad38d687768802afa9153d7a", "score": "0.5747462", "text": "def generate_transaction\n transaction do\n trans = user.purchases.create!(\n amount_in_cents: money_units,\n qty: volume_units,\n venue_id: venue_id,\n tap_id: tap_id,\n description: account_name,\n created_at: line_item_at\n )\n update!(user_transaction: trans)\n end\n end", "title": "" }, { "docid": "266b8cdd50d2219af56890f22a1714c0", "score": "0.57438517", "text": "def handle_create_tx params = {}\n params[:fee] ||= 0\n #keys, recipients, fee = 0\n keystore = Bitcoin::Wallet::SimpleKeyStore.new(file: StringIO.new(\"[]\"))\n params[:keys].each do |k|\n begin\n key = Bitcoin::Key.from_base58(k)\n key = { addr: key.addr, key: key }\n rescue\n if Bitcoin.valid_address?(k)\n key = { addr: k }\n else\n begin\n key = Bitcoin::Key.new(nil, k)\n key = { addr: key.addr, key: key }\n rescue\n return { error: \"Input not valid address, pub- or privkey: #{k}\" }\n end\n end\n end\n keystore.add_key(key)\n end\n wallet = Bitcoin::Wallet::Wallet.new(@node.store, keystore)\n\n tx = wallet.new_tx(params[:recipients].map {|r| [:address, r[0], r[1]]}, params[:fee])\n return { error: \"Error creating tx.\" } unless tx\n { hash: tx.hash, hex: tx.to_payload.hth,\n missing_sigs: tx.in.map {|i| [i.sig_hash.hth, i.sig_address] rescue nil } }\n rescue\n { error: \"Error creating tx: #{$!.message}\" }\n p $!; puts *$@\n end", "title": "" }, { "docid": "6084c6f4f23b7a358227b8a396b19011", "score": "0.5734424", "text": "def create\n @transaction = Transaction.new(transaction_params)\n \n \n respond_to do |format|\n\t\tif @transaction.save\n\t\t\tformat.html { redirect_to @transaction, notice: 'Transaction was successfully created.' }\n\t\t\tformat.json { render action: 'show', status: :created, location: @transaction }\n\t\telse\n\t\t\tformat.html { render action: 'new' }\n\t\t\tformat.json { render json: @transaction.errors, status: :unprocessable_entity }\n\t\tend\n\tend\n \n\tif transaction_params[:t_amount].to_f > 0\n\t from_account = Account.find_by_id(transaction_params[:from_account_id])\n\t\tto_account = Account.find_by_id(transaction_params[:to_account_id])\n \t #account_from.a_amount = account_from.a_amount - transaction_params[:t_amount].to_f\n\t from_account_type = Account.find_by_id(transaction_params[:from_account_id]).a_type\n\t \n\t\tif from_account_type == \"Liability\"\n\t\t\tfrom_account.a_amount += transaction_params[:t_amount].to_f\n\t\t\tto_account.a_amount += transaction_params[:t_amount].to_f\n\t\telse\n\t\t\tif from_account.a_amount >= 0\n\t\t\t\tfrom_account.a_amount -= transaction_params[:t_amount].to_f\n\t\t\t\tto_account.a_amount += transaction_params[:t_amount].to_f\n\t\t\t\t\n\t\t\tend\n\t\tend\n\t\t\n\t\tfrom_account.save\n\t\tto_account.save\n \n\tend\n end", "title": "" }, { "docid": "ea57bb53615e7b105a1d6dbc0a53e0b4", "score": "0.57233137", "text": "def create_transaction\n Transaction.new(\n @bank,\n @certificates,\n player,\n [proceeds]\n )\n reduce_prices\n end", "title": "" }, { "docid": "e55a50098cea50ef7a9c7244c3430619", "score": "0.57222736", "text": "def transaction_params\n params.require(:transaction).permit(:customer_id, :product_id, :sales_person_id, :quantity, :date, :branch_id, :paymentmethod)\n end", "title": "" }, { "docid": "55c998c087801a05d3a880560a2f46c0", "score": "0.57174635", "text": "def create\n from_account = current_user.accounts.find_by_id(params[:transaction][:from_account].to_i)\n to_account = current_user.accounts.find_by_id(params[:transaction][:to_account].to_i)\n amount = params[:transaction][:amount].to_i\n balance = current_user.accounts.balance(from_account, to_account, amount);\n if amount < 0 \n flash[:notice] = \"Amount has a negative sign and that's not allowed, please re-enter the amount\"\n redirect_to new_transaction_path\n else\n if (balance == 0) \n ret_val = current_user.accounts.transaction_account(from_account, to_account, amount)\n if ret_val == ''\n \t @transaction = current_user.transactions.new(params[:transaction])\n @transaction.save\n respond_with(@transaction)\n else\n flash[:notice] = \"#{ret_val} is initially zero so that would result in an overdraft, please check your transaction again\"\n redirect_to new_transaction_path\n end\n else\n redirect_to new_transaction_path\n flash[:notice] = \"Your accounts are unbalanced, please double check your entries\"\n end\n end\n end", "title": "" }, { "docid": "aff7bd829b3031d39d016511cc6b7605", "score": "0.57129765", "text": "def transaction_params\n params.require(:transaction).permit(:name, :email, :phone, :start_date, :sales_rep_name, :item, :connected_account_id)\n end", "title": "" }, { "docid": "0056a8c5ec1e4e3799f3d8b50eaa031f", "score": "0.57104206", "text": "def create\n @transact = Transact.new(transact_params)\n\n @from_user = User.find_by(id: params[:transact][:from_user_id])\n @to_user = User.find_by(id: params[:transact][:to_user_id])\n amount = params[:transact][:amount].to_d\n\n if @from_user.account.balance > amount\n Account.transaction do\n @from_user.account.debit(amount)\n @to_user.account.credit(amount)\n @from_user.account.save\n @to_user.account.save\n @transact.save\n @transact_success = true\n end\n else\n @transact_success = false\n end\n\n respond_to do |format|\n if @transact_success\n format.html { redirect_to @transact, notice: 'Transact was successfully created.' }\n # format.json { render :show, status: :created, location: @transact }\n else\n format.html { redirect_to transacts_path, notice: 'Transact failed, balance not sufficient.' }\n # format.json { render json: @transact.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
8e17c674778318f6d056237bf4a92d01
Method to move the player upwards
[ { "docid": "7d8180604fbd252c567414c64c0fe210", "score": "0.80596083", "text": "def move_up\r\n @y -= 1\r\n end", "title": "" } ]
[ { "docid": "74dce63c2e5abd218687c9987db80a0c", "score": "0.8102935", "text": "def moveUp\n end", "title": "" }, { "docid": "4ce2bd2b01fed0cfefcc149168da5d34", "score": "0.807113", "text": "def move_up!\n @posx -= 1\n end", "title": "" }, { "docid": "a700cca67bf496f0171d2cae30f07772", "score": "0.796973", "text": "def up\n move(-1, 0)\n end", "title": "" }, { "docid": "a700cca67bf496f0171d2cae30f07772", "score": "0.796973", "text": "def up\n move(-1, 0)\n end", "title": "" }, { "docid": "320ea2eea543b779e80d4d8134fecf64", "score": "0.79543984", "text": "def move_up\n return self if y - 1 < 1\n\n move(y: y - 1, yn: yn - 1)\n end", "title": "" }, { "docid": "999ef7ce03ac79d1ea676d970afb003c", "score": "0.7769822", "text": "def move_up\n @oy -= 1\n @y = coordinate(oy, :y).y\n\n store_and_refresh\n end", "title": "" }, { "docid": "786cbe221e7dbb63c5b85b340b009cc3", "score": "0.7641999", "text": "def move_up(track) end", "title": "" }, { "docid": "c01bcad7d34452a9173c6efd0d0fd918", "score": "0.75389713", "text": "def move_up\n @position[1] += 1\n end", "title": "" }, { "docid": "52b8e0aea31b0637d3347904db201d53", "score": "0.7531576", "text": "def move_up\n @animation = :move_up_animation\n @counter = 0\n end", "title": "" }, { "docid": "52b8e0aea31b0637d3347904db201d53", "score": "0.7531576", "text": "def move_up\n @animation = :move_up_animation\n @counter = 0\n end", "title": "" }, { "docid": "cc92045009a03177beee6f8a4a8a32b3", "score": "0.7493498", "text": "def move_up\n up_tile = C[@location.coords.first - 1, @location.coords.second]\n move_to(Location.new(@location.map, up_tile))\n end", "title": "" }, { "docid": "ec8c6ad9e92e33fcb016d264a943aba9", "score": "0.7480499", "text": "def move_up\n return if at_top?\n self.siblings.where(position: self.position - 1).first.inc(:position, 1)\n self.inc(:position, -1)\n end", "title": "" }, { "docid": "ba036f7b8861700b3222967d1ca60751", "score": "0.745096", "text": "def move_up\n switch_with_sibling_at_offset(-1) unless at_top?\n end", "title": "" }, { "docid": "65b8818d74edc139f7cd20f4b5eee824", "score": "0.7388847", "text": "def move_up\n next_y = @pos_y - @speed\n next_y = @game.top_wall if next_y < @game.top_wall\n delta = next_y - @pos_y\n @pos_y = next_y\n @caught_balls.each { |ball| ball.pos_y += delta }\n end", "title": "" }, { "docid": "ac78b44039866a83b416506e7bbe2e84", "score": "0.7370418", "text": "def up(distance)\n\t\tmove_y distance\n\t end", "title": "" }, { "docid": "749f43a5be56fcbbfca0fab5698448bd", "score": "0.73110396", "text": "def move_up\n $x -= 1\n take_step\n end", "title": "" }, { "docid": "09843d9b9d9fbcb8a18e7c41ed99ab94", "score": "0.7290487", "text": "def move_up\n move_to(index_in_parent - 1)\n end", "title": "" }, { "docid": "05454f4168e186fdb50226fec1ec1d2c", "score": "0.7249527", "text": "def go_up\n if can_move?\n @dir = :up\n if @y > 0 && @map.passable?(@x, @y) && @map.passable?(@x, @y - 1)\n sprite.go_up\n @y -= 1\n return true\n else\n turn_up\n end\n end\n Events.on_step_impassable.call(@dir, @x, @y - 1) if self == $Player\n return false\n end", "title": "" }, { "docid": "cb606646532b3fca5863bc6201637352", "score": "0.723072", "text": "def move_up\n @oy -= 1\n\n @attributes = attributes.merge!(x: x,\n y: coordinate.y_position,\n ox: ox,\n oy: oy)\n\n Vedeu::Cursors::Cursor.new(@attributes).store\n end", "title": "" }, { "docid": "9815508117db948608168bfa2dba5b7f", "score": "0.7213316", "text": "def move_up(playing_cards)\n num_cols = playing_cards.length / 3\n if @current_card_index - num_cols < 0\n @current_card_index += 2 * num_cols\n else\n @current_card_index -= num_cols\n end\n end", "title": "" }, { "docid": "5ccd728537e3274c1a0ffd4290ddc10f", "score": "0.72026813", "text": "def move_up\r\n unless at_top?\r\n prev_sibling = higher_siblings.last\r\n switch_with_sibling(prev_sibling) unless prev_sibling.nil?\r\n end\r\n end", "title": "" }, { "docid": "74b86d77d96586068d5325bd96a54368", "score": "0.7170765", "text": "def moveUp(x,y)\n if x > 0\n @history << \"up\"\n @board[x][y],@board[x-1][y] = @board[x-1][y],@board[x][y]\n end\n end", "title": "" }, { "docid": "4fb570e23940f53a22394cb66e4e8763", "score": "0.7139783", "text": "def move_up(turn_enabled = true)\n # turn if turn enabled\n turn_up if turn_enabled\n # move into direction\n return move_direction(8)\n end", "title": "" }, { "docid": "98ca7bdd4e6294eb770bc034a38a21cf", "score": "0.7111709", "text": "def move_up(n = 1)\n move_to(position_value - n) \n end", "title": "" }, { "docid": "9f5901d7a57619442b5a0ffffeb3c2e7", "score": "0.70740145", "text": "def startMovingUp\n\t\t@direction = :up\n\tend", "title": "" }, { "docid": "f361cd17d48c5a3c3db65d1bea70eade", "score": "0.7069872", "text": "def moveUp()\n \t@y += 1\n\t\tputs \"You took a step up!\"\n end", "title": "" }, { "docid": "f05e1551e2a3b591eb360deabb4f6f66", "score": "0.70432496", "text": "def move_up\n up_tile = Couple.new(@location.first - 1, @location.second)\n move_to(up_tile)\n end", "title": "" }, { "docid": "eb112bd5c4f07fc4d5362708952fa595", "score": "0.7010326", "text": "def up\n @oy -= 1 unless @oy == 0\n @y -= 1\n\n self\n end", "title": "" }, { "docid": "c4f533446f5c68adbb26be4be9bc84ff", "score": "0.6975635", "text": "def up\n @direction = :up\n self\n end", "title": "" }, { "docid": "69e89eb8664b9cd96163dc77603b4af8", "score": "0.6918211", "text": "def move_up(mode = true, check = false)\n mode == 0 ? move_generic(mode, check, 8) : super(check)\n end", "title": "" }, { "docid": "c75a829aade51fba71bc08aa8501d967", "score": "0.6900797", "text": "def move_item_up\n if @active_item > 0\n pitem = @items[@active_item - 1]\n @items[@active_item - 1] = @items[@active_item]\n @items[@active_item] = pitem\n @active_item = @active_item - 1\n draw_items\n end\n end", "title": "" }, { "docid": "96b8eb39d30fdca8694614c99c72f7fc", "score": "0.68986696", "text": "def up\n yield north if block_given?\n\n move(:up) if can_move?(:up)\n end", "title": "" }, { "docid": "653d6db29120556d828fb511b63ae3c9", "score": "0.68793267", "text": "def down\n move(1, 0)\n end", "title": "" }, { "docid": "653d6db29120556d828fb511b63ae3c9", "score": "0.68793267", "text": "def down\n move(1, 0)\n end", "title": "" }, { "docid": "e6ddf962eafd9b367951d40e15bc0577", "score": "0.68608236", "text": "def turn_up\n sprite.turn_up\n @dir = :up\n end", "title": "" }, { "docid": "2cce0eb54039e7f42c53ea438caae8e6", "score": "0.68144506", "text": "def move_up\n if y - 1 < 1\n dy = y\n dyn = yn\n else\n dy = y - 1\n dyn = yn - 1\n end\n\n @attributes = attributes.merge(\n centred: false,\n maximised: false,\n x: x,\n xn: xn,\n y: dy,\n yn: dyn,\n )\n Vedeu::Geometry::Geometry.new(@attributes).store\n end", "title": "" }, { "docid": "5b360a95b1d2aae35f9b90362ad99f55", "score": "0.6779744", "text": "def moveUp\n if @y\n call Screen.setColor(@x)\n call Screen.drawRectangle(@x, @y, @x, @y)\n let @y = @y\n call Screen.setColor(@x)\n call Screen.drawRectangle(@x, @y, @x, @y)\n end\n end", "title": "" }, { "docid": "059c4b52486518dcd172e78e084f14fa", "score": "0.6770285", "text": "def button_up(id)\r\n if id==Gosu::KB_LEFT\r\n @player.move_left\r\n end\r\n\r\n if id==Gosu::KB_RIGHT\r\n @player.move_right\r\n end\r\n\r\n if id==Gosu::KB_UP\r\n @player.move_up\r\n end\r\n\r\n if id==Gosu::KB_DOWN\r\n @player.move_down\r\n end\r\n end", "title": "" }, { "docid": "059c4b52486518dcd172e78e084f14fa", "score": "0.6770285", "text": "def button_up(id)\r\n if id==Gosu::KB_LEFT\r\n @player.move_left\r\n end\r\n\r\n if id==Gosu::KB_RIGHT\r\n @player.move_right\r\n end\r\n\r\n if id==Gosu::KB_UP\r\n @player.move_up\r\n end\r\n\r\n if id==Gosu::KB_DOWN\r\n @player.move_down\r\n end\r\n end", "title": "" }, { "docid": "fa2cd745445b70b7421aa4b69b2b79fe", "score": "0.6761272", "text": "def move_lower\n decrement_position\n end", "title": "" }, { "docid": "866eb9184f5003641428c64d65479ede", "score": "0.67329556", "text": "def move_up(turn_enabled = true)\n # Face up\n turn_up if turn_enabled\n # When possible to pass\n if passable?(@x, @y, Input::UP)\n # Face up\n turn_up\n # Update coordinates\n @y -= 1\n end\n end", "title": "" }, { "docid": "0db82e81b92a0f9a0d443c1be70a6479", "score": "0.6669601", "text": "def move_up(step = 1)\n @selected -= step\n @selected = 0 if @selected.negative?\n @offset -= step if @offset.positive? && @selected < @offset\n @offset = 0 if @offset.negative?\n end", "title": "" }, { "docid": "fd4366b4d96a603b3a27af335d3a8fab", "score": "0.6634826", "text": "def _move_up(num = 1)\n num = 1 if num < 1\n @y -= num\n return if @y >= @srt\n _scroll_up(@srt - @y) # scroll\n @y = @srt\n end", "title": "" }, { "docid": "e3a8e680f1adfc06ce0fb0687b921c40", "score": "0.6621844", "text": "def move_up!\n \n cur = self.sequence\n\n swap = LookupItem.find_by_lookup_id_and_parent_id_and_sequence(self.lookup_id, self.parent_id, self.sequence - 1)\n \n self.update_attribute(:sequence, cur - 1)\n swap.update_attribute(:sequence, cur) \n \n end", "title": "" }, { "docid": "6be375884e6ec3204984170c02aa249d", "score": "0.6595607", "text": "def move_up\n\t\tpicture = Picture.find(params[:picture])\n\t\tpicture.move_up\n\t\tredirect_to pictures_path\n\tend", "title": "" }, { "docid": "18fe35f0e63095a3508726f26aed5829", "score": "0.6595122", "text": "def move_away_from_player\n # get pixel movement rate\n pix = BlizzABS.pixel\n # calculates differences in x and y\n dx, dy = @x - ($game_player.x+pix/2)/pix, @y - ($game_player.y+pix*3/4)/pix\n # determines where to move according to the x and y differences\n if dx > 0 && dy > 0 # player is up left\n move_right if !move_lower_right && !move_down\n elsif dx > 0 && dy < 0 # player is down left\n move_right if !move_upper_right && !move_up\n elsif dx < 0 && dy > 0 # player is up right\n move_left if !move_lower_left && !move_down\n elsif dx < 0 && dy < 0 # player is down right\n move_left if !move_upper_left && !move_up\n elsif dx < 0 && dy == 0 # player is right\n move_left\n elsif dx > 0 && dy == 0 # player is left\n move_right\n elsif dx == 0 && dy < 0 # player is down\n move_up\n elsif dx == 0 && dy > 0 # player is up\n move_down\n end\n end", "title": "" }, { "docid": "18fe35f0e63095a3508726f26aed5829", "score": "0.6595122", "text": "def move_away_from_player\n # get pixel movement rate\n pix = BlizzABS.pixel\n # calculates differences in x and y\n dx, dy = @x - ($game_player.x+pix/2)/pix, @y - ($game_player.y+pix*3/4)/pix\n # determines where to move according to the x and y differences\n if dx > 0 && dy > 0 # player is up left\n move_right if !move_lower_right && !move_down\n elsif dx > 0 && dy < 0 # player is down left\n move_right if !move_upper_right && !move_up\n elsif dx < 0 && dy > 0 # player is up right\n move_left if !move_lower_left && !move_down\n elsif dx < 0 && dy < 0 # player is down right\n move_left if !move_upper_left && !move_up\n elsif dx < 0 && dy == 0 # player is right\n move_left\n elsif dx > 0 && dy == 0 # player is left\n move_right\n elsif dx == 0 && dy < 0 # player is down\n move_up\n elsif dx == 0 && dy > 0 # player is up\n move_down\n end\n end", "title": "" }, { "docid": "ecd5b861d9310e5dd4821eb718a93080", "score": "0.6590397", "text": "def move_down\n @position[1] -= 1\n end", "title": "" }, { "docid": "a4cfa2f79cbdaa2b2f3ed4d2614da297", "score": "0.6574167", "text": "def move_up(turn_enabled = true)\n # call superclass method and store result\n result = super\n # update buffer if self is controlled by player\n BlizzABS.player.update_buffer(8) if BlizzABS.player.player == self && result\n # return result\n return result\n end", "title": "" }, { "docid": "a4cfa2f79cbdaa2b2f3ed4d2614da297", "score": "0.6574167", "text": "def move_up(turn_enabled = true)\n # call superclass method and store result\n result = super\n # update buffer if self is controlled by player\n BlizzABS.player.update_buffer(8) if BlizzABS.player.player == self && result\n # return result\n return result\n end", "title": "" }, { "docid": "ceac8457c37bd64f24394a18156fd06d", "score": "0.6565031", "text": "def move_down\n return self if yn + 1 > Vedeu.height\n\n move(y: y + 1, yn: yn + 1)\n end", "title": "" }, { "docid": "4abaaf57356fd173fde21354747952bc", "score": "0.6563585", "text": "def move_up n\n super unless n == 0\n end", "title": "" }, { "docid": "a5aeef59a0f91b8bd877bce3869cb31c", "score": "0.6530387", "text": "def move_up\n @center += Complex( 0, 0.1)* @mag_fact ** @mag\n set_vars\n end", "title": "" }, { "docid": "68c6058f0a666c623f395341db2b448e", "score": "0.6521747", "text": "def moveDown\n end", "title": "" }, { "docid": "aed21181ec46ca9ff1f20d8cdfb85d16", "score": "0.6502104", "text": "def move_toward_player\n # get pixel movement rate\n pix = BlizzABS.pixel\n # calculates differences in x and y\n dx, dy = @x - ($game_player.x+pix/2)/pix, @y - ($game_player.y+pix*3/4)/pix\n # determines where to move according to the x and y differences\n if dx > 0 && dy > 0 # player is up left\n move_left if !move_upper_left && !move_up\n elsif dx > 0 && dy < 0 # player is down left\n move_left if !move_lower_left && !move_down\n elsif dx < 0 && dy > 0 # player is up right\n move_right if !move_upper_right && !move_up\n elsif dx < 0 && dy < 0 # player is down right\n move_right if !move_lower_right && !move_down\n elsif dx < 0 && dy == 0 # player is right\n move_right\n elsif dx > 0 && dy == 0 # player is left\n move_left\n elsif dx == 0 && dy < 0 # player is down\n move_down\n elsif dx == 0 && dy > 0 # player is up\n move_up\n end\n end", "title": "" }, { "docid": "aed21181ec46ca9ff1f20d8cdfb85d16", "score": "0.6502104", "text": "def move_toward_player\n # get pixel movement rate\n pix = BlizzABS.pixel\n # calculates differences in x and y\n dx, dy = @x - ($game_player.x+pix/2)/pix, @y - ($game_player.y+pix*3/4)/pix\n # determines where to move according to the x and y differences\n if dx > 0 && dy > 0 # player is up left\n move_left if !move_upper_left && !move_up\n elsif dx > 0 && dy < 0 # player is down left\n move_left if !move_lower_left && !move_down\n elsif dx < 0 && dy > 0 # player is up right\n move_right if !move_upper_right && !move_up\n elsif dx < 0 && dy < 0 # player is down right\n move_right if !move_lower_right && !move_down\n elsif dx < 0 && dy == 0 # player is right\n move_right\n elsif dx > 0 && dy == 0 # player is left\n move_left\n elsif dx == 0 && dy < 0 # player is down\n move_down\n elsif dx == 0 && dy > 0 # player is up\n move_up\n end\n end", "title": "" }, { "docid": "cf86b49a4e05678e3ead91e6c0f8f2a8", "score": "0.6479387", "text": "def move_cursor_up(params) \n\t\texecute_command(model.cursor_row, model.cursor_col, model.cursor_row - (params[:multiplier] || 1), model.cursor_col, params)\n\tend", "title": "" }, { "docid": "1db8178946b31b1731559658d51590f7", "score": "0.6454328", "text": "def move_up(turn_enabled = true)\r\n # Turn up\r\n if turn_enabled\r\n turn_up\r\n end\r\n # If passable\r\n if passable?(@x, @y, 8)\r\n # Turn up\r\n turn_up\r\n # Update coordinates\r\n @y -= 1\r\n # Increase steps\r\n increase_steps\r\n # If impassable\r\n else\r\n # Determine if touch event is triggered\r\n check_event_trigger_touch(@x, @y-1)\r\n end\r\n end", "title": "" }, { "docid": "52e9f82c11b8a41add5e81d87ff6045f", "score": "0.6429046", "text": "def move_up n\n super unless n == 0\n end", "title": "" }, { "docid": "f8fbc17222d8357826d60e1b5894358b", "score": "0.64212596", "text": "def move_player_on_top player, brick\n player.feet_y = brick.y - 36\n end", "title": "" }, { "docid": "1b0651d45b767f4acd4acf29a6200d42", "score": "0.6409951", "text": "def move_up(turn_enabled = true)\n # Turn up\n if turn_enabled\n turn_up\n end\n # If passable\n if passable?(@x, @y, 8)\n # Turn up\n turn_up\n # Update coordinates\n @y -= 1\n # Increase steps\n increase_steps\n # If impassable\n else\n # Determine if touch event is triggered\n check_event_trigger_touch(@x, @y-1)\n end\n end", "title": "" }, { "docid": "1b0651d45b767f4acd4acf29a6200d42", "score": "0.6409951", "text": "def move_up(turn_enabled = true)\n # Turn up\n if turn_enabled\n turn_up\n end\n # If passable\n if passable?(@x, @y, 8)\n # Turn up\n turn_up\n # Update coordinates\n @y -= 1\n # Increase steps\n increase_steps\n # If impassable\n else\n # Determine if touch event is triggered\n check_event_trigger_touch(@x, @y-1)\n end\n end", "title": "" }, { "docid": "1b0651d45b767f4acd4acf29a6200d42", "score": "0.6409951", "text": "def move_up(turn_enabled = true)\n # Turn up\n if turn_enabled\n turn_up\n end\n # If passable\n if passable?(@x, @y, 8)\n # Turn up\n turn_up\n # Update coordinates\n @y -= 1\n # Increase steps\n increase_steps\n # If impassable\n else\n # Determine if touch event is triggered\n check_event_trigger_touch(@x, @y-1)\n end\n end", "title": "" }, { "docid": "13e8458db3f41633acc621a69764448b", "score": "0.6390903", "text": "def move_up(turn_ok = true)\n if passable?(@x, @y-1) # Passable\n turn_up\n @y = $game_map.round_y(@y-1)\n @real_y = (@y+1)*256\n increase_steps\n @move_failed = false\n else # Impassable\n turn_up if turn_ok\n check_event_trigger_touch(@x, @y-1) # Touch event is triggered?\n @move_failed = true\n end\n end", "title": "" }, { "docid": "84c2f38b6f8bdd4e19c2bf9dd01ef712", "score": "0.63900924", "text": "def move_forward\n case @direction\n when 'NORTH' then (@y_position += 1)\n when 'SOUTH' then (@y_position -= 1)\n when 'EAST' then (@x_position += 1)\n when 'WEST' then (@x_position -= 1)\n end\n end", "title": "" }, { "docid": "964466c1d3bdb510922f2269e76a39e6", "score": "0.6367628", "text": "def move_left\n move_up!\n end", "title": "" }, { "docid": "063f9ab44772742548271af7a1baecfc", "score": "0.635247", "text": "def move_backwards by_how_much = 1\n move_to(self[position_field] - by_how_much) unless first?\n end", "title": "" }, { "docid": "d447ff39371d3e0b8478d513ad014509", "score": "0.63492966", "text": "def up; move_cursor(-@columns); end", "title": "" }, { "docid": "d447ff39371d3e0b8478d513ad014509", "score": "0.63492966", "text": "def up; move_cursor(-@columns); end", "title": "" }, { "docid": "c45996e58993c72fc5e7464c87b0ce62", "score": "0.6340243", "text": "def move_up\n @forum.move_higher\n flash[:notice] = t(:moved_higher, :thing => \"Forum\")\n redirect\n end", "title": "" }, { "docid": "6788a188f31d1158e28ea7fe76e01487", "score": "0.63401407", "text": "def go_up\n\t\t@up = true\n\tend", "title": "" }, { "docid": "318f21d29529cad81366a87112baca39", "score": "0.63280123", "text": "def move_up\n\t\t\tself.survey.node_maps.select { |i|\n\t\t\t\ti.node == self\n\t\t\t}.collect { |node_map|\n\t\t\t\tbegin\n\t\t\t\t\tnode_map.move_left\n\t\t\t\trescue\n\t\t\t\tend\n\t\t\t}\n\t\tend", "title": "" }, { "docid": "33a304f968825760d9ee73efaf1c8ca5", "score": "0.6291361", "text": "def move_away_from_player\n sx = distance_x_from_player\n sy = distance_y_from_player\n if sx != 0 or sy != 0\n if sx.abs > sy.abs # Horizontal distance is longer\n sx > 0 ? move_right : move_left # Prioritize left-right\n if @move_failed and sy != 0\n sy > 0 ? move_down : move_up\n end\n else # Vertical distance is longer\n sy > 0 ? move_down : move_up # Prioritize up-down\n if @move_failed and sx != 0\n sx > 0 ? move_right : move_left\n end\n end\n end\n end", "title": "" }, { "docid": "7e255a726ff755fc8e8abdbf6ea93f2d", "score": "0.62890416", "text": "def up\n @page.move_left\n flash[:notice] = t('pages.moved_up')\n redirect_to(root_path)\n end", "title": "" }, { "docid": "dec6bfac71add0b8cd66dba83b11fefd", "score": "0.62872654", "text": "def move_down!\n @posx += 1\n end", "title": "" }, { "docid": "aa76a68687b10ed1f17454735977ecdd", "score": "0.6281339", "text": "def move_up\n @category.move_higher\n flash[:notice] = t(:moved_higher, :thing => \"Category\")\n redirect\n end", "title": "" }, { "docid": "5d172cb023dc670a1292e70434d47b30", "score": "0.62708294", "text": "def move(direction)\n if direction == 'up' && @pos_x == 1 && @pos_y == 8 # Player in correct position\n PlayerHomeHouse.new(@player,'top').begin\n end\n super\n end", "title": "" }, { "docid": "c20caee1190c0754f7048de4a8d6e945", "score": "0.6270523", "text": "def move_order_up( count = 1 )\n\t\tself.move_order_to( self.send( self.class.acts_as_ordered_order_attribute_name ) - count )\n\tend", "title": "" }, { "docid": "22127a4301cd02bd0b4555bc339ea047", "score": "0.6256263", "text": "def move_higher\n increment_position\n end", "title": "" }, { "docid": "0b66726bbc850b576bc4b7f292645f12", "score": "0.6254649", "text": "def go_up\n @instruction = [:go_up]\n end", "title": "" }, { "docid": "156ac51ebf15dac1553d1268ebb40df0", "score": "0.62457854", "text": "def go_up\n\t\t@current_floor += 1\n\t\tstop_or_not\n\tend", "title": "" }, { "docid": "280a076c7de3355cc204aaf548d35a12", "score": "0.62456435", "text": "def move_forward\n case heading.upcase\n when \"N\"\n @pos_y += 1\n when \"S\"\n @pos_y -= 1\n when \"E\"\n @pos_x += 1\n when \"W\"\n @pos_x -= 1\n end\n end", "title": "" }, { "docid": "463727909cd5e16a1c86d35d2941d730", "score": "0.62351096", "text": "def back_up\n turn_around\n move\n turn_around\n end", "title": "" }, { "docid": "8721afe90c667af6fb4815aac4e15522", "score": "0.62348926", "text": "def pan_up\n @target_y ||= @main_layer.position.y\n @target_y -= 200 * @node.yScale\n end", "title": "" }, { "docid": "82664013f41d3441c7c7e529d828c592", "score": "0.6225223", "text": "def moveDown()\n if (@row < Board::ROWS - 1)\n @row += 1\n end\n end", "title": "" }, { "docid": "96438d922f2544cd635dc10be3c23958", "score": "0.6222325", "text": "def ul; move(@x-1, @y-1) end", "title": "" }, { "docid": "178aa2c9765df3b60b954920fce68830", "score": "0.6189091", "text": "def move_up(board, moves_array, hor, ver)\n up = hor - 1\n if up > 0\n while up > 0 && not_ally?(board, up, ver)\n moves_array.push [up, ver]\n break if enemy?(board, up, ver)\n up -= 1\n end\n end\n end", "title": "" }, { "docid": "4aa3c752524a859d8f3222fddbf0ebc3", "score": "0.617779", "text": "def moveForward\n\t\tif direction == 'N'\n\t\t\t@y += 1\n\t\telsif direction == 'S'\n\t\t\t@y -= 1\n\t\telsif direction == 'E'\n\t\t\t@x += 1\n\t\telsif direction == 'W'\n\t\t\t@x -= 1\n\t\tend\n\tend", "title": "" }, { "docid": "2a89b3bf783451ed598dccbb6054b284", "score": "0.61776054", "text": "def up(size = nil)\n @oy -= 1 unless @oy == 0\n @y -= 1\n @x = size if size && x > size\n\n self\n end", "title": "" }, { "docid": "2a89b3bf783451ed598dccbb6054b284", "score": "0.61776054", "text": "def up(size = nil)\n @oy -= 1 unless @oy == 0\n @y -= 1\n @x = size if size && x > size\n\n self\n end", "title": "" }, { "docid": "b4569af1f8b5542184efa1f91c1b587b", "score": "0.6171801", "text": "def move_down\n return if at_bottom?\n self.siblings.where(position: self.position + 1).first.inc(:position, -1)\n self.inc(:position, 1)\n end", "title": "" }, { "docid": "07f90f6211ebb36c6afdce589efc4763", "score": "0.6152154", "text": "def level_up\r\n if @has_been_eaten\r\n if @has_been_eaten && @player.check_level == 1\r\n @cars[0].speed 1\r\n @insect.get_new_location\r\n @has_been_eaten = false\r\n end\r\n end\r\n end", "title": "" }, { "docid": "258470022ae2f9e6c2a360837c05f1c6", "score": "0.6150722", "text": "def down(distance)\n\t\tmove_y -distance\n\t end", "title": "" }, { "docid": "258470022ae2f9e6c2a360837c05f1c6", "score": "0.6150722", "text": "def down(distance)\n\t\tmove_y -distance\n\t end", "title": "" }, { "docid": "81aec5855f560ff57f863e909f1310ea", "score": "0.6139973", "text": "def move_down\n @speed += [0.0, 0.5].to_vec2d\n end", "title": "" }, { "docid": "6b39deb4a8e910a5c835d7f0a1b034e8", "score": "0.6139199", "text": "def move_up\n @y -= @velocidadeDeMovimento\n\t\t@y = 13 + @radius if @y < 13 + @radius #Limitador do movimento para cima\n\n\t\t@y += @velocidadeDeMovimento if @y >= 56 and @y <= 71 and @x >= 35 and @x <= 59 #Limitação do movimento para cima - 1ª Linha 1° bloco\n\t\t@y += @velocidadeDeMovimento if @y >= 56 and @y <= 71 and @x >= 67 and @x <= 91 #Limitação do movimento para cima - 1ª Linha 2° bloco\n\t\t@y += @velocidadeDeMovimento if @y >= 56 and @y <= 71 and @x >= 99 and @x <= 123 #Limitação do movimento para cima - 1ª Linha 3° bloco\n\t\t@y += @velocidadeDeMovimento if @y >= 56 and @y <= 71 and @x >= 131 and @x <= 155 #Limitação do movimento para cima - 1ª Linha 4° bloco\n\t\t@y += @velocidadeDeMovimento if @y >= 56 and @y <= 71 and @x >= 163 and @x <= 187 #Limitação do movimento para cima - 1ª Linha 5° bloco\n\t\t@y += @velocidadeDeMovimento if @y >= 56 and @y <= 71 and @x >= 195 and @x <= 219 #Limitação do movimento para cima - 1ª Linha 6° bloco\n\n\t\t@y += @velocidadeDeMovimento if @y >= 88 and @y <= 103 and @x >= 35 and @x <= 59 #Limitação do movimento para cima - 2ª Linha 1° bloco\n\t\t@y += @velocidadeDeMovimento if @y >= 88 and @y <= 103 and @x >= 67 and @x <= 91 #Limitação do movimento para cima - 2ª Linha 2° bloco\n\t\t@y += @velocidadeDeMovimento if @y >= 88 and @y <= 103 and @x >= 99 and @x <= 123 #Limitação do movimento para cima - 2ª Linha 3° bloco\n\t\t@y += @velocidadeDeMovimento if @y >= 88 and @y <= 103 and @x >= 131 and @x <= 155 #Limitação do movimento para cima - 2ª Linha 4° bloco\n\t\t@y += @velocidadeDeMovimento if @y >= 88 and @y <= 103 and @x >= 163 and @x <= 187 #Limitação do movimento para cima - 2ª Linha 5° bloco\n\t\t@y += @velocidadeDeMovimento if @y >= 88 and @y <= 103 and @x >= 195 and @x <= 219 #Limitação do movimento para cima - 2ª Linha 6° bloco\n\n\t\t@y += @velocidadeDeMovimento if @y >= 110 and @y <= 135 and @x >= 35 and @x <= 59 #Limitação do movimento para cima - 3ª Linha 1° bloco\n\t\t@y += @velocidadeDeMovimento if @y >= 110 and @y <= 135 and @x >= 67 and @x <= 91 #Limitação do movimento para cima - 3ª Linha 2° bloco\n\t\t@y += @velocidadeDeMovimento if @y >= 110 and @y <= 135 and @x >= 99 and @x <= 123 #Limitação do movimento para cima - 3ª Linha 3° bloco\n\t\t@y += @velocidadeDeMovimento if @y >= 110 and @y <= 135 and @x >= 131 and @x <= 155 #Limitação do movimento para cima - 3ª Linha 4° bloco\n\t\t@y += @velocidadeDeMovimento if @y >= 110 and @y <= 135 and @x >= 163 and @x <= 187 #Limitação do movimento para cima - 3ª Linha 5° bloco\n\t\t@y += @velocidadeDeMovimento if @y >= 110 and @y <= 135 and @x >= 195 and @x <= 219 #Limitação do movimento para cima - 3ª Linha 6° bloco\n\n\t\t@y += @velocidadeDeMovimento if @y >= 142 and @y <= 167 and @x >= 35 and @x <= 59 #Limitação do movimento para cima - 4ª Linha 1° bloco\n\t\t@y += @velocidadeDeMovimento if @y >= 142 and @y <= 167 and @x >= 67 and @x <= 91 #Limitação do movimento para cima - 4ª Linha 2° bloco\n\t\t@y += @velocidadeDeMovimento if @y >= 142 and @y <= 167 and @x >= 99 and @x <= 123 #Limitação do movimento para cima - 4ª Linha 3° bloco\n\t\t@y += @velocidadeDeMovimento if @y >= 142 and @y <= 167 and @x >= 131 and @x <= 155 #Limitação do movimento para cima - 4ª Linha 4° bloco\n\t\t@y += @velocidadeDeMovimento if @y >= 142 and @y <= 167 and @x >= 163 and @x <= 187 #Limitação do movimento para cima - 4ª Linha 5° bloco\n\t\t@y += @velocidadeDeMovimento if @y >= 142 and @y <= 167 and @x >= 195 and @x <= 219 #Limitação do movimento para cima - 4ª Linha 6° bloco\n\n\t\t@y += @velocidadeDeMovimento if @y >= 174 and @y <= 199 and @x >= 35 and @x <= 59 #Limitação do movimento para cima - 5ª Linha 1° bloco\n\t\t@y += @velocidadeDeMovimento if @y >= 174 and @y <= 199 and @x >= 67 and @x <= 91 #Limitação do movimento para cima - 5ª Linha 2° bloco\n\t\t@y += @velocidadeDeMovimento if @y >= 174 and @y <= 199 and @x >= 99 and @x <= 123 #Limitação do movimento para cima - 5ª Linha 3° bloco\n\t\t@y += @velocidadeDeMovimento if @y >= 174 and @y <= 199 and @x >= 131 and @x <= 155 #Limitação do movimento para cima - 5ª Linha 4° bloco\n\t\t@y += @velocidadeDeMovimento if @y >= 174 and @y <= 199 and @x >= 163 and @x <= 187 #Limitação do movimento para cima - 5ª Linha 5° bloco\n\t\t@y += @velocidadeDeMovimento if @y >= 174 and @y <= 199 and @x >= 195 and @x <= 219 #Limitação do movimento para cima - 5ª Linha 6° bloco\n end", "title": "" }, { "docid": "ea0b7232f59f3d4bd2a9723cfd5630d9", "score": "0.613734", "text": "def update()\n self.move()\n end", "title": "" }, { "docid": "4ec2b62920568947ee6bf7814277007c", "score": "0.6135128", "text": "def move_up\n authorize @workshop\n @session = @workshop.session\n unless @workshop.position == 1\n previous_workshop = @session.workshops.where(position: @workshop.position - 1).first\n previous_workshop.update(position: @workshop.position)\n @workshop.update(position: (@workshop.position - 1))\n end\n @workshop.save\n respond_to do |format|\n format.html {redirect_to training_session_path(@workshop.session.training, @workshop.session)}\n format.js\n end\n end", "title": "" }, { "docid": "fb8ca56af39aacc993e48818ef81ca20", "score": "0.6130206", "text": "def cursor_move_up\n\t\tif @cursor[1] > min_row\n\t\t\tcursor_move(SUB_UP)\n\t\t\treprint\n\t\tend\n\tend", "title": "" }, { "docid": "ff9c3f4a5e2787e71b54f77a333ed30c", "score": "0.61194545", "text": "def move_forward\n\t\tcase @facing_direction\n\n\t\twhen NORTH\n\t\t\t@y_position += 1\n\t\twhen WEST\n\t\t\t@x_position -= 1\n\t\twhen EAST\n\t\t\t@x_position += 1\n\t\twhen SOUTH\n\t\t\t@y_position -= 1\n\t\tend\n\tend", "title": "" } ]
ecab10ddd6df24b44f04699c071ee53d
GET /loan_histories GET /loan_histories.json
[ { "docid": "904ea91abe958d0e7441cf73fc3ff6d0", "score": "0.0", "text": "def index\n @loan_histories = PackageRequest.where(:user_id => current_user.id)\n @loan_histories = if params[:loan_history]\n PackageRequest.joins(:item).where('item_name LIKE ? OR loan_date LIKE ?', \"%#{params[:loan_history]}%\", \"%#{params[:loan_history]}%\").where(:user_id => current_user.id)\n else\n PackageRequest.where(:user_id => current_user.id)\n end\n end", "title": "" } ]
[ { "docid": "e10e1e19ef6b0927b20fcbc5e1326efb", "score": "0.7526698", "text": "def index\n @loan_histories = LoanHistory.where(user_id: current_user.id)\n end", "title": "" }, { "docid": "06f1ec0735f80bfd83fd8dd18e24f5de", "score": "0.7277848", "text": "def show\n @loan_history = LoanHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @loan_history }\n end\n end", "title": "" }, { "docid": "9a6be4f06edf5579a1bfa5e6d060804b", "score": "0.7096807", "text": "def index\n @histories = History.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @histories }\n end\n end", "title": "" }, { "docid": "b5aa17ea705268fec4a7aac33e0d77ee", "score": "0.704845", "text": "def index\n # @loans = Loan.all\n @loans = user_capabilities(Loan) #.recent_loans\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @loans }\n end\n end", "title": "" }, { "docid": "a78d66e835b8f13d4f39b1c558977836", "score": "0.6891112", "text": "def index\n #@loans = Loan.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @loans }\n end\n end", "title": "" }, { "docid": "5fd4fb00a8f3b71e68cd04c5137ed777", "score": "0.6831866", "text": "def index\n @loan_details = LoanDetail.all\n end", "title": "" }, { "docid": "0b7411958e1a02200136c0f6eb46ae7e", "score": "0.68275845", "text": "def index\n @histories = History.all\n respond_with(@histories)\n end", "title": "" }, { "docid": "c4dd7f7bd2d643b741bc550c79ebcc30", "score": "0.6810827", "text": "def new\n @loan_history = LoanHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @loan_history }\n end\n end", "title": "" }, { "docid": "f7356718039a4f18d1ad4c74fee90212", "score": "0.6765574", "text": "def index\n @historials = Historial.all\n end", "title": "" }, { "docid": "74a282db223033e3611382623cb708f0", "score": "0.6755685", "text": "def index\n @borrowing_histories = BorrowingHistory.all\n end", "title": "" }, { "docid": "74a282db223033e3611382623cb708f0", "score": "0.6755685", "text": "def index\n @borrowing_histories = BorrowingHistory.all\n end", "title": "" }, { "docid": "f31eb58a49bfc617148b955ea6bea6b9", "score": "0.6705554", "text": "def index\n @loan_payments = LoanPayment.all\n render json: @loan_payments, status: :ok\n end", "title": "" }, { "docid": "d557de39816e9b81d341c1d31910312a", "score": "0.66964376", "text": "def index\n @bank_histories = BankHistory.all\n end", "title": "" }, { "docid": "42789c796012369923ecd47f442cbdf4", "score": "0.66939265", "text": "def index\n @page = \"histories\"\n\n if user_signed_in?\n @histories = History.where(\"user_id = ? and executed_date > chosen_date and tour_id > 0\", current_user.id).order(\"executed_date DESC\").paginate(:per_page => 12, :page => params[:page])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @histories }\n end\n end", "title": "" }, { "docid": "9e6abfabe3cd046d6c38b0b48078ca10", "score": "0.6679892", "text": "def index\n @payment_histories = PaymentHistory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @payment_histories }\n end\n end", "title": "" }, { "docid": "523147502cf6a5764756dfe137a8d98f", "score": "0.6675398", "text": "def index\n @histories = History.all\n end", "title": "" }, { "docid": "523147502cf6a5764756dfe137a8d98f", "score": "0.6675398", "text": "def index\n @histories = History.all\n end", "title": "" }, { "docid": "5cff0f923b1c288b78db775059902447", "score": "0.6644371", "text": "def show\n @loan = Loan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @loan }\n end\n end", "title": "" }, { "docid": "5cff0f923b1c288b78db775059902447", "score": "0.6644371", "text": "def show\n @loan = Loan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @loan }\n end\n end", "title": "" }, { "docid": "5cff0f923b1c288b78db775059902447", "score": "0.6644371", "text": "def show\n @loan = Loan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @loan }\n end\n end", "title": "" }, { "docid": "ff7fe24cee39ea71bff8e0a460b45212", "score": "0.6626098", "text": "def index\n @response_histories = ResponseHistory.all\n end", "title": "" }, { "docid": "4a0fe91dd29a52a62ab6c98279bfae6b", "score": "0.6623416", "text": "def set_loan_history\n @loan_history = LoanHistory.find(params[:id])\n end", "title": "" }, { "docid": "4a0fe91dd29a52a62ab6c98279bfae6b", "score": "0.6623416", "text": "def set_loan_history\n @loan_history = LoanHistory.find(params[:id])\n end", "title": "" }, { "docid": "61a02a5beb157a3f144f28d261314f34", "score": "0.6623247", "text": "def index\n @loans = Loan.all\n end", "title": "" }, { "docid": "61a02a5beb157a3f144f28d261314f34", "score": "0.6623247", "text": "def index\n @loans = Loan.all\n end", "title": "" }, { "docid": "61a02a5beb157a3f144f28d261314f34", "score": "0.6623247", "text": "def index\n @loans = Loan.all\n end", "title": "" }, { "docid": "61a02a5beb157a3f144f28d261314f34", "score": "0.6623247", "text": "def index\n @loans = Loan.all\n end", "title": "" }, { "docid": "61a02a5beb157a3f144f28d261314f34", "score": "0.6623247", "text": "def index\n @loans = Loan.all\n end", "title": "" }, { "docid": "61a02a5beb157a3f144f28d261314f34", "score": "0.6623247", "text": "def index\n @loans = Loan.all\n end", "title": "" }, { "docid": "257b0dbca83fc3b40eab0cb6ad6fd4f6", "score": "0.6611431", "text": "def index\n history = @user.histories\n histories = []\n @user.histories.each do |history|\n histories << { place_type: history.place_type, name: history.name, date: history.created_at.to_date }\n end\n render json: histories, status: 200\n end", "title": "" }, { "docid": "210d5a14b3d819092a611b3b837a16cb", "score": "0.6600415", "text": "def index\n render json: Payment.where(loan_id: params[:loan_id])\n end", "title": "" }, { "docid": "dbcfb04bf5ac3733d7dd982a9882fec2", "score": "0.658626", "text": "def index\n @histories = RewardHistory.all\n Rabl.render(@histories, 'api/reward_histories/index', view_path: 'app/views')\n end", "title": "" }, { "docid": "73f732f51e54cea63f859bc11d0cda0f", "score": "0.65638524", "text": "def index\n @areaing_histories = AreaingHistory.all\n end", "title": "" }, { "docid": "63b24f315059ef5736f538e811e2744f", "score": "0.65569925", "text": "def index\n @borrowhistories = Borrowhistory.all\n end", "title": "" }, { "docid": "3efa35575dd9fa3c899a819ddaccee7c", "score": "0.653739", "text": "def histories_show\n @gallery = Gallery.find(params[:id])\n @ads = @gallery.ads\n @history_info = @ads.map do |ad|\n has_seen_total = ad.histories.count { |e| e.has_been_seen == true }\n has_notseen_total = ad.histories.count { |e| e.has_been_seen == false }\n total = has_seen_total + has_notseen_total\n history = {\n has_seen_total: has_seen_total,\n has_notseen_total: has_notseen_total,\n total: total\n }\n\n end\n\n if @history_info\n render json: {\n gallery: @gallery,\n ads: @ads,\n history_info: @history_info,\n }\n else\n render json: {\n status: 500,\n errors: ['no histories found']\n }\n end\n end", "title": "" }, { "docid": "eee1e9398e1ccb684b5483ab8eb9fb32", "score": "0.6520864", "text": "def index\n @login_histories = LoginHistory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @login_histories }\n end\n end", "title": "" }, { "docid": "e2042af2ae0d368a9599288e0fc74b56", "score": "0.65047175", "text": "def index\n @personal_histories = PersonalHistory.all\n end", "title": "" }, { "docid": "e324f057526a5567e48553885a122a1c", "score": "0.64997786", "text": "def show\n @on_loan = OnLoan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @on_loan }\n end\n end", "title": "" }, { "docid": "c007aa32137b3fcc21a0df8dee24e402", "score": "0.64766794", "text": "def index\n @auditories = Auditory.all\n end", "title": "" }, { "docid": "ac7c3712d4f581d4f9203a60fdbdd8f9", "score": "0.64707327", "text": "def show\n @historial_odc = HistorialOdc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @historial_odc }\n end\n end", "title": "" }, { "docid": "bbb4d4a10af0a015669877e26724a741", "score": "0.6468089", "text": "def show\n @pur_hist = PurHist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pur_hist }\n end\n end", "title": "" }, { "docid": "03bbe53d87f028cc392ae43c2d05a5ce", "score": "0.6461735", "text": "def index\n @batting_histories = BattingHistory.all\n end", "title": "" }, { "docid": "b8c9eca9bc38052fcb5bcea4087df9c2", "score": "0.64594144", "text": "def index\n @hills = Hill.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @hills }\n end\n end", "title": "" }, { "docid": "163196befbd72c8875e8caf0aac29c40", "score": "0.6455433", "text": "def index\n @histories = History.all_by_user(current_user).order_by_happened_at\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @histories }\n end\n end", "title": "" }, { "docid": "1659236063be8eb24fdbb80e301eecaa", "score": "0.6452092", "text": "def index\n @penarikan_histories = PenarikanHistory.all\n end", "title": "" }, { "docid": "301ab72aef32e6dd486f955e90edc509", "score": "0.64485085", "text": "def index\n @book_loans = BookLoan.all\n end", "title": "" }, { "docid": "c6d96256d0f0429b326492a4c480fbfc", "score": "0.64456433", "text": "def index\n @loan_requests = LoanRequest.all\n end", "title": "" }, { "docid": "f3b074d0696cbcaba7111cbec5caaf48", "score": "0.6445219", "text": "def index\n @loans = Loan.all\n @loan = Loan.new\n end", "title": "" }, { "docid": "cdc0f6c37dac35faef5ddb6d4f366cde", "score": "0.6440423", "text": "def show\n @loan = Loan.status('all').find(params[:id])\n @pictures = @loan.featured_pictures(5) # for slideshow\n @other_loans = @loan.cooperative.loans.status('all').order(\"SigningDate DESC\") if @loan.cooperative\n @repayments = @loan.repayments.order('DateDue')\n\n respond_to do |format|\n format.html\n format.json { render :json => @loan }\n end\n end", "title": "" }, { "docid": "0c05ecca150ac4177ee057d33b0c4013", "score": "0.6437112", "text": "def index\n @histories = History.where(approved: true).paginate(page: params[:page])\n\n end", "title": "" }, { "docid": "44dfc6ad98e6b119733be73a1be73b44", "score": "0.6427104", "text": "def by_loan_id\n loan_payments = LoanPayment.where(loan_id: params[:loan_id])\n if loan_payments.count > 0\n render json: loan_payments, status: :ok\n else\n render json: 'not_found', status: :not_found\n end\n \n end", "title": "" }, { "docid": "b9981689319e6da93359e01c5c408b88", "score": "0.6413984", "text": "def show\n @histories = @user.histories.order(created_at: :DESC)\n end", "title": "" }, { "docid": "9251321db06f4f84b714f979e4f1d04b", "score": "0.6407904", "text": "def show\n @loan_detail = LoanDetail.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @loan_detail }\n end\n end", "title": "" }, { "docid": "fe02d9d21dad914db1bad9547117eeae", "score": "0.6406159", "text": "def index\n @account_histories = AccountHistory.all\n end", "title": "" }, { "docid": "deaa3a9992523b5c22c312746b5e233b", "score": "0.63746715", "text": "def index\n @histories = index_page\n end", "title": "" }, { "docid": "d73ee3badbfe5e5a5920a7b1f7f6ed73", "score": "0.637446", "text": "def index\n @histories = History.paginate(page: params[:page], per_page: 7)\n end", "title": "" }, { "docid": "d320ff5ed7bc3e289517669037e5a63e", "score": "0.6369877", "text": "def index\n @personal_histories = @patient.personal_histories.all\n end", "title": "" }, { "docid": "cf2244fc39abad20d3735536d24f7f89", "score": "0.63591033", "text": "def show\n @books_on_loan = BooksOnLoan.find(params[:id])\n respond_to do |format|\n format.json { render json: @books_on_loan }\n end\n end", "title": "" }, { "docid": "2cc5891c8f234c58e574951f20e56493", "score": "0.6343191", "text": "def index\n @book_histories = BookHistory.all\n end", "title": "" }, { "docid": "2cc5891c8f234c58e574951f20e56493", "score": "0.6343191", "text": "def index\n @book_histories = BookHistory.all\n end", "title": "" }, { "docid": "9b0950ae3af9bbba1c2ff332ba9f10a9", "score": "0.6338692", "text": "def show\n @loan_detail = LoanDetail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @loan_detail }\n end\n end", "title": "" }, { "docid": "4068236abdea4c3976139af5a373c6b4", "score": "0.6322748", "text": "def history\n if login?\n @histories = SearchHistory.where(user_id: current_user.id)\n .limit(LIMIT)\n .order(updated_at: :desc)\n render :index\n else\n render json: {}, status: 200\n end\n end", "title": "" }, { "docid": "c4ef8f9786b9279251e130e09896d29e", "score": "0.63194704", "text": "def index\n #@applicant_education_histories = ApplicantEducationHistory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @applicant_education_histories }\n end\n end", "title": "" }, { "docid": "c54487d03b91544d0f4fde7596dd1b03", "score": "0.63174963", "text": "def index\n @personal_loans = PersonalLoan.all\n end", "title": "" }, { "docid": "1a2a355126c4e56464acb24476a30023", "score": "0.63116556", "text": "def index\n\t \t@histories = History.all\n\t \t@histories = @histories.search(params[:search]) if params[:search].present? \n\tend", "title": "" }, { "docid": "bac46b32a8da4c87772cfd5336386147", "score": "0.63072413", "text": "def index\n loans = Loan.where(book_id: params[:book_id], created_at: params.require(:from)...params.require(:to)).preload(:account)\n render json: loans, each_serializer: LoanSerializer, include: [:account]\n end", "title": "" }, { "docid": "0887871c6667a471d508a5dc745013ed", "score": "0.63009626", "text": "def index\n @historians = Historian.all\n end", "title": "" }, { "docid": "9885f3a5f7c14e2d4b51b9798cbc375d", "score": "0.6290333", "text": "def index\n @parkinghistories = Parkinghistory.all\n end", "title": "" }, { "docid": "331e3b32f39f71ade05946ef56e50d75", "score": "0.62899834", "text": "def index\n @search_histories = SearchHistory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @search_histories }\n end\n end", "title": "" }, { "docid": "bb43902b83acb5f78f271618bbc787c7", "score": "0.62844014", "text": "def show\n @loans = @loan_search.loans\n\n respond_to do | format |\n format.html { render 'loans/index' }\n end\n end", "title": "" }, { "docid": "4b3b10927a24b5c75bfe1cd83de2d90f", "score": "0.62739724", "text": "def index\n @loyal = Loyal.all\n \n end", "title": "" }, { "docid": "127800af5bde646d241d5e844325c46d", "score": "0.6273942", "text": "def index\n @interlibrary_loans = InterlibraryLoan.all\n end", "title": "" }, { "docid": "a6ed756aab783e0d763e4200184ec2bb", "score": "0.62672734", "text": "def show\n @loan = @customer.loans.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @loan }\n end\n end", "title": "" }, { "docid": "c8f47c154541abfbcf20f81e7e6b6d5f", "score": "0.62617195", "text": "def index\n @payments = @loan.payments.order(\"loan_id\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @payments }\n end\n end", "title": "" }, { "docid": "074ad71f26d43366234bd755bc701456", "score": "0.6257539", "text": "def index\n @loan_lenders = LoanLender.all\n end", "title": "" }, { "docid": "a55454bf61ca58d8245417a94838f360", "score": "0.6257462", "text": "def index\n @employment_histories = @person.employment_histories\n end", "title": "" }, { "docid": "6a8799e8fa0e88d50a0ebda8f18624b1", "score": "0.62497884", "text": "def index\n @battery_histories = BatteryHistory.all\n end", "title": "" }, { "docid": "dc20207785085c2de258a662375ef10f", "score": "0.6232006", "text": "def index\n @loan_payments = LoanPayment.all\n end", "title": "" }, { "docid": "b6afb841182e4df7857a81c66e3eff0a", "score": "0.62303555", "text": "def index\n @animal_histories = AnimalHistory.all.page params[:page]\n end", "title": "" }, { "docid": "f4f926cc2a1de8e14b99a1c3f11a0491", "score": "0.62251323", "text": "def index\n @thermostat_histories = current_user.thermostat_histories.all\n end", "title": "" }, { "docid": "f4f926cc2a1de8e14b99a1c3f11a0491", "score": "0.62251323", "text": "def index\n @thermostat_histories = current_user.thermostat_histories.all\n end", "title": "" }, { "docid": "3ec9fce20e219d1f8f5f4070b1e87eaf", "score": "0.622099", "text": "def index\n @histories = History.paginate(page: params[:page]).order('created_at DESC')\n end", "title": "" }, { "docid": "c336aebb54ccec332e80dfc697b98139", "score": "0.6217376", "text": "def index\n sort_and_search(Loan.all)\n @search_path = loans_path\n\n authorize Loan\n end", "title": "" }, { "docid": "71b0504520d008751b9946bfc4258c38", "score": "0.6217297", "text": "def index\n @perchase_histories = PerchaseHistory.all\n end", "title": "" }, { "docid": "e40dd7d44d791cdcb81c68d191af2aa5", "score": "0.61933076", "text": "def index\n @thong_bao_lop_hocs = @lop_mon_hoc.thong_bao_lop_hocs\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @thong_bao_lop_hocs }\n end\n end", "title": "" }, { "docid": "5e786d13de8596fe72b157939cf1ffdf", "score": "0.61916715", "text": "def new\n @loan = Loan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @loan }\n end\n end", "title": "" }, { "docid": "5e786d13de8596fe72b157939cf1ffdf", "score": "0.61916715", "text": "def new\n @loan = Loan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @loan }\n end\n end", "title": "" }, { "docid": "5e786d13de8596fe72b157939cf1ffdf", "score": "0.61916715", "text": "def new\n @loan = Loan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @loan }\n end\n end", "title": "" }, { "docid": "0f7b182154dabf278e40660977861fa7", "score": "0.6182369", "text": "def new\n @historial_odc = HistorialOdc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @historial_odc }\n end\n end", "title": "" }, { "docid": "8ff90f4466c1d1da00ce5d20408dbb29", "score": "0.61814195", "text": "def get_wiki_histories(wiki_id, params = {})\n get(\"wikis/#{wiki_id}/history\", params)\n end", "title": "" }, { "docid": "50ff46bf41858ea64a50027a3819ef05", "score": "0.6180563", "text": "def index\n @sulabh_loan_offers = SulabhLoanOffer.all\n end", "title": "" }, { "docid": "c403dd0e616366573221b8dec04eb35e", "score": "0.61667484", "text": "def index\n @loan_access_typologies = LoanAccessTypology.all\n end", "title": "" }, { "docid": "848b2fd40b78a6525272532a1c8aeaaa", "score": "0.6164395", "text": "def history\n historical_data = DrainHistory.all\n render :json => {:history => historical_data}\n end", "title": "" }, { "docid": "2518cb058e145adb2c753ff32bea3721", "score": "0.6159691", "text": "def index\n @item_histories = ItemHistory.paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @item_histories }\n end\n end", "title": "" }, { "docid": "b202ed4627a346274a060aa1e6d62efd", "score": "0.61445963", "text": "def index\n @fund_histories = FundHistory.all\n end", "title": "" }, { "docid": "b6b3210974faee699ce045e203b2c937", "score": "0.61425084", "text": "def show\r\n @applied_loan = AppliedLoan.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @applied_loan }\r\n end\r\n end", "title": "" }, { "docid": "9d61531f4b872efd53e180dde311b4d4", "score": "0.61425066", "text": "def index\n @bills = Bill.all.to_a\n render json: @bills\n end", "title": "" }, { "docid": "089f634bc47750e772bcd72216b1c17b", "score": "0.614185", "text": "def index\n @per_page = params[:per_page].present? ? params[:per_page].to_i : 100\n\n @hd_ggk = current_user.ggks.find params[:ggk_id]\n @hd_ggk_histories = @hd_ggk.ggk_histories\n\n if params[:prize]\n @histories = @hd_ggk.ggk_histories.where(\"prize is not null\").order(\"hd_ggk_histories.updated_at desc\").page([params[:page].to_i,1].max).per(@per_page)\n else\n @histories = @hd_ggk.ggk_histories.order(\"hd_ggk_histories.updated_at desc\").page([params[:page].to_i,1].max).per(@per_page)\n end\n\n\t\t@cnt_all = @hd_ggk.ggk_histories.count\n\t\t@cnt_got_prize = @hd_ggk.ggk_histories.where(\"prize is not null\").count\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @hd_ggk_histories }\n end\n end", "title": "" }, { "docid": "f9e673ab2c6647e25412aeaa55ba7a88", "score": "0.613443", "text": "def new\n @pur_hist = PurHist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pur_hist }\n end\n end", "title": "" }, { "docid": "c1c07cb0962ff3af3ef3e34b40ee94b8", "score": "0.6126166", "text": "def loans\n # retrieve logs of type book_loan, performed by the current user and apply params filter\n @q = Log.book_loan.includes(:book).where(user: current_user).ransack(params[:q])\n # apply pagination to the result above\n @loans = @q.result.paginate(page: params[:page], per_page: 20).order(id: :desc)\n end", "title": "" }, { "docid": "e71c56759d4436ce140d03940aaf63aa", "score": "0.61181045", "text": "def index\n @horesases = Horesase.all\n @horesase_boys = Kaminari.paginate_array(JSON.parse(fetch_meigens)).page(params[:page]).per(50)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @horesases }\n end\n end", "title": "" } ]
19ebba5a5cc49eaa0d71e661d0baa14d
GET /accountabilities GET /accountabilities.json
[ { "docid": "150158c25f22a4038cb24995a631d09b", "score": "0.6871437", "text": "def index\n @user = User.all\n @accountabilities = Accountability.all\n end", "title": "" } ]
[ { "docid": "b32ad550e81e2b6784d3bcfb0dfecf53", "score": "0.7099316", "text": "def index\n @abilities = @user.abilities\n end", "title": "" }, { "docid": "3b4c4eabe0f28bbccfd168e544c4b696", "score": "0.7049832", "text": "def available_achievements\n render json: achievements\n end", "title": "" }, { "docid": "f98b4ff343112030dba47e4447bc0277", "score": "0.7021019", "text": "def abilities\n render json: AbilitySerializer.new(Hero.find(params[:id]).abilities).serialized_json\n end", "title": "" }, { "docid": "81320de134bc26b1fcf7b815fe64d535", "score": "0.6992225", "text": "def abilities\n render_response(Hero.get_abilities(params[:id]))\n end", "title": "" }, { "docid": "1b13a37a59b8b1ef69adbbce6048ff3d", "score": "0.67136127", "text": "def ability_json_key; :abilities; end", "title": "" }, { "docid": "73ea72710690aeac1d5c3b94aaa2f98f", "score": "0.6684335", "text": "def index\n @user = User.find(session[:user_id])\n @achievements = @user.achievements\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @achievements }\n end\n end", "title": "" }, { "docid": "3d3ff04ef8494c8c36fbe48c94bdaeb2", "score": "0.6587049", "text": "def accounts\n get(ROBINHOOD_ACCOUNTS_ROUTE, return_as_json: true)\n end", "title": "" }, { "docid": "b524977865c70a4995d280130cd835f4", "score": "0.6537881", "text": "def show\n @accountability_log = AccountabilityLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @accountability_log }\n end\n end", "title": "" }, { "docid": "fea0e747768cc2c9390327bf2d4dde00", "score": "0.6474549", "text": "def index\n @user_abilities = UserAbility.all\n end", "title": "" }, { "docid": "07bcc33d5c51aa86ecb722ddcecd0fff", "score": "0.6444503", "text": "def show\n @contractor_ability = ContractorAbility.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contractor_ability }\n end\n end", "title": "" }, { "docid": "3aed9bd4448e1b5e8bbd1f35a07962e7", "score": "0.6438789", "text": "def list\n if current_user\n accounts = current_user.accounts\n render json: { accounts: accounts }, status: :ok\n else\n render json: { error: I18n.t('request.forbidden') }, status: :forbidden\n end\n end", "title": "" }, { "docid": "ca863cb0daac453cb713dbb5798fef5d", "score": "0.6385514", "text": "def index\n accounts = current_user.accounts\n render :json => accounts\n end", "title": "" }, { "docid": "d5abafca2d87dba00a1d010f5ce2871e", "score": "0.6372135", "text": "def index\n @character_abilities = CharacterAbility.all\n end", "title": "" }, { "docid": "35d945ea9922f5cba827f21319a58add", "score": "0.63305205", "text": "def get_achievements\n response = get(PATH, nil)\n response_body = JSON.parse(response.body, symbolize_names: true)\n achievements = []\n error_message = nil\n\n if response.success?\n response_body.each do |achievement_hash|\n achievements << GameServer::Model::Achievement.new(achievement_hash[:name], achievement_hash[:description], achievement_hash[:image_url])\n end\n else\n error_message = response_body[:error_message]\n end\n\n return GameServer::Admin::Response::GetAchievementsResponse.new(response.success?, error_message, achievements)\n end", "title": "" }, { "docid": "ffb4a188b3c769da8a88a1918ef73fb0", "score": "0.63147366", "text": "def index\n @achievements = Achievement.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @achievements }\n end\n end", "title": "" }, { "docid": "c04e77c6b10c3a25d2a4e6e26d34a1af", "score": "0.6281335", "text": "def index\n @user_abilities = UserAbility.where user: @user\n end", "title": "" }, { "docid": "8a6bb73ac7e29146177a045fdc28b351", "score": "0.6269353", "text": "def index\n @ability_scores = AbilityScore.all\n @abilities = params[:ability] ? [params[:ability]] : [ \"Strength\", \"Intelligence\", \"Wisdom\", \"Dexterity\", \"Constitution\", \"Charisma\" ]\n end", "title": "" }, { "docid": "e57e2cc85815b93c970c911c3e73a229", "score": "0.62682974", "text": "def index\n render status: 403\n return\n @accounts = Account.page(params[:page]).per(params[:per])\n render json: @accounts\n end", "title": "" }, { "docid": "c898bc7d8a10da9985128e66ff6e4765", "score": "0.625804", "text": "def index\n @accounts = current_user.accounts.all\n\n render json: @accounts\n end", "title": "" }, { "docid": "fdcf71b35c45dbda61464aed180b9361", "score": "0.6226799", "text": "def index\n @profiles = Profile.accessible_by(current_ability).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @profiles }\n end\n end", "title": "" }, { "docid": "3693a5c3cf23fabb550b580d45a0e22c", "score": "0.6225796", "text": "def achievement\n render json: @achievement\n end", "title": "" }, { "docid": "ef0970221c5b321cef5a9a1677b52277", "score": "0.62177736", "text": "def index\n @users = User.accessible_by(current_ability)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "title": "" }, { "docid": "68adbe51d57c0dec6c020c65f2bc3646", "score": "0.6184046", "text": "def index\n @associatied_accounts = AssociatiedAccount.all\n render json: {items: @associatied_accounts}\n end", "title": "" }, { "docid": "4f70d2b4406d78112af80a77e9012fcb", "score": "0.61791503", "text": "def show\n @accountabilityagent = Accountabilityagent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @accountabilityagent }\n end\n end", "title": "" }, { "docid": "0a00aa6fcf80109a561da267defd27ca", "score": "0.61746085", "text": "def index\n @accounts = current_user.person.android_accounts\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @accounts }\n end\n end", "title": "" }, { "docid": "0d9f72b4691500b00e1834a716bb0ec6", "score": "0.61690605", "text": "def assets_and_liabilities\n RubyRedtail::Query.run(\"contacts/#{contact_id}/assets-liabilities\", @api_hash, \"GET\")\n end", "title": "" }, { "docid": "6f9bbb02052e48883bc9229724ca4e70", "score": "0.6163178", "text": "def index\n @achievements = Achievement.order([:name, :stage])\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_achievements }\n end\n end", "title": "" }, { "docid": "7e33b1166a30bd7d9561cd9b71c8e0cd", "score": "0.6151892", "text": "def index\n @accounts = Account.all\n render json: @accounts\n end", "title": "" }, { "docid": "502817f4e7ede4bb9f20ce723cfdd2c8", "score": "0.61469054", "text": "def show\n @avaliability = Avaliability.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @avaliability }\n end\n end", "title": "" }, { "docid": "1694262b1dceda551c2b130da89bc6ce", "score": "0.6136768", "text": "def show\n @accountability_log_detail = AccountabilityLogDetail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @accountability_log_detail }\n end\n end", "title": "" }, { "docid": "df9c62fa4a57c69a78ef4b1e410db61a", "score": "0.6134709", "text": "def index\n @accounts = Account.all\n\n render json: @accounts\n end", "title": "" }, { "docid": "2cf1e490e3ec78e7aed6f9c8a5ffa88d", "score": "0.61257356", "text": "def index\n @accounts = current_user.person.win_mob_accounts\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @accounts }\n end\n end", "title": "" }, { "docid": "7c061c047c6e5efe76c6ab752f5f559a", "score": "0.6114121", "text": "def index\n @accountabilityagents = Accountabilityagent.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @accountabilityagents }\n end\n end", "title": "" }, { "docid": "125887c1576a19595a02175c19c866f7", "score": "0.60946727", "text": "def show\n @achievement = Achievement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @achievement }\n end\n end", "title": "" }, { "docid": "125887c1576a19595a02175c19c866f7", "score": "0.60936624", "text": "def show\n @achievement = Achievement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @achievement }\n end\n end", "title": "" }, { "docid": "125887c1576a19595a02175c19c866f7", "score": "0.60936624", "text": "def show\n @achievement = Achievement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @achievement }\n end\n end", "title": "" }, { "docid": "6d4553dc0d97cde9ca8070edfe8a4676", "score": "0.6089437", "text": "def account\n # TODO exclude promotional money\n @account = @person.account\n render \"api/v1/accounts/show\"\n end", "title": "" }, { "docid": "4be8582dc43658c4b0366b98052ae67b", "score": "0.608771", "text": "def set_accountability\n @accountability = Accountability.find(params[:id])\n end", "title": "" }, { "docid": "5a465b13e77a19a46f42fa03d0d18b95", "score": "0.6082627", "text": "def show\n\t\turi = URI.parse(\"http://204.87.169.110/accounts/\" + params[:account])\n\t\tres = Net::HTTP.get_response(uri)\n\n\t\tif res.code == '200'\n\t\t\trender :json => JSON.parse(res.body)\n\t\telse\n\t\t\trender :json => {}, status: res.code\n\t\tend\n\tend", "title": "" }, { "docid": "55bdfcf1335d2f79dfb515832e10e637", "score": "0.60821646", "text": "def show\n render status: 403\n return\n render json: @account\n end", "title": "" }, { "docid": "d5271e0b58f4baf07854e1ece49ee534", "score": "0.6079942", "text": "def show\n render json: @account\n end", "title": "" }, { "docid": "d5271e0b58f4baf07854e1ece49ee534", "score": "0.6079942", "text": "def show\n render json: @account\n end", "title": "" }, { "docid": "eee2cc151e020de2a60b124e8e59b8d7", "score": "0.607581", "text": "def ability(ability, options = {})\n boolean_from_response :get, \"/abilities/#{ability}\", options\n end", "title": "" }, { "docid": "4688f64c1acc055881f62001900d848d", "score": "0.60735613", "text": "def show\n @achievement = Achievement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @achievement }\n end\n end", "title": "" }, { "docid": "df6f420d44cd61dda9a1c3946b1c544f", "score": "0.6059384", "text": "def index\n @user_accounts = @user.user_accounts.page(params[:page]).per(params[:per])\n\n render json: @user_accounts\n end", "title": "" }, { "docid": "0094ce4c020055a620fcbabbd1cf33dd", "score": "0.60577923", "text": "def index\n if params.has_key?(:alliance_id)\n alliance = Fundamental::Alliance.find(params[:alliance_id])\n raise NotFoundError.new('Alliance Not Found') if alliance.nil?\n #raise ForbiddenError.new('Not member of alliance') unless alliance == current_character.alliance\n @fundamental_victory_progresses = alliance.victory_progresses\n else\n raise ForbiddenError.new('Acess denied.') unless staff?\n @fundamental_victory_progresses = Fundamental::VictoryProgress.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fundamental_victory_progresses }\n end\n end", "title": "" }, { "docid": "0d601fb69fe6f027dd9869b86320ee73", "score": "0.6051714", "text": "def index\n @usuarios = User.accessible_by(current_ability)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @usuarios }\n end\n end", "title": "" }, { "docid": "21bd67c391ef7b36916c5014b9d65ae0", "score": "0.60463905", "text": "def show\n @account = current_user.accounts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @account }\n end\n end", "title": "" }, { "docid": "b80bf112492e9243f7c314a91c7b4121", "score": "0.6038387", "text": "def index\n respond_to do |format|\n format.html { render 'application/cube_trainer' }\n format.json { render json: @user.achievement_grants.map(&:to_simple) }\n end\n end", "title": "" }, { "docid": "61a43d8f4e38377ddf24c54da79adcd4", "score": "0.60363966", "text": "def index\n @achieved_activities = @university.achieved_activities.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @achieved_activities }\n end\n end", "title": "" }, { "docid": "aa77884dcac7a18946dc7b6d228c7b14", "score": "0.60193384", "text": "def fetch_accounts\n log 'fetch_accounts'\n\n # Even if the required method is an HTTP POST\n # the API requires a funny header that says is a GET\n # otherwise the request doesn't work.\n response = with_headers('BBVA-Method' => 'GET') do\n post(BASE_ENDPOINT + PRODUCTS_ENDPOINT, {})\n end\n\n json = JSON.parse(response)\n json['accounts'].map { |data| build_account(data) }\n end", "title": "" }, { "docid": "28a01c060601ede58a9da2bad106c7b8", "score": "0.6003579", "text": "def index\n @accounts = Account.all\n respond_to do |format|\n format.json {render json: @accounts}\n end\n end", "title": "" }, { "docid": "9d07665b7818d8a7e180153ba132f2f1", "score": "0.60019433", "text": "def show\n @profile = Profile.accessible_by(current_ability).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end", "title": "" }, { "docid": "e754fa76d1659a2f75531bd2f2e7c0c6", "score": "0.60012007", "text": "def index\n @language_abilities = LanguageAbility.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @language_abilities }\n end\n end", "title": "" }, { "docid": "68a1c78e70f6432f4f3ec151b1cc9bfd", "score": "0.5998171", "text": "def abilities\n @abilities ||= []\n end", "title": "" }, { "docid": "bd5eaf4a0f5f5762942be89c8dabab87", "score": "0.5994715", "text": "def index\n @memberships = current_account.memberships.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @memberships }\n end\n end", "title": "" }, { "docid": "688ac9b30205b75873e44330a047a5ae", "score": "0.5990519", "text": "def index\n @achievements = Achievement.search(params[:search]).ultimos.page(params[:page]).per_page(4)\n\n authorize Achievement #Restriccion\n\n end", "title": "" }, { "docid": "06b8419234700ce30426718b088d238c", "score": "0.598745", "text": "def index\n @special_abilities = SpecialAbility.all\n end", "title": "" }, { "docid": "72326e73952b67175fc4f1127a472838", "score": "0.5974803", "text": "def index\n @achievements = Achievement.where(game: @game, character: @character)\n end", "title": "" }, { "docid": "5156b7475cb5d2583cec100bc3d00c88", "score": "0.5970614", "text": "def index\n @accounts = Account.where(:account_type_master_id => Account::TYPE_USER)\n render :json => @accounts\n end", "title": "" }, { "docid": "e1d4803c8446fa5cbf82951f37c3b5b2", "score": "0.59692085", "text": "def index\n @achievements = Achievement.all\n end", "title": "" }, { "docid": "e1d4803c8446fa5cbf82951f37c3b5b2", "score": "0.59692085", "text": "def index\n @achievements = Achievement.all\n end", "title": "" }, { "docid": "e1d4803c8446fa5cbf82951f37c3b5b2", "score": "0.59692085", "text": "def index\n @achievements = Achievement.all\n end", "title": "" }, { "docid": "e1d4803c8446fa5cbf82951f37c3b5b2", "score": "0.59692085", "text": "def index\n @achievements = Achievement.all\n end", "title": "" }, { "docid": "e74954c7e48a8802a8973091e276067a", "score": "0.5967427", "text": "def index\n limit, offset = Calculator.limit_and_offset(params)\n accs = Accessory.all\n \n render json: accs\n end", "title": "" }, { "docid": "8d46e2c873f8f60a32563c8cda096f3c", "score": "0.5952192", "text": "def show\n render json: @associatied_account\n end", "title": "" }, { "docid": "f550ce274e01ab006e3cf8a08195a82e", "score": "0.5951007", "text": "def index\n @user_achievements = UserAchievement.all\n end", "title": "" }, { "docid": "2829aca381f2032cfa36c462003b9a49", "score": "0.59497166", "text": "def show\n @account = current_user.person.android_accounts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @account }\n end\n end", "title": "" }, { "docid": "eee496f9d3548f9049b0bf5c849ccac5", "score": "0.59473926", "text": "def index\n unless user_logged_in then return end\n \n @accounts = Account.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @accounts }\n end\n end", "title": "" }, { "docid": "3daeaa41e42eb6a2704d871a7f096ace", "score": "0.59452957", "text": "def index\n @advance_profiles = policy_scope(AdvanceProfile)\n render json: @advance_profiles\n end", "title": "" }, { "docid": "3de80ed8a161fbaf2f43164aa3593884", "score": "0.5937821", "text": "def show\n @account = Account.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @account }\n end\n end", "title": "" }, { "docid": "f3eaeb69c4176730d6c4df1ad3632c7d", "score": "0.5936496", "text": "def personal_assets_list(opts = { :characterid => nil })\n args = postfields(opts)\n h = compute_hash(args.merge(:url => @@personal_assets_url))\n return h if h\n xml = process_query(nil,opts[:url] || @@personal_assets_url,true,args)\n self.recur_through_assets(xml.search(\"/eveapi/result/rowset[@name='assets']/row\"))\n end", "title": "" }, { "docid": "071a23fa8335f8c69afbc19a5008b567", "score": "0.59362537", "text": "def show\n\n add_breadcrumb \"Grant Profile\"\n\n @assets = @grant.assets.where('organization_id in (?)', @organization_list)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @grant }\n end\n\n end", "title": "" }, { "docid": "d95c014a6f2e3fbfd5a9562918fffc05", "score": "0.59308064", "text": "def show\n @challenges = Challenge.where(user_ids: params[:id])\n @challenges = policy_scope(@challenge)\n \n render json: @challenge\n end", "title": "" }, { "docid": "3e2dbee655c2c2b4ab06c98f8f9ef334", "score": "0.59271896", "text": "def show\n @admin_achievement = Achievement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_achievement }\n end\n end", "title": "" }, { "docid": "9d8eaf1129d12732e19f81cb3dec9ac4", "score": "0.5917837", "text": "def index\n @brain_candies = BrainCandy.includes(:difficulty_level).all\n\n respond_to do |format|\n format.html # index.html.erb.erb\n format.json { render json: @brain_candies }\n end\n end", "title": "" }, { "docid": "2a587d13ff65095b3b93c52475a13c26", "score": "0.5915398", "text": "def show\n render_response(Ability.find(params[:id]))\n end", "title": "" }, { "docid": "625804bb2b6e0b23e0254bed1b74cc9c", "score": "0.59130025", "text": "def index\n @accounts = Account.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @accounts }\n end\n end", "title": "" }, { "docid": "625804bb2b6e0b23e0254bed1b74cc9c", "score": "0.59130025", "text": "def index\n @accounts = Account.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @accounts }\n end\n end", "title": "" }, { "docid": "625804bb2b6e0b23e0254bed1b74cc9c", "score": "0.59130025", "text": "def index\n @accounts = Account.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @accounts }\n end\n end", "title": "" }, { "docid": "bd38f582b3dfeade9588c58199adbf0f", "score": "0.5912505", "text": "def show\n @account = Account.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @account }\n end\n end", "title": "" }, { "docid": "28bfa737134a1546cec25756999105e6", "score": "0.59119624", "text": "def show\n authorize @achievement #Restriccion\n end", "title": "" }, { "docid": "44b7ad615d432692a7b352b2f9928688", "score": "0.5906789", "text": "def fetch_availabilities\n fetcher = Commands::AvailabilitiesFetcher.new(credentials.code_partner)\n fetcher.call\n end", "title": "" }, { "docid": "ed8fb57c9c06ff403e0f67fe3b303f22", "score": "0.59029007", "text": "def fetch_accounts\n response = get(BASE_ENDPOINT + ACCOUNTS_ENDPOINT)\n json = JSON.parse(response)\n json['accountProduct']['accounts'].map { |data| build_account(data) }\n\n # TODO parse json['cardProduct'] for cards\n end", "title": "" }, { "docid": "ea945b843cac1d178fdb4f5032d13f30", "score": "0.5892749", "text": "def show\n @account = Account.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @account }\n end\n end", "title": "" }, { "docid": "ea945b843cac1d178fdb4f5032d13f30", "score": "0.5892749", "text": "def show\n @account = Account.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @account }\n end\n end", "title": "" }, { "docid": "ea945b843cac1d178fdb4f5032d13f30", "score": "0.5892749", "text": "def show\n @account = Account.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @account }\n end\n end", "title": "" }, { "docid": "ea945b843cac1d178fdb4f5032d13f30", "score": "0.5892749", "text": "def show\n @account = Account.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @account }\n end\n end", "title": "" }, { "docid": "ea945b843cac1d178fdb4f5032d13f30", "score": "0.5892749", "text": "def show\n @account = Account.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @account }\n end\n end", "title": "" }, { "docid": "ea945b843cac1d178fdb4f5032d13f30", "score": "0.5892749", "text": "def show\n @account = Account.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @account }\n end\n end", "title": "" }, { "docid": "ea945b843cac1d178fdb4f5032d13f30", "score": "0.5892749", "text": "def show\n @account = Account.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @account }\n end\n end", "title": "" }, { "docid": "27c674344505aa1ef83a9c7efe72b89a", "score": "0.5878219", "text": "def index\n @accounts = Account.find_all_by_bank_id(@bank.id)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @accounts }\n end\n end", "title": "" }, { "docid": "3b31e0d330d14b29b191cdbab3fcd4e9", "score": "0.58757305", "text": "def account\n get('/account')\n end", "title": "" }, { "docid": "51016645f4d0066bad173c82edcba8e7", "score": "0.5874839", "text": "def audits\n @audits = Audit.by_class_and_action( params[:user][:classname], params[:user][:action], 20 )\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @audits }\n end\n end", "title": "" }, { "docid": "67bcdbdd2d59ab1495e7098c2e9fa274", "score": "0.5871525", "text": "def show\n @account = Account.find(params[:id])\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @account }\n end\n end", "title": "" }, { "docid": "e66737b82a8345a1e511dd28f4da0fca", "score": "0.58712465", "text": "def show\n @affiliate_account = Affiliate::Account.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @affiliate_account }\n end\n end", "title": "" }, { "docid": "0c918b96a434c74582722402de4198af", "score": "0.58701015", "text": "def show\n render json: @user_account\n end", "title": "" }, { "docid": "32067c58181eb163c1275751b9abe83f", "score": "0.5857479", "text": "def account\n response = send(:get , '/api/v1/account.json')\n \n Unfuddled::Account.from_response(response)\n end", "title": "" }, { "docid": "70d3cec04bee91707969ac22e9627080", "score": "0.5845849", "text": "def index\n respond_with current_account.policies\n end", "title": "" }, { "docid": "46279009653f7c41fa7212b472383f1a", "score": "0.5840985", "text": "def show\n # set_account\n render json: @account\n end", "title": "" } ]
bf35dc0bda767608fef64532da760727
Get refs for the repo
[ { "docid": "d8d9f32619878f868ea7b5a5494fc284", "score": "0.7492922", "text": "def refs(ref=nil)\n prefix = ref ? \"#{path_prefix}/refs/#{ref}\" : \"#{path_prefix}/refs\"\n Ghee::API::Repos::Git::Refs::Proxy.new(connection, prefix)\n end", "title": "" } ]
[ { "docid": "1e4e8eab1cd48ec801ba06f66f6c35f0", "score": "0.80192816", "text": "def refs(repo)\n repo.refs_hash[id]\n end", "title": "" }, { "docid": "04b8b39c08b9198a7df30283970a90e9", "score": "0.7855158", "text": "def refs\n select_branches(git.grit.refs)\n end", "title": "" }, { "docid": "b1bce634780a9ebf9df3e4cb88f3ef75", "score": "0.7484025", "text": "def git_refs()\n # This glob pattern matches recursively so we will find a branch named\n # something like 'feature/subfeature/the-cool-feature'.\n # TODO: get remotes also\n git_dir = git_git_dir()\n\n locals = Dir.glob(File.join(git_dir, 'refs', 'heads', '**', '*')).select do |f|\n !File.directory? f\n end.map do |f|\n {\n 'name' => f.split('/refs/heads/')[1],\n 'hash' => File.open(f).read().rstrip\n }\n end\n\n remotes = Dir.glob(File.join(git_dir, 'refs', 'remotes', '**', '*')).select do |f|\n !File.directory?(f) and !f.end_with? \"/HEAD\"\n end.map do |f|\n {\n 'name' => f.split('/refs/remotes/')[1],\n 'hash' => File.open(f).read().rstrip\n }\n end\n\n locals + remotes\nend", "title": "" }, { "docid": "d7d3f3d63446c2ddc76afdc7fa82c570", "score": "0.73199725", "text": "def fetch_refs(repo_user,repo_name)\n uri = URI(API_BASE_URL+ \"/repos/#{repo_user}/#{repo_name}/git/refs\")\n body = response_body(uri)\n \n if body.instance_of? Array\n body\n elsif body.key?('message') && body['message'].downcase == \"not found\"\n raise \"Unable to fetch #{uri}\" \n else\n puts \"WARNING unexpected body = #{body}\"\n [] \n end\n end", "title": "" }, { "docid": "df2488a761c0f58624eb029d24dd459a", "score": "0.71843505", "text": "def ref_names(repo)\n refs(repo).map do |ref|\n ref.sub(%r{^refs/(heads|remotes|tags)/}, \"\")\n end\n end", "title": "" }, { "docid": "464250f8adaa3abe6113772ee57ec909", "score": "0.7066229", "text": "def find_all(repo, options = {})\n refs = []\n already = {}\n Dir.chdir(repo.path) do\n files = Dir.glob(prefix + '/**/*')\n files.each do |ref|\n next if !File.file?(ref)\n id = File.read(ref).chomp\n name = ref.sub(\"#{prefix}/\", '')\n commit = Commit.create(repo, :id => id)\n if !already[name]\n refs << self.new(name, commit)\n already[name] = true\n end\n end\n\n if File.file?('packed-refs')\n File.readlines('packed-refs').each do |line|\n if m = /^(\\w{40}) (.*?)$/.match(line)\n next if !Regexp.new('^' + prefix).match(m[2])\n name = m[2].sub(\"#{prefix}/\", '')\n commit = Commit.create(repo, :id => m[1])\n if !already[name]\n refs << self.new(name, commit)\n already[name] = true\n end\n end\n end\n end\n end\n\n refs\n end", "title": "" }, { "docid": "c93fb82cbebcb98c5d78d9e71cfb5ea6", "score": "0.68757546", "text": "def list(user_name, repo_name, params={})\n _update_user_repo_params(user_name, repo_name)\n _validate_user_repo_params(user, repo) unless user? && repo?\n normalize! params\n\n response = if params['ref']\n ref = params.delete('ref')\n _validate_reference ref\n get_request(\"/repos/#{user}/#{repo}/git/refs/#{ref}\", params)\n else\n get_request(\"/repos/#{user}/#{repo}/git/refs\", params)\n end\n return response unless block_given?\n response.each { |el| yield el }\n end", "title": "" }, { "docid": "873c225125d6f1d8d4d07a5fbc4130e9", "score": "0.66495377", "text": "def repos\n client.repos({}, query: { sort: \"asc\" })\n end", "title": "" }, { "docid": "0f18c3a8cd681d9a88d244d87ad24257", "score": "0.66252023", "text": "def fetch_ref(repo_user,repo_name, ref_name)\n uri = URI(API_BASE_URL+ \"/repos/#{repo_user}/#{repo_name}/git/#{ref_name}\")\n body = response_body(uri)\n if body.instance_of? Array\n body\n elsif body.key?('message') && body['message'].downcase == \"not found\"\n raise \"Unable to fetch #{uri}\" \n else\n puts \"WARNING unexpected body = #{body}\"\n []\n end\n end", "title": "" }, { "docid": "b3dddafa1395e87648f42451dda14f1e", "score": "0.6605653", "text": "def fetch_repositories(repos = nil)\n # Init git settings\n Git.configure do |config|\n config.binary_path = \"#{@config['git']['path']}\"\n end\n @return_repos = []\n # Loop through repos and fetch it\n repos_to_fetch = repos.nil? ? self.repositories_to_fetch : repos\n repos_to_fetch.each do |repo|\n if File.directory?(repo)\n # Get branches\n g = Git.bare(\"#{repo}\", :log => @log)\n g.remotes.each do |remote|\n # Determine which \"remote\" to fetch e.g. \"git fetch github\"\n if @config['provider'].include?(\"#{remote}\")\n @log.info(\"Fetching remote #{remote} in #{repo}\")\n g.remote(remote).fetch\n @return_repos << repo\n end\n end\n end\n end\n @return_repos\n end", "title": "" }, { "docid": "a32da4f8cb26848728146969316a45e2", "score": "0.6560175", "text": "def repos\n pry(Git::Multi.repositories)\nend", "title": "" }, { "docid": "c4dd5a607ee4b06abd6140c33d439c84", "score": "0.6515936", "text": "def repo_commits(repos)\n repos_commits = []\n repos.each do |repo|\n repos_commits << HTTParty.get(repo[\"commits_url\"].gsub(\"{/sha}\", \"\"))[0]\n end\n repos_commits\nend", "title": "" }, { "docid": "d25700ee9f8e9fa944c102509b5ccf57", "score": "0.65099406", "text": "def commit_refs(commit, repo_param)\n commit.refs.map{ |r| commit_ref(r, repo_param) }.join(\"\\n\")\n end", "title": "" }, { "docid": "b142531b7c6c38d8bbe6422fd11cea5d", "score": "0.65032524", "text": "def refs\n @refs ||= load_refs\n end", "title": "" }, { "docid": "ac95d35feb3467fbe68c97e76d82da38", "score": "0.64907545", "text": "def repos\n @repos ||= get(\"/repos/show/#{login}\")['repositories'].map { |r| Repo.new(connection, r) }\n end", "title": "" }, { "docid": "d91d5687260ff2e15536d90e95941e30", "score": "0.64604264", "text": "def fetch_branches\n refs = @github_client.fetch_refs(@repo_user,@repo_name) \n branch_refs = filter_branch_refs refs \n branch_refs = fetch_and_set_dates(branch_refs)\n branch_refs = sort_by_date(branch_refs) \n branches(branch_refs)\n end", "title": "" }, { "docid": "18ad2bbe60dc0c21e4d9458c5ed0a47a", "score": "0.6410303", "text": "def branches\n client.branches(repo)\n end", "title": "" }, { "docid": "62e9e7520a51229ffb08a14dba31af32", "score": "0.6409759", "text": "def recent_branches_fast\n\t\trefs = []\n\t\trefs.concat Pathname.glob(dot_git + 'refs/heads/**/*')\n\t\trefs.concat Pathname.glob(dot_git + 'refs/remotes/**/*')\n\n\t\tbranches = refs.reject {|r| r.directory? }.sort_by {|r| r.mtime }.last(@opts[:max_num]).map {|r|\n\t\t\tref = r.read.chomp\n\t\t\tif name = ref[/ref: (.+)/, 1]\n\t\t\t\tbegin\n\t\t\t\t\t(dot_git + name).read.chomp\n\t\t\t\trescue\n\t\t\t\t\t`git rev-parse #{name}`.chomp\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tref\n\t\t\tend\n\t\t}\n\t\tretrieve_branch_details(branches)\n\tend", "title": "" }, { "docid": "c6d5b58b95146dc2cc70e4c29e256267", "score": "0.6408908", "text": "def list\n @repos\n end", "title": "" }, { "docid": "88c5d60ceb82231048fce91c34f46f82", "score": "0.6407983", "text": "def get_repos\n @api.list_repositories\n end", "title": "" }, { "docid": "80155901ac2fea6e40b923b3819486d3", "score": "0.63951045", "text": "def list\n Dir.chdir @root do\n cmd = \"git branch\"\n stdout, stderr, status = Open3.capture3 cmd\n if status != 0\n case stderr\n when /Not a git repository/\n raise NotARepositoryError\n else\n raise Error, stderr\n end\n end\n return stdout.split.map { |s|\n # Remove trailing/leading whitespace and astericks\n s.sub('*', '').strip\n }.reject { |s|\n # Drop elements created due to trailing newline\n s.size == 0\n }\n end\n end", "title": "" }, { "docid": "d8289ef45f4924473382a3feaba48678", "score": "0.6344742", "text": "def get(user_name, repo_name, ref, params={})\n _update_user_repo_params(user_name, repo_name)\n _validate_user_repo_params(user, repo) unless user? && repo?\n\n _validate_presence_of ref\n _validate_reference ref\n normalize! params\n\n get_request(\"/repos/#{user}/#{repo}/git/refs/#{ref}\", params)\n end", "title": "" }, { "docid": "46bd17985b0d3cdfbc862a4cd2a4c077", "score": "0.63435775", "text": "def repos\n @client.repos.all.collect(&:clone_url)\n end", "title": "" }, { "docid": "486429e302c40b0d8f50532c70e57a7d", "score": "0.6278844", "text": "def repos\n api.repos.map(&:to_hash)\n end", "title": "" }, { "docid": "45f6f971253237d95f2a46bccc595674", "score": "0.6268047", "text": "def branches(repo)\n api.branches(repo).index_by(&:name)\n end", "title": "" }, { "docid": "1264ee7fed30381c4d239f978216d181", "score": "0.6262071", "text": "def find_repositories\n @repos = GithubApi.call :repos\n end", "title": "" }, { "docid": "4f25758d810b4989d285e382e8862d0e", "score": "0.6242808", "text": "def refs\n @refs\n end", "title": "" }, { "docid": "b460dc100922289f20d804cda339a601", "score": "0.6232323", "text": "def get_repos\n begin\n @repos ||= github_api_setup.repos.list\n rescue Exception => e\n logger.error \"Github #get_repos error #{e}\"\n end\n end", "title": "" }, { "docid": "6fa0e9a11f3754fd350397be095aa1f2", "score": "0.6221923", "text": "def references_for_repository(repository_name)\n @reference_mapping[repository_name] || []\n end", "title": "" }, { "docid": "4dd83cdd66e29a35d70d7c764db821b3", "score": "0.6213324", "text": "def get_all_commits_in_repo\n @branches.collect(&:commits).flatten.sort_by { |k| k.authored_date }.reverse\n end", "title": "" }, { "docid": "00b6624025c464349de026d2e27e1dea", "score": "0.62079114", "text": "def load_ref_commits(ref)\n commits = []\n page = 1\n begin\n loop do\n commits += Octokit.commits(@path, ref, :page => page)\n page += 1\n end\n rescue Octokit::NotFound, Faraday::Error::ResourceNotFound\n end\n commits\n end", "title": "" }, { "docid": "638b037a430c87606652c50d3290df32", "score": "0.6200186", "text": "def list_repo(user, repo)\n get_request(\"/repos/#{user}/#{repo}/issues\", arguments.params)\n end", "title": "" }, { "docid": "649bfc5c684b67cf0a86cced6e938f9e", "score": "0.61896515", "text": "def get_builds_by_repo(repo)\n\t\treturn self.fetch(\"repos/#{repo}/builds\")\n\tend", "title": "" }, { "docid": "6091fd1a5c3832f92778649ee081ecbc", "score": "0.61888933", "text": "def list_repo(repo_id)\n response = HTTParty.get(\n GIT_BASE_URL + 'projects/' + repo_id.to_s,\n :headers => {\n 'PRIVATE-TOKEN' => GIT_TOKEN\n }\n )\n Rails.logger.info \"Git server response (list repo): #{response}\"\n return response['content']\n end", "title": "" }, { "docid": "249d132320e88b31e0cb532167b19bae", "score": "0.61801165", "text": "def repos(*args)\n params = arguments(args, required: [:q]).params\n params['q'] ||= arguments.q\n\n get_request('/search/repositories', arguments.params)\n end", "title": "" }, { "docid": "716b115924e2b1068fa7feba5b832335", "score": "0.6143436", "text": "def repos\n @repos ||= OY.repos\n end", "title": "" }, { "docid": "83e266f9529d81180791dc0e785d0acf", "score": "0.6140897", "text": "def get_list\n @list_of_repos\n end", "title": "" }, { "docid": "6c1a0cfdf31ae292a7258a48a00371ae", "score": "0.61277944", "text": "def refs(test_case)\n all_tags(test_case).select{|tag| tag.name =~/(?:jira|ref)_/}.map{|ticket| /(?:jira|ref)_(\\w+-\\d+)$/.match(ticket.name)[1]}.uniq.join(\",\")\n end", "title": "" }, { "docid": "a0bb3129031c30ec069aaa661840d491", "score": "0.6124664", "text": "def get_repos\n\t\t@repos = Repo.all\n\tend", "title": "" }, { "docid": "f16f68ff617fcaa9eb6f81682588b9af", "score": "0.61216176", "text": "def get_repos\n # using oauth token to increase limit of request to github api to 5000\n client = Octokit::Client.new :access_token => self.github_token\n (client.repositories self.github_name, {:type => 'all'}).map do |repo|\n repo.full_name\n end\n end", "title": "" }, { "docid": "a2279c1389ba907915b4ba95db06f772", "score": "0.6120525", "text": "def list\n @connection.get('/user/repos').map do |repo_data|\n Rails.logger.info \"listing repos\"\n GitHubApi::Repo.new(self, repo_data)\n end\n end", "title": "" }, { "docid": "7277a0ad2f91791b96e6cd927d125109", "score": "0.61160713", "text": "def pull_requests repo\n name = full_name repo\n \n %w[open closed].reduce([]) do |memo, state|\n memo | octokit.pulls(name, state, :per_page=>100)\n end\n end", "title": "" }, { "docid": "ba8ade6ea91e25f99ddf2ce34bc582fb", "score": "0.60720897", "text": "def get_repository_project_branches(repoName)\n self.log(INFO, repoName, \"Searching for project branches...\")\n branches = []\n b=`git branch -r`\n b.each_line do |remoteBranch|\n remoteBranch.gsub!(/\\n/, \"\")\n if remoteBranch =~ /origin\\/project/\n localBranch = \"#{remoteBranch}\"\n localBranch.slice! \"origin/\"\n branches << localBranch.strip! || localBranch\n end\n end\n self.log(INFO, repoName, \"Project branches found : #{branches}\")\n self.log(INFO, repoName, \"Done.\")\n return branches\n end", "title": "" }, { "docid": "829d3f2e13168dd4c5c26f48b03a8723", "score": "0.60666776", "text": "def gl_repos\n all_repos.select{|x| x.is_a?(Repository::Git)}\n end", "title": "" }, { "docid": "6c3e9e2652d92d3a8ad46bc94a87bdfb", "score": "0.6044006", "text": "def get(*args)\n arguments(args, required: [:user, :repo, :sha])\n\n get_request(\"/repos/#{arguments.user}/#{arguments.repo}/commits/#{arguments.sha}\", arguments.params)\n end", "title": "" }, { "docid": "e7a42c5adb20136dbf9edc270c9eda3c", "score": "0.6030393", "text": "def revlist\n (`git rev-list --all`).split(\"\\n\")\n end", "title": "" }, { "docid": "3e6c737367a0e3374d496684b74f8ab6", "score": "0.60194397", "text": "def acquire_repo_list\n set_auth\n set_github_repo_name\n repo_list = []\n (@github.repos.list org: GITHUB_ORG).each do |l|\n repo_list << l[:name]\n end\n repo_list\nend", "title": "" }, { "docid": "b68eb4fe3ebf73f937537b89037fc51f", "score": "0.60059386", "text": "def repositories_to_fetch\n # Find all .git Repositories - Ignore *.wiki.git\n repos = Dir.glob(\"#{@config['git']['repos']}/*/*{[!.wiki]}.git\")\n\n # Build up array of NOT ignored repositories\n delete_path = []\n @config['ignore'].each do |ignored|\n path = File.join(@config['git']['repos'], ignored)\n delete_path += repos.grep /^#{path}/\n repos.delete(delete_path)\n end\n\n return repos - delete_path\n\n end", "title": "" }, { "docid": "fd7f1594a1f7d8b8c3586576a704165e", "score": "0.6002578", "text": "def references\n @references ||= ApiFactory.new 'GitData::References'\n end", "title": "" }, { "docid": "8c09b2cb1250115da85a946909741fd0", "score": "0.5944643", "text": "def repositories\n client.repositories(user_repo, @options)\n end", "title": "" }, { "docid": "bb1425ebb8711e4cfe38b4b4d4edb46c", "score": "0.5929538", "text": "def repos(opts={ push: false, details: false, orgs: true })\n repos = @client.repositories.map {|repo| parse_repo repo}\n @client.organizations.each do |org|\n repos += @client.organization_repositories(org.login).map {|repo| parse_repo repo}\n end\n repos.reject! {|repo| !repo[:push]} if opts[:push]\n repos.map { |repo| repo[:full_name] } unless opts[:details]\n end", "title": "" }, { "docid": "fc11dab9b4cdefd00d93e60264c5d031", "score": "0.5923402", "text": "def get_repos\n\t\trepo_list = []\n\t\tparsed_config = begin\n\t\t\tYAML.load(File.open(@path_to_config_yml))\n\t\trescue ArgumentError => e\n \t\t\tputs \"Could not parse YAML: #{e.message}\"\n\t\tend\n\t\tparsed_config['sections'].each do |section|\n\t\t\trepo_list.push(section['repository']['name'].gsub(/\\w*-?\\w*\\//,''))\n\t\tend\n\t\trepo_list.sort\n\tend", "title": "" }, { "docid": "fbe7878d46c40c5c7307ff52050558d5", "score": "0.5900772", "text": "def get_commits\n raise \"can't get a repo without the repo's full_name (eg. 'fubar/ofxTrickyTrick')\" unless full_name\n\n begin\n response = GithubApi::repository_commits(full_name: full_name)\n rescue => ex\n Rails.logger.debug \"Failed to get recent commit: #{ex.message} (#{ex.class})\"\n return\n end\n\n unless response.success?\n Rails.logger.debug response.inspect.to_s.red\n return\n\tend\n\n @repo_commits_json = response.parsed_response\n end", "title": "" }, { "docid": "57905e70d06992b7371c8a510a45fd01", "score": "0.588092", "text": "def all_repos\n if GitHosting.multi_repos?\n repositories\n else\n [ repository ].compact\n end\n end", "title": "" }, { "docid": "068b74a1ecdda33d7b06897f6bd941a4", "score": "0.5880038", "text": "def get_branch_names(repo)\n repo.heads.collect(&:name)\n end", "title": "" }, { "docid": "0eea3665e681398c2aedf0c47e46a6f7", "score": "0.58736366", "text": "def link_commits(repo_path, username, repo_name)\n\n # create a partial repo URL for GitHub repository\n partial_URL = \"https://github.com/#{username}/#{repo_name}/commit/\"\n \n # access the repository at the given repo_path\n repo = Grit::Repo.new(repo_path)\n \n all_commits = get_all_commits(repo)\n \n #all_commits.each{ |commit|\n # puts \"[#{commit.sha}](#{partial_URL + commit.sha})\\n\\n\"\n #}\n\n return all_commits.map do |commit|\n \"[#{commit.sha}](#{partial_URL + commit.sha})\\n\\n\"\n end\nend", "title": "" }, { "docid": "2a93b785dcf13fbfe944750d37d77885", "score": "0.5867992", "text": "def get_refs(way)\n return [] if !way.tags.has_key?('ref')\n return way.tags['ref'].split(/(;|,)/).collect {|ref| ref.strip}\n end", "title": "" }, { "docid": "b4821da6243a64638666efa6006558c2", "score": "0.58626246", "text": "def fetch\n Repository::GitMirror.active.find_each(&:fetch)\n end", "title": "" }, { "docid": "0a1954a4ee1e969d78c1c94320e3665f", "score": "0.5860921", "text": "def repos\n @repos ||= (user_repos + org_repos).flatten\n end", "title": "" }, { "docid": "eb6c3ab6a3b33242a5d87a1032dff1b6", "score": "0.58567756", "text": "def fetch_commit_hash_list()\n `git rev-list --all --reverse`.strip.split(/\\n/)\nend", "title": "" }, { "docid": "44f11a222a5eb60b49bab88617fd97a2", "score": "0.58460397", "text": "def repository_fields\n client.repo('git/git').fields\n end", "title": "" }, { "docid": "18bd2ccbf1a41b08f5b58d46df45f274", "score": "0.5842991", "text": "def fetch_notes\n info \"fetching notes\"\n run(\"git fetch -f origin refs/notes/*:refs/notes/*\", {:raise => true})\n end", "title": "" }, { "docid": "c1d8b84cdd953834428828ff653f174b", "score": "0.5822074", "text": "def all_repos\n\t\tif GitHosting.multi_repos?\n\t\t repositories\n\t\telse\n\t\t [ repository ].compact\n\t\tend\n\t end", "title": "" }, { "docid": "b76413b5b87d0e310efd4cc5f3851c77", "score": "0.58205646", "text": "def show_ref(repo_path, ref)\n Dir.chdir repo_path do\n lines = git('show-ref', ref).lines.to_a\n\n raise AmbiguousGitRef, ref if lines.size > 1\n\n lines.first.chomp.split(/\\s/).first\n end\n end", "title": "" }, { "docid": "cf33dba3d294a2edb5aa794303efadc9", "score": "0.5817747", "text": "def branch_list\n raw_branches = `cd #{project_repo_path} && git branch -r`\n branches = raw_branches.split(/\\n/)\n return branches\n end", "title": "" }, { "docid": "b921c17f870a7178864a9431a4012f26", "score": "0.5816754", "text": "def repos(show_commits = false)\n response = @github.repos.list(user: 'siakaramalegos', sort: 'updated', direction: 'desc', page: 1, per_page: 10)\n repos = response.body\n\n repos.each_with_index do |repo, index|\n puts '-' * 80\n date_string = repo.updated_at\n date = DateTime.parse(date_string).to_date\n puts \"(#{index + 1}) #{repo.name}: #{repo.description} (updated: #{date.stamp('12/30/99')})\"\n\n if show_commits\n repo_commits = @github.repos.commits.list('siakaramalegos', repo.name, page: 1, per_page: 10).body\n\n repo_commits.each do |c|\n date_string = c.commit.author.date\n date = DateTime.parse(date_string).to_date\n puts \" #{c.commit.message} (#{date.stamp('12/30/99')})\"\n end\n end\n end\n puts '-' * 80\n repos\n end", "title": "" }, { "docid": "9c088a0403a5a8f649f1516ac2e4223d", "score": "0.5813804", "text": "def gitrepo(repo, name, ref = 'master')\n mod name.split('/').join('-'),\n :git => \"https://#{repo}/#{name}.git\",\n :ref => ref\nend", "title": "" }, { "docid": "5035648f3f799dff17c9fc1b9764878c", "score": "0.5810657", "text": "def add_refs(commit)\n commit.refs = []\n refs = @repo.refs.select { |ref| ref.commit.id == commit.id }\n commit.refs << refs\n commit.refs.flatten!\n end", "title": "" }, { "docid": "750f0230f2afbaeadab344a6e78c1259", "score": "0.5806411", "text": "def remotes\n repo.remotes\n end", "title": "" }, { "docid": "ed6c56fe3ef150faa6c788ec72b06f95", "score": "0.58039373", "text": "def get_all_commits(repo)\n all_commits = []\n page = 0\n page_size = 10\n commits = repo.commits('master', page_size, page)\n while commits.length > 0\n all_commits = all_commits + commits\n page = page + page_size\n commits = repo.commits('master', page_size, page)\n end\n return all_commits\nend", "title": "" }, { "docid": "039897490875c9276d5dad23bd0b213d", "score": "0.578491", "text": "def retrieve_branch_details(branches)\n\t\tdetails = []\n\t\tIO.popen(\"-\", \"r+\") do |io|\n\t\t\tif io.nil?\n\t\t\t\targs = [ \"show\", \"--pretty=format:%H\\t%d\\t%ct\\t%cr\\t%an\\t%s\", *branches ]\n\t\t\t\targs << \"--\"\n\t\t\t\texec \"git\", *args\n\t\t\telse\n\t\t\t\twhile l = io.gets\n\t\t\t\t\tnext unless l =~ /^[a-z0-9]{40}/\n\t\t\t\t\thash, refs, time, rtime, author, subject = * l.chomp.split(/\\t/)\n\t\t\t\t\trefs.gsub!(/^\\s*\\(|\\)\\s*$/, '')\n\n\t\t\t\t\trefs.split(/\\s*,\\s*/).each do |ref|\n\t\t\t\t\t\tis_remote = ref[%r{refs/remotes}]\n\t\t\t\t\t\tref.gsub!(%r{refs/(remotes|heads)/}, '')\n\t\t\t\t\t\tdetails.push Ref.new(hash, ref, time.to_i, rtime, author, subject)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tdetails\n\tend", "title": "" }, { "docid": "b4c9faa14cac937d47823346beba1ecb", "score": "0.57785183", "text": "def branches\n @branches ||= get(\"/repos/show/#{owner.login}/#{name}/branches\")['branches'].map do |name, head|\n Branch.new(connection, \n :name => name,\n :head => head,\n :repo => self\n )\n end\n end", "title": "" }, { "docid": "588866a0a20e1598c337dc0148555b2f", "score": "0.57723516", "text": "def get_repositories\n get(\"#{url_base}/repositories?#{dc}\")[\"data\"]\n end", "title": "" }, { "docid": "820ee562196204af9293b9755562f334", "score": "0.5767118", "text": "def post_receive_payloads(refs, project=nil)\n\t\tproject ||= @project\n\t\tpayloads = []\n\t\trefs.each do |ref|\n\t\t\toldhead, newhead, refname = ref.split(',')\n\n\t\t\t# Only pay attention to branch updates\n\t\t\tnext if not refname.match(/refs\\/heads\\//)\n\t\t\tbranch = refname.gsub('refs/heads/', '')\n\n\t\t\tif newhead.match(/^0{40}$/)\n\t\t\t\t# Deleting a branch\n\t\t\t\tGitHosting.logger.debug \"Deleting branch \\\"#{branch}\\\"\"\n\t\t\t\tnext\n\t\t\telsif oldhead.match(/^0{40}$/)\n\t\t\t\t# Creating a branch\n\t\t\t\tGitHosting.logger.debug \"Creating branch \\\"#{branch}\\\"\"\n\t\t\t\trange = newhead\n\t\t\telse\n\t\t\t\trange = \"#{oldhead}..#{newhead}\"\n\t\t\tend\n\n\t\t\trevisions_in_range = %x[#{GitHosting.git_exec} --git-dir='#{GitHosting.repository_path(project)}' rev-list --reverse #{range}]\n\t\t\t#GitHosting.logger.debug \"Revisions in Range: #{revisions.split().join(' ')}\"\n\n\t\t\tcommits = []\n\t\t\trevisions_in_range.split().each do |rev|\n\t\t\t\trevision = project.repository.find_changeset_by_name(rev.strip)\n\t\t\t\tcommit = {\n\t\t\t\t\t:id => revision.revision,\n\t\t\t\t\t:url => url_for(:controller => \"repositories\", :action => \"revision\", \n\t\t\t\t\t\t:id => project, :rev => rev, :only_path => false, \n\t\t\t\t\t\t:host => Setting['host_name'], :protocol => Setting['protocol']\n\t\t\t\t\t),\n\t\t\t\t\t:author => {\n\t\t\t\t\t\t:name => revision.committer.gsub(/^([^<]+)\\s+.*$/, '\\1'),\n\t\t\t\t\t\t:email => revision.committer.gsub(/^.*<([^>]+)>.*$/, '\\1')\n\t\t\t\t\t},\n\t\t\t\t\t:message => revision.comments,\n\t\t\t\t\t:timestamp => revision.committed_on,\n\t\t\t\t\t:added => [],\n\t\t\t\t\t:modified => [],\n\t\t\t\t\t:removed => []\n\t\t\t\t}\n\t\t\t\trevision.changes.each do |change|\n\t\t\t\t\tif change.action == \"M\"\n\t\t\t\t\t\tcommit[:modified] << change.path\n\t\t\t\t\telsif change.action == \"A\"\n\t\t\t\t\t\tcommit[:added] << change.path\n\t\t\t\t\telsif change.action == \"D\"\n\t\t\t\t\t\tcommit[:removed] << change.path\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tcommits << commit\n\t\t\tend\n\n\t\t\tpayloads << {\n\t\t\t\t:before => oldhead,\n\t\t\t\t:after => newhead,\n\t\t\t\t:ref => refname,\n\t\t\t\t:commits => commits,\n\t\t\t\t:repository => {\n\t\t\t\t\t:description => project.description,\n\t\t\t\t\t:fork => false,\n\t\t\t\t\t:forks => 0,\n\t\t\t\t\t:homepage => project.homepage,\n\t\t\t\t\t:name => project.identifier,\n\t\t\t\t\t:open_issues => project.issues.open.length,\n\t\t\t\t\t:owner => {\n\t\t\t\t\t\t:name => Setting[\"app_title\"],\n\t\t\t\t\t\t:email => Setting[\"mail_from\"]\n\t\t\t\t\t},\n\t\t\t\t\t:private => !project.is_public,\n\t\t\t\t\t:url => url_for(:controller => \"repositories\", :action => \"show\", \n\t\t\t\t\t\t:id => project, :only_path => false, \n\t\t\t\t\t\t:host => Setting[\"host_name\"], :protocol => Setting[\"protocol\"]\n\t\t\t\t\t),\n\t\t\t\t\t:watchers => 0\n\t\t\t\t}\n\t\t\t}\n\t\tend\n\t\tpayloads\n\tend", "title": "" }, { "docid": "014d5e7f9456905e6f73ad72f2e5d943", "score": "0.5765532", "text": "def find_all(repo, options = {})\n wrapped_gitaly_errors do\n Gitlab::GitalyClient::CommitService.new(repo).find_all_commits(options)\n end\n end", "title": "" }, { "docid": "394b01b3e7da87fccfc0f442a2ee194d", "score": "0.5765467", "text": "def git_branches(git)\n array = Array.new\n body = raw_file(http_uri + git)\n body.scan(/\" title=\".*>(.*)<\\/a><\\/li>/) do |branch|\n array << branch\n end\n array.flatten\n end", "title": "" }, { "docid": "f4d9adb8e9a48bbd372401d9b1b4cd33", "score": "0.5757323", "text": "def get_repo_list\n Chef::Log.debug(\n \"Fetching all versions of #{new_resource.module_name} \" +\n \"from #{new_resource.repository}.\",\n )\n latest = powershell_out!(\n <<-EOH,\n $splat = @{\n Name = \"#{new_resource.module_name}\"\n Repository = \"#{new_resource.repository}\"\n AllVersions = $True\n }\n (Find-Module @splat).Version.ForEach({$_.ToString()})\n EOH\n ).stdout.to_s.chomp.split(\"\\r\\n\")\n Chef::Log.debug(\"Available versions: #{latest.join(', ')}\")\n\n return latest.map { |v| Gem::Version.new(v) }\n end", "title": "" }, { "docid": "96657f2ebb6a4d07f8040eb67cf8e04a", "score": "0.57557833", "text": "def commits\n if !@commits\n @commits = []\n x = 0\n loop do\n x += 1\n response = get(\"/commits/list/#{repo.owner.login}/#{repo.name}/#{name}?page=#{x}\")\n break unless response.code == 200\n @commits += response['commits'].map { |c| Commit.new(connection, c.merge(:repo => self)) }\n end\n end\n @commits\n end", "title": "" }, { "docid": "a0e55c593c62aa2db5291ad542101a9d", "score": "0.5755046", "text": "def get_repo_users\n repo_users = Array.new\n github = Github.new :oauth_token => github_token\n\n github.repos.list.body.each do |repo|\n repo_users << repo[\"owner\"][\"login\"]\n end\n\n repo_users\n end", "title": "" }, { "docid": "e45d3659a12fdce81587cb917207996c", "score": "0.5749591", "text": "def find_repos(user)\n user.repos\n end", "title": "" }, { "docid": "232f8cd1dd2f33c1c7f5a74bb5241e9e", "score": "0.5744372", "text": "def fetch_over_http(repo_url, use_ssl, remote_name)\n # refs : 909e4d4f706c11cafbe35fd9729dc6cce24d6d6f refs/heads/master\n # packs: P pack-8607f42392be437e8f46408898de44948ccd357f.pack\n \n success = true\n \n Dir.chdir(@git_dir) do\n # fetch (url)/info/refs\n log('fetching server refs')\n refs = Net::HTTP.get(URI.parse(\"#{repo_url}/info/refs\")) \n fetch_refs = map_refs(refs)\n\n # fetch (url)/HEAD, write as FETCH_HEAD\n log('fetching remote HEAD')\n remote_head = Net::HTTP.get(URI.parse(\"#{repo_url}/HEAD\"))\n if !(remote_head =~ /^ref: refs\\//)\n fetch_refs[remote_head] = false\n else\n success = remote_head.sub('ref: refs/heads/', '').strip\n end\n\n fetch_refs.each do |sha, ref|\n log(\"fetching REF : #{ref} #{sha}\")\n if http_fetch(repo_url, sha, 'commit')\n update_ref(\"refs/remotes/#{remote_name}/#{ref}\", sha) if ref\n else\n success = false\n end\n end\n end\n \n success\n end", "title": "" }, { "docid": "482e90e798287562b07a6e4d3b2d9348", "score": "0.57369673", "text": "def get_repos project_id\n $logger.info \"Getting repos\"\n\n # from the bitbucket api\n rest_endpoint = \"/rest/api/1.0/projects/#{PROJECT_ID}/repos\"\n\n http = Net::HTTP.new(BASE_GIT_URL, BASE_GIT_PORT)\n repos_request = Net::HTTP::Get.new(\"/rest/api/1.0/projects/#{PROJECT_ID}/repos?limit=1000\")\n repos_request.basic_auth GIT_USER, GIT_PASSWORD\n repos_response = http.request(repos_request)\n repos_response.value\n\n # https://confluence.atlassian.com/bitbucket/what-is-a-slug-224395839.html\n repos_body = JSON.parse(repos_response.body)\n repos = repos_body['values'].map { |v| v['slug'] }\n\n $logger.info \"Found repos #{repos}\"\n\n return repos\nend", "title": "" }, { "docid": "13ade028cba8bec49e5a6fa777672fbe", "score": "0.5733883", "text": "def list_repos\n repos = []\n end_cursor = nil\n\n data = get_repos(end_cursor)\n repos = repos + data.fetch(\"nodes\")\n next_page = data.dig(\"pageInfo\", \"hasNextPage\")\n end_cursor = data.dig(\"pageInfo\", \"endCursor\")\n\n while next_page do\n data = get_repos(end_cursor)\n repos = repos + data.fetch(\"nodes\")\n next_page = data.dig(\"pageInfo\", \"hasNextPage\")\n end_cursor = data.dig(\"pageInfo\", \"endCursor\")\n end\n\n repos.reject { |r| r.dig(\"isArchived\") || r.dig(\"isDisabled\") }\n end", "title": "" }, { "docid": "728fb0b41a1915a83aba4363777d319a", "score": "0.57148486", "text": "def get_repo_list(token, user)\n query = %{\n query ($user: String!, $cursor: String) {\n user(login: $user) {\n repositories(first: 100, after: $cursor) {\n edges {\n node {\n name\n owner {\n login\n }\n }\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n }\n }\n }\n\n vars = { user: user, cursor: nil }\n\n repos = []\n\n loop do\n result = Github.query(token, query, vars)\n repos += result.dig(\"data\", \"user\", \"repositories\", \"edges\") || []\n break unless result.dig(\"data\", \"user\", \"repositories\", \"pageInfo\", \"hasNextPage\")\n vars[:cursor] = result.dig(\"data\", \"user\", \"repositories\", \"pageInfo\", \"endCursor\")\n end\n\n repos.map { |e| { owner: e.dig(\"node\", \"owner\", \"login\"), name: e.dig(\"node\", \"name\") } }\nend", "title": "" }, { "docid": "c9dea4574c863dd449b86bd63e237fad", "score": "0.57082987", "text": "def get_master_ref(papers)\n github_client.refs(papers).select { |r| r[:ref] == \"refs/heads/master\" }.first.object.sha\n end", "title": "" }, { "docid": "e0ff86ab18f6ffb58c640bdb5369369a", "score": "0.56974185", "text": "def combine_multiple_repos_issues\n\t\tall_tagged_issues_array = []\n\t\trepos = ENV[ \"GIT_ISSUES_REPO\" ]\n\t\trepos = repos.split(' ')\n\t\t\n\t\trepos.each do | a |\n\t\t\trepos_issues = get_issues( a, ENV[ \"GIT_LABEL\" ] )\n\t\t\tall_tagged_issues_array.push( repos_issues ).flatten!\n\t\tend\n\t\t\n\t\treturn all_tagged_issues_array\n\tend", "title": "" }, { "docid": "309e98b64240c9bc16f9f72a18929134", "score": "0.5686927", "text": "def get_commits(pull_req_id)\n do_request(\"https://api.github.com/repos/#{CONFIG[\"repo\"][\"org\"]}/#{CONFIG[\"repo\"][\"repo\"]}/pulls/#{pull_req_id}/commits\", true)\n end", "title": "" }, { "docid": "f8e8c24418a533ea69d4b7c44b54f33a", "score": "0.5685728", "text": "def git_remotes\n @git_remotes ||= (File.read(git_directory / :config).scan(/\\s*url\\s*=\\s*(.*)\\n/).flatten.collect do |url|\n case url\n when %r{(github.com)[:/](.+)/(.+)/?\\.git$} then [$3, \"GitHub\", \"http://#$1/#$2/#$3\", \"http://#$1\"]\n when %r{(codaset.com)[:/](.+)/(.+)?\\.git$} then [$3, \"Codaset\", \"http://#$1/#$2/#$3\", \"http://#$1\"]\n when %r{(gitorious.org)[:/](.+)/.+/?\\.git$} then [$2, \"Gitorious\", \"http://#$1/#$2\", \"http://#$1\"]\n end\n end).compact\n end", "title": "" }, { "docid": "f0a08de32a8f645c5aa3f49679e8e28c", "score": "0.56821114", "text": "def repositories\n # TODO : merge with current data\n load_repos\n end", "title": "" }, { "docid": "46f062254bb962e2ca9bef565414e1eb", "score": "0.56794745", "text": "def all\n return @raw_repos unless @raw_repos.empty?\n return [Template.root.basename.to_s] if Template.project?\n Template.root.join(Meta.new({}).repos_dir).children.map do |path|\n path.basename.to_s\n end\n\n rescue Errno::ENOENT\n then raise(\n Error::RepoNotFound\n )\n end", "title": "" }, { "docid": "0fbad5988827ceda46c4a3ea9f9980e7", "score": "0.5672472", "text": "def filter_branch_refs(refs)\n refs.select do |r|\n ref_name = r[\"ref\"]\n ref_name.start_with? \"refs/heads\"\n end\n end", "title": "" }, { "docid": "44976dcb16c601f37f71bf7a6b5d3f07", "score": "0.5651385", "text": "def get_commits(repo, branch)\n # Downcase the strings\n repo.downcase!\n branch.downcase!\n\n # Make sure we're ending with a trailing / on the repo\n repo << '/' unless repo[repo.size - 1] == '/'\n\n # The full path for a call is:\n # https://api.github.com/repos/avalonmediasystem/avalon/commits/master/\n # The user may or may not have called with the /commits/ part since we don't\n # specifically require it\n # Determine if it is present, add it if it is not\n commits = 'commits/'\n last_char_pos = repo.size\n repo << commits unless repo[last_char_pos - commits.size..last_char_pos - 1] == commits\n\n # Use Rest Client to call the Github API and return it as JSON\n api_call = repo + branch\n resp = rest_client_get(api_call)\n return JSON.parse(resp) unless resp.nil?\n end", "title": "" }, { "docid": "befb5161363c76df1cf4530670ed7adf", "score": "0.56419563", "text": "def repos(*args)\n params = args.extract_options!\n normalize! params\n assert_required_keys %w[ keyword ], params\n\n get_request(\"/legacy/repos/search/#{params.delete('keyword')}\", params)\n end", "title": "" }, { "docid": "56876430dd6fd0ae3dbbb075a6b7567c", "score": "0.56354964", "text": "def fetch_svn_urls()\n urls = bot.config['svn_urls']\n commits = []\n urls.each do |url_str|\n begin\n @log.info \"checking #{url_str} for new commits...\"\n\n # https://username:password@svn.host.com:8080/svn/path/in/repo/\n url = Addressable::URI.parse(url_str)\n\n xmldata = `svn log --username #{url.user} --password #{url.password} --xml -v --limit 15 #{url.omit(:user, :password)}`\n doc = REXML::Document.new(xmldata)\n \n doc.elements.inject('log/logentry', commits) do |commits, element|\n commits.push({:url => url}.merge(parse_entry_info(element)))\n end\n\n rescue Exception => e\n @log.error \"error connecting to svn: #{e.message}\"\n end\n end\n return commits\n end", "title": "" }, { "docid": "6e59580d84282edbcb5f21825fa88da0", "score": "0.56176186", "text": "def repo\n @repo\n end", "title": "" }, { "docid": "2573bd50221e6779b1c9bae2b998bb6b", "score": "0.5614933", "text": "def repos\n ReposAPI.new(self)\n end", "title": "" }, { "docid": "44e059ea01841bc75a7ff145241dee5b", "score": "0.5607998", "text": "def repo_info\n # Extract user and project name from GitHub URL.\n url = git_config['remote.origin.url']\n if url.nil?\n puts \"Error: Not a git repository.\"\n return [nil, nil]\n end\n user, project = github_user_and_project(url)\n # If there are no results yet, look for 'insteadof' substitutions in URL and try again.\n unless user && project\n short, base = github_insteadof_matching(config_hash, url)\n if short and base\n url = url.sub(short, base)\n user, project = github_user_and_project(url)\n end\n end\n [user, project]\n end", "title": "" }, { "docid": "bc27e3fbc664b455776dc2d6596e61b2", "score": "0.5606289", "text": "def merge_base(project, refs)\n get(\"/projects/#{url_encode project}/repository/merge_base\", query: { refs: refs })\n end", "title": "" }, { "docid": "fa06268a576cd1acb88210fa05111252", "score": "0.5600056", "text": "def get_repo(token, owner, repo, authorID)\n query = %{\n query ($owner: String!, $repo: String!, $cursor: String, $author: CommitAuthor) {\n repository(owner: $owner, name: $repo) {\n defaultBranchRef {\n target {\n ... on Commit {\n history(first: 100, after: $cursor, author: $author) {\n edges {\n node {\n authoredDate\n }\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n }\n }\n }\n }\n }\n }\n\n vars = { owner: owner, repo: repo, cursor: nil, author: { id: authorID } }\n\n commits = []\n\n loop do\n result = Github.query(token, query, vars)\n edges = result.dig('data', 'repository', 'defaultBranchRef', 'target', 'history', 'edges')\n info = result.dig('data', 'repository', 'defaultBranchRef', 'target', 'history', 'pageInfo')\n\n commits += edges || []\n break unless info&.dig('hasNextPage')\n vars[:cursor] = info&.dig('endCursor')\n end\n\n dates = commits.map do |commit|\n date = commit.dig('node', 'authoredDate')\n begin\n DateTime.parse(date)\n rescue ArgumentError\n nil\n end\n end\n\n # Remove nil entries where DateTime raised an error\n dates.compact!\n\n CommitTime.new(dates)\nend", "title": "" }, { "docid": "12850c41bab10984649ddd2663a6ebb6", "score": "0.55991757", "text": "def latest_commits_from_repo(username, repo_name, author: nil, branch: nil)\n branch ||= default_branch_for_repo(username, repo_name)\n\n doc = doc_from_url(\n github_url_from_username(username) + \"/#{repo_name}/commits/#{branch}?author=#{author}\"\n )\n\n commit_list = doc.css(GITHUB_COMMITS_COMMIT_ITEM_SELECTOR)\n\n commit_list.map do |commit_node|\n copy_to_clipboard_btn = commit_node.search('button.zeroclipboard-button').first\n\n sha = copy_to_clipboard_btn.attributes['data-clipboard-text'].value\n\n sha\n end\nend", "title": "" } ]
ed71d460f011b781cbb8fd36d7b718c0
This method has the in_regions column display the name of the region in which that location existed.
[ { "docid": "cb35ebce09fcdd2d55d682692e1abd5f", "score": "0.81665444", "text": "def in_regions_column(record)\n record.in_regions.map do |ir|\n ir.region.name\n end.join(', ')\n end", "title": "" } ]
[ { "docid": "7df98444f6964a15a6cab31f36a77bbb", "score": "0.7047329", "text": "def subregion_names\n subregions.pluck(:name) if has_subregions?\n end", "title": "" }, { "docid": "78afb21426f4bbc7997396d6ff5f7f16", "score": "0.70401156", "text": "def region_name\n\t\tcustom_region || region && region.name\n\tend", "title": "" }, { "docid": "0bf41c7d830e1f4bbcb63233a4c9baef", "score": "0.6977454", "text": "def regions_of_interest_list\n if regions_of_interest.any?\n '<h3>Regions of Interest</h3>' +\n cell(RegionsOfInterest::Cell::List, regions_of_interest).()\n else\n 'User has not added any regions of interest'\n end\n end", "title": "" }, { "docid": "d558052b4b78b0651391e3da6c0219c0", "score": "0.6926754", "text": "def geographic_regions\n self.dig_for_array(\"listingSummary\", \"geographicRegions\")\n end", "title": "" }, { "docid": "4bb1eaff438740060ee0d18bd01f7fa3", "score": "0.68113565", "text": "def geographic_regions\n self.dig_for_array(\"geographicRegions\")\n end", "title": "" }, { "docid": "e0ecd2bf803fc7e04decc8b254a0a9f1", "score": "0.6766309", "text": "def regions_for_solr\n regions.collect{|r| r.region_id}.join(' ')\n end", "title": "" }, { "docid": "590a0ed0fd10ca6dc5a4ecc87ce648c3", "score": "0.67192763", "text": "def region\n #custom_region || region && region.name\n UsRegion.new(region_id)\n end", "title": "" }, { "docid": "166667b768eb33378f8e79d48a4dc840", "score": "0.6658829", "text": "def regions\n DefinitionFactory.regions_repository.all\n end", "title": "" }, { "docid": "516a859dc31282ef9fe2476a7598613e", "score": "0.6572492", "text": "def regions\n @regions ||= %w{\n us-east-1\n us-west-2\n ap-southeast-2\n }\n end", "title": "" }, { "docid": "1facd5ce6c903ac9d5e364b3020254d4", "score": "0.65668285", "text": "def show\n @region_name = @region_master.region_state_name\n logger.info \"the region is: #{@region_name}\"\n end", "title": "" }, { "docid": "f42d594f86a4461ac14100f421bb18b1", "score": "0.65444446", "text": "def assign_region_names\n if self.has_regions\n DistrictPrecinct.assign_region_name(self.id)\n end\n end", "title": "" }, { "docid": "1ddb78d0ee8a4bfe3c94fc3105f6856e", "score": "0.6451624", "text": "def aws_regions_list(access, secret)\n create_ec2_client(access, secret, 'us-west-2').describe_regions.regions.map { |record| record['region_name'] }\nend", "title": "" }, { "docid": "81cd7a90b9cacfac51b0558e3b82fbb8", "score": "0.64494467", "text": "def regions\n #@nationwide = Location.get_nationwide\n #@provinces = Location.provinces.where('id != ?', @nationwide.id).collect {|p| [p.name.capitalize, p.id]}\n @regions = Region.order('region_iso').all\n #@user_regions = User.find(current_user.id).regions.pluck(:region_iso)\n @user_regions = {}\n end", "title": "" }, { "docid": "1b72e92477e0a235076ca089badfdc3e", "score": "0.6444293", "text": "def regions\n\t\tignore_nil { country.regions }\n\tend", "title": "" }, { "docid": "555f67efc6d22b510d2ad818e9ab6109", "score": "0.6431396", "text": "def additional_regions\n [\n {:name => \"germanycentral\", :description => \"Germany Central\"},\n {:name => \"germanynortheast\", :description => \"Germany Northeast\"},\n {:name => \"usgovarizona\", :description => \"US Gov Arizona\"},\n {:name => \"usgoviowa\", :description => \"US Gov Iowa\"},\n {:name => \"usgovtexas\", :description => \"US Gov Texas\"},\n {:name => \"usgovvirginia\", :description => \"US Gov Virginia\"}\n ]\n end", "title": "" }, { "docid": "01273b70639f544ac4a3bbe3ac2a6165", "score": "0.6420501", "text": "def region\n data[:region]\n end", "title": "" }, { "docid": "55b909231bf3a3ddee60a9d526989f83", "score": "0.6374301", "text": "def region\n region_conditions = [\"name LIKE (?)\", \"#{params[:value]}%\"]\n\n regions = Region.where(region_conditions)\n regions = regions.map do |r|\n \"<li value='#{r.name}'>#{r.name}</li>\"\n end\n render plain: regions.join('').html_safe and return\n end", "title": "" }, { "docid": "de167d3c7c044e9683d781071dcafb2d", "score": "0.63306975", "text": "def region\n return @region\n end", "title": "" }, { "docid": "8eb3254289b705714a8eb90724a7df7a", "score": "0.6329512", "text": "def regions_for_select\n \t\tRegion.all.map { |p| [p.name, p.id] }\n \tend", "title": "" }, { "docid": "3a728ac3156cdccd3784270b7e9ffa67", "score": "0.63146544", "text": "def region_id\n \"region-#{self.region.match(/\\w+/).to_s.downcase}\"\n end", "title": "" }, { "docid": "41536a2ad5fb1106b62b8f4a92df76b2", "score": "0.62989265", "text": "def find_regions\n find_dependent Occi::InfrastructureExt::Mixins::Region.new\n end", "title": "" }, { "docid": "5289681ad89934a3d2df42da1a5d4226", "score": "0.62891984", "text": "def region\n @region_name = @xml.at('RegionName').inner_text\n end", "title": "" }, { "docid": "fecf4b28fc4d87841f40065d24ae8bf6", "score": "0.6284159", "text": "def regions\n REGIONS.map do |region_name|\n region = Region.new(countries.select { |c| c.in?(region_name) })\n\n [region_name, region]\n end\n end", "title": "" }, { "docid": "6d0c54f5ca7f8d2c09b5ce1213f9202b", "score": "0.6281776", "text": "def location_in_region_condition\n region = params[:in_region]\n region = Location.reverse_name_if_necessary(region)\n\n if Location.understood_continent?(region)\n countries = Location.countries_in_continent(region).join(\"|\")\n \"observations.where REGEXP #{escape(\", (#{countries})$\")}\"\n else\n \"observations.where LIKE #{escape(\"%#{region}\")}\"\n end\n end", "title": "" }, { "docid": "56abefe85f90a3967b126f7c1d41f907", "score": "0.62598854", "text": "def set_InRegion(value)\n set_input(\"InRegion\", value)\n end", "title": "" }, { "docid": "8a930672b32bf737d01fdc864c1f1bda", "score": "0.6217569", "text": "def region=(value)\n @region = value\n end", "title": "" }, { "docid": "0971526af3853a53377e9b4cb4c98638", "score": "0.6206573", "text": "def region_overview(region)\n @region = region\n region_overview = []\n region_overview.push(@region)\n region_overview.push(all_vintages_region(region))\n region_overview.push(all_local_storages_region(region))\n region_overview.push(all_remote_storages_region(region))\n region_overview\n end", "title": "" }, { "docid": "2ae792b8eb2ab981e372df2c8c2150e8", "score": "0.61851895", "text": "def allowed_regions\n template.dig('Metadata', 'Region') || []\n end", "title": "" }, { "docid": "34ec0056cfac6321a1eabef34dffc436", "score": "0.618299", "text": "def region; end", "title": "" }, { "docid": "34ec0056cfac6321a1eabef34dffc436", "score": "0.618299", "text": "def region; end", "title": "" }, { "docid": "1e2b1114ead31deaef901a2589c8a2ed", "score": "0.6182245", "text": "def list_regions\n ec2 = Aws::EC2::Client.new(\n region: 'eu-west-1'\n )\n regions = []\n # list all AWS regions\n regions_resp = ec2.describe_regions\n regions_resp.regions.each do |region|\n regions.push(region.region_name)\n end\n regions.sort!\nend", "title": "" }, { "docid": "34ec0056cfac6321a1eabef34dffc436", "score": "0.6181668", "text": "def region; end", "title": "" }, { "docid": "6afb76216e00c625de495edb7550a551", "score": "0.61749893", "text": "def regions\n Search.regions_from_zone_code(code)\n end", "title": "" }, { "docid": "bd7035970193f6905b9ccef36ff4d6a0", "score": "0.61615396", "text": "def region_id\n res = nil\n if self.regions.length > 0\n res = regions.first.id\n end\n res\n end", "title": "" }, { "docid": "7e3167fe1a2fd5f5c86a8755748ff1eb", "score": "0.61446035", "text": "def current_region(default: [])\n return default unless params[:region]\n icao_starts = params[:region].split(/[\\-,]/)\n icao_starts.compact!\n icao_starts.uniq!\n icao_starts.map!{|s| s.upcase.tr(\"^A-Z\",\"\")}\n return icao_starts\n end", "title": "" }, { "docid": "17f7729cc1304b28c568a93fdbb1e1d2", "score": "0.6140814", "text": "def aws_regions_list\n @aws_regions_list ||= aws_ip_ranges_and_regions_list['prefixes'].map { |list| list['region'] }.uniq\n end", "title": "" }, { "docid": "718880fad0823d69db8beaec3a86b135", "score": "0.61367685", "text": "def my_regions; []; end", "title": "" }, { "docid": "0e0ae61c33dce3d5ad44b6e9dcb87875", "score": "0.61209524", "text": "def regions_from_zone_code # :doc:\n data.regions.select do |r|\n r.zone_code == term\n end\n end", "title": "" }, { "docid": "45dafe5c5650e42dc4e0570e742a7b62", "score": "0.6118441", "text": "def regions\n @regions ||= Region.all.to_a\n end", "title": "" }, { "docid": "754dd492425871ac48800b77544cca60", "score": "0.61158997", "text": "def region\n final_line_non_postal_code if adr_has_region? && !adr_in_london?\n end", "title": "" }, { "docid": "becc744dcd524220cf294946c5a5df9d", "score": "0.6114849", "text": "def region_from_istat # :doc:\n data.regions.find do |r|\n r.istat == term\n end\n end", "title": "" }, { "docid": "af9e8a82a0068c888733ef8d0036bc83", "score": "0.6114373", "text": "def state_province_region_name\n if !state.blank?\n state\n elsif !province.blank?\n province\n else\n region\n end\n end", "title": "" }, { "docid": "e551a8eff39cec2d4de08cdc121c007a", "score": "0.60941875", "text": "def fetch_regions\n @partial_regions = Region.having_reports\n end", "title": "" }, { "docid": "56533f9cd11aea9d02f6ce5355d3158b", "score": "0.6091199", "text": "def multiple_regions\n @attributes[:multiple_regions]\n end", "title": "" }, { "docid": "65e2f6e3eb08c52b16ab6ea569de38a5", "score": "0.6085167", "text": "def region(arg = nil)\n set_or_return(:region, arg, kind_of: String)\n end", "title": "" }, { "docid": "a781bf269f5b41b2ef1776bfe099bfc5", "score": "0.60816985", "text": "def get_regions(conn)\n conn.send_msg(Message.new('definitions','set_regions',@defs.regions))\n end", "title": "" }, { "docid": "f9237008b08ea5414bcaf9edd07ab157", "score": "0.6075736", "text": "def region\n @region || @region = DEFAULT_REGION\n end", "title": "" }, { "docid": "c2895da12b00dcd51aae626b66c215c4", "score": "0.607312", "text": "def regions\n # When regions come back in an include, the method still gets called, to return the object from the attributes.\n return attributes['regions'] if attributes['regions'].present?\n return [] unless respond_to? :region_ids\n ESP::Region.where(id_in: region_ids)\n end", "title": "" }, { "docid": "dfa24586df54c9e35b4508386e8debe4", "score": "0.60343605", "text": "def regions(for_select = true)\n fetch_array_for $regions, for_select\n end", "title": "" }, { "docid": "2769c83aa20557c054adcdc38cf81dca", "score": "0.6032999", "text": "def ec2_region\n availabilityzone = capture(\"ec2metadata | grep availability-zone | awk '{print $2}'\")\n aws_regions.each do |reg|\n if availabilityzone.include? reg\n return reg\n end\n end\n\n return nil\nend", "title": "" }, { "docid": "c773914f74210d91ec251e6a274dc020", "score": "0.6028447", "text": "def regions\n roles.collect{|r| r.role_contactinfos.collect{|rc| rc.contactinfo}.collect{|c| c.region} }.flatten.compact\n end", "title": "" }, { "docid": "65ea6e6a96a842745edcb68ece8a6262", "score": "0.6013042", "text": "def region\n @region ||= model_for(:region).find(self.region_id)\n end", "title": "" }, { "docid": "dd58b0bda4dc78b5a2de2cc0ef614450", "score": "0.598709", "text": "def region\n if id = params[:id]\n @region = Region.find(id)\n else\n # named urls for cell phones are better as bookmarks\n name = params[:region].gsub(/_/,\" \") # .make_caps\n # LJG !!! fix this hack\n name = name.split.map(&:capitalize).join(' ')\n @region = Region.find_by_name(name)\n end \n @profiles = @region.profiles\n \n respond_to do |format|\n format.json {render :json => @profiles}\n format.html\n end\n \n @region_msg = \"region:#{@region.name}\"\n end", "title": "" }, { "docid": "5142f8dea5e891e79b8b83ad0bcdeec5", "score": "0.5985277", "text": "def gke_locations\n @gke.list_project_locations(\"projects/#{@project}\").locations.select do |x|\n x.name.start_with?(\"#{@region}-\")\n end.map(&:name)\n end", "title": "" }, { "docid": "29cc7b77afd65272223083180f4adc1b", "score": "0.5976909", "text": "def region\n self.continent\n end", "title": "" }, { "docid": "924f77b3d8801cb2d10c4b19849c1dc9", "score": "0.59567624", "text": "def regions_overview\n @all_regions = all_regions\n regions_overview = []\n @all_regions.each do |region|\n regions_overview.push(region_overview(region))\n end\n @regions_overview = regions_overview\n end", "title": "" }, { "docid": "99da0cd8614ebc66d7a8d239ba434c6d", "score": "0.5951005", "text": "def select_region\n\n origin_labs = Strain.find_by_sql(\"select origin_lab from strains group by origin_lab\")\n @lab_menu = []\n origin_labs.each do |lab|\n @lab_menu << lab.origin_lab if (lab.origin_lab != nil && lab.origin_lab != '')\n end\n\n origin_country = Strain.find_by_sql(\"select origin from strains group by origin\")\n @country_menu = []\n origin_country.each do |country|\n @country_menu << country.origin if (country.origin != nil && country.origin != '')\n end\n\n chromosomes = MapPosition.find_by_sql(\"select chromosome_label from map_positions where map_id = 1 group by chromosome_label order by chromosome_number asc\")\n @chromosome_menu = []\n chromosomes.each do |chr|\n @chromosome_menu << chr.chromosome_label\n end\n\n @strains = Strain.find(:all, :conditions => ['taxon_id = ?',10116], :order => \"symbol ASC\")\n\n end", "title": "" }, { "docid": "2e402a5ae39262524c03d861763f447a", "score": "0.5946638", "text": "def regions\n self.campus.map {|x| x.city.region_id}\n end", "title": "" }, { "docid": "2e402a5ae39262524c03d861763f447a", "score": "0.5946638", "text": "def regions\n self.campus.map {|x| x.city.region_id}\n end", "title": "" }, { "docid": "3b55aefbe1fd96022209e57ff6722057", "score": "0.59434843", "text": "def regionalized?\n @regionalized\n end", "title": "" }, { "docid": "1d1a5ac12ad96406c53224a93d111f39", "score": "0.5939118", "text": "def in_region(region)\n self.stores({'region' => region})\n end", "title": "" }, { "docid": "b3dd1f17383f50b91e0dcbe32339378f", "score": "0.59375966", "text": "def region_code\n @env[:region_code] || 0\n end", "title": "" }, { "docid": "16d2232dd3d9d1aa3bbd74b4e2e0a0a2", "score": "0.5929211", "text": "def preferred_region_areas\n region_constraints.uniq\n end", "title": "" }, { "docid": "4ece44a1ae06a31d514ae82d74292fe2", "score": "0.592695", "text": "def region_report(out = $stdout)\n out << \" Region | Seed | Team \" << \"\\n\"\n current_idx = -1\n @regions.each_with_index do |region, idx|\n next unless region\n (region[:teams] || []).each do |team|\n region_name = ''\n if idx != current_idx\n region_name = region[:name]\n current_idx = idx\n out << \"--------+------+-------------------------\" << \"\\n\"\n end\n out << \"%8s|%6d|%25s\" % [region_name, team.seed, \"#{team.name} (#{team.short_name})\"] << \"\\n\"\n end\n end\n end", "title": "" }, { "docid": "d1553451d0158756682a9fd310e214da", "score": "0.59201306", "text": "def regions\n @regions ||= Region.all.to_a\n end", "title": "" }, { "docid": "d1553451d0158756682a9fd310e214da", "score": "0.59201306", "text": "def regions\n @regions ||= Region.all.to_a\n end", "title": "" }, { "docid": "4292df492b2990f1e585111732f83473", "score": "0.5914447", "text": "def azure_regions\n %w(\n australiacentral australiacentral2 australiaeast australiasoutheast\n brazilsouth canadacentral canadaeast centralindia centralus eastasia\n eastus eastus2 francecentral francesouth\n germanycentral germanynorth germanynortheast germanywestcentral\n japaneast japanwest koreacentral koreasouth\n northcentralus northeurope southcentralus southeastasia\n southindia uksouth ukwest usgovarizona usgoviowa usgovtexas usgovvirginia\n westcentralus westeurope westindia westus westus2\n )\n end", "title": "" }, { "docid": "1719ba6c9aa46d09ba3a83400e7f6594", "score": "0.5912961", "text": "def app_nexus_regions\n return [] unless Workarea::Taxjar.config[:nexus_addresses]\n Workarea::Taxjar.config[:nexus_addresses].map { |a| a[:state] }\n rescue\n []\n end", "title": "" }, { "docid": "70b05758c1d40dc4e68fefc527d23def", "score": "0.5912427", "text": "def load_field\n 'wcregion'\n end", "title": "" }, { "docid": "f433e9668a2ac59d784860dda43cd04d", "score": "0.5906433", "text": "def region\n requires :region_id\n @region ||= service.regions.get(region_id.to_i)\n end", "title": "" }, { "docid": "957c47db3cfc94d9f0874c8f12a41b3b", "score": "0.5905692", "text": "def detect_region_info(identifier)\n DB.detect { |region_data| region_data[1, 2].include?(identifier) }\n end", "title": "" }, { "docid": "3655c070c5f6cf2b0635fa28259859c4", "score": "0.59055763", "text": "def countries_and_regions\n return @countries_and_regions\n end", "title": "" }, { "docid": "efb13f87cd709b75d99c6ac605490873", "score": "0.5903684", "text": "def region\n defined?(super) ? super : \"us-east-1\"\n end", "title": "" }, { "docid": "1ae54036dc388ade39b22e48c5aff5e0", "score": "0.5897964", "text": "def filter_regions\n regions = if @country_list.present?\n filtered_region_list\n else\n regions_list\n end\n {\n 'name': 'regions[]',\n 'options': regions,\n 'selected': @filter.regions,\n }\n end", "title": "" }, { "docid": "6c7013e85615732c3db4bbd6267d514b", "score": "0.5883027", "text": "def regions\n puts \"regions: called with params - #{params}\"\n\n render json: KeystoneUtil::AWS_REGIONS_SELECT\n end", "title": "" }, { "docid": "6cd4c599b3dea9542e4fb840d51e2b2b", "score": "0.5878215", "text": "def all_regions\n @wines = Wine.all\n regions = []\n all_regions = []\n @wines.each do |wine|\n regions.push(wine.region)\n end\n all_regions = regions.uniq.sort_by(&:downcase)\n all_regions\n end", "title": "" }, { "docid": "304caa47a19f05be926966b7889f0006", "score": "0.58565587", "text": "def origin\n country = fetch('coffee.country')\n region = fetch(\"coffee.regions.#{search_format(country)}\")\n \"#{region}, #{country}\"\n end", "title": "" }, { "docid": "79bbcc6e65939be68425dc377ede8bed", "score": "0.5852655", "text": "def sublot_region\n # Get nuts regions\n h = {}\n Nuts1Region.all.each { |x| h[x.code] = x.name }\n @regions = h\n h = {}\n FacilitiesManagement::Region.all.each { |x| h[x.code] = x.name }\n @supplier = FacilitiesManagement::Admin::SuppliersAdmin.find(params['id'])\n @supplier_lot = @supplier.data['lots'].select { |lot| lot['lot_number'] == params['lot_type'] }\n @sublot_region_name = 'Sub-lot ' + params['lot_type'] + ' regions'\n @selected_supplier_regions = FacilitiesManagement::Supplier::SupplierRegionsHelper.supllier_selected_regions(@supplier_lot)\n @subregions = h\n end", "title": "" }, { "docid": "c93b0943422c11f16919fb78ec73a043", "score": "0.58455676", "text": "def regions\n RegionBuilder.new(self.region_data || {})\n end", "title": "" }, { "docid": "1dad5100b5297c7e315cadec209d5bca", "score": "0.58265907", "text": "def info(region_id_or_region_name)\n @client.region.info(region_id_or_region_name)\n end", "title": "" }, { "docid": "1dad5100b5297c7e315cadec209d5bca", "score": "0.58265907", "text": "def info(region_id_or_region_name)\n @client.region.info(region_id_or_region_name)\n end", "title": "" }, { "docid": "00739055906bb80e39352c911f68b59e", "score": "0.58232224", "text": "def search_regions(region)\n options = {\n :q => region,\n }\n\n regions = []\n\n puts \"Search with options \" + options.inspect\n\n response = connection.get(\"region\", options )\n puts \"responce is \" + response.inspect\n\n if response.status == 200\n regions.push response.body[\"region.regions\"][0]['region'][0]\n end\n\n regions\n end", "title": "" }, { "docid": "c2723092fe6bad2584e6ae13792972ee", "score": "0.5778589", "text": "def region_by_name(name)\n found = nil\n regions_list.each do |region|\n if region[:name] == name\n found = region\n break\n end\n end\n found\n end", "title": "" }, { "docid": "09b9de1e2c6064a69621642f29752314", "score": "0.57587385", "text": "def gene_region\n region_by_boundaries(gene_start, gene_end)\n end", "title": "" }, { "docid": "2dd4e3694b4ecff5d967910124edd2dc", "score": "0.57517713", "text": "def test_connection\n result = []\n ec2_client = @aws[:Ec2Client]\n ec2_client.describe_regions.regions.each do |region|\n result.push(\"Region #{region.region_name} (#{region.endpoint})\")\n end\n !result.empty?\n end", "title": "" }, { "docid": "4ec1ca260f31ea016f0291cb387f54d9", "score": "0.5749535", "text": "def set_RegionName(value)\n set_input(\"RegionName\", value)\n end", "title": "" }, { "docid": "f8d981351a1e81fdf7727183c29d3133", "score": "0.5748128", "text": "def regions\n @regions ||= begin\n if gene_ids.present?\n @regions = gene_coordinates\n elsif bed_file_regions.present?\n @regions = bed_file_regions\n elsif dbsnp.present?\n @regions = dbsnp_coordinates\n elsif f_chromosome.present? && f_start_position.present? && f_end_position.present?\n @regions = [[f_chromosome, f_start_position, f_end_position]]\n else\n @regions = []\n end\n @regions\n end\n end", "title": "" }, { "docid": "36f6e0413614a86f72fb89a589b9b552", "score": "0.5746556", "text": "def add_open_region the_region\n r = self.regions.find :first, :conditions => [\"region_id = ?\", the_region.id]\n if !r\n # self.open_region_names += the_region.name + \",\"\n self.regions << the_region\n # puts \"REGION ADDED #{the_region.name}\"\n self.save\n end\n end", "title": "" }, { "docid": "0279d49ec9a8a612f6ef389994c9f14d", "score": "0.57435495", "text": "def regions_list\n [\n { slug: 'australia-new-zealand',\n countries: %w[australia fiji new-zealand papua-new-guinea],\n name: 'Australia/New Zealand' },\n { slug: 'caribbean',\n countries: %w[barbados costa-rica cuba dominican-republic jamaica trinidad-and-tobago],\n name: 'Caribbean' },\n { slug: 'central-and-eastern-europe',\n countries: %w[bosnia-and-herzegovina bulgaria croatia czech-republic hungary macedonia poland romania serbia slovakia slovenia],\n name: 'Central and Eastern Europe' },\n { slug: 'china',\n countries: %w[china],\n name: 'China' },\n { slug: 'south-america',\n countries: %w[argentina bolivia brazil chile colombia ecuador guyana mexico panama peru uruguay venezuela],\n name: 'South America' },\n { slug: 'mediterranean-europe',\n countries: %w[cyprus greece israel italy portugal spain],\n name: 'Mediterranean Europe' },\n { slug: 'middle-east',\n countries: %w[afghanistan bahrain iran iraq jordan kuwait lebanon oman pakistan palestine qatar saudi-arabia the-united-arab-emirates],\n name: 'Middle East' },\n { slug: 'nato',\n countries: %w[nato],\n name: 'NATO' },\n { slug: 'nordic-and-baltic',\n countries: %w[denmark estonia finland iceland latvia lithuania norway sweden],\n name: 'Nordic & Baltic' },\n { slug: 'north-africa',\n countries: %w[algeria egypt libya morocco tunisia],\n name: 'North Africa' },\n { slug: 'north-america',\n countries: %w[canada the-usa],\n name: 'North America' },\n { slug: 'north-east-asia',\n countries: %w[japan south-korea taiwan],\n name: 'North East Asia' },\n { slug: 'south-asia',\n countries: %w[bangladesh india nepal sri-lanka],\n name: 'South Asia' },\n { slug: 'south-east-asia',\n countries: %w[brunei burma cambodia indonesia malaysia philippines singapore thailand vietnam],\n name: 'South East Asia' },\n { slug: 'sub-saharan-africa',\n countries: %w[angola cameroon ethiopia ghana ivory-coast kenya mauritius mozambique namibia nigeria rwanda senegal seychelles south-africa tanzania uganda zambia],\n name: 'Sub Saharan Africa' },\n { slug: 'turkey-russia-and-caucasus',\n countries: %w[armenia azerbaijan georgia kazakhstan mongolia russia tajikistan turkey turkmenistan ukraine uzbekistan],\n name: 'Turkey, Russia & Caucasus' },\n { slug: 'western-europe',\n countries: %w[austria belgium france germany ireland luxembourg netherlands switzerland],\n name: 'Western Europe' },\n ].sort_by { |region| region[:name] }\n end", "title": "" }, { "docid": "ce8159ee3e02ea8a0c310bcb00959e15", "score": "0.5741901", "text": "def set_RegionName(value)\n set_input(\"RegionName\", value)\n end", "title": "" }, { "docid": "3ede3549172661f488592cbc716a841d", "score": "0.574073", "text": "def region(app_env)\n name, env = app_env.split(SEPERATOR)\n stacks = self.settings['region'] || {}\n stacks[name].try(\"[]\", env) || stacks['all']\n end", "title": "" }, { "docid": "78f8b11347d547a417272f94bf1fcc49", "score": "0.572338", "text": "def pinned_region\n @attributes[:pinned_region]\n end", "title": "" }, { "docid": "a4099de534471a14e83aa19fd22e3ebd", "score": "0.5722423", "text": "def region\n city.andand.region || nil\n end", "title": "" }, { "docid": "7b1b04d33d4b77065f9ca44130bd9e0c", "score": "0.5714351", "text": "def display_name\n if self.name == \"(region)\"\n # \"Region\"\n \"\"\n elsif self.name == \"(section)\"\n # \"Section\"\n \"\"\n else\n self.name\n end\n end", "title": "" }, { "docid": "85d077a6968719cc80878e2d27942ef4", "score": "0.570861", "text": "def template\n region_template\n end", "title": "" }, { "docid": "933d94b001ad3f58509e14259f7ea690", "score": "0.5700794", "text": "def show\n region=params[:region_nom];\n if region\n @sites = Site.where(region_nom: region_nom)\n end\n end", "title": "" }, { "docid": "dd4d6373ed6fe312677fd9ea1eed5b49", "score": "0.5698601", "text": "def region_fields\n sub_klass.column_names & params_columns\n end", "title": "" }, { "docid": "baf5f5915c4f046a7598213a740af580", "score": "0.56902957", "text": "def region r\n\t\tself.predictions.region r\n\tend", "title": "" }, { "docid": "8554aef9c1d1d5f1a395b539d2517336", "score": "0.5686314", "text": "def region_id(x, y)\n $game_map.region_id(x, y)\n end", "title": "" }, { "docid": "a7f4af7213ec2eb87f6342887cac3fd7", "score": "0.56840384", "text": "def list_regions(options={}) path = \"/api/v2/definitions/regions\"\n get(path, options, AvaTax::VERSION) end", "title": "" } ]
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "4e66f44c595640c199beedade2a86918", "score": "0.0", "text": "def set_tarefa\n @tarefa = Tarefa.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60339177", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.60135007", "text": "def on_setup_callbacks; end", "title": "" }, { "docid": "311e95e92009c313c8afd74317018994", "score": "0.59219855", "text": "def setup_actions\n domain = @apps.domain\n path_user = '/a/feeds/'+domain+'/user/2.0'\n path_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n path_email_list = '/a/feeds/'+domain+'/emailList/2.0'\n path_group = '/a/feeds/group/2.0/'+domain\n\n @apps.register_action(:domain_login, {:method => 'POST', :path => '/accounts/ClientLogin' })\n @apps.register_action(:user_create, { :method => 'POST', :path => path_user })\n @apps.register_action(:user_retrieve, { :method => 'GET', :path => path_user+'/' })\n @apps.register_action(:user_retrieve_all, { :method => 'GET', :path => path_user })\n @apps.register_action(:user_update, { :method => 'PUT', :path => path_user +'/' })\n @apps.register_action(:user_delete, { :method => 'DELETE', :path => path_user +'/' })\n @apps.register_action(:nickname_create, { :method => 'POST', :path =>path_nickname })\n @apps.register_action(:nickname_retrieve, { :method => 'GET', :path =>path_nickname+'/' })\n @apps.register_action(:nickname_retrieve_all_for_user, { :method => 'GET', :path =>path_nickname+'?username=' })\n @apps.register_action(:nickname_retrieve_all_in_domain, { :method => 'GET', :path =>path_nickname })\n @apps.register_action(:nickname_delete, { :method => 'DELETE', :path =>path_nickname+'/' })\n @apps.register_action(:group_create, { :method => 'POST', :path => path_group })\n @apps.register_action(:group_update, { :method => 'PUT', :path => path_group })\n @apps.register_action(:group_retrieve, { :method => 'GET', :path => path_group })\n @apps.register_action(:group_delete, { :method => 'DELETE', :path => path_group })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>'' })\n end", "title": "" }, { "docid": "8315debee821f8bfc9718d31b654d2de", "score": "0.5913137", "text": "def initialize(*args)\n super\n @action = :setup\nend", "title": "" }, { "docid": "8315debee821f8bfc9718d31b654d2de", "score": "0.5913137", "text": "def initialize(*args)\n super\n @action = :setup\nend", "title": "" }, { "docid": "bfea4d21895187a799525503ef403d16", "score": "0.589884", "text": "def define_action_helpers\n super\n define_validation_hook if runs_validations_on_action?\n end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5890051", "text": "def actions; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5890051", "text": "def actions; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5890051", "text": "def actions; end", "title": "" }, { "docid": "352de4abc4d2d9a1df203735ef5f0b86", "score": "0.5889191", "text": "def required_action\n # TODO: implement\n end", "title": "" }, { "docid": "8713cb2364ff3f2018b0d52ab32dbf37", "score": "0.58780754", "text": "def define_action_helpers\n if action == :save\n if super(:create_or_update)\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n else\n super\n end\n end", "title": "" }, { "docid": "a80b33627067efa06c6204bee0f5890e", "score": "0.5863248", "text": "def actions\n\n end", "title": "" }, { "docid": "930a930e57ae15f432a627a277647f2e", "score": "0.58094144", "text": "def setup_actions\n domain = @apps.domain\n path_base = '/a/feeds/emailsettings/2.0/'+domain+'/'\n\n @apps.register_action(:create_label, {:method => 'POST', :path => path_base })\n @apps.register_action(:create_filter, { :method => 'POST', :path => path_base })\n @apps.register_action(:create_send_as, { :method => 'POST', :path => path_base })\n @apps.register_action(:update_webclip, { :method => 'PUT', :path => path_base })\n @apps.register_action(:update_forward, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_pop, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_imap, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_vacation, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_signature, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_language, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_general, { :method => 'PUT', :path =>path_base })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>nil })\n end", "title": "" }, { "docid": "33ff963edc7c4c98d1b90e341e7c5d61", "score": "0.57375425", "text": "def setup\n common_setup\n end", "title": "" }, { "docid": "a5ca4679d7b3eab70d3386a5dbaf27e1", "score": "0.57285565", "text": "def perform_setup\n end", "title": "" }, { "docid": "ec7554018a9b404d942fc0a910ed95d9", "score": "0.57149214", "text": "def before_setup(&block)\n pre_setup_actions.unshift block\n end", "title": "" }, { "docid": "9c186951c13b270d232086de9c19c45b", "score": "0.5703237", "text": "def callbacks; end", "title": "" }, { "docid": "c85b0efcd2c46a181a229078d8efb4de", "score": "0.56900954", "text": "def custom_setup\n\n end", "title": "" }, { "docid": "100180fa74cf156333d506496717f587", "score": "0.56665677", "text": "def do_setup\n\t\tget_validation\n\t\tprocess_options\n\tend", "title": "" }, { "docid": "2198a9876a6ec535e7dcf0fd476b092f", "score": "0.5651118", "text": "def initial_action; end", "title": "" }, { "docid": "b9b75a9e2eab9d7629c38782c0f3b40b", "score": "0.5648135", "text": "def setup_intent; end", "title": "" }, { "docid": "471d64903a08e207b57689c9fbae0cf9", "score": "0.56357735", "text": "def setup_controllers &proc\n @global_setup = proc\n self\n end", "title": "" }, { "docid": "468d85305e6de5748477545f889925a7", "score": "0.5627078", "text": "def inner_action; end", "title": "" }, { "docid": "bb445e7cc46faa4197184b08218d1c6d", "score": "0.5608873", "text": "def pre_action\n # Override this if necessary.\n end", "title": "" }, { "docid": "432f1678bb85edabcf1f6d7150009703", "score": "0.5598699", "text": "def target_callbacks() = commands", "title": "" }, { "docid": "48804b0fa534b64e7885b90cf11bff31", "score": "0.5598419", "text": "def execute_callbacks; end", "title": "" }, { "docid": "5aab98e3f069a87e5ebe77b170eab5b9", "score": "0.5589822", "text": "def api_action!(*args)\n type = self.class.name.split(\"::\").last.downcase\n run_callbacks_for([\"before_#{type}\", :before], *args)\n result = nil\n begin\n result = yield if block_given?\n run_callbacks_for([\"after_#{type}\", :after], *args)\n result\n rescue => err\n run_callbacks_for([\"failed_#{type}\", :failed], *(args + [err]))\n raise\n end\n end", "title": "" }, { "docid": "9efbca664902d80a451ef6cff0334fe2", "score": "0.5558845", "text": "def global_callbacks; end", "title": "" }, { "docid": "9efbca664902d80a451ef6cff0334fe2", "score": "0.5558845", "text": "def global_callbacks; end", "title": "" }, { "docid": "482481e8cf2720193f1cdcf32ad1c31c", "score": "0.55084664", "text": "def required_keys(action)\n\n end", "title": "" }, { "docid": "353fd7d7cf28caafe16d2234bfbd3d16", "score": "0.5504379", "text": "def assign_default_callbacks(action_name, is_member=false)\n if ResourceController::DEFAULT_ACTIONS.include?(action_name)\n DefaultActions.send(action_name, self)\n elsif is_member\n send(action_name).build { load_object }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => object }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { render :xml => object.errors }\n else\n send(action_name).build { load_collection }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => collection }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { head 500 }\n end\n end", "title": "" }, { "docid": "dcf95c552669536111d95309d8f4aafd", "score": "0.5465574", "text": "def layout_actions\n \n end", "title": "" }, { "docid": "2f6ef0a1ebe74f4d79ef0fb81af59d40", "score": "0.5464707", "text": "def on_setup(&block); end", "title": "" }, { "docid": "8ab2a5ea108f779c746016b6f4a7c4a8", "score": "0.54471064", "text": "def testCase_001\n test_case_title # fw3_actions.rb\n setup # fw3_global_methods.rb\n \n get_page_url # fw3_actions.rb\n validate_page_title # fw3_actions.rb\n validate_page_link_set # fw3_actions.rb\n \n teardown # fw3_global_methods.rb\nend", "title": "" }, { "docid": "e3aadf41537d03bd18cf63a3653e05aa", "score": "0.54455084", "text": "def before(action)\n invoke_callbacks *options_for(action).before\n end", "title": "" }, { "docid": "6bd37bc223849096c6ea81aeb34c207e", "score": "0.5437386", "text": "def post_setup\n end", "title": "" }, { "docid": "07fd9aded4aa07cbbba2a60fda726efe", "score": "0.54160327", "text": "def testCase_001\n testTitle # fw2_actions.rb\n setup # fw2_global_methods.rb\n get_page_url # fw2_actions.rb\n validate_title # fw2_actions.rb\n teardown # fw2_global_methods.rb\nend", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5411113", "text": "def action_methods; end", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5411113", "text": "def action_methods; end", "title": "" }, { "docid": "9358208395c0869021020ae39071eccd", "score": "0.5397424", "text": "def post_setup; end", "title": "" }, { "docid": "cb5bad618fb39e01c8ba64257531d610", "score": "0.5392518", "text": "def define_model_action(methods,action,default_options={:validate => true})\n default_options.merge!(methods.extract_options!)\n actions = [action,\"#{action}!\".to_sym]\n actions.each do |a|\n define_method(a) do |opts = {}|\n rslt = nil\n options = default_options.merge(opts)\n options[:raise_exception] = a.to_s.match(/\\!$/)\n run_callbacks(action) do\n rslt = run_model_action(methods,options)\n end\n run_after_any\n rslt\n end\n end\n end", "title": "" }, { "docid": "c5904f93614d08afa38cc3f05f0d2365", "score": "0.5391541", "text": "def before_setup; end", "title": "" }, { "docid": "c5904f93614d08afa38cc3f05f0d2365", "score": "0.5391541", "text": "def before_setup; end", "title": "" }, { "docid": "a468b256a999961df3957e843fd9bdf4", "score": "0.5385411", "text": "def _setup\n setup_notification_categories\n setup_intelligent_segments\n end", "title": "" }, { "docid": "f099a8475f369ce73a38d665b6ee6877", "score": "0.53794575", "text": "def action_run\n end", "title": "" }, { "docid": "2c4e5a90aa8efaaa3ed953818a9b30d2", "score": "0.5357573", "text": "def execute(setup)\n @action.call(setup)\n end", "title": "" }, { "docid": "118932433a8cfef23bb8a921745d6d37", "score": "0.53487605", "text": "def register_action(action); end", "title": "" }, { "docid": "725216eb875e8fa116cd55eac7917421", "score": "0.5346655", "text": "def setup\n @controller.setup\n end", "title": "" }, { "docid": "39c39d6fe940796aadbeaef0ce1c360b", "score": "0.53448105", "text": "def setup_phase; end", "title": "" }, { "docid": "bd03e961c8be41f20d057972c496018c", "score": "0.5342072", "text": "def post_setup\n controller.each do |name,ctrl|\n ctrl.post_setup\n end\n end", "title": "" }, { "docid": "c6352e6eaf17cda8c9d2763f0fbfd99d", "score": "0.5341318", "text": "def initial_action=(_arg0); end", "title": "" }, { "docid": "207a668c9bce9906f5ec79b75b4d8ad7", "score": "0.53243506", "text": "def before_setup\n\n end", "title": "" }, { "docid": "669ee5153c4dc8ee81ff32c4cefdd088", "score": "0.53025913", "text": "def ensure_before_and_after; end", "title": "" }, { "docid": "c77ece7b01773fb7f9f9c0f1e8c70332", "score": "0.5283114", "text": "def setup!\n adding_handlers do\n check_arity\n apply_casting\n check_validation\n end\n end", "title": "" }, { "docid": "1e1e48767a7ac23eb33df770784fec61", "score": "0.5282289", "text": "def set_minimum_up_member_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "title": "" }, { "docid": "4ad1208a9b6d80ab0dd5dccf8157af63", "score": "0.52585614", "text": "def rails_controller_callbacks(&block)\n rails_controller_instance.run_callbacks(:process_action, &block)\n end", "title": "" }, { "docid": "63a9fc1fb0dc1a7d76ebb63a61ed24d7", "score": "0.52571374", "text": "def define_callbacks(*args)\n if abstract_class\n all_shards.each do |model|\n model.define_callbacks(*args)\n end\n end\n\n super\n end", "title": "" }, { "docid": "fc88422a7a885bac1df28883547362a7", "score": "0.52483684", "text": "def pre_setup_actions\n @@pre_setup_actions ||= []\n end", "title": "" }, { "docid": "8945e9135e140a6ae6db8d7c3490a645", "score": "0.5244467", "text": "def action_awareness\n if action_aware?\n if !@options.key?(:allow_nil)\n if @required\n @allow_nil = false\n else\n @allow_nil = true\n end\n end\n if as_action != \"create\"\n @required = false\n end\n end\n end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52385926", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52385926", "text": "def action; end", "title": "" }, { "docid": "7b3954deb2995cf68646c7333c15087b", "score": "0.5236853", "text": "def after_setup\n end", "title": "" }, { "docid": "1dddf3ac307b09142d0ad9ebc9c4dba9", "score": "0.52330637", "text": "def external_action\n raise NotImplementedError\n end", "title": "" }, { "docid": "5772d1543808c2752c186db7ce2c2ad5", "score": "0.52300817", "text": "def actions(state:)\n raise NotImplementedError\n end", "title": "" }, { "docid": "64a6d16e05dd7087024d5170f58dfeae", "score": "0.522413", "text": "def setup_actions(domain)\n\t\t\tpath_user = '/a/feeds/'+domain+'/user/2.0'\n\t\t\tpath_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n\t\t\tpath_group = '/a/feeds/group/2.0/'+domain # path for Google groups\n\n\t\t\taction = Hash.new\n\t\t\taction[:domain_login] = {:method => 'POST', :path => '/accounts/ClientLogin' }\n\t\t\taction[:user_create] = { :method => 'POST', :path => path_user }\n\t\t\taction[:user_retrieve] = { :method => 'GET', :path => path_user+'/' }\n\t\t\taction[:user_retrieve_all] = { :method => 'GET', :path => path_user } \n\t\t\taction[:user_update] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_rename] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_delete] = { :method => 'DELETE', :path => path_user +'/' }\n\t\t\taction[:nickname_create] = { :method => 'POST', :path =>path_nickname }\n\t\t\taction[:nickname_retrieve] = { :method => 'GET', :path =>path_nickname+'/' }\n\t\t\taction[:nickname_retrieve_all_for_user] = { :method => 'GET', :path =>path_nickname+'?username=' }\n\t\t\taction[:nickname_retrieve_all_in_domain] = { :method => 'GET', :path =>path_nickname }\n\t\t\taction[:nickname_delete] = { :method => 'DELETE', :path =>path_nickname+'/' }\n\t\t\taction[:group_create] = { :method => 'POST', :path =>path_group }\n\t\t\taction[:group_update] = { :method => 'PUT', :path =>path_group+'/' }\n\t\t\taction[:group_delete] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:groups_retrieve] = { :method => 'GET', :path =>path_group+'?member=' }\n\t\t\taction[:all_groups_retrieve] = { :method => 'GET', :path =>path_group }\n\t\t\taction[:membership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:membership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:membership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_members_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:ownership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:ownership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:ownership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_owners_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\n\t\t\t# special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n\t\t\taction[:next] = {:method => 'GET', :path =>nil }\n\t\t\treturn action \t\n\t\tend", "title": "" }, { "docid": "6350959a62aa797b89a21eacb3200e75", "score": "0.52226824", "text": "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "title": "" }, { "docid": "db0cb7d7727f626ba2dca5bc72cea5a6", "score": "0.521999", "text": "def process_params\n set_params_authable if process_params_authable?\n set_params_ownerable if process_params_ownerable?\n set_params_sub_action\n end", "title": "" }, { "docid": "8d7ed2ff3920c2016c75f4f9d8b5a870", "score": "0.5215832", "text": "def pick_action; end", "title": "" }, { "docid": "7bbfb366d2ee170c855b1d0141bfc2a3", "score": "0.5213786", "text": "def proceed_with(action, *arguments)\n self.class.decouplings.each do |decoupler|\n decoupler.run_on(self, action, *arguments)\n end\n end", "title": "" }, { "docid": "78ecc6a2dfbf08166a7a1360bc9c35ef", "score": "0.52100146", "text": "def define_action_helpers\n if action_hook\n @action_hook_defined = true\n define_action_hook\n end\n end", "title": "" }, { "docid": "2aba2d3187e01346918a6557230603c7", "score": "0.52085197", "text": "def ac_action(&blk)\n @action = blk\n end", "title": "" }, { "docid": "4c23552739b40c7886414af61210d31c", "score": "0.5203262", "text": "def execute_pre_setup_actions(test_instance,runner=nil)\n self.class.pre_setup_actions.each do |action|\n action.call test_instance\n end\n end", "title": "" }, { "docid": "691d5a5bcefbef8c08db61094691627c", "score": "0.5202406", "text": "def performed(action)\n end", "title": "" }, { "docid": "6a98e12d6f15af80f63556fcdd01e472", "score": "0.520174", "text": "def perform_setup\n ## Run global setup before example\n Alfred.configuration.setup.each do |setup|\n @request.perform_setup(&setup)\n end\n\n ## Run setup blocks for scenario\n setups.each { |setup| @request.perform_setup(&setup) }\n end", "title": "" }, { "docid": "d56f4ec734e3f3bc1ad913b36ff86130", "score": "0.5201504", "text": "def create_setup\n \n end", "title": "" }, { "docid": "ad33138fb4bd42d9785a8f84821bfd88", "score": "0.51963276", "text": "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "title": "" }, { "docid": "ad33138fb4bd42d9785a8f84821bfd88", "score": "0.51963276", "text": "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "title": "" }, { "docid": "7fca702f2da4dbdc9b39e5107a2ab87d", "score": "0.5191404", "text": "def add_transition_callbacks\n %w(before after).each {|type| owner_class.define_callbacks(\"#{type}_transition_#{attribute}\") }\n end", "title": "" }, { "docid": "063b82c93b47d702ef6bddadb6f0c76e", "score": "0.5178325", "text": "def setup(instance)\n action(:setup, instance)\n end", "title": "" }, { "docid": "9f1f73ee40d23f6b808bb3fbbf6af931", "score": "0.51765746", "text": "def setup( *args )\n\t\t\tself.class.setupMethods.each {|sblock|\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\tend", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.51710224", "text": "def setup(resources) ; end", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.51710224", "text": "def setup(resources) ; end", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.51710224", "text": "def setup(resources) ; end", "title": "" }, { "docid": "7a0c9d839516dc9d0014e160b6e625a8", "score": "0.5162045", "text": "def setup(request)\n end", "title": "" }, { "docid": "e441ee807f2820bf3655ff2b7cf397fc", "score": "0.5150735", "text": "def after_setup; end", "title": "" }, { "docid": "1d375c9be726f822b2eb9e2a652f91f6", "score": "0.5143402", "text": "def before *actions, &proc\n actions = ['*'] if actions.size == 0\n actions.each { |a| @callbacks[:a][a] = proc }\n end", "title": "" }, { "docid": "c594a0d7b6ae00511d223b0533636c9c", "score": "0.51415485", "text": "def code_action_provider; end", "title": "" }, { "docid": "faddd70d9fef5c9cd1f0d4e673e408b9", "score": "0.51398855", "text": "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "title": "" }, { "docid": "2fcff037e3c18a5eb8d964f8f0a62ebe", "score": "0.51376045", "text": "def setup(params)\n end", "title": "" }, { "docid": "111fd47abd953b35a427ff0b098a800a", "score": "0.51318985", "text": "def setup\n make_notification_owner\n load_superusers\n admin_sets.each do |as|\n @logger.debug \"Attempting to make admin set for #{as}\"\n make_admin_set_from_config(as)\n end\n load_workflows\n everyone_can_deposit_everywhere\n give_superusers_superpowers\n end", "title": "" }, { "docid": "f2ac709e70364fce188bb24e414340ea", "score": "0.5115387", "text": "def setup_defaults\n add_help\n @handler = Cliqr::Util.forward_to_help_handler if @handler.nil? && help? && actions?\n @actions.each(&:setup_defaults)\n end", "title": "" }, { "docid": "3b4fb29fa45f95d436fd3a8987f12de7", "score": "0.5111866", "text": "def setup\n transition_to(:setup)\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5110294", "text": "def action\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5110294", "text": "def action\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5110294", "text": "def action\n end", "title": "" }, { "docid": "4c7a1503a86fb26f1e4b4111925949a2", "score": "0.5109771", "text": "def scaffold_setup_helper\n include ScaffoldingExtensions::Helper\n include ScaffoldingExtensions::MerbControllerHelper\n include ScaffoldingExtensions::PrototypeHelper\n include ScaffoldingExtensions::Controller\n include ScaffoldingExtensions::MerbController\n before :scaffold_check_nonidempotent_requests\n end", "title": "" }, { "docid": "63849e121dcfb8a1b963f040d0fe3c28", "score": "0.5107364", "text": "def perform_action(action, item)\n if action == :approve\n approve(item.fullid)\n elsif action == :remove\n remove(item.fullid)\n elsif action == :alert\n #perform_alert() check condition alert params and proceed\n else\n #something isn't cool, pass or error \n end\nend", "title": "" }, { "docid": "f04fd745d027fc758dac7a4ca6440871", "score": "0.5106081", "text": "def block_actions options ; end", "title": "" }, { "docid": "0d1c87e5cf08313c959963934383f5ae", "score": "0.51001656", "text": "def on_action(action)\n @action = action\n self\n end", "title": "" }, { "docid": "916d3c71d3a5db831a5910448835ad82", "score": "0.50964546", "text": "def do_action(action)\n case action\n when \"a\"\n @user_manager.create_user\n when \"b\"\n @user_manager.delete_user\n when \"c\"\n @user_manager.get_info\n when \"d\"\n @user_manager.list_all_users\n when \"quit\", \"exit\"\n bail\n end\n end", "title": "" }, { "docid": "076c761e1e84b581a65903c7c253aa62", "score": "0.5093199", "text": "def add_callbacks(base); end", "title": "" } ]
1e66dacc38d2ce55630aeb046ece0702
Get a list of the passive servers in the cluster.
[ { "docid": "ad023971aae36342a8a8e456c75c9c7d", "score": "0.0", "text": "def passives\n @passives ||= (config[PASSIVES] || []).map { |s| s.downcase }\n end", "title": "" } ]
[ { "docid": "4d2e0bd8939c79becffac26f506e9ae8", "score": "0.6734244", "text": "def list_servers\n connection.get do |req|\n req.url \"agent/servers\"\n end\n end", "title": "" }, { "docid": "dea5d247074ba4eb0b2acc1a55086891", "score": "0.6699199", "text": "def list_known_servers\n connect.servers.all\n end", "title": "" }, { "docid": "dea5d247074ba4eb0b2acc1a55086891", "score": "0.6699199", "text": "def list_known_servers\n connect.servers.all\n end", "title": "" }, { "docid": "dea5d247074ba4eb0b2acc1a55086891", "score": "0.6699199", "text": "def list_known_servers\n connect.servers.all\n end", "title": "" }, { "docid": "261f064a62d585d0be8cad866fcae2ff", "score": "0.653961", "text": "def get_servers\n puts \"Getting server list\"\n servers = @conn.list_servers\n\n for server in servers.body['servers']\n puts server\n end\n\n return servers.body['servers']\n end", "title": "" }, { "docid": "e7fb56b23cc6d7cfd1939c884b892c51", "score": "0.6496533", "text": "def accessible_servers\n Server.by_ability(:list, self)\n end", "title": "" }, { "docid": "01ff89a51282b7d07f022327fa03016c", "score": "0.6308701", "text": "def servers()\n servers = []\n servers.concat(@servers)\n\n @groups.each do |g|\n servers.concat(g.servers)\n end\n\n return servers\n end", "title": "" }, { "docid": "241da30b7d6f168a44bd9ffbe75bdda4", "score": "0.6307894", "text": "def getServers(admin)\n serverInfos = admin.getClusterMetrics.getLiveServerMetrics.keySet\n servers = []\n serverInfos.each do |server|\n servers << server.getServerName\n end\n servers\nend", "title": "" }, { "docid": "0aaa7efb52db88abf3e5ce8298500b59", "score": "0.62746185", "text": "def list_known_servers\n connect.servers.each do |sr|\n logger.debug sr.inspect\n end\n end", "title": "" }, { "docid": "b0b5dd4e7c5ea7a31a3c397811ea3dca", "score": "0.62700224", "text": "def servers\n @servers\n end", "title": "" }, { "docid": "83e3a42b5878e9602e147de4c95d4b51", "score": "0.62584287", "text": "def servers\n hosts + arbiters + passives\n end", "title": "" }, { "docid": "5c7f4ab8d4786a2c01c6e11180869852", "score": "0.62529266", "text": "def all\n @virtual_servers\n end", "title": "" }, { "docid": "05e78025880e82e09649dec058f61472", "score": "0.6245022", "text": "def servers\n return @servers.values\n end", "title": "" }, { "docid": "85f02d63d78b715050a9c81c3b1991c5", "score": "0.6191217", "text": "def servers\n nr_api.get(url('servers')).body['servers']\n rescue NoMethodError\n []\n end", "title": "" }, { "docid": "b53dde47282ea1147344d7da868b86a6", "score": "0.6188529", "text": "def servers\n topology.servers(servers_list)\n end", "title": "" }, { "docid": "3b3003433e9055f30110414b85811694", "score": "0.6175234", "text": "def servers\n topology.servers(servers_list.compact).compact\n end", "title": "" }, { "docid": "874eb7306de145f5d1145d0697fe6608", "score": "0.6163716", "text": "def servers\n @servers ||= []\n end", "title": "" }, { "docid": "b5ab100e6e995f5f143bd99920f9b3d4", "score": "0.61454886", "text": "def servers\n pool.servers\n end", "title": "" }, { "docid": "e5cfb01ceef6cbca618d0f18482875b9", "score": "0.6051152", "text": "def live_nodes(force: false)\n return [\"#{@config.hostname}:#{@config.port}\"] if ['127.0.0.1', 'localhost', 'solr'].include?(@config.hostname)\n\n key_by_hostname = \"#{Digest::MD5.hexdigest(@config.hostname)[0..9]}_CACHE_LIVE_NODES\"\n lnodes = Utils.with_cache(force: force, key: key_by_hostname, default: [], expires_in: @expires_in) do\n resp = Utils.solr_request(connection, 'CLUSTERSTATUS')\n r = resp['cluster']\n return [] if r.nil?\n\n r = r['live_nodes'].map do |node|\n host_port = node.split(':')\n if host_port.size == 2\n port = host_port.last.gsub('_solr', '')\n \"#{host_port.first}:#{port}\"\n else\n node\n end\n end\n r.nil? || !r.is_a?(Array) || r.count.zero? ? [] : r\n end\n\n adjsut_solr_resp(lnodes)\n end", "title": "" }, { "docid": "7b5eb7dd94e00ffc9346304909606997", "score": "0.6007972", "text": "def get_servers(host=nil, port=nil)\n host ||= '63.146.124.21'\n port ||= 20810\n # TODO 6 ?\n cmd = \"getservers 6 full empty\"\n servers = []\n #TODO need to read all the responses, not just the first\n request_many(cmd, host, port) do |resp, _|\n break if resp.nil?\n servers += parse_serversResponse(resp)\n end\n\n servers\n end", "title": "" }, { "docid": "eb195e56d6341750c3b5052b0346fd1a", "score": "0.59816", "text": "def servers\n collect\n end", "title": "" }, { "docid": "0fd0a9f8cdc7e6867161ccbf49f804c9", "score": "0.59763473", "text": "def get_all_hosts\n @raw[\"servers\"].keys\n end", "title": "" }, { "docid": "30b4b1b3c2deac23b1e161853b745b9d", "score": "0.59624267", "text": "def candidate_servers\n @candidate_servers\n end", "title": "" }, { "docid": "43237f330f7a78823ea8c13ff04589ce", "score": "0.59447247", "text": "def servers\n @servers ||= []\n end", "title": "" }, { "docid": "cfa8f6dc9cc49d6d3026c8aaa451b760", "score": "0.5930548", "text": "def servers\n @pool.servers.to_a.collect do |s|\n s.instance_eval(<<-EOIE)\n def alive?\n #{!!stats[s]}\n end\n EOIE\n s\n end rescue []\n end", "title": "" }, { "docid": "85a9feda83365b658dfe649ebfec9c53", "score": "0.5911835", "text": "def serverlist\n execute([executable, \"--serverlist\"]).split(\"\\n\")\n end", "title": "" }, { "docid": "85a9feda83365b658dfe649ebfec9c53", "score": "0.5911835", "text": "def serverlist\n execute([executable, \"--serverlist\"]).split(\"\\n\")\n end", "title": "" }, { "docid": "581a44b59b4be0e26bba33781218eb20", "score": "0.59096265", "text": "def list_servers\n Com::Vmware::Vcenter::VM.new(vapi_config).list()\n end", "title": "" }, { "docid": "adfd2883da113a99c7ba055b8c48672c", "score": "0.58880126", "text": "def passive_dns\n return @passive_dns\n end", "title": "" }, { "docid": "ce86e6667d2b5a253e033db0b76fb433", "score": "0.58556944", "text": "def passive_dns_records\n return @passive_dns_records\n end", "title": "" }, { "docid": "35a55b1afe6392a5873866b31d04a1e7", "score": "0.5853635", "text": "def servers\n @servers.keys\n end", "title": "" }, { "docid": "d25bc58405304941a3259463759cec00", "score": "0.585303", "text": "def servers\n @_servers ||= []\n end", "title": "" }, { "docid": "80b10d020514db440f9774682fe4ba36", "score": "0.58473647", "text": "def get_read_hosts(cluster)\n read_hosts=[]\n @raw[\"servers\"].each do |srv, d|\n if d[\"readfor\"].class == Array\n read_hosts << srv if d[\"readfor\"].include? cluster and host_active? srv\n elsif d[\"readfor\"].class == String\n read_hosts << srv if d[\"readfor\"] == cluster and host_active? srv\n end\n end\n read_hosts\n end", "title": "" }, { "docid": "d6190353a78e3e4975c7c72e4079a893", "score": "0.5838163", "text": "def index\n @servers = current_user.servers\n end", "title": "" }, { "docid": "24bdc04b59280000041a7c99654ea86e", "score": "0.5818288", "text": "def suitable_servers(cluster)\n if cluster.single?\n candidates(cluster)\n elsif cluster.sharded?\n local_threshold = local_threshold_with_cluster(cluster)\n servers = candidates(cluster)\n near_servers(servers, local_threshold)\n elsif cluster.replica_set?\n validate_max_staleness_value!(cluster)\n candidates(cluster)\n else\n # Unknown cluster - no servers\n []\n end\n end", "title": "" }, { "docid": "273536a5d9d983d03e9a5fcb03d1106c", "score": "0.58001125", "text": "def discover_cluster_chef!\n self.servers\n end", "title": "" }, { "docid": "a86d6483338621da2454b8a3b6b6c827", "score": "0.5775729", "text": "def list_peers\n @replication_admin.listPeers\n end", "title": "" }, { "docid": "a86d6483338621da2454b8a3b6b6c827", "score": "0.5775729", "text": "def list_peers\n @replication_admin.listPeers\n end", "title": "" }, { "docid": "f74b238658cb4f3911335a47f295ec39", "score": "0.5749757", "text": "def get_instances\n\t\t\t@cluster.getInstances()\n\t\tend", "title": "" }, { "docid": "33d2e77be68b64661cc5c8df69315aec", "score": "0.5734979", "text": "def all\n @hosts\n end", "title": "" }, { "docid": "0f64c32cb246994c800dc10880d767a5", "score": "0.57345957", "text": "def list_servers\n params = {\n 'command' => 'listVirtualMachines'\n }\n json = send_request(params)\n json['virtualmachine'] || []\n end", "title": "" }, { "docid": "b5f3dbbc98f5963aed66c30309d8773b", "score": "0.5729564", "text": "def servers\n return self.bare_metal_servers + self.virtual_servers\n end", "title": "" }, { "docid": "5470e53212426fc808d7cf3d24680747", "score": "0.5712572", "text": "def servers\n response = get \"server\"\n data = JSON.parse response.body\n data[\"servers\"][\"server\"]\n end", "title": "" }, { "docid": "822953fa39a6d409371b05a95ee0b101", "score": "0.5702078", "text": "def discovered_servers\n servers.select {|s| s[:discovered] }\n end", "title": "" }, { "docid": "f56286ef256ae11ae488ec1677bc6733", "score": "0.569912", "text": "def servers\n endpoint.config.nodes.map{ |h| \"#{h[:host]}:#{h[:port]}\" }\n end", "title": "" }, { "docid": "99b82479d5400137de82af1f30bcacf5", "score": "0.56920594", "text": "def find_servers\n # need a run_context to find anything in\n return nil unless run_context\n # If there are already servers in attribs use those\n return node[:etcd][:servers] if node.key?(:etcd) &&\n node[:etcd].key?(:servers)\n\n # if we have already searched in this run use those\n return node.run_state[:etcd_servers] if node.run_state.key? :etcd_servers\n\n # find nodes and build array of ip's\n etcd_nodes = search(:node, search_query)\n servers = etcd_nodes.map { |n| n[:ipaddress] }\n\n # store that in the run_state\n node.run_state[:etcd_servers] = servers\n end", "title": "" }, { "docid": "bb912ec071f107d9e7ec299fbda7052f", "score": "0.56868327", "text": "def passive\n fetch('electrical_components.passive')\n end", "title": "" }, { "docid": "e1081b6b5433196683afc3e346a3a152", "score": "0.56823176", "text": "def hosts\n @results.map(&:host)\n end", "title": "" }, { "docid": "5e70f2de5b80d5d22e8f80df441fe45e", "score": "0.56541663", "text": "def fetchServers(lane=nil)\n servers = []\n\n @conn.servers.each{ |server|\n s = {\n :ip => server.public_ip_address,\n :lane => server.tags['Lane'],\n :name => server.tags['Name'],\n :id => server.id\n }\n if s[:ip]\n if lane == nil or lane == s[:lane]\n servers.push s\n end\n end\n };\n\n servers.sort_by!{ |s| [s[:lane] ? s[:lane] : \"zzz\", s[:name]] }\n\n return servers\n end", "title": "" }, { "docid": "302c26fd7b288a6a07cebc302cb0ee18", "score": "0.5651892", "text": "def passive\n\tm=[]\n\n\t# Version Detection # HTTP Server Header\n\tif @headers[\"server\"] =~ / rus\\/(PL[^\\s]+)/\n\t\tm << { :version=>\"#{$1}\" }\n\tend\n\n\t# Return passive matches\n\tm\nend", "title": "" }, { "docid": "47b00bdb20adc8c1a190d207e607f468", "score": "0.56480783", "text": "def candidates(cluster)\n servers = cluster.servers\n servers.each do |server|\n validate_max_staleness_support!(server)\n end\n if cluster.single?\n servers\n elsif cluster.sharded?\n servers\n elsif cluster.replica_set?\n select_in_replica_set(servers)\n else\n # Unknown cluster - no servers\n []\n end\n end", "title": "" }, { "docid": "60f5ad9162149b59a8d402272f525d0a", "score": "0.56314635", "text": "def servers\n print_servers\n end", "title": "" }, { "docid": "4f7bdf62803eedac3de0f5e5c819f9c5", "score": "0.56173986", "text": "def list\n if options[:server]\n server = Chaos::Server.new \"ssh://#{options[:server]}\"\n\n display_ \"Addons availables on '#{server}'...\", :topic\n server.addons\n elsif options[:provider]\n server = Chaos::Server.new \"ssh://#{options[:provider]}\"\n\n display_ \"Servicepacks availables on '#{server}'...\", :topic\n server.servicepacks\n end\n end", "title": "" }, { "docid": "c18b80bb7f44f81c6c50cf1c5afe8d18", "score": "0.56136143", "text": "def live_hosts_ary\n hosts = []\n if @xmlfi.scanner[\"arguments\"].include?(\"-Pn\")\n parse_live_hosts.each {|host| hosts.push(host.ip.to_s)}\n else\n parse_up_hosts.each {|host| hosts.push(host.ip.to_s)}\n end\n return hosts\n end", "title": "" }, { "docid": "56e76d43f849324e745de053feffebc1", "score": "0.5611541", "text": "def passive(target)\n m = []\n\n # Version Detection # HTTP Server Header\n if target.headers[\"server\"] =~ / rus\\/(PL[^\\s]+)/\n m << { version: $1.to_s }\n end\n\n # Return passive matches\n m\n end", "title": "" }, { "docid": "334a2a8ab5cc0290a1b6fa54654bc5c4", "score": "0.55952936", "text": "def servers\n slice(indexes)\n end", "title": "" }, { "docid": "52b8ebbd3230f9f9ea396c25fbf757cc", "score": "0.55782694", "text": "def serversForCapRoles(roles)\n find_servers(:roles => roles).collect { |x| x.host }\nend", "title": "" }, { "docid": "52b8ebbd3230f9f9ea396c25fbf757cc", "score": "0.55782694", "text": "def serversForCapRoles(roles)\n find_servers(:roles => roles).collect { |x| x.host }\nend", "title": "" }, { "docid": "f49b24e98a6243bf7f496194d5cf4723", "score": "0.5572011", "text": "def servers\n unless @servers\n roles = [*(@options[:roles] || actor.configuration.roles.keys)].\n map { |name|\n actor.configuration.roles[name] or\n raise ArgumentError, \"task #{self.name.inspect} references non-existant role #{name.inspect}\"\n }.flatten\n only = @options[:only] || {}\n\n unless only.empty?\n roles = roles.delete_if do |role|\n catch(:done) do\n only.keys.each do |key|\n throw(:done, true) if role.options[key] != only[key]\n end\n false\n end\n end\n end\n\n @servers = roles.map { |role| role.host }.uniq\n end\n\n @servers\n end", "title": "" }, { "docid": "6dd5450b982a13fe2794770d6d80ac4d", "score": "0.5563765", "text": "def all_servers\n\n if block_given? then\n @cs_conn.servers.each do |server|\n yield server\n end\n else\n @cs_conn.servers\n end\n\n end", "title": "" }, { "docid": "6dd5450b982a13fe2794770d6d80ac4d", "score": "0.5563765", "text": "def all_servers\n\n if block_given? then\n @cs_conn.servers.each do |server|\n yield server\n end\n else\n @cs_conn.servers\n end\n\n end", "title": "" }, { "docid": "a93610d327139d6891257b9144aead6d", "score": "0.5553692", "text": "def servers\n @servers ||= find_servers_missing_gem\n end", "title": "" }, { "docid": "9093687c27f3a91df26a63a925169f22", "score": "0.5552622", "text": "def servers\n @servers ||= {}\n @servers\n end", "title": "" }, { "docid": "37312283e2500b6f7830efc08d4e004c", "score": "0.5550325", "text": "def get_instances\n logger.info \"getting instances for #{@hostname}\"\n compute_url=\"#{@compute_url}/servers/detail?all_tenants=true\"\n response_raw=RestClient::Request.execute(method: :get, :url => compute_url, headers: {\"X-Auth-Token\" => @token}, :verify_ssl => false)\n json_data = JSON.parse(response_raw.body)[\"servers\"]\n logger.info \"recieved #{json_data.count} instances from #{@hostname}\"\n json_data\n end", "title": "" }, { "docid": "d95ab4d11bd01a8b0bf8c064eacd46e9", "score": "0.55454", "text": "def hosts\n @hosts\n end", "title": "" }, { "docid": "d95ab4d11bd01a8b0bf8c064eacd46e9", "score": "0.55450577", "text": "def hosts\n @hosts\n end", "title": "" }, { "docid": "d95ab4d11bd01a8b0bf8c064eacd46e9", "score": "0.55450577", "text": "def hosts\n @hosts\n end", "title": "" }, { "docid": "6606966adff5c8a5328fbe35ea4cf7c6", "score": "0.55445564", "text": "def get_all_remote_ports()\n @db.execute(\"SELECT DISTINCT(remote) FROM ports\").flatten\n end", "title": "" }, { "docid": "d95ab4d11bd01a8b0bf8c064eacd46e9", "score": "0.55437034", "text": "def hosts\n @hosts\n end", "title": "" }, { "docid": "494cc8bf6b5eacd6e053a7a03a4128b4", "score": "0.5540546", "text": "def get_write_hosts(cluster)\n write_hosts=[]\n @raw[\"servers\"].each do |srv, d|\n if d[\"writefor\"].class == Array\n write_hosts << srv if d[\"writefor\"].include? cluster and host_active? srv\n elsif d[\"writefor\"].class == String\n write_hosts << srv if d[\"writefor\"] == cluster and host_active? srv\n end\n end\n write_hosts\n end", "title": "" }, { "docid": "225b270257d7476c69de89b80d0b5b42", "score": "0.55379874", "text": "def list_peers\n @admin.listReplicationPeers\n end", "title": "" }, { "docid": "b3a8cd52ea3b4cbc31295838da9a37b4", "score": "0.55366105", "text": "def servers(token)\n Discordrb::API.request(\n :users_me_guilds,\n nil,\n :get,\n \"#{Discordrb::API.api_base}/users/@me/guilds\",\n Authorization: token\n )\n end", "title": "" }, { "docid": "0fd1d3368102d2cff51c76d42c0a221e", "score": "0.5524434", "text": "def migration_host_list\n servers(:db).select { |srv| srv.options[:primary] == true }.map { |x| x.to_s }\n end", "title": "" }, { "docid": "e5fc63d892456ffe8dc71d5d29a09398", "score": "0.55062264", "text": "def list\n database.clusters\n end", "title": "" }, { "docid": "4aec277870847ff4d46fc2bb81c2c678", "score": "0.5498783", "text": "def node_list\n nodes = []\n nodes += config['hosts'] if config['hosts']\n nodes += config['passives'] if config['passives']\n nodes += [\"#{@host}:#{@port}\"] if @client.mongos?\n nodes\n end", "title": "" }, { "docid": "8f444c25da23e60d24871e8d089e1bd5", "score": "0.54946077", "text": "def hosts\n return @hosts\n end", "title": "" }, { "docid": "5f4509c135edaef2ed53ae0cff60101a", "score": "0.54923326", "text": "def list_active\n xml = Hudson.client.server_info\n server_info_parser = Hudson::Parser::ServerInfo.new(xml)\n\n server_info_parser.active_jobs\n end", "title": "" }, { "docid": "48ca49a1fdeb2bd562bf98366c9c670d", "score": "0.5486444", "text": "def list_servers\n vms = VSphereAutomation::VCenter::VMApi.new(api_client).list.value\n\n # list_resource_command uses .send(:name) syntax, so convert to OpenStruct to keep it compatible\n vms.map { |vmsummary| OpenStruct.new(vmsummary.to_hash) }\n end", "title": "" }, { "docid": "3d9807fe99cae5012849ed5064bbb58f", "score": "0.5484227", "text": "def hosts\n @hosts ||= request(\"hosts\").exec_sync(:get).parse\n end", "title": "" }, { "docid": "b293d2ad1bdf02439407beae60edc8fd", "score": "0.5479427", "text": "def each_server()\n futures = []\n\n servers.each do |s|\n server = s.clone.freeze\n\n futures << Celluloid::Future.new do\n yield server\n end\n end\n\n return_values = []\n\n futures.each do |f|\n return_values << f.value\n end\n\n return return_values\n end", "title": "" }, { "docid": "c5721b85e7638b89d28114a019e812ee", "score": "0.5476916", "text": "def ntp_servers\n get_attribute_values(\"ntp-servers\")\n end", "title": "" }, { "docid": "9a786298972638f682b3cb04a690bc49", "score": "0.54628086", "text": "def list_servers\n request_path = '/servers'\n request = BaseManagement::SqlManagementHttpRequest.new(:get, request_path, nil)\n response = request.call\n Serialization.databases_from_xml(response)\n end", "title": "" }, { "docid": "10c91b2a9facb5f48becf96ba24afa03", "score": "0.5456658", "text": "def hosts\n @data[:hosts]\n end", "title": "" }, { "docid": "b5da3987c413b5ccb3654465bf4d52a7", "score": "0.54461", "text": "def listening_hosts(target_hosts=installed_hosts)\n host_entries = BACH::ClusterDef.new(repo_dir: BACH::ClusterData::repo_dir).fetch_cluster_def.select do |entry|\n target_hosts.include?(entry[:hostname]) ||\n target_hosts.include?(entry[:fqdn])\n end\n\n host_entries.select do |entry|\n look_for_ssh_banner(entry[:ip_address])\n end.map do |entry|\n entry[:hostname]\n end\nend", "title": "" }, { "docid": "269196eeb1ae6ee9bce6dd2025297c69", "score": "0.54412466", "text": "def passive\n\tm=[]\n\n\t# HTTP Server Header or HTTP \"Server \" Header\n\tif @headers[\"server\"] =~ /^Tandberg Television Web server$/ or @headers[\"server \"] =~ /^Tandberg Television Web server$/\n\t\tm << { :name=>\"HTTP Server Header\" }\n\tend\n\n\t# Return passive matches\n\tm\nend", "title": "" }, { "docid": "0219da1db8c49b9758fb86b8fe10b818", "score": "0.543449", "text": "def servers\n local_server_address = cluster_manager.local_server_address\n servers={local_server_address => {:server_address => local_server_address}}\n cluster_manager.servers.each do |k,v|\n servers[k] = v.to_hash\n end\n content={:servers => servers}\n respond 200, content\n end", "title": "" }, { "docid": "29a1c069aaf833190d49f6caff537ab9", "score": "0.54315627", "text": "def servers(auth)\n MijDiscord::Core::API.request(\n :users_me_guilds,\n nil,\n :get,\n \"#{MijDiscord::Core::API::APIBASE_URL}/users/@me/guilds\",\n Authorization: auth\n )\n end", "title": "" }, { "docid": "696ebdaebaac0ef8851eba6a1c563865", "score": "0.5420644", "text": "def get_server_instances(results)\n results.each do |result|\n reservations = result.reservations\n reservations.each do |res|\n return res.instances\n end\n end\n end", "title": "" }, { "docid": "48d9dc9ba20219c4e51dca82c77a6d78", "score": "0.54139817", "text": "def db_servers\n data['instances'].select { |i| %w{ db_master db_slave solo }.include? i['role'] }.map { |i| i['public_hostname'] }.sort.join ','\n end", "title": "" }, { "docid": "b32e3e6a4bc5bdb40db95bc1ae1a82d7", "score": "0.54139477", "text": "def get_servers(bot)\n bot.servers.map {|key, server| server.name}.join(', ')\n end", "title": "" }, { "docid": "33e86e26e1285216339ff7f45b0f66b1", "score": "0.54098636", "text": "def vms(opts = {})\n client.servers\n end", "title": "" }, { "docid": "2015330a1aac69663585f27bb34661e1", "score": "0.5409739", "text": "def list\n Marshal.load(Marshal.dump(transports))\n end", "title": "" }, { "docid": "deab1de228ad4754878d6a668e1d29bd", "score": "0.5409351", "text": "def list_known_servers(resource_group)\n connect.servers(resource_group: resource_group).each do |sr|\n logger.debug sr.inspect\n end\n end", "title": "" }, { "docid": "6e50ae275a18d34f633f94d3a50b4bbb", "score": "0.5407161", "text": "def vms(opts = {})\n client.servers\n end", "title": "" }, { "docid": "cd0d413cf1ccdb4cae151320019a1944", "score": "0.54046965", "text": "def name_servers\n Array(@gapi[\"nameServers\"])\n end", "title": "" }, { "docid": "787c03ae344ad36eb6c4e2264df83b20", "score": "0.5403505", "text": "def get_server_config_result_list(opts = {})\n data, _status_code, _headers = get_server_config_result_list_with_http_info(opts)\n data\n end", "title": "" }, { "docid": "9f337607ad24c76311d4af185c831a46", "score": "0.53948075", "text": "def all_servers_by_type\n @all_servers_by_type ||= hcloud_client.servers.select do |server|\n server.server_type.id == server_type.id\n end\n end", "title": "" }, { "docid": "38a76f091574fa61673b718b278335a8", "score": "0.53779715", "text": "def passive\n\tm=[]\n\n\t# HTTP Server Header\n\tm << { :name=>\"HTTP Server Header\", :string=>\"Apache\" } if @headers[\"server\"] =~ /^MACOS_Personal_Websharing$/\n\n\t# Return passive matches\n\tm\nend", "title": "" }, { "docid": "56e19622e51ffb596761710dd7fa2da2", "score": "0.5367283", "text": "def listServers(_options)\n config = HBaseConfiguration.create\n\n zkw = org.apache.hadoop.hbase.zookeeper.ZKWatcher.new(config, 'draining_servers', nil)\n\n begin\n parentZnode = zkw.getZNodePaths.drainingZNode\n servers = ZKUtil.listChildrenNoWatch(zkw, parentZnode)\n servers.each { |server| puts server }\n ensure\n zkw.close\n end\nend", "title": "" }, { "docid": "f77222f5b35b2ea4df7aa6b32d3961ee", "score": "0.5357564", "text": "def addresses\n servers_list.map(&:address)\n end", "title": "" }, { "docid": "9ae8e7075e2066454141d97b744eb2a7", "score": "0.53494513", "text": "def list_hosts\n VSphereAutomation::VCenter::HostApi.new(api_client).list.value\n end", "title": "" } ]
6fe87ff203662720f0508066940988bb
Construct a multi expression.
[ { "docid": "47eed30d7e52dfda0805d11c513e1fb0", "score": "0.5943055", "text": "def expression(type = 0)\n # Defer to unary on UNARY precedence.\n if type == ExpressionType::LEFT_TERMINAL_UNARY\n return leftTerminalUnaryExpression()\n end\n \n # Read all available operators and higher expressions.\n m = MultiExpressionT.new(type)\n m.expressions.push(type == ExpressionType::OBJECT_ENTRY ? factor() : expression(type + 1))\n while accept(*ExpressionType::OPERATORS[type])\n m.operators.push(getTokenType)\n nextToken()\n\n # Parse the next expression or go to factor.\n m.expressions.push(type == ExpressionType::OBJECT_ENTRY ? factor() : expression(type + 1))\n end\n return m\n end", "title": "" } ]
[ { "docid": "c1b05e68fe2d4a5677f70a03d91af30e", "score": "0.6490256", "text": "def to_expression(*args)\n Expression.new([self, *args])\n end", "title": "" }, { "docid": "863c2037fc620ab18a0250971ba105ce", "score": "0.60522664", "text": "def many\n Rexp.new(parenthesized_encoding(POSTFIX) + apply_greedy(\"*\"), POSTFIX, capture_keys)\n end", "title": "" }, { "docid": "04b440ed48bc873f5fce2e404332ff7f", "score": "0.60150456", "text": "def add_expressions(*expressions); end", "title": "" }, { "docid": "241511d3e1d83992c58022724c64ff37", "score": "0.5920797", "text": "def to_expr\n return Concat.new(self.type,\n self.each_expression.map do |expr|\n expr.to_expr\n end\n )\n end", "title": "" }, { "docid": "a6697a5659f54ece962a6ea2bf371b1a", "score": "0.59140664", "text": "def concatenate expressions\n Expression.new(\n \"'|' || \" +\n expressions.map(&:to_s) * \" || '|' || \" +\n \" || '|'\",\n MM::DataType::TYPE_String,\n true\n )\n end", "title": "" }, { "docid": "21840be84b0f3aa8779fe5680dd556ec", "score": "0.59038883", "text": "def build_expression_tree(tree)\n Expressions::Expression.create(tree)\n end", "title": "" }, { "docid": "93248d8913f9a8340dadb432c143203f", "score": "0.58959335", "text": "def +(expression)\n Hexpress.new(*expressions + expression.expressions)\n end", "title": "" }, { "docid": "f9b3b0b6bbe1c51f1b18d3ababb8166a", "score": "0.5874709", "text": "def add_expression\n\tlazy do \n\t\tsequence(\n\t\t\tignore(\n\t\t\t\tchar(\"(\"),\n\t\t\t\tword(\"add\"), \n\t\t\t\tone_or_more(char(\" \"))\n\t\t\t),\n\t\t\texpression,\n\t\t\tignore(\n\t\t\t\tone_or_more(char(\" \"))\n\t\t\t),\n\t\t\texpression,\n\t\t\tignore(\n\t\t\t\tchar(\")\")\n\t\t\t)\n\t\t).apply {|expression1, expression2| Expressions.add(expression1, expression2)}\n\tend\nend", "title": "" }, { "docid": "33a62994754b7a377d0012a639b4d94b", "score": "0.5867299", "text": "def concatenate expressions\n Expression.new(\n \"'|'::text || \" +\n expressions.map(&:to_s) * \" || '|'::text || \" +\n \" || '|'::text\",\n MM::DataType::TYPE_String\n )\n end", "title": "" }, { "docid": "e3c42f0c46cdfeca9f7fa799aa8209bc", "score": "0.5820331", "text": "def to_expr\n elems = self.map {|elem| elem.to_expr }\n typ= TypeTuple.new(:\"\",:little)\n elems.each {|elem| typ.add_type(elem.type) }\n expr = Concat.new(typ)\n elems.each {|elem| expr.add_expression(elem) }\n expr\n end", "title": "" }, { "docid": "bb861dcad8b4f069e30eda6f7de446be", "score": "0.58101106", "text": "def initialize(*expressions)\n @expressions = []\n add_expressions(*expressions)\n end", "title": "" }, { "docid": "e783afc9df193eb1728feb4c68bb7d94", "score": "0.5761748", "text": "def compile_expression_list\n @commands << '<expressionList>'\n if !@tokens[@index].match(/\\)/)\n compile_expression\n end\n while !@tokens[@index].nil? && !@tokens[@index].match(/\\)/)\n next_token\n compile_expression\n end\n @commands << '</expressionList>'\n end", "title": "" }, { "docid": "3923c6fab14edf9c6a6fcbaa09ee3f3a", "score": "0.5753107", "text": "def compile_expression\n write_tag '<expression>'\n compile_term\n # exp1 op exp2\n while check_any?('+', '-', '<', '/', '=', '>', '&', '|', '*')\n op_token = advance\n compile_term\n @vm_writer.write_arithmetic(op_token.lexeme)\n end\n write_tag '</expression>'\n end", "title": "" }, { "docid": "1d7891818f54e1a036f96eddeced8ae3", "score": "0.5735485", "text": "def new_expression(owner)\n @create_count += 1\n logger.info \"Have created #{@create_count} expressions for #{self}\" if @create_count % 10 == 0\n # can limit the number of matches held to 1 because we're catching them in a downstream match set\n make_conjunct 1, true\n end", "title": "" }, { "docid": "5aca6861230c5a2ecb708dfa0c8805a9", "score": "0.57167035", "text": "def expressions; end", "title": "" }, { "docid": "5aca6861230c5a2ecb708dfa0c8805a9", "score": "0.57167035", "text": "def expressions; end", "title": "" }, { "docid": "5aca6861230c5a2ecb708dfa0c8805a9", "score": "0.57167035", "text": "def expressions; end", "title": "" }, { "docid": "5aca6861230c5a2ecb708dfa0c8805a9", "score": "0.57167035", "text": "def expressions; end", "title": "" }, { "docid": "5aca6861230c5a2ecb708dfa0c8805a9", "score": "0.57167035", "text": "def expressions; end", "title": "" }, { "docid": "5aca6861230c5a2ecb708dfa0c8805a9", "score": "0.57167035", "text": "def expressions; end", "title": "" }, { "docid": "4dcc85c433c081c0fcd16d496eb53eff", "score": "0.57085395", "text": "def concatenate expressions\n Expression.new(\n \"CONCAT('|', #{expressions.map(&:to_s)*', '})\",\n MM::DataType::TYPE_String,\n true\n )\n end", "title": "" }, { "docid": "e84f7cb3a61ca1d217401832b64b3053", "score": "0.57075226", "text": "def expr(*args)\n # *args is a built-in Ruby variable which is a tuple of function args\n return { '$expr'=> args }\n end", "title": "" }, { "docid": "5926dfaa5eb94db4833fc9bb44146450", "score": "0.569465", "text": "def build(expressions)\n expressions.flat_map do |expression|\n filters.map do |filter|\n filter.apply(expression)\n end\n end.uniq\n end", "title": "" }, { "docid": "efc4a80b8641d0a452da00c77a20f5fe", "score": "0.56620055", "text": "def __multi__(criterion, operator)\n clone.tap do |query|\n sel = query.selector\n criterion.flatten.each do |expr|\n next unless expr\n criteria = sel[operator] || []\n normalized = expr.inject({}) do |hash, (field, value)|\n hash.merge!(field.specify(value.__expand_complex__))\n hash\n end\n sel.store(operator, criteria.push(normalized))\n end\n end\n end", "title": "" }, { "docid": "56c7c7b3a7ddd11eec304af1129555ab", "score": "0.56174123", "text": "def complex_expression_arg_pairs(args)\n case args.length\n when 1\n args[0]\n when 2\n yield args[0], args[1]\n else\n args.inject{|m, a| yield(m, a)}\n end\n end", "title": "" }, { "docid": "945c6969d184354e6ca3055aa30b0494", "score": "0.55502737", "text": "def to_expression_chain\n ExpressionChain.new([self])\n end", "title": "" }, { "docid": "a6a45f4b4aac3dbcd80a80d7503c9bde", "score": "0.55445546", "text": "def make_seq pexprs\n sexprs = []\n until pexprs.empty?\n a = to_abstract pexprs.shift\n if a.kind_of? Proc\n a = a.call make_seq(pexprs)\n pexprs = []\n end\n sexprs.push a\n end\n AST::Seq.new sexprs\n end", "title": "" }, { "docid": "cbda0fd440bd6d284376a0c183955452", "score": "0.5531074", "text": "def nested_expressions\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 139 )\n return_value = NestedExpressionsReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n nested_expressions_start_index = @input.index\n\n root_0 = nil\n __COMMA852__ = nil\n nested_expression851 = nil\n nested_expression853 = nil\n\n tree_for_COMMA852 = nil\n\n success = false # flag used for memoization\n\n begin\n # rule memoization\n if @state.backtracking > 0 and already_parsed_rule?( __method__ )\n success = true\n return return_value\n end\n root_0 = @adaptor.create_flat_list\n\n\n # at line 795:4: nested_expression ( COMMA nested_expression )*\n @state.following.push( TOKENS_FOLLOWING_nested_expression_IN_nested_expressions_5002 )\n nested_expression851 = nested_expression\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, nested_expression851.tree )\n end\n # at line 795:22: ( COMMA nested_expression )*\n while true # decision 221\n alt_221 = 2\n look_221_0 = @input.peek( 1 )\n\n if ( look_221_0 == COMMA )\n alt_221 = 1\n\n end\n case alt_221\n when 1\n # at line 795:24: COMMA nested_expression\n __COMMA852__ = match( COMMA, TOKENS_FOLLOWING_COMMA_IN_nested_expressions_5006 )\n if @state.backtracking == 0\n\n tree_for_COMMA852 = @adaptor.create_with_payload( __COMMA852__ )\n @adaptor.add_child( root_0, tree_for_COMMA852 )\n\n end\n @state.following.push( TOKENS_FOLLOWING_nested_expression_IN_nested_expressions_5008 )\n nested_expression853 = nested_expression\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, nested_expression853.tree )\n end\n\n else\n break # out of loop for decision 221\n end\n end # loop for decision 221\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n success = true\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 139 )\n memoize( __method__, nested_expressions_start_index, success ) if @state.backtracking > 0\n\n end\n \n return return_value\n end", "title": "" }, { "docid": "3358017cccba61d466340f3ea0120077", "score": "0.55307555", "text": "def initialize\n @expressions = Array.new\n end", "title": "" }, { "docid": "71f32c48e27b940bf57c498b6b751486", "score": "0.5527482", "text": "def expressions\n valued_parameters.map do |key, value|\n to_expr(key, value)\n end\n end", "title": "" }, { "docid": "3aa5738fc9c4105aafbf40ce392e145f", "score": "0.55218166", "text": "def reduce_variadic_formals(_production, _range, _tokens, theChildren)\n SkmFormals.new([theChildren[0]], :variadic)\n end", "title": "" }, { "docid": "57905a488c056f5323d5c545af1e3ee8", "score": "0.5516516", "text": "def new(_ast)\n expr_class.new(_ast, self)\n end", "title": "" }, { "docid": "70b38c37ce32be10863ca6471699b090", "score": "0.55027497", "text": "def sql_expressions\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 149 )\n return_value = SqlExpressionsReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n sql_expressions_start_index = @input.index\n\n root_0 = nil\n __COMMA895__ = nil\n sql_expression894 = nil\n sql_expression896 = nil\n\n tree_for_COMMA895 = nil\n\n success = false # flag used for memoization\n\n begin\n # rule memoization\n if @state.backtracking > 0 and already_parsed_rule?( __method__ )\n success = true\n return return_value\n end\n root_0 = @adaptor.create_flat_list\n\n\n # at line 842:4: sql_expression ( COMMA sql_expression )*\n @state.following.push( TOKENS_FOLLOWING_sql_expression_IN_sql_expressions_5283 )\n sql_expression894 = sql_expression\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, sql_expression894.tree )\n end\n # at line 842:19: ( COMMA sql_expression )*\n while true # decision 232\n alt_232 = 2\n look_232_0 = @input.peek( 1 )\n\n if ( look_232_0 == COMMA )\n look_232_2 = @input.peek( 2 )\n\n if ( syntactic_predicate?( :synpred374_Plsql ) )\n alt_232 = 1\n\n end\n\n end\n case alt_232\n when 1\n # at line 842:21: COMMA sql_expression\n __COMMA895__ = match( COMMA, TOKENS_FOLLOWING_COMMA_IN_sql_expressions_5287 )\n if @state.backtracking == 0\n\n tree_for_COMMA895 = @adaptor.create_with_payload( __COMMA895__ )\n @adaptor.add_child( root_0, tree_for_COMMA895 )\n\n end\n @state.following.push( TOKENS_FOLLOWING_sql_expression_IN_sql_expressions_5289 )\n sql_expression896 = sql_expression\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, sql_expression896.tree )\n end\n\n else\n break # out of loop for decision 232\n end\n end # loop for decision 232\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n success = true\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 149 )\n memoize( __method__, sql_expressions_start_index, success ) if @state.backtracking > 0\n\n end\n \n return return_value\n end", "title": "" }, { "docid": "1c428282b1d5fa03ee61ca3f59fb6e93", "score": "0.54997206", "text": "def initialize(exprs)\n @exprs = exprs\n end", "title": "" }, { "docid": "e5be9953ff82f156a8a05ef2cc67eb14", "score": "0.5488661", "text": "def reduce_multiple_cmd_def(_production, _range, _tokens, theChildren)\n theChildren[0].append(theChildren[1])\n theChildren[0]\n end", "title": "" }, { "docid": "6b9fd4963acd3add23be7642ba2ee143", "score": "0.54840523", "text": "def expr\n [\n [ :N, :expr, [ :simple_expression ] ],\n [ :M, :expr, [ :compound_expr ] ],\n [ :N, :expr, [ :function_expression ] ],\n [ :L, :expr, [ :case_expression ] ],\n [ :L, :expr, [ :scalar_subquery_expression ] ],\n [ :L, :expr, [ :datetime_expression ] ],\n\n\n # Simple expressionsxs\n\n [ :N, :simple_expression, [ :expr_column ], :squeezeBlanks ],\n [ :L, :simple_expression, [ :rownum ] ],\n [ :M, :simple_expression, [ :string ] ],\n [ :M, :simple_expression, [ :numeric_value ] ],\n [ :L, :simple_expression, [ :null ] ],\n [ :L, :simple_expression, [ :sequence_expr ] ],\n\n [ :L, :expr_column, [ :query_ref, :dot, :column_ref ] ],\n [ :L, :expr_column, [ :query_ref, :dot, :rowid ] ],\n [ :N, :expr_column, [ :column_ref ], :columnRefRep ],\n [ :L, :expr_column, [ :rowid ] ],\n [ :N, :expr_column, [ :table_ref, :dot, :column_ref ],\n :columnTableRefRep],\n [ :L, :expr_column, [ :table_ref, :dot, :rowid ] ],\n [ :L, :expr_column, [ :view_ref, :dot, :column_ref ] ],\n [ :L, :expr_column, [ :view_ref, :dot, :rowid ] ],\n [ :L, :expr_column, [ :materialized_view_ref, :dot, :column_ref ] ],\n [ :L, :expr_column, [ :materialized_view_ref, :dot, :rowid ] ],\n [ :N, :expr_column,\n [ :schema_ref, :dot, :table_ref, :dot, :column_ref ],\n :columnTableSchemaRefRep ],\n [ :L, :expr_column,\n [ :schema_ref, :dot, :table_ref, :dot, :rowid ] ],\n [ :L, :expr_column,\n [ :schema_ref, :dot, :view_ref, :dot, :column_ref ] ],\n [ :L, :expr_column,\n [ :schema_ref, :dot, :view_ref, :dot, :rowid ] ],\n [ :L, :expr_column,\n [ :schema_ref, :dot, :materialized_view_ref, :dot, :column_ref ] ],\n [ :L, :expr_column,\n [ :schema_ref, :dot, :materialized_view_ref, :dot, :rowid ] ],\n\n [ :N, :query_ref, [ :ident ], :queryRefRep ],\n [ :N, :view_ref, [ :ident ], :viewRefRep ],\n [ :N, :materialized_view_ref, [ :ident ] ],\n\n [ :N, :sequence_expr, [ :sequence_name, :dot, :currval ],\n :squeezeBlanks],\n [ :N, :sequence_expr, [ :sequence_name, :dot, :nextval ],\n :squeezeBlanks],\n\n # Compound expressions\n\n [ :N, :compound_expr, [ :parened_expr ] ],\n [ :M, :compound_expr, [ :expr, :plus, :expr ] ],\n [ :M, :compound_expr, [ :expr, :minus_sign, :expr ] ],\n [ :M, :compound_expr, [ :expr, :asterisk, :expr ], :tightOperRep ],\n [ :M, :compound_expr, [ :expr, :slash, :expr ], :tightOperRep ],\n [ :M, :compound_expr, [ :expr, :strokestroke, :expr ] ],\n [ :L, :compound_expr, [ :plus, :expr ], :tightUnaryRep ],\n [ :L, :compound_expr, [ :minus_sign, :expr ], :tightUnaryRep ],\n [ :L, :compound_expr, [ :prior, :expr ] ],\n\n [ :N, :parened_expr, [ :lparen, :expr, :rparen ], :tightParenRep ],\n\n [ :N, :expr_list, [ :expr ] ],\n [ :L, :expr_list, [ :expr_list, :comma, :expr_list ], :betterCommas ],\n\n [ :N, :parened_expr_list, [ :lparen, :expr_list, :rparen ],\n :tightParenRep ],\n\n [ :N, :parened_expr_list2_element, [ :expr_list ] ],\n [ :N, :parened_expr_list2_element, [ :parened_expr_list ] ],\n\n [ :N, :parened_expr_list2_body, [ :parened_expr_list2_element ] ],\n [ :L, :parened_expr_list2_body,\n [ :parened_expr_list2_body, :comma, :parened_expr_list2_element ] ],\n\n [ :N, :parened_expr_list2,\n [ :lparen, :parened_expr_list2_body, :rparen ], :tightParenRep ],\n\n # Function expressions\n\n [ :N, :function_expression, [ :function ] ],\n\n # CASE expressions\n\n [ :N, :case_expression,\n [ :case, :simple_case_expression, :else_clause, :end ] ],\n [ :N, :case_expression,\n [ :case, :simple_case_expression, :end ] ],\n [ :N, :case_expression,\n [ :case, :searched_case_expression, :else_clause, :end ] ],\n [ :N, :case_expression,\n [ :case, :searched_case_expression, :end ] ],\n\n [ :N, :simple_case_expression, [ :expr, :simple_case_clause ] ],\n [ :L, :simple_case_expression,\n [ :simple_case_expression, :simple_case_clause ] ],\n\n [ :N, :simple_case_clause, [ :when, :expr, :then, :expr ] ],\n\n [ :N, :searched_case_expression, [ :searched_case_clause ] ],\n [ :L, :searched_case_expression,\n [ :searched_case_expression, :searched_case_clause ] ],\n\n [ :N, :searched_case_clause, [ :when, :condition, :then, :expr ] ],\n\n [ :N, :else_clause, [ :else, :expr ] ],\n\n [ :N, :scalar_subquery_expression, [ :parened_subquery ] ],\n\n # Date time expressions\n\n [ :N, :datetime_expression, [ :expr, :at, :local ] ],\n [ :N, :datetime_expression, [ :expr, :at, :time, :zone, :dbtimezone ] ],\n [ :N, :datetime_expression,\n [ :expr, :at, :time, :zone, :sessiontimezone ] ],\n [ :N, :datetime_expression, [ :expr, :at, :time, :zone, :expr ] ],\n\n # Special cases of expr lists\n\n [ :N, :parened_two_exprs, [ :parened_two_exprs_list ], :betterCommas ],\n [ :N, :parened_two_exprs_body, [ :expr, :comma, :expr ] ],\n [ :N, :parened_two_exprs_list,\n [ :lparen, :parened_two_exprs_body, :rparen ], :tightParenRep ],\n\n [ :N, :parened_three_exprs,\n [ :parened_three_exprs_list ], :betterCommas],\n [ :N, :parened_three_exprs_body,\n [ :expr, :comma, :expr, :comma, :expr ] ],\n [ :N, :parened_three_exprs_list,\n [ :lparen, :parened_three_exprs_body, :rparen ], :tightParenRep ],\n\n [ :N, :parened_four_exprs,\n [ :parened_four_exprs_list ], :betterCommas],\n [ :N, :parened_four_exprs_body,\n [ :expr, :comma, :expr, :comma, :expr, :comma, :expr ] ],\n [ :N, :parened_four_exprs_list,\n [ :lparen, :parened_four_exprs_body, :rparen ], :tightParenRep ],\n\n ] +\n\n function\n end", "title": "" }, { "docid": "46c8584343d614da8a8807654f75313c", "score": "0.5462617", "text": "def expressions=(_arg0); end", "title": "" }, { "docid": "46c8584343d614da8a8807654f75313c", "score": "0.5462617", "text": "def expressions=(_arg0); end", "title": "" }, { "docid": "46c8584343d614da8a8807654f75313c", "score": "0.5462617", "text": "def expressions=(_arg0); end", "title": "" }, { "docid": "46c8584343d614da8a8807654f75313c", "score": "0.5462617", "text": "def expressions=(_arg0); end", "title": "" }, { "docid": "46c8584343d614da8a8807654f75313c", "score": "0.5462617", "text": "def expressions=(_arg0); end", "title": "" }, { "docid": "4ab12880513f336b63e15103a6a220ed", "score": "0.54572266", "text": "def plsql_expressions\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 142 )\n return_value = PlsqlExpressionsReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n plsql_expressions_start_index = @input.index\n\n root_0 = nil\n __COMMA858__ = nil\n plsql_expression857 = nil\n plsql_expression859 = nil\n\n tree_for_COMMA858 = nil\n\n success = false # flag used for memoization\n\n begin\n # rule memoization\n if @state.backtracking > 0 and already_parsed_rule?( __method__ )\n success = true\n return return_value\n end\n root_0 = @adaptor.create_flat_list\n\n\n # at line 808:4: plsql_expression ( COMMA plsql_expression )*\n @state.following.push( TOKENS_FOLLOWING_plsql_expression_IN_plsql_expressions_5059 )\n plsql_expression857 = plsql_expression\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, plsql_expression857.tree )\n end\n # at line 808:21: ( COMMA plsql_expression )*\n while true # decision 223\n alt_223 = 2\n look_223_0 = @input.peek( 1 )\n\n if ( look_223_0 == COMMA )\n alt_223 = 1\n\n end\n case alt_223\n when 1\n # at line 808:23: COMMA plsql_expression\n __COMMA858__ = match( COMMA, TOKENS_FOLLOWING_COMMA_IN_plsql_expressions_5063 )\n if @state.backtracking == 0\n\n tree_for_COMMA858 = @adaptor.create_with_payload( __COMMA858__ )\n @adaptor.add_child( root_0, tree_for_COMMA858 )\n\n end\n @state.following.push( TOKENS_FOLLOWING_plsql_expression_IN_plsql_expressions_5065 )\n plsql_expression859 = plsql_expression\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, plsql_expression859.tree )\n end\n\n else\n break # out of loop for decision 223\n end\n end # loop for decision 223\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n success = true\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 142 )\n memoize( __method__, plsql_expressions_start_index, success ) if @state.backtracking > 0\n\n end\n \n return return_value\n end", "title": "" }, { "docid": "8189e03c063099af23ed3b5e647e9546", "score": "0.54559284", "text": "def compileExpression(lines,i,endchar,parent)\n\tret = \"\"\n\twhile (i < lines.length && !endchar.include?(lines[i]))\n\t\ti,temp = compileTerm(lines,i,parent)\n\t\tret += temp\n\tend\n\tif ret != \"\" then ret = T('expression',ret) end\n\treturn [i,ret]\nend", "title": "" }, { "docid": "fb9890cf45004b8e710387f9dfa56831", "score": "0.5453432", "text": "def parse_expression\n\t\tExpressionNode.new(parse_term,parse_expression_prime)\n\tend", "title": "" }, { "docid": "cce4c35a5a62d5c2b41c9b83920991ca", "score": "0.5431564", "text": "def fillArguments()\n # fill arguments\n lastSplitPoint = 0\n depth = 0\n i = 0\n if @operator.length == 1\n while i < @text.length\n char = @text[i]\n if char == ' ' && depth == 0\n expr = Expression.new(@text[lastSplitPoint..i-1], @bindings)\n @arguments.push(expr)\n lastSplitPoint = i+1\n elsif char == '('\n depth += 1\n elsif char == ')'\n depth -= 1\n end\n i += 1\n end\n expr = Expression.new(@text[lastSplitPoint..-1], @bindings)\n @arguments.push(expr)\n elsif @operator == \"let\"\n depth = 0\n i = 0\n @text.split(\"\").each do |char|\n if char == '('\n depth += 1\n elsif char == ')'\n depth -= 1\n end\n\n if depth == 0\n break\n end\n i += 1\n end\n exprText = @text[i+2..-1]\n letText = @text[2..i-2]\n letBindings = letText.split(\") (\")\n letBindings.each do |elem|\n arr = elem.split(\" \")\n key = arr[0]\n val = arr[1]\n @bindings[key] = val\n end\n expr = Expression.new(exprText, @bindings)\n @arguments.push(expr)\n elsif @operator == \"quote\"\n @arguments.push(@text)\n elsif @operator == \"if\"\n chunks = []\n depth = 0\n lastSplitPoint = 0\n @text.split(\"\").each.with_index do |char, i|\n if char == ' ' && depth == 0\n chunks << @text[lastSplitPoint..i-1]\n lastSplitPoint = i+1\n elsif char == '('\n depth += 1\n elsif char == ')'\n depth -= 1\n end\n end\n chunks << @text[lastSplitPoint..-1]\n chunks.each.with_index do |elem, i|\n expr = Expression.new(chunks[i], @bindings)\n @arguments << expr\n end\n end\n end", "title": "" }, { "docid": "8d62dbb7bf18ba3d4d644f3f6b39c69f", "score": "0.54069555", "text": "def one_or_more\n Rexp.new(parenthesized_encoding(POSTFIX) + apply_greedy(\"+\"), POSTFIX, capture_keys)\n end", "title": "" }, { "docid": "9cebf07a8d4be7980657a2a365dee8c1", "score": "0.54045", "text": "def complex_expression_arg_pairs_append(sql, args, &block)\n literal_append(sql, complex_expression_arg_pairs(args, &block))\n end", "title": "" }, { "docid": "bb8e98c2a376fb9cef62c02bd89b3e91", "score": "0.54017234", "text": "def add_expressions(*expressions)\n self.expressions += expressions.flatten\n end", "title": "" }, { "docid": "1feceda8e327eb20f6bace3021d0af88", "score": "0.53891456", "text": "def reduce_simple_expression_1(_production, _range, _tokens, theChildren)\n reduce_binary_operator(theChildren)\n end", "title": "" }, { "docid": "1feceda8e327eb20f6bace3021d0af88", "score": "0.53891456", "text": "def reduce_simple_expression_1(_production, _range, _tokens, theChildren)\n reduce_binary_operator(theChildren)\n end", "title": "" }, { "docid": "1feceda8e327eb20f6bace3021d0af88", "score": "0.53891456", "text": "def reduce_simple_expression_1(_production, _range, _tokens, theChildren)\n reduce_binary_operator(theChildren)\n end", "title": "" }, { "docid": "7d0c67fa21f220ac7552a54d029636ae", "score": "0.5382174", "text": "def parse_exprs tokens\n e1, rest = eval_prefix tokens\n e2, rest = eval_prefix rest\n [e1,e2,rest]\nend", "title": "" }, { "docid": "f554b04091efb4a540fc2dc9a6a893bb", "score": "0.5362457", "text": "def _reduce_1(val, _values, result)\n result = Expression.new(Alternation.reduce(val[0], val[2])) \n result\nend", "title": "" }, { "docid": "9e47f9db2053863b5d32a407756a5265", "score": "0.5357463", "text": "def expr\n # keep the number of operands before we start\n # (useful for sub expressions)\n size = [@dat.size]\n\n while @pos < @expr.length\n # decide what to do with the next token\n next_token = scan\n #puts \"token: #{next_token}, operator? #{next_token.operator}\"\n case next_token.token_type\n when :open then\n subexpr\n when :close then\n # do nothing\n break \n when :cls_open then\n char_class\n when :rep_open then\n rep\n when :simple, :any, :range, :anchor then\n @dat.push(next_token)\n consume(next_token)\n when :or then\n if next_token.operands.size > 0\n # if the token already has operands\n # dont push it as an operator, just \n # add it as an operand (for example, \n # for \\w escape sequences)\n @dat.push(next_token)\n consume(next_token)\n else\n push_concat_oper(@dat.size - size.pop - 1, :or)\n push_operator(next_token)\n size.push(@dat.size)\n end\n else\n if next_token.operator then\n push_operator(next_token)\n else \n raise SyntaxError.new(\"Parsed invalid token: #{next_token} at #{@pos}\")\n end\n end\n end\n # nothing left on the input, pop operators off the stack until we hit the sentinel\n push_concat_oper(@dat.size - size.last - 1, :or) \n # check if we need to add any concatenate operator\n # how many operands since the last sentinel\n push_concat_oper(@dat.size - size.shift - 1)\n end", "title": "" }, { "docid": "6db2145617096a0d009f98d8d80a92a3", "score": "0.5355851", "text": "def add_expression(_arguments); end", "title": "" }, { "docid": "8b072d39164940a861f1b739d1632143", "score": "0.5355694", "text": "def add_operator_expressions(production, data)\n # Iterate through expression to create binary operations\n lhs = data[:Expression]\n while data[production] && !data[production].empty?\n op, rhs = data[production].shift, data[production].shift\n lhs = SPARQL::Algebra::Expression[op + lhs + rhs]\n end\n add_prod_datum(:Expression, lhs)\n end", "title": "" }, { "docid": "f9f845c12466befd5216ec5634f40971", "score": "0.53502196", "text": "def complex_expression_sql_append(sql, op, args)\n case op\n when :\"NOT LIKE\", :\"NOT ILIKE\"\n sql << 'NOT '\n complex_expression_sql_append(sql, (op == :\"NOT ILIKE\" ? :ILIKE : :LIKE), args)\n when :^\n complex_expression_arg_pairs_append(sql, args){|a, b| Sequel.lit([\"((~(\", \" & \", \")) & (\", \" | \", \"))\"], a, b, a, b)}\n when :**\n unless (exp = args[1]).is_a?(Integer)\n raise(Sequel::Error, \"can only emulate exponentiation on SQLite if exponent is an integer, given #{exp.inspect}\")\n end\n case exp\n when 0\n sql << '1'\n else\n sql << '('\n arg = args[0]\n if exp < 0\n invert = true\n exp = exp.abs\n sql << '(1.0 / ('\n end\n (exp - 1).times do \n literal_append(sql, arg)\n sql << \" * \"\n end\n literal_append(sql, arg)\n sql << ')'\n if invert\n sql << \"))\"\n end\n end\n when :extract\n part = args[0]\n raise(Sequel::Error, \"unsupported extract argument: #{part.inspect}\") unless format = EXTRACT_MAP[part]\n sql << \"CAST(strftime(\" << format << ', '\n literal_append(sql, args[1])\n sql << ') AS ' << (part == :second ? 'NUMERIC' : 'INTEGER') << ')'\n else\n super\n end\n end", "title": "" }, { "docid": "714d42b64db42892aa885d4dbab13e92", "score": "0.5340826", "text": "def expression_matter(a,b,c)\n array = [(a + b + c), ((a * b) + c), (a + (b * c)), (a * b * c), (a * (b + c)), ((a + b)* c)]\n array.max\nend", "title": "" }, { "docid": "2b522d2969fcb0ac3eb346e0feb9f319", "score": "0.53396565", "text": "def compile_expression_list(klass_name, subroutine_name)\n write_tag '<expressionList>'\n\n unless check?(')') # Emptylist\n compile_expression\n @number_of_args += 1\n end\n\n while match(',')\n compile_expression\n @number_of_args += 1\n end\n @vm_writer.write_call(\"#{klass_name}.#{subroutine_name}\", @number_of_args)\n write_tag '</expressionList>'\n end", "title": "" }, { "docid": "0db5ec42d766bcf09765676a796d551e", "score": "0.53203577", "text": "def __multi__(criteria, operator)\n clone.tap do |query|\n sel = query.selector\n criteria.flatten.each do |expr|\n next unless expr\n result_criteria = sel[operator] || []\n if expr.is_a?(Selectable)\n expr = expr.selector\n end\n normalized = _mongoid_expand_keys(expr)\n sel.store(operator, result_criteria.push(normalized))\n end\n end\n end", "title": "" }, { "docid": "08741bdc610fba996ef9eb1f4732bb3f", "score": "0.5308673", "text": "def to_expr\n return StringE.new(self.content,*self.each_arg.map(&:to_expr))\n end", "title": "" }, { "docid": "11893510431ed9e03ba0eb00a9cb8b75", "score": "0.52769864", "text": "def push *expr\n expr.each do |e|\n @data += compile(e)\n end\n end", "title": "" }, { "docid": "319fc84edcb63b41cda17dcfcd660fd1", "score": "0.5268831", "text": "def process_arglist(exp)\n Node.new(*exp.map { |val| process(val) })\n end", "title": "" }, { "docid": "8b0228ae5e9e7fa8805f0a6265992668", "score": "0.5264932", "text": "def parse_operators(expressions, operators_to_parse)\n\n i = 0\n while i < expressions.length\n expr = expressions[i]\n \n if expr.is_a?(Operator) and operators_to_parse.include?(expr.symbol)\n left = expressions[i - 1]\n right = expressions[i + 1]\n \n if expr.symbol == \"^\"\n expr = Exponent.new(left, right)\n elsif expr.symbol == \"*\"\n expr = Multiply.new(left, right)\n elsif expr.symbol == \"/\"\n expr = Divide.new(left, right)\n elsif expr.symbol == \"+\"\n expr = Add.new(left, right)\n elsif expr.symbol == \"-\"\n expr = Subtract.new(left, right)\n end\n \n expressions.slice!(i - 1, 3)\n expressions.insert(i - 1, expr)\n i -= 1\n end\n \n i += 1\n end # end i\n \n expressions\n end", "title": "" }, { "docid": "311f9d52ec996d4e4b7a95fa1f0143ce", "score": "0.5248512", "text": "def expressions \n @expressions = []\n @expressions << parse_frequency_and_interval\n @expressions << send(:\"parse_#{self.rules[:freq].downcase}\") if self.rules[:freq]\n @expressions << parse_start\n @expressions << parse_until\n @expressions.compact!\n @expressions\n end", "title": "" }, { "docid": "5e10eaa0938dec0c3368bff683a13e86", "score": "0.5222132", "text": "def compute expr\n expr = expr.chars\n until expr.length < 3\n res = 0\n val1, op, val2 = expr[0..2]\n\n if val1 == \"(\"\n start, stop = find_sub_expr(expr, 0)\n sub_res = compute(expr[start+1..stop-1].join)\n expr = [sub_res] + expr[stop+1..]\n next\n end\n if val2 == \"(\"\n start, stop = find_sub_expr(expr, 2)\n sub_res = compute(expr[start+1..stop-1].join)\n expr = [val1, op, sub_res] + expr[stop+1..]\n next\n end\n\n val1, val2 = val1.to_i, val2.to_i\n case op\n when \"+\"\n res = val1 + val2\n when \"*\"\n res = val1 * val2\n end\n expr = [res] + expr[3..]\n end\n expr[0]\nend", "title": "" }, { "docid": "3131b2d7e21287899ac66b92cf078aae", "score": "0.52140594", "text": "def initialize(expression, type = \"infix\", operator = nil, argument = nil)\n if type == \"direct\"\n @operator = operator\n @argument = argument\n return self\n end\n\n if type == \"infix\"\n expression = Infix.new(expression).to_rpn.to_array_tree\n elsif type == \"rpn\"\n expression = Rpn.new(expression).to_array_tree\n end\n\n #Now make tree of expressions\n if OPERATIONS[expression[0]]\n @operator = Token.new(expression[0])\n @argument = expression[1].map { |x| Expression.new(x,\"array\") }\n else\n @operator = Token.new(expression)\n @argument = nil\n end\n\n end", "title": "" }, { "docid": "3297cf93e26e3d6f6f8d3b1a86d39973", "score": "0.5208707", "text": "def parse_tokens_to_expression(tokens)\n with_numbers = parse_numbers(tokens)\n grouped = parse_groups(with_numbers)\n with_negations = parse_negate_operators(grouped)\n \n # Parse all the binary operators to make the tree.\n expressions = parse_operators(with_negations, [\"^\"])\n expressions = parse_operators(with_negations, [\"*\", \"/\"])\n expressions = parse_operators(expressions, [\"+\", \"-\"])\n \n expressions\n end", "title": "" }, { "docid": "b928c0d6b33e4897bed801ea9087dde7", "score": "0.5192876", "text": "def compileExpressionList(tokens)\n puts \"compiling ExpressionList\"\n ptr = 0\n\n if tokens[ptr].tag == :identifier or tokens[ptr].tag == :integerConstant then\n# codeWriter(tokens)\n# createExp(tokens[ptr...tokens.size])\n end\n# debugger\n if tokens[ptr].token != \")\"\n @xml.expression{\n\t@argnum = @argnum +1\n\t ptr = ptr + compileExpression(tokens[ptr...tokens.size])\n }\n\n while tokens[ptr].token == \",\"\n\t @xml.tag!(tokens[ptr].tag , \" #{tokens[ptr].token} \")\n\t ptr = ptr+1\n\n\t @argnum = @argnum + 1\n\n\t @xml.expression{\n\t ptr = ptr + compileExpression(tokens[ptr...tokens.size])\n\t }\n end\n# debugger\n else\n @xml.tag!(tokens[ptr].tag , \" #{tokens[ptr].token} \")\n ptr = ptr+1\n end\n\n puts \"finished ExpressionList\"\n return ptr\n end", "title": "" }, { "docid": "c4ca5df506fbd1369b65d31d06c4d090", "score": "0.51896787", "text": "def parse(expression, *values)\n # expand repeating variables\n # begin\n # md = expression.match(/(\\w+)\\[(\\d+)\\]/)\n # expression.sub!(/(\\w+)\\[(\\d+)\\]/, ([md[1]] * md[2].to_i) * \",\") if md\n # end until md.nil?\n\n # then split long the given bar as well as all the join variable\n # for both random variables and conditional random variables\n randvars, condvars = expression.to_s.split(/\\s*\\|\\s*/).map { |e| e.split(/\\s*,\\s*/) }\n condvars ||= []\n varvals = values[0..randvars.length - 1]\n givvals = values[(randvars.length)..(randvars.length + condvars.length)] || []\n \n return randvars.zip(varvals), condvars.zip(givvals)\n end", "title": "" }, { "docid": "79d55d2616de359c545ad865ec794745", "score": "0.5176326", "text": "def complex_expression_sql_append(sql, op, args)\n case op\n when :'||'\n literal_append(sql, Sequel.function(:concat, *args))\n when :LIKE, :'NOT LIKE'\n sql << PAREN_OPEN\n literal_append(sql, args.at(0))\n sql << SPACE << op.to_s << SPACE\n literal_append(sql, args.at(1))\n sql << PAREN_CLOSE\n when :~, :'!~', :'~*', :'!~*'\n if op == :'~*' || op == :'!~*'\n args = args.map{|a| Sequel.function(:upper, a)}\n end\n sql << NOT if op == :'!~' || op == :'!~*'\n sql << PAREN_OPEN\n literal_append(sql, args.at(0))\n sql << REGEXP\n literal_append(sql, args.at(1))\n sql << PAREN_CLOSE\n else\n super\n end\n end", "title": "" }, { "docid": "79d55d2616de359c545ad865ec794745", "score": "0.5176326", "text": "def complex_expression_sql_append(sql, op, args)\n case op\n when :'||'\n literal_append(sql, Sequel.function(:concat, *args))\n when :LIKE, :'NOT LIKE'\n sql << PAREN_OPEN\n literal_append(sql, args.at(0))\n sql << SPACE << op.to_s << SPACE\n literal_append(sql, args.at(1))\n sql << PAREN_CLOSE\n when :~, :'!~', :'~*', :'!~*'\n if op == :'~*' || op == :'!~*'\n args = args.map{|a| Sequel.function(:upper, a)}\n end\n sql << NOT if op == :'!~' || op == :'!~*'\n sql << PAREN_OPEN\n literal_append(sql, args.at(0))\n sql << REGEXP\n literal_append(sql, args.at(1))\n sql << PAREN_CLOSE\n else\n super\n end\n end", "title": "" }, { "docid": "c2c24b9d4ae12707d2f203938b2834ae", "score": "0.5171724", "text": "def input_expressions; end", "title": "" }, { "docid": "c2c24b9d4ae12707d2f203938b2834ae", "score": "0.5171724", "text": "def input_expressions; end", "title": "" }, { "docid": "0428c18721cbf774529754c3cb17aff3", "score": "0.5170795", "text": "def expr(tokens)\n case tokens\n in [Token::Ret] | [Token::Ret, Token::Eof]\n [Node::Ret.new(nil), [Token::Eof]]\n in [Token::Ret, *rest]\n node, tokens = primary(rest)\n [Node::Ret.new(node), [Token::Eof]]\n else\n assign(tokens)\n end\n end", "title": "" }, { "docid": "0b58f75410e5b3b7f6831551f26a9b2e", "score": "0.51630634", "text": "def reduce_dotted_formals(_production, _range, _tokens, theChildren)\n formals = theChildren[1] << theChildren[3]\n SkmFormals.new(formals, :variadic)\n end", "title": "" }, { "docid": "e91936aebf21dbfe25a2f985bfab6818", "score": "0.5158964", "text": "def parse(expression)\n stack =[]\n expression.each do |term|\n case term\n \n # If the term is an operand, push it to stack \n when /\\d/ \n stack.push(term)\n \n # If the term is an operator '* | \\'\n when /[ \\* \\/ ]/\n # Pop out two operands from the stack\n\t right_operand = stack.pop\n\t left_operand = stack.pop\n\t \n\t #Check for a compound operand, left and right define the match object\n\t left = /[\\+ \\- \\* \\/]/.match(left_operand)\n\t right = /[\\+ \\- \\* \\/]/.match(right_operand)\n\t \n\t #Check precedence to minimize parentheses \n\t #if left operand is compound, check precedence of the new operator with compound one.\n\t #left_par and right_par specifies whether to include parentheses or not\n\t if left\n\t left_par = check_precedence(term,left.to_s)\n\t elsif right \n\t right_par = check_precedence(term,right.to_s)\n\t end \n\t\n\t #If parentheses are required:\n\t if left_par || right_par\n \t#Place parentheses around the compound operands\n \t\tleft_operand = \"(\" + left_operand + \")\" if left\n\t\tright_operand = \"(\" + right_operand + \")\" if right \n end\n \n\t #Form a value by combining the left and right operand with operator in the middle\n\t val = left_operand + term + right_operand\n\t #Push the value to stack\n\t stack.push(val) \n \n #If operator is - or +\t\n when /[\\+ -]/\n # Pop the operands and form a value\n right_operand = stack.pop\n left_operand = stack.pop\n\t val = left_operand + term + right_operand\n #Push to stack\t \n\t stack.push(val)\n \t \n else \n #Invalid operator\n puts \"invalid operator{term}\"\n end\n end\n return stack\n end", "title": "" }, { "docid": "5a52c445e66d4b392a6209206a03a557", "score": "0.5148697", "text": "def create(*args)\n simplify command %Q|; return create(#{args.map{|a| value_ref(a)}.join(', ')});|\n end", "title": "" }, { "docid": "70bfdb058800eac5d8e2d5e762eb81f0", "score": "0.5146059", "text": "def expression\n case next_tk.tag\n when :EOL\n if current_tk.tag == :NUMBER then\n return Statement.number(current_tk)\n elsif current_tk.tag == :VARIABLE then\n return Statement.variable(current_tk)\n end\n when :ASSIGN\n left = current_tk\n forward\n skip_token(\"=\")\n return Statement.assign(left,simple_exp)\n when :INCRISE_OP, :MULTIPLY, :TO_POWER\n left = current_tk\n forward\n op = current_tk.value[0]\n skip_token(current_tk.tag)\n right = Statement.bin_op(op,left,simple_exp)\n return Statement.assign(left,right)\n else\n return simple_exp\n end\n end", "title": "" }, { "docid": "9a867afe4b208ca7e14539004cad8984", "score": "0.514202", "text": "def exprs(expr)\n expr.expressions.each {|e| evaluate(e) }\n end", "title": "" }, { "docid": "ca748bda09d25056bbeaa6fadd17409e", "score": "0.51289636", "text": "def input_expressions=(_arg0); end", "title": "" }, { "docid": "ca748bda09d25056bbeaa6fadd17409e", "score": "0.51289636", "text": "def input_expressions=(_arg0); end", "title": "" }, { "docid": "df9afdba8da89f33e77f9b4cfa4c0b2f", "score": "0.51267546", "text": "def select_expression\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 87 )\n return_value = SelectExpressionReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n select_expression_start_index = @input.index\n\n root_0 = nil\n string_literal586 = nil\n set587 = nil\n string_literal591 = nil\n string_literal593 = nil\n __LPAREN595__ = nil\n __RPAREN597__ = nil\n string_literal602 = nil\n string_literal605 = nil\n string_literal606 = nil\n string_literal607 = nil\n string_literal608 = nil\n select_list588 = nil\n keyBULK589 = nil\n keyCOLLECT590 = nil\n lvalues592 = nil\n join_clause594 = nil\n join_clause596 = nil\n table_reference_list598 = nil\n where_clause599 = nil\n hierarchical_query_clause600 = nil\n group_by_clause601 = nil\n sql_condition603 = nil\n model_clause604 = nil\n select_expression609 = nil\n subquery610 = nil\n order_by_clause611 = nil\n\n tree_for_string_literal586 = nil\n tree_for_set587 = nil\n tree_for_string_literal591 = nil\n tree_for_string_literal593 = nil\n tree_for_LPAREN595 = nil\n tree_for_RPAREN597 = nil\n tree_for_string_literal602 = nil\n tree_for_string_literal605 = nil\n tree_for_string_literal606 = nil\n tree_for_string_literal607 = nil\n tree_for_string_literal608 = nil\n\n success = false # flag used for memoization\n\n begin\n # rule memoization\n if @state.backtracking > 0 and already_parsed_rule?( __method__ )\n success = true\n return return_value\n end\n root_0 = @adaptor.create_flat_list\n\n\n # at line 575:3: 'SELECT' ( 'DISTINCT' | 'UNIQUE' | 'ALL' )? select_list ( keyBULK keyCOLLECT )? ( 'INTO' lvalues )? 'FROM' ( join_clause | LPAREN join_clause RPAREN | table_reference_list ) ( where_clause )? ( hierarchical_query_clause )? ( group_by_clause )? ( 'HAVING' sql_condition )? ( model_clause )? ( ( 'UNION' ( 'ALL' )? | 'INTERSECT' | 'MINUS' ) ( select_expression | subquery ) )? ( order_by_clause )?\n string_literal586 = match( T__116, TOKENS_FOLLOWING_T__116_IN_select_expression_3482 )\n if @state.backtracking == 0\n\n tree_for_string_literal586 = @adaptor.create_with_payload( string_literal586 )\n @adaptor.add_child( root_0, tree_for_string_literal586 )\n\n end\n # at line 575:26: ( 'DISTINCT' | 'UNIQUE' | 'ALL' )?\n alt_141 = 2\n alt_141 = @dfa141.predict( @input )\n case alt_141\n when 1\n # at line \n set587 = @input.look\n if @input.peek( 1 ).between?( T__117, T__119 )\n @input.consume\n if @state.backtracking == 0\n @adaptor.add_child( root_0, @adaptor.create_with_payload( set587 ) )\n end\n @state.error_recovery = false\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n mse = MismatchedSet( nil )\n raise mse\n end\n\n\n\n end\n @state.following.push( TOKENS_FOLLOWING_select_list_IN_select_expression_3501 )\n select_list588 = select_list\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, select_list588.tree )\n end\n # at line 576:3: ( keyBULK keyCOLLECT )?\n alt_142 = 2\n look_142_0 = @input.peek( 1 )\n\n if ( look_142_0 == ID )\n alt_142 = 1\n end\n case alt_142\n when 1\n # at line 576:5: keyBULK keyCOLLECT\n @state.following.push( TOKENS_FOLLOWING_keyBULK_IN_select_expression_3507 )\n keyBULK589 = keyBULK\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, keyBULK589.tree )\n end\n @state.following.push( TOKENS_FOLLOWING_keyCOLLECT_IN_select_expression_3509 )\n keyCOLLECT590 = keyCOLLECT\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, keyCOLLECT590.tree )\n end\n\n end\n # at line 577:3: ( 'INTO' lvalues )?\n alt_143 = 2\n look_143_0 = @input.peek( 1 )\n\n if ( look_143_0 == T__120 )\n alt_143 = 1\n end\n case alt_143\n when 1\n # at line 577:5: 'INTO' lvalues\n string_literal591 = match( T__120, TOKENS_FOLLOWING_T__120_IN_select_expression_3518 )\n if @state.backtracking == 0\n\n tree_for_string_literal591 = @adaptor.create_with_payload( string_literal591 )\n @adaptor.add_child( root_0, tree_for_string_literal591 )\n\n end\n @state.following.push( TOKENS_FOLLOWING_lvalues_IN_select_expression_3520 )\n lvalues592 = lvalues\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, lvalues592.tree )\n end\n\n end\n string_literal593 = match( T__121, TOKENS_FOLLOWING_T__121_IN_select_expression_3527 )\n if @state.backtracking == 0\n\n tree_for_string_literal593 = @adaptor.create_with_payload( string_literal593 )\n @adaptor.add_child( root_0, tree_for_string_literal593 )\n\n end\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n raise 'Exit bre' unless @skip \n # <-- action\n end\n # at line 578:44: ( join_clause | LPAREN join_clause RPAREN | table_reference_list )\n alt_144 = 3\n case look_144 = @input.peek( 1 )\n when ID then look_144_1 = @input.peek( 2 )\n\n if ( ( syntactic_predicate?( :synpred263_Plsql ) ) or ( ( syntactic_predicate?( :synpred263_Plsql ) ) and ( ( self.input.look(1).text.upcase == (\"THE\") ) ) ) )\n alt_144 = 1\n elsif ( true )\n alt_144 = 3\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 144, 1 )\n end\n when T__100 then look_144_2 = @input.peek( 2 )\n\n if ( syntactic_predicate?( :synpred263_Plsql ) )\n alt_144 = 1\n elsif ( true )\n alt_144 = 3\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 144, 2 )\n end\n when T__105 then look_144_3 = @input.peek( 2 )\n\n if ( syntactic_predicate?( :synpred263_Plsql ) )\n alt_144 = 1\n elsif ( true )\n alt_144 = 3\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 144, 3 )\n end\n when DOUBLEQUOTED_STRING then look_144_4 = @input.peek( 2 )\n\n if ( syntactic_predicate?( :synpred263_Plsql ) )\n alt_144 = 1\n elsif ( true )\n alt_144 = 3\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 144, 4 )\n end\n when LPAREN then look_144_5 = @input.peek( 2 )\n\n if ( syntactic_predicate?( :synpred263_Plsql ) )\n alt_144 = 1\n elsif ( syntactic_predicate?( :synpred264_Plsql ) )\n alt_144 = 2\n elsif ( true )\n alt_144 = 3\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 144, 5 )\n end\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 144, 0 )\n end\n case alt_144\n when 1\n # at line 578:46: join_clause\n @state.following.push( TOKENS_FOLLOWING_join_clause_IN_select_expression_3533 )\n join_clause594 = join_clause\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, join_clause594.tree )\n end\n\n when 2\n # at line 578:60: LPAREN join_clause RPAREN\n __LPAREN595__ = match( LPAREN, TOKENS_FOLLOWING_LPAREN_IN_select_expression_3537 )\n if @state.backtracking == 0\n\n tree_for_LPAREN595 = @adaptor.create_with_payload( __LPAREN595__ )\n @adaptor.add_child( root_0, tree_for_LPAREN595 )\n\n end\n @state.following.push( TOKENS_FOLLOWING_join_clause_IN_select_expression_3539 )\n join_clause596 = join_clause\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, join_clause596.tree )\n end\n __RPAREN597__ = match( RPAREN, TOKENS_FOLLOWING_RPAREN_IN_select_expression_3541 )\n if @state.backtracking == 0\n\n tree_for_RPAREN597 = @adaptor.create_with_payload( __RPAREN597__ )\n @adaptor.add_child( root_0, tree_for_RPAREN597 )\n\n end\n\n when 3\n # at line 578:88: table_reference_list\n @state.following.push( TOKENS_FOLLOWING_table_reference_list_IN_select_expression_3545 )\n table_reference_list598 = table_reference_list\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, table_reference_list598.tree )\n end\n\n end\n # at line 579:3: ( where_clause )?\n alt_145 = 2\n look_145_0 = @input.peek( 1 )\n\n if ( look_145_0 == T__127 )\n look_145_1 = @input.peek( 2 )\n\n if ( syntactic_predicate?( :synpred265_Plsql ) )\n alt_145 = 1\n end\n end\n case alt_145\n when 1\n # at line 579:5: where_clause\n @state.following.push( TOKENS_FOLLOWING_where_clause_IN_select_expression_3553 )\n where_clause599 = where_clause\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, where_clause599.tree )\n end\n\n end\n # at line 579:21: ( hierarchical_query_clause )?\n alt_146 = 2\n look_146_0 = @input.peek( 1 )\n\n if ( look_146_0 == T__128 )\n look_146_1 = @input.peek( 2 )\n\n if ( syntactic_predicate?( :synpred266_Plsql ) )\n alt_146 = 1\n end\n elsif ( look_146_0 == T__129 )\n look_146_2 = @input.peek( 2 )\n\n if ( syntactic_predicate?( :synpred266_Plsql ) )\n alt_146 = 1\n end\n end\n case alt_146\n when 1\n # at line 579:23: hierarchical_query_clause\n @state.following.push( TOKENS_FOLLOWING_hierarchical_query_clause_IN_select_expression_3560 )\n hierarchical_query_clause600 = hierarchical_query_clause\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, hierarchical_query_clause600.tree )\n end\n\n end\n # at line 579:52: ( group_by_clause )?\n alt_147 = 2\n look_147_0 = @input.peek( 1 )\n\n if ( look_147_0 == T__130 )\n look_147_1 = @input.peek( 2 )\n\n if ( syntactic_predicate?( :synpred267_Plsql ) )\n alt_147 = 1\n end\n end\n case alt_147\n when 1\n # at line 579:54: group_by_clause\n @state.following.push( TOKENS_FOLLOWING_group_by_clause_IN_select_expression_3567 )\n group_by_clause601 = group_by_clause\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, group_by_clause601.tree )\n end\n\n end\n # at line 580:3: ( 'HAVING' sql_condition )?\n alt_148 = 2\n look_148_0 = @input.peek( 1 )\n\n if ( look_148_0 == T__122 )\n look_148_1 = @input.peek( 2 )\n\n if ( syntactic_predicate?( :synpred268_Plsql ) )\n alt_148 = 1\n end\n end\n case alt_148\n when 1\n # at line 580:5: 'HAVING' sql_condition\n string_literal602 = match( T__122, TOKENS_FOLLOWING_T__122_IN_select_expression_3576 )\n if @state.backtracking == 0\n\n tree_for_string_literal602 = @adaptor.create_with_payload( string_literal602 )\n @adaptor.add_child( root_0, tree_for_string_literal602 )\n\n end\n @state.following.push( TOKENS_FOLLOWING_sql_condition_IN_select_expression_3578 )\n sql_condition603 = sql_condition\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, sql_condition603.tree )\n end\n\n end\n # at line 580:31: ( model_clause )?\n alt_149 = 2\n look_149_0 = @input.peek( 1 )\n\n if ( look_149_0 == ID )\n look_149_1 = @input.peek( 2 )\n\n if ( ( syntactic_predicate?( :synpred269_Plsql ) ) and ( ( self.input.look(1).text.upcase == (\"MODEL\") ) ) )\n alt_149 = 1\n end\n end\n case alt_149\n when 1\n # at line 580:33: model_clause\n @state.following.push( TOKENS_FOLLOWING_model_clause_IN_select_expression_3585 )\n model_clause604 = model_clause\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, model_clause604.tree )\n end\n\n end\n # at line 581:3: ( ( 'UNION' ( 'ALL' )? | 'INTERSECT' | 'MINUS' ) ( select_expression | subquery ) )?\n alt_153 = 2\n case look_153 = @input.peek( 1 )\n when T__123 then look_153_1 = @input.peek( 2 )\n\n if ( syntactic_predicate?( :synpred274_Plsql ) )\n alt_153 = 1\n end\n when T__124 then look_153_2 = @input.peek( 2 )\n\n if ( syntactic_predicate?( :synpred274_Plsql ) )\n alt_153 = 1\n end\n when T__125 then look_153_3 = @input.peek( 2 )\n\n if ( syntactic_predicate?( :synpred274_Plsql ) )\n alt_153 = 1\n end\n end\n case alt_153\n when 1\n # at line 581:5: ( 'UNION' ( 'ALL' )? | 'INTERSECT' | 'MINUS' ) ( select_expression | subquery )\n # at line 581:5: ( 'UNION' ( 'ALL' )? | 'INTERSECT' | 'MINUS' )\n alt_151 = 3\n case look_151 = @input.peek( 1 )\n when T__123 then alt_151 = 1\n when T__124 then alt_151 = 2\n when T__125 then alt_151 = 3\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 151, 0 )\n end\n case alt_151\n when 1\n # at line 581:7: 'UNION' ( 'ALL' )?\n string_literal605 = match( T__123, TOKENS_FOLLOWING_T__123_IN_select_expression_3596 )\n if @state.backtracking == 0\n\n tree_for_string_literal605 = @adaptor.create_with_payload( string_literal605 )\n @adaptor.add_child( root_0, tree_for_string_literal605 )\n\n end\n # at line 581:15: ( 'ALL' )?\n alt_150 = 2\n look_150_0 = @input.peek( 1 )\n\n if ( look_150_0 == T__119 )\n alt_150 = 1\n end\n case alt_150\n when 1\n # at line 581:17: 'ALL'\n string_literal606 = match( T__119, TOKENS_FOLLOWING_T__119_IN_select_expression_3600 )\n if @state.backtracking == 0\n\n tree_for_string_literal606 = @adaptor.create_with_payload( string_literal606 )\n @adaptor.add_child( root_0, tree_for_string_literal606 )\n\n end\n\n end\n\n when 2\n # at line 582:6: 'INTERSECT'\n string_literal607 = match( T__124, TOKENS_FOLLOWING_T__124_IN_select_expression_3610 )\n if @state.backtracking == 0\n\n tree_for_string_literal607 = @adaptor.create_with_payload( string_literal607 )\n @adaptor.add_child( root_0, tree_for_string_literal607 )\n\n end\n\n when 3\n # at line 583:6: 'MINUS'\n string_literal608 = match( T__125, TOKENS_FOLLOWING_T__125_IN_select_expression_3617 )\n if @state.backtracking == 0\n\n tree_for_string_literal608 = @adaptor.create_with_payload( string_literal608 )\n @adaptor.add_child( root_0, tree_for_string_literal608 )\n\n end\n\n end\n # at line 585:4: ( select_expression | subquery )\n alt_152 = 2\n look_152_0 = @input.peek( 1 )\n\n if ( look_152_0 == T__116 )\n alt_152 = 1\n elsif ( look_152_0 == LPAREN )\n alt_152 = 2\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 152, 0 )\n end\n case alt_152\n when 1\n # at line 585:6: select_expression\n @state.following.push( TOKENS_FOLLOWING_select_expression_IN_select_expression_3629 )\n select_expression609 = select_expression\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, select_expression609.tree )\n end\n\n when 2\n # at line 586:6: subquery\n @state.following.push( TOKENS_FOLLOWING_subquery_IN_select_expression_3637 )\n subquery610 = subquery\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, subquery610.tree )\n end\n\n end\n\n end\n # at line 589:3: ( order_by_clause )?\n alt_154 = 2\n look_154_0 = @input.peek( 1 )\n\n if ( look_154_0 == T__133 )\n look_154_1 = @input.peek( 2 )\n\n if ( syntactic_predicate?( :synpred275_Plsql ) )\n alt_154 = 1\n end\n end\n case alt_154\n when 1\n # at line 589:5: order_by_clause\n @state.following.push( TOKENS_FOLLOWING_order_by_clause_IN_select_expression_3653 )\n order_by_clause611 = order_by_clause\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, order_by_clause611.tree )\n end\n\n end\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n success = true\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 87 )\n memoize( __method__, select_expression_start_index, success ) if @state.backtracking > 0\n\n end\n \n return return_value\n end", "title": "" }, { "docid": "6cc6081ee58e3befcafe621b6c3f72e9", "score": "0.5121084", "text": "def parse_arg_exprs\n arg_exprs = []\n consume(:oparen)\n if !peek(:cparen)\n arg_exprs << parse_expr\n while peek(:comma)\n consume(:comma)\n arg_exprs << parse_expr\n end\n end\n consume(:cparen)\n arg_exprs\n end", "title": "" }, { "docid": "7998688fdd0604d62101adfbbea5fbc6", "score": "0.51193535", "text": "def parse_expression(tokens)\n list = []\n list << parse_tokens(tokens) while tokens.first != ')'\n tokens.shift\n list\n end", "title": "" }, { "docid": "47fe1db3ab33d0a56a06cca30567fbf3", "score": "0.5117597", "text": "def calc\n stack = []\n\n @expression.each do |term|\n if func = FUNCTIONS[term]\n argc = stack.pop # BigDecimal\n args = stack.pop(argc) # array of BigDecimal\n if args.size != argc\n raise ArgumentError, 'not enough operands on the stack'\n end\n\n stack.push(func.proc.call(*args))\n elsif op = OPS[term]\n a, b = stack.pop(2)\n raise ArgumentError, 'not enough operands on the stack' if b.nil?\n\n stack.push(a.public_send(op.ruby_op, b))\n else\n stack.push(Util.term_to_number(term))\n end\n end\n\n stack.pop\n end", "title": "" }, { "docid": "f82d878679d6e6c8cf432fd1c331b9be", "score": "0.50979", "text": "def multiple_thread_eval(expression); end", "title": "" }, { "docid": "0ae776188c2360f7afb4a0caa9d593b4", "score": "0.50957704", "text": "def expression_list\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 223 )\n return_value = ExpressionListReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n expression_list_start_index = @input.index\n\n root_0 = nil\n __LPAREN1237__ = nil\n __RPAREN1239__ = nil\n sql_expressions1238 = nil\n sql_expressions1240 = nil\n\n tree_for_LPAREN1237 = nil\n tree_for_RPAREN1239 = nil\n\n success = false # flag used for memoization\n\n begin\n # rule memoization\n if @state.backtracking > 0 and already_parsed_rule?( __method__ )\n success = true\n return return_value\n end\n # at line 1132:2: ( LPAREN sql_expressions RPAREN | sql_expressions )\n alt_321 = 2\n alt_321 = @dfa321.predict( @input )\n case alt_321\n when 1\n root_0 = @adaptor.create_flat_list\n\n\n # at line 1132:4: LPAREN sql_expressions RPAREN\n __LPAREN1237__ = match( LPAREN, TOKENS_FOLLOWING_LPAREN_IN_expression_list_7354 )\n if @state.backtracking == 0\n\n tree_for_LPAREN1237 = @adaptor.create_with_payload( __LPAREN1237__ )\n @adaptor.add_child( root_0, tree_for_LPAREN1237 )\n\n end\n @state.following.push( TOKENS_FOLLOWING_sql_expressions_IN_expression_list_7356 )\n sql_expressions1238 = sql_expressions\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, sql_expressions1238.tree )\n end\n __RPAREN1239__ = match( RPAREN, TOKENS_FOLLOWING_RPAREN_IN_expression_list_7358 )\n if @state.backtracking == 0\n\n tree_for_RPAREN1239 = @adaptor.create_with_payload( __RPAREN1239__ )\n @adaptor.add_child( root_0, tree_for_RPAREN1239 )\n\n end\n\n when 2\n root_0 = @adaptor.create_flat_list\n\n\n # at line 1133:4: sql_expressions\n @state.following.push( TOKENS_FOLLOWING_sql_expressions_IN_expression_list_7363 )\n sql_expressions1240 = sql_expressions\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, sql_expressions1240.tree )\n end\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n success = true\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 223 )\n memoize( __method__, expression_list_start_index, success ) if @state.backtracking > 0\n\n end\n \n return return_value\n end", "title": "" }, { "docid": "c90cd8f8f8d0a131c8002151cf58d460", "score": "0.50932986", "text": "def initialize expr\n @expression = expr\n #to_regexp\n end", "title": "" }, { "docid": "d4f777d4a9bfa4624307bbcfd6bd8b8e", "score": "0.5084378", "text": "def expression\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 27 )\n return_value = ExpressionReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n __PLUS111__ = nil\n __MINUS112__ = nil\n op = nil\n addOperand110 = nil\n\n tree_for_PLUS111 = nil\n tree_for_MINUS112 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 203:4: addOperand ( PLUS op= expression | MINUS op= expression )?\n @state.following.push( TOKENS_FOLLOWING_addOperand_IN_expression_1177 )\n addOperand110 = addOperand\n @state.following.pop\n @adaptor.add_child( root_0, addOperand110.tree )\n # --> action\n return_value.result = ( addOperand110.nil? ? nil : addOperand110.result )\n # <-- action\n # at line 204:3: ( PLUS op= expression | MINUS op= expression )?\n alt_32 = 3\n look_32_0 = @input.peek( 1 )\n\n if ( look_32_0 == PLUS )\n alt_32 = 1\n elsif ( look_32_0 == MINUS )\n alt_32 = 2\n end\n case alt_32\n when 1\n # at line 205:4: PLUS op= expression\n __PLUS111__ = match( PLUS, TOKENS_FOLLOWING_PLUS_IN_expression_1188 )\n\n tree_for_PLUS111 = @adaptor.create_with_payload( __PLUS111__ )\n root_0 = @adaptor.become_root( tree_for_PLUS111, root_0 )\n\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1193 )\n op = expression\n @state.following.pop\n @adaptor.add_child( root_0, op.tree )\n # --> action\n return_value.result = [BinaryOperatorTree.new(return_value.result,( op.nil? ? nil : op.result ),Operators.method(:add)),op.tree]\n # <-- action\n\n when 2\n # at line 206:5: MINUS op= expression\n __MINUS112__ = match( MINUS, TOKENS_FOLLOWING_MINUS_IN_expression_1201 )\n\n tree_for_MINUS112 = @adaptor.create_with_payload( __MINUS112__ )\n root_0 = @adaptor.become_root( tree_for_MINUS112, root_0 )\n\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1206 )\n op = expression\n @state.following.pop\n @adaptor.add_child( root_0, op.tree )\n # --> action\n return_value.result = [BinaryOperatorTree.new(return_value.result,( op.nil? ? nil : op.result ),Operators.method(:sub)),op.tree]\n # <-- action\n\n end\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 27 )\n\n end\n \n return return_value\n end", "title": "" }, { "docid": "ef217cab9f352eab1eccc88540a78b8c", "score": "0.50826806", "text": "def conjunctive_expansion\n return [self] if l_cons.size < 2\n expansion = []\n l_cons.each do |lcon_ref|\n new_erc = self.dup\n l_cons.each do |c|\n new_erc.set_e(c) unless c==lcon_ref\n end\n expansion << new_erc\n end\n return expansion\n end", "title": "" }, { "docid": "91a73aa336c7c657ec36ab903b830a04", "score": "0.50800985", "text": "def initialize(expr_list)\n @block = expr_list\n @variables_to_define = []\n end", "title": "" }, { "docid": "674f92e082404d070375f33eb9a0facc", "score": "0.5077259", "text": "def compound_expression\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 157 )\n return_value = CompoundExpressionReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n compound_expression_start_index = @input.index\n\n root_0 = nil\n expr_prior922 = nil\n\n\n success = false # flag used for memoization\n\n begin\n # rule memoization\n if @state.backtracking > 0 and already_parsed_rule?( __method__ )\n success = true\n return return_value\n end\n root_0 = @adaptor.create_flat_list\n\n\n # at line 885:4: expr_prior\n @state.following.push( TOKENS_FOLLOWING_expr_prior_IN_compound_expression_5576 )\n expr_prior922 = expr_prior\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, expr_prior922.tree )\n end\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n success = true\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 157 )\n memoize( __method__, compound_expression_start_index, success ) if @state.backtracking > 0\n\n end\n \n return return_value\n end", "title": "" }, { "docid": "723c61947924060467632b16c8795d1c", "score": "0.50766903", "text": "def merge_predicate_list_into_expression(list)\n fail if list.empty?\n\n expr = list.first\n\n if list.length > 1\n expr = list.first\n\n list.each do |expression|\n if !expression.equal?(list.first)\n expr = BinaryOperatorExpression.new(:\"&&\", expr, expression)\n end\n end\n end\n expr\n end", "title": "" }, { "docid": "d1128f5f7d7cb540d7048c727613cca4", "score": "0.5075749", "text": "def parse_expr1\n expr = parse_expr2\n while token = try(:+, :-, :|, :^)\n expr = [token, expr, parse_expr2]\n end\n expr\n end", "title": "" }, { "docid": "da14b4310842781d72e49a4f2022c9b7", "score": "0.5071353", "text": "def clone\n return Concat.new(@type,\n @expressions.map {|expr| expr.clone } )\n end", "title": "" }, { "docid": "9f7d601e62fa253ff8cad19afd6e2a57", "score": "0.5067765", "text": "def _expression\n\n _save = self.pos\n while true # choice\n _tmp = apply(:_number)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_string)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_constant)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_symbol)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_list)\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_expression unless _tmp\n return _tmp\n end", "title": "" }, { "docid": "bca2c4a7f2eea626e3399ded79d900d2", "score": "0.5063432", "text": "def build(expression)\n case factory\n when :block\n block_runner_factory(expression)\n when :equality\n equality_runner_factory(expression)\n else\n raise \"unknown factory #{factory}\"\n end\n end", "title": "" }, { "docid": "512403da963c56b2d713ceb23cbdeb74", "score": "0.50606894", "text": "def parse_expression\n # TODO implement me\n end", "title": "" }, { "docid": "8749272618dd66ac97047faf82f93040", "score": "0.50587124", "text": "def reduce_add_operator_0(_production, _range, _tokens, theChildren)\n return CalcAddNode.new(theChildren[0].symbol)\n end", "title": "" } ]
3dd37587456f1f7a230530c92de0ce75
convert the json txaction data to csv currently used options are: :tag => scope output to a tag
[ { "docid": "a9bba22d3ab318e5a028ee2bdba1c4c7", "score": "0.7281621", "text": "def convert\n options = @options.dup\n tag = options.delete(:tag)\n return CSV.generate(options) do |csv|\n csv << HEADERS\n @data[\"transactions\"].each do |txaction|\n csv << convert_txaction(txaction, tag)\n end\n end\n end", "title": "" } ]
[ { "docid": "fa04cbeaf6d193637630feb0e4b5e0a9", "score": "0.6732726", "text": "def txactions_to_csv(txactions, options = {})\n txactions.sort! {|a,b| a.date_posted <=> b.date_posted}\n csv_text = CSV.generate(options) do |csv|\n csv << [\"Account Id\", \"Account Name\", \"Financial Institution\", \"Account Type\", \"Currency\",\n \"Transaction Date\", \"Check Number\", \"Amount\", \"Merchant\", \"Raw Name\",\n \"Memo\", \"Note\", \"Rating\", \"Tags\"]\n for txaction in txactions\n csv << [txaction.account.id_for_user,\n txaction.account.name,\n txaction.account.financial_inst_name,\n txaction.account.account_type.name,\n txaction.account.currency.name,\n txaction.date_posted.strftime(\"%Y-%m-%d\"),\n txaction.check_num ? txaction.check_num : nil,\n number_to_currency(txaction.amount(:tag => @tag), :unit => '', :delimiter => ''),\n txaction.merchant_id ? txaction.merchant.name : nil,\n txaction.raw_name || txaction.cleaned_name,\n txaction.memo,\n txaction.note,\n txaction.taggings.map(&:name).join(\", \")]\n end\n end\n\n return csv_text\n end", "title": "" }, { "docid": "ff8aaafbbe6ae7a9a6aa4c6523545d07", "score": "0.63274986", "text": "def to_csv\n @data = {}\n @data['controls'] = []\n get_all_controls_from_json(@json)\n data = inspec_json_to_array(@data)\n CSV.generate do |csv|\n data.each do |row|\n csv << row\n end\n end\n end", "title": "" }, { "docid": "ff8aaafbbe6ae7a9a6aa4c6523545d07", "score": "0.63274986", "text": "def to_csv\n @data = {}\n @data['controls'] = []\n get_all_controls_from_json(@json)\n data = inspec_json_to_array(@data)\n CSV.generate do |csv|\n data.each do |row|\n csv << row\n end\n end\n end", "title": "" }, { "docid": "ff8aaafbbe6ae7a9a6aa4c6523545d07", "score": "0.63274986", "text": "def to_csv\n @data = {}\n @data['controls'] = []\n get_all_controls_from_json(@json)\n data = inspec_json_to_array(@data)\n CSV.generate do |csv|\n data.each do |row|\n csv << row\n end\n end\n end", "title": "" }, { "docid": "354006eefd3ee05d7a4ca0642113115b", "score": "0.60742646", "text": "def to_csv\n end", "title": "" }, { "docid": "a400ff45f02f3b2d5265197feea2cf60", "score": "0.60198593", "text": "def convert\n file = File.read('./dump.json')[0...-2]\n data_hash = JSON.parse(\"#{file}]\")\n correct_data = {}\n\n data_hash.each do |req|\n req.each do |time, data|\n correct_data[time] ||= {}\n data[\"data\"].each do |item|\n correct_data[time][item[\"displayName\"]] = item[\"stockLevel\"]\n end\n end\n end\n\n csv = []\n csv << [\"Time\"] + correct_data.first.last.keys\n\n correct_data.each do |t,d|\n line = []\n line << Time.at(t.to_i).to_s\n\n d.each do |key, value|\n line << value.to_i\n end\n\n csv << line\n end\n\n CSV.open(\"dump.csv\", \"wb\") do |f|\n csv.each { |row| f << row }\n end\nend", "title": "" }, { "docid": "272144ce09dcee5311078a98ff429d27", "score": "0.59952396", "text": "def json_to_csv(input_file, output_file)\n data = get_json_file(input_file)\n create_csv_from_data(output_file, data)\nend", "title": "" }, { "docid": "9b9f96682d2f00fd30a97bb9ddc93101", "score": "0.5987677", "text": "def to_csv_row\n row = []\n row << key\n row << idea.title\n row << user.name\n row << \"https://www.edisonnation.com/admin/live_product_searches/#{live_product_search.to_param}/submissions/#{to_param}\"\n row << (under_review? ? \"Pending at S#{next_stage}\" : \"#{alive? ? 'Alive' : 'Dead'} at S#{stage}\")\n row << (idea.patent_pending? ? 'Y' : 'N')\n row << (idea.patent_issued? ? 'Y' : 'N')\n row << (idea.prototype? ? 'Y' : 'N')\n row << idea.attachments_count\n row += ratings.map(&:rating)\n row.map{|node| \"\\\"#{node.to_s.strip.gsub(',','').gsub('\"','`')}\\\"\"}.join(',')\n end", "title": "" }, { "docid": "9b61fc1ba0d28991e1b29d5f07fd5f11", "score": "0.5973695", "text": "def to_acunote_csv\n [\n task_level,\n @taskID, \n title, \n meta_data[:Tags], \n owner_name,\n nil,\n nil,\n omni_to_acunote_priority(@priority),\n nil,\n effort_required,\n effort_remaining,\n nil,nil,nil, #Due Date,QA Owner,Business Owner,\n nil,nil, #Wiki,Watchers\n nil, #Depends_on (set by dependents)\n nil, #Dependents TODO\n nil\n ].join(',')\n end", "title": "" }, { "docid": "78cf3623f13a1faf167bd1ce43cba061", "score": "0.5929915", "text": "def to_csv\n buf = \"\"\n transactions.each do |transaction|\n buf << transaction.to_csv\n end\n return buf\n end", "title": "" }, { "docid": "1d2945efd799b6a8d2708da3f555d5fd", "score": "0.5898942", "text": "def exportToCsv(options = {})\n\n gzip = options[:gzip] || false\n\n settings(options[:settings]) if options[:settings] != nil\n fields = options[:fields] || getSettingsFields != nil ? getSettingsFields : nil || getAllFields\n customFields = options[:customFields] || getSettingsCustomFields != nil ? getSettingsCustomFields : nil || getCustomFields\n\n fields = [fields != \"\" ? fields : nil,customFields != \"\" ? customFields : nil].compact.join(\",\")\n fields = sortFields(fields)\n\n objects = search(options)\n filename = options[:filename]\n filepath = options[:filepath]\n warn \"There are no data in specified entity\" if objects.empty?\n\n ordered_fields = fields.split(\",\")\n\n FasterCSV.open(\"#{filepath}#{filename}\", \"w\",{:col_sep => \",\",:quote_char => '\"'}) do |csv|\n csv << ordered_fields\n objects.each do |object|\n temp = Array.new\n ordered_fields.each do |o|\n # Remove special characters:\n if (object[o].instance_of? String)\n value = object[o].delete(\"\\n\").delete('\"')\n temp.push(value)\n else\n temp.push(object[o])\n end\n end\n csv << temp\n end\n end\n\n if (gzip)\n Zlib::GzipWriter.open(\"#{filepath}#{filename}\".gsub(\".csv\",\".gz\")) do |gz|\n gz.write File.read(\"#{filepath}#{filename}\")\n end\n end\n\n\n end", "title": "" }, { "docid": "d699c1855380d22599326cb9cf91890b", "score": "0.5892744", "text": "def to_csv\n \"\\\"#{ @timestamp }\\\", \\\"#{ @nick }\\\", \\\"#{ @ip }\\\", \\\"#{ @text }\\\", \\\"#{ @raw }\\\"\"\n end", "title": "" }, { "docid": "8fc65fb06bd8df54b1fd3c9cf5eb09fd", "score": "0.5854826", "text": "def to_csv\n csv_data = []\n @order_scope.find_each do |order|\n if block_given?\n next unless yield order\n end\n csv_data += order_to_line_item_arr(order).map(&:to_csv)\n end\n csv_data_s = ([@columns.join(\",\") + \"\\n\"] + csv_data).flatten.join\n end", "title": "" }, { "docid": "6bfd7a28782fcd7f2c3683f37d02ccd2", "score": "0.58435327", "text": "def write_to_csv(json, output_filename='out.csv', headers=true, nil_substitute='')\n csv = convert_to_csv json, nil_substitute\n headers_written = false \n\n CSV.open(output_filename.to_s, 'w') do |output_file|\n csv.each do |row|\n if headers && !headers_written\n output_file << row.keys && headers_written = true\n end\n\n output_file << row.values\n end\n end\n end", "title": "" }, { "docid": "b98b8bfe80a8496623736da5d6ca5fe7", "score": "0.58097064", "text": "def write_sentiment_csv(json,file_name)\n\t\tfile_name = file_name.gsub(\".xml\",\"\")\t\n\t\tfile = File.open(@dir_name+\"/#{file_name}.csv\",\"w\")#open file with xml removed, csv format FTW\n\t\tarray = json[\"data\"]\n\t\tcsv_string = CSV.generate do |csv|\n\t\t\tcsv << [\"text\",\"retweet_count\",\"polarity\",\"pol_val\"]\n\t\t\tarray.each do |inner|\n\t\t\t\ttext = inner[\"text\"]\n\t\t\t\tretweets = inner[\"retweets\"]\n\t\t\t\tpolarity = inner[\"polarity\"].to_s.chomp\n\t\t\t\tpol_val = 'neut'\n\t\t\t\tputs \"POLARITY #{polarity};\"\n\t\t\t\tif polarity.to_s == '0'\n\t\t\t\t\tputs \"NEG\"\n\t\t\t\t\tpol_val = 'neg'\n\t\t\t\telsif polarity.to_s == '2'\n\t\t\t\t\tputs \"NEUT\"\n\t\t\t\t\tpol_val = 'neut'\n\t\t\t\telsif polarity.to_s == '4'\n\t\t\t\t\tputs \"POS\"\n\t\t\t\t\tpol_val = 'pos'\n\t\t\t\tend\t\t\t\t\t\n\t\t\t\tcsv << [text,retweets,polarity,pol_val]\n\t\t\tend\n\t\tend\n\t\t#write this to the csv...\n\t\tfile.write(csv_string)\n\tend", "title": "" }, { "docid": "a42b9da9b73afd0140da5c4a1be32a77", "score": "0.5791107", "text": "def to_csv\n CSV.generate do |csv|\n csv << [ \"Housing Data Profile: #{self.muni}\",\n nil,\n \"Generated on\",\n DateTime.now.strftime(\"%d %b %Y\"),\n \"via Housing MA\",\n \"http://housing.ma\",\n \"by the Metropolitan Area Planning Council\",\n \"http://mapc.org\"\n ]\n\n csv << nil_row(nil)\n\n csv << [\"Attribute\",\n \"#{self.muni}\",\n \"#{self.muni}, Margin of Error\",\n \"Aggregation Method\",\n \"#{self.neighbors} Municipalities\",\n \"#{self.community_type} (Community Type)\",\n \"#{self.region} (Region)\",\n \"#{self.county} (County)\",\n \"#{self.state} (State)\"]\n \n self.topic_areas.each do |area|\n csv << nil_row(\"#{area}\")\n\n area.topics.each do |topic|\n csv << nil_row(\"\\t#{topic}\")\n\n topic.subtopics.each do |subtopic|\n csv << nil_row(\"\\t\\t#{subtopic}\")\n \n subtopic.fields.each{ |field| csv << field_row(field) }\n end\n end\n end\n end\n end", "title": "" }, { "docid": "f4a75771cb281dac1cb71255171ab0a1", "score": "0.57725495", "text": "def convert_to_csv(json, nil_substitute, fields)\n json = JSON.parse json if json.is_a? String\n\n in_array = array_from json\n\n # Replace all nil values with the value of nil_substitute; The presence\n # of nil values in the data will usually result in uneven rows \n in_array.map! { |x| nils_to_strings x, nil_substitute }\n\n rows = in_array.map { |row| flatten row }\n\n headers = {}\n number_of_columns = 0\n\n csv = rows.map do |row|\n row.keys.each do |header|\n if !headers.key?(header) && field_should_be_included?(header, fields)\n headers[header] = number_of_columns\n number_of_columns += 1\n end\n end\n\n final_row = []\n\n row.each do |k, v|\n if headers[k]\n final_row[headers[k]] = v\n end\n end\n\n final_row\n end\n\n csv.unshift(headers.keys)\n end", "title": "" }, { "docid": "4d4975bff0348e4595b9dcf2c97cf97b", "score": "0.5768579", "text": "def to_tsv\n to_csv(\"\\t\")\n end", "title": "" }, { "docid": "a6650acfa324045c9595d368f9bad283", "score": "0.5757284", "text": "def to_csv\n \"#{@nom}:#{@taux}\"\n end", "title": "" }, { "docid": "d3956ea22d1ea705a0ab2c84f4acda61", "score": "0.57525396", "text": "def index\n @tags = Tag.with_current_and_all_prisoner_count\n\n respond_to do |format|\n format.html\n format.json\n format.csv do\n send_data Tag.to_csv,\n filename: GeneratedFile.clean_filename('tags', 'csv'),\n type: 'text/csv'\n end\n end\n end", "title": "" }, { "docid": "3ce354e762db15747db1c33d889f1255", "score": "0.5750212", "text": "def to_csv_row\n row = []\n row << id\n row << title\n row << user.name\n row << \"https://www.edisonnation.com/admin/ideas/#{to_param}\"\n row << (star? ? 'Y' : 'N')\n row << (patent_pending? ? 'Y' : 'N')\n row << (patent_issued? ? 'Y' : 'N')\n row << (prototype? ? 'Y' : 'N')\n row << attachments_count\n row += ratings.map(&:rating)\n row.map{|node| \"\\\"#{node.to_s.strip.gsub(',','').gsub('\"','`')}\\\"\"}.join(',')\n end", "title": "" }, { "docid": "1fc9383a29daa1d452ceb001e8443876", "score": "0.5742326", "text": "def export_csv\n export_string = \"#{id},#{type_string},#{name.gsub(/[\\,,\\s]/,\"\")},\"\n details.each{|k,v| export_string << \"#{k}=#{v};\".gsub(/[\\,,\\s]/,\"\") }\n export_string\n end", "title": "" }, { "docid": "683815a294427be119f6cceee806a60f", "score": "0.57394135", "text": "def to_csv\r\n arr_rows =[]\r\n #get all the fields\r\n @rows.each do |row|\r\n row.flattern\r\n #collect field names from rows\r\n #we need this because there can be duplicated rows which we can't predict\r\n #like Pads or Batteries\r\n @fields |= row.fields\r\n end\r\n #Make a header row\r\n header = CSVRow.new @fields\r\n @fields.each do |f|\r\n header.set f, f\r\n end\r\n arr_rows.push header.to_csv\r\n\r\n #tell each row the combined fieldset\r\n #and convert it to CSV\r\n @rows.each do |row|\r\n row.fields @fields\r\n arr_rows.push row.to_csv\r\n end\r\n ret = arr_rows.join \"\\n\"\r\n return ret\r\n end", "title": "" }, { "docid": "e4fc0cb7e2fe6f609db77dfefb209201", "score": "0.5727602", "text": "def to_csv(options={})\n CSV.generate(options) do |csv|\n csv << scope.attributes\n csv << attributes_hash.values\n end\n end", "title": "" }, { "docid": "fe5627200c5b432d96ea2721891f3e38", "score": "0.5680869", "text": "def convert_to_csv(json, nil_substitute)\n json = JSON.parse json if json.is_a? String\n\n in_array = array_from json\n out_array = []\n\n # Replace all nil values with the value of nil_substitute; The presence\n # of nil values in the data will usually result in uneven rows \n in_array.map! { |x| nils_to_strings x, nil_substitute }\n\n in_array.each do |row|\n out_array[out_array.length] = flatten row\n end\n\n out_array\n end", "title": "" }, { "docid": "125062262333faca55f146a2c8c02086", "score": "0.5671128", "text": "def orders_processed_to_csv\n @orders = Order.find(:all,:include=>[:person],:order => \"orders.created_at DESC\", :conditions =>\"status='processed'\")\n csv_str = FasterCSV.generate do |csv|\n csv << [\"Captain Name\", \"Team Name\", \"Team Type\", \"Name On Card\", \"Card Type\", \n \"Total Charged\", \"Date/Time\", \"Total Tents\"] \n @orders.each do |order|\n team = order.team\n captain = team.captain \n credit_card = order.credit_card\n extras_orders = order.extras_orders.select {|o| o.extras.is_tent? }\n tents = 0\n extras_orders.each {|o| tents+=o.quantity}\n csv << [captain.person.name, CGI.unescapeHTML(team.name), team.boat_type_human, \n \"#{credit_card.first_name} #{credit_card.last_name}\", credit_card.type.capitalize, \n number_to_currency(order.total_pay), order.created_at.strftime(\"%d.%m.%Y/%H:%M\"), tents]\n end\n end\n send_data csv_str, :type => 'text/csv', :disposition => \"attachment;filename=orders_processed_to_csv.csv\"\n end", "title": "" }, { "docid": "1cab2e18a5876c099c900dc0cf0e2e94", "score": "0.56676376", "text": "def txaction_to_json(txaction, options = {})\n txaction_to_hash(txaction, options).to_json\n end", "title": "" }, { "docid": "4877c13df6b49d13a5175b95924b542f", "score": "0.56623554", "text": "def to_csv(opts = OPTS)\n opts = model.process_csv_serializer_opts(opts)\n\n CSV.generate(opts) do |csv|\n csv << opts[:headers].map{|k| send(k)}\n end\n end", "title": "" }, { "docid": "2659ffbad6d1c9deac62e8b226fc9a23", "score": "0.5631449", "text": "def csv\n StructuredCSV.generate(metadata)\n end", "title": "" }, { "docid": "9dcf7830922eeb86ed6fe8d88993fc1a", "score": "0.5615454", "text": "def to_csv (transactionSubset)\n\t\t# The attributes to include in the csv\n attributes = %w{label amount withdrawal date}\n CSV.generate(headers: true) do |csv|\n csv << attributes\n transactionSubset.each do |transaction|\n csv << attributes.map { |attr| transaction.send(attr)}\n end\n end\n end", "title": "" }, { "docid": "4445590fca390bed90c77cc3bf60f7af", "score": "0.5611421", "text": "def to_csv\n csv_string = String.new\n csv_string << CSV.generate do |csv|\n csv << ['Report between ' + self.start_date.strftime('%B %d, %Y') +\n ' and ' + self.end_date.strftime('%B %d, %Y') ]\n csv << ['License Server', 'Tags', 'Hours', 'Feature', 'License Count', 'Total_Utilization %' ]\n end\n body = YAML::load(self.body)\n body.each do |key,element|\n #for each liceserver\n element.each do |ek,ee|\n #for each office hours and 24-hours utilization\n ee.each do |stats|\n licserver = Licserver.find(key.to_s)\n csv_string << CSV.generate do |csv|\n csv << ( Array.new <<\n licserver.attributes.values_at(\"port\", \"server\").join('@') <<\n licserver.tags.map{ |x| x.title }.join(',') <<\n ek.to_s <<\n stats[0] <<\n stats[1] <<\n (stats[2].nil? ? 0 : (stats[2].to_f/stats[3]).round(4)*100)\n )\n end\n end\n end\n end\n\n return csv_string\n end", "title": "" }, { "docid": "b648fa39f6e9332779f66b0b082dff6c", "score": "0.56023014", "text": "def to_csv\n\t\ta = @author.delete \"\\n\\t\"\n\t\tt = @title.delete \"\\n\\t\"\n\t\td = @description.delete \"\\n\\t\"\n\t\tcsv_string = \"\\\"\" + @year + \"\\\",\\\"\" + a +\"\\\",\\\"\" + t + \"\\\",\\\"\" + d + \"\\\"\\n\"\n\t\treturn csv_string\n\tend", "title": "" }, { "docid": "47470acc74eabd06328831855a1c6c8e", "score": "0.558919", "text": "def to_csv\n\t\t\tattributes.values.join(\", \")\n\t\tend", "title": "" }, { "docid": "a2fed99532b8282dc1e72e04fab0fb4c", "score": "0.55642873", "text": "def generated_csv(t_assignment, t_options)\n delimiter = ','\n CSV.generate(col_sep: delimiter) do |csv|\n csv << ReportsController.export_details_fields(t_options)\n ReportsController.export_details(csv, t_assignment, false)\n end\n end", "title": "" }, { "docid": "ceb1ca12344a8d7d9162ed8d2a54426b", "score": "0.55565387", "text": "def to_csv(options = Hash.new)\n fields.to_csv(options)\n end", "title": "" }, { "docid": "fc27e3bedd710b329223f6acb36c69ad", "score": "0.555325", "text": "def export_csv\n fields = Person.column_names\n fields.push('tags')\n fields.push('notes')\n output = CSV.generate do |csv|\n # Generate the headers\n csv << fields.map(&:titleize)\n\n # Some fields need a helper method\n human_devices = %w(primary_device_id secondary_device_id)\n human_connections = %w(primary_connection_id secondary_connection_id)\n\n # Write the results\n @results.records.where(active: true).each do |person|\n csv << fields.map do |f|\n field_value = person[f]\n if human_devices.include? f\n human_device_type_name(field_value)\n elsif human_connections.include? f\n human_connection_type_name(field_value)\n elsif f == 'phone_number'\n if field_value.present?\n field_value.phony_formatted(format: :national, spaces: '-')\n else\n ''\n end\n elsif f == 'tags'\n person.tag_values.blank? ? '' : person.tag_values.join('|')\n elsif f == 'notes'\n person.comments.empty? ? '' : person.comments.map(&:content).join(\"\\n\")\n elsif @questions && @questions.map(&:text).include?(f)\n q = @questions.find { |question| question.text == f }\n person.answers.find_by(question: q)&.value\n else\n field_value\n end\n end\n end\n end\n send_data output, type: 'text/csv', filename: \"Search-#{Time.zone.today}.csv\"\n end", "title": "" }, { "docid": "9793848f82035391f5aee833e68c905e", "score": "0.5553171", "text": "def convert_json_to_csv json_file, csv_name\n CSV.open(csv_name, \"wb\", col_sep: \";\") do |csv|\n json_file.each_with_index do |hash, index|\n # header csv\n if index == 0\n csv << get_all_keys(hash)\n end\n # data csv\n csv << get_all_values(hash)\n end\n end\nend", "title": "" }, { "docid": "652edf304d8807f452d0e2fcfc77b66f", "score": "0.5551023", "text": "def to_csv\r\n flattern\r\n ret =[]\r\n @fields.each do |f|\r\n val = get f\r\n if val\r\n val = val.gsub /\"/, \"'\"\r\n val = \"\\\"#{val}\\\"\"\r\n else\r\n val = '\"\"'\r\n end\r\n ret.push val\r\n end\r\n ret = ret.join \",\"\r\n return ret\r\n end", "title": "" }, { "docid": "61acd7f8b2585497723d1d04a2fb1003", "score": "0.55285054", "text": "def to_csv(**options)\n fields.to_csv(**options)\n end", "title": "" }, { "docid": "8de8f074917191229569385462df5b5c", "score": "0.5494273", "text": "def embargoed_csv(com)\n handle = 'handle'\n col = 'collection'\n klass = 'year'\n nAuthor = '#author'\n embargo = 'embargo'\n items = DSpace.findByMetadataValue('pu.embargo.terms', nil, nil)\n ihash = []\n items.each do |i|\n next unless i.getHandle\n next unless DSpace.create(i).parents.index(com)\n\n nAuth = i.getMetadataByMetadataString('dc.contributor.author').length\n h = { handle => i.getHandle }\n h[col] = i.getParentObject.getName\n h[klass] = i.getMetadataByMetadataString('pu.date.classyear').collect { |v| v.value}\n h[nAuthor] = nAuth\n h[embargo] = i.getMetadataByMetadataString('pu.embargo.terms').collect { |v| v.value}\n ihash << h\n end\n\n csv_out(ihash, ['embargo', 'year', '#author', 'handle', 'collection'])\nend", "title": "" }, { "docid": "261f865ce1c5c36fc1747d6e47f3a274", "score": "0.54785466", "text": "def to_csv data\n attributes = data.first&.keys || []\n\n CSV.generate(headers: true) do |csv|\n csv << attributes\n\n data.each do |row|\n csv << attributes.map do |att|\n row[att]\n end\n end\n end\n end", "title": "" }, { "docid": "fa93d3818b36861240b96cb632a0bbda", "score": "0.5476616", "text": "def to_csv\n d = get_data\n return \"Sorry, no records.\" if d.length == 0\n arr = []\n d.each {|row| arr.push(row.dup)}\n tbl = Ruport::Data::Table.new(:column_names => arr[0].keys)\n arr.each {|row|\n\ttbl << arr[0].keys.map {|k| row[k]}\n }\n \n return tbl.to_csv\n end", "title": "" }, { "docid": "432fdf42170e1e43fbaa6e458b6a86f5", "score": "0.54722804", "text": "def to_csv\n attributes = [\"Item\", \"Item ID\", \"Contributor\", label]\n\n CSV.generate({ headers: true }) do |csv|\n csv << attributes\n\n multi_page_response.each do |response|\n response.rows.each do |row|\n csv << [title(row), id(row), contributor(row), count(row)]\n end\n end\n end\n end", "title": "" }, { "docid": "3ed09c230551febcbc92eabe46a47473", "score": "0.5471434", "text": "def to_csv\n attributes = [ \"Search term\", \"Count\" ]\n\n CSV.generate({ headers: true }) do |csv|\n csv << attributes\n\n multi_page_response.each do |response|\n response.rows.each do |row|\n csv << row\n end\n end\n end\n end", "title": "" }, { "docid": "f7b2a6762031367aadb2ced97bd7de73", "score": "0.5459641", "text": "def to_csv\n id.to_s << \",\" << time_in.to_s << \",\" << time_out.to_s << \",\" << date.to_s << \",\" << description\n end", "title": "" }, { "docid": "05df04e8f605e4c737702be42e5cdf0b", "score": "0.54510427", "text": "def to_csv\n CSV.generate do |csv|\n sorted_by_name.map do |item|\n csv << [item[:name], item[:email], item[:phone]].flatten\n end\n end\n end", "title": "" }, { "docid": "58681f24d3ee5bd42c1515faaa06ca15", "score": "0.5442056", "text": "def to_csv(options ={})\n CSV.generate(options) do |csv|\n csv << course_type.csv_titles\n csv << csv_data\n end\n end", "title": "" }, { "docid": "be5b6955bc14f910ed7c2ea3387fdac4", "score": "0.5439756", "text": "def export_csv\n @outfile = \"transactions_\" + Time.now.strftime(\"%m-%d-%Y\") + \".csv\"\n @transactions = Transaction.find(:all)\n csv_string = ''\n @transactions.each do |transaction|\n csv_string += FasterCSV.generate do |csv|\n csv << [transaction.id, transaction.amount, transaction.created_at, transaction.updated_at, transaction.recipient.name, transaction.donor.name, transaction.rank, transaction.entity_id, transaction.ilike]\n end\n end\n send_data csv_string, :type => 'text/csv; charset=iso-8859-1; header=present',\n :disposition => \"attachment; filename=#{@outfile}\"\n end", "title": "" }, { "docid": "731dd4819d5b1b5b2701efef3b67907f", "score": "0.54293007", "text": "def csv(data)\n filename = \"data/#{@source[:registry_number]}.csv\"\n CSV.open(filename, \"wb\") do |csv|\n csv << [\n \"ИНН\",\n \"Полное наименование\",\n \"Краткое наименование\",\n \"Город\",\n \"Статус в СРО\",\n \"Допуск выдан\",\n \"Юридический адрес\",\n \"Номер свидетельства\",\n \"ОГРН\"\n ]\n\n data.each do |row|\n csv << [\n row[:inn],\n row[:name],\n row[:short_name],\n row[:city],\n Exporter.statuses[row[:status]],\n row[:resolution_date],\n row[:legal_address],\n row[:certificate_number],\n row[:ogrn]\n ]\n end\n end\n end", "title": "" }, { "docid": "4ba5f1c92ac64ac8e2c4b73085cb7946", "score": "0.54220843", "text": "def csv_string\n string = \"#{@id};#{@title};\"\n string += \"#{@options[:description]};#{@options[:prio]};\"\n string += \"#{@options[:follow_up]};#{@options[:due_date]};\"\n string += \"#{@options[:note] ? @options[:note].gsub(/\\n/, '\\\\n') : \"\"};\"\n string += \"#{@options[:tags]};\"\n string += \"#{@creation_date};\"\n string += \"#{@udpate_date ? \"UPDATED\" : \"UNCHANGED\"};\"\n string += \"#{@done_date ? \"DONE\" : \"OPEN\"}\"\n string\n end", "title": "" }, { "docid": "f61ad40854a68b3a0cbc2e998eb9de3f", "score": "0.54158014", "text": "def to_csv(data)\n CSV.instance(data, force_quotes: true, headers: true) do |csv|\n csv << %w{rxnID rxnEq rxnCTrans rates rxnType basis deviation}\n \n reactions.each_with_index do |reaction, index|\n csv << [\"R#{index + 1}\", reaction.equation.to_s, reaction.carbon_atom_transition_equation.to_s, nil, reaction.type.to_s, nil, nil]\n end\n end\n end", "title": "" }, { "docid": "13a29675370b890ed3c331094f4268bd", "score": "0.541213", "text": "def to_csv\n fetch.to_csv\n end", "title": "" }, { "docid": "cd370aeea01c33cff2a2c318b8d1b096", "score": "0.54112166", "text": "def to_csv(opts = {})\n return \"\\n\" if self.data.blank?\n\n headers = opts[:headers] || self.class.default_headers(self)\n\n [].tap do |result|\n result << i18n_headers(headers.map(&:first)).join( opts[:separator] || self.class.to_csv_value_separator ) if !opts[:skip_header]\n result << headers.map{|h| h.second.call(self) }.join( opts[:separator] || self.class.to_csv_value_separator )\n end.join(self.class.to_csv_line_separator)\n end", "title": "" }, { "docid": "8f0498e302aea9617321b3665cf2c94f", "score": "0.54105324", "text": "def to_csv\n csv_contents = \"\"\n @anonymizations.each do |orig, anon|\n csv_contents += \"#{orig}, #{anon}\\n\"\n end\n return csv_contents\n end", "title": "" }, { "docid": "71712cfd38b462c7d12f1e1c70d8bb84", "score": "0.54083484", "text": "def to_csv\n order_items.map(&:to_csv).join(\"\\n\")\n end", "title": "" }, { "docid": "5774b363fb160ebcde588bda113d3a97", "score": "0.54003996", "text": "def to_csv_line\n [id, started_at, finished_at, frequency, frequency_other, time_spent,\n purpose_gathering, purpose_hobbitry, purpose_fuel, purpose_relaxation,\n favorite_place, once_receive, once_payment, important_nature, important_wood,\n important_gathering, important_water, important_climate, important_health,\n important_ground, relation].map{|field| %(\"#{field}\")}.join(';')\n end", "title": "" }, { "docid": "8293d250c9fc70b42ad44c6a6de4b493", "score": "0.53948724", "text": "def to_csv(format=:short)\n output = ''\n columns = []\n case format\n when :long\n ['id', 'updated', 'title'].each { |c| columns << c }\n end\n unless @points.empty? # if there was at least one result\n @points.first.map {|d| columns << d.keys }\n end\n output = CSV.generate_line(columns) \n @points.each do |point|\n output += point.to_csv(format)\n end\n output\n end", "title": "" }, { "docid": "74400fcbbf72204613329f0d1e25b197", "score": "0.53876793", "text": "def generate_csv(data, options={})\n raise ArgumentError unless ALLOWED_CSV_EXPORT_KINDS.include?(options[:kind])\n \n csv_string = FasterCSV.generate do |csv|\n #Do first pass of the data to get a list of feature names:\n feature_names = []\n data.each do |d|\n d[:features].keys.each do |fname|\n if !feature_names.include?(fname)\n feature_names << fname\n end\n end\n end\n \n if options[:kind] == :metaboanalyst\n csv << [\"subjectID\", \"Label\"] + feature_names\n elsif options[:kind] == :umetrics\n csv << [\"subjectID\"] + feature_names + [ \"Label\" ]\n end\n \n #Now create the rows (using the feature_names array to order each feature vector)\n data.each do |d|\n features = Array.new\n curr_d = d[:features]\n feature_names.each do |f|\n if curr_d.has_key?(f)\n features << curr_d[f]\n else\n features << '' #This sample doesnt have this feature\n end\n end\n \n if options[:kind] == :metaboanalyst\n csv << [d[:id], d[:label]] + features\n elsif options[:kind] == :umetrics\n csv << [d[:id]] + features + [d[:label]]\n end\n end\n end\n \n return(csv_string)\n end", "title": "" }, { "docid": "bd3b9a5cdfb8b3055a75785d867252de", "score": "0.53839636", "text": "def save_csv_data (a)\n rAddress2 = a[3] ? \"ES\" : nil\n \n #EAGF DIRECT PAYMENTS\n if (a[4] && a[4] > 0)\n amount = a[4]\n scheme = \"ES1\"\n data = [a[1..2],rAddress2,nil,a[3],scheme,amount,nil].flatten!\n $output_file.puts CSV::generate_line(data,:encoding => 'utf-8')\n $id += 1\n end\n #EAGF OTHER PAYMENTS\n if a[5] && a[5] > 0\n amount = a[5]\n scheme = \"ES2\"\n data = [a[1..2],rAddress2,nil,a[3],scheme,amount,nil].flatten!\n $output_file.puts CSV::generate_line(data,:encoding => 'utf-8')\n $id += 1\n end\n #EAFRD PAYMENTS\n if a[6] && a[6] > 0\n amount = a[6]\n scheme = \"ES3\"\n data = [a[1..2],rAddress2,nil,a[3],scheme,amount,nil].flatten!\n $output_file.puts CSV::generate_line(data,:encoding => 'utf-8')\n $id += 1\n end\nend", "title": "" }, { "docid": "f4e31ad0df291b0c90bc25cd0c95b2f3", "score": "0.5382724", "text": "def export_document_to_csv\n @document = Document.find_by_id(params[:id])\n return if @document.nil?\n\n csv_string_test = FasterCSV.generate do |csv|\n csv << [\"term\", \"definition\", \"question\", \"incorrect answers\"]\n\n @document.topic_identifiers.each do |ti|\n topic = Topic.find_by_id(ti.topic_id)\n answers = Answer.where(\"topic_id = ?\",ti.topic_id)\n next if topic.nil? || topic.description.nil? || topic.description.length < 1\n\n row = [clean_markup_from_desc(ti.name), clean_markup_from_desc(topic.description), clean_markup_from_desc(topic.question)]\n unless answers.nil?\n answers.each do |a|\n row << clean_markup_from_desc(a.name)\n end\n end\n csv << row\n end\n end\n\n # send it to the browsah\n send_data csv_string_test,\n :type => 'text/csv; charset=iso-8859-1; header=present',\n :disposition => \"attachment; filename=#{params[:file_name]}.csv\"\n end", "title": "" }, { "docid": "787bc437f13c0f96a91a97089599cb1d", "score": "0.53817624", "text": "def csv\n require 'anon/csv'\n Anon::CSV.anonymise!(input, output, options[:columns], options[:header])\n end", "title": "" }, { "docid": "34521dd455cbd67fc8f345147c30d18e", "score": "0.5377754", "text": "def to_csv(format=:short)\n output = ''\n columns = []\n case format\n when :long\n [\"id\", \"updated\", \"title\"].each { |c| columns << c }\n end\n unless @points.empty? # if there was at least one result\n @points.first.dimensions.map {|d| d.keys.first}.each { |c| columns << c }\n @points.first.metrics.map {|m| m.keys.first}.each { |c| columns << c }\n end\n output = CSV.generate_line(columns) \n @points.each do |point|\n output += point.to_csv(format)\n end\n output\n end", "title": "" }, { "docid": "d55db08bf4db2fd9c0e26c1f4d31df83", "score": "0.5372415", "text": "def to_csv\n FasterCSV.generate do |csv|\n csv << [ 'HD', @client.company_alias, @client.company_username, @client.company_password, 'Check' ]\n payments.each do |payment|\n csv << payment.to_csv_data if payment.batch == self # Safety net in case the same payment was applied to more than one batch. It will only go through in the last batch it was added to.\n end\n end\n end", "title": "" }, { "docid": "eeb3e90cd84db53fd0aecc4bae04b665", "score": "0.53695506", "text": "def to_tsv_format(data)\n values = data.map { |_key, value| value }\n values = values.join(TAB)\n \"\\n#{values}\"\nend", "title": "" }, { "docid": "b06436117aad7560a73fe962cf3b3106", "score": "0.5363993", "text": "def render_csv(t)\n io = StringIO.new\n io.puts (\n t.header.collect do |v|\n v ? \"\\\"#{v.to_s.gsub(/\"/, '\"\"')}\\\"\" : \"\"\n end.join(',')\n ) unless @options[:plain]\n t.each do |row|\n next if row === t.header\n io.puts (\n row.collect do |v|\n v ? \"\\\"#{v.to_s.gsub(/\"/, '\"\"')}\\\"\" : \"\"\n end.join(',')\n )\n end\n io.rewind\n io.gets(nil).encode(crlf_newline: true)\n end", "title": "" }, { "docid": "40cadd61a884b61092639060e9437f9a", "score": "0.5362633", "text": "def to_csv\n return \"#{@vid},#{@abbrevation},#{@name},#{@versionStatus}\"\n end", "title": "" }, { "docid": "82404c2f72b3573d697d4f55691d2d2c", "score": "0.5360659", "text": "def export_to_csv \n if Developer.find_by_gamer_id(current_gamer.id) != nil\n @project_id = params[:project_id]\n if Project.find_by_id(@project_id) != nil \n @exported_data = PreferedSynonym.where(project_id: @project_id).all\n csv_string = CSV.generate do |csv|\n if @exported_data != []\n @exported_data.each do |word|\n @keyword = Keyword.find_by_id(word.keyword_id).name\n @synonym = Synonym.find_by_id(word.synonym_id).name\n csv << [@keyword, @synonym]\n end\n else\n flash[:notice] = t(:no_words)\n redirect_to project_path(@project_id), flash: flash\n return\n end\n end \n send_data csv_string,\n type: \"text/csv; charset=iso-8859-1; header=present\",\n disposition: \"attachment; filename=project_data.csv\" \n else\n flash[:notice] = t(:no_project)\n render \"pages/home\"\n end\n else\n flash[:notice] = t(:not_developer)\n render \"pages/home\"\n end\n end", "title": "" }, { "docid": "5931eb204e3847c429dadc8fb78b4ba4", "score": "0.5355291", "text": "def to_csv(format = :short)\n output = ''\n columns = []\n\n # only output\n case format\n when :long\n [@id, @updated, @title].each { |c| columns << c }\n end\n\n # output all dimensions\n @dimensions.map {|d| d.values.first}.each { |c| columns << c }\n # output all metrics\n @metrics.map {|m| m.values.first}.each { |c| columns << c }\n\n output = CSV.generate_line(columns)\n\n end", "title": "" }, { "docid": "3ecc773302267dd1a38f7460798a54d8", "score": "0.53514165", "text": "def to_csv\n return \"\" if @links.count == 0\n str = CSV.generate do |csv|\n csv << [\"id\", \"name\", \"info\", \"collab_with\", \"count\"]\n @links.each do |link|\n source = find_node(link[:source])\n target = find_node(link[:target])\n csv << [source[:id], source[:name], source[:group], target[:id], link[:weight]]\n end\n end\n str\n end", "title": "" }, { "docid": "1a3113ba1627b2255948249f0b0618f8", "score": "0.534647", "text": "def to_csv(*args)\r\n find(:all).to_csv(*args) \r\n end", "title": "" }, { "docid": "fb1ef81cc7e5b3cd9da3cd61049f8aef", "score": "0.5344048", "text": "def to_csv\n\n # If this product has a variant called weight, we have to deal with this separately\n if weight_option?\n \"ProduktID: #{variant.product.id} #{variant.product.name} (#{variant.options_presentation}) #{product.container} / #{net_weight}g #{quantity} x #{number_to_currency(Spree::Money.new(price).money, unit: 'EUR')} = #{number_to_currency(Spree::Money.new(price * quantity).money, unit: 'EUR')}\"\n else\n \"ProduktID: #{variant.product.id} #{variant.product.name} (#{variant.options_presentation}) #{product.container} / #{product.net_weight}g #{quantity} x #{number_to_currency(Spree::Money.new(price).money, unit: 'EUR')} = #{number_to_currency(Spree::Money.new(price * quantity).money, unit: 'EUR')}\"\n end\n end", "title": "" }, { "docid": "4ec62598e9b649ee33df21c077a6000e", "score": "0.5343916", "text": "def export\n answer = Answer.find_by_sql(\"select * from answers where answers.user_id in (select users.id from users where users.managed_by=#{session[:user_id]}) order by answers.quest_id,answers.created_on ASC\")\n stream_csv do |csv|\n csv << [l(:label_quest) ,\"user\",l(:label_date),\"#1\",\"#2\",\"#3\",\"#4\",\"#5\",\"#6\",\"#7\",\"#8\",\"#9\",\"#10\",\"#11\",\"#12\",\"#13\",\"#14\",\"#15\",\"#16\",\"#17\",\"#18\",\"#19\",\"#20\",\"#21\",\"#22\",\"#23\",\"#24\",\"#25\",\"#26\",\"#27\",\"#28\",\"#29\",\"#30\",\"#31\",\"#32\",\"#33\",\"#34\",\"#35\",\"#36\",\"#37\",\"#38\",\"#39\",\"#40\",\"#41\",\"#42\",\"#43\",\"#44\",\"#45\",\"#46\",\"#47\",\"#48\",\"#49\",\"#50\",\"#51\",\"#52\",\"#53\",\"#54\",\"#55\",\"#56\",\"#57\",\"#58\",\"#59\",\"#60\",\"#61\",\"#62\",\"#63\",\"#64\",\"#65\",\"#66\",\"#67\",\"#68\",\"#69\",\"#70\",\"#71\",\"#72\",\"#73\",\"#74\",\"#75\",\"#76\",\"#77\",l(:field_notes),l(:label_competition)]\n answer.each do |a|\n user = User.find(a.user_id)\n nombre=user.name\n case a.quest_id\n when 1:\n csv << [a.quest_id,nombre,l_date(a.created_on),a.answ1,a.answ2 ,a.answ3 ,a.answ4 ,a.answ5 ,a.answ6 ,a.answ7 ,a.answ8 ,a.answ9 ,a.answ10 ,a.answ11 ,a.answ12 ,a.answ13,a.answ14 ,a.answ15 ,a.answ16 ,a.answ17 ,a.answ18 ,a.answ19 ,a.answ20 ,a.answ21 ,a.answ22 ,a.answ23 ,a.answ24,a.answ25 ,a.answ26 ,a.answ27 ,a.answ28 ,a.answ29 ,a.answ30 ,a.answ31 ,a.answ32 ,a.answ33 ,a.answ34 ,a.answ35,a.answ36 ,a.answ37 ,a.answ38 ,a.answ39 ,a.answ40 ,a.answ41 ,a.answ42 ,a.answ43 ,a.answ44 ,a.answ45 ,a.answ46,a.answ47 ,a.answ48 ,a.answ49 ,a.answ50 ,a.answ51 ,a.answ52 ,a.note1 ,a.answ66, a.answ67, a.note2 ,a.answ68, a.answ69, a.note3 ,a.answ70, a.answ71, a.note4 ,a.answ72, a.answ73, a.answ53 ,a.answ54 ,a.answ55 ,a.answ56 ,a.answ57,a.answ58 ,a.answ59 ,a.answ60 ,a.answ61 ,a.answ62 ,a.answ63 ,a.answ64 ,a.answ65 ,a.note5,a.competition]\n when 4:\n csv << [a.quest_id,nombre,l_date(a.created_on),a.answ1,a.answ2 ,a.answ3 ,a.answ4 ,a.answ5 ,a.answ6 ,a.answ7 ,a.answ8 ,a.answ9 ,a.answ10 ,a.answ11 ,a.answ12 ,a.answ13,a.answ14 ,a.answ15 ,a.note1 ,a.answ17 ,a.answ18 ,a.answ19 ,a.answ20 ,a.answ21 ,a.answ22 ,a.answ23 ,a.answ24,a.answ25 ,a.answ26 ,a.answ27 ,a.answ28 ,a.answ29 ,a.answ30 ,a.answ31 ,a.answ32 ,a.answ33 ,a.answ34 ,a.answ35,a.answ36 ,a.answ37 ,a.answ38 ,a.answ39 ,a.answ40 ,a.answ41 ,a.answ42 ,a.answ43 ,a.answ44 ,a.answ45 ,a.answ46,a.answ47 ,a.answ48 ,a.answ49 ,a.answ50 ,a.answ51 ,a.answ52 ,a.answ53 ,a.answ54 ,a.answ55 ,a.answ56 ,a.answ57,a.answ58 ,a.answ59 ,a.answ60 ,a.answ61 ,a.answ62 ,a.answ63 ,a.answ64 ,a.answ65 ,a.answ66 ,a.answ67 ,a.answ68,a.answ69 ,a.answ70 ,a.answ71 ,a.answ72 ,a.answ73 ,a.answ74 ,a.answ75 ,a.answ76 ,a.answ77,a.note2,a.competition]\n else\n csv << [a.quest_id,nombre,l_date(a.created_on),a.answ1,a.answ2 ,a.answ3 ,a.answ4 ,a.answ5 ,a.answ6 ,a.answ7 ,a.answ8 ,a.answ9 ,a.answ10 ,a.answ11 ,a.answ12 ,a.answ13,a.answ14 ,a.answ15 ,a.answ16 ,a.answ17 ,a.answ18 ,a.answ19 ,a.answ20 ,a.answ21 ,a.answ22 ,a.answ23 ,a.answ24,a.answ25 ,a.answ26 ,a.answ27 ,a.answ28 ,a.answ29 ,a.answ30 ,a.answ31 ,a.answ32 ,a.answ33 ,a.answ34 ,a.answ35,a.answ36 ,a.answ37 ,a.answ38 ,a.answ39 ,a.answ40 ,a.answ41 ,a.answ42 ,a.answ43 ,a.answ44 ,a.answ45 ,a.answ46,a.answ47 ,a.answ48 ,a.answ49 ,a.answ50 ,a.answ51 ,a.answ52 ,a.answ53 ,a.answ54 ,a.answ55 ,a.answ56 ,a.answ57,a.answ58 ,a.answ59 ,a.answ60 ,a.answ61 ,a.answ62 ,a.answ63 ,a.answ64 ,a.answ65 ,a.answ66 ,a.answ67 ,a.answ68,a.answ69 ,a.answ70 ,a.answ71 ,a.answ72 ,a.answ73 ,a.answ74 ,a.answ75 ,a.answ76 ,a.answ77,a.note1,a.competition]\n end\n end\n end\n end", "title": "" }, { "docid": "b9f6fb90bd1c48601053eeeaa2c5a86d", "score": "0.5340537", "text": "def create_csv_file(res)\n CSV.generate(headers: true) do |csv|\n csv << [\"Email\", \"IP\", \"Message Subject\",\"Webhook type\"]\n csv << [res[\"recipient\"],res[\"ip\"],res[\"my_var_1\"],res[\"event\"]]\n end\n end", "title": "" }, { "docid": "df7d65ce5d13f42d5729605adcb4605d", "score": "0.5339468", "text": "def to_csv(ledger)\n return parse(ledger).flat_map do |n|\n n[:accounts].map do |a|\n row = [\n n[:date].strftime(@date_format),\n n[:code],\n n[:desc],\n a[:name],\n \"\", # currency (not implemented)\n a[:amount],\n n[:type],\n \"\", # account comment (not implemented)\n ]\n CSV.generate_line(row).strip\n end\n end\n end", "title": "" }, { "docid": "5f0b634e42afc741ed2b5377b39bc383", "score": "0.5335107", "text": "def write_to_csv(json,\n output_file: 'out.csv',\n headers: true,\n nil_substitute: '',\n fields: nil,\n force_quotes: false)\n\n csv = convert_to_csv json, nil_substitute, fields\n\n CSV.open(output_file.to_s, 'w', force_quotes: force_quotes) do |output_file|\n headers_line = csv.shift\n\n columns_count = headers_line.size\n\n if headers\n output_file << headers_line\n end\n\n csv.each do |row|\n output_file << row + [nil] * (columns_count - row.size)\n end\n end\n end", "title": "" }, { "docid": "689f19ed062f11ae6bc0be6e3b7eb8f7", "score": "0.53261334", "text": "def csv\n @page = Page.find(params[:id]) \n csv_array = [\"Date,Pageviews\"]\n @page.date_pageview_array.each do |pair|\n csv_array << \"#{pair[0]},#{pair[1]}\"\n end\n send_data csv_array.join(\"\\n\"), :type => 'text/csv; charset=utf-8', :filename=>\"#{@page.url}.csv\",\n :disposition => 'attachment'\n \n end", "title": "" }, { "docid": "b5a70485388bf3865da003b23513c2c4", "score": "0.5325047", "text": "def to_csv(options = {}, csv_options = {}, &block)\n return '' if empty?\n csv_converter = ToCSV::Converter.new(self, options, csv_options, &block)\n csv_converter.to_csv\n end", "title": "" }, { "docid": "33bee63e627a805e222c5b4fd365d8e6", "score": "0.5321575", "text": "def to_generic_csv data, filename\n s = ''\n 0.upto(data.length - 1) {|i| s += data[i].map{|val| val.to_s}.join(',') + \"\\n\"}\n File.open(filename, 'w') do |f| \n f.puts s\n end \n end", "title": "" }, { "docid": "02ad842961e8b0961bbc4bffdbeb909c", "score": "0.5318754", "text": "def report_to_csv(options = {})\n if !@report.empty? \n CSV.generate(options) do |csv|\n csv << @report[0].keys\n @report.each do |assignment|\n csv << assignment.values\n end\n end\n end\nend", "title": "" }, { "docid": "80ea37a2fd3131dee376ce2c69c510b1", "score": "0.5312871", "text": "def save_to_csv(hash_array)\n # tab_email = get_email_par_ville(hash_array)\n\n\n file_json = open(\"../db/townhalls#{$count_file}.json\")\n json = file_json.read\n \n tab_email = JSON.parse(json)\n\n # Mettre l'entête du tableau [1, 1] = cellule a1\n # Mettre l'entête du tableau [1, 2] = cellule b1\n header = [\"VILLE\", \"EMAIL\"]\n \n\n CSV.open(\"../db/townhalls#{$count_file}.csv\", \"wb\") do |file|\n file << header\n tab_email.map { |contenu| file << contenu }\n end\n end", "title": "" }, { "docid": "a8212e9b0c850a93fffccc2625a841fd", "score": "0.53062946", "text": "def export\n Tag.dump data, path\n end", "title": "" }, { "docid": "2a29601c4b24bb409ffe4b159381c5ba", "score": "0.5302363", "text": "def create_csv(ds_to_include)\n case @record_type\n when 'exam_paper'\n outfile_name = 'exam_papers_key_metadata'\n when 'thesis'\n outfile_name = 'theses_key_metadata'\n else\n outfile_name = 'key_metadata'\n end\n outfile_path = @output_location + '/' + outfile_name + '.csv'\n CSV.open(outfile_path, 'a+') do |csv|\n csv << @headers if csv.count.eql? 0\n csv_row = get_csv_row(ds_to_include)\n csv << csv_row\n end\n end", "title": "" }, { "docid": "0083e848b6fa9a7fd2fa533dd80b4546", "score": "0.53017765", "text": "def to_csv(opts = {})\n headers = default_headers(self)\n\n if opts[:headers]\n headers = headers.select{|h| opts[:headers].include?(h.first) }\n end\n\n [].tap do |result|\n result << i18n_headers(headers.map(&:first)).join( opts[:separator] || self.to_csv_value_separator ) if !opts[:skip_header]\n self.each do |record|\n result << record.to_csv(headers: headers, skip_header: true )\n end\n result\n end.join(self.to_csv_line_separator)\n end", "title": "" }, { "docid": "16bd924f86b602032ea71ed4a2e67d9d", "score": "0.5286355", "text": "def create_csv_doc(source, file_link)\n # Get all headers\n @headers = []\n JSON.parse(source).each do |h|\n h.keys.each do |key|\n @headers << key\n end\n end\n\n # Uniq headers\n uniq_headers = @headers.uniq\n finalrow = []\n\n JSON.parse(source).each do |h|\n final = {}\n @headers.each do |key2|\n final[key2] = h[key2]\n end\n finalrow << final\n end\n\n CSV.open(file_link , 'w') do |csv|\n csv << uniq_headers\n finalrow.each do |deal|\n csv << deal.values\n end\n end\nend", "title": "" }, { "docid": "16bd924f86b602032ea71ed4a2e67d9d", "score": "0.5286355", "text": "def create_csv_doc(source, file_link)\n # Get all headers\n @headers = []\n JSON.parse(source).each do |h|\n h.keys.each do |key|\n @headers << key\n end\n end\n\n # Uniq headers\n uniq_headers = @headers.uniq\n finalrow = []\n\n JSON.parse(source).each do |h|\n final = {}\n @headers.each do |key2|\n final[key2] = h[key2]\n end\n finalrow << final\n end\n\n CSV.open(file_link , 'w') do |csv|\n csv << uniq_headers\n finalrow.each do |deal|\n csv << deal.values\n end\n end\nend", "title": "" }, { "docid": "0c7d08ca9643934d07ff31c3241ba549", "score": "0.52835345", "text": "def import_to_csv\n CSV.open('./output/data.csv', 'wb') do |csv|\n csv << ['Name of article', 'Image link', 'Text']\n @data.each do |article|\n csv << [article[:header], article[:imageLink], article[:text]]\n end\n end\n end", "title": "" }, { "docid": "1aa40ad1035515bc3fe07303e11de6d3", "score": "0.5282524", "text": "def transactions_csv\n results = agent.get(\"https://wwws.mint.com/transactionDownload.event\", JSON_HEADERS)\n raise RubyMintError.new(\"Unable to obtain transactions.\") if results.code != \"200\"\n raise RubyMintError.new(\"Non-CSV content returned.\") if !results.header[\"content-type\"].include?(\"text/csv\")\n\n results.body\n end", "title": "" }, { "docid": "0e3beb23f5796dff533d82fc35afae6d", "score": "0.52754885", "text": "def to_csv\n ::CSV.generate do |csv|\n decorated.line_items.each do |item|\n csv << [item.quantity, \" #{item.description}\",\n \" #{item.total_amount_inc_tax}\"]\n end\n csv << []\n csv << [\"Sales Taxes: #{total_tax}\"]\n csv << [\"Total: #{total_amount}\"]\n end\n end", "title": "" }, { "docid": "9284f789bb1d542c9793595c918410cf", "score": "0.52733827", "text": "def as_csv(*)\n CSV.generate do |csv|\n csv << attributes_with_unit\n nodes.each { |node| csv << node_row(node) }\n end\n end", "title": "" }, { "docid": "20f684650463d983ef14f906089aeada", "score": "0.52712464", "text": "def generate_csv\n ::CSV.generate do |csv|\n # Write headers\n questions_nominal = Question.where(entity_class: @entity_class).order(id: :asc).map { |q| q.nominal }\n questions_nominal += [\"class\"]\n csv.add_row(questions_nominal)\n\n # Write rows\n @klass.where(klass: @entity_class).each do |entity|\n row = entity.answers.order(question_id: :asc).map do |answer|\n answer.answer\n end\n row += [entity.name.parameterize]\n csv << row\n end\n end\n end", "title": "" }, { "docid": "b2b10dbd635811a43d1edb32d2a215b8", "score": "0.5269329", "text": "def to_csv\n CSV.generate do |csv|\n csv << HEADERS\n orders.each do |order|\n csv << csv_line(order)\n end\n end\n end", "title": "" }, { "docid": "95cf3bd3f5459e9648141bddd59a2abe", "score": "0.52686644", "text": "def to_csv(attrs: nil, comma_sub: nil, cr_sub: nil, nl_sub: nil, tab_sub: nil)\n attrs ||= self.attrs\n comma_sub ||= CSV_COMMA_SUB\n nl_sub ||= CSV_NL_SUB\n cr_sub ||= CSV_CR_SUB\n # tab_sub ||= CSV_TAB_SUB\n [].tap { |result|\n attrs.each do |attr|\n value = @hash[attr]\n value = __attr_write_value(attr, value)\n value = value.to_s.gsub(',', comma_sub)\n value = value.gsub('\\n', nl_sub)\n value = value.gsub('\\r', cr_sub)\n value = value.gsub('\\t', tab_sub) if tab_sub\n result << value\n end\n }.join(',')\n end", "title": "" }, { "docid": "d792de0150fdcacf5f560eb80a776f17", "score": "0.5264898", "text": "def event_to_csv\n\t\t@event = Event.find(params[:id])\n\n\t\tcsv_string = CSV.generate() do |csv|\n\t\t\tcsv << [@event.id,\n\t\t\t\t\t@event.name,\n\t\t\t\t\t@event.venue,\n\t\t\t\t\t@event.is_open]\n\t\tend \n\n\t\tsend_data csv_string,\n\t\t\t:type => 'text/csv; charset=iso-88859-1; header=present',\n\t\t\t:disposition => \"attachment; filename=Event_#{@event.id}_#{@event.name}.csv\"\n\tend", "title": "" }, { "docid": "c3222ffaf5dec63a8e183feb818aca97", "score": "0.5263541", "text": "def create_csv\n # create csv for JSON data\n csv_string = CSV.generate do |csv|\n # getting json data\n # creating string array of each row\n ary = JSON.parse(File.open(\"app/assets/javascripts/presidential.json\").read)\n @list = ary\n # sorting on the basis of Name\n sorted_ary = @list.sort_by!{ |m| m['nm'] }\n csv << [\"Name\", \"Party\", \"Presidential term\", \"President Number\", \"Ingestion Time\"]\n sorted_ary.each do |hash|\n # excluding all parties with which have the word Federalist in their name\n if hash.values[3].include?(\"Federalist\")\n nil\n else\n # reverse first name after splitting full name\n hash['nm'] = firstName_reverse_split(hash.values[2])\n # creating abbreviation for party\n hash['pp'] = party_abbreviation(hash.values[3])\n # extracting starting year of the term\n hash['tm'] = term_split(hash.values[4])\n # adding new column with timestamp\n hash[:iTime] = Time.now.strftime('%Y-%m-%d %H:%M:%S')\n # arranging columns in the required format\n csv << [hash.values[2], hash.values[3], hash.values[4], hash.values[1], hash.values[5]]\n end\n end\n end\n # redirecting to download the csv in Downloads folder\n send_data csv_string, type: :csv, filename: \"presidential.csv\"\n end", "title": "" }, { "docid": "4f628a87dcf39831dd834f495c4fa4ac", "score": "0.5263171", "text": "def generate\n csv_string = \"\"\n is_payer_content_layout = operation_log_config.content_layout.downcase == \"by payer\"\n is_eob_content_layout = operation_log_config.content_layout.downcase == \"by eob\"\n csv_string << csv_summary if is_payer_content_layout\n csv_string << csv_header\n csv_string << transactions\n csv_string << csv_summary if is_eob_content_layout\n csv_string unless csv_string.blank?\n end", "title": "" }, { "docid": "9ea4e71016c76a560b71f68eacae8010", "score": "0.52611464", "text": "def to_csv(*args)\n to(:csv, *args)\n end", "title": "" }, { "docid": "268113168326d322e0082c5595ff52c6", "score": "0.52580166", "text": "def as_csv(*)\n CSV.generate do |csv|\n csv << %w[\n key\n number_of_units\n electricity_output_capacity\\ (MW)\n heat_output_capacity\\ (MW)\n full_load_hours\n total_initial_investment_per_plant\\ (Euros)\n wacc\\ (factor)\n technical_lifetime\\ (years)\n ]\n\n nodes.each do |node|\n csv << node_row(node)\n end\n end\n end", "title": "" }, { "docid": "7be5840ed88c60ba893248e77e89539d", "score": "0.52565587", "text": "def convert_file(input_file, output_file)\n\n # Read the file\n data_json = File.read(input_file)\n\n # Array of all objects properties paths\n headers = []\n # Array of all objects values\n rows = []\n convert_str(data_json, headers, rows)\n\n # Write data to CSV\n CSV.open(output_file, \"w\") do |csv|\n csv << headers[0]\n rows.each do |row|\n csv << row\n end\n end\n\n end", "title": "" }, { "docid": "a529379c97970d8e014b5b1a2d90fa60", "score": "0.52470046", "text": "def create_csv_ingest_payload( row )\n\n\n payload = {}\n\n #\n # add all the required fields\n #\n\n # date and time attributes\n\n\n # resource type\n rt = row['Resource type']\n payload[ :resource_type ] = rt if rt.present?\n\n # title\n title = row['Title']\n payload[ :title ] = title if title.present?\n\n # abstract\n abstract = row['Abstract']\n payload[ :abstract ] = abstract if abstract.present?\n\n # author\n payload[ :authors ] = []\n author_number = 1\n\n while author_number < MAX_AUTHORS\n last_name = row[\"Author#{author_number}_LastName\"]\n first_name = row[\"Author#{author_number}_FirstName\"]\n\n break if first_name.blank? && last_name.blank?\n\n # remove extra whitespace\n first_name.strip!\n last_name.strip!\n\n # add a space when Anonymous\n first_name = \" \" if last_name == \"Anonymous\"\n\n author = {\n index: author_number - 1,\n first_name: first_name,\n last_name: last_name\n }\n payload[:authors] << author\n author_number += 1\n end\n\n # document contributor\n # This assumes only one contributor\n payload[ :contributors ] = []\n if row['Contributor_LastName'].present? && row['Contributor_FirstName'].present?\n payload[:contributors] << {\n index: 0,\n first_name: row['Contributor_FirstName'],\n last_name: row['Contributor_LastName']\n }\n end\n\n\n # document work source\n #payload[ :work_source ] = \"\"\n\n # related URL's\n payload[ :related_url ] = [row['Related url']] if row['Related url'].present?\n\n # sponsoring agency\n payload[:sponsoring_agency] = [row['Sponsoring Agency']] if row['Sponsoring Agency'].present?\n\n\n # keywords\n keywords = row['Keyword']\n payload[ :keywords ] = keywords.split('|') if keywords.present?\n\n # language\n #languages = IngestHelpers.solr_all_field_extract(solr_doc, 'language_lang_code_t' )\n #languages = languages.map { |l| IngestHelpers.language_code_lookup( l ) } if languages.present?\n #payload[ :language ] = languages if languages.present?\n\n # notes\n payload[ :notes ] = row['Notes']\n\n # publisher attributes\n pd = row['Published Date']\n payload[:publish_date] = pd\n\n payload[:publisher] = row['Publisher']\n\n payload[:rights] = row['Rights']\n\n # All OEC records are public\n payload[:visibility] = Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC\n\n return payload\n end", "title": "" }, { "docid": "7da221aba61fb13988bae0bbf6f44de9", "score": "0.52418363", "text": "def perform(model, serializer)\n CsvExporter.new(model, serializer).to_csv\n end", "title": "" } ]
b94a01f26a31ca90d5f5548fdd151e39
Frequency to attempt to get articles
[ { "docid": "f3c4648e26f169400665d26cad3745fe", "score": "0.61433965", "text": "def get_articles?(tick)\n tick % @query_frequency == 0\n end", "title": "" } ]
[ { "docid": "a1301e1f300eb1df214e723ef94d2d5e", "score": "0.6797138", "text": "def frequency; end", "title": "" }, { "docid": "7960938be6f6a4ef1ca858e62d1e24b1", "score": "0.6651185", "text": "def article_recommended_count\n article_recommended_count = 0\n self.articles.each do |article|\n article_recommended_count = article_recommended_count + article.article_recommendations_count\n end\n article_recommended_count\n end", "title": "" }, { "docid": "5621f7860b0e9202842ba78a98c6a78f", "score": "0.6399688", "text": "def frequency\n @freq\n end", "title": "" }, { "docid": "f4078451931df5495d186bd14c15649c", "score": "0.631191", "text": "def element_frequency(element)\n rss_feed.css(element).count\n end", "title": "" }, { "docid": "86d16fde62c8fb6d4f5e8d9f742f3925", "score": "0.62622094", "text": "def index\n @articles = Article.all.only(:category, :title).asc(:category).asc(:title)\n .group_by(&:category)\n @count = Article.count\n end", "title": "" }, { "docid": "2930d41935f17378ef3bbf24327c99e1", "score": "0.62579006", "text": "def total_articles_count\n object.articles.count\n end", "title": "" }, { "docid": "b1597b2f6c700be8bd98a2227ab1b660", "score": "0.61842525", "text": "def get_post_frequency(items)\n measure = 0\n stats = {\n :posts => 0.0,\n :period => :day,\n :label => \"No Items To Count\",\n :type => :standard,\n :size => 0\n }\n return stats if items.length == 0\n\n if items[0].published_date.nil?\n stats[:type] = :top\n stats[:label] = \"Not a Serial RSS feed\"\n return stats\n end\n\n # for: http://feeds.uptodown.com/es/android\n if items[0].published_date == items[-1].published_date\n stats[:label] = \"All Feed Items Share Same PubDate\"\n stats[:type] = :same_dates\n return stats\n end\n\n span = get_item_span_in_seconds(items)\n period = \"per day\"\n if span == \"Inf\"\n period = \"Inf\"\n stats[:period] = :day\n elsif span < SECONDS_IN_DAY\n measure = items.length / (span / SECONDS_IN_HOUR)\n period = \"per hour\"\n stats[:period] = :hour\n else\n measure = items.length / (span / SECONDS_IN_DAY)\n stats[:period] = :day\n end\n stats[:label] = \"#{measure} #{period}\"\n stats[:posts] = measure\n return stats\n end", "title": "" }, { "docid": "fb8f6d991eca13d73ad91d8c480a29b4", "score": "0.6176668", "text": "def size_estimation\n return articles.count\n end", "title": "" }, { "docid": "e7ab435a09ced60cc4814ba711b58286", "score": "0.61597353", "text": "def site_stats\n @today = Article.where(publish: 'Yes').where(\"DATE(date_published) = ?\", Time.zone.now.to_date).count\n @yesterday = Article.where(publish: 'Yes').where(\"DATE(date_published) = ?\", Time.zone.yesterday.to_date).count\n end", "title": "" }, { "docid": "fbb94991178761f4101db35cc86fe7d9", "score": "0.6145562", "text": "def frequency\n @frequency ||= parse_frequency(@params[:every])\n end", "title": "" }, { "docid": "efad12a28c4ea901f40e79683ac752aa", "score": "0.61309785", "text": "def update_read_times\n $redis.incr article_key\n article_read_times\n end", "title": "" }, { "docid": "db9376d2e3ef72d14fa47ce0c6c589fe", "score": "0.6118344", "text": "def frequency\n @frequency ||= 0.2\n end", "title": "" }, { "docid": "e07669c3493185052ffb114a9403a5fb", "score": "0.6084349", "text": "def number_of_articles(array)\n array.count\n end", "title": "" }, { "docid": "ff2a3d2e9e470893375cc5f647dcfad4", "score": "0.60820657", "text": "def count(feed)\n raise NotImplementedError\n end", "title": "" }, { "docid": "608aa812085280e23aaf6973239d9359", "score": "0.6038937", "text": "def view_count\n Article.increment_counter(:views, self.id)\n end", "title": "" }, { "docid": "33c8328c8ba36763974e4ebcc6d2e3d6", "score": "0.6018764", "text": "def calculate_article_scores\n puts \"finding article scores\"\n Article.all.each { |article|\n score = 0;\n entry = article.rss_entry\n if(entry.published)\n score += (Time.now - entry.published)/360 #increment score by # of hours\n else\n score += (Time.now - entry.created_at)/360 #increment score by # of hours\n end\n if(article.cluster)\n score += 5 #cluster penalty\n cluster = Cluster.find(article.cluster)\n score += cluster.size(cluster)*2 #penalty for larger clusters\n end\n article.score = score\n article.save!\n }\nend", "title": "" }, { "docid": "1f643ec53969b15172bd2610e12d0fec", "score": "0.5995435", "text": "def occurrences; end", "title": "" }, { "docid": "eb0b6109a692e134603e0e84a7658078", "score": "0.59743375", "text": "def index\n @frequency = 30\n @frequency = 5 if RAILS_ENV == 'development'\n end", "title": "" }, { "docid": "0ed24f56a4e38b6abf9d4d1c3a9dda2d", "score": "0.59691757", "text": "def index\n # get the source articles\n @total = Article.where(:reference_type => \"source\").count\n @art = Article.order(\"journal\").where(:reference_type => \"source\").page(params[:page]).per(25)\n @articles = {}\n # create a hash of citation articles for each source article\n @art.each do |a|\n if @articles.has_key?(a.journal) == false\n @articles[a.journal] = {} \n @articles[a.journal][:count] = 0\n end\n @articles[a.journal][:count] += 1\n # find all the citation articles for this article\n citation = Article.find(:all, :conditions=> {:id => a.citation_ids, :reference_type => 'citation'})\n\n # looping over the list of citations for this article\n citation.each do |c|\n if c.journal.blank? == false\n if @articles[a.journal].has_key?(c.journal) == false\n @articles[a.journal][c.journal] = 0\n end\n @articles[a.journal][c.journal] += 1\n end\n end\n end\n end", "title": "" }, { "docid": "8793a79606cac478ec35a44dd5e1fa22", "score": "0.596549", "text": "def get_article_words\n\t\tFEEDLIST.each do |feed|\n\t\t\tf = FeedNormalizer::FeedNormalizer.parse open(feed)\n\t\t\ti = 0\n\t\t\tf.entries.each do |entry|\n\t\t\t\ti += 1\n\t\t\t\tnext if @titles.include?(entry.title)\t\t\t\t\n\t\t\t\tprocess_entry(entry)\n\t\t\t\t@ec += 1\n\t\t\tend\n\t\t\tputs \"added #{i} entries from #{feed}\"\n\t\tend\n\t\tputs \"title len: #{@titles.length}\"\n\t\t# [@all_words, @article_words, @article_titles] s \n\tend", "title": "" }, { "docid": "2540cdb94a3ec3c85479dc6cf04321f0", "score": "0.5930923", "text": "def sync_counter\n if article.present?\n Indexer.perform_async :index, article.id\n end\n end", "title": "" }, { "docid": "f3d626a6809ee78223833dd07d7c4df8", "score": "0.5911435", "text": "def candidates_for_article(article)\n candidate_set = @term_provider.article_candidates(article)\n result = [article.name]\n report(article.name.hl(:blue))\n return result if candidate_set.empty?\n candidate_set.candidates.each do |term|\n parent_candidates = related_category_candidates(@context_provider.categories_for(article).uniq)\n genus_candidates = [@term_provider.genus_proximum_candidates(article)]\n type_candidates = related_type_candidates([article])\n parentheses_candidates = [@term_provider.parentheses_candidates(article)]\n counts = []\n counts.concat(number_of_matched_candidates(parent_candidates,term,article.name){|t,c| @cyc.with_any_mt{|cyc| cyc.isa?(t,c) } || @cyc.genls?(t,c) })\n counts.concat(number_of_matched_candidates(genus_candidates,term,genus_candidates.first.full_name){|t,c| @cyc.with_any_mt{|cyc| cyc.isa?(t,c) } || @cyc.genls?(t,c) })\n counts.concat(number_of_matched_candidates(type_candidates,term,\"DBPEDIA_TYPE\"){|t,c| @cyc.genls?(t,c) || @cyc.genls?(c,t) })\n counts.concat(number_of_matched_candidates(parentheses_candidates,term,parentheses_candidates.first.full_name){|t,c| @cyc.with_any_mt{|cyc| cyc.isa?(t,c) } || @cyc.genls?(t,c) })\n positive = counts.map.with_index{|e,i| e if i % 2 == 0 }.compact.inject(:+)\n negative = counts.map.with_index{|e,i| e if i % 2 != 0 }.compact.inject(:+)\n report do |reporter|\n if positive > 0\n count_str = \" %-20s p:%i/%i,g:%i/%i,t:%i/%i,r:%i/%i -> %i/%i/%.1f\" %\n [term.to_ruby,*counts,positive,positive+negative,(positive.to_f/(positive+negative)*100)]\n reporter.call(count_str.hl(:green))\n else\n reporter.call(\" #{term.to_ruby}\".hl(:red))\n end\n end\n result.concat([term.id,term.to_ruby.to_s,positive,positive+negative])\n end\n result\n end", "title": "" }, { "docid": "5cb98a97b331a313ed714c528b37b88a", "score": "0.5907935", "text": "def frequency\n inquire[:frequency]\n end", "title": "" }, { "docid": "7c50d200b753c1e1ec80ecfede6b3f47", "score": "0.58648103", "text": "def frequency\n @rrule.getFreq\n end", "title": "" }, { "docid": "a61b12481a8475e940fe159a807f4501", "score": "0.5861449", "text": "def offense_counts; end", "title": "" }, { "docid": "a61b12481a8475e940fe159a807f4501", "score": "0.5861449", "text": "def offense_counts; end", "title": "" }, { "docid": "c69d82384fe598596554c0ce5d8877e3", "score": "0.58592147", "text": "def frequency\n 1.second\n end", "title": "" }, { "docid": "868884a795f9e450942bd9c0bdbe7bad", "score": "0.58520937", "text": "def show\n @article.update( \n views: @article.views + 1\n )\n @relevant_articles = Article.tagged_with(@article.tag_list, :any => true)\n .where(published: true).where.not(id: @article.id)\n .order('views desc').limit(3)\n end", "title": "" }, { "docid": "4c842db3fd79af947e1ffdd882013ffa", "score": "0.585194", "text": "def calculate_relevance(articles_list, words_list)\n # the schema for relevance: if any of the words in the list of words\n # is found in any of the fields of the article object, counts +1 for \n # it's relevance. For title and author, count +2. The times_visited\n # field of the articles does count too with the following formula:\n # \n # times_visited_relevance = ((x/n)*100) / 5 -> roundup int\n #\n # where x stands for times_visited and n stands for the sum of all \n # articles clicks (sum of all times_visited for all articles).\n # The final result for the relevance shall be:\n #\n # article_relevance = times_visited_relevance + word_count + (x/73n)\n #\n @relevance_hash = {}\n puts words_list\n n = @articles_service.get_total_clicks_for_all_articles()\n articles_list.each do |article|\n word_count = 0\n words_list.each do |word|\n word_count = word_count + count_em(article.title, word)*2 + count_em(article.author, word)*2 + \n count_em(article.magazine, word) + count_em(article.translator, word) + \n count_em(article.link, word) + count_em(article.pub_company, word) +\n count_em(article.pub_company_city, word) + count_em(article.inside, word) +\n count_em(article.keywords, word)\n end\n\n # do not divide by zero\n n = 1 if n.nil? or n == 0\n\n # do not operate with a nil value\n x = article.times_visited.nil? ? 0 : article.times_visited\n times_visited_relevance = (((x/n)*100)/5).round\n\n # sum 0.0 to get a float\n article_relevance = 0.0 + times_visited_relevance + word_count + (x/(73*n))\n @relevance_hash[article] = article_relevance\n end\n @relevance_hash\n end", "title": "" }, { "docid": "6d811ade9b1ab844fbc2a216de5448d5", "score": "0.5836973", "text": "def word_frequencies words\nend", "title": "" }, { "docid": "8a6c3b04b45ffcc98cd723179c9d21b6", "score": "0.58359534", "text": "def scrape_all\n # define an overall article array\n @articles = []\n @importers ||= all_importers\n @importers.each do |importer|\n # pass all articles in an array and flatten them\n (@articles << importer.scrape).flatten!\n end\n # DEBUGGING\n puts \"Total articles number: #{@articles.count}\"\n @articles\n end", "title": "" }, { "docid": "7e0a925772143b568dcba08edaedbbd9", "score": "0.58301586", "text": "def crawl\n update_all_feeds\n fetch_and_store_articles\n end", "title": "" }, { "docid": "408a6da3f229d5ae971c426c0f6e4467", "score": "0.58274966", "text": "def frequency\n\t\traise \"Abstract method must be implemented in subclass\"\n\tend", "title": "" }, { "docid": "7b24ac15bccc3bd49cbd3c05db642669", "score": "0.5818551", "text": "def article_count(response, data, count)\n data.count.should == count.to_i\n end", "title": "" }, { "docid": "98de748dd9921cc17a2685ac37feee65", "score": "0.5800205", "text": "def word_frequencies_impl(resource)\n # Prevent possible recursion when we render this resource, below.\n return nil if resource == @resource\n @resource = resource\n\n return nil unless iso_code = resource.hb_locale\n\n lorem_words = %w(alias consequatur aut perferendis sit voluptatem accusantium doloremque aperiam eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo aspernatur aut odit aut fugit sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt neque dolorem ipsum quia dolor sit amet consectetur adipisci velit sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem ut enim ad minima veniam quis nostrum exercitationem ullam corporis nemo enim ipsam voluptatem quia voluptas sit suscipit laboriosam nisi ut aliquid ex ea commodi consequatur quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae et iusto odio dignissimos ducimus qui blanditiis praesentium laudantium totam rem voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident sed ut perspiciatis unde omnis iste natus error similique sunt in culpa qui officia deserunt mollitia animi id est laborum et dolorum fuga et harum quidem rerum facilis est et expedita distinctio nam libero tempore cum soluta nobis est eligendi optio cumque nihil impedit quo porro quisquam est qui minus id quod maxime placeat facere possimus omnis voluptas assumenda est omnis dolor repellendus temporibus autem quibusdam et aut consequatur vel illum qui dolorem eum fugiat quo voluptas nulla pariatur at vero eos et accusamus officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae itaque earum rerum hic tenetur a sapiente delectus ut aut reiciendis voluptatibus maiores doloribus asperiores repellat)\n my_path = File.dirname(File.expand_path(__FILE__))\n stopwords = File.expand_path(File.join(my_path, '..', '..', 'resources', 'stopwords', \"#{iso_code}.plist\"))\n\n stopwords = open_binary_stoplist( stopwords ) + lorem_words\n\n rendered_resource = \"<h1>#{resource.data.title}</h1>\" + resource.render(layout: false)\n doc = Nokogiri::HTML.fragment(rendered_resource)\n doc.search('style,script').each(&:remove)\n counter = WordsCounted.count( doc.text, :exclude => [stopwords, ->(t){t.length < 4}] )\n\n tokens = counter.token_frequency.to_h\n\n # Give extra weight to tokens that are in the data.keywords.\n resource&.data&.keywords&.each do |k|\n tokens[k] = tokens[k] ? tokens[k] + 10 : 10\n end\n\n # Give a lot of extra weight to tokens thare in the data.exactmatch.\n resource&.data&.exactmatch&.each do |k|\n tokens[k] = tokens[k] ? tokens[k] + 100 : 100\n end\n\n tokens\n end", "title": "" }, { "docid": "21d4b6ed7a9819346ac094bf1548274c", "score": "0.5786217", "text": "def rental_frequency\n self.dig_for_string(\"listingSummary\", \"rentalFrequency\")\n end", "title": "" }, { "docid": "1e126d4c18400bf9980e2a23cb54e35b", "score": "0.57821596", "text": "def reaping_frequency; end", "title": "" }, { "docid": "cee9985b0ec513cdb6272472c867aafe", "score": "0.5777559", "text": "def get_article_data(pg = 2, article_date = Date.today)\n agent = Mechanize.new\n tc = agent.get('http://www.techcrunch.com')\n article_pg_count = 0\n\n # Limits the amount of articles scraped\n until article_date === Date.today - 25 #<-- \"yesterday\" option\n # until Article.find_by(tc_num: @tc_num) != nil #<-- \"all\" option\n # Gets the article date\n tc.root.css('li.river-block').each do |link|\n tc_num = link['id'].to_i\n article_date = link.css('time')[0]['datetime']\n article_date = Date.parse(article_date)\n # gets the week_id\n week_date = article_date - article_date.wday\n week_date = Week.find_by_week(week_date).id\n # gets the month_id\n month_date = article_date - article_date.mday + 1\n month_date = Month.find_by_month(month_date).id\n # gets the year_id\n year_date = article_date.year.to_i\n year_date = Year.find_by_year(year_date).id\n # Gets the author (which isn't always in the same place)\n if link.css('div.byline a').text.empty?\n a = link.css('div.byline').text\n b = link.css('div.byline time').text\n author = a.gsub(b, \"\")\n author = author.gsub(\"by\", \"\").strip\n else\n author = link.css('div.byline a').text\n end\n f = link.css('h2.post-title').first\n # Gets the link\n url = f.css('a')[0]['href']\n # Gets the headline\n headline = f.css('a')[0].text\n # Combines all the parts to make an Article\n Article.create(\n tc_num: tc_num,\n headline: headline,\n date: article_date,\n url: url,\n author: author,\n week_id: week_date,\n month_id: month_date,\n year_id: year_date,\n scraped: false\n )\n article_pg_count += 1\n # Gets me to the next page of links\n if article_pg_count == 20\n tc = tc.link_with(:href => %r{page/#{pg}}i).click\n tc\n pg += 1\n article_pg_count = 0\n end\n end\n end\n end", "title": "" }, { "docid": "fb71616ae088c9f979345489b91dc087", "score": "0.5775618", "text": "def get_reviews(articles)\n goodnews = []\n articles.each do |article|\n return goodnews if Article.find_by_uri(data[article.link.gsub(/[^A-z0-9]/,'')].to_s)\n if article.title =~ /.+ Review$/\n title = article.title[0..-1-\" Review\".size].gsub('\"', '\\\"')\n q = \"SELECT *\n WHERE { ?x <http://www.semanticweb.org/ontologies/2011/10/moviesandtv.owl#hasTitle> \\\"#{title}\\\" }\"\n results = query(q)\n # If results.size == 0 do screen scraping\n if results.size == 0\n puts \">#{article.title[0..-1-\" Review\".size]}<\"\n fetch_movie_info(article.title[0..-1-\" Review\".size])\n q = \"SELECT *\n WHERE { ?x <http://www.semanticweb.org/ontologies/2011/10/moviesandtv.owl#hasTitle> \\\"#{title}\\\" }\"\n results = query(q)\n end\n goodnews << {:article => article, \"shows\" => results} if results.size > 0\n end\n end\n return goodnews\n end", "title": "" }, { "docid": "ebff6ba6d55aa24ab323d256e80ed9b5", "score": "0.576925", "text": "def article_feed\n reader = current_user.reader\n\n # This is a temp way of putting the reader\n # blogs on the q for syncing\n reader.async_all_subscriptions\n\n timestamp = params[:timestamp]\n filter = params[:source]\n count = params[:count] || 50\n\n @articles = reader.article_feed(count, filter, timestamp)\n end", "title": "" }, { "docid": "6f2b0a1f68bed3c592597227b8e0bd90", "score": "0.5759036", "text": "def stats_by_article\n\n # otherwise\n @page_title = \"Articles\"\n @breadcrumb = [\n { title: 'Stats', url: admin_root_path },\n @page_title\n ]\n\n end", "title": "" }, { "docid": "de79081188636efa1e39bfe0424ec034", "score": "0.5755318", "text": "def update_visits_count\n\t\tArticle.update(visits_count: self.visits_count + 1)\n\tend", "title": "" }, { "docid": "25fdb6668076d3a100ccbb01bdbc2f46", "score": "0.575267", "text": "def article_fetched(notification)\n log(\"fetch_articles\")\n\n @fetched += 1\n @open_connections -= 1\n notify( \"singlearticlesprocessor.status\", { :s => \"fetched\" } )\n \n if @id_list.size > @fetched\n fetch_articles\n else\n return if @done\n \n @id_list.delete_if { |a| a[:article].status.has_key?(:error) }\n \n log(\"fetch_articles\", \"#{@id_list.size} articles fetched\")\n\n # TMP-Dateien anlegen\n @id_list.each do |a|\n Instapaper.const_get(\"Single#{@format.capitalize}File\").generate(a)\n end\n \n log(\"fetch_articles\", \"All articles converted\")\n \n notify( \"singlearticlesprocessor.status\", { :s => \"all_fetched\" } )\n @done = true\n end\n end", "title": "" }, { "docid": "c70fa9a571103573cb2f6331ff872c8b", "score": "0.5744661", "text": "def order_frequency\n @orders.count\n end", "title": "" }, { "docid": "770c34733423b00c64875c8d30671d1f", "score": "0.5742828", "text": "def frequency\n @values[:frequency] || 1\n end", "title": "" }, { "docid": "57a91ef308168e9fad776bdd34ab6fc1", "score": "0.5724804", "text": "def get_new_articles\n # Download the RSS feed and save to self.doc\n get_source\n \n # Keep track of which articles are in the feed \n articles = []\n \n # For each item in the RSS feed \n (self.doc/'item').each_with_index do |item, index| \n # Create or update the article in the db\n articles << Article.factory(\n :category => self.category,\n :description => (item/'description').inner_html,\n :feed => self,\n :url => (item/'link').inner_html,\n :priority => index\n )\n end\n \n articles\n end", "title": "" }, { "docid": "85f358991e661f9b321a4755bdc1a850", "score": "0.57235515", "text": "def frequency\n @frequency ||= :monthly\n end", "title": "" }, { "docid": "ee8acc3024770b316c2db0c179280efc", "score": "0.5720584", "text": "def following_content_count\n content_count = self.following_by_type_count(\"Petition\") + self.following_by_type_count(\"Complaint\") + self.following_by_type_count(\"Post\")\n end", "title": "" }, { "docid": "a205f964f368d0677211d1270677dad4", "score": "0.57114583", "text": "def article_feed(count=25, blog_filter_id=nil, timestamp_since=nil)\n subs = []\n\n if blog_filter_id.nil?\n subs = subscriptions\n else\n subs = Subscription.where(:blog_id => blog_filter_id).limit(1)\n end\n\n puts subs.first.blog_id\n\n return {} if subs.empty?\n\n blog_ids = []\n subs.each { |b| blog_ids << b.blog_id }\n\n if !timestamp_since.nil?\n if !timestamp_since.is_a? Time\n timestamp_since = Time.at(timestamp_since.to_i / 1000)\n end\n\n articles = Article\n .where(:blog_id => blog_ids)\n .where(\"created_at > ?\", timestamp_since)\n .order('published_at DESC')\n .limit(count)\n else\n articles = Article\n .where(:blog_id => blog_ids)\n .order('published_at DESC')\n .limit(count)\n end\n \n return {} if articles.empty?\n\n articles_by_id = {}\n articles.each do |article|\n articles_by_id[article.id] = {\n 'id' => article.id,\n 'blog_id' => article.blog_id,\n 'blog_name' => Blog.get_name_by_id(article.blog_id),\n 'blog_url' => Blog.get_url_by_id(article.blog_id),\n 'title' => article.title,\n # 'blurb' => truncate(strip_tags(article.content), :length => 120, :separator => ' '),\n 'content' => article.content,\n # 'created_at' => article.created_at,\n 'published_at' => article.published_at,\n 'url' => article.url,\n 'read' => false,\n 'liked' => false\n }\n\n # Let's check the read status against\n # a mark_all_as_read marker if it exists.\n subs_search = subs.select { |s| s.blog_id == article.blog_id }\n if subs_search.size == 1\n if !subs_search.first.unread_marker.nil?\n if subs_search.first.unread_marker > article.created_at\n articles_by_id[article.id]['read'] = true\n end\n end\n end\n end\n\n article_statuses = ArticleStatus.where(:user_id => user.id, :article_id => articles_by_id.keys)\n\n # Return the articles if there are no article status rows\n return articles_by_id.values if article_statuses.empty?\n\n # Bring in the article status meta data into the articles array\n article_statuses.each do |article_status|\n article_id = article_status.article_id\n\n if articles_by_id.has_key?(article_id)\n if article_status.article_read_id?\n articles_by_id[article_id]['read'] = true\n end\n\n if article_status.like_id?\n articles_by_id[article_id]['liked'] = true\n end\n end\n end\n\n articles_by_id.values\n end", "title": "" }, { "docid": "fb050ef9b9bd2ea07200a8f5f1847ce7", "score": "0.57070595", "text": "def tf(docs)\n doc_freq = Hash.new(0) #this gets cleared for each doc\n #puts docs\n docs.each do |doc|\n doc.each do |word|\n @term_freqs[word] += 1 #calculate term frequencies\n doc_freq[word] += 1\n end\n \n #count how many documents contain just *one* instance of any given word\n doc_freq.each do |word, freq|\n @doc_freqs[word] += 1\n end\n \n #reset for the next iteration\n doc_freq.clear\n end\n end", "title": "" }, { "docid": "89aadec0466a174314ec6b1b74b46ec7", "score": "0.5702842", "text": "def fetch_term_counts\n Faraday.get(\"#{BASE_URL}?count=openfda.substance_name.exact&limit=1000\").\n body\n end", "title": "" }, { "docid": "bb4013329c17b5229aa777fdc1d2ffd7", "score": "0.5683747", "text": "def counts\r\n @counts\r\n end", "title": "" }, { "docid": "a740c4b6e3761078c9391149f5bc34e9", "score": "0.5675323", "text": "def count(item)\n c = item.get_text_object.to_string.gsub(/[^-a-zA-Z]/, ' ').split.size\n @metadata['Word Count'][c] << item\n avg = c / pages(item).to_f\n @metadata['Words Per Page'][avg] << item\n end", "title": "" }, { "docid": "1bc3f68b6bea1b059adf6c09d4bd149f", "score": "0.5672781", "text": "def number_of_published_resources(login=nil)\n count_by_frbr(login, :publishes, :how_many_resources?) \n end", "title": "" }, { "docid": "bddfdcb4b06b3c34630888131f757223", "score": "0.56698775", "text": "def highestfrequency\n \n end", "title": "" }, { "docid": "beebc28639243694fc1e934a769e17e6", "score": "0.5658393", "text": "def count\n hits.count\n end", "title": "" }, { "docid": "90ea292e962fef3d1871c6f8283f4ca4", "score": "0.56540483", "text": "def generate_rss_article length, time, stream_id\n corpus = get_corpus(length, :rss)\n title = corpus.title\n title = corpus.text[0..20] if title.blank?\n settings.global_article_counter += 1\n\n {\n :title => title,\n :pub_date => time,\n :body => corpus.text,\n :link => \"http://#{ENV[\"sserver_ip\"]}:3333/rss_article_html/#{corpus.id}\"\n }\n end", "title": "" }, { "docid": "8ca8ce20daae0e12dead7ca1cf25e83c", "score": "0.56456137", "text": "def generate_twitter_article length, time, stream_id\n {\n :id => settings.global_article_counter.to_s,\n :text => get_corpus(length, :twitter).text,\n :created_at => time,\n :retweet_count => rand(30).round,\n :retweeted? => false,\n :favorited? => false,\n :media => [],\n :urls => [],\n :user_mentions => [],\n :hashtags => [],\n :pub_date => time #for stream server only\n }\n end", "title": "" }, { "docid": "dc69dbabdc1129317a41c042535aeb3b", "score": "0.563815", "text": "def element_frequency_count\n collection.each_with_object(Hash.new(0)) { |count,x| x[count]+=1 }\n end", "title": "" }, { "docid": "ad2e14a6354790c4e0f60364b4f0f6fd", "score": "0.5637563", "text": "def freq(x) \n count[x]\n end", "title": "" }, { "docid": "3f9a4c2a742576f319bcbe4ebf969119", "score": "0.56327474", "text": "def topics_count\n object.topics.count\n end", "title": "" }, { "docid": "716957b9fd31ed3b919bedb1a7f87019", "score": "0.563008", "text": "def count\n count_by\n end", "title": "" }, { "docid": "c267ac0de49817cff5e818293e81c808", "score": "0.56251574", "text": "def basic_frequency_count(items)\n # notice that item_counts() was built in V[0.1]\n counts = item_counts(items)\n sum_of_all_counts = counts.values.reduce(:+)\n counts.each do |key,value|\n counts[key] = (value.to_f / sum_of_all_counts).round(8)\n end\nend", "title": "" }, { "docid": "cf0a0c1666ab131f7648d03fa8e8ebe0", "score": "0.5621878", "text": "def cooccurrences(domain)\n get(\"/recommendations/name/#{domain}.json\")\n end", "title": "" }, { "docid": "aeed1e68a5c0e76f1d2b7a165f69aa1d", "score": "0.5616241", "text": "def count\n end", "title": "" }, { "docid": "b93a2bf283811b3a690782feadeb7f57", "score": "0.5614087", "text": "def inverse_document_frequency(term)\n df = @model.document_count(term)\n 1 + log(documents.size / (df + 1.0))\n end", "title": "" }, { "docid": "d7b6d00238a0f9f8299216fa33b42aae", "score": "0.56103474", "text": "def per_page_note_counts\n json current_document(true).per_page_annotation_counts\n end", "title": "" }, { "docid": "2fdefe04b7dd1dbf356b2633a44c0cdb", "score": "0.5610345", "text": "def posts_count\n topics.inject(0) {|x,y| x+y.posts.count}\n end", "title": "" }, { "docid": "5d332bef04798966f2f98a4bff5fa2ab", "score": "0.55989724", "text": "def post_count\n count = 0\n \n self.posts.each do |p|\n count += 1 if p.live?\n end\n \n count\n end", "title": "" }, { "docid": "6cd2ddcb3e16647251948d6050041372", "score": "0.5584685", "text": "def byNoOfComments\n db = Mongo::Client.new([ '192.168.56.12:27017' ], :database => 'nmbp')\n m_r = Strings.new\n\n # use map reduce to get list of article ids\n # and number of comments in that article\n aggregate = db[:articles].find().map_reduce(m_r.comments_map, m_r.comments_reduce)\n sorted = aggregate.find().entries.sort! { |b, a| a[\"value\"] <=> b[\"value\"] }\n\n @articles = []\n\n # Get full article based on _id\n sorted.each do |var|\n @articles << db[:articles].find({:_id => var[\"_id\"]}).first\n end\n db.close\n end", "title": "" }, { "docid": "e5aec15546238836d8be05166a35c043", "score": "0.55806637", "text": "def show_category_articles\n count = 0\n @category.articles.each do |article|\n option_one(article) if [1, 0].include?(count)\n option_two(article) if [2, 3].include?(count)\n count += 1\n count = 0 if count > 4\n end\n end", "title": "" }, { "docid": "a7c170f6b2961c5e1dea38e91dec72df", "score": "0.5578963", "text": "def index\n #@additive_frequencies = AdditiveFrequency.paginate(page: params[:page],:per_page => 5)\n @additive_frequencies = AdditiveFrequency.all\n end", "title": "" }, { "docid": "73eed67ea048547fc3b3ffc4873363cc", "score": "0.5575675", "text": "def counts\n @counts\n end", "title": "" }, { "docid": "73eed67ea048547fc3b3ffc4873363cc", "score": "0.5575675", "text": "def counts\n @counts\n end", "title": "" }, { "docid": "f0462ed96e4e87e473ca951e6492c9f2", "score": "0.5569266", "text": "def perform(article, time)\n \t# => push stats into redis\n \tarticle.daily_views.incr(time.to_date, 1)\n \t# => push stats into mongo\n \tARTICLE_DAILY_VIEWS.update_one( {article_id: article.id}, { \"$inc\" => { :\"#{time.to_date}\" => 1 } }, :upsert => true )\n end", "title": "" }, { "docid": "db317f5897e725970285f938d40659ac", "score": "0.5563796", "text": "def count\n end", "title": "" }, { "docid": "db317f5897e725970285f938d40659ac", "score": "0.5563796", "text": "def count\n end", "title": "" }, { "docid": "db317f5897e725970285f938d40659ac", "score": "0.5563796", "text": "def count\n end", "title": "" }, { "docid": "db317f5897e725970285f938d40659ac", "score": "0.5563796", "text": "def count\n end", "title": "" }, { "docid": "db317f5897e725970285f938d40659ac", "score": "0.5563796", "text": "def count\n end", "title": "" }, { "docid": "db317f5897e725970285f938d40659ac", "score": "0.5563796", "text": "def count\n end", "title": "" }, { "docid": "7e4a35f1efc80ad73232e18c42a4b5c0", "score": "0.5563527", "text": "def count; end", "title": "" }, { "docid": "7e4a35f1efc80ad73232e18c42a4b5c0", "score": "0.5563527", "text": "def count; end", "title": "" }, { "docid": "7e4a35f1efc80ad73232e18c42a4b5c0", "score": "0.5563527", "text": "def count; end", "title": "" }, { "docid": "7e4a35f1efc80ad73232e18c42a4b5c0", "score": "0.5563527", "text": "def count; end", "title": "" }, { "docid": "7e4a35f1efc80ad73232e18c42a4b5c0", "score": "0.5563527", "text": "def count; end", "title": "" }, { "docid": "7e4a35f1efc80ad73232e18c42a4b5c0", "score": "0.5563527", "text": "def count; end", "title": "" }, { "docid": "7e4a35f1efc80ad73232e18c42a4b5c0", "score": "0.5563527", "text": "def count; end", "title": "" }, { "docid": "7e4a35f1efc80ad73232e18c42a4b5c0", "score": "0.5563527", "text": "def count; end", "title": "" }, { "docid": "7e4a35f1efc80ad73232e18c42a4b5c0", "score": "0.5563527", "text": "def count; end", "title": "" }, { "docid": "7e4a35f1efc80ad73232e18c42a4b5c0", "score": "0.5563527", "text": "def count; end", "title": "" }, { "docid": "7e4a35f1efc80ad73232e18c42a4b5c0", "score": "0.5563527", "text": "def count; end", "title": "" }, { "docid": "7e4a35f1efc80ad73232e18c42a4b5c0", "score": "0.5563527", "text": "def count; end", "title": "" }, { "docid": "7e4a35f1efc80ad73232e18c42a4b5c0", "score": "0.5563527", "text": "def count; end", "title": "" }, { "docid": "7e4a35f1efc80ad73232e18c42a4b5c0", "score": "0.5563527", "text": "def count; end", "title": "" }, { "docid": "7e4a35f1efc80ad73232e18c42a4b5c0", "score": "0.5563527", "text": "def count; end", "title": "" }, { "docid": "7e4a35f1efc80ad73232e18c42a4b5c0", "score": "0.5563527", "text": "def count; end", "title": "" }, { "docid": "7e4a35f1efc80ad73232e18c42a4b5c0", "score": "0.5563527", "text": "def count; end", "title": "" }, { "docid": "7e4a35f1efc80ad73232e18c42a4b5c0", "score": "0.5563527", "text": "def count; end", "title": "" } ]
ce1185997c08d466703dc9545182766a
Use this to protect error messages which are intended to go in the flash from causing a ActionDispatch::Cookies::CookieOverflow error (the session cookie has a limit of 4k) or making the web UI look ugly.
[ { "docid": "af524e78c771f492f8e9768954cd749f", "score": "0.0", "text": "def truncate(message)\n return message if message.size < 80\n message.slice(0, 80) + '...'\n end", "title": "" } ]
[ { "docid": "95f2a950e9757f56ba72ccc6f43d0b19", "score": "0.65349543", "text": "def set_flash_now_error(message)\n @controller.flash.now[flash_key(:error)] = message\n end", "title": "" }, { "docid": "3a6abaaec819cc1f8b7c130a745fbfe7", "score": "0.6460811", "text": "def flash_error_key\n :alert\n end", "title": "" }, { "docid": "81f6290bbf564b5d82bb92c1f353c15a", "score": "0.64475244", "text": "def flash_error_key\n :alert\n end", "title": "" }, { "docid": "063cfed33b6f9fadfb4901d1a1debc5d", "score": "0.6402357", "text": "def cookie_warning\n render :template => \"errors/bad_auth\"\n end", "title": "" }, { "docid": "fcda02eab80bb5fe7bab4a85deb7f269", "score": "0.63709956", "text": "def flash_error(*strs)\n flash_notice(*strs)\n session[:notice][0, 1] = \"2\" if session[:notice][0, 1] != \"2\"\n false\n end", "title": "" }, { "docid": "73185bf97fbd585467cb846883c79e80", "score": "0.6348546", "text": "def renders_flash(message)\n regexp = Regexp.new(message.gsub(' ', '\\\\\\+'))\n assert cookies['flash'] =~ regexp,\n \"Flash message does NOT MATCH: #{message}\\n\" +\n \" We got flash cookie: #{cookies['flash']}\\n what doesn't match to our test regexp: #{regexp}\"\n cookies.delete :flash\n end", "title": "" }, { "docid": "87b1a79c73599711d67a1dffa5cffd53", "score": "0.6342635", "text": "def set_flash_now_error(message)\n @controller.flash.now[:error] = message\n end", "title": "" }, { "docid": "717ac78beb4b9ea9073c5cc742911517", "score": "0.63404846", "text": "def flash_errors!(errors = resource.errors, max_length = 100)\n flash[:error] = errors.full_messages.join(\"\\n\").truncate(max_length) if errors.any?\n end", "title": "" }, { "docid": "109c7dd479f8744f4f5830bc88cf541c", "score": "0.63272405", "text": "def display_flash_error\n logger.debug(\"FLASH ERROR [#{flash[:error]}]\")\n %Q{<div class='bannererror'><span class='error-message'>#{flash[:error]}</span></div>} unless flash[:error].blank?\n\n end", "title": "" }, { "docid": "32633ee584ec461d6f73a333eafdc0b4", "score": "0.6319223", "text": "def flash_error(i18nkey, options={},*params)\n if options[:keep] \n flash[:error] = I18n.t(i18nkey,*params)\n else\n flash.now[:error] = I18n.t(i18nkey,*params)\n end\n \n \n end", "title": "" }, { "docid": "7cce66b7afcc48fab95c072e2c512fb9", "score": "0.6258763", "text": "def set_flash_on_exception(ex)\n # populate flash with a human readable error string suitable by\n # display in the WUI\n flash[:errmsg] = ex.get_human_readable()\n\n flash[:invalid_fields] = ex.invalid_fields\n end", "title": "" }, { "docid": "9864a8c3bd409603d2eea7e6af2c6d8d", "score": "0.62457144", "text": "def show_error(msg)\n\t\tsession[:errors] ||= []\n\t\tsession[:errors] << msg\n\tend", "title": "" }, { "docid": "15826656d609db891fe5957e9d9d2355", "score": "0.62412226", "text": "def flashes_if_any\n html = ''\n [:notice, :error].each do |key|\n message = flash[key]\n html << content_tag(:p, message, :class => key) if(message)\n end\n flash.discard\n html.html_safe\n end", "title": "" }, { "docid": "9eaedfc9649d63b32eadc3a05d1e95df", "score": "0.6225829", "text": "def login_errors(flash)\n return unless flash.alert\n content_tag(:div, flash.alert, class: 'has-error text-danger')\n end", "title": "" }, { "docid": "b7e43eee945e59168114953554b2d3e7", "score": "0.61905396", "text": "def handle_facebook_auth_errors(exception)\n session[:access_token] = nil\n flash[:error] = case exception.fb_error_code\n when 100\n t('facebook.errors.expired')\n when 190\n t('facebook.errors.invalid')\n else\n \"Error (#{exception.fb_error_code}): #{exception.fb_error_message}\"\n end\n render 'games/welcome'\n end", "title": "" }, { "docid": "c10c2f4415b6d420a1f02b6d771218e6", "score": "0.6179338", "text": "def customize_permission_denied_error\n if @@actual_configuration_options['denied']\n rep_str = load_erb_string('partials/_access_denied_flash.rb')\n insert_into_file \"app/controllers/application_controller.rb\", rep_str, :after => \"protect_from_forgery\\n\" \n end\n end", "title": "" }, { "docid": "4504bbbe4157629024f3ad1e9b1c854f", "score": "0.6130006", "text": "def note_failed_signin\n flash[:error] = \"Couldn't log you in as '#{params[:session][:login]}'\"\n logger.warn \"Failed login for '#{params[:session][:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "title": "" }, { "docid": "64924ca3a4911084487bd2418c7e16bb", "score": "0.6127021", "text": "def set_error(error_message)\n session[:error] = error_message\nend", "title": "" }, { "docid": "d83e12d66e1e2747e6ba08e834997c5f", "score": "0.61081445", "text": "def dc_flash_messages()\n err = _origin.flash[:error]\n war = _origin.flash[:warning]\n inf = _origin.flash[:info]\n note = _origin.flash[:note]\n unless err.nil? and war.nil? and inf.nil? and note.nil?\n c = ''\n c << \"<div class=\\\"dc-form-error\\\">#{err}</div>\" if err\n c << \"<div class=\\\"dc-form-warning\\\">#{war}</div>\" if war\n c << \"<div class=\\\"dc-form-info\\\">#{inf}</div>\" if inf\n c << note if note\n _origin.flash[:error] = nil\n _origin.flash[:warning] = nil\n _origin.flash[:info] = nil\n _origin.flash[:note] = nil\n\n c.html_safe\n end\nend", "title": "" }, { "docid": "c93eae7cf708821b8cb0a0c4fa63fcc5", "score": "0.6097479", "text": "def note_failed_signin\n flash.now[:error] = \"Не удалось войти как '#{@session.login}'\"\n logger.warn \"Failed login for '#{@session.login}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "title": "" }, { "docid": "958f5fa9d56a2436971476bd07d087cb", "score": "0.6095673", "text": "def note_failed_signin\n # flash[:error] = I18n.t(:\"session.login.error\") \n # logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "title": "" }, { "docid": "63709cd770f774deda534a23c59be93f", "score": "0.6058777", "text": "def failed_login_message\n if failed_login?\n flash.now[:failed_login] = flash[:alert]\n flash.now[:alert] = nil\n end\n end", "title": "" }, { "docid": "23e9e37f7fcea3f2dc4cc557df7d5718", "score": "0.60572606", "text": "def network_error\n flash[:error] = \"An issue with network traffic prevented your page from loading fully. Please try again.\"\n end", "title": "" }, { "docid": "e1f732b756af9629dfbaacb4ecf6db0a", "score": "0.60547924", "text": "def note_failed_survey_signin\n flash.now[:error] = \"We are unable to process your request at this time. If the problem persists, \"\\\n \"<a href=\\\"#{contact_path}\\\"> let us know</a>.\"\n logger.warn \"Failed survey login for key:#{params[:key]} at #{Time.now.utc}\"\n end", "title": "" }, { "docid": "bbf714e368c8a7f867587dec88c44163", "score": "0.60514194", "text": "def error\n if !(flash && flash[:error]) && @exception\n flash[:error] = @exception.message\n end\n end", "title": "" }, { "docid": "526ffbdf3dda6af8a6958f74382939e1", "score": "0.60463756", "text": "def auth_error\n add_flash(_(\"The user is not authorized for this task or item.\"), :error)\n add_flash(_(\"Press your browser's Back button or click a tab to continue\"))\n end", "title": "" }, { "docid": "0cc11a3d9f2c588aef649a5bca009ae2", "score": "0.6045386", "text": "def render_auth_token_error_html\n msg = \"Error: Unable to verify the authenticity of your session. This can happen if cookies are disabled or overly restricted. Please check your cookies, reload the page, and try again.\"\n render :text=>msg, :status=>:bad_request\n end", "title": "" }, { "docid": "e07077e825b9e348c7e03b96b90ad9b0", "score": "0.60421944", "text": "def note_failed_signin\n # 失敗時のメッセージをflashに保存しておく。(メッセージの表示させないが、値の有無だけ見ている。)\n flash[:error] = 'メールアドレス、またはパスワードが間違っています。'\n # ログファイルに残しておく。\n logger.warn \"Failed login for '#{params[:user][:email]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "title": "" }, { "docid": "6bb49fa93365f084756f80d1c5bd3a3c", "score": "0.60419714", "text": "def show_error_notice(error)\n @error = error\n # truncate the message, because very long error messages (i.e from mysql2) causes cookie overflow errors\n @notice = error.message[0..255]\n @trace = error.backtrace[0..50]\n if request.xhr?\n render action: \"error_notice\"\n else\n respond_to do |format|\n format.html { render \"500\", status: 500 }\n format.json { render json: {message: @notice}, status: 500 }\n end\n end\n end", "title": "" }, { "docid": "3b9ff4877f86c37a9032f5e256c5d09f", "score": "0.604163", "text": "def throw_error(message)\n session.delete('error')\n \"<p class=\\\"error\\\">\" + message + \"</p>\" unless message.nil?\nend", "title": "" }, { "docid": "beb04bbc7321218eb889819de5fbcfe1", "score": "0.60354096", "text": "def error_box title, close_text=\"\", &block\n render_flash 'application/error', title, close_text, &block\n end", "title": "" }, { "docid": "3be042aaef959a05b4a799645bb0fced", "score": "0.6030839", "text": "def flash_messages\n html_all = ''\n flash.each do |flash_msg_type, message|\n html = <<-HTML\n <div class=\"flash-message #{bootstrap_class_for(flash_msg_type)}\">\n #{message}\n </div>\n HTML\n html_all += html\n end\n sanitize(html_all.html_safe)\n end", "title": "" }, { "docid": "aaf59c01d1cc5175b7b5762165fc06d7", "score": "0.60226744", "text": "def failure\n flash[:error] = params[:message] # putting the error on the redirect doens't work!\n flash[:error] << \". Note that if the Salesforce organization you are authenticating against has IP or other login restrictions, you cannot use it with this application.\"\n redirect_to root_path\n end", "title": "" }, { "docid": "2ca586d1035f7edb33faa03bcb21d1a3", "score": "0.5996269", "text": "def render_not_authorized_error\n flash.keep[:danger] = 'Access denied.'\n redirect_to(root_path_for_current_user)\n end", "title": "" }, { "docid": "e7ef43bf4d1000e4bcd343c1a5bf7694", "score": "0.59949636", "text": "def handle_403(e)\n redirect_to new_session_path, alert: e.message\n end", "title": "" }, { "docid": "4b53d9d6eedb8038fd83153d8e72e03e", "score": "0.5994578", "text": "def flash_messages\n f_names = [:notice, :alert, :message]\n fl = ''\n\n for name in f_names\n if flash[name]\n fl = fl + \"<div class=\\\"notice\\\">#{flash[name]}</div>\"\n end\n flash[name] = nil;\n end\n\n fl.html_safe\n end", "title": "" }, { "docid": "6ee14fa8cc4d41fb2fb0ccbeb9f5b60f", "score": "0.5989468", "text": "def flash_error_for(object, message)\n resource_desc = object.class.model_name.human\n flash.now[:error] = \"#{resource_desc} #{message.to_s.humanize(capitalize: false)}: <br />#{object.errors.full_messages.join('<br />')}\".html_safe\n end", "title": "" }, { "docid": "96509aac1ab247fb63f38afcad1b60ff", "score": "0.5988873", "text": "def note_failed_signin\n flash[:error] = \"'#{I18n.t('session.note_failed_signin.error')}' '#{params[:login]}'\"\n end", "title": "" }, { "docid": "5b72ae5d68e949b276deef28c756f49e", "score": "0.5986346", "text": "def flash_messages\n flashes = \"\"\n flash.each do |type, value|\n flashes += content_tag(:div, value, class: flash_class(type.to_sym))\n end\n content_tag(:div, flashes.html_safe)\n end", "title": "" }, { "docid": "4d6e3d0a0ba7fd63178a4c1d56543dca", "score": "0.59825975", "text": "def note_failed_signin\n flash[:error] = \"Couldn't sign you in as '#{params[:user_session][:username]}'\"\n logger.warn \"Failed login for '#{params[:user_session][:username]}' from\" + \n \" #{request.remote_ip} at #{Time.now.utc}\"\n end", "title": "" }, { "docid": "d91fb7046f9c61493a459311d823d314", "score": "0.5978693", "text": "def failed_login(message)\n flash.now[:error] = message\n if request.xhr?\n render :update do |page|\n page.replace 'error', \"<div id='error'>#{flash[:error]}</div>\"\n page[\"notice\"].hide\n end\n else\n render :new\n end\n end", "title": "" }, { "docid": "cd2521650dddbee85be0ac20a700d095", "score": "0.5978323", "text": "def render_auth_token_error_js\n msg = \"Error: Unable to verify the authenticity of your session. This can happen if cookies are disabled or overly restricted. Please check your cookies, reload the page, and try again.\"\n render :text=>msg, :status=>:bad_request\n end", "title": "" }, { "docid": "473f304985c41a5516bfb46b06d95c22", "score": "0.5961795", "text": "def flash_messages\n safe_buffer do |html|\n flash.each do |name, message|\n html << content_tag(:p, message, :class => \"message #{name}\")\n flash.discard(name)\n end\n end\n end", "title": "" }, { "docid": "9bc6d540a9eb1417c0ad235e3992844a", "score": "0.5960233", "text": "def sessionnalize\n return if messages.empty?\n session['flash-notices'] = messages.join(';;;')\n end", "title": "" }, { "docid": "50d7990a5a298d37dc9d8054331af604", "score": "0.5955718", "text": "def flash_notice\n %Q{\n <div id=\"errorExplanation\" class=\"errorExplanation\">\n <div class='ui-state-error ui-corner-all' style='padding: 8px;'>\n <span class='ui-icon ui-icon-info' style='float: left; margin-right: 0.3em;'></span>\n #{flash[:notice]}\n </div>\n </div>\n }\n end", "title": "" }, { "docid": "73a0509aaf054c8fe2001de723bb3d9f", "score": "0.59402597", "text": "def flash_get_notices\n # Maybe there is a cleaner way to do this. session[:notice] should\n # already be html_safe, but the substring marks it as unsafe. Maybe there\n # is a way to test if it's html_safe before, and if so, then it should be\n # okay to remove the first character without making it html_unsafe??\n # rubocop:disable Rails/OutputSafety\n session[:notice].to_s[1..].html_safe\n # rubocop:enable Rails/OutputSafety\n end", "title": "" }, { "docid": "fff584b463f5d57334edb4bd9d531c14", "score": "0.5938205", "text": "def error(message, name=:notice_error)\r\n flash[name] = {:message => message}\r\n end", "title": "" }, { "docid": "d210f3b8ba98990e0c3c51450b119242", "score": "0.59362364", "text": "def flash_errors(object)\n errors = object.errors.full_messages\n flash.now[:danger] = \"#{I18n.t(\"helpers.error.#{object.new_record? ? 'create' : 'update'}\", controller: controller_name.singularize)} Error#{'s' unless errors.length == 1}: #{errors.join('. ')}.\"\n end", "title": "" }, { "docid": "90282e21b5113046495e04a89656cbab", "score": "0.59222573", "text": "def note_failed_signin\n flash[:error] = \"Couldn't log you in as '#{params[:login]}'. Are you sure your Login name and Password are correct?\"\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "title": "" }, { "docid": "43924b25fbe6969d97d2edb9c641bfb3", "score": "0.59220666", "text": "def flash_strings\n safe_join flash.collect { |type, message|\n flash.delete type\n message\n }, '<br\\>'.html_safe\n end", "title": "" }, { "docid": "de697d626bdb37c5fd17ffa16a61b566", "score": "0.5914811", "text": "def render_with_truncate_flash(*args)\n [:alert, :error].each do |key|\n msg = flash[key]\n next unless msg\n next if msg.length < TRUNCATE_FLASH_LENGTH\n\n split_at = TRUNCATE_FLASH_LENGTH - 150\n (first,rest) = [msg[0..(split_at-1)], msg[split_at..TRUNCATE_FLASH_LENGTH]]\n\n Rails.logger.warn \"Truncating huge flash[:#{key}]: #{first}...\"\n\n elide_msg = \"...additional messages were hidden. Too many errors to display!\"\n\n # heuristic to try to slot the message in a sensible place.\n if rest.sub!(%r{<br[ /]*>.*$}, \"<br/>#{elide_msg}\")\n # slotted after an existing line\n else\n rest = \"<br/>#{elide_msg}\"\n end\n flash[key] = [first,rest].join\n end\n\n render_without_truncate_flash(*args)\n end", "title": "" }, { "docid": "eb50c498b49a15ec2e8c9d755ee8b94e", "score": "0.5910158", "text": "def note_failed_signin\r\n flash.now[:error] = \"Couldn't log you in as '#{params[:login]}'\"\r\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\r\n end", "title": "" }, { "docid": "3f5323035043187b14867fd223e01595", "score": "0.58897126", "text": "def escaped_humane_flash_messages\n content = \"\"\n unless flash[:notice].blank?\n content << javascript_tag(\"humane.notice(\\\"#{escape_javascript(html_escape flash[:notice])}\\\");\")\n end\n unless flash[:error].blank?\n content << javascript_tag(\"humane.error(\\\"#{escape_javascript(html_escape flash[:error])}\\\");\")\n end\n unless flash[:alert].blank?\n content << javascript_tag(\"humane.alert(\\\"#{escape_javascript(html_escape flash[:alert])}\\\");\")\n end\n content\n end", "title": "" }, { "docid": "408e0145bb7afc0f5fd2bcb4b2c0695f", "score": "0.5887173", "text": "def access_denied(exception = nil)\n if exception.respond_to?(:flash_error)\n flash[:error] = [flash[:error], exception.flash_error].compact.join(' ').strip\n end\n flash[:error] ||= I18n.t('exceptions.security_violations.default')\n # Beware of redirect loops! Check we are not redirecting back to current URL that user can't access\n store_location(nil) if return_to_url && return_to_url.include?(current_url)\n store_location(referred_url) if referred_url && !return_to_url && !referred_url.include?(current_url)\n if logged_in?\n redirect_back_or_default\n else\n session[:return_to] = request.url if params[:return_to].nil?\n redirect_to login_path\n end\n end", "title": "" }, { "docid": "daf192fed02d52e0ebba0b48e6fb40da", "score": "0.58789796", "text": "def note_failed_signin\n flash[:error] = t(\"users.could_not_login_as\", :login => params[:user_session][:login])\n logger.warn \"Failed login for '#{params[:user_session][:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "title": "" }, { "docid": "37c645a18291fc0e5f8e7fdffe0e3fa9", "score": "0.5876377", "text": "def flash_messages\n output = <<~HTML\n <p class=\"notice\">#{flash[:notice]}</p>\n <p class=\"alert\">#{flash[:alert]}</p>\n HTML\n\n # rubocop:disable Rails/OutputSafety\n output.html_safe\n # rubocop:enable Rails/OutputSafety\n end", "title": "" }, { "docid": "c50bf57e303ed4185dc16d69e2e0e81d", "score": "0.5866618", "text": "def form_error(name, message)\n if respond_to?(:flash)\n old = flash[:form_errors] || {}\n flash[:form_errors] = old.merge(name.to_s => message.to_s)\n else\n form_errors[name.to_s] = message.to_s\n end\n end", "title": "" }, { "docid": "d8aa4ea13d57a0448335f36d1b586a41", "score": "0.5863488", "text": "def note_failed_signin\r\n flash[:error] = \"Couldn't log you in as '#{params[:login]}'\"\r\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\r\n end", "title": "" }, { "docid": "d8aa4ea13d57a0448335f36d1b586a41", "score": "0.5863488", "text": "def note_failed_signin\r\n flash[:error] = \"Couldn't log you in as '#{params[:login]}'\"\r\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\r\n end", "title": "" }, { "docid": "bfa3ad8a2245533d6d625225e462483b", "score": "0.5863052", "text": "def note_failed_signin\n #flash[:error] = \"Couldn't log you in as '#{params[:login]}'\"\n @error = \"用户名或密码错误\"\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "title": "" }, { "docid": "35273ff0c2c4816ab098181612685838", "score": "0.5861367", "text": "def note_failed_signin\n flash[:error] = \"Não foi possível fazer login como '#{params[:user_session][:login]}'\"\n logger.warn \"Failed login for '#{params[:user_session][:login]}' from #{request.remote_ip} at #{Time.current}\"\n end", "title": "" }, { "docid": "bd96c78f5b88be24947b0cd9d0d08500", "score": "0.58591115", "text": "def invalid_authenticity_token\n set_now_flash_message :failure, :facebook_authenticity_token\n render_with_scope :new, :controller => :sessions\n end", "title": "" }, { "docid": "b293228743d7d22da100e178e4f1cac2", "score": "0.58549875", "text": "def flash_keys\n [:error, :notice, :warning]\n end", "title": "" }, { "docid": "438986b94ee8d67ea5ccb0b1a27b63eb", "score": "0.5849534", "text": "def assert_flash_error(msg='')\n assert_flash(2, msg)\n end", "title": "" }, { "docid": "45cf74cbb5eb052ac11a760485b3af2e", "score": "0.58441556", "text": "def note_failed_signin\n flash.now[:error] = \"El usuario o la contraseña son incorrectos.\"\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "title": "" }, { "docid": "1f266880638a9a57c6e30a36ada5fa16", "score": "0.58398795", "text": "def show_error(exception)\n if RAILS_ENV == 'production'\n if facebook?\n flash[:error] = \"Alonetone made a boo boo: <br/> #{exception.message}\"\n render :partial => 'facebook_accounts/error', :layout => true\n else\n # show something decent for visitors\n flash[:error] = \"Whups! That didn't work out. We've logged it, but feel free to let us know (bottom right) if something is giving you trouble\"\n redirect_to :back\n end\n else\n # let me see what's wrong in dev mode.\n raise exception \n end\n end", "title": "" }, { "docid": "9e16707c3d58b7adcc5f1ccbc5df2c96", "score": "0.5838686", "text": "def handle_flash_messages(extra_content='')\r\n markup = ''\r\n return markup if ! flash\r\n\r\n if flash[:error]\r\n content = flash[:error].empty? ? '' : %{<div>#{flash[:error]}</div>}\r\n content << extra_content\r\n markup << render_to_string( :partial => 'admin/common/flash_error', :locals => {:message => content} )\r\n end\r\n\r\n flash[:message] = flash[:notice] if flash[:notice] and flash[:message].blank?\r\n\r\n if flash[:message]\r\n content = flash[:message].empty? ? %{<div>Successful Update</div>} : flash[:message]\r\n markup << render_to_string( :partial => 'admin/common/flash_message', :locals => {:message => content} )\r\n end\r\n\r\n markup\r\n end", "title": "" }, { "docid": "6f1d74b2446ae1fada3e271d23bcd22f", "score": "0.5829916", "text": "def flash_messages\r\n %w(notice warning error).map do |msg|\r\n content_tag(:script,\r\n \"$.jGrowl(\\\"#{flash.delete(msg.to_sym)}\\\", { header: '#{t(msg, :default => msg).mb_chars.titleize}', sticky: true, theme: '#{msg}' });\".html_safe\r\n ) unless flash[msg.to_sym].blank?\r\n end.join(\"\\n\").html_safe\r\n end", "title": "" }, { "docid": "00249720aff375a9888aac587cedde8e", "score": "0.5826372", "text": "def note_failed_signin\n flash[:error] = \"Couldn't log you in as '#{params[:login]}'\"\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "title": "" }, { "docid": "00249720aff375a9888aac587cedde8e", "score": "0.5826372", "text": "def note_failed_signin\n flash[:error] = \"Couldn't log you in as '#{params[:login]}'\"\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "title": "" }, { "docid": "00249720aff375a9888aac587cedde8e", "score": "0.5826372", "text": "def note_failed_signin\n flash[:error] = \"Couldn't log you in as '#{params[:login]}'\"\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "title": "" }, { "docid": "00249720aff375a9888aac587cedde8e", "score": "0.5826372", "text": "def note_failed_signin\n flash[:error] = \"Couldn't log you in as '#{params[:login]}'\"\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "title": "" }, { "docid": "00249720aff375a9888aac587cedde8e", "score": "0.5826372", "text": "def note_failed_signin\n flash[:error] = \"Couldn't log you in as '#{params[:login]}'\"\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "title": "" }, { "docid": "00249720aff375a9888aac587cedde8e", "score": "0.5826372", "text": "def note_failed_signin\n flash[:error] = \"Couldn't log you in as '#{params[:login]}'\"\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "title": "" }, { "docid": "00249720aff375a9888aac587cedde8e", "score": "0.5826372", "text": "def note_failed_signin\n flash[:error] = \"Couldn't log you in as '#{params[:login]}'\"\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "title": "" }, { "docid": "00249720aff375a9888aac587cedde8e", "score": "0.5826372", "text": "def note_failed_signin\n flash[:error] = \"Couldn't log you in as '#{params[:login]}'\"\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "title": "" }, { "docid": "00249720aff375a9888aac587cedde8e", "score": "0.5826372", "text": "def note_failed_signin\n flash[:error] = \"Couldn't log you in as '#{params[:login]}'\"\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "title": "" }, { "docid": "00249720aff375a9888aac587cedde8e", "score": "0.5826372", "text": "def note_failed_signin\n flash[:error] = \"Couldn't log you in as '#{params[:login]}'\"\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "title": "" }, { "docid": "00249720aff375a9888aac587cedde8e", "score": "0.5826372", "text": "def note_failed_signin\n flash[:error] = \"Couldn't log you in as '#{params[:login]}'\"\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "title": "" }, { "docid": "00249720aff375a9888aac587cedde8e", "score": "0.5826372", "text": "def note_failed_signin\n flash[:error] = \"Couldn't log you in as '#{params[:login]}'\"\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "title": "" }, { "docid": "00249720aff375a9888aac587cedde8e", "score": "0.5826372", "text": "def note_failed_signin\n flash[:error] = \"Couldn't log you in as '#{params[:login]}'\"\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "title": "" }, { "docid": "00249720aff375a9888aac587cedde8e", "score": "0.5826372", "text": "def note_failed_signin\n flash[:error] = \"Couldn't log you in as '#{params[:login]}'\"\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "title": "" }, { "docid": "00249720aff375a9888aac587cedde8e", "score": "0.5826372", "text": "def note_failed_signin\n flash[:error] = \"Couldn't log you in as '#{params[:login]}'\"\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "title": "" }, { "docid": "00249720aff375a9888aac587cedde8e", "score": "0.5826372", "text": "def note_failed_signin\n flash[:error] = \"Couldn't log you in as '#{params[:login]}'\"\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "title": "" }, { "docid": "00249720aff375a9888aac587cedde8e", "score": "0.5826372", "text": "def note_failed_signin\n flash[:error] = \"Couldn't log you in as '#{params[:login]}'\"\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "title": "" }, { "docid": "00249720aff375a9888aac587cedde8e", "score": "0.5826372", "text": "def note_failed_signin\n flash[:error] = \"Couldn't log you in as '#{params[:login]}'\"\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "title": "" }, { "docid": "00249720aff375a9888aac587cedde8e", "score": "0.5826372", "text": "def note_failed_signin\n flash[:error] = \"Couldn't log you in as '#{params[:login]}'\"\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "title": "" }, { "docid": "00249720aff375a9888aac587cedde8e", "score": "0.5826372", "text": "def note_failed_signin\n flash[:error] = \"Couldn't log you in as '#{params[:login]}'\"\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "title": "" }, { "docid": "00249720aff375a9888aac587cedde8e", "score": "0.5826372", "text": "def note_failed_signin\n flash[:error] = \"Couldn't log you in as '#{params[:login]}'\"\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "title": "" }, { "docid": "00249720aff375a9888aac587cedde8e", "score": "0.5826372", "text": "def note_failed_signin\n flash[:error] = \"Couldn't log you in as '#{params[:login]}'\"\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "title": "" }, { "docid": "00249720aff375a9888aac587cedde8e", "score": "0.5826372", "text": "def note_failed_signin\n flash[:error] = \"Couldn't log you in as '#{params[:login]}'\"\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "title": "" }, { "docid": "00249720aff375a9888aac587cedde8e", "score": "0.5826372", "text": "def note_failed_signin\n flash[:error] = \"Couldn't log you in as '#{params[:login]}'\"\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "title": "" }, { "docid": "00249720aff375a9888aac587cedde8e", "score": "0.5826372", "text": "def note_failed_signin\n flash[:error] = \"Couldn't log you in as '#{params[:login]}'\"\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "title": "" }, { "docid": "00249720aff375a9888aac587cedde8e", "score": "0.5826372", "text": "def note_failed_signin\n flash[:error] = \"Couldn't log you in as '#{params[:login]}'\"\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "title": "" }, { "docid": "00249720aff375a9888aac587cedde8e", "score": "0.5826372", "text": "def note_failed_signin\n flash[:error] = \"Couldn't log you in as '#{params[:login]}'\"\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "title": "" }, { "docid": "00249720aff375a9888aac587cedde8e", "score": "0.5826372", "text": "def note_failed_signin\n flash[:error] = \"Couldn't log you in as '#{params[:login]}'\"\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "title": "" }, { "docid": "00249720aff375a9888aac587cedde8e", "score": "0.5826372", "text": "def note_failed_signin\n flash[:error] = \"Couldn't log you in as '#{params[:login]}'\"\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "title": "" }, { "docid": "da57019cd9caf244d1934bf4c7f19a4b", "score": "0.58263505", "text": "def bad_credentials\n begin\n page = HomePage.new(session, {error: {type: :bad_credentials, message: \"Unknown user or wrong password\"}})\n render text: page.render()\n rescue\n render text: \"Error\", status: 500\n end\n end", "title": "" }, { "docid": "17180315b1c8da7336de2060c46cb72b", "score": "0.58209276", "text": "def flash_errors_for(subject)\n return unless subject.errors.any?\n\n errors = pluralize subject.errors.count, 'error'\n thing = subject.class.name.downcase\n flash.now[:alert] = \"#{errors} prohibited this #{thing} from being saved.\"\n end", "title": "" }, { "docid": "742511683a69c8a9f3ec80081f592585", "score": "0.58208054", "text": "def errors_to_flash(errors)\n flash[:error] = \"<p>There were problems with the following fields:</p>\"\n spacing = \"\"\n 13.times {spacing += \"&nbsp\"}\n errors.each do |k, v| \n flash[:error] += \"#{spacing}<strong>#{k.to_s.humanize}</strong> #{v}<br/>\"\n end\n flash[:error] += \"<br/>\"\n end", "title": "" }, { "docid": "2de8f1c48113ec364d3a250852e125af", "score": "0.5819635", "text": "def note_failed_signin\n flash[:error] = \"Couldn't log you in as '#{params[:login]}'.\"\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "title": "" } ]
3f1354babcd44b166c21925595196f8d
POST /user_stocks POST /user_stocks.json
[ { "docid": "2192b436cf1fb155f7744531fb074a25", "score": "0.7600134", "text": "def create\n @user = User.find(params[:user_id])\n @stock = Stock.where(symbol: params[:user_stock][:symbol]).first_or_create\n params[:user_stock].merge!(stock_id: @stock.id)\n @user_stock = UserStock.new(params[:user_stock])\n\n respond_to do |format|\n if @user_stock.save\n format.html { redirect_to user_user_stocks_path(@user), notice: 'User stock was successfully created.' }\n format.json { render json: @user_stock, status: :created, location: @user_stock }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_stock.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "650667075d05ed0b75a183e6ced2e346", "score": "0.79482275", "text": "def create\n @user = User.find_by(id: params[:user_id])\n if @user.id == current_user.id\n @stock = @user.stocks.new(stock_params)\n if @user.stocks << @stock\n render 'stocks/stock.json.jbuilder', stock: @stock\n else\n render json: {\n errors: @stock.errors.full_messages\n }, status: 500\n end\n end \n end", "title": "" }, { "docid": "61450dc08b3e5ecc39279367e1439d4c", "score": "0.746637", "text": "def create\n @stock = Stock.new(stock_params.merge :user_id => current_user.id)\n respond_to do |format|\n if @stock.save\n format.html { redirect_to :back, notice: 'Stock was successfully created.' }\n format.json { render :show, status: :created, location: @stock }\n else\n format.html { redirect_to :back, alert: 'Already stocked.' }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b77a9aec852ea0fbaf2b2507087892b1", "score": "0.7290076", "text": "def user_stock_params\n params.require(:user_stock).permit(:user_id, :stock_id)\n end", "title": "" }, { "docid": "b77a9aec852ea0fbaf2b2507087892b1", "score": "0.7290076", "text": "def user_stock_params\n params.require(:user_stock).permit(:user_id, :stock_id)\n end", "title": "" }, { "docid": "b77a9aec852ea0fbaf2b2507087892b1", "score": "0.7290076", "text": "def user_stock_params\n params.require(:user_stock).permit(:user_id, :stock_id)\n end", "title": "" }, { "docid": "1798f4322efeb3b60d4c58083f4be270", "score": "0.71732074", "text": "def create\n create_user_stock\n respond_to do |format|\n if @user_stock.save\n format.html { redirect_to my_portfolio_path, notice: message(:added, @user_stock.stock.ticker) }\n format.json { render :show, status: :created, location: @user_stock }\n else\n format.html { render :new }\n format.json { render json: @user_stock.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9e4fa158166f1faf49806865c8eddcb4", "score": "0.7158822", "text": "def user_stock_params\n params.require(:user_stock).permit(:user_id, :stock_id)\n end", "title": "" }, { "docid": "9e4fa158166f1faf49806865c8eddcb4", "score": "0.7158822", "text": "def user_stock_params\n params.require(:user_stock).permit(:user_id, :stock_id)\n end", "title": "" }, { "docid": "9c45f02dd45d199e302e37f9aaffbe00", "score": "0.7142809", "text": "def new\n @user = User.find(params[:user_id])\n @user_stock = UserStock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_stock }\n end\n end", "title": "" }, { "docid": "dac84c2b531464317c36f08ddd43cbb4", "score": "0.7064279", "text": "def create\n @stock = Stock.new(stock_params)\n @stock.user_id = current_user.id\n @stock.sname = StockQuote::Stock.quote(params['stock'][:ticker]).sname\n @stock.name = StockQuote::Stock.quote(params['stock'][:ticker]).name\n respond_to do |format|\n if @stock.save\n format.html { redirect_to stocks_path, notice: 'Stock was successfully created.' }\n format.json { render :show, status: :created, location: @stock }\n else\n format.html { render :new }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "deace7b843e59720c98471d220e99621", "score": "0.7036399", "text": "def create\n @stock = Stock.new(stock_params)\n\n if @stock.save\n render json: @stock, status: :created, location: @stock\n else\n render json: @stock.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "70154e3073e6fd62dec98706c5bfe847", "score": "0.70339286", "text": "def create\n @stock = Stock.create!(stock_params)\n json_response(@stock, :created)\n\n end", "title": "" }, { "docid": "8167a544c297f69a5f6d649cab7f37f2", "score": "0.6998968", "text": "def create\n @stock = current_user.portfolios.default.stocks.build(stock_params)\n\n respond_to do |format|\n if @stock.save\n format.html { redirect_to root_path, notice: 'Stock was successfully created.' }\n format.json { render :show, status: :created, location: @stock }\n else\n format.html { render :new }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4f07a7a22483e408d5e2f64dce244032", "score": "0.6965676", "text": "def create\n stock = nil\n stock_id = params[:stock_id]\n user_id = params[:user_id]\n\n # If we have the stock_id, let's try finding it in the database\n if stock_id.present?\n stock = Stock.find(stock_id)\n end\n\n # Stock is in database? let's create a @user_stock\n if stock\n @user_stock = UserStock.new(user_id: user_id, stock_id: stock.id)\n # Stock not in the database. Let's search it using yahoo client\n else\n ticker = params[:stock_ticker]\n if ticker.present?\n stock = Stock.new_from_lookup(ticker)\n if stock && stock.save\n @user_stock = UserStock.new(user_id: user_id, stock_id: stock.id)\n end\n end\n end\n\n respond_to do |format|\n if @user_stock && @user_stock.save\n success_msg = \"Stock #{stock.name} has been added to your portfolio\"\n format.html { redirect_to(my_portfolio_path, notice: success_msg) }\n format.json { render :show, status: :created, location: @user_stock }\n else\n flash[:error] = \"There was an error adding the stock\"\n format.html { render :new }\n format.json { render json: @user_stock.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8538114b5d20845a5c28d665b029f864", "score": "0.69491494", "text": "def create\n #Assigns user if there is no current user\n if current_user\n @portfolio = current_user.portfolios.find_by(name: params[:portfolio])\n @stock = @portfolio.stocks.create(stock_params)\n render json: @stock\n else\n # @user = User.first\n # @portfolio = @user.portfolios.find_by(name: params[:portfolio])\n render json: []\n end\n end", "title": "" }, { "docid": "36112ecb38834c6d94af06e88a7a24b8", "score": "0.6866625", "text": "def create\n @stock = Stock.new(params[:stock])\n\n respond_to do |format|\n if @stock.save\n format.html { redirect_to stocks_url, :notice => 'Stock was successfully created.' }\n format.json { render :json => @stock, :status => :created, :location => @stocks }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @stock.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "04a22a836690322116244718d140303c", "score": "0.68628985", "text": "def create\n @stocker_item = StockerItem.new(stocker_item_params)\n @stocker_item.save\n # @stocker_items = StockerItem.all\n # render json: @stocker_items\n end", "title": "" }, { "docid": "aaf368e822caab0686d48e5aa5bafd7d", "score": "0.6861258", "text": "def create\n @user_stock = create_record\n\n respond_to do |format|\n if @user_stock.save\n ticker = @user_stock.stock.ticker\n\n format.html do\n redirect_to my_portfolio_path,\n notice: \"The stock #{ticker} was successfully added.\"\n end\n format.json { render :show, status: :created, location: @user_stock }\n else\n format.html { render :new }\n format.json do\n render json: @user_stock.errors,\n status: :unprocessable_entity\n end\n end\n end\n end", "title": "" }, { "docid": "7b8286d5f4941c9116fed6c152172490", "score": "0.68429655", "text": "def create\n @stock = current_user.stocks.build(params[:stock])\n\n @stock.save\n @stocks = current_user.stocks\nend", "title": "" }, { "docid": "845441ca2e9772357078c275add1f090", "score": "0.6837338", "text": "def stock_params\n params.require(:stock).permit(:ticker, :user_id)\n end", "title": "" }, { "docid": "db4ba66db585077b3aa87bfa761c2802", "score": "0.68350875", "text": "def create\n # initialize value, delta if not defined\n params[:stock][:value] ||= 0.0\n params[:stock][:delta] ||= 0.0\n\n @stock = Stock.new(stock_params)\n\n # stock_from_db = Stock.where(\"companysymbol = ?\", @stock.companysymbol)\n stock_from_db = @stock.find_in_db\n \n respond_to do |format|\n if is_in_user_stocklist?(@stock)\n format.html { redirect_to :action => \"index\" }\n format.json { render json: @stock, status: :created, location: @stock }\n elsif stock_from_db.any?\n current_user.stocks << stock_from_db unless current_user.admin?\n format.html { redirect_to :action => \"index\" }\n format.json { render json: @stock, status: :created, location: @stock }\n elsif @stock.valid_request? and @stock.save\n current_user.stocks << @stock unless current_user.admin?\n format.html { redirect_to :action => \"index\" }\n format.json { render json: @stock, status: :created, location: @stock }\n else\n format.html { render action: \"new\" }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "137f945171739eb3753b6851f3a9daac", "score": "0.6717351", "text": "def create\r\n params[:stock][:version] = ENV[\"VERSION\"]\r\n params[:stock][:domain] = current_user.domain\r\n params[:stock][:username] = current_user.username\r\n @stock = Stock.new(stock_params)\r\n\r\n respond_to do |format|\r\n if @stock.save\r\n format.html { redirect_to @stock, notice: 'Stock was successfully created.' }\r\n format.json { render json: @stock, status: :created, location: @stock }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @stock.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "title": "" }, { "docid": "8ec291b7a05f5c7c2781d0477dbc2349", "score": "0.6710925", "text": "def set_user_stock\n @user_stock = UserStock.find(params[:id])\n end", "title": "" }, { "docid": "43113367212d32bb6ee1b2c0ebbb8f44", "score": "0.67085797", "text": "def create \n @stock=Stock.create(stock_params)\n render :json=> @stock.as_json(\n )\n end", "title": "" }, { "docid": "57bf8b478df31c71a25d90c42cd77e0f", "score": "0.67078197", "text": "def create\n @stock = Stock.new(stock_params)\n\n respond_to do |format|\n if @stock.save\n format.html { redirect_to [:api, @stock], notice: 'Stock was successfully created.' }\n format.json { render action: 'show', status: :created, location: [:api, @stock] }\n else\n format.html { render action: 'new' }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c763d81084529417528c9e1cc9112896", "score": "0.6705282", "text": "def create\n @sku_stock = SkuStock.new(sku_stock_params)\n\n respond_to do |format|\n if @sku_stock.save\n format.html { redirect_to @sku_stock, notice: 'Sku stock was successfully created.' }\n format.json { render :show, status: :created, location: @sku_stock }\n else\n format.html { render :new }\n format.json { render json: @sku_stock.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "208bf87b8aad8aa10accc43c62b320ff", "score": "0.6694918", "text": "def set_user_stock\n @user_stock = UserStock.find(params[:id])\n end", "title": "" }, { "docid": "d9764005b011f434b1a8ec7115b349f1", "score": "0.66905653", "text": "def sku_stock_params\n params.require(:sku_stock).permit(:SKU, :stock)\n end", "title": "" }, { "docid": "ee62ea139a5610cede88e794ea2fd83d", "score": "0.6685072", "text": "def create\n @stocks = Stocks.new(stocks_params)\n respond_to do |format|\n if @stocks.save\n format.html { redirect_to @stocks, notice: 'Stocks was successfully created.' }\n format.json { render :show, status: :created, location: @stocks }\n else\n format.html { render :new }\n format.json { render json: @stocks.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d5fe645c9b047935108996943d54c4b4", "score": "0.6659676", "text": "def create\n @stock = Stock.new(params[:stock])\n\n respond_to do |format|\n if @stock.save\n format.html { redirect_to @stock, notice: 'Stock was successfully created.' }\n format.json { render json: @stock, status: :created, location: @stock }\n else\n format.html { render action: \"new\" }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d5fe645c9b047935108996943d54c4b4", "score": "0.6659676", "text": "def create\n @stock = Stock.new(params[:stock])\n\n respond_to do |format|\n if @stock.save\n format.html { redirect_to @stock, notice: 'Stock was successfully created.' }\n format.json { render json: @stock, status: :created, location: @stock }\n else\n format.html { render action: \"new\" }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5b7d68a2aeefc00c7a62c7bd8294b7e1", "score": "0.6655723", "text": "def set_user_stock\n\n @user_stock = UserStock.find(params[:id])\n end", "title": "" }, { "docid": "1236ae6c052091743ae914d9fc795746", "score": "0.66478735", "text": "def create\n @stock = Stock.new(stock_params)\n\n respond_to do |format|\n if @stock.save\n format.html { redirect_to @stock, notice: 'Stock was successfully created.' }\n format.json { render :show, status: :created, location: @stock }\n else\n format.html { render :new }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d42ac65902d42542d468c13b937b3acd", "score": "0.66393155", "text": "def create\n @uniform_stock = UniformStock.new(uniform_stock_params)\n\n respond_to do |format|\n if @uniform_stock.save\n format.html { redirect_to @uniform_stock, notice: (t 'uniform_stocks.stock_id')+(t 'actions.created') }\n format.json { render action: 'show', status: :created, location: @uniform_stock }\n else\n format.html { render action: 'new' }\n format.json { render json: @uniform_stock.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a2e73b201ac4f84839ad35bdb7f0c51f", "score": "0.66200763", "text": "def create\n @stock = Stock.new(stock_params)\n\n respond_to do |format|\n if @stock.save\n format.html { redirect_to @stock, notice: 'Stock was successfully created.' }\n format.json { render :show, status: :created, location: @stock }\n else\n format.html { render :new }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a2e73b201ac4f84839ad35bdb7f0c51f", "score": "0.66200763", "text": "def create\n @stock = Stock.new(stock_params)\n\n respond_to do |format|\n if @stock.save\n format.html { redirect_to @stock, notice: 'Stock was successfully created.' }\n format.json { render :show, status: :created, location: @stock }\n else\n format.html { render :new }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a2e73b201ac4f84839ad35bdb7f0c51f", "score": "0.66200763", "text": "def create\n @stock = Stock.new(stock_params)\n\n respond_to do |format|\n if @stock.save\n format.html { redirect_to @stock, notice: 'Stock was successfully created.' }\n format.json { render :show, status: :created, location: @stock }\n else\n format.html { render :new }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a2e73b201ac4f84839ad35bdb7f0c51f", "score": "0.66200763", "text": "def create\n @stock = Stock.new(stock_params)\n\n respond_to do |format|\n if @stock.save\n format.html { redirect_to @stock, notice: 'Stock was successfully created.' }\n format.json { render :show, status: :created, location: @stock }\n else\n format.html { render :new }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a2e73b201ac4f84839ad35bdb7f0c51f", "score": "0.66200763", "text": "def create\n @stock = Stock.new(stock_params)\n\n respond_to do |format|\n if @stock.save\n format.html { redirect_to @stock, notice: 'Stock was successfully created.' }\n format.json { render :show, status: :created, location: @stock }\n else\n format.html { render :new }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a2e73b201ac4f84839ad35bdb7f0c51f", "score": "0.66200763", "text": "def create\n @stock = Stock.new(stock_params)\n\n respond_to do |format|\n if @stock.save\n format.html { redirect_to @stock, notice: 'Stock was successfully created.' }\n format.json { render :show, status: :created, location: @stock }\n else\n format.html { render :new }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a2e73b201ac4f84839ad35bdb7f0c51f", "score": "0.66200763", "text": "def create\n @stock = Stock.new(stock_params)\n\n respond_to do |format|\n if @stock.save\n format.html { redirect_to @stock, notice: 'Stock was successfully created.' }\n format.json { render :show, status: :created, location: @stock }\n else\n format.html { render :new }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a2e73b201ac4f84839ad35bdb7f0c51f", "score": "0.66200763", "text": "def create\n @stock = Stock.new(stock_params)\n\n respond_to do |format|\n if @stock.save\n format.html { redirect_to @stock, notice: 'Stock was successfully created.' }\n format.json { render :show, status: :created, location: @stock }\n else\n format.html { render :new }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a2e73b201ac4f84839ad35bdb7f0c51f", "score": "0.66200763", "text": "def create\n @stock = Stock.new(stock_params)\n\n respond_to do |format|\n if @stock.save\n format.html { redirect_to @stock, notice: 'Stock was successfully created.' }\n format.json { render :show, status: :created, location: @stock }\n else\n format.html { render :new }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a2e73b201ac4f84839ad35bdb7f0c51f", "score": "0.66200763", "text": "def create\n @stock = Stock.new(stock_params)\n\n respond_to do |format|\n if @stock.save\n format.html { redirect_to @stock, notice: 'Stock was successfully created.' }\n format.json { render :show, status: :created, location: @stock }\n else\n format.html { render :new }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c9a0785a6066766d9c01185846028d6d", "score": "0.6618598", "text": "def create\n @stock = Stock.new(stock_params)\n render json: @stock.errors unless @stock.save\n end", "title": "" }, { "docid": "06b7affc07992c5b6af24b4bc1c9feda", "score": "0.66113925", "text": "def create\n stock = Stock.find_or_create_by(ticker: params[:ticker])\n @favorite = UserStock.new(\n stock_id: stock.id,\n user_id: current_user.id,\n )\n if @favorite.save\n render json: @favorite.stock.ticker + \"added to list\"\n else\n render json: { errors: @favorite.errors.full_messages }, status: :bad_request\n end\n end", "title": "" }, { "docid": "13261d800424fb3cd3f38b877dfdfaa6", "score": "0.66093177", "text": "def set_stocks\n get_luxire_stock\n @luxire_stock.virtual_count_on_hands = params[:luxire_stock][:count]\n @luxire_stock.physical_count_on_hands = params[:luxire_stock][:count]\n @luxire_stock.save\n render json: @luxire_stock, status: '200'\n end", "title": "" }, { "docid": "395469c5202ff27a37efb0422a3fa1aa", "score": "0.6586171", "text": "def create\r\n @stock = Stock.new(params[:stock])\r\n\r\n respond_to do |format|\r\n if @stock.save\r\n format.html { redirect_to @stock, notice: 'Stock was successfully created.' }\r\n format.json { render json: @stock, status: :created, location: @stock }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @stock.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "title": "" }, { "docid": "189c89b2d5288db59f13c8e5509a3438", "score": "0.65598327", "text": "def index\n @user_stocks = UserStock.all\n end", "title": "" }, { "docid": "189c89b2d5288db59f13c8e5509a3438", "score": "0.65598327", "text": "def index\n @user_stocks = UserStock.all\n end", "title": "" }, { "docid": "189c89b2d5288db59f13c8e5509a3438", "score": "0.65598327", "text": "def index\n @user_stocks = UserStock.all\n end", "title": "" }, { "docid": "58902f4abb04010e5c58931b4f77294a", "score": "0.6550583", "text": "def create\n\t\t@stock = Stock.new(stock_params)\n\t\t@stock.user = current_user\n\t\tif !@stock.quantity.nil?\n\t\t\t@stock.remaining = @stock.quantity * @stock.food.total # Get the total number of servings\n\t\tend\n\n\t\trespond_to do |format|\n\t\t if @stock.save\n\t\t format.html { redirect_to @stock, notice: 'Stock was successfully created.' }\n\t\t format.json { render action: 'show', status: :created, location: @stock }\n\t\t else\n\t\t format.html { render action: 'new' }\n\t\t format.json { render json: @stock.errors, status: :unprocessable_entity }\n\t\t end\n\t\tend\n\tend", "title": "" }, { "docid": "c4d51e3de9221cc96ffec7324d21ea21", "score": "0.6549243", "text": "def list_user_stocks(user_id, params = nil, headers = nil)\n get(\"/api/v2/users/#{user_id}/stocks\", params, headers)\n end", "title": "" }, { "docid": "b66ff2a4e838879e35717b74b296bf7a", "score": "0.6535345", "text": "def add_stocks\n get_luxire_stock\n\n @luxire_stock.virtual_count_on_hands += params[:luxire_stock][:count].to_i\n @luxire_stock.physical_count_on_hands += params[:luxire_stock][:count].to_i\n @luxire_stock.save\n render json: @luxire_stock, status: '200'\n end", "title": "" }, { "docid": "fceef3e54f54c1646c9b2fac2aec6f9c", "score": "0.6529245", "text": "def create\n @stock = Stock.new(stock_params)\n\n respond_to do |format|\n if @stock.save\n format.html { redirect_to @stock, notice: 'Stock was successfully created.' }\n format.json { render action: 'show', status: :created, location: @stock }\n else\n format.html { render action: 'new' }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fceef3e54f54c1646c9b2fac2aec6f9c", "score": "0.6529245", "text": "def create\n @stock = Stock.new(stock_params)\n\n respond_to do |format|\n if @stock.save\n format.html { redirect_to @stock, notice: 'Stock was successfully created.' }\n format.json { render action: 'show', status: :created, location: @stock }\n else\n format.html { render action: 'new' }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fceef3e54f54c1646c9b2fac2aec6f9c", "score": "0.6529245", "text": "def create\n @stock = Stock.new(stock_params)\n\n respond_to do |format|\n if @stock.save\n format.html { redirect_to @stock, notice: 'Stock was successfully created.' }\n format.json { render action: 'show', status: :created, location: @stock }\n else\n format.html { render action: 'new' }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b5054eaef830962828fd84cc107ec9f2", "score": "0.65157473", "text": "def create\n @stock = Stock.new(params[:stock])\n\n respond_to do |format|\n if @stock.save\n Quote.grab_data(@stock.symbol)\n format.html { redirect_to @stock, notice: 'Stock was successfully created.' }\n format.json { render json: @stock, status: :created, location: @stock }\n else\n format.html { render action: \"new\" }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f9340027b50082bd0041fc4925b95c2f", "score": "0.64729905", "text": "def create\n @in_stock = InStock.new(params[:in_stock])\n\n respond_to do |format|\n if @in_stock.save\n format.html { redirect_to @in_stock, notice: 'In stock was successfully created.' }\n format.json { render json: @in_stock, status: :created, location: @in_stock }\n else\n format.html { render action: \"new\" }\n format.json { render json: @in_stock.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6bbb140d4933ef691350080a2d73c34d", "score": "0.6466545", "text": "def create\n @stock = Stock.new(stock_params)\n\n respond_to do |format|\n if @stock.save\n format.html { redirect_to dashboard_symbols_path , notice: 'Stock was successfully created.' }\n format.json { render :show, status: :created, location: @stock }\n else\n format.html { render :new }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2bc92689115c44f5033c812989c59781", "score": "0.64302915", "text": "def submitStock\n inventory_data = Inventory.last\n \n onstock = OnStock.create(category_id: params[:category_id], inventory_id: inventory_data.id, product_name: params[:product_name], product_type: params[:product_type], product_details: params[:product_details], quantity: params[:quantity], price: params[:price])\n onstock.save\n\n stock_last = OnStock.last\n\n inventoryStock = InventoryStock.create(inventory_id: inventory_data.id, on_stock_id: stock_last.id)\n\n logs = Log.create(user_id: current_user.id, action: \"added an item to Inventory(Stocks).\")\n\n if inventoryStock.save && logs.save\n render :json => { :status => :ok, :message => \"Success\" }\n else\n render :json => { :status => :error, :message => \"Error!\" }\n end\n \n end", "title": "" }, { "docid": "7b7697b6342be53c34b386fe997b710d", "score": "0.64060706", "text": "def create\n @stock_dividend = current_user.stock_dividends.build(stock_dividend_params)\n\n respond_to do |format|\n if @stock_dividend.save\n format.html { redirect_to @stock_dividend, notice: 'Stock dividend was successfully created.' }\n format.json { render :show, status: :created, location: @stock_dividend }\n else\n format.html { render :new }\n format.json { render json: @stock_dividend.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "edecc9b12275f13bbc6f1dc17b2b4215", "score": "0.64040464", "text": "def stock_params\n params.require(:stock).permit(:ticker, :user_id, :shares, :sname, :name, :start_date, :end_date)\n end", "title": "" }, { "docid": "741331312f0861e8fbc210b1aa2bdcb2", "score": "0.63967824", "text": "def create\n @various_stock = VariousStock.new(various_stock_params)\n\n respond_to do |format|\n if @various_stock.save\n format.html { redirect_to @various_stock, notice: 'Various stock was successfully created.' }\n format.json { render :show, status: :created, location: @various_stock }\n else\n format.html { render :new }\n format.json { render json: @various_stock.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7f2be03c85f5ec682aa0b3c17a37d6ad", "score": "0.63885", "text": "def stock_params\n params.require(:stock).permit(:user_id, :item_id, :unit, :num, :photo, :remarks)\n end", "title": "" }, { "docid": "1bfbdda2c5131b7ccd750f7ad4385203", "score": "0.6369823", "text": "def post_buy_stocks_params\n params[:mystock][:stock_price_bough] = params[:mystock][:stock_price_bough].to_f * 100\n params[:mystock][:stock_count_bought] = params[:mystock][:stock_count_bought].to_f\n params[:mystock][:user_id] = current_user.id\n params.require(:mystock).permit(:stock_count_bought, :stock_price_bough, :stock_name_bought, :user_id)\n end", "title": "" }, { "docid": "62bcd3cffa531e7c58731d8bbbdd0568", "score": "0.6352432", "text": "def create\n \n #the method new_from_lookup, find_by_ticker are all in the model file stock.rb\n \n #if the stock id is present and not an empty string\n if params[:stock_id].present?\n #uses the stock id and asscoiates it with the current user\n @user_stock = UserStock.new(stock_id: params[:stock_id], user: current_user)\n #if the stock id is not present \n else\n #finds the stock is by its ticker (GOOG, twtr)\n stock = Stock.find_by_ticker(params[:stock_ticker])\n #differentitate which method to use to assign the stock to a user \n #if the stock ticker it finds is valid\n if stock\n @user_stock = UserStock.new(user: current_user, stock: stock)\n #the stock did not return a valid ticker\n else\n stock = Stock.new_from_lookup(params[:stock_ticker])\n \n \n #if this stock is valid and were able to save it to the stocks database, we create a new asssociation between the stock and the user\n if stock.save\n @user_stock = UserStock.new(user: current_user, stock: stock)\n #else there is an error and the association could not be made because the stock could not be found\n else\n @user_stock = nil\n flash[:error] = \"stock is not available\"\n end\n end\n end\n \n \n \n \n \n\n respond_to do |format|\n if @user_stock.save\n format.html { redirect_to my_portfolio_path,\n notice: \"Stock #{@user_stock.stock.ticker} was succesffuly added\" }\n format.json { render :show, status: :created, location: @user_stock }\n else\n format.html { render :new }\n format.json { render json: @user_stock.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8da30fd13254fc04616602619075e274", "score": "0.63501304", "text": "def create\n @stockin = Stockin.new(stockin_params)\n\n respond_to do |format|\n if @stockin.save\n format.html { redirect_to @stockin, notice: 'Stockin was successfully created.' }\n format.json { render :show, status: :created, location: @stockin }\n else\n format.html { render :new }\n format.json { render json: @stockin.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "07c84c53a3390192201390d43f3bae45", "score": "0.6346573", "text": "def create\n if current_user\n if current_user.role.en == \"nyabo\"\n @stock = Stock.new(stock_params)\n respond_to do |format|\n @stock.nyabo_id = current_user.id\n if @stock.save\n format.html { redirect_to @stock, notice: 'Шинэ тооллог амжилттай бүртгэгдлээ.' }\n format.json { render :show, status: :created, location: @stock }\n else\n format.html { render :new }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to authenticated_root_path, flash: {alert: t('message.not_found')}\n end\n else\n redirect_to unauthenticated_root_path, flash: {alert: t('message.not_found')}\n end\n end", "title": "" }, { "docid": "8f8345d34aafa0d52c1785202b9747e1", "score": "0.63441765", "text": "def create\n @breadcrumb = 'update'\n @product = $product\n @store = $store\n @stock = Stock.new(params[:stock])\n @stock.created_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @stock.save\n format.html { redirect_to @stock, notice: crud_notice('created', @stock) }\n format.json { render json: @stock, status: :created, location: @stock }\n else\n format.html { render action: \"new\" }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4784e5ee3da06979423bc4e40f20185c", "score": "0.6333622", "text": "def create\n @stock = Stock.new(stock_params)\n\n respond_to do |format|\n if not session[:tipo_usuario] == 1\n format.html { redirect_to stocks_path, notice: 'Sin permisos, solo el administrador puede crear almacenes' }\n elsif @stock.save\n format.html { redirect_to @stock, notice: 'Stock was successfully created.' }\n format.json { render :show, status: :created, location: @stock }\n else\n obtener_sucursales\n format.html { render :new }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "77c46fc176a98ea96a4c57a3ff9d56ff", "score": "0.63279325", "text": "def create\n @available_stock = AvailableStock.new(available_stock_params)\n\n respond_to do |format|\n if @available_stock.save\n format.html { redirect_to @available_stock, notice: 'Available stock was successfully created.' }\n format.json { render :show, status: :created, location: @available_stock }\n else\n format.html { render :new }\n format.json { render json: @available_stock.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ba6d7581c5fce53922a6ff0701e67ebb", "score": "0.632785", "text": "def index\n @users = User.all\n render json: @users, include: {stocks: {include: :purchases}}, status: :ok\n end", "title": "" }, { "docid": "7ad4c260bd5777be988278eec5a1b6c0", "score": "0.6302017", "text": "def stock_list_params\n params.require(:stock_list).permit(:name, :user_id)\n end", "title": "" }, { "docid": "33658047a9dff3326acde84e87941414", "score": "0.62938887", "text": "def create\n @stock_item = StockItem.new(params[:stock_item])\n\n respond_to do |format|\n if @stock_item.save\n format.html { redirect_to @stock_item, notice: 'Stock item was successfully created.' }\n format.json { render json: @stock_item, status: :created, location: @stock_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @stock_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7233597384a4600bfa628b868e3f0298", "score": "0.6293601", "text": "def create\n if member_signed_in? \n @stock = Stock.new(stock_params)\n\n respond_to do |format|\n if @stock.save\n format.html { redirect_to @stock, notice: 'Stock was successfully created.' }\n format.json { render action: 'show', status: :created, location: @stock }\n else\n format.html { render action: 'new' }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end \n else\n redirect_to new_member_session_path\n end \n end", "title": "" }, { "docid": "b27a117b258dc229ce05563a6c0c83c8", "score": "0.6290588", "text": "def create\n\n # ログインしているときの動き\n if user_signed_in? then\n @stock = Stock.new(stock_params)\n @stock.user_id = current_user.id\n respond_to do |format|\n if @stock.save\n format.html { redirect_to stocks_url, notice: '在庫を登録しました' }\n format.json { render :show, status: :created, location: @stock }\n else\n format.html { render :new }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n # 非ログイン時の動き\n else\n @project = Project.find_by(:key => params[:project_key])\n @stock = @project.stocks.build(stock_params)\n @stock.user_id = params[:project_key]\n respond_to do |format|\n if @stock.save\n format.html { redirect_to project_stocks_url, notice: '在庫を登録しました' }\n format.json { render :show, status: :created, location: @stock }\n else\n format.html { render :new }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "title": "" }, { "docid": "9ac14fe56245fd6f8d29b222dd04d9c9", "score": "0.6277592", "text": "def index\n @stocks = current_user.stocks\n end", "title": "" }, { "docid": "baeac4164c8da2687d79aef926a538d7", "score": "0.6272986", "text": "def create\n @i_stock = IStock.new(params[:i_stock])\n\n respond_to do |format|\n if @i_stock.save\n format.html { redirect_to @i_stock, :notice => 'I stock was successfully created.' }\n format.json { render :json => @i_stock, :status => :created, :location => @i_stock }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @i_stock.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ab9bf17f2c158d6efa80c38f324c3b31", "score": "0.6264982", "text": "def create\n @stockist = Stockist.new(stockist_params)\n\n respond_to do |format|\n if @stockist.save\n format.html { redirect_to @stockist, notice: 'Stockist was successfully created.' }\n format.json { render :show, status: :created, location: @stockist }\n else\n format.html { render :new }\n format.json { render json: @stockist.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "80fd391ac7a86cb71425d2343c96fc7f", "score": "0.6250845", "text": "def create\n @stock_position = current_user.stock_positions.create(stock_position_params)\n\n respond_to do |format|\n if @stock_position.save\n format.html { redirect_to current_user, notice: 'Stock position was successfully created.' }\n format.json { render :show, status: :created, location: @stock_position }\n else\n format.html { render :new }\n format.json { render json: @stock_position.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4e636e7683c12ae1e1544e4581b6f3f3", "score": "0.62304956", "text": "def create\n favourite = Favourites.create(stockSymbol: params[:stockSymbol], stockName: params[:stockName])\n favourite_valid = favourite.valid?\n if favourite_valid\n render json: { message: \"Successfully added a new favourite!\" }, status: 200\n else\n render json: { message: \"Unable to add a new favourite!\" }, status: 400\n end\n end", "title": "" }, { "docid": "d0390d272c666bbb1deb8691bf4f2810", "score": "0.6229265", "text": "def create\n if params[:commit].present?\n identifier = params['add'].values.first.upcase\n @stock = Stock.fetch(identifier).first\n UserStock.create!(user: current_user, stock: @stock)\n flash.now.notice = 'Stock added'\n render :index\n end\n end", "title": "" }, { "docid": "6cac42314c30cb975ecff6017a38a452", "score": "0.62229127", "text": "def create\n @stock = Stock.new(stock_params)\n\n respond_to do |format|\n if @stock.save\n create_action_html_format(format)\n create_action_json_format(format)\n else\n render_action_or_error(format, 'new')\n end\n end\n end", "title": "" }, { "docid": "324916f9e1a0bf512fd84fd88b3c33fc", "score": "0.6218751", "text": "def index\n @stocks = Stock.all\n\n render json: @stocks\n end", "title": "" }, { "docid": "0d61e2b48a7d92bab2a400996fa6156a", "score": "0.6218506", "text": "def get\n user = authenticate(params[:id], request.headers[\"HTTP_AUTH_TOKEN\"])\n if user\n stocks = consolidateStocks(user[:id])\n render json: { success: true, stocks: stocks}\n else\n render json: { success: false }\n end\n\n end", "title": "" }, { "docid": "dfd4314963781c09a7e7b8499ab6f78a", "score": "0.6214197", "text": "def stock_params\r\n params.require(:stock).permit(:domain, :id, :in_quantity, :out_quantity, :stock, :username, :version)\r\n end", "title": "" }, { "docid": "cc1ae32409e95b727a8b8e3dfd2dbec8", "score": "0.62073195", "text": "def create\n @id = current_user.home.id\n @stock = Stock.new(stock_params)\n @stock.home_id = @id\n\n respond_to do |format|\n if @stock.save\n format.html { redirect_to :back }\n format.json { render json: { status: \"OK\", data: nil, message: nil } }\n else\n format.html { redirect_to 'new' }\n format.json { render json: { status: \"KO\", data: nil, message: @stock.errors.message }, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e3c1ea2229e9d07659646e90a62ea22e", "score": "0.61946064", "text": "def show\n\n @user = User.find(params[:id])\n @user_stocks = @user.stocks\n\n end", "title": "" }, { "docid": "fe2f22f3e023d6f8729c97d8aa2101af", "score": "0.6194326", "text": "def show\n @user_stock = UserStock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_stock }\n end\n end", "title": "" }, { "docid": "18c685e56abb09eee0bdd2b550f90e21", "score": "0.61918074", "text": "def stock_params\n params.require(:stock).permit!\n end", "title": "" }, { "docid": "60d432534a67393b61b27f9cdabdd4b3", "score": "0.61825866", "text": "def create\n \n params[:feedstock].each do |f|\n if (f[:feedstock_id] && f[:quantity] != \"\")\n feedstock = FeedstockByProduct.new\n feedstock.product_id = params[:product_id]\n feedstock.feedstock_id = f[:feedstock_id]\n feedstock.quantity = f[:quantity]\n feedstock.save\n end\n end\n\n @feedstock_by_product = FeedstockByProduct.new(params[:feedstock_by_product])\n\n respond_to do |format|\n format.html { redirect_to product_feedstock_by_products_path(params[:product_id]) }\n #format.json { render json: @feedstock_by_product, status: :created, location: @feedstock_by_product } \n end\n end", "title": "" }, { "docid": "6400ddebb16309d2a0f631b9cd5c4fc8", "score": "0.61710066", "text": "def stock_params\n params.require(:stock).permit(:id, :name, :symbol)\n end", "title": "" }, { "docid": "f6eedf40826ac4ab0b6342aca8238176", "score": "0.61681557", "text": "def create\n respond_to do |format|\n if @stock.save\n @stock_log = StockLog.create(user: current_user, stock: @stock, operation: 'create_stock', status: 'checked', operation_type: 'in', amount: @stock.actual_amount, checked_at: Time.now)\n format.html { redirect_to @stock, notice: I18n.t('controller.create_success_notice', model: '库存') }\n format.json { render action: 'show', status: :created, location: @stock }\n else\n format.html { render action: 'new' }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4dbcec89508d4e70c3fabc719003cab8", "score": "0.61657095", "text": "def create\n @customer_stock = CustomerStock.new(params[:customer_stock])\n\n respond_to do |format|\n if @customer_stock.save\n format.html { redirect_to @customer_stock, notice: 'Customer stock was successfully created.' }\n format.json { render json: @customer_stock, status: :created, location: @customer_stock }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer_stock.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8a42943ecaf617eeb0e0751c2c352f0d", "score": "0.6138058", "text": "def create\n @inventories_stock = InventoriesStock.new(inventories_stock_params)\n\n respond_to do |format|\n if @inventories_stock.save\n format.html { redirect_to @inventories_stock, notice: 'Inventories stock was successfully created.' }\n format.json { render :show, status: :created, location: @inventories_stock }\n else\n format.html { render :new }\n format.json { render json: @inventories_stock.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5691cc922645f114d35f3ff80f50feb1", "score": "0.61346805", "text": "def create\n @stocker = Stocker.new(stocker_params)\n\n respond_to do |format|\n if @stocker.save\n format.html { redirect_to @stocker, notice: 'Stocker was successfully created.' }\n format.json { render :show, status: :created, location: @stocker }\n else\n format.html { render :new }\n format.json { render json: @stocker.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4ce648e7ad62acbdd31d0d6ad259e5a7", "score": "0.61305934", "text": "def create\n @invoice_stock = InvoiceStock.new(invoice_stock_params)\n #@quantity = Stock.update_quantity(invoice_stock_params[:stocks_attributes])\n respond_to do |format|\n if @invoice_stock.save\n format.html { redirect_to invoice_stocks_path, notice: 'Invoice stock was successfully created.' }\n format.json { render :show, status: :created, location: @invoice_stock }\n else\n format.html { render :new }\n format.json { render json: @invoice_stock.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e5a50e4aaf1fc4717b97f7f3bbe40e3b", "score": "0.6130269", "text": "def stock_params\n params.require(:stock).permit(:name)\n end", "title": "" }, { "docid": "e5a50e4aaf1fc4717b97f7f3bbe40e3b", "score": "0.6130269", "text": "def stock_params\n params.require(:stock).permit(:name)\n end", "title": "" } ]
423659dcdc25f77adf2afe705c60b560
Initialize a command from arguments. Returns an instance of Command.
[ { "docid": "23d13d7612f5f220cd0cb5c7f06b656b", "score": "0.0", "text": "def action_command\n Command.new(serverside_command_path, @serverside_version, *task) do |cmd|\n given_applicable_options = given_options & applicable_options\n given_applicable_options.each do |option|\n cmd.argument(option.type, option.to_switch, @arguments[option.name])\n end\n end\n end", "title": "" } ]
[ { "docid": "f290606fcde90decf87b1c8629960095", "score": "0.7660639", "text": "def initialize(*args)\n raise ArgumentError, \"Must pass arguments to Command.new\" if args.empty?\n @options = default_options.merge(args.extract_options!)\n @command = sanitize_command(args.shift)\n @args = args\n @options.symbolize_keys!\n @stdout, @stderr, @full_stdout, @full_stderr = String.new, String.new, String.new, String.new\n @uuid = Digest::SHA1.hexdigest(SecureRandom.random_bytes(10))[0..7]\n end", "title": "" }, { "docid": "a60f5f097b2030e68b965edf5ce01146", "score": "0.72021437", "text": "def initialize(*args)\n fail ArgumentError, \"no command given\" if args.empty?\n @command = args\n @ran = false\n end", "title": "" }, { "docid": "f6bb864cefa2b33050819c184c1bdf94", "score": "0.7192093", "text": "def initialize(**args)\n super(command: self.class.command.new(args), executed: [])\n end", "title": "" }, { "docid": "158ca5b949a81cc23ccdfbaa8f2ef7be", "score": "0.7158902", "text": "def initialize(parsed_arguments)\n @command = parsed_arguments[:command]\n @options = parsed_arguments[:options]\n @arguments = parsed_arguments[:arguments]\n end", "title": "" }, { "docid": "af13ee2ed05762ccaa6c77e19cee84be", "score": "0.71353155", "text": "def initialize(cmd, args=[], env={})\n @command, @arguments, @environment = cmd, Array(args), env\n @stdout, @stderr = \"\", \"\"\n end", "title": "" }, { "docid": "8d1b8b0213d76397aa6043c0b2104848", "score": "0.70542103", "text": "def initialize(command)\n @command = command\n end", "title": "" }, { "docid": "a59ef1fc649ef7752e754e49fbf42bee", "score": "0.69859976", "text": "def initialize(*args)\n return self if args.empty?\n parsed_args = args.first.is_a?(Hash) ? args.first : parse_string_args(args)\n\n self.executable = parsed_args[:executable]\n self.arguments = parsed_args[:arguments]\n end", "title": "" }, { "docid": "a40bdfc426a71e134f38e794b46007cb", "score": "0.6893844", "text": "def initialize_command(message)\n message = Message.new(params)\n @command = begin\n \"#{message.command.capitalize}Command\".constantize.new(message)\n rescue\n HelpCommand.new(message)\n end\n end", "title": "" }, { "docid": "d5f2aff023a762ff9eedc8b632356537", "score": "0.687505", "text": "def initialize command, parameters = nil\n @command = command\n @parameters = parameters\n end", "title": "" }, { "docid": "043ce89db5065303193bc62cf5ec54e8", "score": "0.6861217", "text": "def initialize(name, command)\r\n super(name)\r\n @command = command\r\n end", "title": "" }, { "docid": "954fbb2d80a1bcf11b7121fe2a78d445", "score": "0.68093586", "text": "def initialize command\n @command = command\n end", "title": "" }, { "docid": "f465221847001302cfc97839612aaff1", "score": "0.676689", "text": "def initialize(parser, input_cmd, input_cmd_args, opts = { } )\n # TODO parser now holds a builder, lets rename this\n @parser = parser\n @opts = opts\n @cmd_name = input_cmd\n @cmd = lookup_command(input_cmd, input_cmd_args)\n end", "title": "" }, { "docid": "9320aec6ff1a5f417531388eff04359d", "score": "0.6750841", "text": "def initialize(command, env:, verbose:, named_args: nil, ignore_failures: false, repository: nil)\n @named_args = [named_args].flatten.compact.map(&:to_s)\n @command = command + @named_args\n @env = env\n @verbose = verbose\n @ignore_failures = ignore_failures\n @repository = repository\n\n @name = command[1]&.delete(\"-\")\n @status = :running\n @output = nil\n end", "title": "" }, { "docid": "f43f79e4c8a47bcb6f383429c3b8d0e8", "score": "0.6680195", "text": "def initialize tag, cmd, *args\n @tag = tag\n @cmd = cmd\n @args = args\n end", "title": "" }, { "docid": "98b793863a65c1819df15e01be17d100", "score": "0.66555434", "text": "def command(*a)\n command = Command.new(*a)\n command.node = self\n command\n end", "title": "" }, { "docid": "38e51060cd3e781b8b858b825f249ce0", "score": "0.65645283", "text": "def run( args )\n args = args.dup\n\n parse args\n init args\n self.__send__(*@command)\n end", "title": "" }, { "docid": "67faa5307a57dcd4fd0945ba32871c0f", "score": "0.6500099", "text": "def create_command(text)\n self.class.concrete_command.new(self, text)\n end", "title": "" }, { "docid": "1b1e3b6cba81013d09639cd0db287040", "score": "0.6499487", "text": "def initialize\n parse_options\n command = ARGV.shift\n subcommand = ARGV.shift\n case command\n when 'console' then run_console\n when 'server' then run_server(subcommand)\n when 'node' then run_node(subcommand)\n when 'load_schema' then run_load_schema\n when 'install' then run_install(subcommand)\n when 'cleanup' then run_cleanup\n else usage\n end\n end", "title": "" }, { "docid": "e77600da3118dc5906df88c447815921", "score": "0.64976436", "text": "def new *args\n require 'zsteg/cli/cli'\n Cli.new(*args)\n end", "title": "" }, { "docid": "eb6a551e90afcc4d379d48c4acdf552e", "score": "0.6484345", "text": "def command_object\n @command_object ||= GitPusshuTen::Command.new(cli, configuration, hooks, environment)\n end", "title": "" }, { "docid": "bd877f99c9959d12f51a59f967ac7c45", "score": "0.6457939", "text": "def cmd(command, *arguments) Command.send(command.to_sym, *arguments) end", "title": "" }, { "docid": "6cb2be37be469971ddafbd7e42d8308e", "score": "0.6455821", "text": "def initialize(cmd, *args)\n @cmd = cmd\n @args = *args\n @process_status = nil\n @executed = false\n end", "title": "" }, { "docid": "7280ae02bd63d20239fe13a1c65abe1d", "score": "0.63887346", "text": "def initialize command_string\n @cmds = parse_command_string( command_string.to_s )\n end", "title": "" }, { "docid": "d1db3c0806431d6233275ba9561fbf5d", "score": "0.6372451", "text": "def parse\n # Parse all arguments first\n option_parser.parse!(arguments)\n\n # Get the first argument, this is our command\n cmd = arguments.pop\n raise OptionParser::MissingArgument, 'command' unless cmd\n\n # Set the command if it's present\n options.command = cmd.to_sym\n end", "title": "" }, { "docid": "2dfccfc80c5d2edbf019473dd9ed9823", "score": "0.6364469", "text": "def initialize(args = [])\n @args = args\n command = args.shift\n if command && self.respond_to?(command)\n unless command == 'help'\n @user, @repo = repo_info\n return unless @user && @repo && configure_github_access\n update unless command == 'clean'\n end\n self.send command\n else\n unless command.nil? || command.empty? || %w(-h --help).include?(command)\n puts \"git-review: '#{command}' is not a valid command.\\n\\n\"\n end\n help\n end\n rescue UnprocessableState\n puts 'Execution of git-review command stopped.'\n end", "title": "" }, { "docid": "6745ba3c2dcf3bd4d8bbde8904a311c8", "score": "0.6346762", "text": "def create_command command_text\r\n DatabaseCommand.new self, command_text\r\n end", "title": "" }, { "docid": "0bc0bcc41cf668f3a8fdf78d164bf131", "score": "0.63219845", "text": "def command(*args,&block)\n return @working_command if @working_command\n name, options = _parse_name_and_options(args,self.name)\n @working_command = cmd = Command.new({:plugin=>self,:name=>name}.merge(options))\n yield(cmd) if block\n bot.add_command(cmd)\n @working_command=nil \n @commands << cmd\n cmd\n end", "title": "" }, { "docid": "59fedf7f394a72447ddf69931f1fcdb3", "score": "0.6290001", "text": "def initialize options={}, path=nil\n self.parse = options.delete(\"parse\")\n self.tee = options.delete(\"tee\")\n options = parse_command_option(options) if options.has_key?(\"command\")\n\n validate_options(options)\n set_command_from_path(path) unless @command\n\n @options = params.merge(options)\n end", "title": "" }, { "docid": "b1fe790cd903d4d7593c628ce64ced4e", "score": "0.6251619", "text": "def initialize(*command_path) \n @command = command_path.collect { |part| \"#{part}\".gsub('_', '-') }.join('/')\n @command = \"/#{@command}\" unless @command.start_with?('/')\n @options = {}\n @replies = []\n end", "title": "" }, { "docid": "e4e90d1ddc3ad078a0d9372f1602614b", "score": "0.6250817", "text": "def initialize(command, options = {})\n @command = self.class.camelize(command.to_s)\n @uri = options.delete(:uri) || self.uri\n @uri = URI.parse(@uri) unless @uri.is_a? URI\n @auth_token = (options.delete(:auth_token) || self.auth_token).to_s\n @site_id = (options.delete(:site_id) || self.site_id).to_s\n @compatability_level = (options.delete(:compatability_level) || self.compatability_level).to_s\n @http_timeout = (options.delete(:http_timeout) || 60).to_i\n # Remaining options are converted and used as input to the call\n @input = options.delete(:input) || options\n end", "title": "" }, { "docid": "a92f05ffa327dea8e7b88fdd34188512", "score": "0.62428427", "text": "def cmd(*args) self.class.cmd(*args) end", "title": "" }, { "docid": "f69d1293f1c95201abdcef1763e335b1", "score": "0.6227013", "text": "def initialize(argv)\n @options = {\n :command => 'execute',\n :rpcname => nil,\n :verbose => false\n }\n @argv = argv.clone\n if @argv.first =~ /^[a-z0-9][a-z0-9_-]*$/i\n self.options[:command] = @argv.shift\n end\n if @argv.first =~ /^[a-z0-9_-]+\\.[a-z0-9_\\.-]+$/i\n self.options[:rpcname] = @argv.shift\n end\n end", "title": "" }, { "docid": "5d7e0ac2e5eaf42589ada552288b68a6", "score": "0.621354", "text": "def initialize(*commands)\n @options = (commands.last.is_a?(Hash) && commands.pop) || {}\n @commands = commands\n end", "title": "" }, { "docid": "18dd1c056c93609fa0aa1f22efaf5dca", "score": "0.61590856", "text": "def command\n @command ||= Class.new.send(:include, Command)\n end", "title": "" }, { "docid": "696e617e6542860c3ba479625dc8b933", "score": "0.61587006", "text": "def initialize(name)\n super \"Unknown command: #{name}\"\n @command = name\n end", "title": "" }, { "docid": "5e6c4bb875af244ec39ce84cf77c1717", "score": "0.6153678", "text": "def create_commands args\n command = String.new\n args.each do |arg|\n command << arg << \" \" \n end\n command\n end", "title": "" }, { "docid": "df96679ac54af6757561346725c51c87", "score": "0.6152405", "text": "def initialize(options = {:dry_run => false})\n @commands = Array.new\n @dry_run = options[:dry_run]\n end", "title": "" }, { "docid": "f6b66eb4101f835ef0212a7dd50d090a", "score": "0.6148727", "text": "def initialize(items = nil, **opt)\n command = opt.delete(:command)\n items, command = [nil, items] if items.is_a?(Symbol)\n opt[:command] = command&.to_sym || DEFAULT_COMMAND\n # noinspection RubyMismatchedArgumentType\n super(items, **opt)\n end", "title": "" }, { "docid": "9b78b2af2b0863c82462eba58c14c3b6", "score": "0.6147567", "text": "def call(*args)\n if args.first.is_a?(Array) && args.size == 1\n command = args.first\n else\n command = args\n end\n\n @commands << command\n nil\n end", "title": "" }, { "docid": "d88882d998a5cf538c49893e5b8a6033", "score": "0.6139009", "text": "def initialize(*args)\n if self.class == BlockCommand\n raise TypeError, 'BlockCommand.new should not be called directly'\n end\n super\n end", "title": "" }, { "docid": "dd1b27f54429e1ae30895407f136983c", "score": "0.6111664", "text": "def initialize(commands)\n @cmds = commands\n end", "title": "" }, { "docid": "f56e1e124318bc3b5a0971b1947fec88", "score": "0.60940075", "text": "def newcommand(options, &block)\n raise \"No name given in command\" unless options.include?(:name)\n\n command = options[:name]\n\n SLAF::Commands.module_eval {\n define_method(\"#{command}_command\", &block)\n }\n\n SLAF::command_options || SLAF.command_options = {}\n\n if options.include?(:allow_arguments)\n SLAF::command_options[command] = options[:allow_arguments]\n else\n SLAF::command_options[command] = false\n end\nend", "title": "" }, { "docid": "3b7cd6917e8ffcdd2c80138832337c14", "score": "0.6088243", "text": "def initialize(line, cookbook, options = {})\n Strainer.ui.debug \"Created new command from '#{line}'\"\n @label, @command = line.split(':', 2).map(&:strip)\n Strainer.ui.debug \" Label: #{@label.inspect}\"\n Strainer.ui.debug \" Command: #{@command.inspect}\"\n @cookbook = cookbook\n end", "title": "" }, { "docid": "b122db4bb1b868797f2603feccb3a21e", "score": "0.60704434", "text": "def command *args, &block\n @commands ||= []\n @args ||= []\n @commands << block\n @args << args\n end", "title": "" }, { "docid": "c2117072f34263a354171febad702f64", "score": "0.60685545", "text": "def command(*cmd_parameters)\n\n @@attribute = nil\n @@method_file = nil\n @@method_line = nil\n @@command_options = {}\n \n # Include Commandable in singleton classes so class level methods work\n include Commandable unless self.include? Commandable\n \n # parse command parameters\n while (param = cmd_parameters.shift)\n case param\n when Symbol\n if param == :xor\n @@command_options.merge!(param=>:xor)\n else\n @@command_options.merge!(param=>true)\n end\n when Hash\n @@command_options.merge!(param)\n when String\n @@command_options.merge!(:description=>param)\n end\n end\n @@command_options[:priority] ||= 0\n \n # only one default allowed\n raise ConfigurationError, \"Only one default method is allowed.\" if @@default_method and @@command_options[:default]\n \n set_trace_func proc { |event, file, line, id, binding, classname|\n\n @@attribute = id if [:attr_accessor, :attr_writer].include?(id)\n \n # Traps the line where the method is defined so we can look up \n # the method source code later if there are optional parameters\n if event == \"line\" and !@@method_file\n @@method_file = file\n @@method_line = line\n end\n \n # Raise an error if there is no method following a command definition\n if event == \"end\"\n set_trace_func(nil)\n raise SyntaxError, \"A command was specified but no method follows\"\n end\n }\n end", "title": "" }, { "docid": "e9a275502e1af5145a45361195f699eb", "score": "0.60681516", "text": "def cmd(options={})\n arguments\n end", "title": "" }, { "docid": "ea5b76c5dda3894b4a3256648730426e", "score": "0.6063872", "text": "def initialize\n load_commands\n end", "title": "" }, { "docid": "97c8c7c01453f0a885a8d91d6e7179e1", "score": "0.60460913", "text": "def initialize(id, *command)\n if command.empty?\n raise ArgumentError, \"Command may not be empty!\"\n end\n\n @id = id\n @command = command\n @pid = nil\n @stdout = nil\n @stderr = nil\n @wout = nil\n @werr = nil\n end", "title": "" }, { "docid": "2caa34245cd88decea8d8a94752a4a64", "score": "0.6022284", "text": "def new(opts, argv, _cmd = nil)\n handle_opts(opts)\n handle_argv(argv)\n @runner = R10K::Action::Runner.new(@opts, @argv, @klass)\n self\n end", "title": "" }, { "docid": "5c8c677bc400cf1d7feb80e290b95df0", "score": "0.59948117", "text": "def initialize(cmds = {})\n @commands = cmds\n end", "title": "" }, { "docid": "f1f91b4b3950d1df3a26e9afbbc7d415", "score": "0.599215", "text": "def initialize(args=ARGV)\n @args = args\n end", "title": "" }, { "docid": "44b916a9bede0d43ecdcdc148f9a99c0", "score": "0.59714943", "text": "def initialize(command_line)\n parse(command_line)\n end", "title": "" }, { "docid": "a254cee4766288d0428974cb8b294c34", "score": "0.5970881", "text": "def method_missing(name, *args, &block)\n command = registry[name]\n\n if args.size > 1\n command.new(*args, &block)\n else\n command.call(*args, &block)\n end\n end", "title": "" }, { "docid": "12c13b01a80c63d23e5a89308812131f", "score": "0.59429044", "text": "def command cmd, help = \"\", &blk\n Bot::Commands.create self, cmd, help, &blk\n end", "title": "" }, { "docid": "320a9d277abd01d573c915d562f46062", "score": "0.5935192", "text": "def initialize(**args)\n self.args = args\n self.args.freeze\n\n parse_arguments\n validate_arguments!\n\n end", "title": "" }, { "docid": "f664dfba20dd5b34457281d1c55b42c4", "score": "0.59299326", "text": "def initialize(prefix, command, params)\n @prefix = prefix\n @command = command\n @params = params\n end", "title": "" }, { "docid": "a76f1a56e2eafc61097e2d6bfa2b9818", "score": "0.5923402", "text": "def initialize_cmd_args(args, new_name_args)\n args = args.dup\n args.shift(2 + @name_args.length) \n cmd_args = new_name_args + args\n end", "title": "" }, { "docid": "ab890a63792fe75a52bf3f912efaac3f", "score": "0.5919813", "text": "def initialize(registry)\n @commands = registry\n end", "title": "" }, { "docid": "a361aafd4ef24edb0bdca124200a3599", "score": "0.591859", "text": "def initialize(args = {})\n parse_args(args)\n end", "title": "" }, { "docid": "82a27f4571afe02338fa2684d6b0405a", "score": "0.59176147", "text": "def parse_args(args, kwargs)\n return unless self.class.Args\n command_args = self.class.Args.new(self, *args, **kwargs)\n command_args.validate\n command_args\n end", "title": "" }, { "docid": "eafe9c4d8a3775dabbb5725eb4004f05", "score": "0.59094685", "text": "def initialize(ctx, cmd, args, text, file, line)\n\t\t\t@ctx = ctx\n\t\t\t@cmd = cmd\n\t\t\t@args = args\n\t\t\t@text = text\n\t\t\t\n\t\t\t@cmd_real = (respond_to? cmd+'_action') ? (cmd+'_action') : cmd\n\t\t\t\n\t\t\tunless respond_to? @cmd_real and Context::actions.include? @cmd\n\t\t\t\traise \"#{file} (line #{line+1}): Unknown command #{cmd}.\"\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "5388b9a602abc07669eb56f83c5e4b69", "score": "0.58951324", "text": "def cmd(options={})\n env = merge_option(:environment, options)\n spawn_options = merge_option(:spawn_options, options)\n mk_cmd(env, arguments, spawn_options)\n end", "title": "" }, { "docid": "556b2b009eec8505633f3267b0b3627d", "score": "0.5883014", "text": "def initialize(command, output=nil, exit_code=nil, duration=0)\n @command = command\n @output = output || ''\n @exit_code = Integer(exit_code) rescue 1 if exit_code != nil\n @duration = Float(duration)\n end", "title": "" }, { "docid": "63963e199b6e8112f7077ca9d295937a", "score": "0.58744097", "text": "def call(*args)\n cache.fetch_or_store(args.hash) do\n id, adapter, ast, plugins, plugins_options, meta = args\n\n component = registry.components.get(:commands, id: id)\n\n command_class =\n if component\n component.constant\n else\n Command.adapter_namespace(adapter).const_get(Inflector.classify(id))\n end\n\n plugins_with_opts = Array(plugins)\n .map { |plugin| [plugin, plugins_options.fetch(plugin) { EMPTY_HASH }] }\n .to_h\n\n compiler = with(\n id: id,\n command_class: command_class,\n adapter: adapter,\n plugins: plugins_with_opts,\n meta: meta\n )\n\n graph_opts = compiler.visit(ast)\n command = ROM::Commands::Graph.build(registry.root.commands, graph_opts)\n\n if command.graph?\n root = Inflector.singularize(command.name.relation).to_sym\n CommandProxy.new(command, root)\n elsif command.lazy?\n command.unwrap\n else\n command\n end\n end\n end", "title": "" }, { "docid": "f65c40a74bfd723c2e32edf07951a52a", "score": "0.58739656", "text": "def command(**options)\n require \"tty-command\"\n TTY::Command.new(options)\n end", "title": "" }, { "docid": "177aa382ae805f16bbf4632a0fa1cacb", "score": "0.5850878", "text": "def new args\n\t\t\trequire 'simrb/comd'\n\t\t\tsimrb_app = Simrb::Scommand.new\n\t\t\tsimrb_app.run(args.unshift('new'))\n\t\tend", "title": "" }, { "docid": "177aa382ae805f16bbf4632a0fa1cacb", "score": "0.5850878", "text": "def new args\n\t\t\trequire 'simrb/comd'\n\t\t\tsimrb_app = Simrb::Scommand.new\n\t\t\tsimrb_app.run(args.unshift('new'))\n\t\tend", "title": "" }, { "docid": "e6560e6b0b5f667c21da1a37f1d830b1", "score": "0.58455324", "text": "def command(*args, **opts, &block)\n all_args = args + opts.to_a.flatten\n\n if all_args.size > 1\n commands.fetch_or_store(all_args.hash) do\n custom_mapper = opts.delete(:mapper)\n type, name = args + opts.to_a.flatten\n\n relation = name.is_a?(Symbol) ? relations[name] : name\n\n ast = relation.to_ast\n adapter = relations[relation.name].adapter\n\n if custom_mapper\n mapper = container.mappers[relation.name][custom_mapper]\n else\n mapper = mappers[ast]\n end\n\n CommandCompiler[container, type, adapter, ast] >> mapper\n end\n else\n container.command(*args, &block)\n end\n end", "title": "" }, { "docid": "8e54101744315849729baa2cddae8780", "score": "0.58408195", "text": "def __command(version, arguments, node_number)\n if command = COMMANDS[version]\n command.call(arguments, node_number)\n else\n raise ArgumentError, \"Cannot find command for version [#{version}]\"\n end\n end", "title": "" }, { "docid": "806e330fa0fdc1ecd9e1cd96112e656a", "score": "0.58369017", "text": "def initialize(*args)\n @env, @argv, options = extract_process_spawn_arguments(*args)\n @options = options.dup\n @input = @options.delete(:input)\n @timeout = @options.delete(:timeout)\n @max = @options.delete(:max)\n @prepend_stdout = @options.delete(:prepend_stdout) || \"\"\n @prepend_stderr = @options.delete(:prepend_stderr) || \"\"\n @options.delete(:chdir) if @options[:chdir].nil?\n\n exec!\n end", "title": "" }, { "docid": "f834daa9a1e9119435da9a71023683ed", "score": "0.5833975", "text": "def command(**options)\n require 'tty-command'\n TTY::Command.new(options)\n end", "title": "" }, { "docid": "f834daa9a1e9119435da9a71023683ed", "score": "0.5833975", "text": "def command(**options)\n require 'tty-command'\n TTY::Command.new(options)\n end", "title": "" }, { "docid": "eca0e02b3f5d469021859e08d2c92dae", "score": "0.5825341", "text": "def invoke_independent_command!(args)\n \n ##\n # Flatten Arguments to be able to test if the array is empty\n # and not an empty array in an empty array\n args.flatten!\n \n ##\n # Parses the CLI\n cli = GitPusshuTen::CLI.new(args)\n \n ##\n # Parses the Configuration\n if File.exist?(configuration_file)\n configuration = GitPusshuTen::Configuration.new(cli.environment).parse!(configuration_file)\n else\n configuration = nil\n end\n \n ##\n # Initializes the help command by default if there aren't any arguments\n if args.empty?\n GitPusshuTen::Command.new(cli, configuration, nil, nil)\n exit\n end\n \n ##\n # Append more arguments to the array below to allow more commands\n # to invoke without initializing an environment\n if %w[help version initialize].include? args.flatten.first\n \"GitPusshuTen::Commands::#{args.flatten.first.classify}\".constantize.new(\n cli, configuration, nil, nil\n ).perform!\n exit\n end\n end", "title": "" }, { "docid": "1b0a989ceb52c636e505c29c83fe706a", "score": "0.5824839", "text": "def cli(*args)\n CLI.new(args.flatten, self).execute\n end", "title": "" }, { "docid": "1b0a989ceb52c636e505c29c83fe706a", "score": "0.5824839", "text": "def cli(*args)\n CLI.new(args.flatten, self).execute\n end", "title": "" }, { "docid": "be45b72842e5ea27cb631dbf8f249701", "score": "0.5824466", "text": "def initialize(cmd, port)\n @cmd = cmd\n @port = port\n end", "title": "" }, { "docid": "a36d8664421826fe3e67d09c090837ef", "score": "0.5823482", "text": "def initialize(argv = [])\n @arguments ||= argv\n end", "title": "" }, { "docid": "8eab97d56a0f20e7b602185919afcdf6", "score": "0.58158827", "text": "def initialize(options={})\n @command = options[:command]\n @ruby_version = options[:ruby_version]\n @results = []\n @line = []\n end", "title": "" }, { "docid": "6a7458169f75fbd436ac842d2929492f", "score": "0.5808423", "text": "def build_command(cmd)\n cmd\n end", "title": "" }, { "docid": "f504d52576ebc2de67fe00fc74538e18", "score": "0.57878727", "text": "def from(args)\n new(*args.args, **args.kwargs)\n end", "title": "" }, { "docid": "d35b61b440c6fc1487da8ad0db0080f6", "score": "0.57811624", "text": "def initialize_exec_mode(*args)\n @image_name = args[0]\n @inside_command = args.last\n\n if @image_name.nil? || @inside_command.nil?\n puts 'Usage:'\n puts '$ docker-container-create imageName [args] \"command\"'\n exit 1\n end\n\n @other_args = args[1..-2]\n @other_args << '-it'\n end", "title": "" }, { "docid": "bbc959c7a8dad159ccde48fe7b51f0fc", "score": "0.5769412", "text": "def initialize(given_args=ARGV)\n @options, @arguments, @extras = self.class.parse_options!(given_args)\n end", "title": "" }, { "docid": "d2fdbe0818b7e58f5404518d7c55bdfb", "score": "0.57682073", "text": "def execute_command(command_arguments)\n self.class.from_arguments(config, ui, command_arguments).execute\n end", "title": "" }, { "docid": "048110c8d3f87cdac334b632da50f8fd", "score": "0.5713882", "text": "def initialize(argv = [])\n @arguments ||= argv\n @theme ||= cli.ec2_tag_theme\n @host ||= cli.host\n @domain ||= cli.domain\n end", "title": "" }, { "docid": "57b54ac39b7401813da87532165aeef2", "score": "0.5706435", "text": "def execute(command)\n @command = command\n self\n end", "title": "" }, { "docid": "b1b44314269f7952f6ba98b1e1d7230f", "score": "0.57035404", "text": "def initialize(args)\n @options = parse_arguments(args)\n check_arguments\n end", "title": "" }, { "docid": "4215e9114d0297a6b207a5bde7ec608b", "score": "0.5692586", "text": "def run_command(*args)\n @cmd = Gem::Commands::CreateCommand.new\n\n Dir.chdir(self.class.tmpdir) do\n Gem::DefaultUserInteraction.use_ui(ui) do\n capture_io { @cmd.invoke *args }\n end\n end\n\n return ui.output, ui.error\n end", "title": "" }, { "docid": "d19469741cef4109fdeb05481df94746", "score": "0.5682508", "text": "def initialize(cmd_str,opt = nil)\n raise(CmdException,\"Command string is nil\") if cmd_str.nil?\n @cmd_str = cmd_str\n # parse option\n @opt = @@def_opt.clone\n @@def_opt.each_key do |key|\n if opt != nil && opt[key] != nil\n # use argument\n @opt[key] = opt[key]\n elsif RBatch.common_config != nil \\\n && RBatch.common_config[\"cmd_\" + key.to_s] != nil\n # use config\n @opt[key] = RBatch.common_config[\"cmd_\" + key.to_s]\n else\n # use default\n end\n end\n end", "title": "" }, { "docid": "7b677a3fffa41683b916393f8811cf36", "score": "0.5672134", "text": "def initialize(commands=[], original_dir)\n @commands = commands\n @original_dir = original_dir\n cmd_list = @commands.dup\n\n @cmd = aliases(cmd_list.first).nil? ? nil : aliases(cmd_list.pop)\n @first = cmd_list.pop || @original_dir\n @second = cmd_list.pop\n end", "title": "" }, { "docid": "bd0e80b2c05c614bc7a2147a1755c805", "score": "0.56681377", "text": "def command(command, *args)\n @shell.command(command, *args)\n end", "title": "" }, { "docid": "3a1c013926a4455109ae3cc8d557c108", "score": "0.5667668", "text": "def with_command(*cmd)\n @commands.concat cmd.compact\n self\n end", "title": "" }, { "docid": "ac72be6b60aca536f42af0716b381435", "score": "0.56631327", "text": "def initialize(*args)\n if (args.length > 1)\n raise ArgumentError, 'too many args'\n end\n self\n end", "title": "" }, { "docid": "54ca362f5d95494a50188e5c21cb80ce", "score": "0.5656115", "text": "def initialize(*arguments)\n options = arguments.extract_options!\n self.class.aggregated_properties.each do |arg|\n instance_variable_set(\"@#{arg}\", arguments.shift)\n end\n options.each do |arg, argv|\n instance_variable_set(\"@#{arg}\", argv)\n end\n end", "title": "" }, { "docid": "281696efc8a701bddcc90a68f59ff74a", "score": "0.5631552", "text": "def execute_command(*args)\n if args.size < 2\n display_help\n exit(1)\n end\n \n command_class = Command.commands[args.first]\n \n if command_class\n command_class.command(self,*(args[2..-1]))\n else\n display_help\n exit(1)\n end\n end", "title": "" }, { "docid": "864a9ecd4ab085c5009f21f29ff8bcb1", "score": "0.5629812", "text": "def initialize(*args)\n @env, @argv, options = extract_process_spawn_arguments(*args)\n @options = options.dup\n @input = @options.delete(:input)\n @timeout = @options.delete(:timeout)\n @max = @options.delete(:max)\n if @options.delete(:pgroup_kill)\n @pgroup_kill = true\n @options[:pgroup] = true\n end\n @options.delete(:chdir) if @options[:chdir].nil?\n exec! if !@options.delete(:noexec)\n end", "title": "" }, { "docid": "c7135dc3ca4ab74d9907e8c0adb92a16", "score": "0.56281626", "text": "def command_factory\n end", "title": "" }, { "docid": "6b5954a90dcb16b6c53dc111c2cf332c", "score": "0.5618111", "text": "def initialize(argv=[])\n super()\n #@text = Text.new(STDOUT, STDERR, STDIN, config)\n @text ||= Megam::Text.new(STDOUT, STDERR, STDIN, config)\n command_name_words = self.class.snake_case_name.split('_')\n\n # Mixlib::CLI ignores the embedded name_args\n\n @name_args = parse_options(argv)\n\n @name_args.delete(command_name_words.join('-'))\n\n @name_args.reject! { |name_arg| command_name_words.delete(name_arg) }\n\n # meg node run_list add requires that we have extra logic to handle\n # the case that command name words could be joined by an underscore :/\n command_name_words = command_name_words.join('_')\n @name_args.reject! { |name_arg| command_name_words == name_arg }\n if config[:help]\n msg opt_parser\n exit 1\n end\n\n # copy Mixlib::CLI over so that it cab be configured in meg.rb\n # config file\n Meggy::Config[:verbosity] = config[:verbosity]\n end", "title": "" }, { "docid": "e7000593d7e2a3145b06257ddb8cdc95", "score": "0.5616656", "text": "def initialize\n @commands = Hash.new\n @commands = {\n :add_repository => nil,\n :info => nil,\n :install => nil,\n :search => nil,\n :update => nil,\n :upgrade => nil\n }\n\n set_commands\n end", "title": "" }, { "docid": "b2e56150634a17b032bc3a0b2351c701", "score": "0.56013304", "text": "def initialize(cmd, stdout, stderr, exit_code)\n @cmd = cmd\n @stdout = stdout\n @stderr = stderr\n @exit_code = exit_code\n end", "title": "" }, { "docid": "a48b8e519998ba54235fd69441168e27", "score": "0.56003636", "text": "def initialize(cmd)\n\t\t@env = {}\n\t\t\n\t\t@clearenv = false\n\t\t@mergeouts = false\n\t\t\n\t\t@cmd = cmd.map{|a| a.to_s}\n\tend", "title": "" }, { "docid": "e8b31cea16d281304da77630f06281e9", "score": "0.5598928", "text": "def initialize(args = [])\n self.args = args\n self.options = default_options\n extract_options!\n end", "title": "" } ]
3eef8933c11b003709f3fe0c0a3b9547
Returns floating point percentage of how much object HP is gone.
[ { "docid": "4664e5215c9730638175a90c1bf7f614", "score": "0.7831695", "text": "def damaged_percentage\n 1 - alive_percentage\n end", "title": "" } ]
[ { "docid": "39fa8b0196247bc55534a282f4cd4f7c", "score": "0.74563724", "text": "def alive_percentage\n hp.to_f / hit_points\n end", "title": "" }, { "docid": "cb23ea50aeff517f75ec226e6e6cd9f2", "score": "0.6902058", "text": "def pct()\n\t (self.wins()==0) ? 0 : self.wins().to_f/(self.wins()+self.losses()) \n\tend", "title": "" }, { "docid": "82a58411e81f83ef2414f23c5f17a1d2", "score": "0.68806404", "text": "def health\n (100 * @health.to_f / @max_health).round(2)\n end", "title": "" }, { "docid": "f7d052f5ca2e2d3967426b3771e83ac2", "score": "0.68770075", "text": "def carbsPercent()\n\t\t\t\ttot = @dishes.inject(0.0) { |tot, dish| tot += dish.carbsPercent() }\n\t\t\t\treturn tot / @dishes.length\n\t\t\tend", "title": "" }, { "docid": "e06bef3823483c91f753f34bc51f8cd1", "score": "0.6822871", "text": "def percentage\n 0.0\n end", "title": "" }, { "docid": "804bba4c7a60e5beb74b5000bed698cc", "score": "0.6804392", "text": "def remaining_percent\n (remaining_pints.to_f)/(124.to_f)\n end", "title": "" }, { "docid": "e7dfec15332d62ac3a6bfef179e45210", "score": "0.67913926", "text": "def stat_hcr\n percentage(self.heifers, self.heifers_calved)\n end", "title": "" }, { "docid": "f5a5aa9d49cb7c950ecca15034271c90", "score": "0.6748664", "text": "def hp_rate\r\n @hp.to_f / mhp\r\n end", "title": "" }, { "docid": "f567ddee5e2eaa0531dd1e79b32471d8", "score": "0.6734722", "text": "def percent_full\n return 0.0 if capacity.nil?\n return 0.0 if mentor_terms_count.nil?\n mentor_terms_count.to_f / capacity.to_f * 100\n end", "title": "" }, { "docid": "f520a5fe8414af000e37a05334af0918", "score": "0.6586596", "text": "def get_near_death_value\n return @character.near_death_percent / 100.0\n end", "title": "" }, { "docid": "b452e0830b613d06697a4ea10fe9d9d3", "score": "0.6567708", "text": "def disbursement_remaining_percentage\n disbursement_remaining_factor * 100\n end", "title": "" }, { "docid": "c86dc575e4fa5c4abb4019c4e103f2f8", "score": "0.6512651", "text": "def percentage_of_detractors\n calculator.percentage_of_detractors\n end", "title": "" }, { "docid": "5a485a829f159c698ce4e5089d340d1b", "score": "0.64736885", "text": "def reduce_HP\n @points -= 10\n end", "title": "" }, { "docid": "c989ae123c30781ca692bacf72660dbc", "score": "0.6469918", "text": "def getHealth()\n return @hp\n end", "title": "" }, { "docid": "c989ae123c30781ca692bacf72660dbc", "score": "0.6469918", "text": "def getHealth()\n return @hp\n end", "title": "" }, { "docid": "b43d7bffa2bf9f7cca117370835f6c6c", "score": "0.64492625", "text": "def hps\n self.total_healing.to_f / self.encounter.duration_in_seconds\n end", "title": "" }, { "docid": "15dc94011d66d309e58350ec9a859904", "score": "0.6427238", "text": "def percent_of_goal_raised\n ( ( 100.0 * self.funds_raised ) / self.fundraising_goal ).round\n end", "title": "" }, { "docid": "9c1e89390180d5303f17c5b08c0f253f", "score": "0.63992923", "text": "def percentage_off\n\t\t(you_save > 0) ? (you_save/100).round(2) : 0\n\tend", "title": "" }, { "docid": "38a5684b74299938244f36ba9235bb1c", "score": "0.6390594", "text": "def percentage; end", "title": "" }, { "docid": "52af940883f4e0f2dc237599aaf84451", "score": "0.6372515", "text": "def player_win_percentage\n (games_won/user_games)\n end", "title": "" }, { "docid": "b7f6f4b2a3921ef31ce8c71c23b5d315", "score": "0.63707256", "text": "def get_percent_of_vote\n\t\t(@votes.count(@winner).to_f / @votes.count.to_f * 100).round\n\tend", "title": "" }, { "docid": "a7a089e5957f2ca2b0a1880faec3f988", "score": "0.63587666", "text": "def loss_percent(current_price)\n price = self.price.present? ? self.price : 0.0\n (self.loss_price(current_price)*100/price).round(2)\n end", "title": "" }, { "docid": "4284a3dcf3acb1e6ce635a1a8ce5a980", "score": "0.6345579", "text": "def achievements_percentage\n achievements_done.to_f / @achievements.size\n end", "title": "" }, { "docid": "ad70239d34d1feef839ac62afdca5e4a", "score": "0.6345112", "text": "def percentage\n \tamount / expense.cost\n end", "title": "" }, { "docid": "f60e323c29acaa33735b5b6baa01b4d4", "score": "0.6344816", "text": "def vote_percentage \n if self.filed? || self.finished? # Makes sure the threshold hasn't already been hit. \n return 100 # Return 100, meaning 100% goal. \n elsif self.pending? # PEtition is pending still \n petition_votes = self.votes_for.count\n petition_votes.to_f\n percentage = petition_votes / 500.00 # Finds percentage of the vote goal \n percentage *= 100 # Turns the float percentage into a whole number percentage.\n return percentage.round(1) \n else \n puts \"Something is wrong with this petition.\"\n end \n end", "title": "" }, { "docid": "3397b858cf62e25a265c78cfc68586fc", "score": "0.6333579", "text": "def percent_of_house\n house_capacity.zero? ? 100 : (100.0 * total_sales.size / house_capacity).floor\n end", "title": "" }, { "docid": "0281419e3ca00447bef4407f25dde35d", "score": "0.6318892", "text": "def dps\n self.total_damage.to_f / self.encounter.duration_in_seconds\n end", "title": "" }, { "docid": "0c3f6e239bc02bb31f52429421d5c151", "score": "0.63128597", "text": "def calc_pct(wins, losses)\n return (wins + losses) == 0 ? 0.0 : wins.to_f / (wins + losses).to_f\nend", "title": "" }, { "docid": "ff7b3a762f715c20e24407dd6f24f141", "score": "0.631174", "text": "def hours_spent_percentage\n return 1 if hours_planned == 0\n (hours_spent.to_f / hours_planned).round(2)\n end", "title": "" }, { "docid": "ff7b3a762f715c20e24407dd6f24f141", "score": "0.631174", "text": "def hours_spent_percentage\n return 1 if hours_planned == 0\n (hours_spent.to_f / hours_planned).round(2)\n end", "title": "" }, { "docid": "3a86d6368fbcfae4745ceb268b19630b", "score": "0.6292449", "text": "def damaged\n @hp = @hp - 1\n end", "title": "" }, { "docid": "770020d744534bb42033dbdd1b7c6f05", "score": "0.6272593", "text": "def percent_used\n 100 - (100.0 * bytes_free.to_f / bytes_total.to_f)\n end", "title": "" }, { "docid": "9a5eb38b68f1b9a77f1bea82deeaff93", "score": "0.62529415", "text": "def death_percentage(num)\n (@population * num).floor\n end", "title": "" }, { "docid": "8e2c3e1e6151bdf4990dcd353a5f8132", "score": "0.6251627", "text": "def stat_total\n (self.health + self.hunger + self.happiness) / 3\n end", "title": "" }, { "docid": "02fdd4d0175846166dd839f630c1f925", "score": "0.62471765", "text": "def away_shoot_percent\n away_shoot_percent = @schedule.away_score / game_stat.away_sog.to_f * 100\n away_shoot_percent.round(2)\n end", "title": "" }, { "docid": "f5f9cf822ead8e467512d2593b407b5e", "score": "0.62262154", "text": "def get_percentage\n r = get_status[:percent]\n r.blank? ? nil : r.to_i\n end", "title": "" }, { "docid": "e0dc346d7453c481c59b866746fa9897", "score": "0.62158287", "text": "def percent_damage(compared_to_type=nil)\n self.class.percent_of self.total_damage, self.encounter.total_damage(compared_to_type)\n end", "title": "" }, { "docid": "361a20323c70416ee0e6deacee761fce", "score": "0.62107235", "text": "def hp\n h / 360.0\n end", "title": "" }, { "docid": "96fa7db0d01d7443806e11386fde000c", "score": "0.62065566", "text": "def percentage_sold\n ((quantity_sold / stock.to_f) * 100).round\n end", "title": "" }, { "docid": "3a4a3eeda71a5a2f23f8b2467212dbab", "score": "0.62047595", "text": "def disbursement_percentage\n disbursement_factor * 100\n end", "title": "" }, { "docid": "6173af8628a280f8532433b476381de9", "score": "0.6189234", "text": "def percentage_of_passives\n calculator.percentage_of_passives\n end", "title": "" }, { "docid": "b6213ddd6070fbd7076ae89eebd4fbd9", "score": "0.6183117", "text": "def percent_high_ranking\n percent = high_ranking_cards.length / cards.length.to_f\n end", "title": "" }, { "docid": "665bf4ac79b6ef7bf800cefcca1db2d3", "score": "0.6171424", "text": "def vote_percent\n Vote.percent(vote_cache)\n end", "title": "" }, { "docid": "28d75716d70d004db4a2b35aac6e67c9", "score": "0.6136431", "text": "def percent_high_ranking\n number_of_high_cards = self.high_ranking_cards.length.to_f\n number_of_all_cards = self.cards.length.to_f\n\n percentage = number_of_high_cards / number_of_all_cards\n percentage_rounded = (percentage * 100).round(2)\n\n return percentage_rounded\n end", "title": "" }, { "docid": "3c652edbe23dc3aa86cf9eab9342831d", "score": "0.61244774", "text": "def undeliverable_percent\n total, fails = total_count, messages_given_up_on_count\n if total == 0\n return 0\n elsif fails == 0\n return 0\n else\n return (fails / total) * 100\n end\n end", "title": "" }, { "docid": "1ffcd1e5c76af335e845a133d015b9b1", "score": "0.61167777", "text": "def percent_for\n (votes_for.to_f * 100 / (self.votes.size + 0.0001)).round\n end", "title": "" }, { "docid": "eca1ad10c66128698b43a54967837152", "score": "0.6112228", "text": "def percent_of_total\n # Prevents a error caused by attempting to round the value NaN\n poll.total_points == 0 ? 0 : (score.to_f/poll.total_points.to_f * 100).round\n end", "title": "" }, { "docid": "193379b3f220048bcdd6c5fa3b823bc0", "score": "0.6107051", "text": "def rounds_won_percentage\n (@rounds_played > 0) ? @rounds_won.to_f / @rounds_played : 0\n end", "title": "" }, { "docid": "b50b791c52dfd024f280309a6f8d8dbc", "score": "0.6103247", "text": "def home_shoot_percent\n home_shoot_percent = @schedule.home_score / game_stat.home_sog.to_f * 100\n home_shoot_percent.round(2)\n end", "title": "" }, { "docid": "253ceb7cc7ad56fd285f875d734221b9", "score": "0.6096968", "text": "def decrement_of_health(user)\n -((user.max_health / 10) + 5 * (4 - difficulty)).round\n end", "title": "" }, { "docid": "06a3bd21c5c9a429109d463c50879de6", "score": "0.6087961", "text": "def pri_goal_percentage\n shots_on_goal > 0 ? goals.to_f / shots_on_goal : 1.0\n end", "title": "" }, { "docid": "9b3df252b17b29e1acd1d0598b862d5d", "score": "0.6086068", "text": "def percent()\n ''\n end", "title": "" }, { "docid": "2ce24908f5bb758272110996bcd31b67", "score": "0.60701907", "text": "def percent_wins(wins)\n ((wins.to_f / @num_games.to_f) * 100).round(4)\n end", "title": "" }, { "docid": "28cfb0a14f4055a8600aa39631e841e3", "score": "0.606001", "text": "def percent_sold\n max_advance_sales.zero? ? 100 : (100.0 * total_sales.size/max_advance_sales).floor\n end", "title": "" }, { "docid": "be14393dacbf31ec5291611c60688a6b", "score": "0.6059194", "text": "def percent_of_budget\n if budget_dollars_billed.nil? || budget_dollars_billed == 0\n rv = 0\n elsif current_total_billed.nil? \n rv = 0\n else\n rv = current_total_billed / budget_dollars_billed\n end\n rv\n end", "title": "" }, { "docid": "b31aa51486e5e340d51724009b1a2648", "score": "0.6040318", "text": "def heal!\n @health_remaining = @max_health\n end", "title": "" }, { "docid": "eda840afe4fa105775785f27e5067d84", "score": "0.60366726", "text": "def to_percentage\n percentage = (object.popularity * 100).round(1)\n precision = if (object.popularity * 100).to_i == percentage\n 0\n else\n 1\n end\n number_to_percentage(percentage, precision: precision)\n end", "title": "" }, { "docid": "cef570d7998ab4fd64698a8d9754d8cc", "score": "0.6033932", "text": "def scope_percentual\n total = full_count\n scope_count / total.to_f if total.positive?\n end", "title": "" }, { "docid": "e61e5aaa2411996c012c91b3cc80765f", "score": "0.60324895", "text": "def percentage_owned(company)\n certificates_for(company).map(&:portion).inject(:+) || 0\n end", "title": "" }, { "docid": "8d8dbf217368f86982d762182b9f34de", "score": "0.6020407", "text": "def percent_against\n (votes_against.to_f * 100 / (self.votes.size + 0.0001)).round\n end", "title": "" }, { "docid": "a0e2152b661664fc8ca319d4d067b5d1", "score": "0.6020094", "text": "def percent_high_ranking\n (high_ranking_cards.count.fdiv(@cards.count) * 100).round(2)\n end", "title": "" }, { "docid": "f0ff7daaa710aa05aff60688073c3191", "score": "0.6015899", "text": "def percentage_idle\n (idle_time / horizon_time) * 100\n end", "title": "" }, { "docid": "eab00ead2559b84ea55eddcddc03178f", "score": "0.6007169", "text": "def percent_val\n dollar_amt ? ((dollar_amt / Contract.sum(:dollar_amt)) * 100) : nil\n end", "title": "" }, { "docid": "46cfa2ea87299d3f4fbd6e636e04d465", "score": "0.60057455", "text": "def proteinsPercent()\n\t\t\t\tplato = @alimentsList.head\n\t\t\t\tgrams = @gramsList.head\n\t\t\t\ttotalEnergy = 0.0\n\t\t\t\ttotalProteinsEnergy = 0.0\n\n\t\t\t\twhile plato != nil\n\t\t\t\t\ttotalEnergy += (plato.value.get_energia * grams.value) / 100\n\t\t\t\t\ttotalProteinsEnergy += (plato.value.get_energia_proteins * grams.value) / 100\n\n\t\t\t\t\tplato = plato.next\n\t\t\t\t\tgrams = grams.next\n\t\t\t\tend\n\n\t\t\t\treturn (totalProteinsEnergy * 100) / totalEnergy\n\t\t\tend", "title": "" }, { "docid": "408a13076c5ddd93b08a079188f72710", "score": "0.6005267", "text": "def get_percentage(report)\n percent = (report[:position] / report[:length]) * 100\n percent.round\n end", "title": "" }, { "docid": "2c8f01e3404d9544eda24b95dc88e568", "score": "0.6004458", "text": "def hpdamage\n return (@hpdamage == nil ? 0 : @hpdamage)\n end", "title": "" }, { "docid": "c760090d5be7bbd003fef8e5a4aa465e", "score": "0.6003969", "text": "def percent_high_ranking\n ((high_ranking_cards.count.to_f / @cards.count.to_f) * 100).round(2)\n end", "title": "" }, { "docid": "da27226ff2da7abd9b76aa78efa128ea", "score": "0.59999293", "text": "def unit_saving_percentage(point)\n \"#{100 - point.price.proportion(price).round(1)}%\"\n end", "title": "" }, { "docid": "a41c8cdd3d5d8c4847dc4f3027d71320", "score": "0.59989244", "text": "def non_ref_ratio\n self.non_ref_count.to_f / self.coverage.to_f\n end", "title": "" }, { "docid": "7787611a756d0a74676f2c091f9cf37d", "score": "0.5996629", "text": "def percentage_change\n return_sum / @money * 100\n end", "title": "" }, { "docid": "714e21639531c0e494156deda5156a55", "score": "0.5984711", "text": "def space_percentage\n if quota == 0\n 0.0\n else\n (size.to_f/quota)*100 rescue 0.0\n end\n end", "title": "" }, { "docid": "a10806abaa48b673f60ac7a4fd031476", "score": "0.5982549", "text": "def percent_of_total\n VoteCount.total.blank? ? 0 : ((count.to_f / VoteCount.total)*100)\n end", "title": "" }, { "docid": "cf2ee33a195f9b013e1abb2e866a03a5", "score": "0.5971777", "text": "def amount\n @percent\n end", "title": "" }, { "docid": "cf2ee33a195f9b013e1abb2e866a03a5", "score": "0.5971777", "text": "def amount\n @percent\n end", "title": "" }, { "docid": "34e1e30e6c0c06ec18cd43455ac1e661", "score": "0.5970816", "text": "def progress_percentage\n progress = $redis.hgetall(redis_key)\n\n if progress.present?\n return 100 if progress['total_items'] == '0'\n (progress['processed_items'].to_f / progress['total_items'].to_f) * 100\n else\n 100\n end\n end", "title": "" }, { "docid": "b5abaa9f0eebe45eeb14f2e1ba9ed0bf", "score": "0.5960926", "text": "def stat_ftc\n percentage(self.heifers_first, self.heifers_first_calved)\n end", "title": "" }, { "docid": "ee00894f9d547044604313198d15b70f", "score": "0.5945281", "text": "def percentage_no\n return 0 if no_count == 0\n\n 100 - percentage_yes\n end", "title": "" }, { "docid": "ee00894f9d547044604313198d15b70f", "score": "0.5945281", "text": "def percentage_no\n return 0 if no_count == 0\n\n 100 - percentage_yes\n end", "title": "" }, { "docid": "7a7009e9b0b13d4efd55a11484465b7c", "score": "0.59427756", "text": "def win_percent\n matchmade_games < 1 ? 0 : ((total_exp.to_f/matchmade_games.to_f) * 100).to_d\n end", "title": "" }, { "docid": "604c47595b970ff0c83e977e8cb5f062", "score": "0.5938465", "text": "def covered_percent; end", "title": "" }, { "docid": "604c47595b970ff0c83e977e8cb5f062", "score": "0.5938465", "text": "def covered_percent; end", "title": "" }, { "docid": "8d1496247f589d9be6642beb9692a4d9", "score": "0.59381473", "text": "def achievements_percentage\n @achievements.size.to_f / @schema.achievements.size\n end", "title": "" }, { "docid": "923f1a218676c093efc0a26b9b1d52e2", "score": "0.5937916", "text": "def guts_hp_recovery\n if actor?\n self.hp += (mhp * (self.actor.guts_hp_recovery_rate * 0.01)).to_i\n else\n self.hp += (mhp * (self.enemy.guts_hp_recovery_rate * 0.01)).to_i\n end\n end", "title": "" }, { "docid": "92284183f1170de75a150131b0d6ce20", "score": "0.59336156", "text": "def carbsPercent()\n\t\t\t\tplato = @alimentsList.head\n\t\t\t\tgrams = @gramsList.head\n\t\t\t\ttotalEnergy = 0.0\n\t\t\t\ttotalCarbsEnergy = 0.0\n\n\t\t\t\twhile plato != nil\n\t\t\t\t\ttotalEnergy += (plato.value.get_energia * grams.value) / 100\n\t\t\t\t\ttotalCarbsEnergy += (plato.value.get_energia_carbs * grams.value) / 100\n\n\t\t\t\t\tplato = plato.next\n\t\t\t\t\tgrams = grams.next\n\t\t\t\tend\n\n\t\t\t\treturn (totalCarbsEnergy * 100) / totalEnergy\n\t\t\tend", "title": "" }, { "docid": "6153fb334e3a4b70837204081fa38e12", "score": "0.59298253", "text": "def percent_passes; end", "title": "" }, { "docid": "6153fb334e3a4b70837204081fa38e12", "score": "0.59298253", "text": "def percent_passes; end", "title": "" }, { "docid": "4e9f363704347990382faa87de24c3d3", "score": "0.59288794", "text": "def percentage_of_promoters\n calculator.percentage_of_promoters\n end", "title": "" }, { "docid": "8fd50f9d5b77a54bc8c4558eef615d92", "score": "0.5926184", "text": "def user_percentage(user)\n\t\tworth \t\t= self.worth\n\t\tgrade \t\t= self.user_grade(user)\n\t\t\n\t\tif !grade.blank? && !worth.blank? && worth != 0\n\t\t\tpercent \t= (grade.to_f / worth.to_f) * 100\n\t\t\treturn percent\n\t\tend\n\tend", "title": "" }, { "docid": "8d275d85e466595168b4c2fbbfad181f", "score": "0.5921813", "text": "def storage_check_failed_percentage\n return @storage_check_failed_percentage\n end", "title": "" }, { "docid": "cdebd28b61c5f832dda2dae7574c29d9", "score": "0.5920904", "text": "def hp_decriment(opponent)\n\t\thp_will_change!\n\t\tputs \"damage taken!\"\n\t\t# self.hp -= 1 \n\t\tself.hp -= (1 + opponent.attack/self.defense)\n\t\tif self.hp <=0 \n\t\t\tputs \"Fatality!\"\n\t\t\tself.lives_decriment()\n\t\tend\n\t\tself.save!\n\tend", "title": "" }, { "docid": "86f9f0617680fec7733f80f67328a378", "score": "0.59153885", "text": "def percent_correct\n # Check for divide by zero. Than calculate the percentage otherwise.\n if @turns.size == 0\n 0.0\n else\n # Calculate percentage, truncate value to one decimal place.\n ((number_correct.to_f / @turns.size.to_f) * 100.0).truncate(1)\n end\n end", "title": "" }, { "docid": "8544e4a3d9c97ea094a67debcbb65efb", "score": "0.59136444", "text": "def progress_as_percentage\n\t\t\"#{real_days_progress_today.round}%\"\n\tend", "title": "" }, { "docid": "4bb66d7a70daf4430e0ba4806c22ccd4", "score": "0.5913175", "text": "def calculate_progress\n result = self.progress_status\n (100 * result.values.count(true) / result.values.compact.count).to_s\n end", "title": "" }, { "docid": "89d0d2cf68033c916ce216b71d3ad551", "score": "0.58924884", "text": "def current_percentage\n if budget.total_expense == 0\n return 0\n else\n ((self.subtotal / budget.total_expense) * 100).round\n end\n end", "title": "" }, { "docid": "4b953cb9f48f0289fa20a5f263d40ba8", "score": "0.5878019", "text": "def percentage_of_votes\n if total_votes > 0\n 100 * (number_of_votes.to_f / total_votes.to_f)\n else\n 0\n end\n end", "title": "" }, { "docid": "4c7512a84dd46a07b67ad16e12d5c03b", "score": "0.587656", "text": "def percent_remaining\n #num_unlabeled = image_labels.where(:label_id => nil).count\n num_unlabeled = image_labels.count - labelledImagesCount()\n if(images.count > 0)\n percent_remaining = 100.0 * num_unlabeled.to_f / images.count\n else\n percent_remaining = 0.0\n end\n end", "title": "" }, { "docid": "459d7e93b644cfe06ea521caf4f3e2df", "score": "0.5874405", "text": "def percentage_discount\n ((1 - (sale_price / original_price)) * 100).round.to_i\n end", "title": "" }, { "docid": "a32164ee5298f16d59ef3546816a9fc2", "score": "0.5873014", "text": "def percent_used\n\t\t\t\treturn nil unless meminfo?\n\t\t\t\tmemory = IO.foreach('/proc/meminfo').first(3)\n\t\t\t\ttotal = memory[0].split[1].to_i\n\t\t\t\ttotal.-(memory[2].split[1].to_i).*(100).fdiv(total).round(2)\n\t\t\tend", "title": "" }, { "docid": "5f4fd2455812404a41ae089c4d964cf3", "score": "0.5857722", "text": "def profile_completeness_percent\n Cache.get(['profile_c', self], nil, true){\n total = completed = 0.0\n self.profile_elements.each do |element, is_completed|\n total += 1.0\n completed += 1.0 if is_completed\n end\n (completed / total).round(2)\n }.to_f\n end", "title": "" }, { "docid": "12d7e91cf96a91c8418c4d1ab9a151f5", "score": "0.58534646", "text": "def percent\n self[:percentage] = (self[:current] <= self[:max] ? self[:current]/self[:max]*100 : self[:max])\n end", "title": "" } ]
f04c6f62ab47a5531cd2085b76eca8a4
=begin MASTER DATA: create supplier =end
[ { "docid": "ded65e0cd1cd5cd7c791120aeec34397", "score": "0.6336635", "text": "def create_supplier( employee, supplier_params) \n supplier = Supplier.new(supplier_params)\n if not employee.has_role?(:admin)\n supplier.errors.add( :authentication , \"Wrong Role: No admin role\")\n return supplier\n end\n \n \n \n supplier.office_id = self.id \n supplier.creator_id = employee.id \n supplier.save\n \n \n return supplier\n end", "title": "" } ]
[ { "docid": "fbadce10d22b0da27599eae3ec49fccb", "score": "0.6574977", "text": "def generate_warehouse\n return true if type!=\"Supplier\"\n Warehouse.create(:company_id=>self.id,\n :name=>self.name,\n :managed=>false,\n :address=>self.address,\n :address2=>self.address2,\n :city=>self.city,\n :us_state=>self.state,\n :zipcode=>self.zipcode)\n end", "title": "" }, { "docid": "8732e4647f561ea33b077b880829a72d", "score": "0.64178383", "text": "def create\n @supplier = Supplier.new(supplier_params)\n\n # Wenn neu erstellter Lieferant ein Kabellieferant ist, dann Einträge in wire_suppliers für alle Kabel erstellen\n suppliertypeid = Suppliertype.where(name: 'Kabel').first.id\n if supplier_params[:suppliertype_ids].include? suppliertypeid.to_s\n Wire.all.each do |wire|\n wire_supplier = WireSupplier.create\n wire_supplier.supplier = @supplier\n wire_supplier.wire = wire\n wire_supplier.save!\n end\n end\n\n # Wenn neu erstellter Lieferant ein Kabelbeschriftungslieferant ist, dann einen neuen Eintrag in wirecaptionprices erstellen\n suppliertypeid = Suppliertype.where(name: 'Kabelbeschriftung').first.id\n if supplier_params[:suppliertype_ids].include? suppliertypeid.to_s\n wirecaptionprice = Wirecaptionprice.create\n wirecaptionprice.supplier = @supplier\n wirecaptionprice.save!\n end\n\n # Wenn neu erstellter Lieferant ein Elektroinstallationslieferant ist, dann Einträge in electrical_installation_suppliers für alle Elektroinstallationen erstellen\n suppliertypeid = Suppliertype.where(name: 'Elektroinstallation').first.id\n if supplier_params[:suppliertype_ids].include? suppliertypeid.to_s\n ElectricalInstallation.all.each do |electrical_installation|\n electricalInstallationSupplier = ElectricalInstallationSupplier.create\n electricalInstallationSupplier.supplier = @supplier\n electricalInstallationSupplier.electrical_installation = electrical_installation\n electricalInstallationSupplier.save!\n end\n end\n\n # Wenn neu erstellter Lieferant ein FU Lieferant ist, dann Einträge in drive_suppliers für alle Drives erstellen\n suppliertypeid = Suppliertype.where(name: 'FU').first.id\n if supplier_params[:suppliertype_ids].include? suppliertypeid.to_s\n Drive.all.each do |drive|\n driveSupplier = DriveSupplier.create\n driveSupplier.supplier = @supplier\n driveSupplier.drive = drive\n driveSupplier.save!\n end\n end\n\n # Wenn neu erstellter Lieferant ein Schaltanlagenbau Lieferant ist, dann Einträge in switchgear_suppliers für alle Switchgears erstellen\n suppliertypeid = Suppliertype.where(name: 'Schaltanlagenbau').first.id\n if supplier_params[:suppliertype_ids].include? suppliertypeid.to_s\n Switchgear.all.each do |switchgear|\n switchgearSupplier = SwitchgearSupplier.create\n switchgearSupplier.supplier = @supplier\n switchgearSupplier.switchgear = switchgear\n switchgearSupplier.save!\n end\n end\n\n # write supplier to database\n if @supplier.save\n redirect_to suppliers_path, :notice => 'Lieferant erfolgreich erstellt.'\n else\n render 'new'\n end\n end", "title": "" }, { "docid": "9766a2036a89fec988d9906583e10f28", "score": "0.62272894", "text": "def create_new_acquisition(data_set)\n enter_acquisition_info_data data_set\n save_record\n end", "title": "" }, { "docid": "9766a2036a89fec988d9906583e10f28", "score": "0.62272894", "text": "def create_new_acquisition(data_set)\n enter_acquisition_info_data data_set\n save_record\n end", "title": "" }, { "docid": "5bd16470090c4de689397bb582442065", "score": "0.6159367", "text": "def create\n \n #頭文字を必ず半角小文字にする\n set_character\n \n @supplier_master = SupplierMaster.new(supplier_master_params)\n\n respond_to do |format|\n if @supplier_master.save\n format.html { redirect_to @supplier_master, notice: 'Supplier master was successfully created.' }\n format.json { render :show, status: :created, location: @supplier_master }\n else\n format.html { render :new }\n format.json { render json: @supplier_master.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "edb38383f7afc712016f35c9da7d8387", "score": "0.61483556", "text": "def create\n @pagetitle = \"New supplier\"\n \n @company = Company.find(params[:supplier][:company_id])\n @supplier = Supplier.new(params[:supplier])\n\n respond_to do |format|\n if @supplier.save\n format.html { redirect_to(@supplier, :notice => 'Supplier was successfully created.') }\n format.xml { render :xml => @supplier, :status => :created, :location => @supplier }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @supplier.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7dc356b55e613b8d0e2a79565129cce5", "score": "0.6123916", "text": "def set_supplier_master\n @supplier_master = SupplierMaster.find(params[:id])\n end", "title": "" }, { "docid": "85b49e5a663e0e6278da281903e555de", "score": "0.6064668", "text": "def add_to_allocation(supplier, demander, bid)\n @allocation[supplier.get_id][demander.get_id] = { :demander => demander, :bid => bid }\n @in_allocation[demander.get_id] = true\n end", "title": "" }, { "docid": "35e1bce36bbfd4669ef38c6ad0890d00", "score": "0.6064327", "text": "def create\n @supplier = current_merchant.suppliers.new(supplier_params)\n\n respond_to do |format|\n if @supplier.save\n format.html { redirect_to @supplier, notice: 'Supplier was successfully created.' }\n format.json { render :show, status: :created, location: @supplier }\n else\n format.html { render :new }\n format.json { render json: @supplier.errors, status: :unprocessable_entity }\n end\n end\n @supplier.ordering_method_ids = params[:supplier][:ordering_method_ids]\n @supplier.delivery_location_ids = params[:supplier][:delivery_location_ids]\n @supplier.online_retail_service_type_ids = params[:supplier][:online_retail_service_type_ids]\n @supplier.product_category_ids = params[:supplier][:product_category_ids]\n end", "title": "" }, { "docid": "025c03f0ef67dcae9ca7691a9638276b", "score": "0.6057677", "text": "def create\n @pagetitle = \"New supplier\"\n \n @company = Company.find(params[:supplier][:company_id])\n @supplier = Supplier.new(supplier_params)\n\n respond_to do |format|\n if @supplier.save\n format.html { redirect_to(@supplier, :notice => 'Supplier was successfully created.') }\n format.xml { render :xml => @supplier, :status => :created, :location => @supplier }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @supplier.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d7bebbbcf84853928b723a5120e6ed10", "score": "0.60536516", "text": "def create\n @supplier = Supplier.new(supplier_params)\n\n respond_to do |format|\n if @supplier.save\n\t \n\t\t@hz_manufacturer = HzManufacturer.new\n\t\t@hz_manufacturer.address=params[:supplier][:address]\n\t\t@hz_manufacturer.manufacturer_id=params[:supplier][:shop_id]\n\t\t@hz_manufacturer.tel=params[:supplier][:contact_no]\n\t\t@hz_manufacturer.hz_country_code=params[:supplier][:country_code]\n\t\t@hz_manufacturer.save\n\t \n format.html { redirect_to @supplier, notice: 'Supplier was successfully created.' }\n format.json { render action: 'show', status: :created, location: @supplier }\n else\n format.html { render action: 'new' }\n format.json { render json: @supplier.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6357c3b4786bafdecb0240493dfc3d2c", "score": "0.6047027", "text": "def create\n get_supplier\n @supplier_phone = @supplier.phones.create(params[:supplier_phone])\n end", "title": "" }, { "docid": "e810c54e4fc9cfa3b6c42a5607ccdf20", "score": "0.6009354", "text": "def set_supplier\n @object.supplier = spree_current_user.supplier\n end", "title": "" }, { "docid": "24555ae5823d783928da8d9c388c6bb8", "score": "0.59609604", "text": "def set_supplier\n @supplier = Supplier.find(params[:id])\n end", "title": "" }, { "docid": "b10236b8678a7d7f6af215d91994310d", "score": "0.595807", "text": "def import_supply_items(filename = self.import_filename)\n # before calling this in a descended class, you must set up these variables:\n # @supplier = The supplier to import for (an AR object)\n SupplyItem.expire_category_tree_cache(@supplier)\n\n ThinkingSphinx::Deltas.suspend :supply_item do\n File.open(filename, \"r:utf-8\").each_with_index do |line, i|\n next if i == 0 # We skip the first line, it only contains header information\n data = parse_line(line)\n next if data == false\n next if data[:supplier_product_code].blank? # The line is incomplete, skip it\n # check if we have the supply item\n local_supply_item = SupplyItem.where(:supplier_id => @supplier.id,\n :supplier_product_code => data[:supplier_product_code]).first\n # We do not have that supply item yet\n if local_supply_item.nil?\n si = new_supply_item(data)\n if si.save\n supplier_logger.info(\"[#{DateTime.now.to_s}] SupplyItem create: #{si.inspect}\")\n else\n supplier_logger.error(\"Failed adding supply item during sync: #{si.inspect.to_s}, #{si.errors.to_s}\")\n end\n # We already have that supply item and need to update that and related product information\n else\n update_supply_item(local_supply_item, data)\n end\n end\n end\n Product.update_price_and_stock # Sync available products to the now changed supply items\n CategoryDispatcher.create_unique_combinations_for(@supplier)\n end", "title": "" }, { "docid": "e698662371a3854e4801a5a2c0d36e58", "score": "0.59507424", "text": "def set_supplier\n @supplier = Supplier.find(params[:id])\n end", "title": "" }, { "docid": "e698662371a3854e4801a5a2c0d36e58", "score": "0.59507424", "text": "def set_supplier\n @supplier = Supplier.find(params[:id])\n end", "title": "" }, { "docid": "e698662371a3854e4801a5a2c0d36e58", "score": "0.59507424", "text": "def set_supplier\n @supplier = Supplier.find(params[:id])\n end", "title": "" }, { "docid": "e698662371a3854e4801a5a2c0d36e58", "score": "0.59507424", "text": "def set_supplier\n @supplier = Supplier.find(params[:id])\n end", "title": "" }, { "docid": "e698662371a3854e4801a5a2c0d36e58", "score": "0.59507424", "text": "def set_supplier\n @supplier = Supplier.find(params[:id])\n end", "title": "" }, { "docid": "e698662371a3854e4801a5a2c0d36e58", "score": "0.59507424", "text": "def set_supplier\n @supplier = Supplier.find(params[:id])\n end", "title": "" }, { "docid": "e698662371a3854e4801a5a2c0d36e58", "score": "0.59507424", "text": "def set_supplier\n @supplier = Supplier.find(params[:id])\n end", "title": "" }, { "docid": "e698662371a3854e4801a5a2c0d36e58", "score": "0.59507424", "text": "def set_supplier\n @supplier = Supplier.find(params[:id])\n end", "title": "" }, { "docid": "84dfb0babc8ac2ab1f633548af133ce7", "score": "0.59369576", "text": "def create\n @supplier = Supplier.new(params[:supplier])\n \n respond_to do |format|\n if @supplier.save\n flash.now[:notice] = 'Supplier was successfully created.'\n format.html { redirect_to(suppliers_path) }\n format.xml { render :xml => @supplier, :status => :created, :location => @supplier }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @supplier.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0a174b56469c984b3211f44a88591a1b", "score": "0.59052986", "text": "def create\n @admin_supplier = Admin::Supplier.new(params[:admin_supplier])\n\n respond_to do |format|\n if @admin_supplier.save\n format.html { redirect_to admin_suppliers_url }\n format.json { render json: @admin_supplier, status: :created, location: @admin_supplier }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_supplier.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4bf4d1688a9aea2016c431befd6bf988", "score": "0.5885597", "text": "def set_supplier\n @supplier = Supplier.find(params[:id])\n end", "title": "" }, { "docid": "9bbad68e65383d9016922e9751078e18", "score": "0.58586365", "text": "def create_full_product\n generate_product_name\n generate_product_code\n generate_product_manufacturer\n generate_product_description\n generate_product_price\n end", "title": "" }, { "docid": "a2eb56bb13efdee8f3016e9764b419f6", "score": "0.58256054", "text": "def create\n @supplier = current_user.suppliers.new(supplier_params)\n\n respond_to do |format|\n if @supplier.save\n @supplier.update(uid: \"s_\" + @supplier.id.to_s)\n @dis = @supplier.supplier_name.to_s + '$' + @supplier.supplier_address.to_s + '$' + @supplier.supplier_contact.to_s + '$' + @supplier.supplier_email.to_s\n \n Log.create!(description: @dis, username: current_user.name, uid: \"s_\" + @supplier.id.to_s, user_id: current_user.user_id)\n\n params[:paymentterm_description].each do | payment |\n @pt = PaymentTerm.find(payment)\n @pay = SupplierPaymentTerm.find_by(payment_term_id: payment, supplier_id: @supplier.id)\n if !@pay\n SupplierPaymentTerm.create(payment_term_description: @pt.paymentterm_description, supplier_id: @supplier.id, payment_term_id: payment)\n end\n end\n format.html { redirect_to suppliers_url, notice: 'Supplier was successfully created.' }\n format.json { render :show, status: :created, location: @supplier }\n else\n format.html { render :new }\n format.json { render json: @supplier.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fe04b3c08ee9b207936aa6b581e5b8e4", "score": "0.5823205", "text": "def set_supplier\n @supplier = Supplier.friendly.find(params[:id])\n end", "title": "" }, { "docid": "fc1df395249fdee0224c52d6fe2bd030", "score": "0.58113366", "text": "def new\n # build a 'temporary' post which is written to DB later (create-method)\n @supplier = Supplier.new\n end", "title": "" }, { "docid": "1e352d8bf7246ff533f956c3977a245c", "score": "0.57964873", "text": "def create\n @catalog_supplier = Catalog::Supplier.new(catalog_supplier_params)\n\n respond_to do |format|\n if @catalog_supplier.save\n format.html { redirect_to @catalog_supplier, notice: 'Supplier was successfully created.' }\n format.json { render :show, status: :created, location: @catalog_supplier }\n else\n format.html { render :new }\n format.json { render json: @catalog_supplier.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2908e218f2eddd6ccedeba4157488d5b", "score": "0.5793732", "text": "def supplier()\n sql = \"SELECT * FROM suppliers WHERE id = $1\"\n values = [@supplier_id]\n result = SqlRunner.run(sql, values)[0]\n return Supplier.new(result)\n end", "title": "" }, { "docid": "21c26647e369f0459864797dfa407952", "score": "0.57876295", "text": "def create\n @supplier = Supplier.new(params[:supplier])\n\n respond_to do |format|\n if @supplier.save\n format.html { redirect_to @supplier, notice: 'Supplier was successfully created.' }\n format.json { render json: @supplier, status: :created, location: @supplier }\n else\n format.html { render action: \"new\" }\n format.json { render json: @supplier.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6ab5c14866edd7ad9d5e5221320d1e52", "score": "0.5766706", "text": "def create\n @supplier = Supplier.new(params[:supplier])\n\n respond_to do |format|\n if @supplier.save\n format.html { redirect_to @supplier, :notice => 'Dobavljac je uspjesno kreiran.' }\n format.json { render :json => @supplier, :status => :created, :location => @supplier }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @supplier.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "11e4a83adef6851d1a844610d8ecbdb1", "score": "0.57554764", "text": "def create\n @supplier = Supplier.new(supplier_params)\n #supplier_contact = @supplier.build_contact(contact_params) \n #@address = @supplier.address.new() \n \n #supplier_finance = @supplier.create_finance(finance_params)\n respond_to do |format|\n if @supplier.save #supplier_contact.save #and supplier_address.save and supplier_finance.save\n\n format.html { redirect_to registration_steps_path(supplier_id: @supplier)}\n #format.html { redirect_to @supplier, notice: 'Supplier was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end", "title": "" }, { "docid": "35daaf07196707a2fbbfd64afd54bd3c", "score": "0.57454807", "text": "def create\n @supplier = Supplier.new(supplier_params)\n\n respond_to do |format|\n if @supplier.save\n format.html { redirect_to @supplier, notice: 'Supplier was successfully created.' }\n format.json { render :show, status: :created, location: @supplier }\n else\n format.html { render :new }\n format.json { render json: @supplier.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b2b16f8ea1eab562a6d7d4be56117cb8", "score": "0.573003", "text": "def new\n get_supplier\n @supplier_phone = @supplier.phones.new\n end", "title": "" }, { "docid": "357fd3fdb12ea999b2b343e978640283", "score": "0.5718472", "text": "def create\n @lab_supplier = LabSupplier.new(params[:lab_supplier])\n\n respond_to do |format|\n if @lab_supplier.save\n format.html { redirect_to @lab_supplier, notice: 'Lab supplier was successfully created.' }\n format.json { render json: @lab_supplier, status: :created, location: @lab_supplier }\n else\n format.html { render action: \"new\" }\n format.json { render json: @lab_supplier.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1be01fe56e364c6f74b41239fc21723e", "score": "0.5714773", "text": "def set_product_supplier\n @product_supplier = ProductSupplier.find(params[:id])\n end", "title": "" }, { "docid": "7d4b12214bdc985a6ff5faee3cdd9d41", "score": "0.57136506", "text": "def create\n @catalogs_supplier = Catalogs::Supplier.new(catalogs_supplier_params)\n\n respond_to do |format|\n if @catalogs_supplier.save\n format.html { redirect_to @catalogs_supplier, notice: 'Supplier was successfully created.' }\n format.json { render :show, status: :created, location: @catalogs_supplier }\n else\n format.html { render :new }\n format.json { render json: @catalogs_supplier.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3c304a62878c0cb8465c2918775f8500", "score": "0.5710836", "text": "def set_catalog_supplier\n @catalog_supplier = Catalog::Supplier.find(params[:id])\n end", "title": "" }, { "docid": "961b5dc20a01c27f10e5615d8e44e26e", "score": "0.57084703", "text": "def supplier_name\n supplier.name if supplier\n end", "title": "" }, { "docid": "70b933223947c47b742b65087433bf33", "score": "0.5691525", "text": "def set_catalogs_supplier\n @catalogs_supplier = Catalogs::Supplier.find(params[:id])\n end", "title": "" }, { "docid": "c264516f3acad177a82b921d76314ee6", "score": "0.56906813", "text": "def create_product_data\n\tsave_file(print_products)\n\tproduct_details\nend", "title": "" }, { "docid": "39b67a4cacb8455d77838fa69d723267", "score": "0.5681077", "text": "def create\n @supplier = Supplier.find(params[:supplier_id])\n @product = @supplier.products.build(params[:product])\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @supplier, :notice => 'Product was successfully created.' }\n format.json { render :json => @product, :status => :created, :location => @product }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @product.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4e9e971695c03a67a7171f261062f1eb", "score": "0.56674093", "text": "def get_supplier\n supplier = Supplier.where(:code => self.accountcode).first\n self.supplier_id = supplier.id if supplier\n end", "title": "" }, { "docid": "d3e538d36d06865bd68250d577a7730c", "score": "0.56405294", "text": "def change_supplier(supp_id=nil)\n return if supp_id.nil?\n self.update_attribute(:supplier_id, supp_id)\n\n #if having combis\n combis = OrderProcessing.where(\"combi_id = ?\", self.id)\n unless combis.empty?\n combis.each{|op| op.update_attribute(:supplier_id, supp_id) }\n end\n \n #if having splits\n splitted = OrderProcessing.where(\"parent_order_id = ?\", self.order_id)\n unless splitted.empty?\n splitted.each{|op| op.update_attribute(:supplier_id, supp_id) }\n end\n end", "title": "" }, { "docid": "26d4de748830f9c4060ac2d0c808b6ee", "score": "0.5613317", "text": "def create\n @mt_supplier_data = MtSupplierData.new(params[:mt_supplier_data])\n \n respond_to do |format|\n if @mt_supplier_data.save\n format.js { render :action => \"create_mt_supplier_data\" }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @mt_supplier_data.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "215685cf089230f6697583b87b5ce354", "score": "0.56080806", "text": "def construct(provider)\n self.generate_resources_data(provider.id)\n self.generate_ingredients_data(provider.id)\n self.status = DeploymentRecommendation::UNEVALUATED\n self.save!\n end", "title": "" }, { "docid": "24597b709c5a4197246d66053c704556", "score": "0.56074584", "text": "def create\n @supplier = Supplier.new(params[:supplier])\n\n respond_to do |format|\n if @supplier.save\n format.html { \n redirect_to(medicines_url)\n }\n format.xml { render :xml => @supplier, :status => :created, :location => @supplier }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @supplier.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "35c3ddf816283ba7c883e97c59cc88df", "score": "0.5594787", "text": "def supplier\n # Look in the supplier's table for a supplier with an id that matches supplier_id\n Supplier.find_by(id: supplier_id)\n end", "title": "" }, { "docid": "500119d7539b60fbba61c4ce43996446", "score": "0.55932796", "text": "def create_brand_data\n\tsave_file(print_brands)\n\tbrand_details\nend", "title": "" }, { "docid": "d727ca84c8e7abb6208b7fd6cef94bc8", "score": "0.5591604", "text": "def setup_catalog\n [\n {product_name: 'bamba', photo_url: 'dummy_url1', barcode: 'xxx1', sku: 111, price: 2.23, producer: 'Nestle'},\n {product_name: 'apple', photo_url: 'dummy_url2', barcode: 'xxx2', sku: 555, price: 4.66, producer: 'WFM'},\n {product_name: 'tapu chepse', photo_url: 'dummy_url3', barcode: 'xxx3', sku: 1111444, price: 7.33, producer: 'Nestle'}\n ].each do |data|\n Catalog.create(data)\n end\n end", "title": "" }, { "docid": "b4d10990c18e75e3d3ea5401c74cd590", "score": "0.55897295", "text": "def create\n @oxygen_supplier = OxygenSupplier.new(oxygen_supplier_params)\n\n respond_to do |format|\n if @oxygen_supplier.save\n format.html { redirect_to oxygen_suppliers_url, notice: \"Oxygen supplier was successfully created.\" }\n format.json { render :show, status: :created, location: @oxygen_supplier }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @oxygen_supplier.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e07e76c6ff26127679c5a9e82b7fb117", "score": "0.5587978", "text": "def current_supplier_data\n @current_supplier_data ||= begin\n supplier = supplier_data.data.find { |supplier_item| supplier_item['id'] == supplier_id }.dup\n\n supplier_data.edits.where(supplier_id:).where('created_at <= ?', created_at).order(created_at: :asc).each do |edit|\n if edit.change_type == 'lot_data'\n supplier_lot_data = supplier['lot_data'].find { |lot_data| lot_data['lot_code'] == edit.data['lot_code'] }\n\n lot_data_changes(edit, supplier_lot_data, 'removed', :delete)\n lot_data_changes(edit, supplier_lot_data, 'added', :push)\n else\n edit.data.each { |detail| supplier[detail['attribute']] = detail['value'] }\n end\n end\n\n supplier\n end\n end", "title": "" }, { "docid": "a9942c6f1438606ca27976e18100fe15", "score": "0.5580258", "text": "def set_oxygen_supplier\n @oxygen_supplier = OxygenSupplier.find(params[:id])\n end", "title": "" }, { "docid": "ffabd680bb3d6bdb885fb4613d10a954", "score": "0.55691487", "text": "def create_report\n\tcreate_rep_heading\n \tcreate_product_data\n \tcreate_brand_data\nend", "title": "" }, { "docid": "1b15c99414b9d4b5b6967c16a7d379a0", "score": "0.5558854", "text": "def bulk_generate\n\n end", "title": "" }, { "docid": "8677166ca63db4e915ff03a11d195fed", "score": "0.5556156", "text": "def set_supplier_product\n @supplier_product = SupplierProduct.find(params[:id])\n end", "title": "" }, { "docid": "a9430a15116ad653c1230f4583559abb", "score": "0.55444825", "text": "def create\n\t\t@part = Part.new(params[:part])\n# \t\t@product = Product.find(@part.product_id)\n\t\t@supplier = Supplier.find(params[:supplier_id])\n\t\t\n\t\trespond_to do |format|\n\t\tif @part.save\n\t\t\tformat.html { redirect_to @supplier, notice: t('actions.part.notice.created') }\n\t\t\tformat.json { render json: @part, status: :created, location: @supplier }\n\t\telse\n\t\t\tformat.html { render action: \"new\" }\n\t\t\tformat.json { render json: @part.errors, status: :unprocessable_entity }\n\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "77e5f1a3db887fd853835731dc7e0e69", "score": "0.5533137", "text": "def create_franchises\n 8.times do \n Franchise.create(company_id: Company.all.sample.id, owner_id: Owner.all.sample.id, location: Faker::Address.city, profit: Faker::Number.within(range: -1000.00..1000000.00))\n end\nend", "title": "" }, { "docid": "f0dc242be1aa4eda1f48bf688e895d30", "score": "0.5522423", "text": "def create_from_goodreads(shelf)\n self['Name'] = shelf.name\n self.save\n end", "title": "" }, { "docid": "3b38fd026fe62afcc049181119879e67", "score": "0.5521417", "text": "def set_supplier_item\n @supplier_item = SupplierItem.find(params[:id])\n end", "title": "" }, { "docid": "8c57c4aa95ba1317d95a8e99b4bbeaf5", "score": "0.55196905", "text": "def generate_data\n\t\tgenerate_stations\n\t\tgenerate_demands\n\tend", "title": "" }, { "docid": "604bd1919f482b0afb20de6781e9e7a6", "score": "0.5512517", "text": "def supplier\n Supplier.find_by(:id => supplier_id)\n end", "title": "" }, { "docid": "f08eddbb69357b9e5230ac47be83a7f1", "score": "0.5505644", "text": "def create\n @product_supplier = ProductSupplier.new(product_supplier_params)\n\n respond_to do |format|\n if @product_supplier.save\n format.html { redirect_to @product_supplier, notice: 'Product supplier was successfully created.' }\n format.json { render :show, status: :created, location: @product_supplier }\n else\n format.html { render :new }\n format.json { render json: @product_supplier.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7e576fc88fa7852c520ed28909d3591e", "score": "0.5468296", "text": "def create\n get_supplier\n @supplier_category = @supplier.categories.create(params[:supplier_category])\n end", "title": "" }, { "docid": "1f514aa7a45c8950e3b15828af050454", "score": "0.54678386", "text": "def create\n params.permit!\n @warehouse_supplier = WarehouseSupplier.new(params[:warehouse_supplier])\n\n respond_to do |format|\n if @warehouse_supplier.save\n format.html { redirect_to(@warehouse_supplier, :notice => 'Warehouse supplier was successfully created.') }\n format.xml { render :xml => @warehouse_supplier, :status => :created, :location => @warehouse_supplier }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @warehouse_supplier.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "911615c8c21a5833ff637de5e344375b", "score": "0.5467365", "text": "def is_supplier?\n supplier ? true : false\n end", "title": "" }, { "docid": "6dd05f384f0ee66db70a7c8d03d2fa0f", "score": "0.5464481", "text": "def new\n @object = Spree::Product.new()\n @status = true\n @suppliers = Supplier.all\n end", "title": "" }, { "docid": "46972fa8b94861dc822953c2463cce6e", "score": "0.54637426", "text": "def create_species_and_data\n # Entrance message\n puts \"** Creating new species from lifeviz/ubiota files using hagrid_ubid as the bridge\"\n puts \" Note! New species are species with data imported from lifeviz. Orphaned species \"\n puts \" are ubiota species with no associated lifeviz data.\"\n new_species = []\n orphaned_species = []\n \n # Open files\n lifeviz, ubiota, map = nil\n seed \"Opening data files\" do\n lifeviz = IO.popen(\"bunzip2 -c #{LIFEVIZ}\")\n ubiota = IO.popen(\"bunzip2 -c #{UBIOTA}\")\n map = IO.readlines(LIFEVIZ_UBIOTA)\n lifeviz && ubiota && map ? true : false\n end\n\n # Dump all species\n seed \"Removing existing species.\"\n progress \"Deleting\", Species.count do |progress_bar|\n Species.all.each do |species|\n species.delete\n progress_bar.inc\n end\n end\n\n # Dump all related data\n seed \"Removing any existing age, litter sizes, adult weights, birth weights data\" do\n Lifespan.delete_all && LitterSize.delete_all && AdultWeight.delete_all && BirthWeight.delete_all ? true : false\n end\n\n # Load taxon from lifeviz, let's use hpricot\n lifeviz_species, lifeviz_ages, lifeviz_development, lifeviz_refs = nil\n seed \"Loading lifeviz data with hpricot\" do\n doc = Hpricot::XML(lifeviz)\n lifeviz_species = (doc/'names')\n lifeviz_ages = (doc/'age')\n lifeviz_development = (doc/'development')\n lifeviz_refs = (doc/'refs')\n (lifeviz_species.size > 0 && lifeviz_ages.size > 0 && lifeviz_development.size > 0 && lifeviz_refs.size > 0) ? true : false\n end\n notice \"#{lifeviz_species.size} species loaded with #{lifeviz_ages.size} ages\"\n\n # Create new species array to load lifeviz species and attributes we want\n seed \"Loading new species and storing lifeviz data from lifeviz dump\"\n development_index = ref_index = 0\n progress \"Storing\", lifeviz_species.length do |progress_bar|\n lifeviz_species.each_with_index do |s, index|\n hagrid = (s/'id_hagr').inner_html.to_i\n x = {}\n x[:synonyms] = (s/'name_common').inner_html\n x[:age] = (lifeviz_ages[index]/'tmax').inner_html\n x[:context] = (lifeviz_ages[index]/'phenotype').inner_html\n x[:hagrid] = hagrid\n x[:references] = x[:context].scan(/\\[(\\d*)\\]/).flatten\n \n while lifeviz_development[development_index] && (lifeviz_development[development_index]/'hagrid').inner_html.to_i < hagrid\n notice \"#{(lifeviz_development[development_index]/'hagrid').inner_html} is less than #{hagrid}\"\n development_index += 1\n end\n # development attributes matches the current species id\n if lifeviz_development[development_index] && (lifeviz_development[development_index]/'hagrid').inner_html.to_i == hagrid\n development = lifeviz_development[development_index]\n if development && (development/'hagrid').inner_html.to_i == hagrid\n x[:adult_weight] = (development/'adult_weight').inner_html.blank? ? \"\" : (development/'adult_weight').inner_html.to_f\n x[:birth_weight] = (development/'birth_weight').inner_html.blank? ? \"\" : (development/'birth_weight').inner_html.to_f\n x[:litter_size] = (development/'litter_size').inner_html.blank? ? \"\" : (development/'litter_size').inner_html.to_f\n else\n x[:adult_weight] = \"\"\n x[:birth_weight] = \"\"\n x[:litter_size] = \"\"\n end\n development_index += 1\n end\n new_species << x\n progress_bar.inc\n end\n end\n notice \"#{new_species.length} new species stored\"\n\n # Load ubid ids into new species from mapping\n seed \"Loading mapped ubiota ids into new species\" do\n new_species_pointer = 0\n map.each do |line|\n hagrid, ubid = line.split(/\\s+/)\n while new_species[new_species_pointer] && hagrid.to_i != new_species[new_species_pointer][:hagrid]\n new_species_pointer += 1\n end\n new_species[new_species_pointer][:ubid] = ubid.to_i if new_species[new_species_pointer]\n end\n end\n\n # Remove any new species that have no ubid from mapping\n count = new_species.size\n seed \"Delete any new species that do not have a ubiota id mapped\", \n :success => \"Mappings completed\", \n :failure => \"No species had mappings\" do\n new_species.delete_if { |species| species[:ubid] == nil }\n new_species.length != 0 ? true : false\n end\n notice \"deleted #{count - new_species.size} species, #{new_species.size} remaining\"\n\n # Sort species by ubid\n seed \"Sorting new species by ubid\" do\n new_species = new_species.sort_by { |each| each[:ubid] }\n true\n end\n\n # Find and load ubiota genus ids and species name for each species\n # Ensure the rank is 6 (species level)\n # Set taxon_id to nil if the species inside ubiota doesn't exist\n seed \"Looking up and loading each new species' genus id from the ubiota data\"\n x = 0\n a_couple = 0\n num_lines = num_lines_bz2(UBIOTA)\n progress \"Matching\", num_lines do |progress_bar|\n ubiota.each do |line|\n id, term, rank, hierarchy, parent_id, num_children, hierarchy_ids = line.split(\"|\")\n # skip if we're not looking at a species level taxon\n if rank.to_i != 6\n progress_bar.inc\n next\n end\n if new_species[x].nil? || id.to_i != new_species[x][:ubid]\n y = {:taxon_id => parent_id.to_i, :name => term.to_s}\n orphaned_species << y\n if !new_species[x].nil? then new_species[x][:taxon_id] = nil end\n if !new_species[x].nil? && id.to_i > new_species[x][:ubid] then x += 1 end\n else\n new_species[x][:taxon_id] = parent_id.to_i\n new_species[x][:name] = term.to_s\n x += 1\n end\n progress_bar.inc\n end\n end\n notice \"traversed #{x} new species and #{orphaned_species.size} orphaned species\"\n\n # Remove any new species that has no genus in ubiota\n count = new_species.size\n seed \"Delete any species that had no genus id\" do\n new_species.delete_if { |species| species[:taxon_id] == nil }\n end\n notice success_string(\"deleted #{count - new_species.size} species, #{new_species.size} remaining\")\n\n # Remove any orphaned species that has no genus in ubiota\n count = orphaned_species.size\n seed \"Delete any orphaned species that had no genus id\" do\n orphaned_species.delete_if { |species| species[:taxon_id] == 0 }\n end\n notice success_string(\"deleted #{count - orphaned_species.size} species, #{orphaned_species.size} remaining\")\n\n # Create species with all the new species stored in memory\n count = species_without_parents = 0\n seed \"Saving all of the new species.\"\n\n progress \"Species\", new_species.length do |progress_bar|\n new_species.each_with_index do |taxon, index|\n s = new_species[index]\n species = Taxon.new(:name => s[:name], :parent_id => s[:taxon_id], :rank => 6, :id => s[:ubid])\n species.send(:create_without_callbacks)\n # # This was commented out because we're using Cera's lifespan data now.\n # unless s[:age].blank?\n # s[:references].each do |reference_id|\n # lifespan = Lifespan.new(:value_in_days => (s[:age].to_f * 365), :units => \"Years\", :species_id => species.id)\n # lifespan.context = s[:context]\n # lifespan.citation = Reference.find(reference_id).to_s\n # lifespan.created_by = ANAGE_USER_ID\n # lifespan.created_by_name = ANAGE_USER_NAME\n # lifespan.send(:create_without_callbacks)\n # end\n # end\n BirthWeight.new(\n :value_in_grams => (s[:birth_weight]),\n :units => \"Grams\",\n :species_id => species.id,\n :created_by => ANAGE_USER_ID,\n :created_by_name => ANAGE_USER_NAME\n ).send(:create_without_callbacks) unless s[:birth_weight].blank?\n AdultWeight.new(\n :value_in_grams => (s[:adult_weight]),\n :units => \"Grams\",\n :species_id => species.id,\n :created_by => ANAGE_USER_ID,\n :created_by_name => ANAGE_USER_NAME\n ).send(:create_without_callbacks) unless s[:adult_weight].blank?\n LitterSize.new (\n :value => (s[:litter_size]),\n :species_id => species.id,\n :created_by => ANAGE_USER_ID,\n :created_by_name => ANAGE_USER_NAME\n ).send(:create_without_callbacks) unless s[:litter_size].blank?\n count = index\n progress_bar.inc\n end\n end\n notice success_string(\"saved #{count - species_without_parents} species\")\n notice success_string(\"saved #{Lifespan.count} ages\")\n notice success_string(\"saved #{AdultWeight.count} adult weights\")\n notice success_string(\"saved #{BirthWeight.count} birth weights\")\n notice success_string(\"saved #{LitterSize.count} litter sizes\")\n notice failure_string(\"#{species_without_parents} species didn't have taxons matching taxon_id in our database\") if species_without_parents != 0\n\n # Create orphaned species with all the species stored in memory\n count = 0\n species_without_parents = 0\n seed \"Saving all the orphaned species\"\n progress \"Saving orphans\", orphaned_species.length do |progress_bar|\n orphaned_species.each_with_index do |s, index|\n taxon = Taxon.find_by_id(s[:taxon_id])\n if taxon == nil\n # notice failure_string(\"no taxon found with an id of #{s[:taxon_id].to_s} for species with ubid of #{s[:ubid].to_s}\")\n species_without_parents += 1\n else\n species = Taxon.new(:name => s[:name], :parent_id => taxon.id, :rank => 6)\n species.send(:create_without_callbacks)\n end\n count = index\n progress_bar.inc\n end\n end\n notice success_string(\"Phew!... saved #{count - species_without_parents} species\")\n notice failure_string(\"#{species_without_parents} species didn't have taxons matching taxon_id in our database\") if species_without_parents != 0\n\n seed \"Rebuilding heirarchical tree\" do\n Taxon.rebuild!\n end\n\n seed \"Vacuuming database\" do\n SQL.execute \"VACUUM ANALYZE;\"\n end\n\n notice \"Species creation is completed.\"\nend", "title": "" }, { "docid": "6f1bed3ff845510a0cc6baf0232a4d9c", "score": "0.5459686", "text": "def supplier_params\n params.require(:supplier).permit(:name, :address, :contact_person, :phone, :business_field, :management_system)\n end", "title": "" }, { "docid": "4a68be3ee8f0d166bd84a53772acef5b", "score": "0.5444379", "text": "def setup_broker_requests(broker)\n broker.license_type.each_with_index do |l,index| \n license=broker.licenses.create(license_type:l,license_number:\"test#{index}\")\n license.license_image=(Rails.root+\"spec/fixtures/test_files/example_license.pdf\").open\n license.save\n end\n \n @license1=License.all.first\n @license2=License.all.second\n broker.broker_requests.create(request_type:\"create account\",complement:false) \n broker.reload\n broker.licenses.each do |l|\n broker.broker_requests.create(request_type:\"create license\", license_id:l.id,complement:true,admin_reply:nil)\n end\n\nend", "title": "" }, { "docid": "a13d743da07da64751153d6b5977acaf", "score": "0.542703", "text": "def supplier_params\n params.require(:supplier).permit(:name, :num_doc, :type_doc_id)\n end", "title": "" }, { "docid": "a25f10a312e56206e977b4d8fb6c49d5", "score": "0.542623", "text": "def make_vendor index, rep_key, company_key\n %{INSERT INTO vendors VALUES (#{index}, #{rep_key}, #{company_key});}\nend", "title": "" }, { "docid": "a58e40c87f02139499a1543c9e26b977", "score": "0.5406308", "text": "def create_product(prod)\n\n purchase_price = BigDecimal.new(\"0.0\")\n purchase_price = BigDecimal.new(prod['purchase_price'].to_s) unless prod['purchase_price'].nil?\n sales_price = nil\n sales_price = BigDecimal.new(prod['sales_price']) unless prod['sales_price'].nil?\n weight = 0\n weight = prod['weight'].to_f unless prod['weight'].nil?\n manufacturer_product_code = prod['manufacturer_product_code']\n stock = prod['stock'].to_i unless prod['stock'].nil?\n\n tax_percentage = prod['tax_percentage'] || 8.0\n tax_class = TaxClass.where(:percentage => tax_percentage).first unless tax_percentage.nil?\n if tax_class.nil?\n tax_class = TaxClass.create(:percentage => 8.0, :name => \"8.0\")\n end\n\n prod['description'].blank? ? description = \"No description\" : description = prod['description']\n \n is_featured = false\n is_featured = true if [\"yes\", \"true\", \"1\"].include?(prod['featured'])\n is_visible = true\n is_visible = false if [\"no\", \"false\", \"0\"].include?(prod['visible'])\n is_build_to_order = false\n is_build_to_order = true if [\"yes\", \"true\", \"1\"].include?(prod['build_to_order'])\n \n supplier = Supplier.find_by_name(prod['supplier'])\n\n product = Product.where(:name => prod['name'],\n :description => description,\n :weight => weight,\n :sales_price => sales_price,\n :supplier_id => supplier,\n :tax_class_id => tax_class,\n :purchase_price => purchase_price,\n :manufacturer_product_code => manufacturer_product_code,\n :is_featured => is_featured,\n :is_visible => is_visible,\n :is_build_to_order => is_build_to_order,\n :stock => stock).first\n if product.nil?\n product = Product.create(:name => prod['name'],\n :description => description,\n :weight => weight,\n :sales_price => sales_price,\n :supplier => supplier,\n :tax_class => tax_class,\n :purchase_price => purchase_price,\n :manufacturer_product_code => manufacturer_product_code,\n :is_featured => is_featured,\n :is_visible => is_visible,\n :is_build_to_order => is_build_to_order,\n :stock => stock)\n end\n if prod['category']\n category = Category.where(:name => prod['category']).first\n category = Category.create(:name => prod['category']) if category.nil?\n product.categories << category\n product.save\n end\n\n\n # Ugly, but at least it makes test authors know what went wrong\n if product.errors.empty?\n return product\n else\n puts \"Errors creating product: #{product.errors.full_messages}\"\n return false\n end\nend", "title": "" }, { "docid": "9b322b463aad647cc93a8be48a1dbac7", "score": "0.53660154", "text": "def supplier_params\n params.require(:supplier).permit(:supplier_name, :supplier_address, :supplier_contact, :supplier_email, :user_id)\n end", "title": "" }, { "docid": "00b89c3a8286d0880f9fadc8b912b092", "score": "0.53642523", "text": "def creator\n productlist = ProductList.find(self.product_list_id)\n\n self.update_columns(subtotal: productv.price * self.pieces,\n taxes: productv.taxes * self.pieces,\n codcharges: 0 * self.pieces,\n shipping: productv.shipping * self.pieces,\n total: productv.total * self.pieces,\n description: productv.name) # This will skip validation gracefully.\n\n self.update(description: productlist.productlistdetails)\n\n #updateOrder\n end", "title": "" }, { "docid": "2817d7ae52bf3881f08f35a7a5d02412", "score": "0.5346977", "text": "def manufacture; end", "title": "" }, { "docid": "5bbb0e31ffbeb98c7d35df7b4b2befbf", "score": "0.5345576", "text": "def create_some_data\n\t\tSunspot.remove_all!\t\t\t\t\t#\tisn't always necessary\n\t\tStudySubject.solr_reindex\n\t\tassert StudySubject.search.hits.empty?\n\t\tsubject1 = FactoryBot.create(:complete_case_study_subject)\n\t\tFactoryBot.create(:sample, :study_subject => subject1,\n\t\t\t:sample_type => SampleType['marrowdiag'])\n\t\tsubject2 = FactoryBot.create(:complete_case_study_subject)\n\t\tFactoryBot.create(:sample, :study_subject => subject2,\n\t\t\t:sample_type => SampleType['periph'])\n\t\tStudySubject.solr_reindex\n\t\tassert !StudySubject.search.hits.empty?\n\tend", "title": "" }, { "docid": "d75763777759ce12170948cc3a090a13", "score": "0.534122", "text": "def add_provenance(microtiter_plate:, pooling_groups:)\n pooling_groups.each do |pooling_group|\n microtiter_plate.associate_provenance_next_empty(\n key: :specimens,\n data: pooling_group.map { |item| hash_data(item) }\n )\n end\n microtiter_plate\n end", "title": "" }, { "docid": "adada3e446c2705dff1bc2457b5a38b1", "score": "0.53399646", "text": "def create_shop_source(unlock, type, text)\n unless unlock.sources.any?\n unlock.sources.create!(type: type, text: text)\n end\nend", "title": "" }, { "docid": "961a96c81c97937843e858ffc4f5e8a6", "score": "0.5330775", "text": "def create_with_distributors(id, distributors)\n create_with_importer_and_distributors(id, nil, distributors)\n end", "title": "" }, { "docid": "f4e34691449ed0b6904750b4cdefd0e7", "score": "0.5328341", "text": "def supplier?\n supplier.present?\n end", "title": "" }, { "docid": "f9d979b3c08e5523bfca75936850b3e5", "score": "0.5325895", "text": "def valid_create?\n param! :supplier, Hash, required: true, blank: false do |s|\n s.param! :name, String, required: true, blank: false\n s.param! :status, String, in: ['active', 'inactive'], default: 'active'\n s.param! :metadata, Hash\n s.param! :types, Array\n end\n end", "title": "" }, { "docid": "fe2e54b9d8fd12d5e7ece8f9b77de243", "score": "0.5322634", "text": "def create\n @mt_supplier_part_data = MtSupplierPartData.new(params[:mt_supplier_part_data])\n \n respond_to do |format|\n if @mt_supplier_part_data.save\n format.js { render :action => \"create_mt_supplier_part_data\" }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @mt_supplier_part_data.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5e250297ba03976e2e8887809be4198f", "score": "0.5320188", "text": "def run\n super\n create_easy_type_source\n create_simple_provider_source\n create_name_attribute_source\n end", "title": "" }, { "docid": "4f34612d3f52ca5e9e2964d99df9a8aa", "score": "0.53187764", "text": "def createconsensus\n end", "title": "" }, { "docid": "9b533319738be875bfd815e1aaa805cb", "score": "0.5316583", "text": "def set_supplier_provider\n @supplier_provider = Supplier::Provider.find(params[:id])\n end", "title": "" }, { "docid": "68d0106a7ece8b1f30dba60571c431da", "score": "0.5314863", "text": "def create_protonym_from_hol reference, name, author, journal, hol_taxon\n\n end", "title": "" }, { "docid": "dd72658952af88375893152b20f524be", "score": "0.5309543", "text": "def generate_data!\n start_dir = Dir.pwd\n \n Dir.chdir tool_path\n system \"./generate -pc #{product_factor} -fn #{filename} -fc\"\n ensure\n Dir.chdir start_dir\n end", "title": "" }, { "docid": "58494496b2efafeb5cbb0aa7e82e9a18", "score": "0.53043026", "text": "def parse_products\n\n # This next method should be called for each product from the supplier\n # This block is used to improve error messages. When you set pd.supplier_num, if there is an error anywhere in the block the message will include the supplier_num\n ProductDesc.apply(self) do |pd|\n # Any ValidateError raised in the ProductDesc.apply block will be caught and added to a list of errors\n # A summary of all errors will be given after this method is complete\n # you can also use warning('name', 'data') which will also be summarised in the same way.\n\n pd.supplier_num = nil # Required - string. Unique product identifier provided by the supplier\n pd.name = nil # Required - string. Name of the product\n pd.description = [] # Required - string or array. If this is an array it will be turned into a string separated by \\n newlines.\n pd.data = nil # Optional - hash. Additional arbitrary data that doesn't fit anywhere else. Usually not used\n pd.supplier_categories = [['Bags', 'Tote Bags']] # List of categories this product belongs to as the supplier specifies. Each category is itself a list as categories typically form a hierarchy and this list represents the path\n\n pd.tags = [] # List of tags for this product Should be one of Special, MadeInUSA, Eco, Closeout, New or Kosher. Can create new tags if needed but must have an associated icon.\n \n pd.lead_time.normal_min = nil # Optional - integer. The minimum time required to produce this product\n pd.lead_time.normal_max = nil # Optional - integer. The maximum time required to produce this product\n pd.lead_time.rush = nil # Optional - integer. The time required for a rush order, usually less than normal_min\n pd.lead_time.rush_charge = nil \n\n pd.package.units = nil # Optional - integer. Number of products in a single package\n pd.package.weight = nil # Optional - float. Weight in pounds (lbs) of a single package\n pd.package.height = nil # Optional - float. Dimensions of package in inches (in)\n pd.package.width = nil\n pd.package.length = nil\n\n # List of DecorationDesc objects representing each decoration type and location\n pd.decorations = [DecorationDesc.none]\n pd.decorations << DecorationDesc.new(:technique => technique, # Array of strings representing a technique already in the database\n :location => location, # string describing the location of the decoraiton\n :limit => limit) # The maximum number of units (typically colors) for this decoration\n # The pricing for each technique must be specified for each supplier separately typically in a decorations.rb file\n # A pricing definition for a decoration can be created with get_decoration that will return a valid value for the :technique property of DecorationDesc\n # This is only used when the decoration price is specified for each product. Many times the price for a decoration will be the same for all products and not in the product data.\n pd.decorations << DecorationDesc.new(:technique => get_decoration(technique, fixed_price, marginal_price),\n :location => location,\n :limit => limit,\n :height => height,\n :width => width,\n )\n\n # List of ImageNodeFetch objects representing all the images for this product that are not specific to a product variant\n pd.images = [ImageNodeFetch.new(unique_image_identifier, image_url, optional_image_tag)]\n\n # Hash of properties common to all product variants. If a property is specific to a variant it can be specified with a VariantDesc object in the same way\n # Common properties are\n # dimension - dimension or size of the object\n # color - color of the product or variant\n # swatch - image representing the color of the product (ImageNodeFetch object)\n # memory - capacity of USB flash drive\n # You can specify any property name and value string\n pd.properties['dimension'] = parse_dimension(dimension_string)\n\n\n # PricingDesc object representing the price of this product.\n # Either use pd.pricing for set the pricing for each variant but not both\n pd.pricing \n\n # Use this to add a price column to the pricing object\n pd.pricing.add(quantity, price, optional_code, optional_rounding_if_code) \n pd.pricing.apply_code(code) # Generate costs from a multi column discount code\n pd.pricing.ltm(charge, optional_quantity) # Set less than miniumum charge and quantity\n pd.pricing.maxqty(optional_quantity) # Set the maximum quantity\n pd.pricing.eqp(optional_discount, optional_round) # Set costs as end quantity pricing from the price data\n pd.pricing.eqp_costs # Set costs as end quantity pricing from the cost data.\n \n\n # pd.variants is a list of VariantDesc object describing each product variant (typically different colors)\n pd.variants = object.collect do |obj|\n vd = VariantDesc.new(:supplier_num => variant_supplier_num)\n vd.images = [] # List of ImageNodeFetch objects specific to this variant just like pd.images\n vd.properties['color'] = color # Hash of properties specific to this variant just like pd.properties\n\n vd.pricing # Optional. Either use variant pricing or product pricing but not both\n end\n end\n end", "title": "" }, { "docid": "3d4e0c94710e6b85807d075e46c7d0c8", "score": "0.5300831", "text": "def create; end", "title": "" }, { "docid": "3d4e0c94710e6b85807d075e46c7d0c8", "score": "0.5300831", "text": "def create; end", "title": "" }, { "docid": "3d4e0c94710e6b85807d075e46c7d0c8", "score": "0.5300831", "text": "def create; end", "title": "" }, { "docid": "3d4e0c94710e6b85807d075e46c7d0c8", "score": "0.5300831", "text": "def create; end", "title": "" }, { "docid": "d0078c4da7e69222d7499d8e727714ce", "score": "0.5299812", "text": "def set_supplier_package\n @supplier_package = SupplierPackage.find(params[:id])\n end", "title": "" }, { "docid": "27df7f95ad1759706ad8f86b8a2e7cd5", "score": "0.5299507", "text": "def new\n @supplier = Supplier.new\n 1.times { @supplier.phones.build }\n 1.times { @supplier.emails.build }\n 1.times { @supplier.addresses.build }\n #@phone = Phone.new\n #@email = Email.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @supplier }\n end\n end", "title": "" }, { "docid": "678a59e3abd0cb63bed3c66dd34b8ec1", "score": "0.52944803", "text": "def create\n @integration_store = IntegrationStore.new(integration_store_params.merge(supplier: current_user))\n\n respond_to do |format|\n if @integration_store.save\n format.html { redirect_to @integration_store, notice: 'Integration store was successfully created.' }\n else\n format.html { render :new, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b32b66b23ee739de375d46a86131bf49", "score": "0.52905375", "text": "def create\n @fabric_variant_supplier = FabricVariantSupplier.new(fabric_variant_supplier_params)\n\n respond_to do |format|\n if @fabric_variant_supplier.save\n format.html { redirect_to @fabric_variant_supplier, notice: 'Fabric variant supplier was successfully created.' }\n format.json { render :show, status: :created, location: @fabric_variant_supplier }\n else\n format.html { render :new }\n format.json { render json: @fabric_variant_supplier.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
8e0d0a3e8447aab58d0fda89a1f6e8c5
PATCH/PUT /system_organ_classes/1 PATCH/PUT /system_organ_classes/1.json
[ { "docid": "97dd93cca388798b8eea57847eed2379", "score": "0.76575136", "text": "def update\n respond_to do |format|\n if @system_organ_class.update(system_organ_class_params)\n format.html { redirect_to @system_organ_class, notice: 'System organ class was successfully updated.' }\n format.json { render :show, status: :ok, location: @system_organ_class }\n else\n format.html { render :edit }\n format.json { render json: @system_organ_class.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "40ffdc4b484c12a3fdfffc4f540ed0dd", "score": "0.6664275", "text": "def update\n @sclass = Sclass.find(params[:id])\n\n respond_to do |format|\n if @sclass.update_attributes(params[:sclass])\n format.html { redirect_to admin_orgs_url, notice: t('admin.orgs.update_class_success') }\n format.json { head :ok }\n else\n format.html { render action: \"edit_class\" }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f6b75521c5e0a0dcd8b6c9588578f770", "score": "0.6661747", "text": "def set_system_organ_class\n @system_organ_class = SystemOrganClass.find(params[:id])\n end", "title": "" }, { "docid": "8f2114621a5e6df79e0a674de485b227", "score": "0.6638517", "text": "def update\r\n @sclass = Sclass.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @sclass.update_attributes(params[:sclass])\r\n format.html { redirect_to admin_orgs_url, notice: t('admin.orgs.update_class_success') }\r\n format.json { head :ok }\r\n else\r\n format.html { render action: \"edit_class\" }\r\n format.json { render json: @school.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "title": "" }, { "docid": "126da0882dcf0795bdbc2c3550a33002", "score": "0.65700066", "text": "def update\n respond_to do |format|\n if @organisation_class.update(organisation_class_params)\n format.html { redirect_to @organisation_class, notice: 'Organisation class was successfully updated.' }\n format.json { render :show, status: :ok, location: @organisation_class }\n else\n format.html { render :edit }\n format.json { render json: @organisation_class.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "47cc0373e0b06c247db2070de1880c09", "score": "0.6426552", "text": "def update\n unless current_user.admin?\n params[:class_org][:user_id] = current_user.id\n end\n respond_to do |format|\n if @class_org.update(class_org_params)\n format.html { redirect_to return_path, notice: \"Class Org was successfully updated.\" }\n format.json { render :show, status: :ok, location: @class_org }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @class_org.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a382949d7f559bb9f796d116d01c2dc1", "score": "0.63797647", "text": "def update\n @klass = @organisation.klasses.find(params[:id])\n\n respond_to do |format|\n if @klass.update_attributes(params[:klass])\n format.html { redirect_to [@organisation, @klass], notice: 'Klass was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @klass.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7b8e37e14e4d5844073e2fb5f2bd812a", "score": "0.6236502", "text": "def update\n respond_to do |format|\n if @classtype.update(classtype_params)\n format.html { redirect_to @classtype, notice: 'Classtype was successfully updated.' }\n format.json { render :show, status: :ok, location: @classtype }\n else\n format.html { render :edit }\n format.json { render json: @classtype.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5dc36273fe46c4bec375fa642a763756", "score": "0.6202956", "text": "def update\n respond_to do |format|\n if @sclass.update(sclass_params)\n format.html { redirect_to @sclass, notice: 'Sclass was successfully updated.' }\n format.json { render :show, status: :ok, location: @sclass }\n else\n format.html { render :edit }\n format.json { render json: @sclass.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3e7e7bfe1d9adceb78395f31354dbb8a", "score": "0.6121666", "text": "def update\n #@clazz.department_id = params[:clazz][:department_id]\n #@clazz.class_code = @clazz.level.to_s + Department.find(@clazz.department_id).dept_code\n respond_to do |format|\n if @clazz.update(clazz_params)\n format.html { redirect_to @clazz, notice: 'Clazz was successfully updated.' }\n format.json { render :show, status: :ok, location: @clazz }\n else\n format.html { render :edit }\n format.json { render json: @clazz.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a3ef184794b9fd850af0aac6e90a60c5", "score": "0.611742", "text": "def update\n @jclsclass = Jclsclass.find(params[:id])\n\n respond_to do |format|\n if @jclsclass.update_attributes(params[:jclsclass])\n format.html { redirect_to @jclsclass, notice: 'Jclsclass was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @jclsclass.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0f924717433a3469958f1dd0d040a700", "score": "0.6025495", "text": "def create\n @system_organ_class = SystemOrganClass.new(system_organ_class_params)\n\n respond_to do |format|\n if @system_organ_class.save\n format.html { redirect_to @system_organ_class, notice: 'System organ class was successfully created.' }\n format.json { render :show, status: :created, location: @system_organ_class }\n else\n format.html { render :new }\n format.json { render json: @system_organ_class.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "340883182a41a5c122e9f20f2f13aeb3", "score": "0.6004571", "text": "def update\n respond_to do |format|\n if @special_class.update(special_class_params)\n format.html { redirect_to @special_class, notice: 'Se actualizó la clase particular satisfactoriamente.' }\n format.json { render :show, status: :ok, location: @special_class }\n else\n format.html { render :edit }\n format.json { render json: @special_class.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "df102143b77405ae1bc2f0d384f19349", "score": "0.5982197", "text": "def update\n @clasification = Clasification.find(params[:id])\n\n respond_to do |format|\n if @clasification.update_attributes(params[:clasification])\n format.html { redirect_to @clasification, notice: 'Clasification was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @clasification.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "93187533d804070a0d745748cb4378e8", "score": "0.592989", "text": "def update\n @incident_class = IncidentClass.find(params[:id])\n\n respond_to do |format|\n if @incident_class.update_attributes(params[:incident_class])\n format.html { redirect_to @incident_class, notice: 'Incident class was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @incident_class.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9dc888cf147456a2568e841c3724e878", "score": "0.58957446", "text": "def update\n respond_to do |format|\n if @t_as_class.update(t_as_class_params)\n format.html { redirect_to @t_as_class, notice: 'T as class was successfully updated.' }\n format.json { render :show, status: :ok, location: @t_as_class }\n else\n format.html { render :edit }\n format.json { render json: @t_as_class.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d61a25d69ed10b03601d4f17ba7d9ef3", "score": "0.58895993", "text": "def update\n #RAILS_DEFAULT_LOGGER.debug(\"******** REST Call to CRMS: Updating #{self.class.name}:#{self.id}\")\n #RAILS_DEFAULT_LOGGER.debug(caller[0..5].join(\"\\n\")) \n response = connection.put(element_path(prefix_options), to_xml, self.class.headers)\n save_nested\n load_attributes_from_response(response)\n merge_saved_nested_resources_into_attributes\n response\n end", "title": "" }, { "docid": "2fcbadeedaf8cc5ef4e81d9ad2a8d677", "score": "0.5856076", "text": "def update\n respond_to do |format|\n if @classtime.update(classtime_params)\n format.html { redirect_to @classtime, notice: 'Classtime was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @classtime.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4aefc2fbfa8352d05616c0ba573129b1", "score": "0.58138794", "text": "def update\n respond_to do |format|\n if @classrom.update(classrom_params)\n format.html { redirect_to @classrom, notice: 'Classrom was successfully updated.' }\n format.json { render :show, status: :ok, location: @classrom }\n else\n format.html { render :edit }\n format.json { render json: @classrom.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7bc36147d7793b42c588f0177e9c2765", "score": "0.5804167", "text": "def update\n respond_to do |format|\n if @objeto.update(clasificacion_params)\n format.html { redirect_to @objeto, notice: 'Clasificacion was successfully updated.' }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f3dfc7b98e328b392cca8c53cd7a4315", "score": "0.58002967", "text": "def update\n @breadcrumb = 'update'\n @complaint_class = ComplaintClass.find(params[:id])\n @complaint_class.updated_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @complaint_class.update_attributes(params[:complaint_class])\n format.html { redirect_to @complaint_class,\n notice: (crud_notice('updated', @complaint_class) + \"#{undo_link(@complaint_class)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @complaint_class.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1f9021cfdb86f220158186a156de5c8b", "score": "0.5781956", "text": "def update\n respond_to do |format|\n if @pathfinder_class.update(pathfinder_class_params)\n format.html { redirect_to @pathfinder_class, notice: 'Pathfinder class was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pathfinder_class.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a500b31ed9cb54869ece7a40a3990fb4", "score": "0.5769103", "text": "def update\n @class_group = ClassGroup.find(params[:id])\n\n respond_to do |format|\n if @class_group.update_attributes(params[:class_group])\n format.html { redirect_to @class_group, notice: 'Class group was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @class_group.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c7511a0d3bb550cc0da771955adcb869", "score": "0.57607424", "text": "def update\n @clazz = Clazz.find(params[:id])\n\n respond_to do |format|\n if @clazz.update_attributes(params[:clazz])\n format.html { redirect_to @clazz, notice: 'Clazz was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @clazz.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6a558226d0fdabbcbc8a4d2f184bd1c5", "score": "0.57573766", "text": "def update\n respond_to do |format|\n if @clasificacion.update(clasificacion_params)\n format.html { redirect_to @clasificacion, notice: 'Clasificacion was successfully updated.' }\n format.json { render :show, status: :ok, location: @clasificacion }\n else\n format.html { render :edit }\n format.json { render json: @clasificacion.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "17816aa970f1a3df58c6ea8dc8071f1d", "score": "0.574539", "text": "def system_organ_class_params\n params.require(:system_organ_class).permit(:soc_code)\n end", "title": "" }, { "docid": "38116a3c2ed5631d8983071b234553c1", "score": "0.5731894", "text": "def set_class_org\n @class_org = ClassOrg.find(params[:id])\n end", "title": "" }, { "docid": "9acf40ac43ee50c2afefc73a18c797bd", "score": "0.57205445", "text": "def update\n respond_to do |format|\n if @api_v1_base_class.update(api_v1_base_class_params)\n format.html { redirect_to @api_v1_base_class, notice: 'Base class was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_base_class }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_base_class.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e5c7619230fbc1c435225603cbe13771", "score": "0.5708684", "text": "def update\n respond_to do |format|\n if @class1.update(class1_params)\n format.html { redirect_to @class1, notice: 'Class1 was successfully updated.' }\n format.json { render :show, status: :ok, location: @class1 }\n else\n format.html { render :edit }\n format.json { render json: @class1.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fc958d157ea8a76c7dc4ac943834ffd8", "score": "0.57044184", "text": "def update\n respond_to do |format|\n if @class_group.update(class_group_params)\n format.html { redirect_to @class_group, notice: 'Class group was successfully updated.' }\n format.json { render :show, status: :ok, location: @class_group }\n else\n format.html { render :edit }\n format.json { render json: @class_group.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fe6509c81c982a30fbc782f3b15d443f", "score": "0.56950945", "text": "def update\n @yoga_class = YogaClass.find(params[:id])\n\n respond_to do |format|\n if @yoga_class.update_attributes(params[:yoga_class])\n format.html { redirect_to @yoga_class, notice: 'Yoga class was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @yoga_class.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f544581f71d01243dc501b867b12c4cc", "score": "0.56879", "text": "def update\n @classgroup = Classgroup.find(params[:id])\n\n respond_to do |format|\n if @classgroup.update_attributes(params[:classgroup])\n format.html { redirect_to @classgroup, notice: 'Classgroup was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @classgroup.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fc8d023c6e3711a98ce6b7f784251125", "score": "0.5686145", "text": "def update\n @gclass = Gclass.find(params[:id])\n\n respond_to do |format|\n if @gclass.update_attributes(params[:gclass])\n format.html { redirect_to @gclass, notice: 'Gclass was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gclass.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c30366a0900342bcae3f0557f2234491", "score": "0.566568", "text": "def update\n @security_class = SecurityClass.find(params[:id])\n\n respond_to do |format|\n if @security_class.update_attributes(params[:security_class])\n format.html { redirect_to @security_class, notice: 'Security class was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @security_class.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c640622728045181130fcb6f54583880", "score": "0.56638443", "text": "def update\n @discipline_class = DisciplineClass.find(params[:id])\n\n respond_to do |format|\n if @discipline_class.update_attributes(params[:discipline_class])\n format.html { redirect_to @discipline_class, :notice => 'Classe atualizada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @discipline_class.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "72484d623e4c60a535c72085764d973b", "score": "0.5656507", "text": "def update\n respond_to do |format|\n if @class.update(class_params)\n format.html { redirect_to @class, notice: 'Classe was successfully updated.' }\n format.json { render :show, status: :ok, location: @class }\n else\n format.html { render :edit }\n format.json { render json: @class.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "eca6bfc7d339181c2b8630b2c0f7f2bf", "score": "0.565446", "text": "def update\n respond_to do |format|\n if @class_info.update(class_info_params)\n format.html { redirect_to @class_info, notice: 'Class info was successfully updated.' }\n format.json { render :show, status: :ok, location: @class_info }\n else\n format.html { render :edit }\n format.json { render json: @class_info.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d9fdac1fd143b7fc7f57036911177d61", "score": "0.56522524", "text": "def update\n respond_to do |format|\n if @class.update_attributes(params[:klass])\n format.html { redirect_to class_path(@class), notice: 'La classe a bien été mise à jour.' }\n format.json { head :ok }\n else\n format.html do\n @trainings = Training.all\n render action: \"edit\"\n end\n format.json { render json: @class.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6040580c1a92ca197e7a59470c908929", "score": "0.5648323", "text": "def update\n @lab_class = current_resource\n\n respond_to do |format|\n if @lab_class.update_attributes(params[:lab_class])\n format.html { redirect_to @lab_class, notice: 'Lab class was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lab_class.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2bfb0b816f038a694d86829585ea0793", "score": "0.56428164", "text": "def update\n respond_to do |format|\n if @classification.update(classification_params)\n format.html { redirect_to @classification, notice: 'Classification was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @classification.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4994c975c853f040d2b7d9deeeed7f2d", "score": "0.56427974", "text": "def update\n respond_to do |format|\n if @class_status.update(class_status_params)\n format.html { redirect_to @class_status, notice: 'Class status was successfully updated.' }\n format.json { render :show, status: :ok, location: @class_status }\n else\n format.html { render :edit }\n format.json { render json: @class_status.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d7f41af2f5d72ac7e850ff5499b63c2d", "score": "0.5642298", "text": "def update\n @organism_topology_stat = OrganismTopologyStat.find(params[:id])\n\n respond_to do |format|\n if @organism_topology_stat.update_attributes(params[:organism_topology_stat])\n format.html { redirect_to @organism_topology_stat, notice: 'Organism topology stat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @organism_topology_stat.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a48a3709feb0d9b7e070c4a2e67cf88b", "score": "0.56407416", "text": "def update\n respond_to do |format|\n if @class_name.update(class_name_params)\n format.html { redirect_to @class_name, notice: 'Class name was successfully updated.' }\n format.json { render :show, status: :ok, location: @class_name }\n else\n format.html { render :edit }\n format.json { render json: @class_name.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9e40a7012db8b0ef36ab8122c51e17ba", "score": "0.5635348", "text": "def update\n @clazz = Portal::Clazz.find(params[:id])\n respond_to do |format|\n if @clazz.update_attributes(params[:portal_clazz])\n flash[:notice] = 'Portal::Clazz was successfully updated.'\n format.html { redirect_to(@clazz) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @clazz.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "548ba1babbcdb78511c04a317bf5c979", "score": "0.56324464", "text": "def update\n json_update(factType,factType_params, FactType)\n end", "title": "" }, { "docid": "e0e5eed78a5b4a2455a8ca0b033ec59b", "score": "0.56324255", "text": "def update\n respond_to do |format|\n if @seat_class.update_attributes(params[:seat_class])\n format.html { redirect_to @seat_class, notice: 'Seat class was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @seat_class.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "38949a2ec223d4ebb5b3287ec277039b", "score": "0.5619987", "text": "def update\n respond_to do |format|\n if @capsule_class.update(capsule_class_params)\n format.html { redirect_to @capsule_class, notice: 'Capsule class was successfully updated.' }\n format.json { render :show, status: :ok, location: @capsule_class }\n else\n format.html { render :edit }\n format.json { render json: @capsule_class.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "99de579c57329a8ea2693300a08aa87a", "score": "0.56138116", "text": "def update\n respond_to do |format|\n if @klass.update(klass_params)\n format.html { redirect_to my_classes_path, notice: 'Klass was successfully updated.' }\n format.json { render :show, status: :ok, location: @klass }\n else\n format.html { render :edit }\n format.json { render json: @klass.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b1684117c478cbd460b4ee9805e4488c", "score": "0.56122047", "text": "def update\n respond_to do |format|\n if @business_system.update(business_system_params)\n format.html { redirect_to business_systems_url, notice: 'Success Update' }\n format.json { render :show, status: :ok, location: @business_system }\n else\n create_nested @business_system\n format.html { render :edit }\n format.json { render json: @business_system.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "194c559bee0aa7b7dcd511e3a4036c56", "score": "0.56061465", "text": "def update\n @classes_planification = ClassesPlanification.find(params[:id])\n\n if @classes_planification.update(classes_planification_params)\n head :no_content\n else\n render json: @classes_planification.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "483db5975a91690e7575df2948b0d44f", "score": "0.5603408", "text": "def update\n @classroom.state = @classroom.state ? false : true\n respond_to do |format|\n if @classroom.update(classroom_params)\n format.html { redirect_to management_classrooms_path }\n format.json { render :json => @classroom.to_json(include: :category), status: :created }\n else\n format.html { render :edit }\n format.json { render json: @classroom.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b02edaa6d569086d9190f4714c7de2cf", "score": "0.5602934", "text": "def update\n @l_class = LClass.find(params[:id])\n\n respond_to do |format|\n if @l_class.update_attributes(params[:l_class])\n format.html { redirect_to @l_class, notice: 'L class was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @l_class.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5497502e74fa73f00e20740e96f1ab92", "score": "0.5595296", "text": "def update\n @aecomo_class = AecomoClass.find(params[:id])\n\n respond_to do |format|\n if @aecomo_class.update_attributes(params[:aecomo_class])\n format.html { redirect_to @aecomo_class, notice: 'Aecomo class was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @aecomo_class.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "80138c2132ff19b52822cc35ed52733d", "score": "0.55816674", "text": "def update\n respond_to do |format|\n if @system_requirement.update(system_requirement_params)\n format.html { redirect_to @system_requirement, notice: 'System requirement was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @system_requirement.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "817aa1f60f1a687bdebedd5454323974", "score": "0.5568714", "text": "def destroy\n @system_organ_class.destroy\n respond_to do |format|\n format.html { redirect_to system_organ_classes_url, notice: 'System organ class was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3d7bda464a4f4a68d0a8a9b48d056bbf", "score": "0.55674773", "text": "def update\n respond_to do |format|\n if @class_g.update(class_g_params)\n format.html { redirect_to @class_g, notice: 'Class g was successfully updated.' }\n format.json { render :show, status: :ok, location: @class_g }\n else\n format.html { render :edit }\n format.json { render json: @class_g.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a5153d7648aee31b8fcdeaf5353d0658", "score": "0.55672526", "text": "def update\n @organisation_type = OrganisationType.find(params[:id])\n\n respond_to do |format|\n if @organisation_type.update_attributes(params[:organisation_type])\n format.html { redirect_to @organisation_type, notice: 'Organisation type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @organisation_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5a3bb40ec3ff3bed7c071a4ebbc15911", "score": "0.5557349", "text": "def update\n @organization = Organization.find(params[:id])\n @organization.sectors = Sector.find(params[:sector_ids]) if params[:sector_ids]\n respond_to do |format|\n if @organization.update_attributes(params[:organization])\n format.html { redirect_to @organization, notice: 'Organization was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f986e70d1efb9c2bf8bb5930dda6ced2", "score": "0.555414", "text": "def update\n @class_need = ClassNeed.find(params[:id])\n\n respond_to do |format|\n if @class_need.update_attributes(params[:class_need])\n format.html { redirect_to @class_need, notice: 'Class need was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @class_need.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d37c212ef4d24806b6c31e1e66552fa2", "score": "0.55510515", "text": "def update\n @ss_class = SsClass.find(params[:id])\n\n if user_permission[:ss][:write]\n respond_to do |format|\n if @ss_class.update_attributes(params[:ss_class])\n format.json { head :no_content }\n else\n #format.json { render json: @ss_class.errors, status: :unprocessable_entity }\n format.json {render json: flash}\n end\n format.html {redirect_to @ss_class, notice: 'Instructors Updated'}\n end\n else\n respond_to do |format|\n format.html { redirect_to @ss_class }\n format.json {head :no_content}\n end\n end\n end", "title": "" }, { "docid": "d269214992f50284564beaf4e5a41e04", "score": "0.5546297", "text": "def update\n respond_to do |format|\n if @class_service.update(class_service_params)\n format.html { redirect_to @class_service, notice: \"Class service was successfully updated.\" }\n format.json { render :show, status: :ok, location: @class_service }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @class_service.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d9bca0af0cb7b101b220037356d0b2f4", "score": "0.55424464", "text": "def update\n respond_to do |format|\n if @classification.update(classification_params)\n format.html { redirect_to @classification, notice: 'Classification was successfully updated.' }\n format.json { render :show, status: :ok, location: @classification }\n else\n format.html { render :edit }\n format.json { render json: @classification.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d9bca0af0cb7b101b220037356d0b2f4", "score": "0.55424464", "text": "def update\n respond_to do |format|\n if @classification.update(classification_params)\n format.html { redirect_to @classification, notice: 'Classification was successfully updated.' }\n format.json { render :show, status: :ok, location: @classification }\n else\n format.html { render :edit }\n format.json { render json: @classification.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f75419543edea7ba4d9593bb54fc638b", "score": "0.5542433", "text": "def saveClass\n if params[:mode] == 'I'\n update = CoursesHlp.saveClass(params[:class])\n else\n update = CoursesHlp.updateClass(params[:class])\n end\n render json: update\n end", "title": "" }, { "docid": "8066043fbb0bb5140717c20adf016dbf", "score": "0.5539497", "text": "def update\n @clazz = Clazz.find(params[:id])\n\n respond_to do |format|\n if @clazz.update_attributes(params[:clazz])\n format.html { redirect_to(@clazz, :notice => 'Clazz was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @clazz.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7ccb8af5ba4f79d8e5d23b214a76023d", "score": "0.5536138", "text": "def update\n if(!checkAdmin())\n redirect_to \"/\", notice: 'Admin only!'\n return\n end\n @semester_class = SemesterClass.find(params[:id])\n\n respond_to do |format|\n if @semester_class.update_attributes(params[:semester_class])\n format.html { redirect_to @semester_class, notice: 'Semester class was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @semester_class.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "47b19df117646281ef38abca88c901ea", "score": "0.55313677", "text": "def update\n respond_to do |format|\n if @tclass.update(tclass_params)\n format.html { redirect_to @tclass, notice: 'Tclass was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tclass.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "57577bfbaee5e4e8cb0cc6ffaf21b9cb", "score": "0.5529045", "text": "def update\n @schedtype = Schedtype.find(params[:id])\n\n respond_to do |format|\n if @schedtype.update_attributes(params[:schedtype])\n format.html { redirect_to @schedtype, notice: 'Schedtype was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @schedtype.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c5a6bdb0b5e008071f05d723bd699d18", "score": "0.55264026", "text": "def update\n respond_to do |format|\n if @title_class.update(title_class_params)\n format.html { redirect_to @title_class, notice: 'Title class was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @title_class.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5248cbbc66aa674b1f1eb280a7dc1734", "score": "0.55190235", "text": "def update\n @academic_class = AcademicClass.find(params[:id])\n\n respond_to do |format|\n if @academic_class.update_attributes(params[:academic_class])\n format.html { redirect_to @academic_class, notice: 'Form was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @academic_class.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f83c4845dec3da26fe844c81723744ec", "score": "0.5517867", "text": "def update\n respond_to do |format|\n if @cluster.update_attributes(params[:cluster])\n format.html { redirect_to @cluster, notice: 'Module was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render layout: \"form\", action: \"edit\" }\n format.json { render json: @cluster.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6531c2eafc6a5812812ae573dfef0ab0", "score": "0.5506794", "text": "def update\n respond_to do |format|\n if @company_classification.update(company_classification_params)\n format.html { redirect_to @company_classification, notice: 'Company classification was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @company_classification.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ccc2d2958cc2d1500fb5eb863c15a7a1", "score": "0.55016035", "text": "def update\n respond_to do |format|\n if @classified.update(classified_params)\n format.html { redirect_to @classified, notice: 'Classified was successfully updated.' }\n format.json { render :show, status: :ok, location: @classified }\n else\n format.html { render :edit }\n format.json { render json: @classified.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cb58ed3b6e4b53daaf1d346d8394c566", "score": "0.5500192", "text": "def update\n respond_to do |format|\n if @college_class.update(college_class_params)\n format.html { redirect_to @college_class, notice: 'College class was successfully updated.' }\n format.json { render :show, status: :ok, location: @college_class }\n else\n format.html { render :edit }\n format.json { render json: @college_class.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5549c1407625dfaea74efaa07f287c30", "score": "0.5481045", "text": "def update\n @admin_classifieds = Admin::Classified.all\n @admin_classified = Admin::Classified.find(params[:id])\n\n respond_to do |format|\n if @admin_classified.update_attributes(params[:admin_classified])\n flash[:notice] = 'Classified was successfully updated.'\n format.html { redirect_to admin_classifieds_path, notice: 'Classified was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_classified.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c2c5c45a81f64b2d3c6e0c89aa045028", "score": "0.5480248", "text": "def update\n @uni_class = UniClass.find(params[:id])\n\n respond_to do |format|\n if @uni_class.update_attributes(params[:uni_class])\n format.html { redirect_to @uni_class, notice: 'Uni class was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @uni_class.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "da6a2e29d6b95af703b23210ecc1fce7", "score": "0.54785025", "text": "def update\n respond_to do |format|\n if @org.update(org_params)\n format.html { redirect_to @org, notice: t('.update_ok', item: @org.abbreviation) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @org.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "15636bae64bfcd9c9ef8ce47cf67e90f", "score": "0.5470398", "text": "def update\n @course_class = CourseClass.find(params[:id])\n\n respond_to do |format|\n if @course_class.update_attributes(params[:course_class])\n format.html { redirect_to @course_class, notice: 'Course class was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @course_class.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d8304b6b9b5e000577e63cf994564e41", "score": "0.5470185", "text": "def update\n respond_to do |format|\n if @class_schedule.update(class_schedule_params)\n format.html { redirect_to @class_schedule, notice: 'Class schedule was successfully updated.' }\n format.json { render :show, status: :ok, location: @class_schedule }\n else\n format.html { render :edit }\n format.json { render json: @class_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d70d073d683a5a6878c16ce3bf36958a", "score": "0.5462801", "text": "def update\n @classified = Classified.find(params[:id])\n\n respond_to do |format|\n if @classified.update_attributes(params[:classified])\n format.html { redirect_to @classified, notice: 'Classified was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @classified.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "895d25470dde27eef11a3d4c4829b5b6", "score": "0.5461362", "text": "def update\n respond_to do |format|\n if @procedure_class.update(procedure_class_params)\n format.html { redirect_to @procedure_class, notice: 'Procedure class was successfully updated.' }\n format.json { render :show, status: :ok, location: @procedure_class }\n else\n format.html { render :edit }\n format.json { render json: @procedure_class.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5455733877365260c91ecc8e36b73f9a", "score": "0.5460772", "text": "def update\n respond_to do |format|\n if @active_class.update(active_class_params)\n format.html { redirect_to @active_class, notice: 'Active class was successfully updated.' }\n format.json { render :show, status: :ok, location: @active_class }\n else\n format.html { render :edit }\n format.json { render json: @active_class.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b4574dbbf5b0591d00d2f4b72265f0d0", "score": "0.5458068", "text": "def update\n respond_to do |format|\n if @edit_classroom.update(classroom_params)\n format.html { redirect_to classrooms_path, notice: 'Schedule place was successfully updated.' }\n format.json { render :show, status: :ok, location: @edit_classroom }\n else\n format.html { render :edit }\n format.json { render json: @edit_classroom.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6ca4ef2765483a403b5160880eb4e167", "score": "0.5457151", "text": "def update\n @classroom.state = @classroom.state ? false : true\n respond_to do |format|\n if @classroom.update(classroom_params)\n format.html { redirect_to classrooms_path }\n format.json { render :json => @classroom.to_json(include: :category), status: :created }\n else\n format.html { render :edit }\n format.json { render json: @classroom.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ab1750a535bdf80f9ef32b7f0aa0ad60", "score": "0.54549605", "text": "def update\n respond_to do |format|\n if @problem_class.update(problem_class_params)\n format.html { redirect_to @problem_class, notice: 'Problem class was successfully updated.' }\n format.json { render :show, status: :ok, location: @problem_class }\n else\n format.html { render :edit }\n format.json { render json: @problem_class.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "90c3a515e7abd9af6de273b9d8e88c94", "score": "0.54507893", "text": "def updateClassTrans\n result = Hash.new\n result['status'] = true\n begin # try\n if !CoursesHlp.updateClassTrans(params[:class])\n result['status'] = false\n end\n rescue # catch\n result['status'] = false\n result['error'] = \"#{$!}\"\n ensure # finally\n render json: result\n end\n end", "title": "" }, { "docid": "ffdd133885555217995164bbb8a4174b", "score": "0.54505134", "text": "def update\n authorize @gym_class\n respond_to do |format|\n if @gym_class.update(gym_class_params)\n format.html { redirect_to @gym_class, notice: \"Gym class was successfully updated.\" }\n format.json { render :show, status: :ok, location: @gym_class }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @gym_class.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d2de27ca2dcea420a6db785f65803f6a", "score": "0.5450364", "text": "def update\n @unit_class = UnitClass.find(params[:id])\n\n respond_to do |format|\n if @unit_class.update_attributes(params[:unit_class])\n format.html { redirect_to @unit_class, notice: 'Unit class was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @unit_class.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "46b7eae40852d3993f918312b4cdf985", "score": "0.5450125", "text": "def update\n @list = HqSystem.all(:order => :name)\n @object = HqSystem.find(params[:id])\n \n params[:hq_system][:new_hq_app_attributes] ||= {}\n params[:hq_system][:existing_hq_app_attributes] ||= {}\n \n \n @hq_system = HqSystem.find(params[:id])\n respond_to do |format|\n if @hq_system.update_attributes(params[:hq_system])\n @objects = HqSystem.all\n flash[:notice] = 'System was successfully updated.'\n format.js if request.xhr?\n format.html { redirect_to :action => \"edit\", :template => 'reflected/edit' }\n format.xml { head :ok }\n else\n messages = '<ul>Error:'\n @hq_system.errors.full_messages.each {|msg| messages += '<li>'+msg+'</li>'}\n messages += '</ul>'\n flash[:notice] = messages\n format.html { redirect_to :action => \"edit\", :template => 'reflected/edit' }\n format.xml { render :xml => @hq_system.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b82766c60409153e304e08791346cdd1", "score": "0.54485106", "text": "def update\n @classroom_schedule = Classroom::Schedule.find(params[:id])\n\n respond_to do |format|\n if @classroom_schedule.update_attributes(params[:classroom_schedule])\n format.html { redirect_to classroom_schedules_path }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @classroom_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6ee929c4c09046f5cd33f31f9a4ce657", "score": "0.5447762", "text": "def update\n respond_to do |format|\n if @system.update(system_params)\n format.html { redirect_to @system, notice: 'Combination dose was successfully updated.' }\n format.json { render :show, status: :ok, location: @system }\n else\n format.html { render :edit }\n format.json { render json: @system.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8b2099c4f5990ac17c6dbbfe54fbc09a", "score": "0.5446824", "text": "def update\n @class_action = ClassAction.find(params[:id])\n\n if @class_action.update(params[:class_action])\n head :no_content\n else\n render json: @class_action.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "4418fd65e2ef429651b77e64bc42f0c0", "score": "0.54447156", "text": "def update\n @registration_class_status = RegistrationClassStatus.find(params[:id])\n\n respond_to do |format|\n if @registration_class_status.update_attributes(params[:registration_class_status])\n format.html { redirect_to @registration_class_status, :notice => 'Estado de registro de classe atualizada.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @registration_class_status.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "48a8e0f54431934fee5368623b5a9de5", "score": "0.54432565", "text": "def update\n respond_to do |format|\n if @emp_clasificacion.update(emp_clasificacion_params)\n format.html { redirect_to @emp_clasificacion, notice: 'Clasificacion contable actualizado correctamente.' }\n format.json { render :show, status: :ok, location: @emp_clasificacion }\n else\n format.html { render :edit }\n format.json { render json: @emp_clasificacion.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a381ed16df5318c39d971b12ef655cda", "score": "0.5441096", "text": "def update\n respond_to do |format|\n if @cllass.update(cllass_params)\n format.html { redirect_to @cllass, notice: 'Cllass was successfully updated.' }\n format.json { render :show, status: :ok, location: @cllass }\n else\n format.html { render :edit }\n format.json { render json: @cllass.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0729f53f92c18ef0937e6b182908b941", "score": "0.54404354", "text": "def update\n respond_to do |format|\n if @classe.update(class_params)\n format.html { redirect_to @classe, notice: 'Classe was successfully updated.' }\n format.json { render :show, status: :ok, location: @classe }\n else\n format.html { render :edit }\n format.json { render json: @classe.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5378ca7d60fa2c046cbc4737f10d3467", "score": "0.5439867", "text": "def update\n @system = System.find(params[:id])\n\n respond_to do |format|\n if @system.update_attributes(params[:system])\n format.html { redirect_to @system, :notice => 'System was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @system.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6ce28809a460ae65f5e53743208cf8b5", "score": "0.5439319", "text": "def update\n # PUNDIT_REVIEW_AUTHORIZE\n # PUNDIT_CHECK_AUTHORIZE (did not find instance)\n # authorize @clazz\n @portal_clazz = Portal::Clazz.find(params[:id])\n\n object_params = params[:portal_clazz]\n grade_levels = object_params.delete(:grade_levels)\n if !valid_grade_levels_param?(grade_levels)\n grade_levels = nil\n end\n if grade_levels\n # This logic will attempt to prevent someone from removing all grade levels from a class.\n grades_to_add = []\n grade_levels.each do |name, v|\n grade = Portal::Grade.find_by_name(name)\n grades_to_add << grade if grade\n end\n object_params[:grades] = grades_to_add if !grades_to_add.empty?\n end\n\n if request.xhr?\n if update_class_and_teachers(@portal_clazz, object_params)\n @portal_clazz.reload\n end\n render :partial => 'show', :locals => { :portal_clazz => @portal_clazz }\n else\n respond_to do |format|\n okToUpdate = true\n\n if Admin::Settings.default_settings.enable_grade_levels?\n if !grade_levels\n flash['error'] = \"You need to select at least one grade level for this class.\"\n okToUpdate = false\n end\n end\n\n if okToUpdate && update_class_and_teachers(@portal_clazz, object_params)\n @portal_clazz.reload\n flash['notice'] = 'Class was successfully updated.'\n format.html { redirect_to(url_for([:materials, @portal_clazz])) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @portal_clazz.errors, :status => :unprocessable_entity }\n end\n end\n end\n end", "title": "" }, { "docid": "758b6a28aa9533db44cf2c1ca03e3cc8", "score": "0.54355586", "text": "def update\n respond_to do |format|\n if @classification.update(admin_classification_params)\n format.html { redirect_to [:admin, @classification], notice: 'Classification was successfully updated.' }\n format.json { render :show, status: :ok, location: @classification }\n else\n format.html { render :edit }\n format.json { render json: @classification.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "16ac9b95cc3b582a61c62af58a0e8adb", "score": "0.5430252", "text": "def update\n respond_to do |format|\n if @subject_has_classification.update_attributes(params[:subject_has_classification])\n format.html { redirect_to @subject_has_classification, :notice => t('controller.successfully_updated', :model => t('activerecord.models.subject_has_classification')) }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @subject_has_classification.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1282ccae06af502827430028a9f5ae95", "score": "0.5425134", "text": "def update\n @organization.social_link = @social_link\n @organization.feature = @feature\n @organization.organization_theme = @organization_theme\n render json: @organization.errors unless @organization.update(filtered_org_params)\n end", "title": "" } ]
bfd7859020e54f4bb722804d969bee64
PUT /type_decisions/1 PUT /type_decisions/1.xml
[ { "docid": "ff88aaf4e4ee1fc5605eafd817083dd9", "score": "0.6218553", "text": "def update\n @type_decision = TypeDecision.find(params[:id])\n\n respond_to do |format|\n if @type_decision.update_attributes(params[:type_decision])\n format.html { redirect_to(@type_decision, :notice => 'Type decision was successfully updated.') }\n format.xml { head :ok }\n format.json {render :json => {\"success\"=>true,\"data\"=>@type_decision}}\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @type_decision.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "470369b7ff586fc5881b51a88bb20440", "score": "0.6150468", "text": "def update\n authorize! :update, CompetenceType\n @competence_type.update!(competence_type_params)\n render json: {status: :ok}\n end", "title": "" }, { "docid": "fd7c5f545c4eff73294c760ac7057ca2", "score": "0.60031265", "text": "def update\n respond_to do |format|\n if @constraint_type.update(constraint_type_params)\n format.html { redirect_to @constraint_type, notice: 'Constraint type was successfully updated.' }\n format.json { render :show, status: :ok, location: @constraint_type }\n else\n format.html { render :edit }\n format.json { render json: @constraint_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "31c51cd72cd18b3e6602ff21fcc9cd9e", "score": "0.5952382", "text": "def update\n @type = Type.find(params[:id])\n\n respond_to do |format|\n if @type.update_attributes(params[:type])\n format.html { redirect_to(types_path, :notice => 'Type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @type.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "872eb92207485ca64c077b56db614720", "score": "0.591482", "text": "def update\n @type = Type.find(params[:id])\n\n respond_to do |format|\n if @type.update_attributes(params[:type])\n format.html { redirect_to(\"/typeview\", :notice => 'Type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @type.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bf24a2488a05604824762dedd25c157e", "score": "0.5898697", "text": "def update\n @disposable_type = DisposableType.find(params[:id])\n\n respond_to do |format|\n if @disposable_type.update_attributes(params[:disposable_type])\n format.html { redirect_to @disposable_type, notice: 'Disposable type was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @disposable_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b08d53ee2e90732b0f23a4da8e1aae93", "score": "0.58759177", "text": "def update\n @travel_expence_type.update(travel_expence_type_params)\n @travel_expence_types = TravelExpenceType.all\n @travel_expence_type = TravelExpenceType.new\n end", "title": "" }, { "docid": "635111af9841d78e58589c1a7080f875", "score": "0.58613753", "text": "def update\n respond_to do |format|\n if @type_incidence.update(type_incidence_params)\n format.html { redirect_to @type_incidence, notice: 'Type incidence was successfully updated.' }\n format.json { render :show, status: :ok, location: @type_incidence }\n else\n format.html { render :edit }\n format.json { render json: @type_incidence.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9b07bb05c7ffc499d4bb5922ba8d9caf", "score": "0.5829528", "text": "def update\n @type = Type.find(params[:id])\n\n respond_to do |format|\n if @type.update_attributes(params[:type])\n flash[:notice] = 'Type was successfully updated.'\n format.html { redirect_to(@type) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @type.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6113a23cbf951b9880cae8721f7ba2c4", "score": "0.5820179", "text": "def update\n @type = Type.find(params[:id])\n\n respond_to do |format|\n if @type.update_attributes(params[:type])\n format.html { redirect_to types_path, notice: 'Type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9ced4e719b313483a7d15e88c0e54434", "score": "0.58195674", "text": "def update\n @incident_type = IncidentType.find(params[:id])\n\n respond_to do |format|\n if @incident_type.update_attributes(params[:incident_type])\n format.html { redirect_to @incident_type, notice: 'Incident type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @incident_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "96f4cdf7e34ff9617f8ae66f0efd8254", "score": "0.58080775", "text": "def update\n respond_to do |format|\n if @incidence_type.update(incidence_type_params)\n format.html { redirect_to @incidence_type, notice: 'Incidence type ha sido actualizado.' }\n format.json { render :show, status: :ok, location: @incidence_type }\n else\n format.html { render :edit }\n format.json { render json: @incidence_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6721740f4224cc3e98242ee9167e8cd0", "score": "0.57888514", "text": "def update\n respond_to do |format|\n if @offense_type.update(offense_type_params)\n format.html { redirect_to @offense_type, notice: 'Offense type was successfully updated.' }\n format.json { render :show, status: :ok, location: @offense_type }\n else\n format.html { render :edit }\n format.json { render json: @offense_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c00c683db0f6a4c62c033d3442dee33a", "score": "0.5785483", "text": "def update\n @type = Type.find(params[:id])\n\n respond_to do |format|\n if @type.update_attributes(params[:type])\n format.html { redirect_to @type, notice: 'Type was successfully updated!' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e392b3e94167617f55483f9f509abb66", "score": "0.5774089", "text": "def update_entity_type(entity_type_id, request)\n start.uri('/api/entity/type')\n .url_segment(entity_type_id)\n .body_handler(FusionAuth::JSONBodyHandler.new(request))\n .put()\n .go()\n end", "title": "" }, { "docid": "2e510230583f0b5e4a336fa42abcadef", "score": "0.5772638", "text": "def update\n\n respond_to do |format|\n if @expense_type.update_attributes(params[:expense_type])\n format.html { redirect_to(expense_types_path, :notice => t(\"screens.notice.successfully_updated\")) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @expense_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4b8ff2dedebdf4128945c8f311181d20", "score": "0.5753168", "text": "def update\r\n @incident_type = IncidentType.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @incident_type.update_attributes(params[:incident_type])\r\n flash[:notice] = 'IncidentType was successfully updated.'\r\n format.html { redirect_to incident_type_url(@incident_type) }\r\n format.xml { head :ok }\r\n else\r\n format.html { render :action => \"edit\" }\r\n format.xml { render :xml => @incident_type.errors.to_xml }\r\n end\r\n end\r\n end", "title": "" }, { "docid": "664449ca79919ada2f216f482a874b4d", "score": "0.5752459", "text": "def update\n @expensetype = Expensetype.find(params[:id])\n\n respond_to do |format|\n if @expensetype.update_attributes(params[:expensetype])\n format.html { redirect_to expensetypes_url, notice: 'Expensetype was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @expensetype.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "93cfbef4487696a97955b3e015286a04", "score": "0.574925", "text": "def update\n @domicile_type = DomicileType.find(params[:id])\n\n if @domicile_type.update(domicile_type_params)\n head :no_content\n else\n render json: @domicile_type.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "c49bb18a9d19fd19fb827a659ef10d6e", "score": "0.5726455", "text": "def update\n @expense_type = ExpenseType.find(params[:id])\n\n respond_to do |format|\n if @expense_type.update_attributes(params[:expense_type])\n format.html { redirect_to @expense_type, notice: 'Expense type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @expense_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7f8c4b1c7e5c115624864dd3fc07fd61", "score": "0.5707465", "text": "def update\n @exp_type = ExpType.find(params[:id])\n\n respond_to do |format|\n if @exp_type.update_attributes(params[:exp_type])\n format.html { redirect_to @exp_type, notice: 'Exp type was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exp_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1ba1caec23ae3973c933a21e488e2bf1", "score": "0.5703326", "text": "def update\n @evidence_type = AccountingEvidenceType.find(params[:id])\n\n respond_to do |format|\n if @evidence_type.update_attributes(params[:evidence_type])\n flash[:notice] = 'EvidenceType was successfully updated.'\n format.html { redirect_to(accounting_evidence_type_path(@evidence_type)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @evidence_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "636816043691b6789c59af190f7f19a0", "score": "0.5686284", "text": "def update\n @correspondence_type = CorrespondenceType.find(params[:id])\n\n respond_to do |format|\n if @correspondence_type.update_attributes(params[:correspondence_type])\n flash[:notice] = 'CorrespondenceType was successfully updated.'\n format.html { redirect_to(correspondence_types_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @correspondence_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "525201fb3bdfda7e822ed519aa691013", "score": "0.5666351", "text": "def destroy\n @type_decision = TypeDecision.find(params[:id])\n @type_decision.destroy\n\n respond_to do |format|\n format.html { redirect_to(type_decisions_url) }\n format.xml { head :ok }\n format.json {render :json => {\"success\"=>true,\"data\"=>[]}}\n end\n end", "title": "" }, { "docid": "9317abf930d702c1fd7c02de42960a14", "score": "0.5661987", "text": "def update\n @element_type = ElementType.find(params[:id])\n\n if @element_type.update(element_type_params)\n head :no_content\n else\n render json: @element_type.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "0342f72731a560bc33736a8a8afc2505", "score": "0.5652022", "text": "def update\n respond_to do |format|\n if @exp_type.update(exp_type_params)\n format.html { redirect_to @exp_type, notice: 'Exp type was successfully updated.' }\n format.json { render :show, status: :ok, location: @exp_type }\n else\n format.html { render :edit }\n format.json { render json: @exp_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c16e8da224c52c856a9283b7f7c163e0", "score": "0.563944", "text": "def update\n @comptype = Comptype.find(params[:comptype][:id])\n\n respond_to do |format|\n if @comptype.update_attributes(params[:comptype])\n format.xml { head :ok }\n end\n end\n end", "title": "" }, { "docid": "36139f17c470f157f3c78e8b5508e024", "score": "0.5631376", "text": "def update\n @type_info = TypeInfo.find(params[:id])\n\n respond_to do |format|\n if @type_info.update_attributes(params[:type_info])\n format.html { redirect_to @type_info, notice: 'Type info was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @type_info.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a88f84845b803572cc01909ce95785a9", "score": "0.56301016", "text": "def update\n @occasion_type = OccasionType.with_permissions_to(:update).find(params[:id])\n\n respond_to do |format|\n if @occasion_type.update_attributes(params[:occasion_type])\n flash[:notice] = 'Tapahtumatyyppin tiedot päivitetty.'\n format.html { redirect_to(occasion_type_url) } \n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @occasion_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5d3f84262efeddc9f0de57dd9c89bcb3", "score": "0.5624608", "text": "def update\n @correspondence_type = CorrespondenceType.find(params[:id])\n\n respond_to do |format|\n if @correspondence_type.update_attributes(params[:correspondence_type])\n format.html { redirect_to @correspondence_type, notice: 'Correspondence type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @correspondence_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "60bb7a2b33f8bff29183c206f8e0da54", "score": "0.56202656", "text": "def update\n @engine_type = EngineType.find(params[:id])\n\n respond_to do |format|\n if @engine_type.update_attributes(engine_type_params)\n format.html { redirect_to \"/engine_types\", notice: 'Engine type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @engine_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6e233529c3d7b45c9c2e44799e0abae4", "score": "0.561033", "text": "def update\n respond_to do |format|\n if @type.update(type_params)\n format.html { redirect_to @type, notice: 'Type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2fd92509f4f02a59166a51dee2092331", "score": "0.5608229", "text": "def update\n @instancetype = Instancetype.find(params[:id])\n\n respond_to do |format|\n if @instancetype.update_attributes(params[:instancetype])\n flash[:notice] = 'Instance type was successfully updated.'\n format.html { redirect_to(instancetypes_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @instancetype.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2b6804b14d43e2f69ff91cc740a298ee", "score": "0.5602989", "text": "def update\n authorize! :update, @warranty_type\n respond_to do |format|\n if @warranty_type.update(warranty_type_params)\n format.html { redirect_to @warranty_type, notice: 'Warranty type was successfully updated.' }\n format.json { render :show, status: :ok, location: @warranty_type }\n else\n format.html { render :edit }\n format.json { render json: @warranty_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5de21f8f95872925e70ed8e4519d5dd3", "score": "0.5596491", "text": "def update\n respond_to do |format|\n if @expend_type.update(expend_type_params)\n format.html { redirect_to @expend_type, notice: 'Expend type was successfully updated.' }\n format.json { render :show, status: :ok, location: @expend_type }\n else\n format.html { render :edit }\n format.json { render json: @expend_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "170cf65fb9684f68867e39cf251aff03", "score": "0.5596448", "text": "def update\n @adjustment_type = AdjustmentType.find(params[:id])\n\n respond_to do |format|\n if @adjustment_type.update_attributes(params[:adjustment_type])\n format.html { redirect_to @adjustment_type, notice: 'Adjustment type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @adjustment_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "98cf5f168d4983067f65b6e6aa7dd97f", "score": "0.55952406", "text": "def update\n @eval_type = EvalType.find(params[:id])\n\n respond_to do |format|\n if @eval_type.update_attributes(params[:eval_type].permit(:name, :organization_id))\n format.html { redirect_to eval_types_url, notice: I18n.t(:general_update_success) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @eval_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0006baef57a77654d8f9f087c5d98902", "score": "0.55884695", "text": "def update\n @subsidy_type = SubsidyType.find(params[:id])\n\n respond_to do |format|\n if @subsidy_type.update_attributes(params[:subsidy_type])\n format.html { redirect_to @subsidy_type, notice: 'Тип материальной выплаты успешно обновлён.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @subsidy_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "65905f6605590c7dc6259460e4e77ad8", "score": "0.55812865", "text": "def update\n @incidence_type.code = @incidence_type.code.upcase\n\n respond_to do |format|\n if @incidence_type.update(incidence_type_params)\n format.html { redirect_to incidence_types_path, notice: 'Incidence type was successfully updated.' }\n format.json { render :index, status: :ok, location: @incidence_type }\n else\n format.html { render :edit }\n format.json { render json: @incidence_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d94dcd3d13ee1c127551d66862d9d1db", "score": "0.55802923", "text": "def update\n @interview_type.update(interview_type_params)\n @interview_types = InterviewType.all\n @interview_type = InterviewType.new\n end", "title": "" }, { "docid": "e3a1c430784c23e4a288f45954a75b73", "score": "0.5576891", "text": "def update\n @maintenance_type = MaintenanceType.find(params[:id])\n\n respond_to do |format|\n if @maintenance_type.update_attributes(params[:maintenance_type])\n format.html { redirect_to @maintenance_type, notice: 'Maintenance type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @maintenance_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "93cc652d828b49318d287673699f7ff1", "score": "0.5574494", "text": "def update\n @operation_type = OperationType.find(params[:id])\n\n respond_to do |format|\n if @operation_type.update_attributes(params[:operation_type])\n flash[:notice] = 'OperationType was successfully updated.'\n format.html {redirect_to(operation_types_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @operation_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5372c9596069755560b8f017ca5b0c42", "score": "0.5573377", "text": "def update\n @taxe_type = Taxe::Type.find(params[:id])\n\n respond_to do |format|\n if @taxe_type.update_attributes(params[:taxe_type])\n format.html { redirect_to(@taxe_type, :notice => 'Type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @taxe_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a6e526ca0d07cb91e40ee0197881ebe6", "score": "0.55602247", "text": "def update\n @effect_type = EffectType.find(params[:id])\n\n if @effect_type.update(effect_type_params)\n head :no_content\n else\n render json: @effect_type.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "68ace705677ab2a5a073f804511342e7", "score": "0.55594116", "text": "def set_type_req_resp\n @type_req_resp = TypeReqResp.find(params[:id])\n end", "title": "" }, { "docid": "64381d7f0393a974f3c30cac80ff2f25", "score": "0.55452806", "text": "def update\n respond_to do |format|\n if @intervention_type.update(intervention_type_params)\n format.html { redirect_to intervention_types_url, notice: \"Intervention type was successfully updated.\" }\n format.json { render :show, status: :ok, location: @intervention_type }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @intervention_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "29b2f7ddc2064f1853a62daf34963a13", "score": "0.5544819", "text": "def update\n respond_to do |format|\n if @reinforcement_type.update(reinforcement_type_params)\n format.html { redirect_to reinforcement_types_path, notice: 'Reinforcement type was successfully updated.' }\n format.json { render :show, status: :ok, location: @reinforcement_type }\n else\n format.html { render :edit }\n format.json { render json: @reinforcement_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7b3ebf3de8a8363c55cda1ec38d126f9", "score": "0.5541422", "text": "def update\n @warrantytype = Warrantytype.find(params[:id])\n\n respond_to do |format|\n if @warrantytype.update_attributes(params[:warrantytype])\n format.html { redirect_to(@warrantytype, :notice => 'Warrantytype was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @warrantytype.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "67a5cb2324725ec290eb435577233967", "score": "0.55380255", "text": "def update\n @entity_type = EntityType.find(params[:id])\n\n respond_to do |format|\n if @entity_type.update_attributes(params[:entity_type])\n format.html { redirect_to @entity_type, notice: 'Entity type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @entity_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1317fe9ee9261995a3c38389ade72579", "score": "0.5523357", "text": "def update\n respond_to do |format|\n if @type.update(type_params)\n format.html { redirect_to @type, notice: 'Type was successfully updated.' }\n format.json { render :show, status: :ok, location: @type }\n else\n format.html { render :edit }\n format.json { render json: @type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1317fe9ee9261995a3c38389ade72579", "score": "0.5523357", "text": "def update\n respond_to do |format|\n if @type.update(type_params)\n format.html { redirect_to @type, notice: 'Type was successfully updated.' }\n format.json { render :show, status: :ok, location: @type }\n else\n format.html { render :edit }\n format.json { render json: @type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ce3bc8c03cbe136175b1da2296e26d9b", "score": "0.55203116", "text": "def update\n respond_to do |format|\n if @usage_type.update(usage_type_params)\n format.html { redirect_to @usage_type, notice: 'Usage type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @usage_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "faac8eb10f482b225a48d3eb9ffb60d4", "score": "0.5520186", "text": "def update\n @threat_type = ThreatType.find(params[:id])\n\n respond_to do |format|\n if @threat_type.update_attributes(params[:threat_type])\n format.html { redirect_to(@threat_type, :notice => 'Threat type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @threat_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b132de04469240a543618c6e195f5d81", "score": "0.55187565", "text": "def update\n @type_status_consignation = TypeStatusConsignation.find(params[:id])\n\n respond_to do |format|\n if @type_status_consignation.update_attributes(params[:type_status_consignation])\n format.html { redirect_to(@type_status_consignation, :notice => 'Type status consignation was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @type_status_consignation.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a2302ec87383f4d8390ff7ce197cb73d", "score": "0.5518575", "text": "def update\n @evaluation_type = EvaluationType.find(params[:id])\n\n respond_to do |format|\n if @evaluation_type.update_attributes(params[:evaluation_type])\n format.html { redirect_to @evaluation_type, notice: 'Tipo de evaluacion actualizado exitosamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @evaluation_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e6c4c66d03665bc26f5edd4b3c5dd814", "score": "0.55172753", "text": "def update\n respond_to do |format|\n if @type_resource.update(type_resource_params)\n format.html { redirect_to @type_resource, notice: 'EL tipo de recurso fue modificado éxitosamente.' }\n format.json { render :show, status: :ok, location: @type_resource }\n else\n format.html { render :edit }\n format.json { render json: @type_resource.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8a02c71e29ab4de68296fe9e9aefccb1", "score": "0.5511729", "text": "def update\n @performance_type = PerformanceType.find(params[:id])\n\n respond_to do |format|\n if @performance_type.update_attributes(params[:performance_type])\n format.html { redirect_to @performance_type, :notice => 'Performance type was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @performance_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0869fb07b93dff21adac586d29cf4a72", "score": "0.5511238", "text": "def update\n @budget_type = BudgetType.find(params[:id])\n\n respond_to do |format|\n if @budget_type.update_attributes(params[:budget_type])\n format.html { redirect_to @budget_type, notice: 'Budget type was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @budget_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4d179db3209f83396add42d95d429cbb", "score": "0.5503439", "text": "def update\n @ot_type = OtType.find(params[:id])\n\n respond_to do |format|\n if @ot_type.update_attributes(params[:ot_type])\n format.html { redirect_to @ot_type, notice: 'Ot type was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ot_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ea2fb841f284119bce9304a754897572", "score": "0.55026865", "text": "def update\n respond_to do |format|\n if @entry_type.update(type_params)\n format.html { redirect_to @entry_type, notice: 'Type was successfully updated.' }\n format.json { render :show, status: :ok, location: @entry_type }\n else\n format.html { render :edit }\n format.json { render json: @entry_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f476c737f5cfcd2235ccc9932d89e358", "score": "0.5498628", "text": "def update\n respond_to do |format|\n if @perf_type.update(perf_type_params)\n format.html { redirect_to @perf_type, notice: 'Perf type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @perf_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8992215c97a571ad2db8557f95d41a3e", "score": "0.54982626", "text": "def set_type_incidence\n @type_incidence = TypeIncidence.find(params[:id])\n end", "title": "" }, { "docid": "275972e96dd47e80d06604a3c25677ea", "score": "0.54975474", "text": "def update\n respond_to do |format|\n if @expensetype.update(expensetype_params)\n format.html { redirect_to @expensetype, notice: 'Expensetype was successfully updated.' }\n format.json { render :show, status: :ok, location: @expensetype }\n else\n format.html { render :edit }\n format.json { render json: @expensetype.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1faa91e9633d332acb07c3cce9fc4dc8", "score": "0.54970956", "text": "def update\n @status_type = StatusType.find(params[:id])\n\n respond_to do |format|\n if @status_type.update_attributes(params[:status_type])\n flash[:notice] = 'Status Type was successfully updated.'\n format.html { redirect_to(@status_type) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @status_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b36a61097277c4c00db9b571e4bd55cd", "score": "0.5489625", "text": "def update\n respond_to do |format|\n if @responsibility_type.update(responsibility_type_params)\n format.html { redirect_to @responsibility_type, notice: 'Responsibility type was successfully updated.' }\n format.json { render :show, status: :ok, location: @responsibility_type }\n else\n format.html { render :edit }\n format.json { render json: @responsibility_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4f7f8b30e048e201e6dc45546d90b0cf", "score": "0.5484675", "text": "def update\n @financial_assistance_option_type = FinancialAssistanceOptionType.find(params[:id])\n\n respond_to do |format|\n if @financial_assistance_option_type.update_attributes(params[:financial_assistance_option_type])\n format.html { redirect_to(@financial_assistance_option_type, :notice => 'Financial assistance option type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @financial_assistance_option_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "577f2742c6b4ff286f80f4f929163df4", "score": "0.5484276", "text": "def update\n respond_to do |format|\n if @degree_requirement_type.update(degree_requirement_type_params)\n format.html { redirect_to @degree_requirement_type, notice: 'Degree requirement type was successfully updated.' }\n format.json { render :show, status: :ok, location: @degree_requirement_type }\n else\n format.html { render :edit }\n format.json { render json: @degree_requirement_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e9421f02483883c331a9eaf933c93345", "score": "0.54831266", "text": "def update\n @division_type = DivisionType.find(params[:id])\n\n respond_to do |format|\n if @division_type.update_attributes(params[:division_type])\n format.html { redirect_to @division_type, notice: 'Division type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @division_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7e4a0277498a5dc6554b22256019a5d0", "score": "0.5479696", "text": "def update\n @request_type = RequestType.find(params[:id])\n\n respond_to do |format|\n if @request_type.update_attributes(params[:request_type])\n format.html { redirect_to @request_type, notice: 'Request type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @request_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "642a71e8a60ebc957d9d622819dcfba2", "score": "0.54758227", "text": "def update\n respond_to do |format|\n handle_sample_swap if @resource.sample?\n if @resource.update strong_type params, @type, @type.downcase\n handle_successful_update\n format.html { redirect_to resource_path(@resource, :edit), notice: 'Changes successfully saved.' }\n else\n handle_invalid\n format.html { render :edit }\n end\n end\n end", "title": "" }, { "docid": "23fb9ef89c2b12a5af55135a29683d7a", "score": "0.5475005", "text": "def update\n @debt_type = DebtType.find(params[:id])\n\n respond_to do |format|\n if @debt_type.update_attributes(params[:debt_type])\n flash[:notice] = 'DebtType was successfully updated.'\n format.html { redirect_to(@debt_type) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @debt_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c22bc1272c3775dd6c3f43e888af8051", "score": "0.5466506", "text": "def update\n @spell_type = SpellType.find(params[:id])\n\n if @spell_type.update(spell_type_params)\n head :no_content\n else\n render json: @spell_type.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "e5420e57e859455455de6b70c823f9ad", "score": "0.54644126", "text": "def update\n respond_to do |format|\n if @assessment_type.update(assessment_type_params)\n format.html { redirect_to @assessment_type, notice: 'Assessment type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @assessment_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a2d166e1ce5afe8b8dac5ebb7bc69adc", "score": "0.54610914", "text": "def update\n @contact_type = ContactType.find(params[:id])\n\n if @contact_type.update(contact_type_params)\n audit(@contact_type, current_user)\n head :no_content\n else\n render json: @contact_type.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "12ef17898d697f38ff54de1a26842287", "score": "0.54584336", "text": "def update\n @data_type = DataType.find(params[:id])\n\n respond_to do |format|\n if @data_type.update_attributes(params[:data_type])\n format.html { redirect_to @data_type, notice: 'Data type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @data_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d0461352f6632015458caab1cfa16f26", "score": "0.5456177", "text": "def update\n @violence_kind = ViolenceKind.find(params[:id])\n\n respond_to do |format|\n if @violence_kind.update_attributes(params[:violence_kind])\n format.html { redirect_to @violence_kind, notice: 'Violence kind was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @violence_kind.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f14c829e71d954536d9ead92f90abf26", "score": "0.5456033", "text": "def update\n @consultation_type = ConsultationType.find(params[:id])\n\n respond_to do |format|\n if @consultation_type.update_attributes(params[:consultation_type])\n format.html { redirect_to @consultation_type, notice: 'Consultation type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @consultation_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "84fcb8b34cbe74d1f4b81e2e3e3646b0", "score": "0.54515874", "text": "def update\n @attendance_type = AttendanceType.find(params[:id])\n \n respond_to do |format|\n if @attendance_type.update_attributes(params[:attendance_type])\n flash[:notice] = 'attendance type was successfully updated'\n format.html { redirect_to attendance_types_path }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @attendance_type.errors.to_xml }\n end\n end\n end", "title": "" }, { "docid": "a923a1f20a620cfc3e6ca3d0f5f52e53", "score": "0.5450259", "text": "def update\n @comparison_type = ComparisonType.find(params[:id])\n\n respond_to do |format|\n if @comparison_type.update_attributes(params[:comparison_type])\n flash[:notice] = 'ComparisonType was successfully updated.'\n format.html { redirect_to(@comparison_type) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @comparison_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "71e8a78762ad08988f247185ee74bab2", "score": "0.54476744", "text": "def update\n respond_to do |format|\n if @assessment_type.update(assessment_type_params)\n format.html { redirect_to @assessment_type, notice: 'Assessment type was successfully updated.' }\n format.json { render :show, status: :ok, location: @assessment_type }\n else\n format.html { render :edit }\n format.json { render json: @assessment_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3faaa4940de03fb2e3af1071f9d27920", "score": "0.5447469", "text": "def update\n respond_to do |format|\n if @opportunity_type.update(opportunity_type_params)\n format.html { redirect_to @opportunity_type, notice: 'Opportunity type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @opportunity_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "11eb91d253f94d6315e87b62898674ad", "score": "0.54455125", "text": "def update\n @account_type = AccountType.find(params[:id])\n\n respond_to do |format|\n if @account_type.update_attributes(params[:account_type])\n format.html { redirect_to(@account_type, :notice => 'Account type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @account_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bfeb692c2993fa52ba2f95396be1aa11", "score": "0.54440075", "text": "def set_travel_expence_type\n @travel_expence_type = TravelExpenceType.find(params[:id])\n end", "title": "" }, { "docid": "899a5c3ba5b15e9dbd8e43ebeb82ab45", "score": "0.544339", "text": "def update\n authorize RequestType\n respond_to do |format|\n if @request_type.update(request_type_params)\n format.html { redirect_to @request_type, notice: \"Request type #{@request_type.description} was successfully updated.\" }\n format.json { render :show, status: :ok, location: @request_type }\n else\n format.html { render :edit }\n format.json { render json: @request_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0498d08fc86810b5ba6ec43ed0ccfe8f", "score": "0.5439143", "text": "def update\n @model_type = ModelType.find(params[:id])\n respond_to do |format|\n if @model_type.update_attributes(params[:model_type])\n flash[:notice] = 'ModelType was successfully updated.'\n format.html { redirect_to model_type_url(@model_type) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @model_type.errors.to_xml }\n end\n end\n end", "title": "" }, { "docid": "179d578984c045f688dbd71da730a51a", "score": "0.5438254", "text": "def update\n @exchange_duration_type = ExchangeDurationType.find(params[:id])\n\n respond_to do |format|\n if @exchange_duration_type.update_attributes(params[:exchange_duration_type])\n format.html { redirect_to @exchange_duration_type, notice: 'Exchange duration type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exchange_duration_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b3a21db6be96c2ac0112d2888e93e7b5", "score": "0.54358256", "text": "def update\n respond_to do |format|\n if @type_opinion.update(type_opinion_params)\n format.html { redirect_to @type_opinion }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @type_opinion.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "defd3382b7381567f86fa8cf827ef29f", "score": "0.5434049", "text": "def update\n @data_type = DataType.find(params[:id])\n\n respond_to do |format|\n if @data_type.update_attributes(params[:data_type])\n flash[:notice] = 'File type was successfully updated.'\n format.html { redirect_to(data_types_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @data_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1d814685e7e0ba70ab76d4f68970d0c6", "score": "0.5432159", "text": "def update\n respond_to do |format|\n if @amount_type.update(amount_type_params)\n format.html { redirect_to @amount_type, notice: 'Amount type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @amount_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b58970463677d65e8cb5217ded1d2f7b", "score": "0.54309773", "text": "def update\n @crust_type = CrustType.find(params[:id])\n\n respond_to do |format|\n if @crust_type.update_attributes(params[:crust_type])\n flash[:notice] = 'CrustType was successfully updated.'\n format.html { redirect_to(@crust_type) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @crust_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cdb23a9bd8cc13a85dd431c41e7ef4a3", "score": "0.5428512", "text": "def update\n @type = ReferenceNumberType.find(params[:id])\n\n respond_to do |format|\n if @type.update_attributes(params[:reference_number_type])\n flash[:notice] = 'ReferenceNumberType was successfully updated.'\n format.html { redirect_to reference_number_types_url }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @type.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ac2ea7ce84bf1fd39d0e8ab973667c6b", "score": "0.54244244", "text": "def update\n event_type = EventType.find(params[:id])\n if event_type.update(event_type_params)\n render json: event_type, status: 200, location: [:api, event_type]\n else\n failed_to_update(event_type, \"event_type\")\n end\n end", "title": "" }, { "docid": "aaf1bf10f855cf90573b1758aec0f65b", "score": "0.5423265", "text": "def update\n @organization_type = OrganizationType.find(params[:id])\n \n respond_to do |format|\n if @organization_type.update_attributes(params[:organization_type])\n flash[:notice] = 'OrganizationType was successfully updated.'\n format.html { redirect_to(@organization_type) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @organization_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9a2efc8178ab3de7aed9a20d0af2323e", "score": "0.54228514", "text": "def update\n respond_to do |format|\n if @indicator_type.update(indicator_type_params)\n format.html { redirect_to @indicator_type, notice: 'Indicator type was successfully updated.' }\n format.json { render :show, status: :ok, location: @indicator_type }\n else\n format.html { render :edit }\n format.json { render json: @indicator_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7e9ac193baf6488dd0e9bfcc0533184d", "score": "0.54211855", "text": "def update\n respond_to do |format|\n if @usage_type.update(usage_type_params)\n format.html { redirect_to @usage_type }\n format.json { render :show, status: :ok, location: @usage_type }\n else\n format.html { render :edit }\n format.json { render json: @usage_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "044d72d783348d6a5cd258722244a205", "score": "0.54130864", "text": "def update\n respond_to do |format|\n if @crust_type.update(crust_type_params)\n format.html { redirect_to @crust_type, notice: 'Crust type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @crust_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "77ae59f10b7b010287312a837805da9c", "score": "0.54096276", "text": "def update\n @asset_type = AssetType.find(params[:id])\n\n respond_to do |format|\n if @asset_type.update_attributes(params[:asset_type])\n format.html { redirect_to @asset_type, notice: 'Asset type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @asset_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "80ed2022b0025432ba1798edb2aaf5ac", "score": "0.5409216", "text": "def update\n respond_to do |format|\n if @type_ent.update(type_ent_params)\n format.html { redirect_to @type_ent, notice: 'Type ent was successfully updated.' }\n format.json { render :show, status: :ok, location: @type_ent }\n else\n format.html { render :edit }\n format.json { render json: @type_ent.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "46c1c78269f3af246d42d38e3cea94c8", "score": "0.5409062", "text": "def update\n @annotation_type = AnnotationType.find(params[:id])\n\n respond_to do |format|\n if @annotation_type.update_attributes(params[:annotation_type])\n format.html { redirect_to @annotation_type, :notice => 'Annotation type was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @annotation_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d027231ccb2657c4a7bcfbb41f68fa60", "score": "0.54082376", "text": "def update\n @instance_type_extra_spec = InstanceTypeExtraSpec.find(params[:id])\n\n respond_to do |format|\n if @instance_type_extra_spec.update_attributes(params[:instance_type_extra_spec])\n format.html { redirect_to @instance_type_extra_spec, notice: 'Instance type extra spec was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @instance_type_extra_spec.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a1dd627ba8ecad97d73b6e84ab6124ad", "score": "0.5407248", "text": "def update\n @answer_type = AnswerType.find(params[:id])\n\n respond_to do |format|\n if @answer_type.update_attributes(params[:answer_type])\n format.html { redirect_to @answer_type, notice: 'Answer type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @answer_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
19c8e9b6177a835ee195f325ff7e086a
Push a message down one or more channels.
[ { "docid": "77c53654e591c5041657b51cffcac673", "score": "0.76464576", "text": "def push(msg, *channels)\n delegate.push(msg, *channels)\n end", "title": "" } ]
[ { "docid": "46e293959c929cb6ec6de80bcf78b181", "score": "0.75110584", "text": "def push(msg, *channels)\n channels = Array.ensure(channels).flatten\n raise ArgumentError if channels.empty?\n delegate.push(msg, channels)\n end", "title": "" }, { "docid": "02a9ab1455a374ba9a29451e87892031", "score": "0.69729435", "text": "def push(message, channels)\n channels.each do |channel|\n connections_for_channel(channel).each_pair do |channel, connections|\n connections.each do |connection|\n connection.push({\n payload: message,\n channel: channel\n })\n end\n end\n end\n end", "title": "" }, { "docid": "09e5d65633018168db026d7c979bd906", "score": "0.6616984", "text": "def push(message, channels)\n if registry.propagates? && !propagated?(message)\n return propagate(message, channels)\n elsif propagated?(message)\n message.delete(:__propagated)\n end\n\n # push to this instances connections\n channels.each do |channel_query|\n connections_for_channel(channel_query).each_pair do |channel, conns|\n conns.each do |connection|\n connection.push(payload: message, channel: channel)\n end\n end\n end\n end", "title": "" }, { "docid": "6b459acd2ae870e8438b2a27f4dd75a5", "score": "0.6572513", "text": "def push array\n message = [@array_id += 1, array]\n @messages << message\n return unless @channel\n if @channel_queue.empty?\n EventMachine.next_tick do\n if @channel\n @channel.send_data @channel_queue\n @channel_queue = []\n end\n end\n end\n @channel_queue << message\n end", "title": "" }, { "docid": "9b33f6a772191be8fb053a1950c502c5", "score": "0.6339912", "text": "def push_message route, msg, args, &block\n unless @state == :state_inited\n block_given? and yield Exception.new 'channel is not running now'\n return\n end\n send_message_by_group @channel_service, route, msg, @groups, args, &block\n end", "title": "" }, { "docid": "9ff3d9dbaec7a9c36fc9a429e5f19306", "score": "0.6241224", "text": "def publish(channel, message); end", "title": "" }, { "docid": "9ff3d9dbaec7a9c36fc9a429e5f19306", "score": "0.6241224", "text": "def publish(channel, message); end", "title": "" }, { "docid": "12af3d2898d7c3c06b265332488d51c9", "score": "0.6240663", "text": "def push msg\n put_in_queue :push, msg\n end", "title": "" }, { "docid": "a89fee0ea1a2bc038f37aeaebbf592cb", "score": "0.6176506", "text": "def push! message, topic: []\n topics = [topic].flatten\n bind! unless socket\n logger.debug \"Push message: #{message}\"\n if publisher?\n topics.each do |t|\n error? socket.send_string(t, ZMQ::SNDMORE)\n error? socket.send_string(message), raize: MessageError\n end\n elsif pusher?\n error? socket.send_string(message), raize: MessageError\n end\n message\n end", "title": "" }, { "docid": "35c8c30df206057216735ae8159fa927", "score": "0.6161575", "text": "def join *channels\n send \"JOIN #{channels.join(',')}\"\n end", "title": "" }, { "docid": "063802fc01cb5fb51d9ce9892a4fc062", "score": "0.61258906", "text": "def send_to_all(msg)\n payload = {\n :type => :chat,\n :subtype => :new_message,\n :message => build_message(msg)\n }.to_json\n @channel.push(payload)\n end", "title": "" }, { "docid": "0686268afcd3c8d2194596ddb98f77bc", "score": "0.6116524", "text": "def write(params)\n msg = get_param(params, :msg)\n raise \"No :channels argument given\" unless params.has_key?(:channels)\n channels = arrayify(params[:channels])\n if !channels.empty?\n if @environment.in_dry_run_mode\n notify(:msg => \"[#{@name}] Would write message '#{msg}' to channels #{channels.join(',')}\",\n :tags => [:irc, :dryrun])\n else\n channels.each { |channel| write_to_channel(msg, channel) }\n notify(:msg => \"[#{@name}] Wrote message '#{msg}' to channels #{channels.join(',')}\",\n :tags => [:irc, :trace])\n end\n end\n end", "title": "" }, { "docid": "4a1bee1402cb46a04cd5c332d7f162f4", "score": "0.60682064", "text": "def message_channel(msg)\n send \"PRIVMSG ##{@channel} :#{msg}\"\n end", "title": "" }, { "docid": "1d9dab7c8f7c9c5388d0756d3114b282", "score": "0.6029081", "text": "def push(message)\n unless(message.is_a?(FrameType::Message))\n abort TypeError.new \"Expecting `FrameType::Message` but received `#{message.class}`!\"\n end\n messages do |collection|\n begin\n collection[message.connection.identifier] << message\n pop_order << message.connection.identifier\n rescue Celluloid::DeadActorError\n abort Error::ConnectionUnavailable.new\n end\n end\n signal(:new_message)\n current_actor\n end", "title": "" }, { "docid": "6a5f46b69bbdf4ac6db63b82f84e9cb9", "score": "0.60074574", "text": "def publish(*message)\n message.each do |m|\n @message_queue.push m\n end\n end", "title": "" }, { "docid": "3b132485c7ccbffba6049b0482e7bb0f", "score": "0.595331", "text": "def push_notification channel, message\n @notifiers[channel.to_sym].push(message) if @notifiers[channel.to_sym]\n end", "title": "" }, { "docid": "07aba2905601fe92bfe7d4df2867c41a", "score": "0.593933", "text": "def push(msg, &block); @skype.cmd \"MESSAGE #{@id} #{msg}\", &block; end", "title": "" }, { "docid": "9175b693b6422d1c2dbf7b6825c2af54", "score": "0.59280604", "text": "def publish(channel, message, options = {})\n end", "title": "" }, { "docid": "b29b37553e14ac6f61b9df97332572ce", "score": "0.5911773", "text": "def push *args\n queue.push args\n end", "title": "" }, { "docid": "a30dae2850aaaa8323d0395a12726904", "score": "0.5891454", "text": "def add_channel channel\n join(channel)\n self\n end", "title": "" }, { "docid": "cee853a89f00bcc4722c840846302fca", "score": "0.5889217", "text": "def push_message(ws, msg)\n ws.send(msg)\n end", "title": "" }, { "docid": "38791a43510968091cb0526a9355e878", "score": "0.5888276", "text": "def dispatch(message, channel)\n push(message.to_json) unless channel =~ /^slanger:/\n end", "title": "" }, { "docid": "ce9919b5ff1bdac95443a48fbf8f0582", "score": "0.5883586", "text": "def push_output!(message)\n @instance.rpush(@output_channel, message) \n end", "title": "" }, { "docid": "ce9919b5ff1bdac95443a48fbf8f0582", "score": "0.5883586", "text": "def push_output!(message)\n @instance.rpush(@output_channel, message) \n end", "title": "" }, { "docid": "30c1ad411f8cfbda63dcbd8bed1dc48a", "score": "0.58543944", "text": "def push(*args)\n if args.first.is_a?(ThreadMsg)\n @comm_in << args.first\n elsif args.size == 1\n @comm_in << ThreadMsg.new(args.first)\n else\n @comm_in << ThreadMsg.new(args.first, args.last)\n end\n end", "title": "" }, { "docid": "66bb915119e6f184456902977e3178b1", "score": "0.58491766", "text": "def send_message\n @selected.send_message(channel)\n end", "title": "" }, { "docid": "ba28284b48dcbce8ae141cea695beac1", "score": "0.5833351", "text": "def publish(channel, event, data)\n Pusher[channel].trigger(event,data)\n end", "title": "" }, { "docid": "d5464fb7ed192276d5087c82fed37b44", "score": "0.5793214", "text": "def join(*channels)\n channels.each {|channel| raw(\"JOIN #{channel}\")}\n end", "title": "" }, { "docid": "2b1566c0753f948ef2996d5997ecca34", "score": "0.57832634", "text": "def push(*items)\n EM.schedule do\n @sink.push(*items)\n unless @popq.empty?\n @drain = @sink\n @sink = []\n @popq.shift.call @drain.shift until @drain.empty? || @popq.empty?\n end\n end\n end", "title": "" }, { "docid": "b756ccb4dae1ea6c5557f8cfcb5cea4f", "score": "0.5778913", "text": "def publish(*args)\n channel.publish(*args)\n end", "title": "" }, { "docid": "b164d7c701fcfe919d67ada60986fb71", "score": "0.5738311", "text": "def write(*message)\n if(connection.alive?)\n if(message.size > 1)\n debug 'Multiple message publish'\n connection.transmit(\n Command::Mpub.new(\n :topic_name => topic,\n :messages => message\n )\n )\n else\n debug 'Single message publish'\n connection.transmit(\n Command::Pub.new(\n :message => message.first,\n :topic_name => topic\n )\n )\n end\n else\n abort Error.new 'Remote connection is unavailable!'\n end\n end", "title": "" }, { "docid": "70564e32b75eb49968e3794227b8a61b", "score": "0.5733112", "text": "def push(message)\n @lock.synchronize do\n @messages << message\n unless @waiting.empty? # Notify waiting senders\n # NOTE: the call to self.send_to is added to the sender's work_queue,\n # and will be executed in the sender's thread\n @waiting.each { |s| s.work_queue.add { self.send_to(s); } }\n @waiting.clear\n end\n end\n end", "title": "" }, { "docid": "88d8ffdcbdc8254399088accd7d84a04", "score": "0.5726649", "text": "def channel_send( sender, channel, message, type='ice-msg-b')\n packet_send( sender, type, '*', '*', {:channel => channel, :text => message, :emote => 0, :echo => 1 })\n end", "title": "" }, { "docid": "e78e69725eee54af42e822d520de06d3", "score": "0.5714758", "text": "def notify_channels\n channels.each do |channel|\n self.class.connection.execute('NOTIFY %s, %s' % [channel, payload])\n end\n end", "title": "" }, { "docid": "9a28871cab9380412fb36dd6e50c9dd8", "score": "0.5694945", "text": "def push(msg)\n push_raw(wrap(msg).to_s)\n end", "title": "" }, { "docid": "0cdcae3ecb26973e51d002a6429c9020", "score": "0.5693082", "text": "def push(channel, event, data)\n publish('pusher.push', channel: channel, event: event, data: data)\n end", "title": "" }, { "docid": "edc7a33748d406dc5c067e511ceda515", "score": "0.56824905", "text": "def join\n Mattermost.post(\"/channels/#{self.id}/join\")\n end", "title": "" }, { "docid": "80e25411109fe9f83e2c7996ff5d60cb", "score": "0.56757206", "text": "def publish_to(channel, data)\n publish_message(message(channel, data))\n end", "title": "" }, { "docid": "80e25411109fe9f83e2c7996ff5d60cb", "score": "0.56757206", "text": "def publish_to(channel, data)\n publish_message(message(channel, data))\n end", "title": "" }, { "docid": "0472271e52d178c4d6a39d8eaf7bbeb1", "score": "0.56701404", "text": "def subscribe(channel, *channels, &block); end", "title": "" }, { "docid": "ad9b078e32a428a5087b2472b526ed4d", "score": "0.56608456", "text": "def push(*items)\n ::BubbleWrap::Reactor.schedule do\n @items.push(*items)\n @popq.shift.call @items.shift until @items.empty? || @popq.empty?\n end\n end", "title": "" }, { "docid": "c5aa9ec86a3b4cf45a243a5aff5ac010", "score": "0.56231874", "text": "def send message\n Thread.exclusive do\n @chat << message\n @listeners.each {|t,n| t.wakeup}\n end\n end", "title": "" }, { "docid": "b0f50a8940a946a54415fbe0cff66923", "score": "0.5615706", "text": "def send_message_by_group service, route, msg, groups, args, &block\n app = service.app\n namespace = 'sys'\n service = 'channelRemote'\n method = 'pushMessage'\n count = groups.length\n success_flag = false\n fail_ids = []\n\n block_given? and yield if count == 0\n\n latch = Utils::CountDownLatch.new(count) {\n unless success_flag\n block_given? and yield Exception.new 'all uids push message fail'\n return\n end\n block_given? and yield nil, fail_ids\n }\n\n rpc_cb = Proc.new { |server_id|\n Proc.new { |err, fails|\n if err\n latch.done\n return\n end\n fail_ids += fails if fails\n success_flag = true\n latch.done\n }\n }\n\n args = { :type => 'push', :user_args => args || {} }\n\n send_message = Proc.new { |sid|\n if sid == app.server_id\n service.channelRemote.send method, route, msg, groups[sid], args, &rpc_cb.call\n else\n app.rpc_invoke(sid, {\n :namespace => namespace,\n :service => service,\n :method => method,\n :args => [route, msg, groups[sid], args]\n }, &rpc_cb.call(sid))\n end\n }\n\n groups.each_with_index { |group, sid|\n if group && group.length > 0\n send_message sid\n else\n EM.next_tick { rpc_cb.call.call }\n end\n }\n end", "title": "" }, { "docid": "f7b873556de8d59dc38c78886eaa4a68", "score": "0.56069607", "text": "def push(msg)\n payload = {\n :payload => msg,\n :widget => self.widget_name,\n :widget_id => self.widget_id\n }\n\n message = { :message => payload }\n\n channel.push self.encoder.encode(message)\n ensure\n log.info(widget_name) { \"Pushing #{message.inspect} via #{channel}\" }\n end", "title": "" }, { "docid": "d089a43517700c02e2c549c71f41ca48", "score": "0.5593696", "text": "def psubscribe(*channels, &block); end", "title": "" }, { "docid": "d089a43517700c02e2c549c71f41ca48", "score": "0.5593696", "text": "def psubscribe(*channels, &block); end", "title": "" }, { "docid": "1b5803ad81f49287ef3b143d3685e2f8", "score": "0.55897796", "text": "def notify(msg, opts={})\n if opts[:poke_channel]\n if msg.lines.size > 1\n msg << \"\\n\" if msg[-1] != \"\\n\"\n msg << \"<!channel> (see above)\"\n else\n msg = \"<!channel> \" << msg\n end\n end\n \n @pending << msg\n send_pending\n end", "title": "" }, { "docid": "cbe9e15367ee12b0136d1e91ef4a5fc9", "score": "0.55739206", "text": "def message(message)\n channel.message(message)\n end", "title": "" }, { "docid": "6b674f5ca8bdc90de12b2e0186b5ded7", "score": "0.5572158", "text": "def push message\n @on_push_callback && @on_push_callback.call(self, message)\n end", "title": "" }, { "docid": "d9802e64e01995b2ba6a38231cc13f7c", "score": "0.5570819", "text": "def push!(*args)\n raise NotImplementedError\n end", "title": "" }, { "docid": "86401616ce96398708d5fd16f125f7f0", "score": "0.55665815", "text": "def subscribe(*channels, &block); end", "title": "" }, { "docid": "83fd5cac4e1df20bb254672a7c6532cd", "score": "0.5536747", "text": "def join(channels)\n state.join(self, channels)\n end", "title": "" }, { "docid": "9f40ea4af4b2369d214176a075214f5d", "score": "0.5536527", "text": "def send_join channel\n if channel.is_a? Array\n buf = []\n\n channel.each do |c|\n next if channels.include? c\n\n buf << c\n\n if buf.length == 4\n send_join channel.join(',')\n buf.clear\n end\n end\n\n send_join buf.join(',') unless buf.empty?\n elsif channel.is_a? Hash\n buf, keys = [], []\n\n channel.each do |c, k|\n next if channels.include? c\n\n buf << c\n keys << (k.empty? ? k : 'x')\n\n if buf.length == 4\n send_join \"#{buf.join(',')} #{keys.join(',')}\"\n buf.clear\n keys.clear\n end\n end\n send_join \"#{buf.join(',')} #{keys.join(',')}\" unless buf.empty?\n else\n send_command 'JOIN', channel\n end\n end", "title": "" }, { "docid": "8533b2dff40a32b87ad84705d8ba8260", "score": "0.5475161", "text": "def broadcast(message, chatters)\n chatters.each do |chatter| #Goes through an array of chatters\n chatter.puts message #sends a message to each one (new client joined the chat)\n end\nend", "title": "" }, { "docid": "a21c52bc2a7edf4ec7e1561badd09a84", "score": "0.5473863", "text": "def send_data(data)\n channels.each { |channel| channel.send_data(data) }\n self\n end", "title": "" }, { "docid": "709be7c7f6cc22de119fe95a3f687cdc", "score": "0.54709715", "text": "def send(*msgArray)\n send!(0, *msgArray)\n end", "title": "" }, { "docid": "c5ceec9b5d289123b233306066e5c572", "score": "0.5470923", "text": "def publish(channel_name, message)\n raise \"Not implemented\"\n end", "title": "" }, { "docid": "47566aa0201aba313d8d0d93ba57c86f", "score": "0.54703057", "text": "def pushes; end", "title": "" }, { "docid": "13e6457edc578389d5033c6e50884c8f", "score": "0.5458299", "text": "def send_message\n channel =SlackChannel.new(params[:channel])\n channel.send(params[:message])\n redirect_to chats_path\n end", "title": "" }, { "docid": "e49fc0acecd1b751c31714c0d33b14eb", "score": "0.5448822", "text": "def publish message\n # Require Pusher\n require 'pusher'\n # Publish to url\n Pusher.url = \"http://#{Rails.application.secrets.pusher_app_key}:#{Rails.application.secrets.pusher_app_secret}@api.pusherapp.com/apps/#{Rails.application.secrets.pusher_app_id}\"\n # Publish channel, event and message\n Pusher[self.user_hash].trigger('event', {\n message: message\n })\n end", "title": "" }, { "docid": "fe47ecb1972b74f339b8ce87ca200b05", "score": "0.5444429", "text": "def insert(message)\n self.messages.push message\n self.messages = self.messages.last(settings.channel_message_limit)\n self.save\n end", "title": "" }, { "docid": "f24b81b4693dccc954398d1a9041d393", "score": "0.54391664", "text": "def sends_channel_data(channel, data)\n events << LocalPacket.new(:channel_data, channel.remote_id, data)\n end", "title": "" }, { "docid": "da453de1b422ea6c5559acc0e48b2acf", "score": "0.5437489", "text": "def push(key, *items)\n @queue[key] += Array.wrap(items).flatten\n end", "title": "" }, { "docid": "6d99a45adb362be5fb515f5a645c6387", "score": "0.5434208", "text": "def inform!(message)\n slack_channels.map do |channel|\n message_with_channel = message.merge(channel: channel['id'], as_user: true)\n logger.info \"Posting '#{message_with_channel.to_json}' to #{self} on ##{channel['name']}.\"\n rc = slack_client.chat_postMessage(message_with_channel)\n\n {\n ts: rc['ts'],\n channel: channel['id']\n }\n end\n end", "title": "" }, { "docid": "6d99a45adb362be5fb515f5a645c6387", "score": "0.5434208", "text": "def inform!(message)\n slack_channels.map do |channel|\n message_with_channel = message.merge(channel: channel['id'], as_user: true)\n logger.info \"Posting '#{message_with_channel.to_json}' to #{self} on ##{channel['name']}.\"\n rc = slack_client.chat_postMessage(message_with_channel)\n\n {\n ts: rc['ts'],\n channel: channel['id']\n }\n end\n end", "title": "" }, { "docid": "41aae4fcb325bfd912cdc11b15169774", "score": "0.54286766", "text": "def send_message(message)\n dd_message = dd_messagify(message)\n if dd_message.is_a?(DripDrop::Message)\n @send_queue.push([dd_message.encoded])\n elsif message.class == Array\n @send_queue.push(message)\n else\n @send_queue.push([message])\n end\n \n self.write_connection.register_writable if @send_queue_enabled\n \n EM::next_tick {\n on_writable(self.write_connection)\n }\n end", "title": "" }, { "docid": "ed550e06c67d8f926a443b65359ce23e", "score": "0.54184896", "text": "def broadcast(channel, message)\n redis.publish(\"dispatch\", format(channel, message))\n end", "title": "" }, { "docid": "09b51a6ce27ef72ac3b597ca5099632b", "score": "0.5412337", "text": "def deliver(message)\n inbox.push message\n end", "title": "" }, { "docid": "8f99986587e644f41f9424be3faafe71", "score": "0.54104006", "text": "def channel(*args)\n @state.channel = args.first unless args.empty?\n @state.channel\n end", "title": "" }, { "docid": "aaceb615581c44176d2be05935eafece", "score": "0.54011405", "text": "def join(channel)\n send \"JOIN #{channel}\"\n end", "title": "" }, { "docid": "894b44e43868f142eb178a8f714e615b", "score": "0.53924316", "text": "def dm!(message)\n unless channel_id\n channel = slack_client.conversations_open(users: users.map(&:user_id).join(','))\n update_attributes!(channel_id: channel.channel.id)\n end\n slack_client.chat_postMessage(message.merge(channel: channel_id, as_user: true))\n end", "title": "" }, { "docid": "23efbb19bb8649a18e156c7a2381cfd0", "score": "0.5390322", "text": "def publish(channel_name, message)\n @redis.publish(channel_name.to_sym, message)\n end", "title": "" }, { "docid": "7037b4f6ee67c6a235be6ba3f3e2ef81", "score": "0.53879446", "text": "def inform!(message)\n slack_channels.map do |channel|\n message_with_channel = message.merge(channel: channel['id'], as_user: true)\n logger.info \"Posting '#{message_with_channel.to_json}' to #{self} on ##{channel['name']}.\"\n rc = slack_client.chat_postMessage(message_with_channel)\n\n {\n ts: rc['ts'],\n channel: channel\n }\n end\n end", "title": "" }, { "docid": "7037b4f6ee67c6a235be6ba3f3e2ef81", "score": "0.53879446", "text": "def inform!(message)\n slack_channels.map do |channel|\n message_with_channel = message.merge(channel: channel['id'], as_user: true)\n logger.info \"Posting '#{message_with_channel.to_json}' to #{self} on ##{channel['name']}.\"\n rc = slack_client.chat_postMessage(message_with_channel)\n\n {\n ts: rc['ts'],\n channel: channel\n }\n end\n end", "title": "" }, { "docid": "ec8708343d1ec8cf9571638306cdd863", "score": "0.5387236", "text": "def send_message(message)\n if muted?\n CachedArray(messages_key).push :nick => @nick, :content => message\n else\n CachedArray('chat/users').each do |u|\n CachedArray(messages_key(u)).push :nick => @nick, :content => message\n end\n end\n end", "title": "" }, { "docid": "fb04ec966efabf673486a1215ecbe929", "score": "0.53833085", "text": "def join(channels)\n @context.join(channels)\n end", "title": "" }, { "docid": "0d014853cba8bc0170982ab32a6f1a01", "score": "0.53814626", "text": "def push(message)\n index = redis.rpush(mailbox_key, encode(message))\n expire(mailbox_key)\n expire(consumer_list_key)\n consumers = redis.zrange(consumer_list_key, 0, -1)\n consumers.each do |consumer_key|\n redis.lpush(consumer_key, index)\n expire(consumer_key)\n end\n consumers.count\n end", "title": "" }, { "docid": "b43ee05a95c53ca70679d4062abcb541", "score": "0.53805697", "text": "def push(message_body)\n better_client.push queue_name, message_body\n end", "title": "" }, { "docid": "fd4e5a0addd0c7e05a47bdf33c8059e4", "score": "0.5370901", "text": "def push_message(data)\n @queue_mutex.synchronize do\n @callbacks.each do |callback|\n @callback_queue.push([callback, data])\n end\n end\n end", "title": "" }, { "docid": "a2ac069f50505cec4afbb53e7b48b4e1", "score": "0.536932", "text": "def notify_channels\n notification_channels.each do |channel|\n self.class.connection.execute('NOTIFY %s, %s' % [channel, payload])\n end\n end", "title": "" }, { "docid": "457f210c1d223ecb0ea551d6f7ca5b84", "score": "0.5366976", "text": "def flush\n return unless is_runner_listening?\n while message = @redis.lpop(QUEUE_KEY)\n message = ActiveSupport::JSON.decode message\n channel = \"#{MESSAGE_PREFIX}:#{message[\"action\"]}\"\n puts \"publishing to channel #{channel}\"\n @redis.publish channel, message[\"data\"].to_s\n end\n end", "title": "" }, { "docid": "84986194048b417c07fdacd61dcddf56", "score": "0.5364656", "text": "def <<(message)\n # make non-blocking ? \n remote_pump.deliver(message) \n end", "title": "" }, { "docid": "84bd4996be36c571355e3e8d045295b8", "score": "0.53580624", "text": "def push(*items)\n EM.schedule do\n @items.push(*items)\n @popq.shift.call @items.shift until @items.empty? || @popq.empty?\n end\n end", "title": "" }, { "docid": "5e8b43cd9092af08f0f99a938faf6faf", "score": "0.5357422", "text": "def send_commands_to_channel(channel, commands, interval = nil)\n commands.each do |command|\n if interval\n sleep interval\n end\n send_irc channel, command\n end\n end", "title": "" }, { "docid": "f419180abcabf55923ec636899a82ebf", "score": "0.53573966", "text": "def push(requested_channel, data)\n CHANNELS.each do |channel|\n if requested_channel == channel[:channel]\n GameOverseer::ServiceManager::SERVICES.each do |service|\n if service.class.name == channel[:klass].class.name\n service.send(:update, data)\n end\n end\n end\n end\n end", "title": "" }, { "docid": "7db8a64e064bf0688948d314c3b023a9", "score": "0.5353968", "text": "def store_message(msg, channels)\n self.expire_queued_messages!\n @messages << { :channels => channels, :message => msg, :timeout => Time.now + options[:timeout] }\n end", "title": "" }, { "docid": "f74bd6c7ee0f4f64401e87e03e6db50d", "score": "0.5349174", "text": "def publish(channel_name, message)\n MessageBusTasks.publish(channel_name, message)\n end", "title": "" }, { "docid": "bc0296658e21b7717b908a9969431a3b", "score": "0.53424275", "text": "def write_queue(msg)\n # REDISREAD.lpush(\"toJava\", msg)\n redis = REDISLOCALW\n record_event(msg)\n # if ENV[\"RAILS_ENV\"] == \"development\"\n # redis = REDISLOCALW\n # else\n # redis = REDISWRITE\n # end\n # puts \"writing\"\n redis.lpush(\"toJava#{REDISCHAN}\", msg)\n end", "title": "" }, { "docid": "1bc38ab3caed70c0c96d43ac606e0731", "score": "0.53387266", "text": "def channel_commands(name)\n\t name = name.strip.to_s\n\t begin\n @cli.join_channel(name)\n @@currentChannel = name\n rescue # In case invalid channel name is entered\n send(\"Invalid Channel Name\")\n end\n\t\tsleep(1)\n\tend", "title": "" }, { "docid": "b90caf2820cd84a51742310c3d780587", "score": "0.5334576", "text": "def push(other)\n push_logs other\n end", "title": "" }, { "docid": "364de77ffa7ef2c6e1e6f99320e5935b", "score": "0.53221774", "text": "def deliver( to, message )\n to = [to] unless to.is_a?( Array )\n to.each do |email|\n msg = Jabber::Message::new( email, message )\n msg.type = :chat\n @jabber.send( msg )\n end\n end", "title": "" }, { "docid": "ce6b274c737e4d97d4022564c2cbfb4a", "score": "0.53195167", "text": "def push\r\n\r\n end", "title": "" }, { "docid": "0d65d45f38682b0b00df37acab1da30a", "score": "0.53194714", "text": "def send_via_post\n\t\t# This is a gem, from here:\n\t\t# http://ruby-growl.rubyforge.org/ruby-growl/README_txt.html\n\t\trequire 'ruby-growl'\n\t\t# Maybe use the channel address field as the \"host/password\"?...\n\t\tg = Growl.new(channel.address.split(/\\//)[0], 'ComHub', ['ComHub'],\n\t\t\t['ComHub'], channel.address.split(/\\//)[1])\n\t\tg.notify(['ComHub'], subject, body, \"ComHub\")\n\t\tself.deliver!\n\tend", "title": "" }, { "docid": "e1d433f1033c0e780aecb583b7cfdaf6", "score": "0.5315562", "text": "def post_to_channel(channel, message)\n client.chat_postMessage(channel: channel, text: message, as_user: false, username: @slack_config.bot_name)\n end", "title": "" }, { "docid": "9c8fe19bdc55d44035e0e70ebe11bb59", "score": "0.5313587", "text": "def send_pending_messages\n begin\n while (msg = @pending.pop)\n self.discover_channel_id if !@channel_id\n\n data = \"{\"\n data += %( channel: \"#{@channel_id}\" )\n data += %(, ts: \"#{msg[:from_action].message_ts}\" ) if msg[:from_action]\n data += %(, text: #{msg[:text].to_json} ) if msg[:text]\n data += %(, blocks: #{msg[:blocks]} ) if msg[:blocks]\n data += \"}\"\n\n method = msg[:from_action] ? SLACK_UPDATE_MESSAGE_METHOD : SLACK_POST_MESSAGE_METHOD\n response_data = slack_api(method, SLACK_BOT_TOKEN, data, accept_notok=true)\n \n if response_data['ok'] == false\n # @pending.unshift msg\n break\n end\n\n sleep 0.5 # send up to 2 per second\n end\n rescue => e\n log :error, 'slack sender died', exception: e\n end\n end", "title": "" }, { "docid": "9511944a6becd95f76cb60bd0b23c95b", "score": "0.5312987", "text": "def deliver(message)\n @queue.push(message)\n end", "title": "" }, { "docid": "686bf3226cae073267e40f13b87fcd98", "score": "0.5308468", "text": "def publish(options)\n\t\traise 'NoChannelProvided' unless options[:channel]\n\t\traise 'NoMessageProvided' unless options[:message]\n\t\tmessaging_client.publish(options[:channel], options[:message])\n\tend", "title": "" }, { "docid": "df274c15dd46d93f73a6815c97590d89", "score": "0.5302889", "text": "def publish(options={})\n\t\traise 'No Channel Provided' if !options[:channel]\n\t\traise 'No Message Provided' if !options[:message]\n\t\tself.messaging_server.get_client.publish(options[:channel], options[:message])\n\tend", "title": "" }, { "docid": "dfa423085ff065e533384d34d3550d35", "score": "0.53028864", "text": "def receive_channel_state message\n if channel = channel_by_id(message.channel_id)\n channel.synchronize message\n else\n channel = Channel.new message.channel_id, message.name\n channel.synchronize message\n\n @channels << channel\n end\n end", "title": "" }, { "docid": "8db165420ff315f1833c08fb3645f36a", "score": "0.53004384", "text": "def channels_join(options={})\n throw ArgumentError.new(\"Required arguments :name missing\") if options[:name].nil?\n post(\"channels.join\", options)\n end", "title": "" } ]
147a080bafe9b47824d6875c2829979b
Implement a method merge_sort that sorts an Array:
[ { "docid": "6178c7da6f253581656883d2d9ea49b9", "score": "0.7760206", "text": "def merge_sort(arr)\n return arr if arr.length <= 1 \n\n mid = arr.length/2\n left_arr = arr[0...mid]\n right_arr = arr[mid..-1]\n\n sorted_left_arr = merge_sort(left_arr)\n sorted_right_arr = merge_sort(right_arr)\n\n merge(sorted_left_arr, sorted_right_arr)\n end", "title": "" } ]
[ { "docid": "159bc4d733fabfb3e2a4030d1a47a913", "score": "0.8998524", "text": "def merge_sort array\nend", "title": "" }, { "docid": "b4cfc7e651465c8c64d2dc6c7a9f8663", "score": "0.8945444", "text": "def merge_sort(array)\nend", "title": "" }, { "docid": "b4cfc7e651465c8c64d2dc6c7a9f8663", "score": "0.8945444", "text": "def merge_sort(array)\nend", "title": "" }, { "docid": "042fc0e78c4ca73da112c387006e1b6a", "score": "0.8802309", "text": "def merge_sort(array)\n\nend", "title": "" }, { "docid": "042fc0e78c4ca73da112c387006e1b6a", "score": "0.8802309", "text": "def merge_sort(array)\n\nend", "title": "" }, { "docid": "f1cbbd6aeaee55fd772371e8a90eb35d", "score": "0.8631958", "text": "def merge_sort(array)\n # \nend", "title": "" }, { "docid": "dd399a3650f2f6abf4145a64b6a58b5e", "score": "0.83844215", "text": "def merge_sort\n Sorting.split_array(array_list, self)\n end", "title": "" }, { "docid": "3cd4bad40ab3b31cea15c23f86db7caa", "score": "0.8371102", "text": "def merge_sort(arry)\n\t\tif arry.length <= 1\n\t\t\tarry\n\t\telse\n\t\t\ta = arry[0...(arry.length / 2)]\n\t\t\tb = arry[(arry.length / 2)..arry.length]\n\t\t\tmerge(merge_sort(a), merge_sort(b))\n\t\tend\n\tend", "title": "" }, { "docid": "21e92507b36f9c325223a008a00ffeb5", "score": "0.8363822", "text": "def merge_sort\n return self if self.size <= 1\n\n mid = (self.length / 2).floor\n\n # divide the array\n lhs = self.slice(0, mid).merge_sort\n rhs = self.slice(mid, self.length).merge_sort\n\n merge(lhs, rhs)\n end", "title": "" }, { "docid": "26f78933b0d2cc1a079c885e54bfea6e", "score": "0.8288623", "text": "def merge_sort(a)\n return a if a.size <= 1\n l, r = split_array(a)\n result = combine(merge_sort(l), merge_sort(r))\n end", "title": "" }, { "docid": "31c71bbb0470574fa7d573c043d2f42a", "score": "0.82707906", "text": "def merge_sort(array)\n merge_into(array.dup, array, 0, array.size)\n array\n end", "title": "" }, { "docid": "d8e256b1547247bc7134a58405e24ff6", "score": "0.8215416", "text": "def merge_sort(ary)\n ary = break_array(ary, results = Array.new, final = [])\n multi_array(ary, counter = 0, original_array = ary)\nend", "title": "" }, { "docid": "60a6985802e37d30d94849fec0f43a2c", "score": "0.8210405", "text": "def merge_sort(array, &prc)\nend", "title": "" }, { "docid": "82680db02319245dfc1fa99ff87dc677", "score": "0.820976", "text": "def merge_sort(array)\n\tif array.length <= 1\n\t\tarray\n\telse\t\n\t\tmid = array.length / 2\n\t\tarray_left = merge_sort(array[0, mid])\n\t\t\n\t\tarray_right = merge_sort(array[mid, array.length])\n\t\t\n\t\tp merge(array_left, array_right)\n\tend\nend", "title": "" }, { "docid": "2d18a87a9d0ee56aaaa072192f2343d6", "score": "0.82077205", "text": "def merge_sort(array)\n\t if array.length <= 1\n\t array\n\t else\n\t mid = (array.length / 2).floor\n\t left = merge_sort(array[0..mid-1])\n\t right = merge_sort(array[mid..array.length])\n\t merge(left, right)\n\t end\n\tend", "title": "" }, { "docid": "7e02decec80e9695198b41a5b9ddd928", "score": "0.8171485", "text": "def merge_sort(array)\n return array if array.length <= 1\n array1 = array[0..array.length / 2 - 1]\n array2 = array[array.length / 2..-1]\n array1.length > 1 ? array1_sorted = merge_sort(array1) : array1_sorted = array1\n array2.length > 1 ? array2_sorted = merge_sort(array2) : array2_sorted = array2\n merge_sorted_arrays(array1_sorted, array2_sorted)\n end", "title": "" }, { "docid": "df8ebbc1c591323cd85c50328186462e", "score": "0.8166945", "text": "def sort_array", "title": "" }, { "docid": "a2aaa00d7e298481d65ad4b004a2a290", "score": "0.8156022", "text": "def merge_sort(array)\n return array if array.size <= 1\n cut = (array.size / 2) - 1\n array1, array2 = array[0..cut], array[cut+1..-1]\n merge(merge_sort(array1), merge_sort(array2))\nend", "title": "" }, { "docid": "3a1fbbff1314bf829ef844d735b6cd8c", "score": "0.81245863", "text": "def merge_sort (array, &prc)\n return array if array.length <= 1\n\n mid_idx = array.length / 2\n merge(\n merge_sort(array.take(mid_idx), &prc),\n merge_sort(array.drop(mid_idx), &prc),\n &prc\n )\nend", "title": "" }, { "docid": "14029e4283f30086e82111e28e73dee2", "score": "0.8121291", "text": "def merge_sort(array)\n ary_size = array.size\n return array if ary_size == 1\n\n ary_left = merge_sort(array[0...ary_size / 2])\n ary_right = merge_sort(array[ary_size / 2...ary_size])\n\n merge(ary_left, ary_right)\nend", "title": "" }, { "docid": "2a784369d5c2a126aa3e73dc33edc037", "score": "0.81028897", "text": "def merge_sort(array, &prc)\n return array if array.length <= 1\n mid = array.length / 2\n left = array.take(mid)\n right = array.drop(mid)\n merged_left = merge_sort(left, &prc)\n merged_right = merge_sort(right, &prc)\n\n merge(merged_left, merged_right, &prc)\nend", "title": "" }, { "docid": "ee94138fdfde1895c9063765de52f8d9", "score": "0.80702776", "text": "def merge_sort(array)\n return array if array.length == 1 #until the list is broken down enough, only then can all the pending merge(left) and merge(right) sort the entire array \n \n midpoint = array.length / 2\n left = array.slice(0, midpoint - 1)\n right = array.slice(midpoint, array.length)\n merge(merge_sort(left), merge_sort(right))\nend", "title": "" }, { "docid": "3489587587d8dedf6e083c20bbcbc2bf", "score": "0.80666286", "text": "def poorly_written_ruby_2(*arrays)\n sorted_array = merge_sort(arrays.flatten)\n # Return the sorted array\n sorted_array\n end", "title": "" }, { "docid": "9e454c72b13f5e9e50ebbbb9c63bf302", "score": "0.80555284", "text": "def merge_sort(array)\n return array if array.length <= 1\n\n mid_idx = array.length / 2\n merge(merge_sort(array[0...mid_idx]), merge_sort(array[mid_idx..-1]))\nend", "title": "" }, { "docid": "4c5389d05b23538312b15bada3b5b0b1", "score": "0.8050167", "text": "def merge_sort(&prc)\n return self if length <= 1\n prc ||= Proc.new { |x,y| x.length <=> y.length }\n\n mid = count / 2\n sorted_left = self.take(mid).merge_sort(&prc)\n sorted_right = self.drop(mid).merge_sort(&prc)\n\n result = Array.merge(sorted_left, sorted_right, &prc)\n end", "title": "" }, { "docid": "71ba55a83b32f39381e514f4580bfe80", "score": "0.8046622", "text": "def merge_sort(array)\n\tif array.length <= 1\n\t\tarray\n\telse\n\t\tmiddle_index = (array.length/2)\n\t\tleft = merge_sort(array[0..middle_index-1])\n\t\tright = merge_sort(array[middle_index..array.length])\n\t\tmerge(left, right)\n\tend\nend", "title": "" }, { "docid": "20e7e6b1bff2e3f5d671605cc6d73bb9", "score": "0.8039534", "text": "def mergesort(array)\n if array.length == 1\n array\n else\n mid = array.length / 2\n sub_ar1 = mergesort(array.slice(0...mid))\n sub_ar2 = mergesort(array.slice(mid..(array.length - 1)))\n merge(sub_ar1, sub_ar2)\n end\n end", "title": "" }, { "docid": "27f72143a6f4261db2ba314a993300a8", "score": "0.80204856", "text": "def mergesort(array)\n if array.size == 1\n array\n else\n mid = array.size / 2\n left_ar = mergesort(array.slice(0...mid))\n right_ar = mergesort(array.slice(mid..-1))\n merge(left_ar, right_ar)\n end\n end", "title": "" }, { "docid": "f865df26b12bc524d39dc764f93c3475", "score": "0.80131006", "text": "def merge_sort(array)\n return array if array.length == 1 \n midpoint = array.length/2\n a = array[0..midpoint-1]\n b = array[midpoint..array.length-1]\n new_a = merge_sort(a) \n new_b = merge_sort(b) \n new_arr = merge(new_a, new_b)\n return new_arr\nend", "title": "" }, { "docid": "e2df4fc0fd489297e81866b752fa67e7", "score": "0.79938793", "text": "def merge_sort(array, &prc)\n return array if array.length <= 1\n prc ||= Proc.new { |x,y| x <=> y }\n\n mid = array.length / 2\n sorted_left = merge_sort(array.take(mid), &prc)\n sorted_right = merge_sort(array.drop(mid), &prc)\n\n merge(sorted_left, sorted_right, &prc)\nend", "title": "" }, { "docid": "7677fbaaa0b5a1921d1c1dfa1bb5f567", "score": "0.7982351", "text": "def merge_sort(array)\n return array if array.size == 1\n a = array[0...(array.size / 2)]\n b = array[(array.size / 2)...array.size]\n\n a = merge_sort(a)\n b = merge_sort(b)\n \n return merge(a, b)\nend", "title": "" }, { "docid": "578a28f55a32cbf8d91af5472c499fd4", "score": "0.79817575", "text": "def merge_sort(array)\n return array if array.size == 1\n\n sub_array_1 = array[0...array.size / 2]\n sub_array_2 = array[array.size / 2...array.size]\n\n sub_array_1 = merge_sort(sub_array_1)\n sub_array_2 = merge_sort(sub_array_2)\n\n merge(sub_array_1, sub_array_2)\nend", "title": "" }, { "docid": "578a28f55a32cbf8d91af5472c499fd4", "score": "0.79817575", "text": "def merge_sort(array)\n return array if array.size == 1\n\n sub_array_1 = array[0...array.size / 2]\n sub_array_2 = array[array.size / 2...array.size]\n\n sub_array_1 = merge_sort(sub_array_1)\n sub_array_2 = merge_sort(sub_array_2)\n\n merge(sub_array_1, sub_array_2)\nend", "title": "" }, { "docid": "cac7c962eed828cdc4397ee9fad39407", "score": "0.7979741", "text": "def merge_sort(array)\n return array if array.length == 1\n mid_idx = array.length / 2\n left = array[0...mid_idx]\n right = array[mid_idx..-1]\n sorted_left = merge_sort(left) \n sorted_right = merge_sort(right)\n merge(sorted_left, sorted_right)\nend", "title": "" }, { "docid": "14ccf282e52b292e9fc711f2e6c15b8b", "score": "0.7965704", "text": "def merge_sort(array)\n #Check if the array is larger than one. No need to sort if not\n if array.count <= 1\n return array\n end\n\n mid = array.count / 2\n\n #recursive call to break input array up into smaller single\n #element arrays that can then be merged back together in a\n #sorted order.\n part_a = merge_sort(array.slice(0, mid))\n part_b = merge_sort(array.slice(mid, array.count - mid))\n\n new_array = []\n offset_a = 0\n offset_b = 0\n\n #Merge the smaller arrays together by comparing the first\n #element and pushing the smaller of the two to the new\n #array\n while offset_a < part_a.count && offset_b < part_b.count\n a = part_a[offset_a]\n b = part_b[offset_b]\n\n if a <= b\n new_array << a\n offset_a += 1\n else\n new_array << b\n offset_b += 1\n end\n end\n\n #There might be left over item that has not been pushed in\n #either part_a or part_b. This handles that case.\n while offset_a < part_a.count\n new_array << part_a[offset_a]\n offset_a += 1\n end\n\n while offset_b < part_b.count\n new_array << part_b[offset_b]\n offset_b += 1\n end\n\n return new_array\nend", "title": "" }, { "docid": "96c8753148bde25390fce7fe16abed10", "score": "0.7964682", "text": "def merge_sorted_arrays(array1, array2)\nend", "title": "" }, { "docid": "c247648d1856520d24f7a0a756755c63", "score": "0.7959978", "text": "def merge_sort(array)\n return array if array.length <= 1\n left = array.slice(0, array.length/2)\n right = array.slice(left.length, array.length-1)\n merge(merge_sort(left), merge_sort(right))\nend", "title": "" }, { "docid": "26c6545319513dcfeec4b34cf7b98d20", "score": "0.79591393", "text": "def merge_sort(array)\n # debugger\n if array.length <= 1\n return array\n end\n\n array_size = array.length\n middle = (array.length / 2).round\n\n left_side = array[0...middle]\n right_side = array[middle...array_size]\n\n sorted_left = merge_sort(left_side)\n sorted_right = merge_sort(right_side)\n\n merge(array, sorted_left, sorted_right)\n\n return array\nend", "title": "" }, { "docid": "08f6894b092061e534d46919ae28c5de", "score": "0.7932064", "text": "def merge_sort arr\n\n return arr if arr.length == 1\n\n # sort left half of arr\n left_arr = arr[0..((arr.length / 2 ) - 1)]\n left_sorted = merge_sort(left_arr)\n \n # sort right half of arr\n right_arr = arr[(arr.length / 2)..-1]\n right_sorted = merge_sort(right_arr)\n \n # merge\n merge_array(left_sorted, right_sorted)\nend", "title": "" }, { "docid": "2169bcba4c02b384e528b6ee49ebc327", "score": "0.79297394", "text": "def merge_sort(array)\n return array if array.length <= 1\n mididx= array.length/2\n left= array[0...mididx]\n right= array[mididx..-1]\n \n merge(merge_sort(left), merge_sort(right))\n\nend", "title": "" }, { "docid": "8db6e2e2a00dbe2ca0e1dbbc1e73e215", "score": "0.7913961", "text": "def merge_sort(array)\n return array if array.size < 2\n\n split_index = (array.size / 2.0).floor\n left = array[0...split_index]\n right = array[split_index...array.size]\n\n merge(merge_sort(left), merge_sort(right))\nend", "title": "" }, { "docid": "67f4018b090981168fe1919b682d6d53", "score": "0.78957236", "text": "def merge_sort\nend", "title": "" }, { "docid": "e3b666136f321fa6568cf2fd7f25bed0", "score": "0.78901196", "text": "def merge_sort(a)\n return a if a.size <= 1 \n m = a.size / 2\n l = merge_sort(a[0, m])\n r = merge_sort(a[m, a.size - m])\n \n merge(l, r)\n end", "title": "" }, { "docid": "e305486519fbc96e924109255a85caf2", "score": "0.7888707", "text": "def merge_sort(array)\n return array if array.length <= 1\n mid = array.length / 2\n left_split = array[0...mid]\n right_split = array[mid..array.length]\n\n left_sort = merge_sort(left_split)\n right_sort = merge_sort(left_split)\n\n merge(left_sort, right_sort, array)\nend", "title": "" }, { "docid": "65a0cf28475f4ce1bc9120a3373c79e8", "score": "0.78836346", "text": "def merge_sort(arr)\n return arr if arr.length <= 1\n mid = arr.length / 2\n sorted_left = merge_sort(arr.take(mid))\n sorted_right = merge_sort(arr.drop(mid))\n merge(sorted_left, sorted_right)\n end", "title": "" }, { "docid": "7b719152381b7ddfd0e90b4378b46f78", "score": "0.78799695", "text": "def mergesort(arr)\n return arr if arr.length < 2\n\n left_merged_stuff = mergesort(arr[0..((arr.length/2)-1)])\n right_merged_stuff = mergesort(arr[(arr.length/2)..-1])\n merge(left_merged_stuff, right_merged_stuff)\nend", "title": "" }, { "docid": "564c0eb32484d47b3e8d5ae51765591d", "score": "0.7873724", "text": "def merge_sort(array)\n return array if array.length <= 1\n \n mid = array.length / 2\n left = array[0...mid]\n right = array[mid...array.length]\n \n merge(merge_sort(left), merge_sort(right))\nend", "title": "" }, { "docid": "35f9589263adcba0cc5a6f31c004b34b", "score": "0.78734124", "text": "def merge_sort(array, &prc)\n return array if array.length <= 1\n\n mid = array.length / 2\n left_sorted = merge_sort(array.take(mid), &prc)\n right_sorted = merge_sort(array.drop(mid), &prc)\n\n merge(left_sorted, right_sorted, &prc)\n\nend", "title": "" }, { "docid": "571b5c7b6fa2227b545041d79b3c8fdf", "score": "0.7869114", "text": "def merge_sort(array)\n return array if array.size < 2\n mid = array.size/2\n left = array[0,mid]\n right = array[mid..-1]\n left = merge_sort(left)\n right = merge_sort(right)\n merge(left, right)\nend", "title": "" }, { "docid": "8b02aff90fe6dbb436b6ae68519aec3e", "score": "0.7862968", "text": "def merge_sort(array)\n return array if array.length < 2\n mid = array.length / 2\n sleft = merge_sort(array.take(mid))\n sright = merge_sort(array.drop(mid))\n merge(left, right)\nend", "title": "" }, { "docid": "59fcd7ffaee0e00f7a57a2e4b63741ce", "score": "0.7849448", "text": "def merge_sort(array)\n if array.length < 2\n #Arrays that have 0 or 1 items don't need to be sorted\n return array\n end\n\n middle = array.length / 2\n left = array.slice(0,middle)\n right = array.slice(middle,array.length)\n\n merge(merge_sort(left), merge_sort(right))\nend", "title": "" }, { "docid": "4089de50bcca2307d8b327b8a99a2e4c", "score": "0.78469414", "text": "def merge_sort(unsorted_arr)\n return unsorted_arr if unsorted_arr.length <= 1\n\n left = merge_sort( unsorted_arr[0..(unsorted_arr.length/2 - 1) ] )\n right = merge_sort( unsorted_arr[(unsorted_arr.length/2)..-1])\n merge(left, right)\nend", "title": "" }, { "docid": "d64dd18e42de9a09964f4eff0e4643fa", "score": "0.78434515", "text": "def merge_sort(arr)\n return arr if arr.length <= 1\n mid_idx = arr.length / 2\n left = arr[0...mid_idx]\n right = arr[mid_idx .. -1]\n sorted_left = merge_sort(left)\n sorted_right = merge_sort(right)\n merge(sorted_left, sorted_right)\nend", "title": "" }, { "docid": "895e1a7f45c3d9071d8a026b828fbbe0", "score": "0.7836524", "text": "def merge_sort(array)\n if array.length <= 1\n return array\n end\n middle = array.length / 2\n left = array[0, middle]\n right = array[middle, array.length]\n merge(merge_sort(left), merge_sort(right))\nend", "title": "" }, { "docid": "7f74e241e4509792f51635f292a5cb21", "score": "0.7826603", "text": "def merge_sort(array)\n return array if array.length <= 1\n\n left = merge_sort(array[0..((array.length / 2) - 1)])\n right = merge_sort(array[(array.length / 2)..-1])\n merge(left, right)\nend", "title": "" }, { "docid": "b65ce04e3b669be6318165008927ca1d", "score": "0.7826259", "text": "def merge_sort(array)\n return array if array.length <= 1\n\n midpoint = array.length / 2\n left = merge_sort(array[0...midpoint])\n right = merge_sort(array[midpoint..-1])\n\n merge(left, right)\nend", "title": "" }, { "docid": "a091803c1531ba633fa503ae70e1438b", "score": "0.7819242", "text": "def merge_sort(array)\n return array if array.length <= 1\n middle_index = array.length/2-1\n arry1 = array[0..middle_index]\n arry2 = array[(middle_index + 1)..-1]\n #Should be sorted by the time it reaches merge\n b = merge_sort(arry1)\n c = merge_sort(arry2)\n merge(b,c)\n\nend", "title": "" }, { "docid": "eba0deaa649ea26dfd9e4d21fed63179", "score": "0.7810248", "text": "def merge_sort(array)\n return array if array.length <= 1\n\n middle = array.length / 2\n left = array[0...middle]\n right = array[middle..-1]\n merge(merge_sort(left), merge_sort(right))\nend", "title": "" }, { "docid": "3ddfd08665bb302403ea33b4fd7f4590", "score": "0.78099906", "text": "def merge_sort(array_of_ints)\n \n array_length = array_of_ints.length \n \n return array_of_ints if array_length === 1\n\n right_array = array_of_ints[0..(array_length/2-1)]\n left_array = array_of_ints[array_length/2..(array_length-1)]\n \n right_array = merge_sort(right_array)\n left_array = merge_sort(left_array)\n\n return merge(right_array, left_array)\nend", "title": "" }, { "docid": "bb2c7576ed1009a13ef03ca294e59d14", "score": "0.78059363", "text": "def merge_sort(arr)\n\treturn arr if arr.length <= 1\n\n\tleft = arr.take(arr.length / 2)\n\tright = arr.drop(arr.length / 2)\n\n\tmerge(merge_sort(left), merge_sort(right))\nend", "title": "" }, { "docid": "bf12e3c9661261be6d4ea75ca6508547", "score": "0.7791743", "text": "def merge_sort(array)\n return array if array.length == 1\n left = merge_sort(array[0..array.length/2-1])\n right = merge_sort(array[array.length/2..-1])\n return merge(left, right)\nend", "title": "" }, { "docid": "bfe78716913e84d675ac1df05911b0e2", "score": "0.7791408", "text": "def merge_sort(array)\n middle = array.length / 2\n return array if middle < 2\n left, right = array[0...middle], array[middle..-1]\n sorted_left, sorted_right = merge_sort(left), merge_sort(right)\n merge(sorted_left, sorted_right)\nend", "title": "" }, { "docid": "d66789b2681a9353d04fd80f8aa9d139", "score": "0.77886325", "text": "def merge_sort(array)\n return array if array.length <= 1\n\n middle = array.length / 2\n left = merge_sort(array[0...middle])\n right = merge_sort(array[middle..-1])\n merge(left, right)\nend", "title": "" }, { "docid": "b7a3263e96468984f6d7947c58cb1657", "score": "0.77854866", "text": "def merge_sort(array)\n return array if array.size <= 1\n mid = (array.size / 2).floor\n left = merge_sort(array[0..mid - 1])\n right = merge_sort(array[mid..array.size])\n merge(left, right)\nend", "title": "" }, { "docid": "f8c3a7e453f83cc7314cfedf52a3dbbf", "score": "0.7782101", "text": "def mergesort(arr)\n return arr if arr.length <= 1\n copy = arr.dup\n m = copy.length / 2\n left = copy[0...m]\n right = copy[m..-1]\n left_sorted = mergesort(left)\n right_sorted = mergesort(right)\n merge(left_sorted, right_sorted)\nend", "title": "" }, { "docid": "b2ec1516c43895bab2c808960034bbe5", "score": "0.7779592", "text": "def merge_sort(array)\n if array.size <= 1\n array\n else\n midpoint = (array.size - 1) / 2\n merge(merge_sort(array[0..midpoint]), merge_sort(array[midpoint+1...array.size]))\n end\nend", "title": "" }, { "docid": "61b414914f4a393aafba99280a24fd0a", "score": "0.7773017", "text": "def merge_sort(arr)\n return arr if arr.length <= 1\n mid_idx = arr.length / 2\n left = merge_sort(arr[0...mid_idx])\n right = merge_sort(arr[mid_idx..-1])\n merge(left, right)\nend", "title": "" }, { "docid": "96c84fccd6ea1ea778753c7edba2e01d", "score": "0.77668184", "text": "def merge_sort(array)\n if array.length < 2\n return array\n end\n \n mid = array.length/2\n left = array[0..(mid - 1)]\n right = array[mid..-1]\n \n merge(merge_sort(left), merge_sort(right))\n \nend", "title": "" }, { "docid": "65c3d885fcb4124af98b6d79f5d76ef8", "score": "0.77668136", "text": "def merge_sort()\nend", "title": "" }, { "docid": "d47537f4299fe2708caa33ed4b9286b3", "score": "0.77655566", "text": "def merge_sort(array)\n return array if array.length <= 1\n\n half_index = array.length.odd? ? array.length / 2 : (array.length / 2) - 1\n left = array[0..half_index]\n right = array[half_index+1..-1]\n\n \n merge(merge_sort(left), merge_sort(right))\n\nend", "title": "" }, { "docid": "a2fc2a8320d0042000af14c3fa417e9b", "score": "0.7759767", "text": "def merge_sort(arr)\n return arr if arr.length <= 1\n arr2 = arr.shift(arr.length / 2)\n merge(merge_sort(arr),merge_sort(arr2))\nend", "title": "" }, { "docid": "bb4583a5d774ab462712ca0d539d24f4", "score": "0.7749793", "text": "def merge_sort(arr)\n\tif arr.length == 1\n\t\treturn arr\n\telse\n\t\tn = arr.size-1\n\t\tmerge(merge_sort(arr[0..n/2]), merge_sort(arr[(n/2)+1..n]))\n\tend\nend", "title": "" }, { "docid": "c80393356144bee206b3277b53297a63", "score": "0.77485317", "text": "def merge_sort(&prc)\n return self if self.length <= 1\n\n prc ||= Proc.new { |n1,n2| n1<=>n2 } # Default incase no block is passed in\n mid = self.length/2\n left,right = self[0...mid],self[mid..-1]\n\n Array.merge(left.merge_sort(&prc),right.merge_sort(&prc),&prc)\n end", "title": "" }, { "docid": "666da33e78aa6a70c2bbbb597a2f7c27", "score": "0.77463883", "text": "def mergesort(arr)\n # Base case: Arrays of length 1 are sorted.\n return arr if arr.length <= 1\n\n arr1 = mergesort(arr[0...arr.length / 2])\n\n arr2 = mergesort(arr[arr.length / 2..])\n\n # Merge and return sorted arrays\n merge_sorted_arrays(arr1, arr2)\nend", "title": "" }, { "docid": "840570b0082f02befe108a4fdcaa9a57", "score": "0.77437156", "text": "def merge_sort(arr)\n return arr if arr.length <= 1\n\n array_a = merge_sort(arr[0..arr.length / 2 - 1 ])\n array_b = merge_sort(arr[arr.length/2..-1])\n new_array = []\n \n until array_a.empty? || array_b.empty?\n new_array << if array_a[0] <= array_b[0]\n array_a.shift\n else\n array_b.shift\n end\n end\n new_array.concat(array_a, array_b)\n\n end", "title": "" }, { "docid": "a70356941a34b2e9b63b13dfd96cf13c", "score": "0.77407664", "text": "def merge_sort(arr)\n return arr if arr.length<2\n\n middle_idx = arr.length/2\n left_arr = arr[0..(middle_idx-1)]\n right_arr = arr[middle_idx..-1]\n\n left_arr = merge_sort(left_arr)\n right_arr = merge_sort(right_arr)\n merge(left_arr,right_arr)\nend", "title": "" }, { "docid": "1a40515bb5598168e63f6dcbefad59eb", "score": "0.7739971", "text": "def merge_sort(array)\n return array if array.count <= 1\n\n midpoint = array.count / 2\n left = merge_sort(array.take(midpoint))\n right = merge_sort(array.drop(midpoint))\n\n merge(left, right)\nend", "title": "" }, { "docid": "3e56c3dd0fb8f683ce9be8af8b83852f", "score": "0.7736988", "text": "def merge_sort(array)\n return array if array.count < 2\n left, right = array.take(array.count / 2), array.drop(array.count / 2)\n l, r = merge_sort(left), merge_sort(right)\n merged = []\n until l.empty? || r.empty?\n l.first < r.first ? merged << l.shift : merged << r.shift\n end\n merged + l + r\nend", "title": "" }, { "docid": "b528c1cda440853cd6cda9f61415b686", "score": "0.7735776", "text": "def merge_sort(arr)\n\tl = arr.length\n\n\treturn arr if l <= 1\n\n\tleft = merge_sort(arr.take(l/2))\n\tright = merge_sort(arr.drop(l/2))\n\n\treturn merge(left, right)\nend", "title": "" }, { "docid": "2ae6ad860c4f0fc5c46b89e46d5af326", "score": "0.77323633", "text": "def merge_sort(array)\n return array if array.length <= 1\n mid = array.length / 2\n sorted_left = merge_sort(array.take(mid))\n sorted_right = merge_sort(array.drop(mid))\n merge(sorted_left,sorted_right)\nend", "title": "" }, { "docid": "52950bf43d712f59a0d4201e3dafedcd", "score": "0.77292675", "text": "def mergeSort(array)\n\n # We need at least 2 elements to sort\n return array if array.length <= 1 \n\n # 1. Divide Array into Array[p..q] and Array[q+1..r]\n half = array.length/2\n\n # The subarrays are broken down even further \n left = mergeSort(array.slice(0,half))\n right = mergeSort(array.slice(half, array.length))\n\n merge(left,right)\nend", "title": "" }, { "docid": "cc475420d5ee8a97734f28a3e41f7144", "score": "0.7725849", "text": "def merge_sort(array)\n return array if array.length <= 1\n\n midpoint = array.length/2\n upper = merge_sort(array[midpoint..-1])\n lower = merge_sort(array[0...midpoint])\n\n merge((upper), (lower))\nend", "title": "" }, { "docid": "41ba63ad61655bed4f1d12a81513e705", "score": "0.77255464", "text": "def merge_sort(arr)\n return arr if arr.length < 2\n\n mid = arr.length / 2\n left = arr[0...mid]\n right = arr[mid..-1]\n left_sort = merge_sort(left)\n right_sort = merge_sort(right)\n\n merge(left_sort, right_sort)\nend", "title": "" }, { "docid": "4d535d882058fc4bf70622eab8476f84", "score": "0.7723027", "text": "def merge_sort(array)\n # already sorted\n return array if array.count < 2\n\n middle = array.count / 2\n left, right = array.take(middle), array.drop(middle)\n\n sorted_left, sorted_right = merge_sort(left), merge_sort(right)\n\n merge(sorted_left, sorted_right)\nend", "title": "" }, { "docid": "2d30d92ee317293d81eed024fc9628e0", "score": "0.7718465", "text": "def merge_sort(arr)\n return arr if arr.length <= 1\n index = arr.length / 2\n left = merge_sort(arr[0...index])\n right = merge_sort(arr[index..-1])\n merge(left, right)\nend", "title": "" }, { "docid": "db4ae077687a31f2fd28939a3502d9b3", "score": "0.7710875", "text": "def merge_sort(array)\n if array.length <= 1\n return array\n else\n mid = (array.length/2).floor\n left = merge_sort(array[0..mid-1])\n right = merge_sort(array[mid..array.length])\n merge(left, right)\n end\nend", "title": "" }, { "docid": "1998a49fd72ae2cda463bca12f39ccfd", "score": "0.7700613", "text": "def merge_sort(array)\n return array if array.length < 2\n mid = array.length / 2\n merge(merge_sort(array.take(mid)), merge_sort(array.drop(mid)))\nend", "title": "" }, { "docid": "f210b3d271243e744961b2018a01d7ce", "score": "0.769742", "text": "def merge_sort(array)\n p array\n return array if array.length == 1\n half = (array.length - 1 )/ 2\n new_array = [merge_sort(array[0..half]), merge_sort(array[(half + 1)..-1])]\n merge(new_array[0], new_array[1])\nend", "title": "" }, { "docid": "cf49d6f7e633458ae5edbe28ea888b73", "score": "0.76964587", "text": "def merge_sort(arr)\n return arr if arr.length <= 1\n\n middle_idx = (arr.length / 2) - 1\n\n left = arr[0..middle_idx]\n right = arr[middle_idx + 1..-1]\n\n sorted_left = merge_sort(left)\n sorted_right = merge_sort(right)\n\n merge(sorted_left, sorted_right)\nend", "title": "" }, { "docid": "eb8012b166011ff7f8d82aadff2f47b9", "score": "0.76933455", "text": "def merge_sort(array)\n len = array.length\n return array if len == 1 #Base case set to an array size of 1\n \n array1 = array[0..(len/2)-1] #Split the array in half\n array2 = array[len/2..-1] #Array two gets the longer half if it's an odd length\n a1 = merge_sort(array1) #Split array1 in half again recursively\n a2 = merge_sort(array2) #Split array2 in half again recursively\n merge(a1, a2) #Call the merge function on the split arrays\nend", "title": "" }, { "docid": "b47e3dd1683900026364e05eab9b544a", "score": "0.76913476", "text": "def merge_sort(arr)\n return arr if arr.length <= 1\n\n leftArr = arr[0...arr.length / 2]\n rightArr = arr[(arr.length / 2)...arr.length]\n\n left = merge_sort(leftArr)\n right = merge_sort(rightArr)\n\n merge(left, right)\nend", "title": "" }, { "docid": "a0dac36e168429fcf6417f8e2d5ce9dd", "score": "0.7688235", "text": "def merge_sort(ary)\n return ary if ary.length == 1\n\n merge(merge_sort(ary[0..ary.length / 2 - 1]), merge_sort(ary[ary.length / 2..-1]))\n end", "title": "" }, { "docid": "1e9208ce5e11d5f581ef182d83ad0dc3", "score": "0.76838124", "text": "def merge_sort array\n left, right = halve(array)\n\n sorted = []\n\n left.each do |l|\n right.each do |r|\n if l < r\n sorted << l\n else\n sorted << r\n end\n end\n end\n sorted\nend", "title": "" }, { "docid": "74f6cf5d4234c84a9b040bee4bc1cb31", "score": "0.768148", "text": "def merge_sort(arr)\n if arr.length <= 1\n return arr\n end\n\n middle = (arr.length / 2).round\n left = arr.slice(0, middle)\n right = arr.slice(middle, arr.length)\n\n return merge(merge_sort(left), merge_sort(right))\nend", "title": "" }, { "docid": "a9092133ce8f47e9b11dfbf75df8b675", "score": "0.76742107", "text": "def merge_sort(array, left = 0, right = array.length - 1)\n return [array[left]] if left == right\n\n l_arr = merge_sort(array, left, left + (right - left) / 2)\n r_arr = merge_sort(array, left + (right - left) / 2 + 1, right)\n\n merged_array = []\n merged_array.push(l_arr[0] < r_arr[0] ? l_arr.shift : r_arr.shift) while\n !l_arr.empty? && !r_arr.empty?\n merged_array.push(*l_arr, *r_arr)\nend", "title": "" }, { "docid": "1e49adf11596bc15097b06de2efb1fc1", "score": "0.7667392", "text": "def merge_sort(arr)\n return arr if arr.length == 1\n merge(merge_sort(arr.slice(0, arr.length/2)),\n merge_sort(arr.slice(arr.length/2, arr[-1])))\nend", "title": "" }, { "docid": "974c759c26718c8de540857c16686057", "score": "0.76564807", "text": "def merge_sort(arr)\n\treturn arr if arr.length < 2\n\tleft = arr.slice(0...arr.length/2)\n\tright = arr.slice(arr.length/2..-1)\n\tmerge_sort(left)\n\tmerge_sort(right)\n\tr = l = k = 0\n\twhile l < left.length && r < right.length do\n\t\tif left[l] > right[r]\n\t\t\tarr[k] = right[r]\n\t\t\tr += 1\n\t\telse\n\t\t\tarr[k] = left[l]\n\t\t\tl += 1\n\t\tend\n\t\tk += 1\n\tend\n\twhile l < left.length do\n\t\tarr[k] = left[l]\n\t\tl += 1\n\t\tk += 1\n\tend\n\twhile r < right.length do\n\t\tarr[k] = right[r]\n\t\tr += 1\n\t\tk += 1\n\tend\n\tarr\nend", "title": "" }, { "docid": "5a2196e3d2576e67dbebe01d04bd9a8b", "score": "0.76539296", "text": "def merge_sort(arr)\n return arr unless arr.size > 1\n mid = arr.size/2\n a, b, sorted = merge_sort(arr[0...mid]), merge_sort(arr[mid..-1]), []\n sorted << (a[0] < b[0] ? a.shift : b.shift) while [a,b].none?(&:empty?)\n sorted + a + b\nend", "title": "" }, { "docid": "d23bf16b6e74e79afd2a58f71eb833f6", "score": "0.76485926", "text": "def merge_sort(arr)\n return arr if arr.length < 2\n\n h = arr.length / 2\n left_half = arr.slice(0, h)\n right_half = arr.slice(h, arr.length)\n merged_arr = (merge_sort(left_half).concat(merge_sort(right_half))).sort\nend", "title": "" }, { "docid": "29de5d25df92f5b677efefd3413a7d15", "score": "0.76483184", "text": "def mergeSort(array)\n #pre\n assert array.is_a? Array\n assert array.size > 0\n array.each {|a| assert a.respond_to? :<=> } #Confirm comparable implemented\n\n # If the size of the array is not equal to 1... then it needs to be divided further\n if array.size != 1\n\n threads = []\n mid = (array.size - 1) / 2 # 1\n leftArray = []\n rightArray = []\n threads << Thread.new(array[0..mid]) { |arr| leftArray += mergeSort(arr) } # 2\n threads << Thread.new(array[mid+1..(array.size - 1)]) { |arr| rightArray += mergeSort(arr) } # 3\n threads.each { |thr| thr.join }\n\n #post\n assert threads.is_a? Array\n assert threads.each {|a| assert a.is_a? Thread}\n assert threads.each {|a| assert a.alive? == false }\n assert leftArray.is_a? Array\n assert rightArray.is_a? Array\n assert rightArray.size > 0\n assert leftArray.size > 0\n return merge(leftArray, rightArray) # 4\n else\n return array\n end\n end", "title": "" } ]
61a0ea52c54430bec8ecfb0818fe0adc
From the page 534 int.ord > int The ord method was added to assist in the migration from Ruby 1.8 to 1.9. It allows ?A.ord to return 65. If ?A returns a string, ord will be called on that string and return 65; if ?A returns an integer, then Numericord is called, which is basically a noop
[ { "docid": "fa24462c05afd6a2ca3f359d2a8485fa", "score": "0.8315257", "text": "def test_Integer_InstanceMethods_ord\n\t\tassert_equal(1, 1.ord)\n\t\tassert_equal(65, ?A.ord)\n\t\tassert_equal(66, ?B.ord)\n\tend", "title": "" } ]
[ { "docid": "7abbca8d0bdad926549dd44490d0d2ea", "score": "0.76072174", "text": "def ord(string)\nstring.ord\nend", "title": "" }, { "docid": "054ca0a3a960e9150ab2687e2a2cfafb", "score": "0.7451224", "text": "def ord()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "054ca0a3a960e9150ab2687e2a2cfafb", "score": "0.7451224", "text": "def ord()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "1124fed65d2dfed3ea5c3c597639e942", "score": "0.7438862", "text": "def ord(c)\n ruby1_8? ? c[0] : c.ord\n end", "title": "" }, { "docid": "89f73db75d05f45d44814548122ca5e2", "score": "0.72559166", "text": "def ord\n end", "title": "" }, { "docid": "07a347e76fe6b8256c051e166f1dd2d5", "score": "0.71842885", "text": "def ord(char)\n char.ord\nrescue\n char[0]\nend", "title": "" }, { "docid": "199eec707674ab25e79ad78e7eee0228", "score": "0.7129025", "text": "def asciicode\n\t\"z\".ord\nend", "title": "" }, { "docid": "0bbfbccb7612d3b3ae1daa40b89d5bad", "score": "0.6918808", "text": "def dec\n char.ord\n end", "title": "" }, { "docid": "b8c5913330e37ff41c27c31693c5943e", "score": "0.6854302", "text": "def test_Integer_InstanceMethods_chr\n\t\tassert_equal('A', 65.chr)\n\t\tassert_equal('a', ?a.chr)\n\t\tassert_equal(\"\\xE9\", 233.chr)\n\tend", "title": "" }, { "docid": "cd5529c88fc1f67f1f2edddfe1427b59", "score": "0.6824267", "text": "def ord(char)\n char[0]\n end", "title": "" }, { "docid": "c881021d6ef1490cf5bdc2c79ca6ddfc", "score": "0.6820676", "text": "def to_ord(key)\n if key.is_a?(String) then\n return key.ord\n else\n return key\n end\n end", "title": "" }, { "docid": "e1f0c32a4d011728517ccc9742ca8ff1", "score": "0.67034173", "text": "def ord\n to_bin.ord\n end", "title": "" }, { "docid": "ba1d5974fab65f959f715838fae6ff4d", "score": "0.66962093", "text": "def ord_value(val)\n if val.is_a? Fixnum\n return val\n elsif val.is_a? String\n return val.unpack('C')[0]\n else\n return val.to_i\n end\n end", "title": "" }, { "docid": "ede3270454e465682eb935f5a10bd730", "score": "0.6649199", "text": "def char_to_int(str) # ascii\n str.ord - 48\nend", "title": "" }, { "docid": "8998eb13fbb703236377c81298c056ae", "score": "0.6642292", "text": "def char(str)\n str.ord\n end", "title": "" }, { "docid": "8998eb13fbb703236377c81298c056ae", "score": "0.6642292", "text": "def char(str)\n str.ord\n end", "title": "" }, { "docid": "12b720953ff0adfc5d4dd3f9993b1308", "score": "0.6633495", "text": "def ord\r\n self\r\n end", "title": "" }, { "docid": "32107cd6ae1ce5c688ec4af51a04aa23", "score": "0.66334766", "text": "def ord\r\n return self\r\n end", "title": "" }, { "docid": "55ea0aa2d07cab7f5628c708cbc6825c", "score": "0.6609183", "text": "def ord\n self\n end", "title": "" }, { "docid": "1d5d7f9b061048125f40f42099dff154", "score": "0.6534194", "text": "def ord\n self\n end", "title": "" }, { "docid": "f0d54e49edea7e0a46a920fdfe4362fd", "score": "0.63323903", "text": "def ascii_value(str)\n result = 0\n str.each_char { |elem| result += elem.ord }\n result\nend", "title": "" }, { "docid": "6a2a280557d19d5ab13db507339cf7e2", "score": "0.6287906", "text": "def ascii_value(str)\n value = 0\n\n str.chars.each do |character|\n value += character.ord\n end\n\n value\nend", "title": "" }, { "docid": "c774efd670b38ec6641cc4722827eabd", "score": "0.6279691", "text": "def reacts?(a, b)\n (a.ord - b.ord).abs == 32 # ?a.ord - ?A.ord == 32\nend", "title": "" }, { "docid": "3c45188df6959e704f9292aca70b3a57", "score": "0.62620866", "text": "def ascii_value(string)\n value = 0\n string.chars.each do |char|\n value += char.ord\n end\n value\nend", "title": "" }, { "docid": "b8d546a4cd4f6856e516911806a27831", "score": "0.6260974", "text": "def compare(char)\n char.ord.chr == char\nend", "title": "" }, { "docid": "6bcc56095e3600beed3616fe31230576", "score": "0.6257432", "text": "def ascii_value(string)\n value = 0\n string.chars.each do |char|\n value = value + char.ord\n end\n value\nend", "title": "" }, { "docid": "bbf4e2ae5f5da256aa146453db4309b0", "score": "0.62558264", "text": "def ascii_value(string)\n string.chars.inject(0) { |sum, char| sum + char.ord }\nend", "title": "" }, { "docid": "2ba7ff27aca793532b768a07fa3d0e74", "score": "0.6253321", "text": "def ascii_value(string)\n\n\tresult = 0\n\n\tstring.chars.each do |char|\n\t\tresult += char.ord\n\tend\n\n\tresult\n\nend", "title": "" }, { "docid": "26d92cbafad0a797e96cce7ac5e44746", "score": "0.62361205", "text": "def get_num\n expected 'Integer' unless !is_digit(@look)\n result = ord(@look) - ord('0')\n get_char\n return result\nend", "title": "" }, { "docid": "fe97321d89fec58bd65b7cd6159863d1", "score": "0.6227497", "text": "def ascii_value(string)\r\n value = 0\r\n string.chars.map do |char|\r\n value += char.ord\r\n end\r\n value\r\nend", "title": "" }, { "docid": "b67de428f18bc684a58d9759013842b9", "score": "0.6223925", "text": "def ascii_value(string)\n value = 0\n\n string.chars.each do |char|\n value += char.ord\n end\n\n value\nend", "title": "" }, { "docid": "c02d030b70cc1a4984436b3c3976d964", "score": "0.62044495", "text": "def ascii_value(string)\n ascii = 0\n string.chars.each { |letter| ascii += letter.ord }\n ascii\nend", "title": "" }, { "docid": "0edebdd9ce120f82823075326bebebdd", "score": "0.62038016", "text": "def ascii_value(word)\n sum = 0\n word.each_char do |letter|\n sum += letter.ord\n end\n sum\n \nend", "title": "" }, { "docid": "65caed930e7ab255b761361ba143953a", "score": "0.6193213", "text": "def ascii_value(str)\n str.chars.map(&:ord).inject(0, :+)\nend", "title": "" }, { "docid": "e191f30f6e63c43dfd6c9a78fbf749aa", "score": "0.6187082", "text": "def ascii_value(str)\n value = 0\n str.each_char { |char| value += char.ord }\n value\nend", "title": "" }, { "docid": "29b32d9466f64154b33d3ba5802662b1", "score": "0.6181316", "text": "def ascii_value(str)\n sum = 0\n str.chars.each { |ch| sum += ch.ord }\n sum\nend", "title": "" }, { "docid": "4107451d8d57425688020569ab0b2395", "score": "0.6171875", "text": "def ascii_value(string)\n string == \"\" ? 0 : string.chars.map { |x| x.ord }.inject(:+)\nend", "title": "" }, { "docid": "9b1ace009de9caba03531653096b492f", "score": "0.61637306", "text": "def convert(letter)\n letter.ord - 96\nend", "title": "" }, { "docid": "e9b67eb206d8618e012a5807c1bce09c", "score": "0.6158189", "text": "def to_byte\n self.ord\n end", "title": "" }, { "docid": "42388cc018fb4087296ad801d4411d5d", "score": "0.6152981", "text": "def ascii_value(string)\n sum = 0\n string.chars.each{|s| sum += s.ord}\n sum\nend", "title": "" }, { "docid": "fa9e0bbf059a98dfbfd13ce8a0971e78", "score": "0.61490506", "text": "def ascii_value string\n string.chars.inject(0) { |sum, char| sum + char.ord}\nend", "title": "" }, { "docid": "5be0bc2451a951c152ea26f02511c5cd", "score": "0.61439484", "text": "def ascii_value(string)\n string.chars.map { |char| char.ord }.sum # remember {|char| char.ord} ~~ (&:ord)\nend", "title": "" }, { "docid": "e34a83950b0a0ffe7dfbfe561c24c4e2", "score": "0.61303943", "text": "def ascii_value(str)\n characters = str.chars\n sum = 0\n characters.each { |chr| sum += chr.ord }\n sum\nend", "title": "" }, { "docid": "779059c22a0f5f41b6162abbc27b7f0d", "score": "0.6122372", "text": "def ascii_value(str)\n value = 0\n str.each_char { |c| value += c.ord }\n p value\nend", "title": "" }, { "docid": "bd93f0d40630261feb42f7971bf5f2a6", "score": "0.61203533", "text": "def ascii_value(str)\n str.chars.map(&:ord).sum\nend", "title": "" }, { "docid": "bd93f0d40630261feb42f7971bf5f2a6", "score": "0.61203533", "text": "def ascii_value(str)\n str.chars.map(&:ord).sum\nend", "title": "" }, { "docid": "d42654abe788316a56e13041f9f1e159", "score": "0.6119559", "text": "def charCodeAt(ch)\n self[ch].ord unless self[ch].nil?\n end", "title": "" }, { "docid": "85a68868b59d01b1d7a7507350611860", "score": "0.61145794", "text": "def ascii_value(str)\n str.chars.reduce(0) { |total, e| total + e.ord }\nend", "title": "" }, { "docid": "8082217f80f3631eb0393c66e4242099", "score": "0.6110515", "text": "def ascii_translator(number)\n# method name: #ascii_translator\n# parameter: number (an integer)\n# return value: the number's ASCII character (https://www.ascii-code.com/)\n# hint: use Integer#chr\nnumber.chr\nend", "title": "" }, { "docid": "9299ca28e46f593b641b5e52d46ac483", "score": "0.61103135", "text": "def string_to_ord(str)\n ord_array = []\n str.each_byte { |x| ord_array << x }\n return ord_array\nend", "title": "" }, { "docid": "63081e654f0a8c7a80e3482cf878d30f", "score": "0.6100225", "text": "def x\n if self =~ /^\\((-{0,1}\\d+),-{0,1}\\d+\\)$/\n $1.to_i\n elsif self =~ /^(\\w)\\d+$/\n $1.ord - 97\n end\n end", "title": "" }, { "docid": "02a560ce07068cb43d71031990a63dcd", "score": "0.6098314", "text": "def ascii_value(str)\n str.chars.collect{|&:ord}.sum\nend", "title": "" }, { "docid": "857bb49e179c843fee98cbbfc8718765", "score": "0.60861903", "text": "def ascii_value(str)\n sum = 0\n str.each_char { |char| sum += char.ord }\n sum\nend", "title": "" }, { "docid": "857bb49e179c843fee98cbbfc8718765", "score": "0.60861903", "text": "def ascii_value(str)\n sum = 0\n str.each_char { |char| sum += char.ord }\n sum\nend", "title": "" }, { "docid": "d6991ad2c8c0bb8abbf82af9ceb84356", "score": "0.60800844", "text": "def ascii_value(string)\n sum = 0\n string.chars.each do |char|\n sum += char.ord\n end\n sum\nend", "title": "" }, { "docid": "7b5cc11d4e0b0451601475b8ad0236f8", "score": "0.6075604", "text": "def ascii_value(str)\ntotal = 0\nstr.each_char { |letter| total += letter.ord }\ntotal\nend", "title": "" }, { "docid": "7e72740d9795fbd77718fc28fd984e70", "score": "0.6073991", "text": "def ascii_value(str)\r\n sum = 0\r\n\r\n str.each_char { |char| sum += char.ord}\r\n sum\r\nend", "title": "" }, { "docid": "00f137f6950714d5cde0cf0cc6c239c4", "score": "0.60720825", "text": "def ascii_value(string)\n total = 0\n string.chars.each do |char|\n total += char.ord\n end\n total\nend", "title": "" }, { "docid": "a72d9219ab8439c80ec87d1375c3b7e1", "score": "0.6071211", "text": "def ascii_value(string)\n array_of_strings = string.chars\n value = 0\n\n array_of_strings.each do |character|\n value += character.ord\n end\n value\nend", "title": "" }, { "docid": "f05ab8895598c82a0c97c4412e5097bb", "score": "0.6070069", "text": "def ascii_value(string)\n string.chars.map { |chr| chr.ord }.reduce(0, :+)\nend", "title": "" }, { "docid": "2060cc26073ae4a4a9a63ca558933c3d", "score": "0.6067655", "text": "def ascii_value(string)\n string.chars.map(&:ord).sum\nend", "title": "" }, { "docid": "d4b54eef3d1714bbabbf9a8bd19e6767", "score": "0.6060214", "text": "def ascii_value(str)\n str.split('').map { |ch| ch.ord }.inject(:+)\nend", "title": "" }, { "docid": "027cc0c491092474561a693a872b2989", "score": "0.60568774", "text": "def ascii_value(string)\n total = 0\n string.chars.each {|char| total += char.ord }\n total\nend", "title": "" }, { "docid": "ed4e314d4f37d0a033132376f3a6afa1", "score": "0.6051486", "text": "def ascii_value(string)\r\n sum = 0\r\n string.each_char {|c| sum += c.ord}\r\n sum\r\nend", "title": "" }, { "docid": "cf5860d1fda2847f22df65665dc47e92", "score": "0.60472566", "text": "def ascii_value(string)\n sum = 0\n\n string.chars.each do |char|\n sum += char.ord\n end\n\n sum\nend", "title": "" }, { "docid": "b1b408f5bd360eb2438573bf09053f8d", "score": "0.60443205", "text": "def ascii_value(string)\n total_value = 0\n string.chars.each do |char|\n total_value += char.ord\n end\n total_value\nend", "title": "" }, { "docid": "be876ac67b3677aef3e5b4e6a7c94e83", "score": "0.604337", "text": "def ascii_value(str)\n if str.empty?\n 0\n else\n str.split('').map { |ch| ch.ord }.inject(:+)\n end\nend", "title": "" }, { "docid": "bbada83c2ab3be0cdb97ed6861d3b665", "score": "0.60426515", "text": "def to_ascii_int\n\t\tn = 0\n\t\tchars = split('').map(&:ord)\n\t\tchars.each_index { |i| n += chars[i] * 128 ** (chars.size - 1 - i) }\n\t\tn\n\tend", "title": "" }, { "docid": "064c3f11db935d500d17a7f76269db90", "score": "0.6041086", "text": "def ascii_value(string)\n return 0 if string.empty?\n string.chars.map { |chr| chr.ord }.reduce(:+)\nend", "title": "" }, { "docid": "f4aa50b670d03d4d1e41b7e15dbc5577", "score": "0.6038755", "text": "def ascii_value(string)\n sum = 0\n characters = string.chars\n characters.each { |char| sum += char.ord }\n sum\nend", "title": "" }, { "docid": "83a7861e228fbb599f96ad6c7dd4c652", "score": "0.6038624", "text": "def ascii_value(str)\n\n str_arr = str.chars\n\n return 0 if str == ''\n str_arr.map {|char| char.ord}.reduce(:+)\n\nend", "title": "" }, { "docid": "f5a98585ef9ee94e288ab96520838a94", "score": "0.60299987", "text": "def ascii_value str\n str.chars.reduce(0) {|total, char| total + char.ord }\nend", "title": "" }, { "docid": "8957a98b522d2dcb7ca452b56cdf5b73", "score": "0.60236293", "text": "def ascii_value(string)\n string.chars.reduce(0) { |sum, char| sum + char.ord }\nend", "title": "" }, { "docid": "60df55500b019dff3976b20d924f42fc", "score": "0.6023411", "text": "def ascii_value(str)\n str_array = str.split(//)\n str_value = 0\n str_array.each { |string| str_value += string.ord }\n str_value\nend", "title": "" }, { "docid": "28d1ef97b77891454c9a41e45b0333dc", "score": "0.60174567", "text": "def ascii_value(str)\n str.chars.map { |x| x.ord }.sum\nend", "title": "" }, { "docid": "28d1ef97b77891454c9a41e45b0333dc", "score": "0.60174567", "text": "def ascii_value(str)\n str.chars.map { |x| x.ord }.sum\nend", "title": "" }, { "docid": "5b0faa16a98b8e80a0a4eca426e2c4d2", "score": "0.60165864", "text": "def ascii_value(str)\n str = str.split \"\"\n count = 0\n str.each {|let| count += let.ord}\n count\nend", "title": "" }, { "docid": "97e105e272feff1d2da10df15b736215", "score": "0.6014762", "text": "def ascii_value(string)\n return 0 if string.empty?\n ords = []\n string.chars.map {|i| ords << i.ord}\n ords.reduce(:+)\nend", "title": "" }, { "docid": "7ec79bac4ff221c90367fdf60fbc8de9", "score": "0.6010102", "text": "def ascii_value2(str)\n return 0 if str.length == 0\n ord_arr = str.chars.map { |char| char.ord }\n ord_arr.reduce(:+)\nend", "title": "" }, { "docid": "b39d6494740df8fad6b1a7d7c94aff5f", "score": "0.600909", "text": "def _6b_ascii(ord)\n '@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\\]^_ !\"#$%&\\'()*+,-./0123456789:;<=>?'[ord]\n end", "title": "" }, { "docid": "1748def2e2616941e5ecab1eafc04541", "score": "0.60014087", "text": "def ascii_value(string)\n string.chars.map { |char| char.ord }.inject(0, &:+)\nend", "title": "" }, { "docid": "7c25b05c0032fb26e176dc0982e824bb", "score": "0.60006523", "text": "def ascii_value(string)\n sum = 0\n string.each_char { |char| sum += char.ord if char.ord != nil}\n sum\nend", "title": "" }, { "docid": "3bf90f06880750784249af1dd1b42fde", "score": "0.59977555", "text": "def ascii_value(string)\n sum = 0\n string.chars.each do |character| # there is also String#each_char method\n sum += character.ord\n end\n sum\nend", "title": "" }, { "docid": "cf45b0597eac5713e4234db9b05166a7", "score": "0.59915715", "text": "def ascii_value(string)\n sum = 0\n string.each_char { |char| sum += char.ord }\n sum\nend", "title": "" }, { "docid": "cf45b0597eac5713e4234db9b05166a7", "score": "0.59915715", "text": "def ascii_value(string)\n sum = 0\n string.each_char { |char| sum += char.ord }\n sum\nend", "title": "" }, { "docid": "3f79be61316bd93d8394751129339229", "score": "0.59910804", "text": "def ascii_value(str)\n total = 0\n str.chars.map { |char| total += char.ord }\n total\nend", "title": "" }, { "docid": "6d30914ada4b373a5bda16fac7b904f4", "score": "0.5989879", "text": "def ascii_value(string)\n arr_chars = string.chars\n sum = 0\n\n arr_chars.each { |char| sum += char.ord }\n\n sum\nend", "title": "" }, { "docid": "ea8eb21f31f31bada047fa88f927d1be", "score": "0.59666693", "text": "def ascii_value(string)\n total = 0\n string.each_char {|c| total += c.ord}\n total\nend", "title": "" }, { "docid": "4369ff505bd43bfbf2995279ab2640cb", "score": "0.596638", "text": "def ascii_value(str)\n accum_arr = str.chars.map { |char| char.ord } \n accum_arr.inject(0,:+)\nend", "title": "" }, { "docid": "3f7b519474af8a7d36704a1e7dd183a3", "score": "0.5963604", "text": "def ascii_value(str)\n sum = 0\n str.chars.reduce(0){ |sum, ch| sum += ch.ord }\nend", "title": "" }, { "docid": "c2b790b6b4bacb21b9ee8d658eabf911", "score": "0.5953482", "text": "def ascii_value(str)\n b = str.chars.map do |v| v.ord\n end\n b.sum\nend", "title": "" }, { "docid": "c034d91e6de2478c00868dc015e723af", "score": "0.5952662", "text": "def ascii_value(string)\n string.chars.map { |char| char.ord }.inject(0, :+)\nend", "title": "" }, { "docid": "79ffa25ee26e4ab63f7b26f8cffc229d", "score": "0.5945662", "text": "def ascii_value(string)\n string.split(//).reduce(0) { |tot, char| tot += char.ord }\nend", "title": "" }, { "docid": "547cfe6bb6f756d4ac3831a03d06ee96", "score": "0.59441805", "text": "def ascii_value(string)\n return 0 if string.empty?\n string.chars.map { |char| char.ord }.inject(:+)\nend", "title": "" }, { "docid": "6c631c7b17d5baf5818840d663af6efd", "score": "0.59436077", "text": "def ascii_value(string)\n sum = 0\n ascii = string.each_char do |char|\n p sum += char.ord\n end\n sum\nend", "title": "" }, { "docid": "e21ca543c33f231f1d0c546ddcc31840", "score": "0.5937078", "text": "def ascii_value(string)\n sum = 0\n string.each_char { |char| sum += char.ord}\n p sum \nend", "title": "" }, { "docid": "43a062883dc31efcdaf087e5b4a6c2ea", "score": "0.59213793", "text": "def myAtoI(s)\n\t\treturn s.ord - 48\n\tend", "title": "" }, { "docid": "2e44491f5d878b8735a5e9ab2a4e087c", "score": "0.5919802", "text": "def <=>(other)\n ord <=> other.ord if self.class == other.class\n end", "title": "" }, { "docid": "963082afb384d7d843cb04f8045b72e0", "score": "0.5918909", "text": "def get_code(c)\n c.upcase.ord - 'A'.ord + 1\nend", "title": "" }, { "docid": "963082afb384d7d843cb04f8045b72e0", "score": "0.5918909", "text": "def get_code(c)\n c.upcase.ord - 'A'.ord + 1\nend", "title": "" } ]
036b378617b6f9f7654554d01ff2a784
currently getting wrong score because it is adding in te else at the very end to the strikes when they should not be getting added in.
[ { "docid": "e5bb3ddefdcd30b6e2fe33067bb02758", "score": "0.0", "text": "def last_three_throws_are_strikes(number_of_rolls, roll, current_roll, nextroll1, nextroll2 )\n if (3 == number_of_rolls - roll) && strike?(current_roll) && strike?(nextroll1) && strike?(nextroll2)\n true\n else\n false\n end\n end", "title": "" } ]
[ { "docid": "b8cf86479c54c6cc1de7ac5cf3f3e68c", "score": "0.70949405", "text": "def score_strikes(scores, strike_locs)\n score = 0\n # perfect game\n return 300 if strike_locs.length == 10\n\n strike_locs.each do |loc|\n next unless loc <= 8\n # does not add score for a strike frame if the last strike is not followed\n # by 2 rolls (bonus cannot be calculated yet)\n next if scores.length < 10 && scores.last[0] == 'X'\n\n # 3 strikes\n score += 30 if scores[loc + 1][0] == 'X' && scores[loc + 2][0] == 'X'\n\n # 2 strikes and a 3rd roll\n if scores[loc + 1][0] == 'X' && scores[loc + 2][0] != 'X'\n score += 20 + scores[loc + 2][0].to_i\n\n # strike and a spare\n elsif scores[loc + 1].include?('/')\n score += 20\n end\n\n # strike + 2 rolls (less than a spare)\n unless scores[loc + 1][0] == 'X' || scores[loc + 1][1] == '/'\n score += 10 + scores[loc + 1].map(&:to_i).sum\n end\n end\n score\nend", "title": "" }, { "docid": "8e991c270698338c8db0a90cb04e5836", "score": "0.6814915", "text": "def saw_strike\n @count[:strikes] += 1\n check_strikes\n end", "title": "" }, { "docid": "4407040346c97dd41cdf1a65ee3c95af", "score": "0.6701013", "text": "def score_hand\n final_score = 0\n final_score += 2 if pair?\n final_score += 3 if two_pair?\n final_score += 4 if three_of_a_kind?\n final_score += 5 if straight?\n final_score += 6 if flush?\n final_score += 1 if pair? && three_of_a_kind?\n final_score += 8 if four_of_a_kind?\n final_score += 1 if royal_flush?\n @score = final_score\n end", "title": "" }, { "docid": "99dfc00c5b0908ab3dac2a775fcc984c", "score": "0.6697091", "text": "def score_regular\n if how_many? > 5\n @score += @die*200\n elsif how_many? > 2\n @score += @die*100\n end\n end", "title": "" }, { "docid": "0f37b814aea35a54cb27981d8a3f0041", "score": "0.6593849", "text": "def score\n return 'love' if @points == 0\n return 'fifteen' if @points == 1\n return 'thirty' if @points == 2\n return 'forty' if @points == 3\n return 'advantage' if @points == 4\n return 'adv +' if @points >= 5\n end", "title": "" }, { "docid": "6e88ac3832f24459ae4624290e1e2acf", "score": "0.65885514", "text": "def score\n # this is sequentially checking scores and returning values\n # what might be a better way?\n # It feels like switching states, which are not visible,\n # and then mapping these states to the natural language\n # output.\n #\n # Love/Fifteen/.../Forty is inner level of mapping.\n # for the scores the \"inner loop\"\n # The outer states are All, Advantage, Win, etc. determined\n # by difference/comparing.\n #\n names1 = [ \"Love\", \"Fifteen\", \"Thirty\", \"Forty\", \"Advantage #{@player1Name}\" ]\n names2 = [ \"Love\", \"Fifteen\", \"Thirty\", \"Forty\", \"Advantage #{@player2Name}\" ]\n \n result = \"\"\n # equal and low score\n if (@p1points == @p2points and @p1points < 3)\n return names1[@p1points] + \"-All\"\n end\n # equal and high score\n if (@p1points==@p2points and @p1points>2)\n return \"Deuce\"\n end\n\n p1res = \"\"\n p2res = \"\"\n # player 1 has sth, player 2 has nothing\n if (@p1points > 0 and @p2points==0)\n p2res = names2[@p2points]\n p1res = names1[@p1points]\n result = p1res + \"-\" + p2res\n end\n # player 2 is leading (the reverse) duplicated\n if (@p2points > 0 and @p1points==0)\n p2res = names2[@p2points]\n p1res = names1[@p1points]\n result = p1res + \"-\" + p2res\n end\n\n # duplicated blocks, player 1 leading but with low score\n if (@p1points>@p2points and @p1points < 4)\n p1res = names1[@p1points]\n p2res = names2[@p2points]\n result = p1res + \"-\" + p2res\n end\n if (@p2points>@p1points and @p2points < 4)\n p1res = names1[@p1points]\n p2res = names2[@p2points]\n result = p1res + \"-\" + p2res\n end\n\n # one is leading with hi score\n if (@p1points > @p2points and @p2points >= 3)\n result = names1[[@p1points, 4].min]\n end\n if (@p2points > @p1points and @p1points >= 3)\n result = names2[[@p2points, 4].min]\n end\n\n # wins when >= 2 more score and high score\n if (@p1points>=4 and @p2points>=0 and (@p1points-@p2points)>=2)\n result = \"Win for \" + @player1Name\n end\n if (@p2points>=4 and @p1points>=0 and (@p2points-@p1points)>=2)\n result = \"Win for \" + @player2Name\n end\n result\n end", "title": "" }, { "docid": "6e7ab434c068ef1aff0d0b70608114a2", "score": "0.6573687", "text": "def score\n return 'love' if @points == 0\n end", "title": "" }, { "docid": "2e579fdca18b100c5b41e4a7000e041c", "score": "0.65647936", "text": "def score\n return 'love' if @points == 0\n return 'fifteen' if @points == 1\n return 'thirty' if @points == 2\n return 'fourty' if @points == 3\n end", "title": "" }, { "docid": "00b864c2ab90ec5b13a9c2b7020e0b2d", "score": "0.6508447", "text": "def adjusted_score\n adj_score = 0\n scorecards.each do |score|\n if score.strokes.nil?\n adj_score += score.hole.par + 2\n elsif score.strokes > (score.hole.par + 2)\n adj_score += score.hole.par + 2\n else\n adj_score += score.strokes\n end\n end\n return adj_score\n end", "title": "" }, { "docid": "5c0ea17118edac17ca0bc8a1e1acea94", "score": "0.6504548", "text": "def strike_score\n return 0 unless strike?\n \n if final?\n balls[1].score + balls[2].score\n else\n next_ball.score + next_next_ball.score\n end\n end", "title": "" }, { "docid": "cb32144f99b7694b40be991a75e4eaf6", "score": "0.64976525", "text": "def score_one\n if how_many? > 5\n @score += 2000\n elsif how_many? > 2\n @score += 1000 + (how_many?-3)*100\n else\n @score += how_many?*100\n end\n end", "title": "" }, { "docid": "853ca927ab6ef714006bb97ebd791b8e", "score": "0.6478858", "text": "def score\n return 'love' if @points == 0\n return 'fifteen' if @points == 1\n return 'thirty' if @points == 2\n return 'forty' if @points == 3\n return 'advantage' if @points == 4 && opponent.points == 5\n end", "title": "" }, { "docid": "38b11ddba37c3a1b6ae295fdaaed1f75", "score": "0.6470604", "text": "def score_strike\n @total_score += 10 + @next_roll + @rolls[@current_roll + 2]\n @current_roll += 1\n end", "title": "" }, { "docid": "38b11ddba37c3a1b6ae295fdaaed1f75", "score": "0.6470604", "text": "def score_strike\n @total_score += 10 + @next_roll + @rolls[@current_roll + 2]\n @current_roll += 1\n end", "title": "" }, { "docid": "8181e10c4b80105b0c6467e160a375e7", "score": "0.6460423", "text": "def mistake_score(raw_scores)\n (1.0 * raw_scores[0]) + (0.5 * raw_scores[1])\n end", "title": "" }, { "docid": "edbc4d2120015b4afbe2f514a8538645", "score": "0.6440477", "text": "def score_strike\n\t\t@total_score += 10 + @next_roll + @rolls[@current_roll + 2]\n\t\t@current_roll += 1\n\tend", "title": "" }, { "docid": "edbc4d2120015b4afbe2f514a8538645", "score": "0.6440477", "text": "def score_strike\n\t\t@total_score += 10 + @next_roll + @rolls[@current_roll + 2]\n\t\t@current_roll += 1\n\tend", "title": "" }, { "docid": "e506db573f41dc90dde0cd08b1761300", "score": "0.63642913", "text": "def score()\n total_score = 0\n number_of_rolls = @scores.count\n\n @scores.each_with_index do |current_score, index|\n last_score = @scores[index - 1]\n last_last_score = @scores[index - 2]\n is_last_roll = number_of_rolls - 1 == index\n is_gutter_ball = last_last_score == 0\n\n # check if there are at least 2 rolls\n if index > 1\n is_strike = last_last_score == 10\n is_spare = last_score + last_last_score == 10 && !is_gutter_ball\n end\n\n if !is_last_roll\n # add bonus scores if strike\n if is_strike\n total_score += current_score + last_score\n # add bonus score if spare\n elsif is_spare\n total_score += current_score\n end\n end\n\n # always add current score\n total_score += current_score\n end\n\n total_score\n end", "title": "" }, { "docid": "4ff2a574aee5cacf393b181f9f7d1bba", "score": "0.6362962", "text": "def score\n score = 0\n round = 0\n for frame in 0...10\n if Strike?(round) \n score += 10 + strikeBonus(round)\n round++\n elsif Spare?(round)\n score += 10 + spareBonus(round)\n round += 2\n else \n score += scoreInRound(round)\n round += 2\n end\n end\n return score\n end", "title": "" }, { "docid": "ae24dca43ff979526c90a9a504d02fa6", "score": "0.63571703", "text": "def score_strike\n @total_score += 10 + @rolls[@current_roll + 1] + @rolls[@current_roll + 2]\n @current_roll += 1\n frame_counter\n end", "title": "" }, { "docid": "7ebc9a84a7af64c392b346bf44328974", "score": "0.63412696", "text": "def scoreThrows(radi)\n unless radi.nil? \n score = 0\n give_bonus = true\n radi.map do |dart| \n dart.between?(5,10) ? (score += 5; give_bonus = false) : score += 10 unless dart > 10\n give_bonus = false if dart > 5\n end \n result = give_bonus == true ? score += 100 : score\n radi.empty? ? score = 0 : result \n end\nend", "title": "" }, { "docid": "3f82a2076907364c9818218c6d603d40", "score": "0.63315135", "text": "def score\n distance_to_bullseye = (@abscissa**2 + @ordinate**2)**0.5\n return 0 if distance_to_bullseye > 10\n return 1 if distance_to_bullseye > 5\n return 5 if distance_to_bullseye > 1\n\n 10\n end", "title": "" }, { "docid": "0f50616f2500b0b5e159d340f9d799cb", "score": "0.63182795", "text": "def score_spare\n\t\t@total_score += 10 + @rolls[@current_roll + 2]\n\t\t@current_roll += 2\n\tend", "title": "" }, { "docid": "2d0582f7eb461c0031c8e2e4037978d6", "score": "0.63069594", "text": "def score_spare\n @total_score += 10 + @rolls[@current_roll +2]\n @current_roll += 2\n end", "title": "" }, { "docid": "9c4f49a5a5eaec5e0204e142997b6852", "score": "0.62966764", "text": "def score_spare \n @total_score += 10 + @rolls[@current_roll + 2]\n @current_roll += 2\n end", "title": "" }, { "docid": "b0d6b52f3be009c15e6872ac4eb6e27b", "score": "0.6281399", "text": "def score_spare\n @total_score += 10 + @rolls[@current_roll + 2]\n @current_roll += 2\t\n\tend", "title": "" }, { "docid": "3660c8d48fc7d62a7c14efd56b988fbf", "score": "0.62812907", "text": "def score\n case points\n when 0\n 'love'\n when 1\n 'fifteen'\n when 2\n 'thirty'\n when 3\n 'fourty'\n end\n end", "title": "" }, { "docid": "4daa9f69ec5db0d11e5e0701fe7cc683", "score": "0.62495416", "text": "def fruit(reels, spins)\n # Code here\n a = reels[0][spins[0]]\n b = reels[1][spins[1]]\n c = reels[2][spins[2]]\n result = 0\n flag = false\n\n if a == 'Wild' || b == 'Wild' || c == 'Wild'\n flag = true\n end\n\n if a == b && b == c \n result = score(a, 3)\n return result \n end\n\n case flag\n when false\n if a == b || a == c \n result = score(a, 2)\n elsif b == c \n result = score(b, 2)\n end\n when true \n if a == b || a == c && a != 'Wild'\n result = score(a, 'wild')\n elsif a == b || a == c && a == 'Wild'\n result = score(a, 2)\n elsif b == c && b != 'Wild'\n result = score(b, 'wild')\n elsif b == c && b == 'Wild'\n result = score(b, 2)\n end\n end\n result \n\nend", "title": "" }, { "docid": "43e888296a396ac7868861eb1a6cf8fc", "score": "0.6242603", "text": "def score\n\t\tindex = 0\n\t\ttotal = 0\n\t\t\n\t\twhile (index < @frameList.size)\n\t\t\tif(index == 9)\n\t\t\t\tif(@frameList[9].firstL != -1)\n\t\t\t\t\ttotal += @frameList[9].firstL\n\t\t\t\t\tif(@frameList[9].secondL != -1)\n\t\t\t\t\t\ttotal += @frameList[9].secondL\n\t\t\t\t\t\tif(@frameList[9].bonus != -1)\n\t\t\t\t\t\t\ttotal += @frameList[9].bonus\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t# Normal Situation::::::::::::::::::::::::::::::::::\n\t\t\telsif(@frameList[index].flagSituation == \"N\")\n\t\t\t\tif (@frameList[index].firstL != -1)\n\t\t\t\t\ttotal += @frameList[index].firstL\n\t\t\t\t\tif (@frameList[index].secondL != -1)\n\t\t\t\t\t\ttotal += @frameList[index].secondL\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t# Strike Situation::::::::::::::::::::::::::::::::::\n\t\t\telsif(@frameList[index].flagSituation == \"ST\")\n\t\t\t\ttotal += 10\n\t\t\t\tif(@frameList[index + 1] != nil)\n\t\t\t\t\tif(@frameList[index + 1].flagSituation == \"ST\")\n\t\t\t\t\t\ttotal += 10\n\t\t\t\t\t\t\n\t\t\t\t\t\tif(index == 8 and @frameList[9].secondL != -1)\n\t\t\t\t\t\t\ttotal += @frameList[9].secondL\n\t\t\t\t\t\t\n\t\t\t\t\t\telsif(@frameList[index + 2] != nil)\n\t\t\t\t\t\t\ttotal += @frameList[index + 2].firstL\n\t\t\t\t\t\tend\n\t\t\t\t\telsif(@frameList[index + 1].firstL != -1)\n\t\t\t\t\t\ttotal += @frameList[index + 1].firstL\n\t\t\t\t\t\tif(@frameList[index + 1].secondL != -1)\n\t\t\t\t\t\t\ttotal += @frameList[index + 1].secondL\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t# Spare Situation::::::::::::::::::::::::::::::::::\n\t\t\telsif(@frameList[index].flagSituation == \"SP\")\n\t\t\t\ttotal += 10\n\t\t\t\tif(@frameList[index + 1] != nil)\n\t\t\t\t\tif(@frameList[index + 1].firstL != -1)\n\t\t\t\t\t\ttotal += @frameList[index + 1].firstL\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\tindex += 1\n\t\tend\n\t\ttotal\n\tend", "title": "" }, { "docid": "23ada1e19da3a42407f0cc0c372b86b4", "score": "0.6236187", "text": "def calculate_frame_score(bowl_1, bowl_2)\n if @strike == true\n #this adds the\n score = (bowl_1 + bowl_2) * 2\n elsif @spare == true\n score = (bowl_1 * 2) + bowl_2\n elsif\n score = bowl_1 + bowl_2\n end\n return score\n end", "title": "" }, { "docid": "e75a97728f2971fb089c5c17be8691d5", "score": "0.6231446", "text": "def score\r\n pos = tacks\r\n n = tacks + flaggings_count\r\n return 0 if n == 0\r\n z = 1.96 # confidence level of 0.95\r\n phat = 1.0*pos/n\r\n (phat + z*z/(2*n) - z * Math.sqrt((phat*(1-phat)+z*z/(4*n))/n))/(1+z*z/n)\r\n end", "title": "" }, { "docid": "e2a11c66289de2a4f39d6ed19c8e734e", "score": "0.621039", "text": "def return_user_word_score(old_entry)\n old_entry += NORMAL_BONUS unless hover\n return 0.0 if old_entry < 0.0\n old_entry\n end", "title": "" }, { "docid": "87437b752ce206eb90fd4796e6b9f042", "score": "0.6207956", "text": "def score\n return 'love' if @points == 0\n return 'fifteen' if @points == 1\n return 'thirty' if @points == 2\n return 'forty' if @points == 3\n return \"#{@points}\" if @points > 3\n end", "title": "" }, { "docid": "04cf019044a39c1c70c8680195367657", "score": "0.6207206", "text": "def add_apples_score\n @score += 50\n @lives += 1 if @lives < 3\n end", "title": "" }, { "docid": "1ca1317bc802e1d1ffd892ff5138d760", "score": "0.6203042", "text": "def should_play_next_score \n (score + last_played_score) / 2\n end", "title": "" }, { "docid": "12b633078b65ff2ef662afc79f7d5804", "score": "0.6195016", "text": "def score(answers)\n if @answers & @answer_key == @answers \n return 100\n else\n return 75.0\n end\n\n # if grader.grades.count == 0 \n # i =+ 1 \n # else\n # return \"No grades have been taken\"\n # end\n end", "title": "" }, { "docid": "6d1c44e2dcedc64421167712972b15c7", "score": "0.6166754", "text": "def bowling_score(scores)\n scores = scores.split(' ')\n scores = scores.map { |score| score.split('') }\n strike_locs, spare_locs = locate_strikes_and_spares(scores[0..7])\n # score open frames\n opens = score_open_frames(scores[0..7])\n\n # score spares\n spares = score_spares(scores, spare_locs)\n\n # score strikes\n strikes = score_strikes(scores, strike_locs)\n\n # score frames nine and ten\n nine = (scores.length == 10 ? score_frame_9(scores) : 0)\n ten = (scores.length == 10 ? score_frame_10(scores[9]) : 0)\n opens + strikes + spares + nine + ten\nend", "title": "" }, { "docid": "c4f4cd91636c5499f50b8b944eef1f7b", "score": "0.61480445", "text": "def calculate_score\n self.score = (ll_score + tw_base + fb_base + google_base + pinterest_base + linkedin_base + delicious_base + stumble_base) / (((Time.now - created_at) / 1.hour) + 2 ** 3.0)\n end", "title": "" }, { "docid": "35e4158b3d4e8f298365b9c2b2310615", "score": "0.61464196", "text": "def score_spares(scores, spare_locs)\n score = 0\n spare_locs.each do |loc|\n # does not add score for last spare if spare is not followed by\n # a bonus roll\n next if scores[loc + 1].nil?\n\n score += (scores[loc + 1][0] == 'X' ? 20 : 10 + scores[loc + 1][0].to_i)\n end\n score\nend", "title": "" }, { "docid": "d9b313c60e1142abba31bfed0ebb8fad", "score": "0.61365044", "text": "def score\n 0\n end", "title": "" }, { "docid": "d9b313c60e1142abba31bfed0ebb8fad", "score": "0.61365044", "text": "def score\n 0\n end", "title": "" }, { "docid": "fe4b2e20edd5a55bd2632325ee78937b", "score": "0.6127829", "text": "def scoring\n end", "title": "" }, { "docid": "e1ab191186bff1f44a583198ca7c7d55", "score": "0.6125957", "text": "def score\n score = 0\n @word.each do |letter|\n @letter(assign value here)\n @letters.each do |letter|\n (letter1 + letter2 = new_score)\n end\n end\n\n if player_one == player_two\n puts \"It is a tie.\"\n elsif player_one > player_two\n puts \"Player 1 wins.\"\n else player_two > player_one\n puts \"Player 2 wins.\"\n end\n \n end", "title": "" }, { "docid": "512de64cf2cfb0ffeead743d7e3282e7", "score": "0.6123831", "text": "def score\n raise\n end", "title": "" }, { "docid": "9be97867b5e9278caee47adffe1c5eac", "score": "0.61137867", "text": "def strike_score(index)\n frame = frame_at(index)\n one_frame_ahead = frame_at(index + 1)\n two_frames_ahead = frame_at(index + 2)\n\n return frame.partial_score if frame.last? # 10th and last frame: strike + 2 bonus throws = 3 total throws\n return 10 + 10 + 10 if one_frame_ahead.strike? && two_frames_ahead.strike? # Strike + strike + strike\n return 10 + 10 + two_frames_ahead.ball_one_pins if one_frame_ahead.strike? && frame.frame_number != 9 # Strike + strike + (normal || spare)\n 10 + one_frame_ahead.ball_one_pins + one_frame_ahead.ball_two_pins # (Strike + normal + normal) || (strike + spare) || (strike + strike + strike @9th frame)\n end", "title": "" }, { "docid": "895f5c5dfb779d1427709f8947517f4d", "score": "0.611215", "text": "def update_score(next_frame, next_next_frame)\n moves = Frame.get_next_moves(next_frame, next_next_frame)\n if tenth_frame?\n self.update(score: pins_sum)\n elsif strike? && (moves.length > 1)\n self.update(score: pins_sum + moves[0] + moves[1])\n elsif spare? && (moves.length > 0)\n self.update(score: pins_sum + moves[0])\n elsif !strike? && !spare?\n self.update(score: pins_sum)\n end\n self.score\n end", "title": "" }, { "docid": "188167ac8dd2a24fe4bd44971a4a174d", "score": "0.6108142", "text": "def adjusted_like_count\n (self.like_count||0) + (self.like_count_boost||0)\n end", "title": "" }, { "docid": "43a3f8d0ceca4360bf68d5c9e902a778", "score": "0.6101689", "text": "def update_score(score)\n if score>0\n @score.wins+=1\n elsif score==0\n @score.ties+=1\n elsif score<0\n @score.losses+=1\n else\n raise \"InputMismatchExeption\" \n end\n end", "title": "" }, { "docid": "6877ee4f7d1edf0f7a993126ef7d9a1c", "score": "0.6059442", "text": "def add_point_to_winner\n @current_Score[\"#{@match_Winner}\"] += 1\n end", "title": "" }, { "docid": "41b67fcc3b44ffdd6db93bc8cf4aea82", "score": "0.6054646", "text": "def score_five\n if how_many? > 5\n @score += 1000\n elsif how_many? > 2\n @score += 500 + (how_many?-3)*50\n else\n @score += how_many?*50\n end\n end", "title": "" }, { "docid": "30218582a8a8a8f5ad3a3e4985ebcfa1", "score": "0.60400224", "text": "def score_point\n @correct_answers += 1\n end", "title": "" }, { "docid": "d14beb53e7f04048a96227270a259b07", "score": "0.60324967", "text": "def match_tally\n ##HAND\n if @ai_point == 1\n @ai_score[:engagement] += 1\n elsif @ui_point == 1\n @ui_score[:engagement] += 1\n end\n ##BOUT\n if @ui_score[:engagement] == 2\n puts \"Bout -- #{@name}!\"\n @ui_score[:engagement] = 0\n @ui_score[:bout] += 1\n @ai_score[:engagement] = 0\n end\n if @ai_score[:engagement] == 2\n puts \"Bout -- Computer!\"\n @ui_score[:engagement] = 0\n @ai_score[:engagement] = 0\n @ai_score[:bout] += 1\n end\n ##MATCH\n if @ui_score[:bout] == 2\n puts \"Match -- #{@name}!\"\n @ui_score[:engagement] = 0\n @ui_score[:bout] = 0\n @ai_score[:engagement] = 0\n @ai_score[:bout] = 0\n @ui_score[:match] += 1\n elsif @ai_score[:bout] == 2\n puts \"Match -- Computer!\"\n @ui_score[:engagement] = 0\n @ui_score[:bout] = 0\n @ai_score[:engagement] = 0\n @ai_score[:bout] = 0\n @ai_score[:match] += 1\n end\n end", "title": "" }, { "docid": "f164b1505f5c1a198a53fb38fe56bcb7", "score": "0.60294425", "text": "def test\n @score = 0\n\n if contain_invalid_matches?\n invalid!\n elsif common_word?\n invalid!\n elsif contain_invalid_repetion?\n invalid!\n else\n @score += score_for(:password_size)\n @score += score_for(:numbers)\n @score += score_for(:symbols)\n @score += score_for(:uppercase_lowercase)\n @score += score_for(:numbers_chars)\n @score += score_for(:numbers_symbols)\n @score += score_for(:symbols_chars)\n @score += score_for(:only_chars)\n @score += score_for(:only_numbers)\n @score += score_for(:username)\n @score += score_for(:sequences)\n @score += score_for(:repetitions)\n\n @score = 0 if score < 0\n @score = 100 if score > 100\n\n weak! if score < 35\n good! if score >= 35 && score < 70\n strong! if score >= 70\n end\n\n score\n end", "title": "" }, { "docid": "1c0ecf465e2fdd6822a9157d1effa194", "score": "0.6023465", "text": "def score_spare\n @total_score += 10 + @rolls[@current_roll + 2]\n @current_roll += 2 \n frame_counter\n end", "title": "" }, { "docid": "1f54082df60dd5ab3c0323654fe57d52", "score": "0.60192615", "text": "def score\n (object.score*20).round if object.score\n end", "title": "" }, { "docid": "832f4656402f550d2f8dfb3577d99276", "score": "0.6009724", "text": "def score( dice )\n\npoints = 0\n# when there is less then three 5's or 1's\nif dice.count(5) <=2 && dice.count(1) <=2\n if dice.count(2) >= 3\n points += 200\n elsif dice.count(3) >= 3\n points += 300\n elsif dice.count(4) >= 3\n points += 400\n elsif dice.count(6) >= 3\n points += 600\n end\n points += dice.count(1) * 100 + dice.count(5) * 50\n# when there is 3 or more 1s\nelsif dice.count(1) >= 3\n if dice.count(1) == 3\n points = 1000 + dice.count(5) * 50\n elsif dice.count(1) == 4\n points = 1100 + dice.count(5) * 50\n elsif dice.count(1) == 5\n points = 1200\n end\n# last scenario three or more 5's\nelse\n if dice.count(5) == 3\n points = 500 + dice.count(1) * 100\n elsif dice.count(1) == 4\n points = 500 + dice.count(1) * 100\n elsif dice.count(1) == 5\n points = 600\n end\nend\n\npoints\nend", "title": "" }, { "docid": "bb828ae8e8aa8bc1bcddce854d9dad59", "score": "0.6009493", "text": "def score\n 0\n end", "title": "" }, { "docid": "0be00d3a06bf9dd3501f25c428956357", "score": "0.6007248", "text": "def is_strike?(score)\n score.to_i == 10\n end", "title": "" }, { "docid": "d8d5f97bd5588c11ae72a52ff8df785c", "score": "0.6006147", "text": "def score_word(word)\n score = 0\n # if the length of the word is greater than 7, 8 additional points are added\n if word.length >= 7\n score = 8\n end\n\n word.split(\"\").each do |letter|\n #scoring system with letter/point value\n case letter.upcase\n when \"A\", \"E\", \"I\", \"O\", \"U\", \"L\", \"N\", \"R\", \"S\", \"T\"\n score += 1\n when \"D\", \"G\"\n score += 2\n when \"B\", \"C\", \"M\", \"P\"\n score += 3\n when \"F\",\"H\",\"V\",\"W\",\"Y\"\n score += 4\n when \"K\"\n score += 5\n when \"J\",\"X\"\n score += 8\n when \"Q\",\"Z\"\n score += 10\n else\n puts \"Invalid word score: #{word}\"\n end\n end\n #total score of the word\n return score\nend", "title": "" }, { "docid": "c9acddcb5ee8fb33959bb6f23740a608", "score": "0.599124", "text": "def spare_score\n return 0 unless spare?\n\n if final?\n balls[2].score\n else\n next_ball.score\n end\n end", "title": "" }, { "docid": "2e2191f82f4e06b558f46f452b9b0a1c", "score": "0.5990697", "text": "def spo(name, scores)\n name = name\n sl = scores.length\n i = 0\n final_total = 0\n \n ## Looping through the score array adding up for the final total \n while i <= sl - 1\n\n ## If the frame is a spare\n if scores[i].length == 2 && scores[i][0].to_i + scores[i][1].to_i == 10\n\n final_total = 10 + scores[i+1][0].to_i + final_total\n \n ## if the frame is the 10th frame \n elsif scores[i].length == 3\n\n final_total = scores[i][0].to_i + scores[i][1].to_i + scores[i][2].to_i + final_total\n \n ## if the frame is a strike and the next frame is either a spare or open\n elsif scores[i][0].to_i == 10 && scores[i+1].length == 2\n\n final_total = 10 + scores[i+1][0].to_i + scores[i+1][1].to_i + final_total\n \n ## if the next 2 frames are strikes and the next throw is not \n elsif scores[i][0].to_i == 10 && scores[i+1].length == 1 && scores[i+2].length != 1\n \n final_total = 20 + scores[i+2][0].to_i + final_total\n \n ## if the next 3 frames are strikes \n elsif scores[i][0].to_i == 10 && scores[i+1][0].to_i == 10 && scores[i+2] != nil \n \n final_total = 10 + scores[i+1][0].to_i + scores[i+2][0].to_i + final_total\n \n ## for the 9th frame if you strike and have a spare or open on the 10th frame\n elsif scores[i][0].to_i == 10 && scores[i+1][0].to_i == 10 && scores[i+2] == nil\n\n final_total = 10 + scores[i+1][0].to_i + scores[i+1][1].to_i + final_total\n\n else\n\n ## for a open frame\n \n final_total = scores[i][0].to_i + scores[i][1].to_i + final_total\n\n end\n i += 1\n end\n ## final name and total score for the bowling game\n final = name, final_total\n end", "title": "" }, { "docid": "24a2f2f4c811e4aed432a5e21036fc0a", "score": "0.5989509", "text": "def calculateScore\n\n\tend", "title": "" }, { "docid": "bfe570e85ef71880555f624eec2d1352", "score": "0.59840727", "text": "def update_score!\n\t\tscore = 0\n\t\tpredictions.each do |p|\n\t\t\tif p.correct?\n\t\t\t\tscore += (2 ** p.round)\n\t\t\tend\n\t\tend\n\t\tself.update_attributes :score => score\n\tend", "title": "" }, { "docid": "098a4e7fdf52860919b9aea293960c7c", "score": "0.5978282", "text": "def postmatchScores(_old_score, _exp_score, _games_played, _result)\n\t# Calculate k value\n\tif _games_played < 30 then\n\t\tk = 40\n\telsif _old_score < 2400 then\n\t\tk = 20\n\telse\n\t\tk = 10\n\tend\n\t\n\t# Return new score\n\treturn (_old_score + k * (_result - _exp_score))\nend", "title": "" }, { "docid": "600854cad122fd5e1b4fd9775d314d9c", "score": "0.5977891", "text": "def calculate_score\n self.score = RatingSystem::SCORE_FACTOR * (skill_mean - 2 * skill_deviation)\n self.score = [self.score.to_i, 0].max # ensure not negative\n end", "title": "" }, { "docid": "53d5ac5274e17f7d0b15cbe56a248ff5", "score": "0.5969805", "text": "def total_score\n points = 0\n played_words.each do |word|\n points += Scrabble::Scoring.score(word)\n end\n return points\n end", "title": "" }, { "docid": "1c9addf49b8ea9ade246c57b0192412d", "score": "0.59654695", "text": "def score\n while points < 3\n if points == 0\n return 'love'\n elsif points == 1\n return 'fifteen'\n elsif points == 2\n return 'thirty'\n end\n end\n\n while points >= 3\n if points == opponent.points\n return 'deuce'\n elsif points - opponent.points == 1\n return \"Advantage: #{self.name}\"\n elsif points - opponent.points == -1\n return \"Advantage: #{self.opponent.name}\"\n elsif points - opponent.points == 2\n return \"Game: #{self.name}\"\n elsif points - opponent.points == -2\n return \"Game: #{self.opponent.name}\"\n end\n end\n\n end", "title": "" }, { "docid": "87f6c42d1a0a3e9a3a248258257fad32", "score": "0.5961227", "text": "def strike?\n return score_for_attempt == 10\n end", "title": "" }, { "docid": "513c9c2a7ffa91fe5269714fd97357c7", "score": "0.5955663", "text": "def score\n result = 0\n \n NUMBER_OF_FRAMES.times do\n if strike?\n result += 10 + next_two_throws\n elsif spare?\n result += 10 + next_throw\n else\n result += frame_score\n end\n end\n \n return result\n end", "title": "" }, { "docid": "b6fed0e499081a5c1bf9fec6936a0ec9", "score": "0.59555334", "text": "def score(game)\n if game.winner.nil?\n 0\n elsif game.winner.mark == \"O\"\n +1\n elsif game.winner.mark == \"X\"\n -1\n end\n end", "title": "" }, { "docid": "bf396396a740c76a8c4004192cf47937", "score": "0.5949883", "text": "def score_Word(_word)\ncharArray = _word.split(\"\")\t# seperate letters of word into character array\nstrLength = _word.length\t# determine number of times to loop\nmult3 = false\t\t# bool to signify if total score will be multiplied by 3\nmult2 = false\t\t# bool to signify if total score will be multiplied by 2\nscore = 0\t\t# initialize score as 0\nscores = { 'A' => 1, 'F' => 4, 'K' => 5, 'P' => 3, 'U' => 1,\t\t#Associative array implemented by hash to relate letters to their associated score\n 'B' => 2, 'G' => 2, 'L' => 1, 'Q' => 10, 'V' => 4,\n 'C' => 3, 'H' => 4, 'M' => 3, 'R' => 1, 'W' => 4,\n 'D' => 2, 'I' => 1, 'N' => 1, 'S' => 1, 'X' => 8,\n 'E' => 1, 'J' => 8, 'O' => 1, 'T' => 1, 'Y' => 4,\n 'Z' => 10, 'a' => 1, 'b' => 2, 'c' => 3, 'd' => 2, 'e' => 1,\n'f' => 4, 'g' => 2, 'h' => 4, 'i' => 1, 'j' => 8, 'k' => 5, 'l'=>1,\n'm' => 3, 'n' => 1, 'o' => 1, 'p' => 3, 'q' => 10, 'r' => 1, 's' => 1, 't' => 1, 'u' => 1, \n'v' => 4, 'w' => 4, 'x' => 8, 'y' => 4, 'z' => 10\n };\nif charArray[0] == '2' # set bool to true if word score is to be doubled\n\tmult2 = true\n\ta = 1 # begin iterating at second letter\nelsif charArray[0] == '3' # set bool to true if word score is to be tripled \n\tmult3 = true\n\ta = 1 \t# begin iterating at second letter\nelse\n\ta = 0 \t# begin itrating at first letter\nend\nfor a in 0..strLength do # begin looping over each character in word \n\tx = a+1\t\t# increase position counter to see following character\n\ty = charArray[a]\t# y set to next character from current position a\n\tz = 0\n\tcase y\t\t\t# switch statement to check value for current character\n\twhen 'A', 'a'\n\t\tz = scores.fetch('a')\n\t\tif charArray[x] == '2'\n \t\tz = z * 2\n \t\telsif charArray[x] == '3'\n \tz = z * 3\n \t\tend\n\twhen 'B', 'b'\n\t\tz = scores.fetch('b')\n\t\tif charArray[x] == '2'\n \t\tz = z * 2\n \t\telsif charArray[x] == '3'\n \tz = z * 3\n \t\tend\n\twhen 'C', 'c'\n\t\tz = scores.fetch('c')\n\t\tif charArray[x] == '2'\n \t\tz = z * 2\n \t\telsif charArray[x] == '3'\n \tz = z * 3\n \t\tend\n\twhen 'D', 'd'\n\t\tz = scores.fetch('d')\n\t\tif charArray[x] == '2'\n \t\tz = z * 2\n \t\telsif charArray[x] == '3'\n \tz = z * 3\n \t\tend\n\twhen 'E', 'e'\n\t\tz = scores.fetch('e')\n\t\tif charArray[x] == '2'\n \t\tz = z * 2\n \t\telsif charArray[x] == '3'\n \tz = z * 3\n \t\tend\n\twhen 'F', 'f'\n\t\tz = scores.fetch('f')\n\t\tif charArray[x] == '2'\n \t\tz = z * 2\n \t\telsif charArray[x] == '3'\n \tz = z * 3\n \t\tend\n\twhen 'G','g'\n\t\tz = scores.fetch('g')\n\t\tif charArray[x] == '2'\n \t\tz = z * 2\n \t\telsif charArray[x] == '3'\n \tz = z * 3\n \t\tend\n\twhen 'H', 'h'\n\t\tz = scores.fetch('h')\n\t\tif charArray[x] == '2'\n \t\tz = z * 2\n \t\telsif charArray[x] == '3'\n \tz = z * 3\n \t\tend\n\twhen \"I\", 'i'\n\t\tz = scores.fetch('i')\n\t\tif charArray[x] == '2'\n \t\tz = z * 2\n \t\telsif charArray[x] == '3'\n \tz = z * 3\n \t\tend\n\twhen 'J', 'j'\n\t\tz = scores.fetch('j')\n\t\tif charArray[x] == '2'\n \t\tz = z * 2\n \t\telsif charArray[x] == '3'\n \tz = z * 3\n \t\tend\n\twhen 'K', 'k'\n\t\tz = scores.fetch('k')\n\t\tif charArray[x] == '2'\n \t\tz = z * 2\n \t\telsif charArray[x] == '3'\n \tz = z * 3\n \t\tend\n\twhen 'L', 'l'\n\t\tz = scores.fetch('l')\n\t\tif charArray[x] == '2'\n \t\tz = z * 2\n \t\telsif charArray[x] == '3'\n \tz = z * 3\n \t\tend\n\twhen 'M', 'm'\n\t\tz = scores.fetch('m')\n\t\tif charArray[x] == '2'\n \t\tz = z * 2\n \t\telsif charArray[x] == '3'\n \tz = z * 3\n \t\tend\n\twhen 'N', 'n'\n\t\tz = scores.fetch('n')\n\t\tif charArray[x] == '2'\n \t\tz = z * 2\n \t\telsif charArray[x] == '3'\n \tz = z * 3\n \t\tend\n\twhen 'O', 'o'\n\t\tz = scores.fetch('o')\n\t\tif charArray[x] == '2'\n \t\tz = z * 2\n \t\telsif charArray[x] == '3'\n \tz = z * 3\n \t\tend\n\twhen 'P', 'p'\n\t\tz = scores.fetch('p')\n\t\tif charArray[x] == '2'\n \t\tz = z * 2\n \t\telsif charArray[x] == '3'\n \tz = z * 3\n \t\tend\n\twhen 'Q', 'q'\n\t\tz = scores.fetch('q')\n\t\tif charArray[x] == '2'\n \t\tz = z * 2\n \t\telsif charArray[x] == '3'\n \tz = z * 3\n \t\tend\n\twhen 'R', 'r'\n\t\tz = scores.fetch('r')\n\t\tif charArray[x] == '2'\n \t\tz = z * 2\n \t\telsif charArray[x] == '3'\n \tz = z * 3\n \t\tend\n\twhen 'S', 's'\n\t\tz = scores.fetch('s')\n\t\tif charArray[x] == '2'\n \t\tz = z * 2\n \t\telsif charArray[x] == '3'\n \tz = z * 3\n \t\tend\n\twhen 'T', 't'\n\t\tz = scores.fetch('t')\n\t\tif charArray[x] == '2'\n \t\tz = z * 2\n \t\telsif charArray[x] == '3'\n \tz = z * 3\n \t\tend\n\twhen 'U', 'u'\n\t\tz = scores.fetch('u')\n\t\tif charArray[x] == '2'\n \t\tz = z * 2\n \t\telsif charArray[x] == '3'\n \tz = z * 3\n \t\tend\n\twhen 'V', 'v'\n\t\tz = scores.fetch('v')\n\t\tif charArray[x] == '2'\n \t\tz = z * 2\n \t\telsif charArray[x] == '3'\n \tz = z * 3\n \t\tend\n\twhen 'W', 'w'\n\t\tz = scores.fetch('w')\n\t\tif charArray[x] == '2'\n \t\tz = z * 2\n \t\telsif charArray[x] == '3'\n \tz = z * 3\n \t\tend\n\twhen 'X', 'x'\n\t\tz = scores.fetch('x')\n\t\tif charArray[x] == '2'\n \t\tz = z * 2\n \t\telsif charArray[x] == '3'\n \tz = z * 3\n \t\tend\n\twhen 'Y', 'y'\n\t\tz = scores.fetch('y')\n\t\tif charArray[x] == '2'\n \t\tz = z * 2\n \t\telsif charArray[x] == '3'\n \tz = z * 3\n \t\tend\n\twhen 'Z', 'z'\n\t\tz = scores.fetch('z')\n\t\tif charArray[x] == '2'\n \t\tz = z * 2\n \t\telsif charArray[x] == '3'\n \tz = z * 3\n \t\tend\n\telse\n\tend\nscore = score + z \t# update score\nend\n\nif mult2 == true\n\treturn score * 2\nelsif mult3 == true\n\treturn score * 3\nelse\n\treturn score\nend\nend", "title": "" }, { "docid": "e57302cbe26811f89b4fd344673914e2", "score": "0.59469765", "text": "def score_checker(word)\n word_score = ScrabbleNerd::LETTER_SCORE_VALUES\n points = 0\n word = word.to_s\n if word == nil || word.length == 0\n return points\n else\n single_characters = word.chars\n single_characters.each do |char|\n points += word_score[char.upcase]\n end\n end\n \n return points\n end", "title": "" }, { "docid": "25e48708ca1b517bcbfab96c4527c303", "score": "0.59462136", "text": "def won_round\n @score += 1\n end", "title": "" }, { "docid": "bf9eb6bd6af4a194331950241fe7a24c", "score": "0.5941161", "text": "def score_by_luke(dice)\n # You need to write this method\n dice = dice.delete_if {|x| 1 > x or x > 6}\n dice = dice.slice!(0..4)\n\n ones = dice.select {|x| x == 1}\n twos = dice.select {|x| x == 2}\n threes = dice.select {|x| x == 3}\n fours = dice.select {|x| x == 4}\n fives = dice.select {|x| x == 5}\n sixes = dice.select {|x| x == 6}\n \n score = 0\n\n case ones.length\n when 3 then score += 1000\n when 4 then score += 1100\n when 5 then score += 1200\n else \n score += ones.length*100\n end\n \n case fives.length\n when 3 then score += 500\n when 4 then score += 550\n when 5 then score += 600\n else \n score += fives.length*50\n end\n=begin #code below does not work, needs to be rewritten with iteration\n everyoneelse = [twos.length, threes.length, fours.length, sixes.length]\n \n case everyoneelse\n when everyoneelse[0] >= 3 then score += 200\n when everyoneelse[1] >= 3 then score += 300\n when everyoneelse[2] >= 3 then score += 400\n when everyoneelse[3] >= 3 then score += 600\n end\n=end\n score\nend", "title": "" }, { "docid": "4e1c4af28cd59ab09810eba445b2587c", "score": "0.5933495", "text": "def report_scores\n if player1.points >= 3 && player1.points == player2.points\n return \"The score is deuce!\"\n elsif player1.points >= 4 || player2.points >= 4\n \n if player1.points >= 4 && player1.points == (player2.points + 1) \n return \"The score is ad in.\"\n elsif player2.points >= 4 && player1.points == (player2.points - 1)\n return \"The score is ad out.\"\n elsif player1.points >= (player2.points + 2)\n return \"Game Over! The server wins!\"\n else\n return \"Game Over! The receiver wins!\"\n end\n \n else\n return \"The score is #{player1.score}, #{player2.score}.\"\n end\n end", "title": "" }, { "docid": "c4888f3bcb5cf5b38e025b0b6af5bc62", "score": "0.5933392", "text": "def update_score\n frames.take(10).each_with_index do |frame, index|\n # do not consider any frame that is already marked done\n # or the extra frame (11th frame)\n # byebug\n unless frame.mark || frame.extra_frame\n # for all frame besides the 10th frame\n if index < 9\n # if frame is strike check for two consequetive ball\n # byebug\n if frame.is_strike? && frames[index.succ]\n next_frame = frames[index.succ]\n if next_frame.is_strike?\n new_index = index.succ\n if frames[new_index.succ]\n next_frame = frames[new_index.succ]\n points = 20 + next_frame.first_roll\n frame.update_and_mark!(score: points)\n end\n else\n points = 10 + next_frame.total_score?\n frame.update_and_mark!(score: points)\n end\n end\n # if frame is spare check for one consequetive ball\n if frame.is_spare? && frames[index.succ]\n points = 10 + frames[index.succ].first_roll\n frame.update_and_mark!(score: points)\n end\n else\n # for the last frame (10th frame)\n if frames[index.succ]\n next_frame = frames[index.succ]\n points = 10 + next_frame.total_score?\n frame.update_and_mark!(score: points)\n end\n end\n end\n end\n end", "title": "" }, { "docid": "27e73c7b81cc7fccced91efa76b46054", "score": "0.5926707", "text": "def score\n val = 0\n val = val + shot_1 unless shot_1.nil?\n val = val + shot_2 unless shot_2.nil?\n if last_frame?\n val = val + shot_3 if !shot_3.nil? and spare?\n else\n val = val + next_two_rolls if strike?\n val = val + next_roll if spare?\n end\n val\n end", "title": "" }, { "docid": "03fcc7f3f47b88813518a34deee4bc2e", "score": "0.59201884", "text": "def score\n if valid? && chain && choices.present?\n prior_tweet = related_tweets.joins(:votes).first\n return if prior_tweet && prior_tweet.tweeted_at > tweeted_at\n prior_tweet.votes.destroy_all if prior_tweet\n choices.each do |choice|\n votes.create!(\n :voter_id => voter_id,\n :choice_id => choice.id,\n :chain_id => chain_id\n )\n end\n chain.update_percentages\n self[:scored] = true\n end\n end", "title": "" }, { "docid": "78fc8fca843c7315cbb4d47b37f2ddbc", "score": "0.59199893", "text": "def score(dice)\n # You need to write this method\n @score = 0\n\n ones = dice.count(1)\n two = dice.count(2)\n three = dice.count(3)\n four = dice.count(4)\n five = dice.count(5)\n six = dice.count(6)\n seven = dice.count(7)\n eight = dice.count(8)\n nine = dice.count(9)\n\n ones >= 3 ? @score+=1000 : false\n two >= 3 ? @score+=200 : false\n three >= 3 ? @score+=300 : false\n four >= 3 ? @score+=400 : false\n five >= 3 ? @score+=500 : false\n six >= 3 ? @score+=600 : false\n seven >= 3 ? @score+=700 : false\n eight >= 3 ? @score+=800 : false\n nine >= 3 ? @score+=900 : false\n\n ones >= 3 ? ones-= 3 : false\n two >= 3 ? two-= 3 : false\n three >= 3 ? three-= 3 : false\n four >= 3 ? four-= 3 : false\n five >= 3 ? five-= 3 : false\n six >= 3 ? six-= 3 : false\n seven >= 3 ? seven-= 3 : false\n eight >= 3 ? eight-= 3 : false\n nine >= 3 ? nine-= 3 : false\n\n\n ones < 3 ? @score+= (100*ones) : 0\n five < 3? @score+= (50*five) : 0\n\n\nend", "title": "" }, { "docid": "0830ba0410ec70c6c07cb244244196a5", "score": "0.5916899", "text": "def score(positive, answer)\n\t\tanswer = answer.to_s.downcase.delete(' ')\n\t\tif positive == true\n\t\t\tcase \n\t\t\twhen answer == 'sangatsesuai'\n\t\t\t\treturn 4\n\t\t\twhen answer == 'sesuai'\n\t\t\t\treturn 3\n\t\t\twhen answer == 'tidaksesuai'\n\t\t\t\treturn 2\n\t\t\telse\n\t\t\t\treturn 1\n\t\t\tend\n\t\telse\n\t\t\tcase \n\t\t\twhen answer == 'sangatsesuai'\n\t\t\t\treturn 1\n\t\t\twhen answer == 'sesuai'\n\t\t\t\treturn 2\n\t\t\twhen answer == 'tidaksesuai'\n\t\t\t\treturn 3\n\t\t\telse\n\t\t\t\treturn 4\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "8ecaf647f536b0bd12fb07d6e189ff9d", "score": "0.591617", "text": "def score; end", "title": "" }, { "docid": "8ecaf647f536b0bd12fb07d6e189ff9d", "score": "0.591617", "text": "def score; end", "title": "" }, { "docid": "8ecaf647f536b0bd12fb07d6e189ff9d", "score": "0.591617", "text": "def score; end", "title": "" }, { "docid": "8ecaf647f536b0bd12fb07d6e189ff9d", "score": "0.591617", "text": "def score; end", "title": "" }, { "docid": "9eed7ff3c34c7e3580b27936ae415061", "score": "0.5915066", "text": "def calculate_final_points\n if self.score_board.id == ScoreBoard.main_score_board.id\n\n match_type = self.match.match_type\n if match_type == Match::GROUP_MAIN\n score_boards = ScoreBoard.not_main_board.active\n score_boards.each do |score_board|\n score_board.points = 0\n score_board.save\n matches = select_group_matches(score_board)\n update_each_group_match(matches, score_board)\n self.score_board.extra_phase.set_point_for_score_board(score_board) unless self.score_board.extra_phase.nil?\n end \n elsif match_type == Match::THIRD_MAIN\n score_boards = ScoreBoard.not_main_board.active\n score_boards.each do |score_board|\n score_board_match = Match.find_by_match_number_score_board(self.match.match_number, score_board) \n winner = self.match.winner.id\n if winner == score_board_match.winner.id\n score_board.points += 7\n score_board.save\n end\n end\n # check winner add 7\n elsif match_type == Match::FINAL_MAIN\n score_boards = ScoreBoard.not_main_board.active\n score_boards.each do |score_board|\n score_board_match = Match.find_by_match_number_score_board(self.match.match_number, score_board) \n winner = self.match.winner.id\n loser = self.match.loser.id\n if winner == score_board_match.winner.id\n score_board.points += 9\n end\n if score_board_match.loser.id == loser\n score_board.points += 8\n end\n score_board.save\n end \n # check if winner (9) and sub champion (8)\n end\n end\n end", "title": "" }, { "docid": "b1be0978e8525c19c8a4591c8510fff1", "score": "0.5914599", "text": "def final_score\n total = 0\n frames = 0\n current_idx = 0\n loop do \n if is_strike(current_idx)\n total += (@frames[current_idx] + @frames[current_idx + 1] + @frames[current_idx + 2])\n current_idx += 1\n elsif is_spare(current_idx)\n total += (@frames[current_idx] + @frames[current_idx + 1] + @frames[current_idx + 2])\n current_idx += 2\n else\n total += (@frames[current_idx] + @frames[current_idx + 1])\n current_idx += 2\n end\n frames += 1\n break if frames == MAX_FRAMES\n end\n total\n end", "title": "" }, { "docid": "8766051c54e31b7a03f63ac05f8de8d5", "score": "0.5913447", "text": "def score\n score = 0\n \n dice_copy = @dice.dup\n \n return STRAIGHT_VALUE if straight?\n \n triplets.each do |triplet|\n multiplier = triplet == 1 ? ONES_MULTIPLIER : DEFAULT_MULTIPLIER\n score += triplet * multiplier\n 3.times {dice_copy.delete_once(triplet)}\n end\n \n # Add 1s and 5s\n score += dice_copy.inject(0) do |sum, d|\n sum += d.value == 1 ? ONE_VALUE : 0\n sum += d.value == 5 ? FIVE_VALUE : 0\n end\n end", "title": "" }, { "docid": "214dc9ef586cedfaf33186be5811aff4", "score": "0.591038", "text": "def expected_score_against(opponent)\n \treturn 1/(1+10**((opponent.rating - self.rating)/400.0))\n end", "title": "" }, { "docid": "705748189e4a3ef28a471b432000c7f6", "score": "0.5909176", "text": "def get_score\n @score = 3 * @tally + 5 * @strength + 2 * @wealth + @food + 30 * @mk\n @score\n end", "title": "" }, { "docid": "37081eebbcf1f70b23542fdd1232e978", "score": "0.5908089", "text": "def score\n # Setup mark array\n mark = Array.new(10)\n for i in 0...mark.length\n mark[i] = Mark.new(false, false, -1, -1)\n end\n i = 0\n # First pass - mark triples/quads\n while i < @cards.length - 2 # can't find a triple past the third last card\n inARow = 0\n while @cards[i].value == @cards[i + 1].value\n i += 1\n inARow += 1\n end\n if inARow >= 2 # triple\n limit = 2\n if inARow == 3 # quad\n limit = 3\n end\n for j in 0..limit\n mark[i - j].set = true\n mark[i - j].setindex = 2 - j\n end\n end\n i += 1\n end\n puts mark.to_s\n # Second pass - mark sequences\n i = 0\n\n # Third pass - brute force\n end", "title": "" }, { "docid": "798b0ae2821f8d590c6cc358f78ab2b7", "score": "0.5907127", "text": "def score_word(word)\n score_chart = {\n \"1\" => [\"A\", \"E\", \"I\", \"O\", \"U\", \"L\", \"N\", \"R\", \"S\", \"T\"],\n \"2\" => [\"D\", \"G\"],\n \"3\" => [\"B\", \"C\", \"M\", \"P\"],\n \"4\" => [\"F\", \"H\", \"V\", \"W\", \"Y\"],\n \"5\" => [\"K\"],\n \"8\" => [\"J\", \"X\"],\n \"10\" => [\"Q\", \"Z\"]\n }\n \n split_word = word.split('')\n split_word = split_word.map {|letter| letter.upcase}\n \n sum = 0\n points = 0\n # Get value/point of each letter and add it all together in 'sum'\n split_word.each do |letter|\n score_chart.each do | key, value|\n if value.include?(letter)\n points = key.to_i\n end\n end\n \n sum += points\n \n end\n \n # If length o fthe word is 7, 8, 9 or 10, then the word gets an additional 8 points\n if split_word.length > 6\n sum += 8\n end\n return sum\nend", "title": "" }, { "docid": "a09a3eebf74e27cdded03af1312bab45", "score": "0.5906121", "text": "def is_matchsuitable_forscore?\r\n tot_segni = 0\r\n @segni_curr_match.each_value{|v| tot_segni += v }\r\n if tot_segni > 0 or @mano_count > 3\r\n return true\r\n end\r\n return false\r\n end", "title": "" }, { "docid": "1177e9a170a8418a21975b6b018242b1", "score": "0.5898261", "text": "def update_game game\n if game[:score] =~ /w\\/o/i\n game[:is_walk_over] = true\n return\n end\n\n if game[:score] =~ /ret/i\n game[:not_finished] = true\n end\n\n scores = game[:score].gsub(/[^\\d -]/, '').split ' '\n sets = scores.map{|score| translate_score_to_set score}\n # game[:sets] = sets\n game[:score] = game[:score].gsub(/76(\\d+)/, '76(\\1)').gsub(/67(\\d+)/, '67(\\1)')\n\n sets_won = sets.count{|set| set[:is_winner] }\n sets_lost = sets.count - sets_won\n max = [sets_won, sets_lost].max\n if max == 2\n game[:format] = 'best-of-three'\n elsif max == 3\n game[:format] = 'best-of-five'\n else\n game[:format] = 'other'\n end\n\n # Tiebreaks\n won_tiebreaks = sets.count{|set| set[:is_winner] && set[:is_tiebreak]}\n if won_tiebreaks > 0\n game[:won_tiebreaks] = won_tiebreaks\n end\n lost_tiebreaks = sets.count{|set| !set[:is_winner] && set[:is_tiebreak]}\n if lost_tiebreaks > 0\n game[:lost_tiebreaks] = lost_tiebreaks\n end\n\n # Bagels\n won_bagels = sets.count{|set| set[:is_winner] && set[:is_bagel]}\n if won_bagels > 0\n game[:won_bagels] = won_bagels\n end\n lost_bagels = sets.count{|set| !set[:is_winner] && set[:is_bagel]}\n if lost_bagels > 0\n game[:lost_bagels] = lost_bagels\n end\nend", "title": "" }, { "docid": "ec5b7774ed2dba17fd8b638f533dcce3", "score": "0.5897819", "text": "def score()\n\t\tif self.score_1.blank?\n\t\t\tif self.score_2.blank?\n\t\t\t\treturn 0\n\t\t\telse \n\t\t\t\treturn score_2\n\t\t\tend\n\t\telse\n\t\t\tif self.score_2.blank?\n\t\t\t\treturn score_1\n\t\t\telse \n\t\t\t\treturn (score_2 + score_1) / 2\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "0d0ae70b57467dbca3fb1c5bd5542b8b", "score": "0.58976376", "text": "def grader(score)\r\n # TODO: complete me\r\n if score > 1 || score < 0.6\r\n \"F\"\r\n elsif score < 0.7\r\n \"D\"\r\n elsif score < 0.8\r\n \"C\"\r\n elsif score < 0.9\r\n \"B\"\r\n else\r\n \"A\"\r\n end\r\nend", "title": "" }, { "docid": "e27f2e8282c9666696981537b15f6416", "score": "0.5895751", "text": "def cheat\n if !@is_cheated and @score >= 100\n @score -= 100\n @is_cheated = true\n end\n end", "title": "" }, { "docid": "db8e780981ebef715b302f48b4070cb4", "score": "0.5889099", "text": "def score_standard\n\t\t@total_score += @roll + @next_roll\n\t\t@current_roll += 2\n\tend", "title": "" }, { "docid": "18f6c56d0bbf4c890634573e7c402081", "score": "0.588617", "text": "def single_score(face)\n points = { 1 => 100, 5 => 50 }\n points[face] || 0\n end", "title": "" }, { "docid": "4663c68c6e8cce690cde5b37903072c6", "score": "0.58849406", "text": "def calculate_score!\n highest_possible_score = 0\n actual_score = 0\n self.criteria_responses.each{|cr|\n if cr.score\n highest_possible_score += 10 * cr.criteria.weight\n actual_score += cr.score * cr.criteria.weight\n end\n }\n self.score = (highest_possible_score == 0) ? 0 : (actual_score * 100) / highest_possible_score\n \n ## check for initial_score\n if self.score == 0 && self.initial_score.to_i > 0\n self.score = self.initial_score.to_i\n end\n end", "title": "" }, { "docid": "831ac54bd0a7bb9032723816360cda85", "score": "0.5883347", "text": "def score\n 3*@tally + 5*@strength + 2*@wealth + @food + 30*@monsters_killed\n end", "title": "" }, { "docid": "f8534dfcc301654861f14206fd07f2b6", "score": "0.5882388", "text": "def try_cheat\n if !cheated? && @score >= 100\n @score -= 100\n @cheated = true\n end\n end", "title": "" } ]
b3d4043e068d832cd69f68ba49f301bb
Returns all payments from the system that the user has access to
[ { "docid": "23e9746ac7d271b629ea10708ffe740d", "score": "0.0", "text": "def get_payments(opts = {})\n data, _status_code, _headers = get_payments_with_http_info(opts)\n return data\n end", "title": "" } ]
[ { "docid": "5616caa5d8287e369bc051502720c0ac", "score": "0.78880185", "text": "def index\n @payments = current_user.payments\n end", "title": "" }, { "docid": "0c6d2cabae214a4fa53deed440ddf015", "score": "0.7845758", "text": "def index\n @payments = Payment.where(user_id: current_user.id)\n end", "title": "" }, { "docid": "7357200dc54ab955ec4ced9f461325e6", "score": "0.7785182", "text": "def index\n if current_user.is_admin?\n @payments = Payment.all\n else\n @payments = Payment.where(:user => current_user)\n end\n end", "title": "" }, { "docid": "64465651022d07dfe82005c89d193e8c", "score": "0.77255756", "text": "def get_payments\n response = self.class.get('/payments', headers: authorization_header)\n response.parsed_response['payments']\n end", "title": "" }, { "docid": "37829af5a5cb69e7d80d19378f6b8806", "score": "0.74557316", "text": "def index\n @payer_payments = Payment.for_payer(current_user.id).chronological.all\n @payee_payments = Payment.for_payee(current_user.id).chronological.all\n end", "title": "" }, { "docid": "481c9fcb4cd29ebd951992aa1c6d11ed", "score": "0.7397881", "text": "def payments\n reset_errors!\n \n response = Http.get(\"/invoices/#{uuid}/payments/\", domain.token)\n \n return [] if response.code != 200\n \n MultiJson.decode(response.body)\n end", "title": "" }, { "docid": "a7ebed16b385a9f86f2ccc0178013f50", "score": "0.73571944", "text": "def index\n @payments = current_user.payments.ordered\n end", "title": "" }, { "docid": "faee214e11440cd79546b5ad74cd7ab7", "score": "0.7344948", "text": "def payments\n Breeze::Commerce::Payment.where(:reference => id)\n end", "title": "" }, { "docid": "54aec559ffcb4f4082e8c166a571d7d7", "score": "0.7217977", "text": "def index\n page = params[:page] || 1\n @payments = Payment.payments_of_user(current_user).page page\n end", "title": "" }, { "docid": "04dd177d926db292319316930ede1c76", "score": "0.72155124", "text": "def index\n if admin_signed_in?\n @payments = @payments.paginate(:page => params[:page], :per_page => 12)\n else\n @payments = current_user.payments.order(updated_at: :desc).paginate(:page => params[:page], :per_page => 12)\n end\n end", "title": "" }, { "docid": "116174ac3695749019b0baea65cca913", "score": "0.7210449", "text": "def payments\n expose Member.payments(@oauth_token, params[:membername], payments_fields, payments_order_by)\n end", "title": "" }, { "docid": "0af1607279f22388e82967ab93977644", "score": "0.71075356", "text": "def index\n @payment_users = PaymentUser.all\n end", "title": "" }, { "docid": "f5667b4b0be8e158362db794fb6b2d4d", "score": "0.7101429", "text": "def index\n @user_payment_methods = UserPaymentMethod.all\n end", "title": "" }, { "docid": "3866e33a9b4fbc9b619d67e110b0eabc", "score": "0.70999473", "text": "def users_payments\n @payments = Payment.where(\"user_id = ?\", current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @payments }\n end\n end", "title": "" }, { "docid": "54b7a7bf38c3c6c5ed2ad2d4e918845f", "score": "0.7083609", "text": "def index\n @payments = current_login.payments\n\n end", "title": "" }, { "docid": "54b7a7bf38c3c6c5ed2ad2d4e918845f", "score": "0.7083609", "text": "def index\n @payments = current_login.payments\n\n end", "title": "" }, { "docid": "08a945ab45cf46d2a40ef7c74e0b81df", "score": "0.7048706", "text": "def index\n @pay_methods = PayMethod.where(:customer_id => session[:user_id], active_record: true)\n end", "title": "" }, { "docid": "eba8dedc382edc2b4d2c0683e491362f", "score": "0.70018697", "text": "def index\n @financial_objects_payment_methods = FinancialObjects::PaymentMethod.where(wallet_id: current_user.wallet_id)\n end", "title": "" }, { "docid": "099fa9f3d8b5b694949bb673598f0152", "score": "0.6980829", "text": "def payments\n @payments ||= parse_params_into_payments\n end", "title": "" }, { "docid": "e1f3652da092f9bcf521deae403de193", "score": "0.6966934", "text": "def index\n\t\t@payment_types = PaymentType.where(:user_id => session[:user_id])\n\tend", "title": "" }, { "docid": "0c24222db43fd0f8d7dab1c85fc59234", "score": "0.6939205", "text": "def payments\n financial_transactions\n end", "title": "" }, { "docid": "342d9b74af1dfac33f6da480cdc6154a", "score": "0.6934874", "text": "def receivedPayments\n months = current_user.subscriptionType * 12 #months\n user_house_contract = UserHouseContract.find(params[:id])\n @payments = Payment.where(:created_at => months.months.ago..Time.now, :user_house_contract => user_house_contract, :active => true).order(payment_date: :desc)\n end", "title": "" }, { "docid": "f950463077b4429d4df55f01f8eeb076", "score": "0.6929086", "text": "def index\n @method_payments = MethodPayment.all\n end", "title": "" }, { "docid": "e4386f45e63fd277454314d6d0137119", "score": "0.692669", "text": "def index\n @payments = Payment.all\n end", "title": "" }, { "docid": "e4386f45e63fd277454314d6d0137119", "score": "0.692669", "text": "def index\n @payments = Payment.all\n end", "title": "" }, { "docid": "e4386f45e63fd277454314d6d0137119", "score": "0.692669", "text": "def index\n @payments = Payment.all\n end", "title": "" }, { "docid": "e4386f45e63fd277454314d6d0137119", "score": "0.692669", "text": "def index\n @payments = Payment.all\n end", "title": "" }, { "docid": "e4386f45e63fd277454314d6d0137119", "score": "0.692669", "text": "def index\n @payments = Payment.all\n end", "title": "" }, { "docid": "e4386f45e63fd277454314d6d0137119", "score": "0.692669", "text": "def index\n @payments = Payment.all\n end", "title": "" }, { "docid": "e4386f45e63fd277454314d6d0137119", "score": "0.692669", "text": "def index\n @payments = Payment.all\n end", "title": "" }, { "docid": "e4386f45e63fd277454314d6d0137119", "score": "0.692669", "text": "def index\n @payments = Payment.all\n end", "title": "" }, { "docid": "e4386f45e63fd277454314d6d0137119", "score": "0.692669", "text": "def index\n @payments = Payment.all\n end", "title": "" }, { "docid": "e4386f45e63fd277454314d6d0137119", "score": "0.692669", "text": "def index\n @payments = Payment.all\n end", "title": "" }, { "docid": "e4386f45e63fd277454314d6d0137119", "score": "0.692669", "text": "def index\n @payments = Payment.all\n end", "title": "" }, { "docid": "e4386f45e63fd277454314d6d0137119", "score": "0.692669", "text": "def index\n @payments = Payment.all\n end", "title": "" }, { "docid": "e4386f45e63fd277454314d6d0137119", "score": "0.692669", "text": "def index\n @payments = Payment.all\n end", "title": "" }, { "docid": "e4386f45e63fd277454314d6d0137119", "score": "0.692669", "text": "def index\n @payments = Payment.all\n end", "title": "" }, { "docid": "e4386f45e63fd277454314d6d0137119", "score": "0.692669", "text": "def index\n @payments = Payment.all\n end", "title": "" }, { "docid": "e4386f45e63fd277454314d6d0137119", "score": "0.692669", "text": "def index\n @payments = Payment.all\n end", "title": "" }, { "docid": "e4386f45e63fd277454314d6d0137119", "score": "0.692669", "text": "def index\n @payments = Payment.all\n end", "title": "" }, { "docid": "e4386f45e63fd277454314d6d0137119", "score": "0.692669", "text": "def index\n @payments = Payment.all\n end", "title": "" }, { "docid": "e4386f45e63fd277454314d6d0137119", "score": "0.692669", "text": "def index\n @payments = Payment.all\n end", "title": "" }, { "docid": "e4386f45e63fd277454314d6d0137119", "score": "0.692669", "text": "def index\n @payments = Payment.all\n end", "title": "" }, { "docid": "e4386f45e63fd277454314d6d0137119", "score": "0.692669", "text": "def index\n @payments = Payment.all\n end", "title": "" }, { "docid": "e4386f45e63fd277454314d6d0137119", "score": "0.692669", "text": "def index\n @payments = Payment.all\n end", "title": "" }, { "docid": "e4386f45e63fd277454314d6d0137119", "score": "0.692669", "text": "def index\n @payments = Payment.all\n end", "title": "" }, { "docid": "e4386f45e63fd277454314d6d0137119", "score": "0.692669", "text": "def index\n @payments = Payment.all\n end", "title": "" }, { "docid": "e4386f45e63fd277454314d6d0137119", "score": "0.692669", "text": "def index\n @payments = Payment.all\n end", "title": "" }, { "docid": "e4386f45e63fd277454314d6d0137119", "score": "0.692669", "text": "def index\n @payments = Payment.all\n end", "title": "" }, { "docid": "e4386f45e63fd277454314d6d0137119", "score": "0.692669", "text": "def index\n @payments = Payment.all\n end", "title": "" }, { "docid": "e4386f45e63fd277454314d6d0137119", "score": "0.692669", "text": "def index\n @payments = Payment.all\n end", "title": "" }, { "docid": "e4386f45e63fd277454314d6d0137119", "score": "0.692669", "text": "def index\n @payments = Payment.all\n end", "title": "" }, { "docid": "e4386f45e63fd277454314d6d0137119", "score": "0.692669", "text": "def index\n @payments = Payment.all\n end", "title": "" }, { "docid": "69372bbf25a8f3ad4522e172851dd5d7", "score": "0.6908559", "text": "def index\n @payments = current_user.payments.find(:all, :order => \"created_at desc\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @payments }\n end\n end", "title": "" }, { "docid": "58b873f0a466c7c3e28e6cafeb557283", "score": "0.68757963", "text": "def index\n @payments = current_user.payments(:joins => [ :cart, :receipt] , :order => \"paid_at DESC\") \n end", "title": "" }, { "docid": "584cd0a723a15ad34e999620a0343e8a", "score": "0.6842995", "text": "def index\n @payments = Payment.all\n \n end", "title": "" }, { "docid": "b65567ede2979188600ff739f8c51632", "score": "0.6838689", "text": "def index\n @account_payments = AccountPayment.all\n end", "title": "" }, { "docid": "0094a81a90ff19357b6b5f22b7249640", "score": "0.6742279", "text": "def index\n\n @payments_all = Payment.all\n @payments_current = current_user.payments\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @payments_all }\n format.json { render json: @payments_current }\n end\n end", "title": "" }, { "docid": "dbc83f4ba856a9c07601f7b359ee2fa6", "score": "0.67284006", "text": "def index\n if user_signed_in?\n if current_user.admin == true\n @payments = Payment.all\n end\n if current_user.admin == false\n @payments = Payment.where(:reference_code => current_user.content_code)\n\t@clientpayments = Payment.where(:client_code => current_user.client_code)\n\tend\n\tend\n end", "title": "" }, { "docid": "01980e46f748237f44be703ea67ac307", "score": "0.67107433", "text": "def index\n @user_payments = @user.user_payments.order(created_at: :desc)\n end", "title": "" }, { "docid": "d4941f7c9f8f5ac78b6654898c7b8e5a", "score": "0.6696043", "text": "def index\n @payments = Payment.joins(:account,:status).where(accounts: {customer_id:session[:id]}).\n page(params[:page])\n end", "title": "" }, { "docid": "01a296a649109c339c64b96808593fab", "score": "0.6695642", "text": "def index\n @payments = @store.payments\n end", "title": "" }, { "docid": "2ead98dc253031d3ae7edec38abb8043", "score": "0.66797227", "text": "def payments( params={} )\n payments = get_connections(\"payments\", params)\n return map_connections payments, :to => Facebook::Graph::Payment\n end", "title": "" }, { "docid": "42b6e9c37b6e589695542286d684da54", "score": "0.66575176", "text": "def index\n @payments = Payment.find_all_by_user_id(current_user.id).paginate(:page =>params[:page], :per_page => 9)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @payments }\n end\n end", "title": "" }, { "docid": "9486ae423791b5ab865e6bd92d782791", "score": "0.6651129", "text": "def index\n @invoice_payments = InvoicePayment.all\n end", "title": "" }, { "docid": "689b9ca9f4db22a6dd61093fc6d5ed6f", "score": "0.66319615", "text": "def index\n @user_pays = UserPay.all\n end", "title": "" }, { "docid": "2181e3a84071626b5d34f23b52909291", "score": "0.6616708", "text": "def index\n @payments = current_user.payments\n @payment_methods = current_user.payment_methods\n \n if @payments.size > 0\n @payment = @payments.first\n @user = User.find(@payment.user_id)\n @subscription = Subscription.find(@payment.subscription_id)\n @location = @subscription.location \n end\n end", "title": "" }, { "docid": "47692d87a2f805cb2e0097b23cdb0956", "score": "0.6585472", "text": "def show\n @payments = @order.payments.to_a\n end", "title": "" }, { "docid": "a1a9e9087c4a1b3d96fde6fd80366ce3", "score": "0.6573773", "text": "def payments\n @payments ||= PaymentsApi.new @global_configuration\n end", "title": "" }, { "docid": "e20b41c0225caa520ba0f11cf37c2b5a", "score": "0.65657574", "text": "def payments_for_affiliate\n @title = \"Payments made to #{@affiliate.name}\"\n @payments = @affiliate.payments.find(:all, :order => \"id DESC\")\n end", "title": "" }, { "docid": "001514185936e504df2c0a84815fe0d0", "score": "0.6562625", "text": "def payments(options = {})\n # /api/en/v1.0/:token/payments\n response = get('payments', options)\n log_and_map(response).parsed_response['data']\n .map { |d| Hashie::Mash.new(d) }\n end", "title": "" }, { "docid": "8fd79bade848b1bdb38c4d5f41a0c5c7", "score": "0.6558798", "text": "def show\n\t\t@payment_types = PaymentType.where(:user_id => session[:user_id])\n\tend", "title": "" }, { "docid": "ff68771658ac9c9523a92379b0c682a7", "score": "0.6557174", "text": "def payments_paid_by(housemate)\n housemate_payments = self.payments.where(mate_id: housemate.id)\n end", "title": "" }, { "docid": "492ed4bcdd52c3ec01eb92b6a7b93c68", "score": "0.655636", "text": "def payments(options={})\n # /api/en/v1.0/:token/payments\n response = TheCurrencyCloud.get(\"/#{token}/payments\",query: options)\n response.parsed_response['data'].collect{|d| Payment.new(d)}\n end", "title": "" }, { "docid": "b1c5f58ca6767dd39230110d403d36dd", "score": "0.65502673", "text": "def payments\n @payments ||= Services::PaymentsService.new(@api_service)\n end", "title": "" }, { "docid": "2683a2472e91abfaffd13da3c3c7973f", "score": "0.6544546", "text": "def payments\n @payments ||= PaymentsApi.new config\n end", "title": "" }, { "docid": "33047fe666718eddd37d81f8adc5df64", "score": "0.6522039", "text": "def index\n @customer_payments = CustomerPayment.all\n end", "title": "" }, { "docid": "4b27695c23dabb9563da4f3ae53d5771", "score": "0.650544", "text": "def payments\n if params[\"form_payment\"]\n results = Members.update(current_access_token, @current_user.username, params[\"form_payment\"])\n #check for errors!!\n if results[\"Success\"].eql?('false')\n flash.now[:error] = results[\"Message\"]\n else\n flash.now[:notice] = \"Your payment information has been updated.\"\n end\n end\n # get the member's id for docusign\n member = Members.find_by_username(current_access_token, @current_user.username, 'id').first\n @memberId = member['Id']\n @payments = Payments.all(current_access_token, :select => 'id,name,challenge__r.name,challenge__r.challenge_id__c,money__c,place__c,reason__c,status__c,type__c,Reference_Number__c,payment_sent__c', :where => current_user.username)\n @payments.each do |record| \n if record['Status__c'].eql?('Paid')\n @show_paid_section = true\n else \n @show_outstanding_section = true\n end\n end\n @page_title = \"Your Payments and Payment Info\"\n get_account\n respond_to do |format|\n format.html\n format.json { render :json => @payments }\n end\n end", "title": "" }, { "docid": "32b3f8d84320803fda60968d3656872b", "score": "0.64973325", "text": "def get_list_payments_methods\n PaymentMethod.get_list_payment_methods\n end", "title": "" }, { "docid": "6c74ccdbee87f68f60ac6001b16b44a9", "score": "0.64922774", "text": "def payments(options = {})\n status = options[:status] || \"all\"\n page = options[:page] || 1\n\n uri = \"payments/status/#{status}?page=#{page}\"\n\n pay_get(uri)\n end", "title": "" }, { "docid": "38f98b63a5b8923bbe072662921c7242", "score": "0.64646024", "text": "def payments\n Services::PaymentsService.new(@api_service)\n end", "title": "" }, { "docid": "5e7bc3f7a5b63e11411ab0771b284c24", "score": "0.6462951", "text": "def index\n @bill_payments = BillPayment.all\n end", "title": "" }, { "docid": "8f140fbd47dab12fdb317570d18e14e9", "score": "0.64556867", "text": "def payments\n end", "title": "" }, { "docid": "1816af9d6e9edcfabc658c9bac7b1db9", "score": "0.64495695", "text": "def index\n @subscription_payments = SubscriptionPayment.all\n end", "title": "" }, { "docid": "63d8d67c9131422afa9ecd754cbe023f", "score": "0.64391047", "text": "def index\n @means_payments = MeansPayment.all\n end", "title": "" }, { "docid": "24da424d2d4ac81f64a0c4301b66407b", "score": "0.6434961", "text": "def index\n @bank_payments = BankPayment.all\n end", "title": "" }, { "docid": "1db15400d86eba0dd8cf111d272c8a29", "score": "0.6427045", "text": "def index\n @paymentmanagements = Paymentmanagement.all\n end", "title": "" }, { "docid": "3e181933313ac039adb61521c3831a33", "score": "0.6418472", "text": "def index\n @spree_my_pays = Spree::MyPay.all\n end", "title": "" }, { "docid": "6c590a3475b73b1927d52fdb709e791a", "score": "0.64000714", "text": "def index\n @stripe_payouts = current_user.stripe_payouts\n end", "title": "" }, { "docid": "2a96e89a38eb16262f12f7fe1067615d", "score": "0.6398761", "text": "def show\n @payments = Payment.where(member_id: @member.id)\n end", "title": "" }, { "docid": "e9ec438729692dc904fb52f2a2c3ec7e", "score": "0.63943464", "text": "def index\n @paymments = Paymment.all\n end", "title": "" }, { "docid": "775bd97d814cd38cce3acce6c594b325", "score": "0.6393813", "text": "def index\n @usr_buyer_payment_methods = UsrBuyerPaymentMethod.all\n end", "title": "" }, { "docid": "5beb681eaf35c19543f3f64e28ee70c6", "score": "0.6390223", "text": "def index\n @payment_infos = PaymentInfo.all\n end", "title": "" }, { "docid": "b60c1058eec92bae2a40aa9d822219a8", "score": "0.6371869", "text": "def payments(options = {})\n status = options[:status] || \"all\"\n page = options[:page] || 1\n\n uri = \"payments/status/#{status}?page=#{page}\"\n\n _get(uri)\n end", "title": "" }, { "docid": "41e4ccae03df91e73a3a467c6cd680b5", "score": "0.63602394", "text": "def index\n @payment_audits = PaymentAudit.all\n end", "title": "" }, { "docid": "b45120c991677fa804dc3b8c373dee26", "score": "0.6356034", "text": "def index\n @payment_transferences = Payment::Transference.all\n end", "title": "" }, { "docid": "569b8cb3edf3ffa5423ffe514e78b880", "score": "0.63522655", "text": "def index\n @payment_manager = PaymentManager.all\n end", "title": "" }, { "docid": "3781f3be9cc188f40ba3ce5ff841f460", "score": "0.63487476", "text": "def payments\n payments ||= lambda {\n obj = Payments.new\n obj.account = self\n obj\n }.call\n end", "title": "" }, { "docid": "b64759b43a3bcfd17e8f4707bd08c7c1", "score": "0.6347192", "text": "def index\n @expense_payments = @expense.expense_payments.all\n end", "title": "" }, { "docid": "4404291ac0e56cc6ec367ff3da161dfa", "score": "0.63439703", "text": "def index\n @payment_reqs = PaymentReq.all\n end", "title": "" }, { "docid": "02ad48506130de61b6275ecb8ce09d05", "score": "0.63220006", "text": "def index\n @personal_in_charges = PersonalInCharge.all\n end", "title": "" } ]
2f6b014e1a12494e0046aeb333663509
Convert a field_predicate (field_op format), a value and a SQL field name using the set of predicates, to something convertible to a Sequel expression. field_predicate:: is a key from the parameter hash. Usually name_pred, eg birth_year_gt value:: is the value from the parameter hash. Could be a collection. field:: is the name of the SQL field to use, or nil where it would default to key without its predicate.
[ { "docid": "1083789c1dbeb9c53fe937d22ed9ae74", "score": "0.68094826", "text": "def define_name_predicate( field_predicate, value, field = nil )\n splitter = PredicateSplitter.new field_predicate, value\n\n # the default / else / fall-through is just an equality\n default_proc = ->{:eq}\n\n # find a better predicate, if there is one\n suffix = predicate_names.find default_proc do |suffix|\n splitter =~ suffix\n end\n\n # wrap the field name first, to infect the expressions so all the\n # operators work.\n field_name = Sequel.expr(field || splitter.field)\n\n define_singleton_method field_predicate do |value|\n send suffix, field_name, value\n end\n end", "title": "" } ]
[ { "docid": "3e30cb73096d5e90fd7972c2f10a5e78", "score": "0.70152456", "text": "def call( field_predicate, value, field = nil )\n unless respond_to? field_predicate\n define_name_predicate field_predicate, value, field\n end\n send field_predicate, value\n end", "title": "" }, { "docid": "9b873121499f22e41c1929b16954f068", "score": "0.67794216", "text": "def to_expr( key, value, field = nil )\n Sequel.expr( predicates[key, value, field] )\n end", "title": "" }, { "docid": "a9ee69d2b69c18b1f5ef2149059d664e", "score": "0.6603385", "text": "def expr_for( predicate, field = nil )\n unless (value = valued_parameters[predicate]).blank?\n to_expr( predicate, value, field )\n end\n end", "title": "" }, { "docid": "061130d7e6fc588878c7d35c027d924e", "score": "0.6488141", "text": "def sql_for_field(field, operator, value, db_table, db_field)\n sql = ''\n case operator\n when \"=\"\n if value.any?\n case type_for(field)\n when :date, :date_past\n sql = date_clause(db_table, db_field, parse_date(value.first), parse_date(value.first))\n when :integer\n sql = \"#{db_table}.#{db_field} = #{value.first.to_i}\"\n when :float\n sql = \"#{db_table}.#{db_field} BETWEEN #{value.first.to_f - 1e-5} AND #{value.first.to_f + 1e-5}\"\n else\n sql = \"#{db_table}.#{db_field} IN (\" + value.collect{|val| \"'#{@filters_for_class.connection.quote_string(val)}'\"}.join(\",\") + \")\"\n end\n else\n # IN an empty set\n sql = \"1=0\"\n end\n when \"!\"\n if value.any?\n sql = \"(#{db_table}.#{db_field} IS NULL OR #{db_table}.#{db_field} NOT IN (\" + value.collect{|val| \"'#{@filters_for_class.connection.quote_string(val)}'\"}.join(\",\") + \"))\"\n else\n # NOT IN an empty set\n sql = \"1=1\"\n end\n when \"!*\"\n sql = \"#{db_table}.#{db_field} IS NULL\"\n when \"*\"\n sql = \"#{db_table}.#{db_field} IS NOT NULL\"\n when \">=\"\n if [:date, :date_past].include?(type_for(field))\n sql = date_clause(db_table, db_field, parse_date(value.first), nil)\n else\n sql = \"#{db_table}.#{db_field} >= #{value.first.to_f}\"\n end\n when \"<=\"\n if [:date, :date_past].include?(type_for(field))\n sql = date_clause(db_table, db_field, nil, parse_date(value.first))\n else\n sql = \"#{db_table}.#{db_field} <= #{value.first.to_f}\"\n end\n when \"><\"\n if [:date, :date_past].include?(type_for(field))\n sql = date_clause(db_table, db_field, parse_date(value[0]), parse_date(value[1]))\n else\n sql = \"#{db_table}.#{db_field} BETWEEN #{value[0].to_f} AND #{value[1].to_f}\"\n end\n when \"><t-\"\n # between today - n days and today\n sql = relative_date_clause(db_table, db_field, - value.first.to_i, 0)\n when \">t-\"\n # >= today - n days\n sql = relative_date_clause(db_table, db_field, - value.first.to_i, nil)\n when \"<t-\"\n # <= today - n days\n sql = relative_date_clause(db_table, db_field, nil, - value.first.to_i)\n when \"t-\"\n # = n days in past\n sql = relative_date_clause(db_table, db_field, - value.first.to_i, - value.first.to_i)\n when \"><t+\"\n # between today and today + n days\n sql = relative_date_clause(db_table, db_field, 0, value.first.to_i)\n when \">t+\"\n # >= today + n days\n sql = relative_date_clause(db_table, db_field, value.first.to_i, nil)\n when \"<t+\"\n # <= today + n days\n sql = relative_date_clause(db_table, db_field, nil, value.first.to_i)\n when \"t+\"\n # = today + n days\n sql = relative_date_clause(db_table, db_field, value.first.to_i, value.first.to_i)\n when \"t\"\n # = today\n sql = relative_date_clause(db_table, db_field, 0, 0)\n when \"ld\"\n # = yesterday\n sql = relative_date_clause(db_table, db_field, -1, -1)\n when \"w\"\n # = this week\n first_day_of_week = l(:general_first_day_of_week).to_i\n day_of_week = Date.today.cwday\n days_ago = (day_of_week >= first_day_of_week ? day_of_week - first_day_of_week : day_of_week + 7 - first_day_of_week)\n sql = relative_date_clause(db_table, db_field, - days_ago, - days_ago + 6)\n when \"lw\"\n # = last week\n first_day_of_week = l(:general_first_day_of_week).to_i\n day_of_week = Date.today.cwday\n days_ago = (day_of_week >= first_day_of_week ? day_of_week - first_day_of_week : day_of_week + 7 - first_day_of_week)\n sql = relative_date_clause(db_table, db_field, - days_ago - 7, - days_ago - 1)\n when \"l2w\"\n # = last 2 weeks\n first_day_of_week = l(:general_first_day_of_week).to_i\n day_of_week = Date.today.cwday\n days_ago = (day_of_week >= first_day_of_week ? day_of_week - first_day_of_week : day_of_week + 7 - first_day_of_week)\n sql = relative_date_clause(db_table, db_field, - days_ago - 14, - days_ago - 1)\n when \"m\"\n # = this month\n date = Date.today\n sql = date_clause(db_table, db_field, date.beginning_of_month, date.end_of_month)\n when \"lm\"\n # = last month\n date = Date.today.prev_month\n sql = date_clause(db_table, db_field, date.beginning_of_month, date.end_of_month)\n when \"y\"\n # = this year\n date = Date.today\n sql = date_clause(db_table, db_field, date.beginning_of_year, date.end_of_year)\n when \"~\"\n sql = \"LOWER(#{db_table}.#{db_field}) LIKE '%#{@filters_for_class.connection.quote_string(value.first.to_s.downcase)}%'\"\n when \"!~\"\n sql = \"LOWER(#{db_table}.#{db_field}) NOT LIKE '%#{@filters_for_class.connection.quote_string(value.first.to_s.downcase)}%'\"\n else\n raise \"Unknown query operator #{operator}\"\n end\n\n return sql\n end", "title": "" }, { "docid": "0405f7d7e27a90b1eae79f74ded4ad36", "score": "0.63970196", "text": "def sql_for_field(field, operator, value, db_table, db_field, is_custom_filter=false)\n sql = ''\n resolved = \"select journalized_id from journals where id in (select journal_id from journal_details where value in (select id from issue_statuses where name = 'resolved' and prop_key='status_id'))\"\n case operator\n when \"=\"\n\n if value.any?\n case type_for(field)\n when :date, :date_past\n sql = date_clause(db_table, db_field, parse_date(value.first), parse_date(value.first))\n when :integer\n if is_custom_filter\n sql = \"(#{db_table}.#{db_field} <> '' AND CAST(CASE #{db_table}.#{db_field} WHEN '' THEN '0' ELSE #{db_table}.#{db_field} END AS decimal(30,3)) = #{value.first.to_i})\"\n else\n sql = \"#{db_table}.#{db_field} = #{value.first.to_i}\"\n end\n when :float\n if is_custom_filter\n sql = \"(#{db_table}.#{db_field} <> '' AND CAST(CASE #{db_table}.#{db_field} WHEN '' THEN '0' ELSE #{db_table}.#{db_field} END AS decimal(30,3)) BETWEEN #{value.first.to_f - 1e-5} AND #{value.first.to_f + 1e-5})\"\n else\n sql = \"#{db_table}.#{db_field} BETWEEN #{value.first.to_f - 1e-5} AND #{value.first.to_f + 1e-5}\"\n end\n else\n if db_field == 'resolved_by'\n sql = \"#{db_table}.id IN (select issue_id from issue_details where resolved_by=('#{value.join(',')}'))\"\n #sql = User.current.admin? ? sql : \"\" \n elsif db_field == 'approved_by'\n value = User.current.admin? ? value : [] << User.current.id\n sql = \"#{db_table}.id IN (select issue_id from ticket_approval_flows where status='approved' and user_id=('#{value.join(',')}'))\"\n elsif db_field == 'requested_project'\n # sql = \"#{db_table}.id IN (select issue_id from issue_ticket_tags where inia_project_id =('#{value.join(',')}'))\"\n issues = IssueTicketTag.where(:inia_project_id => value ).map(&:issue_id).join(',') rescue ''\n sql = issues.present? ? \"#{db_table}.id IN (#{issues})\" : \"#{db_table}.id IN ('')\"\n elsif db_field == 'requested_category'\n # p Issue.joins(:issue_ticket_tag).joins(:ticket_tag).where(\"ticket_tags.category_id in (?)\",value)\n category = (\"tt.category_id in (#{value.join(',')})\")\n p sql = \"#{db_table}.id IN (select i.id from issues i join issue_ticket_tags it on it.issue_id = i.id\n join ticket_tags tt on tt.id = it.ticket_tag_id where #{category} )\"\n else\n sql = \"#{db_table}.#{db_field} IN (\" + value.collect{|val| \"'#{connection.quote_string(val)}'\"}.join(\",\") + \")\"\n end\n end\n else\n # IN an empty set\n sql = \"1=0\"\n end\n when \"!\"\n if db_field == 'resolved_by' #&& User.current.admin?\n sql = \"#{db_table}.id IS NULL OR #{db_table}.id IN (select issue_id from issue_details where resolved_by!='' and resolved_by!=('#{value.join(',')}'))\"\n elsif db_field == 'approved_by' #&& User.current.admin?\n value = User.current.admin? ? value : [] << User.current.id\n sql = \"#{db_table}.id IS NULL OR #{db_table}.id IN (select issue_id from ticket_approval_flows where status='Approved' and issue_id not in (select issue_id from ticket_approval_flows where status='approved' and user_id=('#{value.join(',')}')))\"\n elsif db_field == 'requested_project'\n issues = IssueTicketTag.where('inia_project_id not in (?)', value ).map(&:issue_id).join(',') rescue ''\n sql = issues.present? ? \"#{db_table}.id IN (#{issues})\" : \"#{db_table}.id IN ('')\"\n elsif db_field == 'requested_category'\n category = (\"tt.category_id not in (#{value.join(',')})\")\n p sql = \"#{db_table}.id IN (select i.id from issues i join issue_ticket_tags it on it.issue_id = i.id\n join ticket_tags tt on tt.id = it.ticket_tag_id where #{category} )\"\n elsif value.any?\n sql = \"(#{db_table}.#{db_field} IS NULL OR #{db_table}.#{db_field} NOT IN (\" + value.collect{|val| \"'#{connection.quote_string(val)}'\"}.join(\",\") + \"))\"\n else\n # NOT IN an empty set\n sql = \"1=1\"\n end\n when \"!*\"\n if db_field == 'resolved_by' && User.current.admin?\n sql = \"#{db_table}.id IS NULL\"\n sql << \" OR #{db_table}.id = ''\" if is_custom_filter\n elsif db_field == 'approved_by' && User.current.admin?\n value = User.current.admin? ? value : [] << User.current.id\n sql = \"#{db_table}.id IS NULL\"\n sql << \" OR #{db_table}.id = ''\" if is_custom_filter\n elsif db_field == 'requested_project'\n sql = \"#{db_table}.id IS NULL\"\n sql << \" OR #{db_table}.id = ''\" if is_custom_filter\n elsif db_field == 'requested_category'\n sql = \"#{db_table}.id IS NULL\"\n sql << \" OR #{db_table}.id = ''\" if is_custom_filter\n else\n sql = \"#{db_table}.#{db_field} IS NULL\"\n sql << \" OR #{db_table}.#{db_field} = ''\" if is_custom_filter\n end\n when \"*\"\n if db_field == 'resolved_by' && User.current.admin?\n sql = \"#{db_table}.id IS NOT NULL\"\n sql << \" OR #{db_table}.id = ''\" if is_custom_filter\n elsif db_field == 'approved_by' && User.current.admin?\n value = User.current.admin? ? value : [] << User.current.id\n sql = \"#{db_table}.id IS NOT NULL\"\n sql << \" OR #{db_table}.id = ''\" if is_custom_filter\n elsif db_field == 'requested_project'\n sql = \"#{db_table}.id IS NOT NULL\"\n sql << \" OR #{db_table}.id = ''\" if is_custom_filter\n elsif db_field == 'requested_category'\n sql = \"#{db_table}.id IS NOT NULL\"\n sql << \" OR #{db_table}.id = ''\" if is_custom_filter\n else\n sql = \"#{db_table}.#{db_field} IS NOT NULL\"\n sql << \" AND #{db_table}.#{db_field} <> ''\" if is_custom_filter\n end\n when \">=\"\n if [:date, :date_past].include?(type_for(field))\n sql = date_clause(db_table, db_field, parse_date(value.first), nil)\n else\n if is_custom_filter\n sql = \"(#{db_table}.#{db_field} <> '' AND CAST(CASE #{db_table}.#{db_field} WHEN '' THEN '0' ELSE #{db_table}.#{db_field} END AS decimal(30,3)) >= #{value.first.to_f})\"\n else\n sql = \"#{db_table}.#{db_field} >= #{value.first.to_f}\"\n end\n end\n when \"<=\"\n if [:date, :date_past].include?(type_for(field))\n sql = date_clause(db_table, db_field, nil, parse_date(value.first))\n else\n if is_custom_filter\n sql = \"(#{db_table}.#{db_field} <> '' AND CAST(CASE #{db_table}.#{db_field} WHEN '' THEN '0' ELSE #{db_table}.#{db_field} END AS decimal(30,3)) <= #{value.first.to_f})\"\n else\n sql = \"#{db_table}.#{db_field} <= #{value.first.to_f}\"\n end\n end\n when \"><\"\n if [:date, :date_past].include?(type_for(field))\n sql = date_clause(db_table, db_field, parse_date(value[0]), parse_date(value[1]))\n else\n if is_custom_filter\n sql = \"(#{db_table}.#{db_field} <> '' AND CAST(CASE #{db_table}.#{db_field} WHEN '' THEN '0' ELSE #{db_table}.#{db_field} END AS decimal(30,3)) BETWEEN #{value[0].to_f} AND #{value[1].to_f})\"\n else\n sql = \"#{db_table}.#{db_field} BETWEEN #{value[0].to_f} AND #{value[1].to_f}\"\n end\n end\n when \"o\"\n sql = \"#{queried_table_name}.status_id IN (SELECT id FROM #{IssueStatus.table_name} WHERE is_closed=#{connection.quoted_false})\" if field == \"status_id\"\n when \"c\"\n sql = \"#{queried_table_name}.status_id IN (SELECT id FROM #{IssueStatus.table_name} WHERE is_closed=#{connection.quoted_true})\" if field == \"status_id\"\n when \"><t-\"\n # between today - n days and today\n sql = relative_date_clause(db_table, db_field, - value.first.to_i, 0)\n when \">t-\"\n # >= today - n days\n sql = relative_date_clause(db_table, db_field, - value.first.to_i, nil)\n when \"<t-\"\n # <= today - n days\n sql = relative_date_clause(db_table, db_field, nil, - value.first.to_i)\n when \"t-\"\n # = n days in past\n sql = relative_date_clause(db_table, db_field, - value.first.to_i, - value.first.to_i)\n when \"><t+\"\n # between today and today + n days\n sql = relative_date_clause(db_table, db_field, 0, value.first.to_i)\n when \">t+\"\n # >= today + n days\n sql = relative_date_clause(db_table, db_field, value.first.to_i, nil)\n when \"<t+\"\n # <= today + n days\n sql = relative_date_clause(db_table, db_field, nil, value.first.to_i)\n when \"t+\"\n # = today + n days\n sql = relative_date_clause(db_table, db_field, value.first.to_i, value.first.to_i)\n when \"t\"\n # = today\n sql = relative_date_clause(db_table, db_field, 0, 0)\n when \"ld\"\n # = yesterday\n sql = relative_date_clause(db_table, db_field, -1, -1)\n when \"w\"\n # = this week\n first_day_of_week = l(:general_first_day_of_week).to_i\n day_of_week = Date.today.cwday\n days_ago = (day_of_week >= first_day_of_week ? day_of_week - first_day_of_week : day_of_week + 7 - first_day_of_week)\n sql = relative_date_clause(db_table, db_field, - days_ago, - days_ago + 6)\n when \"lw\"\n # = last week\n first_day_of_week = l(:general_first_day_of_week).to_i\n day_of_week = Date.today.cwday\n days_ago = (day_of_week >= first_day_of_week ? day_of_week - first_day_of_week : day_of_week + 7 - first_day_of_week)\n sql = relative_date_clause(db_table, db_field, - days_ago - 7, - days_ago - 1)\n when \"l2w\"\n # = last 2 weeks\n first_day_of_week = l(:general_first_day_of_week).to_i\n day_of_week = Date.today.cwday\n days_ago = (day_of_week >= first_day_of_week ? day_of_week - first_day_of_week : day_of_week + 7 - first_day_of_week)\n sql = relative_date_clause(db_table, db_field, - days_ago - 14, - days_ago - 1)\n when \"m\"\n # = this month\n date = Date.today\n sql = date_clause(db_table, db_field, date.beginning_of_month, date.end_of_month)\n when \"lm\"\n # = last month\n date = Date.today.prev_month\n sql = date_clause(db_table, db_field, date.beginning_of_month, date.end_of_month)\n when \"y\"\n # = this year\n date = Date.today\n sql = date_clause(db_table, db_field, date.beginning_of_year, date.end_of_year)\n when \"~\"\n sql = \"LOWER(#{db_table}.#{db_field}) LIKE '%#{connection.quote_string(value.first.to_s.downcase)}%'\"\n when \"!~\"\n sql = \"LOWER(#{db_table}.#{db_field}) NOT LIKE '%#{connection.quote_string(value.first.to_s.downcase)}%'\"\n else\n raise \"Unknown query operator #{operator}\"\n end\n\n return sql\n end", "title": "" }, { "docid": "ab062792fda22445d03d07bf7d9ed8d8", "score": "0.61853397", "text": "def sql_for_field(field, value, db_table, db_field, is_custom_filter)\r\n sql = ''\r\n case operator_for field\r\n when \"=\"\r\n sql = \"#{db_table}.#{db_field} IN (\" + value.collect{|val| \"'#{connection.quote_string(val)}'\"}.join(\",\") + \")\"\r\n when \"!\"\r\n sql = \"(#{db_table}.#{db_field} IS NULL OR #{db_table}.#{db_field} NOT IN (\" + value.collect{|val| \"'#{connection.quote_string(val)}'\"}.join(\",\") + \"))\"\r\n when \"!*\"\r\n sql = \"#{db_table}.#{db_field} IS NULL\"\r\n sql << \" OR #{db_table}.#{db_field} = ''\" if is_custom_filter\r\n when \"*\"\r\n sql = \"#{db_table}.#{db_field} IS NOT NULL\"\r\n sql << \" AND #{db_table}.#{db_field} <> ''\" if is_custom_filter\r\n when \">=\"\r\n sql = \"#{db_table}.#{db_field} >= #{value.first.to_i}\"\r\n when \"<=\"\r\n sql = \"#{db_table}.#{db_field} <= #{value.first.to_i}\"\r\n when \"o\"\r\n sql = \"#{IssueStatus.table_name}.is_closed=#{connection.quoted_false}\" if field == \"status_id\"\r\n when \"c\"\r\n sql = \"#{IssueStatus.table_name}.is_closed=#{connection.quoted_true}\" if field == \"status_id\"\r\n when \">t-\"\r\n sql = date_range_clause(db_table, db_field, - value.first.to_i, 0)\r\n when \"<t-\"\r\n sql = date_range_clause(db_table, db_field, nil, - value.first.to_i)\r\n when \"t-\"\r\n sql = date_range_clause(db_table, db_field, - value.first.to_i, - value.first.to_i)\r\n when \">t+\"\r\n sql = date_range_clause(db_table, db_field, value.first.to_i, nil)\r\n when \"<t+\"\r\n sql = date_range_clause(db_table, db_field, 0, value.first.to_i)\r\n when \"t+\"\r\n sql = date_range_clause(db_table, db_field, value.first.to_i, value.first.to_i)\r\n when \"t\"\r\n sql = date_range_clause(db_table, db_field, 0, 0)\r\n when \"w\"\r\n from = l(:general_first_day_of_week) == '7' ?\r\n # week starts on sunday\r\n ((Date.today.cwday == 7) ? Time.now.at_beginning_of_day : Time.now.at_beginning_of_week - 1.day) :\r\n # week starts on monday (Rails default)\r\n Time.now.at_beginning_of_week\r\n sql = \"#{db_table}.#{db_field} BETWEEN '%s' AND '%s'\" % [connection.quoted_date(from), connection.quoted_date(from + 7.days)]\r\n when \"~\"\r\n sql = \"LOWER(#{db_table}.#{db_field}) LIKE '%#{connection.quote_string(value.first.to_s.downcase)}%'\"\r\n when \"!~\"\r\n sql = \"LOWER(#{db_table}.#{db_field}) NOT LIKE '%#{connection.quote_string(value.first.to_s.downcase)}%'\"\r\n end\r\n return sql\r\n end", "title": "" }, { "docid": "af6e84dd2c5914eeeae83ad62faa17a3", "score": "0.61219686", "text": "def filter_field(field_name, predicates={equal_to: field_name})\n predicates.each do |operator, filter|\n @arel_filters[filter] = []\n\n if operator == :contains\n @arel_filters[filter] << ->(arel, value) do\n table_name, field = apply_joins(arel, field_name, filter)\n arel.where(\"#{table_name}.#{field} ILIKE ?\", \"%#{value}%\")\n end\n elsif operator == :equal_to\n @arel_filters[filter] << ->(arel, value) do\n table_name, field = apply_joins(arel, field_name, filter)\n arel.where(table_name => {field => value})\n end\n elsif operator == :greater_than_or_equal_to\n @arel_filters[filter] << ->(arel, value) do\n table_name, field = apply_joins(arel, field_name, filter)\n arel.where(\"#{table_name}.#{field} >= ?\", value)\n end\n elsif operator == :less_than\n @arel_filters[filter] << ->(arel, value) do\n table_name, field = apply_joins(arel, field_name, filter)\n arel.where(\"#{table_name}.#{field} < ?\", value)\n end\n elsif operator == :less_than_or_equal_to\n @arel_filters[filter] << ->(arel, value) do\n table_name, field = apply_joins(arel, field_name, filter)\n arel.where(\"#{table_name}.#{field} <= ?\", value)\n end\n elsif operator == :present_if\n @arel_filters[filter] << ->(arel, value) do\n table_name, field = apply_joins(arel, field_name, filter)\n if value\n arel.where(\"#{table_name}.#{field} IS NOT NULL\")\n else\n arel.where(\"#{table_name}.#{field} IS NULL\")\n end\n end\n else\n raise UnknownOperator.new(\"Unknown operator #{operator}.\")\n end\n end\n end", "title": "" }, { "docid": "d70b9e7aa4368e6b161a63d88f427b15", "score": "0.6087934", "text": "def prepare(field, operator, value)\n unless operator =~ /exists|type|size/\n value = value.__expand_complex__\n field = field.to_s\n name = aliases[field] || field\n serializer = serializers[name]\n value = serializer ? serializer.evolve(value) : value\n end\n selection = { operator => value }\n negating? ? { \"$not\" => selection } : selection\n end", "title": "" }, { "docid": "db8f9271a2875f9f95048e41f96441aa", "score": "0.6018192", "text": "def expression_to_sql(clause, value, collector)\n case clause\n when Symbol::Operator then\n operator = case clause.type\n when :gt then '>'\n when :gte then '>='\n when :lt then '<'\n when :lte then '<='\n when :not then inequality_operator(value)\n when :eql then equality_operator(value)\n when :like then equality_operator(value, 'LIKE')\n when :in then equality_operator(value)\n else raise ArgumentError.new('Operator type not supported')\n end\n #Table[column name] is column.to_sql(true/false based on associations or not)\n collector << [\"#{@table[clause].to_sql(@qualify_columns)} #{operator} ?\", value]\n when Symbol then\n collector << [\"#{@table[clause].to_sql(@qualify_columns)} #{equality_operator(value)} ?\", value]\n when String then\n collector << [clause, *value]\n when Mappings::Column then\n collector << [\"#{clause.to_sql(@qualify_columns)} #{equality_operator(value)} ?\", value]\n else raise \"CAN HAS CRASH? #{clause.inspect}\"\n end\n rescue => e\n raise ConditionsError.new(clause, value, e)\n end", "title": "" }, { "docid": "d21c861090a0e53a1bad6701bdf412c3", "score": "0.59745497", "text": "def where_condition_part(field, expression, value)\n case field[:type]\n when :guid then [\"#{field[:api_name]}.ToString()\", expression, \"\\\"#{value}\\\"\"]\n when :string then [field[:api_name], expression, \"\\\"#{value}\\\"\"]\n when :boolean then [field[:api_name], expression, value ? 'true' : 'false']\n when :integer then [field[:api_name], expression, value.to_s]\n when :decimal then [field[:api_name], expression, value.to_s]\n when :date then [field[:api_name], expression, \"DateTime.Parse(\\\"#{value.strftime(\"%Y-%m-%d\")}\\\")\"]\n when :datetime then [field[:api_name], expression, \"DateTime.Parse(\\\"#{value.utc.strftime(\"%Y-%m-%dT%H:%M:%S\")}\\\")\"]\n when :datetime_utc then [field[:api_name], expression, \"DateTime.Parse(\\\"#{value.utc.strftime(\"%Y-%m-%dT%H:%M:%S\")}\\\")\"]\n when :belongs_to then\n when :has_many then\n when :has_one then\n end\n end", "title": "" }, { "docid": "f8fc17484f5e6d0f68fed46b53a94156", "score": "0.5941775", "text": "def prepare(field, operator, value)\n unless operator =~ /exists|type|size/\n value = value.__expand_complex__\n serializer = serializers[field]\n value = serializer ? serializer.evolve(value) : value\n end\n selection = { operator => value }\n negating? ? { \"$not\" => selection } : selection\n end", "title": "" }, { "docid": "726209027a5b07b364f112f4598a82b9", "score": "0.59121877", "text": "def auto_query_for(field, value)\n case value\n when String, Numeric, Date\n { match: { field => value } }\n when Range\n { range: { field => { gte: value.min, lte: value.max } } }\n when Array\n # Array<String|Fixnum|Float> get shorthanded to a single match query\n if value.all? { |v| v.is_a?(String) || v.is_a?(Numeric) }\n auto_query_for(field, value.join(' '))\n else\n matchers = value.map { |v| auto_query_for(field, v) }\n { bool: { should: matchers } }\n end\n when Hash\n value.deep_transform_keys { |key| key.to_s == '$field' ? field : key }\n else\n value\n end\n end", "title": "" }, { "docid": "9e7a949ffdda961f2287c574f73ef7ca", "score": "0.58732194", "text": "def expression_to_sql(clause, value, collector)\n qualify_columns = qualify_columns?\n\n case clause\n when Symbol::Operator then\n operator = case clause.type\n when :gt then '>'\n when :gte then '>='\n when :lt then '<'\n when :lte then '<='\n when :not then inequality_operator(value)\n when :eql then equality_operator(value)\n when :like then equality_operator(value, 'LIKE')\n when :in then equality_operator(value)\n else raise ArgumentError.new('Operator type not supported')\n end\n collector << [\"#{primary_class_table[clause].to_sql(qualify_columns)} #{operator} ?\", value]\n when Symbol then\n collector << [\"#{primary_class_table[clause].to_sql(qualify_columns)} #{equality_operator(value)} ?\", value]\n when String then\n collector << [clause, *value]\n when Mappings::Column then\n collector << [\"#{clause.to_sql(qualify_columns)} #{equality_operator(value)} ?\", value]\n else raise \"CAN HAS CRASH? #{clause.inspect}\"\n end\n rescue => e\n if e.is_a?(ConditionsError)\n raise e\n else\n raise ConditionsError.new(clause, value, e)\n end\n end", "title": "" }, { "docid": "125d27f125c5a1213247ad5b1a2185f1", "score": "0.57444215", "text": "def sql_for_custom_field(field, operator, value, custom_field_id)\n db_table = CustomValue.table_name\n db_field = 'value'\n filter = @available_filters[field]\n return nil unless filter\n if filter[:field].format.target_class && filter[:field].format.target_class <= User\n if value.delete('me')\n value.push User.current.id.to_s\n end\n end\n not_in = nil\n if operator == '!'\n # Makes ! operator work for custom fields with multiple values\n operator = '='\n not_in = 'NOT'\n end\n customized_key = \"id\"\n customized_class = queried_class\n if field =~ /^(.+)\\.cf_/\n assoc = $1\n customized_key = \"#{assoc}_id\"\n customized_class = queried_class.reflect_on_association(assoc.to_sym).klass.base_class rescue nil\n raise \"Unknown #{queried_class.name} association #{assoc}\" unless customized_class\n end\n where = sql_for_field(field, operator, value, db_table, db_field, true)\n if operator =~ /[<>]/\n where = \"(#{where}) AND #{db_table}.#{db_field} <> ''\"\n end\n \"#{queried_table_name}.#{customized_key} #{not_in} IN (\" +\n \"SELECT #{customized_class.table_name}.id FROM #{customized_class.table_name}\" +\n \" LEFT OUTER JOIN #{db_table} ON #{db_table}.customized_type='#{customized_class}' AND #{db_table}.customized_id=#{customized_class.table_name}.id AND #{db_table}.custom_field_id=#{custom_field_id}\" +\n \" WHERE (#{where}) AND (#{filter[:field].visibility_by_project_condition}))\"\n end", "title": "" }, { "docid": "52e0fdd230e4e7360ea86afa7892de20", "score": "0.56628215", "text": "def field_to_sql(field_attribute_type, field_attribute_value)\n unless FIELD_ATTRS.include?(field_attribute_type) then\n (error(\"invalid field attribute. #{field_attribute_type}\"); nil) \n end\n\n case field_attribute_type\n when \"field\" then return field_attribute_value\n when \"type\" then return field_attribute_value\n when \"null\"\n return \"NOT NULL\" if field_attribute_value == \"NO\"\n return \"\"\n when \"key\"\n case field_attribute_value\n when \"PRI\" then return \"PRIMARY KEY\"\n when \"MUL\" then return \"\"\n when \"UNI\" then return \"UNIQUE\"\n else return \"\"\n end\n when \"default\"\n if field_attribute_value.length > 0 then\n return \"DEFAULT #{field_attribute_value}\" \n else\n return \"\"\n end\n when \"extra\" then return \"#{field_attribute_value}\"\n when \"comment\" then return \"#{field_attribute_value}\"\n end\n error(\"invalid field type #{field_attribute_type}, value: \" +\n \"#{field_attribute_value}\")\n return nil\n end", "title": "" }, { "docid": "bb8468ea92c28ea07bf791036120431d", "score": "0.5622579", "text": "def transform_field(field)\n field = field.to_s\n \n # see if field consists of SQL function, then get table-field inside ``\n field.scan(/\\`[a-z0-9_\\.]+\\`/i).uniq.each do |field_scan|\n \n j, f = parse_assoc_field( field_scan[1...-1] )\n\n if j then \n field.gsub!(field_scan, \"t#{j.index}.`#{f}`\")\n else\n puts \"WARNING: uknown #{field_scan}\"\n end\n end\n \n field\n end", "title": "" }, { "docid": "d0103177d6c2749fc6e36a676b545a0d", "score": "0.5614937", "text": "def sql_for_field_with_short_operators_fix(field, operator, value, db_table, db_field, is_custom_filter=false)\n sql = ''\n case operator\n when \"=\"\n if value.present?\n sql = \"#{db_table}.#{db_field} IN (\" + value.collect{|val| \"'#{connection.quote_string(val)}'\"}.join(\",\") + \")\"\n else\n # empty set of allowed values produces no result\n sql = \"0=1\"\n end\n when \"!\"\n if value.present?\n sql = \"(#{db_table}.#{db_field} IS NULL OR #{db_table}.#{db_field} NOT IN (\" + value.collect{|val| \"'#{connection.quote_string(val)}'\"}.join(\",\") + \"))\"\n else\n # empty set of forbidden values allows all results\n sql = \"1=1\"\n end\n when \"!*\"\n sql = \"#{db_table}.#{db_field} IS NULL\"\n sql << \" OR #{db_table}.#{db_field} = ''\" if is_custom_filter\n when \"*\"\n sql = \"#{db_table}.#{db_field} IS NOT NULL\"\n sql << \" AND #{db_table}.#{db_field} <> ''\" if is_custom_filter\n when \">=\"\n sql = \"#{db_table}.#{db_field} >= #{value.first.to_i}\"\n when \"<=\"\n sql = \"#{db_table}.#{db_field} <= #{value.first.to_i}\"\n when \"o=\"\n sql = \"#{IssueStatus.table_name}.is_closed=#{connection.quoted_false}\" if field == \"status_id\"\n when \"c=\"\n sql = \"#{IssueStatus.table_name}.is_closed=#{connection.quoted_true}\" if field == \"status_id\"\n when \">t-\"\n sql = date_range_clause(db_table, db_field, - value.first.to_i, 0)\n when \"<t-\"\n sql = date_range_clause(db_table, db_field, nil, - value.first.to_i)\n when \"t-\"\n sql = date_range_clause(db_table, db_field, - value.first.to_i, - value.first.to_i)\n when \">t+\"\n sql = date_range_clause(db_table, db_field, value.first.to_i, nil)\n when \"<t+\"\n sql = date_range_clause(db_table, db_field, 0, value.first.to_i)\n when \"t+\"\n sql = date_range_clause(db_table, db_field, value.first.to_i, value.first.to_i)\n when \"t\"\n sql = date_range_clause(db_table, db_field, 0, 0)\n when \"w\"\n from = l(:general_first_day_of_week) == '7' ?\n # week starts on sunday\n ((Date.today.cwday == 7) ? Time.now.at_beginning_of_day : Time.now.at_beginning_of_week - 1.day) :\n # week starts on monday (Rails default)\n Time.now.at_beginning_of_week\n sql = \"#{db_table}.#{db_field} BETWEEN '%s' AND '%s'\" % [connection.quoted_date(from), connection.quoted_date(from + 7.days)]\n when \"~\"\n sql = \"LOWER(#{db_table}.#{db_field}) LIKE '%#{connection.quote_string(value.first.to_s.downcase)}%'\"\n when \"!~\"\n sql = \"LOWER(#{db_table}.#{db_field}) NOT LIKE '%#{connection.quote_string(value.first.to_s.downcase)}%'\"\n end\n\n return sql\n end", "title": "" }, { "docid": "64cc1ca71216d13cac02ff84bfe27efd", "score": "0.55817276", "text": "def to_get_field_from_datum(&field_value_extraction_proc)\n @field_value_extraction_proc = field_value_extraction_proc\n end", "title": "" }, { "docid": "81df89dbd2b1efb54091208b5a69923e", "score": "0.5569494", "text": "def convert_fields_for_query(fields)\n case fields\n when String, Symbol\n to_dbobject({fields => 1})\n when Array\n return nil if fields.length.zero?\n hash = {}\n fields.each { |field| hash[field] = 1 }\n to_dbobject hash\n when Hash\n to_dbobject fields\n end\n end", "title": "" }, { "docid": "1175fc18b5fe9940fcb81b8ab3ed0e8d", "score": "0.5494377", "text": "def convert_fields_for_query(fields)\n to_dbobject prep_fields(fields)\n end", "title": "" }, { "docid": "5cd00aa056d791c80994b86eccc9a17f", "score": "0.5433724", "text": "def add_field(name, predicate, options = {})\n # create a field object and store it in our hash\n field = field_for(name, predicate, options)\n @fields ||= {}\n @fields[name] = field\n\n # set up the accessors for the fields\n create_accessors(name, name, options)\n\n # create a URL validation if appropriate\n # (format nabbed from https://gist.github.com/joshuap/948880)\n validates(name, is_url: true) if field.is_uri?\n\n field\n end", "title": "" }, { "docid": "a4a870c386da0bea7952ff7b601756f0", "score": "0.54106367", "text": "def linked_custom_sql_for_field(field,operator, value,db_table, db_field, is_custom_filter=false)\n if field == \"linked_custom_fields_id\" || field == \"linked_custom_fields_id2\" || field == \"linked_custom_fields_id3\"\n \n if field == \"linked_custom_fields_id\"\n v = values_for(field).clone\n end\n \n if field == \"linked_custom_fields_id2\"\n v2 = values_for(field).clone\n end\n \n if field == \"linked_custom_fields_id3\"\n v3 = values_for(field).clone\n end\n db_field = nil\n \n db_field2 = nil\n \n db_field3 = nil\n \n db_table = \"issues\"\n \n if field == \"linked_custom_fields_id\"\n db_field = 'linked_custom_id1'\n end\n if field == \"linked_custom_fields_id2\"\n db_field2 = \"linked_custom_id2\"\n end\n if field == \"linked_custom_fields_id3\"\n db_field3 = \"linked_custom_id3\"\n end\n \n # \"me\" value subsitution\n # v.push(User.current.logged? ? User.current.id.to_s : \"0\") if v.delete(\"me\")\n \n case operator_for field\n when \"=\"\n \n use_and = false\n sql=\"\"\n if db_field!= nil\n sql += \"#{db_table}.#{db_field} IN (\" + v.collect{|val| \"'#{connection.quote_string(val)}'\"}.join(\",\") + \")\"\n use_and = true\n end\n \n if db_field2!= nil\n if use_and\n sql+=\" and \"\n end\n sql += \"#{db_table}.#{db_field2} IN (\" + v2.collect{|val| \"'#{connection.quote_string(val)}'\"}.join(\",\") + \")\"\n use_and = true\n end\n \n if db_field3!= nil\n if use_and\n sql+=\" and \"\n end\n sql += \"#{db_table}.#{db_field3} IN (\" + v3.collect{|val| \"'#{connection.quote_string(val)}'\"}.join(\",\") + \")\"\n end\n \n when \"!\"\n \n use_and = false\n sql=\"\"\n if db_field!= nil\n sql +=\"(#{db_table}.#{db_field} IS NULL OR #{db_table}.#{db_field} NOT IN (\" + v.collect{|val| \"'#{connection.quote_string(val)}'\"}.join(\",\") + \"))\"\n use_and = true\n end\n \n if db_field2!= nil\n if use_and\n sql+=\" and \"\n end\n sql += \"(#{db_table}.#{db_field2} IS NULL OR #{db_table}.#{db_field2} NOT IN (\" + v.collect{|val| \"'#{connection.quote_string(val)}'\"}.join(\",\") + \"))\"\n use_and = true\n end\n \n if db_field3!= nil\n if use_and\n sql+=\" and \"\n end\n sql += \"(#{db_table}.#{db_field3} IS NULL OR #{db_table}.#{db_field3} NOT IN (\" + v.collect{|val| \"'#{connection.quote_string(val)}'\"}.join(\",\") + \"))\"\n end\n end\n\n return sql\n \n else\n return sql_for_field_before_linked_custom(field,operator, value, db_table, db_field,is_custom_filter)\n end\n \n end", "title": "" }, { "docid": "1f14d763dc53a594ee2028b5954b4b96", "score": "0.5400638", "text": "def create_field_accessors(column, field, value)\n # define the method to check if the field is true or false\n define_method(field) { (value.first & (self[column] || 0) != 0) }\n\n # define the method to set the field value\n define_method(:\"#{field.to_s}=\") do |v|\n if [true, '1', 1, 't'].include? v\n self[column] = (self[column] || 0) | value.first\n elsif [false, '0', 0, 'f'].include? v\n self[column] = (self[column] || 0) &~ value.first\n end\n end\n alias_method :\"#{field.to_s}?\", field\n end", "title": "" }, { "docid": "c13933890e18eee3ce4e6546ea8fccff", "score": "0.5384045", "text": "def process_field(field_name)\n if ['id', 'parent_id', 'project_id', 'section_id', 'kpath', 'name', 'event_at', 'custom_a', 'idx_foo1' , 'amount'].include?(field_name)\n \"#{table}.#{field_name}\"\n elsif field_name == 'REF_DATE'\n context[:ref_date] ? insert_bind(context[:ref_date]) : 'now()'\n elsif %w{age size}.include?(field_name)\n tbl = add_key_value_table('idx', 'idx_nodes', field_name) do |tbl_name|\n # This block is only executed once\n \"#{tbl_name}.node_id = #{table}.id AND #{tbl_name}.key = #{quote(field_name)}\"\n end\n\n \"#{tbl}.value\"\n else\n super # raises an error\n end\n end", "title": "" }, { "docid": "e4b88398bd21de1d16ab44662f91631e", "score": "0.5375039", "text": "def parse_table_field(table, field)\n validate_table(table)\n raise CustomErrors::FilterArgumentError, 'Field name must be a symbol.' unless field.is_a?(Symbol)\n\n if association_field?(field)\n parse_other_table_field(table, field)\n else\n\n # table name may not be the same as model / controller name :(\n model = to_model(table)\n #controller = (filter_settings[:controller].to_s + '_controller').classify.constantize\n\n {\n table_name: table.name,\n field_name: field,\n arel_table: table,\n model:,\n filter_settings: @filter_settings\n }\n end\n end", "title": "" }, { "docid": "31e83af893d38c1a9b99c29551cf885d", "score": "0.53743017", "text": "def with_value_of(field, wanted_value, compar_sym = nil)\n compar_sym ||= wanted_value.is_a?(Array) || wanted_value.is_a?(Range) ? :in : :eq\n @areltable ||= arel_table\n mapping = filter_mappings[field]\n if mapping\n send(mapping, wanted_value, compar_sym)\n else\n advanced_fields.include?(field) && [:eq, :in, :not_eq, :not_in].include?(compar_sym.to_sym) ?\n special_numeric_filter(field, wanted_value, compar_sym) :\n where(@areltable[field].send(compar_sym, wanted_value))\n end\n end", "title": "" }, { "docid": "322c18d749ad672d090bb73e09a3db0d", "score": "0.5354292", "text": "def criteria(data, field, cond1, cond2)\n my_select = \"data.select { |item| item[:#{field}]#{cond1} #{cond2} }\"\n return eval(my_select)\nend", "title": "" }, { "docid": "b1b6669acd54e94cda53a9fee7a980be", "score": "0.531158", "text": "def get_field_predicate(search_instance,field,default)\n search_instance.conditions.find {|i|\n i.attributes.first.name == field.name.to_s\n }.try(:predicate).try(:name) || default\n end", "title": "" }, { "docid": "297156ff337de78d7cc86ee278f1358a", "score": "0.53076345", "text": "def parse_predicate(pred)\n key, value = pred.split('==', 2)\n key_proc = parse_field(key)\n value = JSON.parse(\"[#{value}]\").first rescue value\n\n ->(t) do\n key_proc.call(t) == value\n end\nend", "title": "" }, { "docid": "fd586fc1225681b45c94ba0420fff918", "score": "0.53048", "text": "def convert_fields_for_query(fields)\n case fields\n when String, Symbol\n {fields => 1}\n when Array\n return nil if fields.length.zero?\n fields.each_with_object({}) { |field, hash| hash[field] = 1 }\n when Hash\n return fields\n end\n end", "title": "" }, { "docid": "8c704ee11b172e7cadaddd9f8bb53628", "score": "0.53037184", "text": "def parse_table_field(field)\n fail ClearlyQuery::FilterArgumentError.new('field name must be a symbol') unless field.is_a?(Symbol)\n\n field_s = field.to_s\n\n if field_s.include?('.')\n dot_index = field.to_s.index('.')\n parsed_table = field[0, dot_index].to_sym\n parsed_field = field[(dot_index + 1)..field.length].to_sym\n\n models = @associations.map { |a| a[:join] }\n table_names = @associations.map { |a| a[:join].table_name.to_sym }\n\n validate_name(parsed_table, table_names)\n\n model = parsed_table.to_s.classify.constantize\n\n validate_association(model, models)\n\n model_filter_settings = model.clearly_query_def\n model_valid_fields = model_filter_settings[:fields][:valid].map(&:to_sym)\n arel_table = relation_table(model)\n\n validate_table_column(arel_table, parsed_field, model_valid_fields)\n\n {\n table_name: parsed_table,\n field_name: parsed_field,\n arel_table: arel_table,\n model: model,\n filter_settings: model_filter_settings\n }\n else\n {\n table_name: @table.name,\n field_name: field,\n arel_table: @table,\n model: @model,\n filter_settings: @raw\n }\n end\n\n end", "title": "" }, { "docid": "83f3f583e9b2cd9e0810fff47b24756d", "score": "0.5269114", "text": "def condition(field, value)\n case value\n when Array then field.in(value)\n when String then field.matches(sanitize(value))\n when Integer then field.eq(value)\n end\n end", "title": "" }, { "docid": "580a799bcfd99be0d6bc736219d39033", "score": "0.52414125", "text": "def typecast_value_for(field, value)\n return field.selection(value) if field.type === value\n case value\n when Hash\n value = value.dup\n value.each_pair do |k, v|\n value[k] = typecast_hash_value(field, k, v)\n end\n when Array\n value.map { |v| typecast_value_for(field, v) }\n when Regexp\n value\n when Range\n {\n \"$gte\" => typecast_value_for(field, value.first),\n \"$lte\" => typecast_value_for(field, value.last)\n }\n else\n if field.type == Array\n Serialization.mongoize(value, value.class)\n else\n field.selection(value)\n end\n end\n end", "title": "" }, { "docid": "f1e378202e61f55ba5f92d0110e4f547", "score": "0.521829", "text": "def v( obj )\n case obj\n when Sequel::Dataset\n # transform empty expressions to false (or nil, but false is more debuggable)\n # can't use nil for all kinds of expressions because nil mean NULL for\n # most of the Sequel::SQL expressions.\n obj.clone Hash[ v(obj.opts).map{|k,val| [k, val.is_a?(Philtre::EmptyExpression) ? false : val]} ]\n\n # for Sequel::Models\n when -> obj { obj.is_a?(Class) && obj.ancestors.include?(Sequel::Model) }\n # From sequel-5.x.x, I suspect,\n # SomeModel.dataset.opts includes :row_proc => SomeModel and :model => SomeModel\n # which sends v into an endless loop.\n opts = obj.dataset.opts.reject{|_,v| v == obj}\n transformed = v(opts).map do |k,val|\n [k, val.is_a?(Philtre::EmptyExpression) ? false : val]\n end\n obj.dataset.clone Hash[transformed]\n\n # for other things that are convertible to dataset\n when ->(obj){obj.respond_to? :to_dataset}\n v obj.to_dataset\n\n # Keep the context for place holders,\n # so we know what kind of expression to insert later.\n # Each of :where, :order, :having, :select etc will come as a hash.\n # There are some other top-level options too.\n when Hash\n rv = {}\n obj.each do |key, val|\n push_subset key do\n rv[v(key)] = v(val)\n end\n end\n rv\n\n when Philtre::PlaceHolder\n # get the expression for the placeholder.\n # use the placeholder's field name if given\n expr =\n case subset\n # substitute a comparison or some other predicate\n when :where, :having\n filter.expr_for obj.name, obj.sql_field\n\n # substitute an order by expression\n when :order\n filter.order_for obj.name\n\n # Substitute the field name only if it has a value.\n # nil when the name doesn't have a value. This way,\n # select :some_field.lieu\n # is left out when some_field does not have a value.\n when :select\n if filter[obj.name]\n obj.sql_field || obj.name\n end\n\n else\n raise \"don't understand subset #{subset}\"\n end\n\n # keep it, just in case\n context_places[obj.name] = expr\n\n # transform\n expr || Philtre::EmptyExpression.new\n\n when Array\n # sometimes things are already an empty array, in which\n # case just leave them alone.\n return super if obj.empty?\n\n # collect expressions, some may be empty.\n exprs = super.reject{|e| e.is_a? Philtre::EmptyExpression}\n\n # an empty array of expressions must be translated\n # to an empty expression at this point.\n exprs.empty? ? Philtre::EmptyExpression.new : exprs\n\n when Sequel::SQL::ComplexExpression\n # use the Array case above, otherwise copy the expression itself\n v( obj.args ).empty? ? Philtre::EmptyExpression.new : super\n\n else\n super\n end\n end", "title": "" }, { "docid": "e6237d2646bfd28e63f8887c9de6ff89", "score": "0.51819974", "text": "def typecast_query_param( param_value, field )\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "bd199a013990d65ad13f491918b38946", "score": "0.5172116", "text": "def expr_query(criterion)\n selection(criterion) do |selector, field, value|\n if (field.is_a? Key) && custom_serialization?(field.name, field.operator)\n specified = custom_specify(field.name, field.operator, value)\n else\n specified = field.specify(value.__expand_complex__, negating?)\n end\n selector.merge!(specified)\n end\n end", "title": "" }, { "docid": "2a4f434656101deeef0d3e721e732d3f", "score": "0.51615924", "text": "def predicates(predicate, collection, klass, column_name, value)\n case predicate\n when :between\n klass.arel_table[column_name].between(value.first..value.last)\n when :does_not_match\n klass.arel_table[column_name].does_not_match(\"%#{value}%\")\n when :does_not_match_all\n klass.arel_table[column_name].does_not_match_all(value)\n when :does_not_match_any\n klass.arel_table[column_name].does_not_match_any(value)\n when :eq\n klass.arel_table[column_name].eq(value)\n when :eq_all\n klass.arel_table[column_name].eq_all(value)\n when :eq_any\n klass.arel_table[column_name].eq_any(value)\n when :gt\n klass.arel_table[column_name].gt(value)\n when :gt_all\n klass.arel_table[column_name].gt_all(value)\n when :gt_any\n klass.arel_table[column_name].gt_any(value)\n when :gteq\n klass.arel_table[column_name].gteq(value)\n when :gteq_all\n klass.arel_table[column_name].gteq_all(value)\n when :gteq_any\n klass.arel_table[column_name].gteq_any(value)\n when :in\n if value.is_a?(Array)\n klass.arel_table[column_name].in(value.flatten.compact.uniq)\n else\n klass.arel_table[column_name].in(value)\n end\n when :in_all\n if value.is_a?(Array)\n klass.arel_table[column_name].in_all(value.flatten.compact.uniq)\n else\n klass.arel_table[column_name].in_all(value)\n end\n when :in_any\n if value.is_a?(Array)\n klass.arel_table[column_name].in_any(value.flatten.compact.uniq)\n else\n klass.arel_table[column_name].in_any(value)\n end\n when :lt\n klass.arel_table[column_name].lt(value)\n when :lt_all\n klass.arel_table[column_name].lt_all(value)\n when :lt_any\n klass.arel_table[column_name].lt_any(value)\n when :lteq\n klass.arel_table[column_name].lteq(value)\n when :lteq_all\n klass.arel_table[column_name].lteq_all(value)\n when :lteq_any\n klass.arel_table[column_name].lteq_any(value)\n when :ilike\n klass.arel_table[column_name].matches(\"%#{value}%\")\n when :matches\n klass.arel_table[column_name].matches(value)\n when :matches_all\n klass.arel_table[column_name].matches_all(value)\n when :matches_any\n klass.arel_table[column_name].matches_any(value)\n when :not_between\n klass.arel_table[column_name].not_between(value.first..value.last)\n when :not_eq\n klass.arel_table[column_name].not_eq(value)\n when :not_eq_all\n klass.arel_table[column_name].not_eq_all(value)\n when :not_eq_any\n klass.arel_table[column_name].not_eq_any(value)\n when :not_in\n klass.arel_table[column_name].not_in(value)\n when :not_in_all\n klass.arel_table[column_name].not_in_all(value)\n when :not_in_any\n klass.arel_table[column_name].not_in_any(value)\n else\n unless predicate.respond_to?(:call)\n raise ArgumentError,\n \"unsupported predicate `#{predicate}`\"\n end\n\n predicate.call(collection, value)\n end\n end", "title": "" }, { "docid": "7610a58481dc6c26d38385e5e4ae3504", "score": "0.5105146", "text": "def sql_format(table, field_name, field_value)\n\t\t\tif not @meta_types.has_key?(table)\n\t\t\t\traise \"invalid table: #{table}\"\n\t\t\tend\n\t\t\tif not @meta_types[table].has_key?(field_name)\n\t\t\t\traise \"invalid field name: #{field_name}\"\n\t\t\tend\n\t\t\tcase @meta_types[table][field_name].downcase\n\t\t\twhen /int/, /serial/\n\t\t\t\tif type != 'interval' and type != 'point'\n\t\t\t\t\ttypified_value = field_value\n\t\t\t\tend\n\t\t\twhen /float/, /double/, /money/, /numeric/, /decimal/\n\t\t\t\ttypified_value = field_value\n\t\t\twhen /bool/\n\t\t\t\ttypified_value = field_value\n\t\t\twhen /timestamp/, /date/\n if field_value.to_s.strip.empty?\n typified_value = 'NULL'\n else\n typified_value = sql_escape(field_value.to_s.strip).quote(true)\n end\n\t\t\twhen /var/, /char/, /text/\n\t\t\t\ttypified_value = sql_escape(field_value.to_s.strip).quote(true)\n\t\t\tend\n\t\t\treturn typified_value\n\t\tend", "title": "" }, { "docid": "395883893cd942ff844c1e88bbfcdad8", "score": "0.5092702", "text": "def field_for(name, predicate, options)\n Tripod::Fields::Standard.new(name, predicate, options)\n end", "title": "" }, { "docid": "41abdb860a5e184f772424524cc9f39d", "score": "0.5071284", "text": "def sql_for_issue_rating_rating_val_field(field, operator, value)\n case operator\n when \"=\", \">=\", \"<=\", \"!*\", \"><\"\n sw = ''\n nl = ''\n if operator == \"!*\"\n sw = 'NOT'\n elsif operator == \"><\"\n nl = \"AND ir1.rating_val >= #{value.first} AND ir1.rating_val <= #{value[1]}\"\n else\n nl = \"AND ir1.rating_val #{operator} #{value.first}\"\n end\n\n \"( #{Issue.table_name}.id #{sw} IN (SELECT ir1.issue_id FROM #{IssueRating.table_name} ir1\" +\n \" LEFT JOIN #{IssueRating.table_name} ir2 ON (ir1.issue_id = ir2.issue_id AND ir1.updated_at < ir2.updated_at)\" +\n \" WHERE ir2.issue_id IS NULL #{nl}) )\"\n\n end\n end", "title": "" }, { "docid": "ce6cc9e62e606f33ce3c40b1a1809806", "score": "0.5066476", "text": "def sql_for(field, db_type)\n val = @row_values[field]\n return 'NULL' if val.nil?\n\n case sql_row_type.data_type_of(field)\n when :string\n \"'#{val.to_s.gsub(/'/,\"''\")}'\"\n when :date\n \"'#{val.strftime('%Y-%m-%d')}'\"\n when :time\n \"'#{val.iso8601}'\"\n when :boolean\n if :sql_server == db_type\n convert_to_boolean(val) ? '1' : '0'\n else\n convert_to_boolean(val) ? \"'t'\" : \"'f'\"\n end\n when :numeric\n tmp = val.to_s\n if tmp.length > 50 # Reduce number of digits after decimal\n BigDecimal(tmp).round(20).to_s\n else\n tmp\n end\n else\n val.to_s\n end\n end", "title": "" }, { "docid": "91de8dad9735830549c7499620a698cd", "score": "0.50645685", "text": "def field(*fields)\n fields.each { |field|\n field = field.to_sym\n unless @field_names.include?(field)\n ivar_name = \"@\" + field.to_s\n # this is better than lambda because it's only eval'ed once\n define_method(field, lambda { instance_variable_get(ivar_name) })\n define_method(\"#{field}=\".to_sym, lambda { |val| instance_variable_set(ivar_name, val) })\n define_method(\"#{field}?\".to_sym, lambda {\n val = instance_variable_get(ivar_name)\n val != nil && (!val.kind_of?(String) || val != '')\n })\n @field_names << field\n end\n }\n end", "title": "" }, { "docid": "a86e2b9995d7f1944902cc445aed52db", "score": "0.50287694", "text": "def expression_for(arg)\n if arg.is_a? String\n \"#{self.field}#{self.op}('#{arg}')\"\n elsif arg.is_a? Regexp\n \"#{self.field}#{self.op}(#{arg.inspect})\"\n elsif arg.is_a? Date\n \"#{self.field}#{self.op}(DateTime.parse('#{arg}'))\"\n else\n \"#{self.field}#{self.op}(#{arg})\"\n end\n end", "title": "" }, { "docid": "4ad0d4ec6e55c14dec3ed803fedc9ad3", "score": "0.5025833", "text": "def form_where_eq(key, value)\n value_class = value.class\n x = ['EQ', key.to_s]\n x << if Time == value_class\n value.utc.iso8601(9)\n elsif value.nil? ||\n TrueClass == value_class ||\n FalseClass == value_class ||\n Integer == value_class ||\n Float == value_class\n value\n elsif String == value_class\n # if the string matches a detectable type then don't quote it\n detect_string(value)\n elsif WAB::Utils.pre_24_fixnum?(value)\n value\n else\n value.to_s\n end\n x\n end", "title": "" }, { "docid": "6542df58038b44608fcbdfa63de91749", "score": "0.5003636", "text": "def get_val_from_element_or_predicate(element,predicate,type)\n if element.keys.include?(type)\n element[type]\n else\n path = case type\n when 'const'\n '$..A_CONST.val'\n when 'col'\n '$..COLUMNREF.fields'\n when 'opr'\n '$..AEXPR.name'\n end\n if type == 'const' and newVal.is_a? Array\n path = '$..AEXPR.rexpr..fields'\n end\n JsonPath.new(path).on(predicate).flatten\n end\n end", "title": "" }, { "docid": "61ec64c4f84bd1111da31037c3bf7ee2", "score": "0.5000896", "text": "def filters_expression(field = nil)\n @filters_expression ||= ''\n @filters_expression = Hisui::FiltersExpression.new(field).to_param if field\n @filters_expression\n end", "title": "" }, { "docid": "3d11bcb82dd27ecd6b80ec8b7b7b549b", "score": "0.4983805", "text": "def get_value(table, field_val, field_ftr, filter_val)\n #print filter_val\n sql_statement = \"SELECT \" + field_val + \" FROM \" + table + \" WHERE \" + \\\n field_ftr + \" = '\" + filter_val + \"';\"\n print sql_statement\n db = get_db()\n stm = db.prepare sql_statement\n rs = stm.execute\n retun_val = nil\n rs.each do |row|\n retun_val = row[field_val]\n end\n return retun_val\nend", "title": "" }, { "docid": "9c0fa5304f6bb591d5d919e46a1638d1", "score": "0.49721983", "text": "def initialize(field, sql_operation, value)\n @field = field\n @value = value\n @sql_operation_template = sql_operation.dup\n @sql_operation = sql_operation.dup\n _init_sql_operation\n end", "title": "" }, { "docid": "f68c371b20eb14d3e3f372aed11c7c03", "score": "0.4959809", "text": "def calculate(field_name, row, dictionary)\n item = dictionary[field_name.to_s] || dictionary[field_name.to_sym]\n type = item['type'] || item[:type]\n fail \"calculate: field not found in dictionary #{field_name.inspect}\" if item.nil?\n expr = item['calculate'] || item[:calculate]\n fail ArgumentError, \"expected to calculate #{field_name}\" if expr.nil?\n e = Expression.find_or_create(expr)\n vars = {}\n e.variables.each do |name|\n vars[name] = fix_field_type(type, row[name.to_sym])\n end\n fix_field_type(type, e.evaluate(vars))\n end", "title": "" }, { "docid": "c04bfaed627e003936842019ed10690a", "score": "0.49558377", "text": "def rubyfunc2kif(f, var) \n \tcase f\n \twhen :< then pk(\"lt\");\n \twhen :> then pk(\"gt\");\n \twhen :<= then pk(\"lte\");\n \twhen :>= then pk(\"gte\");\n\telse pk(f)\n\tend\n end", "title": "" }, { "docid": "f03ff3487e2cb69032786125e5e6492a", "score": "0.49459362", "text": "def make_filter(value, columns_mapped_to=nil)\n {@column_qualified => value && value.id}\n end", "title": "" }, { "docid": "b9d7b0e3c2adaeee5f76a9a2faeb2c0c", "score": "0.49435386", "text": "def get_field_value_from_parameter_fields(params, field)\n field_value = nil\n parameter_field = params['parameter_field']\n case field[:field_type]\n\n # --- DateTime ---\n when \"DateTimeField\"\n if parameter_field[:\"#{field[:field_name]}-sign\"].to_s == \"IS NULL\" ||\n parameter_field[:\"#{field[:field_name]}-sign\"].to_s == \"IS NOT NULL\"\n field_value = parameter_field[:\"#{field[:field_name]}-sign\"]\n else\n field_value = DateTime.civil(parameter_field[:\"#{field[:field_name]}(1i)\"].to_i,\n parameter_field[:\"#{field[:field_name]}(2i)\"].to_i,\n parameter_field[:\"#{field[:field_name]}(3i)\"].to_i,\n parameter_field[:\"#{field[:field_name]}(4i)\"].to_i,\n parameter_field[:\"#{field[:field_name]}(5i)\"].to_i).strftime(\"%Y/%m/%d %I:%M%p\")\n end\n\n # --- Date ---\n when \"DateField\"\n if parameter_field[:\"#{field[:field_name]}-sign\"].to_s == \"IS NULL\" ||\n parameter_field[:\"#{field[:field_name]}-sign\"].to_s == \"IS NOT NULL\"\n field_value = parameter_field[:\"#{field[:field_name]}-sign\"]\n else\n field_value = DateTime.civil(parameter_field[:\"#{field[:field_name]}(1i)\"].to_i,\n parameter_field[:\"#{field[:field_name]}(2i)\"].to_i,\n parameter_field[:\"#{field[:field_name]}(3i)\"].to_i).strftime(\"%Y/%m/%d\")\n end\n\n # --- DropDown ---\n when \"DropDownField\"\n if (parameter_field[:\"#{field[:field_name]}-sign\"].to_s == \"IS NULL\" ||\n parameter_field[:\"#{field[:field_name]}-sign\"].to_s == \"IS NOT NULL\")\n field_value = parameter_field[:\"#{field[:field_name]}-sign\"]\n else\n field_value = parameter_field[:\"#{field[:field_name]}\"]\n end\n # --- Text ---\n when \"TextField\"\n if (parameter_field[:\"#{field[:field_name]}-sign\"].to_s == \"IS NULL\" ||\n parameter_field[:\"#{field[:field_name]}-sign\"].to_s == \"IS NOT NULL\")\n field_value = parameter_field[:\"#{field[:field_name]}-sign\"]\n else\n field_value = parameter_field[:\"#{field[:field_name]}\"]\n end\n\n # --- PopupDate ---\n when \"PopupDateRangeSelector\"\n from = \"\"\n to = \"\"\n from_name = field[:field_name].to_s + \"_datefrom\"\n to_name = field[:field_name].to_s + \"_dateto\"\n if params[from_name]\n from += params[from_name]\n end\n if params[to_name]\n to += params[to_name]\n end\n field_value = \"#{from}|#{to}\"\n else\n field_value = parameter_field[:\"#{field[:field_name]}\"]\n end\n field_value\n end", "title": "" }, { "docid": "bb67adf22bd3b45c22ab91a2baf0b644", "score": "0.49417263", "text": "def find_by_field(field, value)\n translate_from_interface interface.get_for_key_with_value(data_collection, field, value)\n end", "title": "" }, { "docid": "a5549bff5dd3f5611e546396fd96713b", "score": "0.4927133", "text": "def field_clause\n field.name\n end", "title": "" }, { "docid": "562ddcf5dceffa6daf4f4fad3f2f52e8", "score": "0.48993543", "text": "def get_condition_value(key, value)\n column_name = self.class.filtering_attributes[key.to_sym]\n\n # It's not a number (positive number to be precise)\n if !/\\A\\d+\\z/.match(value)\n case key\n when :appendices\n value = value.split(',').map { |v| \"'#{v}'\" }.join(',')\n return \"IN (#{value})\"\n when /_id(s)?/\n null = []\n values = value.split(',')\n values.delete_if { |v| null << v if ['unreported', 'direct', 'items'].include? v.downcase }\n value = values.join(',')\n if value.present? && null.present?\n return \"IN (#{value}) OR #{column_name} IS NULL\"\n elsif value.present?\n return \"IN (#{value})\"\n elsif null.present?\n return \"IS NULL\"\n else\n return ''\n end\n else\n value = value.split(',').map { |v| \"'#{v.downcase}'\" }.join(',')\n return \"IN (#{value})\"\n end\n\n end\n\n return \"IS NULL\" if value == 'NULL'\n\n operator = case key\n when :time_range_start\n '>='\n when :time_range_end\n '<='\n else\n '='\n end\n \"#{operator} #{value.to_i}\"\n end", "title": "" }, { "docid": "e6a4d1a812d93e6c94403c4e68e54299", "score": "0.48991707", "text": "def add_filter(*args)\n raise ArgumentError, \"wrong number of arguments (#{args.length} for 2..3)\" if args.length != 2 and args.length != 3\n\n field = args.shift.to_sym\n self.fields[field] = [] unless self.fields.has_key?(field)\n\n if args.length == 1\n self.fields[field] << args.first\n else\n self.fields[field] << { operator: args.first, value: args.last }\n end\n\n self\n end", "title": "" }, { "docid": "f1dc2153122b6a2ad7ad8e5845829376", "score": "0.4892307", "text": "def query_clause(type, key, value)\n \"_query_:\\\"{!#{type} f=#{key}}#{value.gsub('\"', '\\\"')}\\\"\"\n end", "title": "" }, { "docid": "119fc285225cf55781b6b4e7ba11d1f5", "score": "0.48660165", "text": "def coerce_to_predicate(predicate = Undefined)\n case predicate\n when Undefined\n Evaluator::Context.new(header) { |context| yield context }.yield\n when Enumerable\n predicate.reduce(TAUTOLOGY) do |entry, (name, value)|\n entry.and(header[name].eq(value))\n end\n else\n predicate\n end\n end", "title": "" }, { "docid": "21f04c95c2904662b17e5a91b469bdd3", "score": "0.48537305", "text": "def convert_to_proc(field_name_or_proc)\n field_name_or_proc.respond_to?(:call) ? field_name_or_proc : Proc.new { field_name_or_proc.to_s }\n end", "title": "" }, { "docid": "3782c76b1d0d48a9106181fae2668125", "score": "0.48176455", "text": "def add_filters(fields, operators, values)\n if fields.is_a?(Array) && operators.is_a?(Hash) && (values.nil? || values.is_a?(Hash))\n fields.each do |field|\n add_filter(field, operators[field], values && values[field])\n end\n end\n end", "title": "" }, { "docid": "90dc3394744fbda3d8b30d22828c8007", "score": "0.4815348", "text": "def date_query(search_query, field:)\n comparator = search_query.match(/[<=>]{1,2}/).to_s\n date = parse_utc_date(search_query)\n\n beginning_of_day_date = date.beginning_of_day.to_formatted_s(:db)\n end_of_day_date = date.end_of_day.to_formatted_s(:db)\n\n case comparator\n when '>' # query should return any time after that day (invert for \"days ago\")\n if contains_days_ago?(search_query)\n field.lteq(beginning_of_day_date)\n else\n field.gteq(end_of_day_date)\n end\n when '<' # query should return any time before that day (opposite for the invert)\n if contains_days_ago?(search_query)\n field.gteq(end_of_day_date)\n else\n field.lteq(beginning_of_day_date)\n end\n when '<=' # query should return any time before or within that day (opposite for the invert)\n if contains_days_ago?(search_query)\n field.gteq(beginning_of_day_date)\n else\n field.lteq(end_of_day_date)\n end\n when '>=' # query should return any time after or within that day (opposite for the invert)\n if contains_days_ago?(search_query)\n field.lteq(end_of_day_date)\n else\n field.gteq(beginning_of_day_date)\n end\n when '=' # query should return any time within that day.\n # since the current fields are always datetime so we need to do a\n # BETWEEN check between the beginning and end of the day\n field.between(beginning_of_day_date..end_of_day_date)\n else\n raise ArgumentError, <<-ERROR.strip_heredoc.tr(\"\\n\", ' ')\n Expected :comparison to be '>', '>=', '<', '<=' or '=', but it was\n #{comparison.inspect}\n ERROR\n end\n end", "title": "" }, { "docid": "49b4268a2c1b22f952c7acfa638eb428", "score": "0.48134068", "text": "def projection(key, value)\n unless value.is_a?(Array)\n raise CustomErrors::FilterArgumentError.new(\n \"Projection field list must be an array but instead got #{value.class}\", { key.to_s => value }\n )\n end\n\n if !value.blank? && value.uniq.length != value.length\n raise CustomErrors::FilterArgumentError.new('Must not contain duplicate fields.', { key.to_s => value })\n end\n\n columns = []\n case key\n when :include\n raise CustomErrors::FilterArgumentError, 'Include must contain at least one field.' if value.blank?\n\n columns = value\n when :exclude\n raise CustomErrors::FilterArgumentError, 'Exclude must contain at least one field.' if value.blank?\n\n columns = @render_fields.reject { |item| value.include?(item) }\n raise CustomErrors::FilterArgumentError, 'Exclude must contain at least one field.' if columns.blank?\n else\n raise CustomErrors::FilterArgumentError, \"Unrecognized projection key #{key}.\"\n end\n\n # create projection that includes each column\n\n columns.map { |item|\n project_column(@table, item, allowed_fields)\n }.flatten.compact\n end", "title": "" }, { "docid": "dbd9124c204e90868cbca77e897f74d6", "score": "0.48111954", "text": "def add_filters(fields, operators, values)\n if fields.is_a?(Array) && operators.is_a?(Hash) && (values.nil? || values.is_a?(Hash))\n fields.each do |field|\n add_filter(field, operators[field], values && values[field])\n end\n end\n end", "title": "" }, { "docid": "7ef0d9022534ffa0f4170ed58276f639", "score": "0.4805979", "text": "def typecast(table, field_name, field_value, honor_func=false)\n if @meta_types.has_key?(table)\n\t\t\t\tif @meta_types[table].has_key?(field_name)\n case @meta_types[table][field_name].downcase\n when /int/, /serial/\n if type != 'interval' and type != 'point' # these type are not supported\n if honor_func and field_value.to_s.strip =~ /^\\w+\\(/\n typecast_value = field_value\n else\n typecast_value = field_value.to_i\n end\n else\n typecast_value = field_value.to_s.strip\n end\n when /float/, /double/, /money/, /numeric/, /decimal/\n if honor_func and field_value.to_s.strip =~ /^\\w+\\(/\n typecast_value = field_value\n else\n typecast_value = field_value.to_f\n end\n when /bool/\n if honor_func and field_value.to_s.strip =~ /^\\w+\\(/\n typecast_value = field_value\n else\n typecast_value = field_value.to_b\n end\n when /timestamp/, /date/\n typecast_value = field_value.to_s.strip\n when /var/, /char/, /text/\n typecast_value = field_value.to_s.strip\n else\n typecast_value = field_value.to_s.strip\n end\n else\n # pass through any field not found?\n typecast_value = field_value #raise \"table column, #{field_name}, does not exist\"\n end\n else\n # pass through if table not found?\n typecast_value = field_value #raise \"typecast table, #{table}, does not exist\"\n end\n return typecast_value\n end", "title": "" }, { "docid": "030a9efb86b93d45861cc0ddfdae5c9d", "score": "0.479986", "text": "def with_field(value)\n @query_hash[WITH_FIELD][value] = value\n self\n end", "title": "" }, { "docid": "cadd43bc20ef179306d5c88df8c1c6c8", "score": "0.47980368", "text": "def db_field(q)\n map = {\n :date => 'date(orders.created_at)',\n :q_email => 'orders.email',\n :q_orderid => 'orders.id',\n :q_supplier_order_id => 'orders.supplier_order_id'\n }\n\n map[q] || q\n end", "title": "" }, { "docid": "1dcdd37762ba4f8db9b6ac7cff62c701", "score": "0.4789169", "text": "def mapper(field)\n %Q{\n function() {\n var agg = {\n count: 1,\n max: this.#{field},\n min: this.#{field},\n sum: this.#{field}\n };\n emit(\"#{field}\", agg);\n }}\n end", "title": "" }, { "docid": "04464950a7650e20659ba67a37c07c92", "score": "0.4786833", "text": "def map_field(field) # rubocop:disable Metrics/MethodLength\n return field if field.is_a?(Symbol)\n case field.to_s\n when /Integer|Fixnum|Numeric/ then :integer\n when /BigDecimal|Rational/ then :decimal\n when /Float/ then :float\n when /DateTime/ then :datetime\n when /Date/ then :date\n when /Time/ then :timestamp\n else\n :string\n end\n end", "title": "" }, { "docid": "3a9eb084b88228d76f490465c35f15a1", "score": "0.47834814", "text": "def expression field_name\n value = send(field_name.to_sym)\n value.gsub(/expression=/, \"\")\n end", "title": "" }, { "docid": "0eaa144970812eb0d9e7e536379bda96", "score": "0.4768666", "text": "def get_field_values document, field, field_config, options = {}\n\n case\n when (field_config and field_config.helper_method)\n send(field_config.helper_method, options.merge(:document => document, :field => field))\n when (field_config and field_config.link_to_search)\n link_field = if field_config.link_to_search === true\n field_config.field\n else\n field_config.link_to_search\n end\n\n Array(document.get(field, :sep => nil)).map do |v|\n link_to render_field_value(v), search_action_url(add_facet_params(link_field, v, {}))\n end if field\n when (field_config and field_config.highlight)\n document.highlight_field(field_config.field).map { |x| x.html_safe } if document.has_highlight_field? field_config.field\n else\n document.get(field, :sep => nil) if field\n end\n end", "title": "" }, { "docid": "7ef56844f474368e3289cf04c2ef86b5", "score": "0.4766676", "text": "def get_field_values document, field, field_config, options = {}\n case\n when (field_config and field_config.helper_method)\n send(field_config.helper_method, options.merge(:document => document, :field => field, :field_config => field_config))\n when (field_config and field_config.link_to_search)\n link_field = if field_config.link_to_search === true\n field_config.field\n else\n field_config.link_to_search\n end\n Array(document.get(field, :sep => nil)).map do |v|\n link_to render_field_value(v, field_config), search_action_url(add_facet_params(link_field, v, {}))\n end if field\n when (field_config and field_config.highlight and document.has_highlight_field?(field_config.field))\n document.highlight_field(field_config.field).map { |x| x.html_safe } if document.has_highlight_field? field_config.field\n else\n document.get(field, :sep => nil) if field\n end\n end", "title": "" }, { "docid": "69f5156b6beb72c1b8e0febd019eac78", "score": "0.4750742", "text": "def add_one_expression(field, value)\n unless field.is_a?(String)\n raise ArgumentError, \"Field must be a string: #{field}\"\n end\n\n if field.start_with?('$')\n add_operator_expression(field, value)\n else\n add_field_expression(field, value)\n end\n end", "title": "" }, { "docid": "a8a10079e7c0b8f6740daa2766a6a0be", "score": "0.47491688", "text": "def field\n (@field || @key).andand.to_sym\n end", "title": "" }, { "docid": "fde9ed3b070b2aa15da9beb0586c6dfc", "score": "0.47407055", "text": "def operator_field_value(field_id)\n field = FieldTable.find field_id\n\n # Operator value\n case field_id\n when 1,2,3,4\n @operators = Operator.where(value: 5)\n when 5,6,7,8,9,12,13,14\n @operators = Operator.where(value: [1,2,3,4])\n when 10,11\n @operators = Operator.where(value: [5,6,7,8,9])\n end\n\n # Field value\n model_name = field.model\n model = Object.const_get model_name\n @field_values = model.all\n end", "title": "" }, { "docid": "c76e25dd0ad7bcdbc95fcbf262c5cabc", "score": "0.47333544", "text": "def make_comparable(value, field = nil)\n if Log.debug?\n case value\n when Number, Model, Hash\n Log.debug { \"#{__method__}: ignoring field = #{field.inspect}\" }\n end\n end\n id_fld = field && IDENTIFIER_FIELDS.include?(field)\n case value\n when Number\n value.number_value\n when Model\n make_comparable(value.fields)\n when Hash\n # noinspection RubyMismatchedReturnType\n value.map { |k, v|\n v = make_comparable(v, k)\n [k, v] if v.present?\n }.compact.sort_by! { |kv| kv&.first || '' }.to_h\n when Array\n if id_fld\n value.compact_blank.sort_by! { |v| identifier_sort_key(v) }\n else\n value.map { |v| make_comparable(v, field) }.compact_blank!.sort!\n end\n else\n # noinspection RubyMismatchedReturnType\n id_fld ? value : value.to_s.downcase.gsub(/[[:punct:]]/, ' ').squish\n end\n end", "title": "" }, { "docid": "8fa29c1fb2e04119ac35b5adb2be6f19", "score": "0.4727116", "text": "def field(fieldname, x, y = nil)\n fieldname = fieldname.to_sym\n if(!@register[:fields][fieldname])\n @register[:fields][fieldname] = {bits: nil, vals: {}}\n end\n val_hash = y\n if(x.kind_of? Range)\n @register[:fields][fieldname][:bits] = x\n resort_fields()\n elsif(x.kind_of? Numeric)\n @register[:fields][fieldname][:bits] = x..x\n resort_fields()\n else\n val_hash = x\n end\n \n if(val_hash)\n val_hash.each {|valname, val|\n valname = valname.to_sym\n @register[:fields][fieldname][:vals][valname] = val\n }\n end\n end", "title": "" }, { "docid": "cb724826b173f184d26a0e108f70785e", "score": "0.47237265", "text": "def filter_expr(expr = nil, &block)\n expr = nil if expr == []\n if expr && block\n return SQL::BooleanExpression.new(:AND, filter_expr(expr), filter_expr(block))\n elsif block\n expr = block\n end\n case expr\n when Hash\n SQL::BooleanExpression.from_value_pairs(expr)\n when Array\n if (sexpr = expr.at(0)).is_a?(String)\n SQL::PlaceholderLiteralString.new(sexpr, expr[1..-1], true)\n elsif Sequel.condition_specifier?(expr)\n SQL::BooleanExpression.from_value_pairs(expr)\n else\n SQL::BooleanExpression.new(:AND, *expr.map{|x| filter_expr(x)})\n end\n when Proc\n filter_expr(Sequel.virtual_row(&expr))\n when SQL::NumericExpression, SQL::StringExpression\n raise(Error, \"Invalid SQL Expression type: #{expr.inspect}\") \n when Symbol, SQL::Expression\n expr\n when TrueClass, FalseClass\n SQL::BooleanExpression.new(:NOOP, expr)\n when String\n LiteralString.new(\"(#{expr})\")\n else\n raise(Error, 'Invalid filter argument')\n end\n end", "title": "" }, { "docid": "ce5f15b1cfe8091195bbf8f00d193837", "score": "0.47056666", "text": "def ask_hash(field)\n model.send(\"#{field}=\".to_sym, hv(field))\n end", "title": "" }, { "docid": "fe6ef3546d511bf7065602b96ad738e8", "score": "0.46974152", "text": "def to_sql\n @sql ||= case kind\n\n when :query\n # expressions should be ANDed together\n children.map(&:to_sql).join(\" AND \")\n\n when :unqualified_expression\n eq = Search::LexToken.new(Search::LexToken::EQUAL, \"=\")\n \"(\" + default_qualifiers.map{ |q| comparison(q, eq, children[0]) }.join(' OR ') + \")\"\n\n when :qualified_expression\n # children[2] will be an :rhs token\n \"(\" + comparison(children[0], children[1], children[2]) + \")\"\n\n when :values\n # if first form, 'and' is implicit\n if children[1] && !children[1].is?(:or)\n \"#{children[0].to_sql} AND #{children[1].to_sql}\"\n else\n children.map(&:to_sql).join\n end\n\n else\n children[0].to_sql\n end\n end", "title": "" }, { "docid": "c297a9766878c9ef0b568606b4ee8f1d", "score": "0.46889535", "text": "def transform_query_property(property_name)\n #TODO What do we do with special case fields - the stuff we are keeping at the patient level?\n if ['birthdate'].include?(property_name)\n property_name\n else\n \"measures.#{@measure_id}.#{property_name}\"\n end\n end", "title": "" }, { "docid": "4dd472aa81b0ace4808ff59673f80dbb", "score": "0.4682231", "text": "def sql_where_from_hashes(filters)\n clause=filters.select{|f|!@setup.fields[f[:field].to_s][:aggregate]}.collect{|f| tn=o2m(@setup.fields[f[:field].to_s][:join]); \" #{strip_aliases(tn ? @setup.fields[f[:field].to_s][:sql_phrase].gsub(/#{tn}\\./,\"#{tn}#{f[:field].to_s.split('|')[1]||1}.\").gsub(/#{tn.singularize.titleize}/,\"#{(f[:field].to_s.split('|')[1]||1).to_i.ordinalize} #{tn.singularize.titleize}\") : @setup.fields[f[:field].to_s][:sql_phrase])} #{f[:sign]} ? #{'AND ?' if f[:sign]=='between'}\"}.join(\" AND \")\n values=filters.select{|f|!@setup.fields[f[:field].to_s][:aggregate]}.collect{|f| f[:sign] == 'between' ? f[:value] : f[:value].to_s.downcase == 'true' ? true : f[:value].to_s.downcase == 'false' ? false : \"#{f[:value]}#{'%' if f[:sign]=='like'}\"}\n return clause.nil? || clause.empty? ? \"\" : \" #{User.send(:sanitize_conditions,[clause,values].flatten)} \"\n end", "title": "" }, { "docid": "cec38565573a1caffe5687fa2b819527", "score": "0.46799752", "text": "def sql_value\n \"#{@field} #{@operation} #{@value}\"\n end", "title": "" }, { "docid": "444ba0139a48f7285d0a0afc10560c55", "score": "0.4671751", "text": "def compose_gteq(table, column_name, allowed, value)\n validate_table_column(table, column_name, allowed)\n compose_gteq_node(table[column_name], value)\n end", "title": "" }, { "docid": "db0ae9c9b7882b24fd7a928f62bedb4a", "score": "0.46716964", "text": "def filter_search_field(search_form, field, predicate)\n search_method = \"#{field.name}_#{predicate}\"\n css = \"\"\n css = \"datepicker\" if field.data_type == :date || field.data_type == :datetime\n search_form.search_field search_method.to_sym,\n \"data-field\" => field.name.to_s\n end", "title": "" }, { "docid": "ca7db8f338e38e47b84423c2c3be14e2", "score": "0.46636525", "text": "def filter!(param_name, col_name, operator, val)\n return self unless val\n @params.merge!(param_name => val)\n add_conditions! [{\n key: col_name,\n operator: operator,\n value: \"%{#{param_name}}\"\n }]\n end", "title": "" }, { "docid": "99fd8389b6125a481959633b788e51f6", "score": "0.46618715", "text": "def parse_gen_clause field_spec\n case field_spec\n when AS\n field_spec\n when Symbol\n AS[field_spec, field_spec, field_type(field_spec)];\n when Array\n alias_in, field_in, name, type = field_spec\n name ||= field_in\n type = alias_in.field_type(field_in)\n AS[field_in, name, type, alias_in.relationize]\n when Hash\n field_spec.map do |field_in, field_out|\n AS[field_in, field_out, field_type(field_in)]\n end\n else raise \"Don't know how to specify type for #{field_specs.inspect}\"\n end\n end", "title": "" }, { "docid": "0cf3267625e512a2bcf48af81290ea9b", "score": "0.46484277", "text": "def sql_for_relations(field, operator, value, options={})\n relation_options = IssueRelation::TYPES[field]\n return relation_options unless relation_options\n\n relation_type = field\n join_column, target_join_column = \"issue_from_id\", \"issue_to_id\"\n if relation_options[:reverse] || options[:reverse]\n relation_type = relation_options[:reverse] || relation_type\n join_column, target_join_column = target_join_column, join_column\n end\n\n sql = case operator\n when \"*\", \"!*\"\n op = (operator == \"*\" ? 'IN' : 'NOT IN')\n \"#{Issue.table_name}.id #{op} (SELECT DISTINCT #{IssueRelation.table_name}.#{join_column} FROM #{IssueRelation.table_name} WHERE #{IssueRelation.table_name}.relation_type = '#{self.class.connection.quote_string(relation_type)}')\"\n when \"=\", \"!\"\n op = (operator == \"=\" ? 'IN' : 'NOT IN')\n \"#{Issue.table_name}.id #{op} (SELECT DISTINCT #{IssueRelation.table_name}.#{join_column} FROM #{IssueRelation.table_name} WHERE #{IssueRelation.table_name}.relation_type = '#{self.class.connection.quote_string(relation_type)}' AND #{IssueRelation.table_name}.#{target_join_column} = #{value.first.to_i})\"\n when \"=p\", \"=!p\", \"!p\"\n op = (operator == \"!p\" ? 'NOT IN' : 'IN')\n comp = (operator == \"=!p\" ? '<>' : '=')\n \"#{Issue.table_name}.id #{op} (SELECT DISTINCT #{IssueRelation.table_name}.#{join_column} FROM #{IssueRelation.table_name}, #{Issue.table_name} relissues WHERE #{IssueRelation.table_name}.relation_type = '#{self.class.connection.quote_string(relation_type)}' AND #{IssueRelation.table_name}.#{target_join_column} = relissues.id AND relissues.project_id #{comp} #{value.first.to_i})\"\n end\n\n if relation_options[:sym] == field && !options[:reverse]\n sqls = [sql, sql_for_relations(field, operator, value, :reverse => true)]\n sql = sqls.join([\"!\", \"!*\", \"!p\"].include?(operator) ? \" AND \" : \" OR \")\n end\n \"(#{sql})\"\n end", "title": "" }, { "docid": "f30b9682dc33a3cbf97e5c5ec1d57778", "score": "0.46347424", "text": "def filter_value_to_fq_string(facet_key, value, facet_opts=nil)\n facet_field = table[facet_key]\n facet_config = (Ansr::Arel::ConfiguredField === facet_field) ? facet_field : nil\n facet_default = (::Arel.star == facet_key)\n local_params = local_field_params(facet_key)\n local_params.merge!(facet_opts) if facet_opts\n local_params = local_params.collect {|k,v| \"#{k.to_s}=#{v.to_s}\"}\n local_params << \"tag=#{facet_config.tag}\" if facet_config and facet_config.tag\n\n prefix = \"\"\n prefix = \"{!#{local_params.join(\" \")}}\" unless local_params.empty?\n\n fq = case\n when (facet_config and facet_config.query)\n facet_config.query[value][:fq] if facet_config.query[value]\n when (facet_config and facet_config.date)\n # in solr 3.2+, this could be replaced by a !term query\n \"#{prefix}#{facet_field.name}:#{RSolr.escape(value)}\"\n when (value.is_a?(DateTime) or value.is_a?(Date) or value.is_a?(Time))\n \"#{prefix}#{facet_field.name}:#{RSolr.escape(value.to_time.utc.strftime(\"%Y-%m-%dT%H:%M:%SZ\"))}\"\n when (value.is_a?(TrueClass) or value.is_a?(FalseClass) or value == 'true' or value == 'false'),\n (value.is_a?(Integer) or (value.to_i.to_s == value if value.respond_to? :to_i)),\n (value.is_a?(Float) or (value.to_f.to_s == value if value.respond_to? :to_f))\n \"#{prefix}#{facet_field.name}:#{RSolr.escape(value.to_s)}\"\n when value.is_a?(Range)\n \"#{prefix}#{facet_field.name}:[#{RSolr.escape(value.first.to_s)} TO #{RSolr.escape(value.last.to_s)}]\"\n else\n \"{!term f=#{facet_field.name}#{(\" \" + local_params.join(\" \")) unless local_params.empty?}}#{value}\"\n end\n\n\n end", "title": "" }, { "docid": "da775d5be1500bd80010b0fb9285a84c", "score": "0.46341422", "text": "def make_field( field_name, value )\n\t\treturn '' if value.nil? || (value.is_a?(String) && value.empty?)\n\t\t\n\t\treturn \"; %s=%s\" % [\n\t\t\tfield_name.capitalize,\n\t\t\tvalue\n\t\t]\n\tend", "title": "" }, { "docid": "67b4cb9606ed1d0fe1a1162a013af202", "score": "0.46312842", "text": "def normalize_expression(expression)\n case expression\n when Symbol\n # Take care of symbol notations like :table__column___alias.\n table, column, aliaz =\n Sequel.split_symbol(expression).map { |part| part&.to_sym }\n\n exp = table ? Sequel.qualify(table, column) : column\n exp = Sequel.as(exp, aliaz) if aliaz\n exp\n when Sequel::SQL::Identifier\n # Identifier objects have their uses, but not here, where a symbol is\n # just fine.\n expression.value.to_sym\n when Sequel::SQL::QualifiedIdentifier\n t = expression.table\n c = expression.column\n\n if t.is_a?(Symbol) && c.is_a?(Symbol)\n expression\n else\n Sequel::SQL::QualifiedIdentifier.new(\n normalize_expression(t),\n normalize_expression(c),\n )\n end\n else\n # Other arbitrary expressions can just be passed through.\n expression\n end\n end", "title": "" }, { "docid": "48d53403d8844524ffc3e269c11911ee", "score": "0.46312165", "text": "def create_function_query(expression) #:nodoc:\n if expression.is_a?(Sunspot::Query::FunctionQuery)\n expression\n elsif expression.is_a?(Symbol)\n Sunspot::Query::FieldFunctionQuery.new(@setup.field(expression))\n else\n Sunspot::Query::ConstantFunctionQuery.new(expression)\n end\n end", "title": "" }, { "docid": "a506c7032e615894b4e00d53ab78ab81", "score": "0.46298775", "text": "def get_parameter_field_hash(path_or_query, name, type, required)\n {\n 'in' => path_or_query.to_s,\n 'name' => name.to_s,\n 'schema' => {\n 'type' => type\n },\n 'required' => required\n }\n end", "title": "" }, { "docid": "9fcab76271aab7e457757a49e4a7b060", "score": "0.4616474", "text": "def [](field_name)\n f = field(field_name)\n f && f.value\n end", "title": "" }, { "docid": "cbbcccd797632bb9a1720fdbc6ab801d", "score": "0.46155387", "text": "def process_field(kind, value)\n field = Field.new(match_kind(kind), value.strip)\n return @attributes << field if field.attribute?\n return @fields << field if field.entity?\n return @data << field\n end", "title": "" }, { "docid": "1b23bd81b04668b6b1726ec366ea7680", "score": "0.46087557", "text": "def where(field, value)\n # FIXME\n end", "title": "" }, { "docid": "f8e6ce8fc2f46f396e2f2ca334562bce", "score": "0.459841", "text": "def field_search(field_queries, query)\n return query unless field_check? field_queries\n field_queries.each do |exp|\n sub_query = table[exp[:left]].public_send(exp[:op], exp[:right])\n query = query.try(:and, sub_query) || sub_query\n end\n query\n end", "title": "" }, { "docid": "2869b2c3aa4f245d74a2d4b9b4f9fa98", "score": "0.45950451", "text": "def typed_value_for(key, value)\n fields.key?(key) ? fields[key].mongoize(value) : value.mongoize\n end", "title": "" }, { "docid": "fdf8932b6e2dbb1c365ae7d9f564efb4", "score": "0.4587326", "text": "def update_field field, value\n Formula.new update(\n @ast,\n [ by_type('begin'),\n by_both(\n by_type('send'),\n by_msg(field)),\n by_type('str')],\n -> (n) { n.updated(nil, [value]) })\n end", "title": "" }, { "docid": "48d4ce02e243abba791a903bdfcaed8a", "score": "0.45836914", "text": "def expand_one_condition(field, value)\n kv = field.__expr_part__(value.__expand_complex__, negating?)\n [kv.keys.first.to_s, kv.values.first]\n end", "title": "" }, { "docid": "b1febffd6be99d04fe8a9cf1371d6acd", "score": "0.45772955", "text": "def define_to_field_method(field, options = {})\n method_name = \"#{field}_to_ferret\"\n return if instance_methods.include?(method_name) # already defined\n aaf_configuration[:defined_fields] ||= {}\n aaf_configuration[:defined_fields][field] = options\n dynamic_boost = options[:boost] if options[:boost].is_a?(Symbol)\n via = options[:via] || field\n define_method(method_name.to_sym) do\n val = begin\n content_for_field_name(field, via, dynamic_boost)\n rescue\n logger.warn(\"Error retrieving value for field #{field}: #{$!}\")\n ''\n end\n logger.debug(\"Adding field #{field} with value '#{val}' to index\")\n val\n end\n end", "title": "" } ]
7a4e0b93671432b6acb6da67035c3da8
Remove blank lines and comments ()
[ { "docid": "d518c68916bf365f0dd67a0d9865a0fa", "score": "0.0", "text": "def compress\n delete_if { |l| l =~ /^\\s*$/ || l =~ /^#/ }\n end", "title": "" } ]
[ { "docid": "9f2168014c6fff8c848b160d361e5608", "score": "0.7863325", "text": "def strip_comments_and_newlines(text)\n text.gsub(/(\\/\\*.*?\\*\\/)|\\r\\n|\\n/, \"\") \n end", "title": "" }, { "docid": "f53131b9bf7df83ad7da0e3ab3467edd", "score": "0.76302654", "text": "def remove_empty_lines(source)\n for_outstrings_of(source) do |str|\n str.gsub /\\n\\s*\\n/m, \"\\n\"\n end\n end", "title": "" }, { "docid": "7c02ab4adf599e8425ef53a0759bcd10", "score": "0.74917364", "text": "def strip_comments\n @contents = @contents.gsub(/\\s*!.*$/,'').gsub(/^\\n$/,'')\n end", "title": "" }, { "docid": "c828f1437b40eae3d145abaece77dc12", "score": "0.73648685", "text": "def without_script_comments\n replace_stuff %r'[^\\n]+|\\n', /^\\s*#/ do |x|\n ''\n end\n end", "title": "" }, { "docid": "e78a9cbc58cee6d4a69f8b6b0498deba", "score": "0.73204064", "text": "def strip_comments\n\t\t# removes whole lines only, doesn't remove inline comments\n\t\tcode_to_be_obfu = ''\n\t\t@code.each_line do |line|\n\t\t\tif (not line =~ /^\\s*\\/\\// and not line =~ /^\\s+$/)\n\t\t\t\tcode_to_be_obfu << line \n\t\t\tend\n\t\tend\n\t\treturn code_to_be_obfu\n\tend", "title": "" }, { "docid": "038ae5b54a5ee5a7d9545f6bdb3306c9", "score": "0.7254234", "text": "def strip_js_comments\n regexp = /\\/\\/.*$|(?m:\\/\\*.*?\\*\\/)/\n self.gsub!(regexp, '')\n\n # also remove empty lines\n regexp = /^\\s*\\n/\n self.gsub!(regexp, '')\n end", "title": "" }, { "docid": "038ae5b54a5ee5a7d9545f6bdb3306c9", "score": "0.7254234", "text": "def strip_js_comments\n regexp = /\\/\\/.*$|(?m:\\/\\*.*?\\*\\/)/\n self.gsub!(regexp, '')\n\n # also remove empty lines\n regexp = /^\\s*\\n/\n self.gsub!(regexp, '')\n end", "title": "" }, { "docid": "0b5aec5b14e50422724c1a5f846f6339", "score": "0.7234443", "text": "def remove_blanks(lines)\n lines.shift while RE_BLANK =~ lines.first\n end", "title": "" }, { "docid": "b6d16083bd2012e266fa902750a99df8", "score": "0.72311085", "text": "def strip_comment\n gsub(/#([^{].*\\n)?/, \"\\n\")\n end", "title": "" }, { "docid": "44954891c3959d24ff88527354bab4f2", "score": "0.7196824", "text": "def strip_comments(text)\r\n text.gsub!(/<!--(.*?)-->[\\n]?/m, \"\")\r\n text.gsub!(/<!(.*?)>[\\n]?/m, \"\")\r\n return text\r\n end", "title": "" }, { "docid": "1971d4baf5d911b1d691efe1f097e769", "score": "0.71387213", "text": "def strip_comments(input)\n # ^[ \\t]*(<!--.*?-->)++[ \\t]*\\r?\\n lines with just comments\n # | or\n # <!--.*?--> comments on lines with other content\n #\n # ^ start of line\n # [ \\t]* optional spaces or tabs\n # (<!--.*?-->)++\n # <!-- start of html comment\n # .*? any char, incl linefeed (for multi-line comments)\n # lazy (non-greedy): *?\n # --> end of html comment\n # ++ possessive match - prevents a match across comment boundaries\n # ie: prevent matching this: <!-- a --> keep <!-- b -->\n # explanation: initially .*? will refuse to match --> because it's\n # non-greedy. but, in search of pre/post whitespace, the regex engine\n # could backtrack and ask .*? to match an --> as long as there's\n # another --> later. possessive disables the backtracking.\n # can combine <!-- a --><!-- b --> into one match, which is of no harm.\n # [ \\t]* optional spaces or tabs\n # \\r?\\n end of line (either unix or windows style)\n input.gsub(/^[ \\t]*(<!--.*?-->)++[ \\t]*\\r?\\n|<!--.*?-->/m, '')\n end", "title": "" }, { "docid": "f05cb5b750d3801f301cc66013496477", "score": "0.7128141", "text": "def without_cpp_comments\n replace_stuff CPP_RE, %r'^/[/*]' do |x|\n x.gsub /[^\\n]/, ''\n end\n end", "title": "" }, { "docid": "3a72736f52bea2c691e4bd958d18faf9", "score": "0.71119654", "text": "def strip(lines, clean_space: true)\n\t\t\tout=[]\n\t\t\tlines.each do |line|\n\t\t\t\tline.match(/(.*?)\\#(.*)/) {|m| line=m[1]} #strip comments\n\t\t\t\tline =~ /^\\s*$/ && next #skip blank lines\n\t\t\t\tout << line.gsub(/\\s+/,' ')\n\t\t\tend\n\t\t\treturn out\n\t\tend", "title": "" }, { "docid": "e415cab639caa80a4c68eb61e73b7545", "score": "0.708605", "text": "def empty_with_comments?; end", "title": "" }, { "docid": "e415cab639caa80a4c68eb61e73b7545", "score": "0.7085829", "text": "def empty_with_comments?; end", "title": "" }, { "docid": "962fa3ec8218753656e56506d5d8afdf", "score": "0.7081312", "text": "def remove_boilerplate(s)\n # nuke any line to do with Sabinet and the government printer\n s.gsub(/^.*Sabinet.*Government Printer.*$/i, '')\\\n .gsub(/^.*Provincial Gazette \\d+.*$/i, '')\\\n .gsub(/^.*Provinsiale Koerant \\d+.*$/i, '')\\\n .gsub(/^\\s*\\d+\\s*$/, '')\\\n # get rid of date lines\n .gsub(/^\\d+\\s+\\w+\\s+\\d+$/, '')\\\n # get rid of page number lines\n .gsub(/^\\s*page \\d+( of \\d+)?\\s*\\n/i, '')\n end", "title": "" }, { "docid": "58617414d5a75d600e3d45f2d8995387", "score": "0.70787483", "text": "def remove_empty_lines\n @file_content.tr(\"\\r\\n\",'')\n end", "title": "" }, { "docid": "b0e2cd12a8e37deab6edf613b707da93", "score": "0.7028897", "text": "def removeComments(text)\n # Currently hardcoded for JS comments and the two-space inline convention\n expr = {:line => /^(\\s+)?[\\/\\*]/, :inline => / \\/.+$/}\n return(\n text.reject{|t| t.match?(expr[:line])}.map{|t| t.gsub(expr[:inline], '')}\n )\nend", "title": "" }, { "docid": "0615dc773aeb227c1c6fd8961b6d9572", "score": "0.6996417", "text": "def remove_comments_from_source(source)\n # remove comments (block and line, in three steps to ensure correct precedence)\n source.gsub!(/(?<!\\*)\\/\\/(?:.+\\/\\*|\\*(?:$|[^\\/])).*$/, '') # remove line comments that comment out the start of blocks\n source.gsub!(/\\/\\*.*?\\*\\//m, '') # remove block comments\n source.gsub!(/\\/\\/.*$/, '') # remove line comments (all that remain)\n end", "title": "" }, { "docid": "5920bba0330a756215426750508143f6", "score": "0.69683325", "text": "def non_comment_lines(lines)\n comment = /^\\s*#.*$/\n lines.reject { |line| line.match(comment) }\n end", "title": "" }, { "docid": "73a495b106db96337a0bcd81b95991d5", "score": "0.69479775", "text": "def remove_empty_lines(string)\n string.gsub(/\\n\\s+\\n/, \"\\n\")\n end", "title": "" }, { "docid": "f22a301df2f9645c409815f350cd9a56", "score": "0.69298923", "text": "def strip_comments ruby\n ruby.gsub!(/^[ \\t]*#[^{@$].*?\\r?\\n/, '')\n ruby.gsub!(/[ \\t]*#[^{@$].*?$/, '')\n ruby\n end", "title": "" }, { "docid": "43d6b6a94b57f3417386d5f779096f71", "score": "0.6929371", "text": "def strip_full_line_comments(raw_table_data) #:doc:\n raw_table_data = raw_table_data.split(/\\n/)\n raw_table_data.each_with_index do |row, i|\n if row.first == \";\"\n raw_table_data.delete_at(i)\n else\n raw_table_data[i] = trim_same_line_comments(row)\n end\n end\n raw_table_data.join(\"\\n\")\n end", "title": "" }, { "docid": "ab0def1fcaab8b719ec71677e7793dfe", "score": "0.6901173", "text": "def clean(comment)\n clean = comment.split(\"\\n\").map do |line|\n line =~ /^(\\s*# ?)/ ? line.sub($1, '') : nil\n end.compact.join(\"\\n\")\n clean\n end", "title": "" }, { "docid": "17efbf26bc84d92ca02fffc28d31755c", "score": "0.68950313", "text": "def strip_at_lines_head!(linebreak: $/)\n lb_quo = Regexp.quote linebreak\n gsub!(/(\\A|#{lb_quo})[[:blank:]]+/m, '\\1')\n end", "title": "" }, { "docid": "ebecab98b2e01786bb8ee8b2434a5972", "score": "0.6894151", "text": "def tidy_blank_lines\n (@fragments.size - 1).times do |i|\n if BlankLine === @fragments[i] and ListEnd === @fragments[i+1] then\n @fragments[i], @fragments[i+1] = @fragments[i+1], @fragments[i]\n end\n end\n\n # remove leading blanks\n @fragments.each_with_index do |f, i|\n break unless f.kind_of? BlankLine\n @fragments[i] = nil\n end\n\n @fragments.compact!\n end", "title": "" }, { "docid": "c1e0a60dc36aeb622a4d29cba95bb31c", "score": "0.68910044", "text": "def strip_comments(doc)\n\n\t\tmultiline_comments = /<!--(?:.|([\\r\\n]))*?-->/\n\t\tdoc.gsub!(multiline_comments,'')\n\n\t\tsingle_line_comments = /<!--.*-->/\n\t\treturn doc.gsub(single_line_comments,'')\n\n\tend", "title": "" }, { "docid": "4f6e955db1d4a5fb49d3f104b832d1ae", "score": "0.6863916", "text": "def skip_empty_lines\n @lines.first\n\n first_nonempty_line = @lines.find_index { |line| /[^\\s]/ =~ line }\n remove_consumed_lines(first_nonempty_line || @lines.buffer_size)\n end", "title": "" }, { "docid": "93bd2660eb3f1cbc2306351d70e0f0a5", "score": "0.68419117", "text": "def skip_blank(lines)\n while lines.any? && lines.first.strip.empty?\n lines.shift\n end\n\n nil\n end", "title": "" }, { "docid": "2571662865c89cbea64fd1d1f2a1f51b", "score": "0.68351084", "text": "def strip_comments(doc)\n\t\t# TODO: Add multiline_comments, remembering that they need \n\t\t# replacing with whitespace otherwise we can't track our \n\t\t# position within the doc when searching.\n\t\t# multiline_comments = /\\/\\*(?:.|[\\r\\n])*?\\*\\//\n\t\tsingle_line_comments = /\\/\\/.*$/\t\t\n\t\treturn doc.gsub(single_line_comments,'')\n\tend", "title": "" }, { "docid": "7a50750289ecebe0f9b9e50458465309", "score": "0.6830823", "text": "def remove_empty_head_lines(text)\n return \"\" unless text\n lines = text.split(\"\\n\")\n header = true\n lines.delete_if{ |line|\n header = false if /\\S/ =~ line\n header && /^\\s*?$/ =~ line\n }\n lines.join(\"\\n\")\n end", "title": "" }, { "docid": "e4c760a9aef74d1aa94e4f0b61b65524", "score": "0.68254435", "text": "def strip(comment)\n comment.split(\"\\n\").inject([]) do |new_comment, line|\n if line =~ /(=begin.*|=end)/ || line =~ /^\\s*#+\\s*$/\n # This is fluff\n new_comment\n else\n new_comment << line.gsub(/\\s*#\\s*/, '')\n end\n end.join(\"\\n\")\n end", "title": "" }, { "docid": "13d5066d19acd2fd9d3bfd0498beb1ca", "score": "0.68153024", "text": "def trim_final_newlines; end", "title": "" }, { "docid": "2a55cd9cb5b791399a32d5acd8af9678", "score": "0.6793023", "text": "def strip_empty_lines(code)\n code.squeeze(\"\\n\")\n end", "title": "" }, { "docid": "684e8e663eaa565d4c183117d20f2193", "score": "0.6788685", "text": "def skip_white_space()\n @input.gsub!(/^[^\\S\\r\\n]+/, \"\")\n end", "title": "" }, { "docid": "f337375ea77cf963ac2f4a0f66f165e7", "score": "0.6780888", "text": "def remove_whitespace(oldsource)\n need_newline = false\n source = \"\"\n \n oldsource = oldsource.sub(/^\\n+/, \"\")\n \n oldsource.each_line { |line|\n line = line.strip().gsub(/\\s{2,}|\\t/, \" \")\n \n if line[0] == \"#\"\n if need_newline\n source += \"\\n\"\n end\n \n source += line + \"\\n\"\n need_newline = false\n else\n source += line.sub(\"\\n\", \"\").gsub(/\\s*({|}|=|\\*|,|\\+|\\/|>|<|&|\\||\\[|\\]|\\(|\\)|\\-|!|;)\\s*/, \"\\\\1\")\n need_newline = true\n end\n }\n \n return source.gsub(/\\n+/, \"\\n\")\nend", "title": "" }, { "docid": "c7c404d95cb82925aa0f26f8a2c14787", "score": "0.67465466", "text": "def clean_whitespace\n [:topic,:description,:solution,:reference,:text_only_cpe].each do |key|\n write_attribute(key, read_attribute(key).gsub(\"\\r\\n\",\"\\n\").gsub(/\\n{3,}/,\"\\n\\n\").strip) if read_attribute(key)\n end\n end", "title": "" }, { "docid": "3bf94cbf646ae1d96942a56101f75ede", "score": "0.6735751", "text": "def remove_comments\n\n #Split all lines and put them in an array\n line_array=@text_to_process.split(\"\\n\")\n\n #We assume the line is not part of multi line comments (hence false)\n #The initialization cannot be inside loop, as multiline comments can span among multiple lines\n\n multi_line_type=false\n\n for line in line_array do\n\n #Check if we already a part of multiline comment\n unless multi_line_type==false\n\n #look for a multiline comment\n if line.include?(@confinstance.multi_line[multi_line_type][0])\n multi_line_type=false #the multi line span end here itself\n next #goto next line\n else\n next\n end\n end\n\n #we assume initially we have no single line comments on our way\n single_line_exist=false\n\n #For all single comment type, check if the 'line' begins with any single line comment\n for comment in @confinstance.single_line do\n\n single_comment_length=comment.length\n\n #match the first 'comment.length' characters in line with comment\n prefix=line.slice(0,single_comment_length+1)\n\n #if we have a single line comment in the beginning of the line\n if prefix==comment\n single_line_exist=true\n break # break out!\n end\n\n #for single line comments that start somewhere in mid\n if line.include?(comment)\n line.slice!(line.index(comment),line.length)\n end\n\n end\n\n\n #for all multiline comment types beginning symbols(so keys)\n for comment in @confinstance.multi_line.keys do\n\n multi_comment_length=comment.length\n\n #Remove the leading whitespaces if any...\n line.lstrip!\n\n #match the first 'comment.length' characters in line with comment\n prefix=line.slice(0,multi_comment_length)\n\n #the line is beginning a multiline comment\n if prefix==comment\n multi_line_type=prefix\n end\n end\n\n\n #So if its not a single line comment or part of a multiline comment part we can add it to filtered text\n\n if single_line_exist==false && multi_line_type==false\n @filtered_text << line << \"\\n\"\n end\n\n\n #Check if the end of multicomment is present in the same line somewhere\n unless multi_line_type==false\n\n #look for end of multiline comment\n if line.include?(@confinstance.multi_line[multi_line_type][0])\n multi_line_type=false #the span end in this line itself\n end\n end\n\n end\n\n switch_text\n end", "title": "" }, { "docid": "9b82ba3766487d2921bf5b9a1708bd78", "score": "0.67330194", "text": "def without_xml_comments\n replace_stuff %r'<.*?>|[^<]*', /^<!/ do |x|\n x.gsub(/[^\\n]/, '')\n end\n end", "title": "" }, { "docid": "5828b2e09761af288d528fe1658486c2", "score": "0.6721445", "text": "def strip_comments!\n\t\t@code = strip_comments\n\tend", "title": "" }, { "docid": "5766512c6a1a83613b09f767a93c79b9", "score": "0.6709207", "text": "def clean_lines(text)\n text.split(/\\n/).map {|x| x =~ /^\\s*<%[^=]/ ? x.strip : x.rstrip}.join(\"\\n\").chomp\n end", "title": "" }, { "docid": "bfced092504486e60229d214964f91e8", "score": "0.66849047", "text": "def removeWhitespacesAndComments(node)\n remove = []\n childs = node.childNodes.to_a\n childs.each do |nd|\n case _nodeType(nd)\n when :TEXT\n # TODO: add nil?\n unless %w(i4 i8 int boolean string double dateTime.iso8601 base64).include? node.nodeName\n\n if node.nodeName == \"value\"\n if not node.childNodes.to_a.detect {|n| _nodeType(n) == :ELEMENT}.nil?\n remove << nd if nd.nodeValue.strip == \"\"\n end\n else\n remove << nd if nd.nodeValue.strip == \"\"\n end\n end\n when :COMMENT\n remove << nd\n else\n removeWhitespacesAndComments(nd)\n end\n end\n\n remove.each { |i| node.removeChild(i) }\n end", "title": "" }, { "docid": "2db31575f06cdaf7098153a8a75c3835", "score": "0.6677183", "text": "def rmWhiteSpace!\n return self.gsub!(/\\A\\s*/m, '').gsub!(/\\s*\\Z/m,'')\n end", "title": "" }, { "docid": "6bf16d7e6d751f5ae47d84161ad3815d", "score": "0.6666699", "text": "def remove_comments\n @js.gsub!(%r{\\s+//.*$}, '')\n @js.gsub!(%r{/\\*.*?\\*/}m, '')\n end", "title": "" }, { "docid": "a0c744f2c5fb20ca72684fd71ad880bb", "score": "0.66399425", "text": "def skip_garbage\n next_c = peek\n while true\n if is_whitespace(next_c)\n skip_whitespaces\n elsif next_c == ?;\n skip_comments\n else \n break\n end\n next_c = peek\n end\n end", "title": "" }, { "docid": "7e60e6dd5d18234fb6fed04eaf120020", "score": "0.663881", "text": "def strip_lines\n @file.each { |line| line.strip!}\n end", "title": "" }, { "docid": "9032159dec4283415baf8a69fd88b9fd", "score": "0.66337514", "text": "def remove_comments\n\t\t@js.gsub!(%r{//.*$}, '')\n\t\t@js.gsub!(%r{/\\*.*?\\*/}m, '')\n\tend", "title": "" }, { "docid": "be50a23d7e3ae442097b17337ec976e2", "score": "0.6631517", "text": "def remove_empty_fields!\n lines.delete_if do |x|\n x.raw_value.strip.empty? or (x.respond_to? :values and x.values.join.empty?)\n end\n self\n end", "title": "" }, { "docid": "dafca482a38d8c711791b4a54fd68bdf", "score": "0.6628723", "text": "def without_trailing_whitespace\n lines.map(&:rstrip).join(\"\\n\")\n end", "title": "" }, { "docid": "b12dae5898a81973707ebdb183697e05", "score": "0.6614488", "text": "def remove_comments\n @file_content.gsub(/;.*/, '')\n end", "title": "" }, { "docid": "7eaa555856a7a9273294b9722584eaf2", "score": "0.6591066", "text": "def removeWhitespacesAndComments(node)\n\tremove = []\n\tchilds = node.childNodes.to_a\n\tchilds.each do |nd|\n\t case _nodeType(nd)\n\t when :TEXT\n # TODO: add nil?\n unless %w(i4 int boolean string double dateTime.iso8601 base64).include? node.nodeName\n\n if node.nodeName == \"value\" \n if not node.childNodes.to_a.detect {|n| _nodeType(n) == :ELEMENT}.nil?\n remove << nd if nd.nodeValue.strip == \"\" \n end\n else\n remove << nd if nd.nodeValue.strip == \"\"\n end\n\t end\n\t when :COMMENT\n\t remove << nd\n\t else\n\t removeWhitespacesAndComments(nd)\n\t end \n\tend\n\n\tremove.each { |i| node.removeChild(i) }\n end", "title": "" }, { "docid": "d7696ee81ebd45f4aa12fdc736c38291", "score": "0.65907514", "text": "def cleanup(data)\n data\n .to_s\n .each_line\n .reject { |line| line.start_with?('#') || line.chomp.empty? }\n .uniq\n .sort\n .join\n end", "title": "" }, { "docid": "ae6a6233b333e46124323ff5f002b8bd", "score": "0.65899974", "text": "def remove_line_comments(line)\n line.gsub /\\/\\/.*$/, ''\n end", "title": "" }, { "docid": "cc45a8ea4e9810fcca387fda7fd81739", "score": "0.658803", "text": "def removeComments(lines)\n newLines = []\n multiLineComment = false\n\n for i in 0..lines.size-1\n line = lines[i].split(\" \")\n newLine = []\n for j in 0..line.size-1\n str = line[j]\n\n if str.size > 1 and str[0] == \"/\" and str[1] == \"/\"\n break\n end\n\n if str.size > 1 and str[0] == \"/\" and str[1] == \"*\"\n multiLineComment = true\n end\n\n unless multiLineComment\n newLine.push(str)\n end\n\n if str.size > 1 and str[0] == \"*\" and str[1] == \"/\"\n multiLineComment = false\n end\n end\n\n unless newLine.empty?\n newLines.push(newLine)\n end\n end\n\n return newLines\nend", "title": "" }, { "docid": "d73d69e38f3260c2d4048bddf056e0cc", "score": "0.657384", "text": "def clean_comment (comment)\n return \"\" if comment == nil\n unless (comment == nil || comment.lstrip.empty?) \n comment_without_carriage = comment.gsub(/\\r/,\"\")\n comment_without_carriage = comment_without_carriage.gsub(/\\n/,\" \")\n \n if (comment_without_carriage.size > 1024)\n comment_without_carriage = comment_without_carriage[0,1023]\n end\n return comment_without_carriage\n end\n return comment\n end", "title": "" }, { "docid": "4ebb51692ddb0f8ad82d6a4b1a1c7bc4", "score": "0.65608156", "text": "def process_html_comments (out)\n out.gsub /<!--([ \\t]*?)-->/, ''\n end", "title": "" }, { "docid": "faa00051a4b9bb7d1bf4c7b827b999fd", "score": "0.655992", "text": "def remove_commented_out_lines\n @body.gsub!(%r{//.*rb_define_}, '//')\n end", "title": "" }, { "docid": "8f6eb5ce92923ab9eccdba3b00bab616", "score": "0.655349", "text": "def strip\n Germinate::TextTransforms.strip_blanks.call(self)\n end", "title": "" }, { "docid": "c9e272ad66033a54025031d80eb3517b", "score": "0.6548601", "text": "def strip\n val = super.concat \"\\n\"\n val.strip_comment\n end", "title": "" }, { "docid": "a57f53fbf4adb7c092a91100926a4b50", "score": "0.6546537", "text": "def test_removeblanklines\n runtest('case6')\n\n end", "title": "" }, { "docid": "67e49ad9300a8afa109a1dca98819a11", "score": "0.6537847", "text": "def process_html_comments (out)\n out.gsub /<!--([\\s\\S]*?)-->/, ''\n end", "title": "" }, { "docid": "73a8f2fbff643e11f5a871f2d99121bb", "score": "0.65301055", "text": "def strip_space\n gsub(/:\\s*/, \":\").gsub(/\\n/, \"\").gsub(/\\s+/, \" \").gsub(/(\\/\\*).*?(\\*\\/)/, \"\")\n end", "title": "" }, { "docid": "4821ef04626e0db924c7522ae8ac0b0b", "score": "0.6526734", "text": "def remove_comments(source)\n for_outstrings_of(source) do |str|\n str.gsub! /\\/\\*.*?\\*\\//im, ''\n str\n end\n end", "title": "" }, { "docid": "4588b89e27a3806194c1ed6f40e1ca7a", "score": "0.65207326", "text": "def test_whole_line_single_line_comments\n assert_equal \"1\\n3\\n\", strip_comments(\"1\\n<!-- 2 -->\\n3\\n\"), 'adjacent lines'\n assert_equal \"1\\r\\n3\\r\\n\", strip_comments(\"1\\r\\n<!-- 2 -->\\r\\n3\\r\\n\"), 'adjacent lines w/windows LF'\n assert_equal \"1\\n\\n\\n3\\n\", strip_comments(\"1\\n\\n<!-- 2 -->\\n\\n3\\n\"), 'spaced lines'\n assert_equal \" 1\\n 3\\n\", strip_comments(\" 1\\n <!-- 2 -->\\n 3\\n\"), 'adjacent lines indented w/spaces'\n assert_equal \"\\t1\\n\\t3\\n\", strip_comments(\"\\t1\\n\\t<!-- 2 -->\\n\\t3\\n\"), 'adjacent lines indented w/tabs'\n assert_equal \" 1\\n\\n\\n 3\\n\", strip_comments(\" 1\\n\\n <!-- 2 -->\\n\\n 3\\n\"), 'spaced lines indented w/spaces'\n assert_equal \"1 \\n \\n4\\t\\n\", strip_comments(\"1 \\n \\n<!-- 2 --> \\n<!--3-->\\t\\n4\\t\\n\"), 'spaced lines w/trailing whitespace'\n end", "title": "" }, { "docid": "412d1eaa9e41cc26d4f5c068f5ebfeda", "score": "0.6514347", "text": "def strip_comments(str)\n str.sub(/\\s*\\#.*$/, EMPTY).strip\n end", "title": "" }, { "docid": "d6d91a180e16f463e66d28e187e90e11", "score": "0.64989954", "text": "def remove_whitespace\n self.material = self.material.strip\n self.condition = self.condition.strip\n self.description = self.description.strip\n end", "title": "" }, { "docid": "52f541084219e7da0e6c95bc5800777e", "score": "0.64971024", "text": "def trim_trailing_whitespace; end", "title": "" }, { "docid": "61a7db0d30e586ca824d1a9088fc47a1", "score": "0.6484511", "text": "def compact_blank; end", "title": "" }, { "docid": "61a7db0d30e586ca824d1a9088fc47a1", "score": "0.6484511", "text": "def compact_blank; end", "title": "" }, { "docid": "4421eb21f4e7f878ad2768b46c092ec1", "score": "0.6476269", "text": "def test_shared_line_multi_line_comments\n assert_equal \"14\", strip_comments(\"1<!-- 2\\n3 -->4\"), 'no whitespace'\n assert_equal \"1 4\", strip_comments(\"1 <!-- 2\\n3 --> 4\"), 'with whitespace'\n assert_equal \"1\\n 4\", strip_comments(\"1\\n <!-- 2\\n3 --> 4\"), 'leading whitespace on comment'\n assert_equal \"1 \\n4\", strip_comments(\"1 <!-- 2\\n3 --> \\n4\"), 'trailing whitespace on comment'\n assert_equal \"1 \\n 4\", strip_comments(\"1 \\n<!-- 2\\n3 --> 4\"), 'trailing whitespace on line'\n assert_equal \"1 \\n 4\", strip_comments(\"1 <!-- 2\\n3 -->\\n 4\"), 'leading whitespace on line'\n end", "title": "" }, { "docid": "9391dc5e68b565dfbe955bbf2ca655d2", "score": "0.6463059", "text": "def remove_whitespace\n @diagrams.delete_if {|line| line !~ /\\S/ }.map {|line| line.strip! }\n end", "title": "" }, { "docid": "9bbc1220f2498cfa05f641c08af5cc86", "score": "0.6460813", "text": "def skipSpaceComments(strm)\n while(!strm.eof?()) do\n case (c=strm.getc())\n when (?\\ ) ,(?\\n), (?\\t), (?\\r)\n next ;\n when (?;)\n strm.gets() ;\n else\n strm.ungetc(c) ;\n return TRUE ;\n end\n end\n return FALSE ;\n end", "title": "" }, { "docid": "a620283486007bf43bcb876f1d531c47", "score": "0.6457295", "text": "def skip_whitespace_tokens\n skip_tokens kinds: [:newline, :line_comment, :block_comment]\n self\n end", "title": "" }, { "docid": "9a4a0da68bc6cea971858306db01710e", "score": "0.64518034", "text": "def remove_leading_space(code, regex)\n if code.lines.all? { |line| line =~ /\\A\\r?\\n\\Z/ || line =~ regex }\n code.gsub!(regex) { '' }\n end\n end", "title": "" }, { "docid": "49195d167c7546b941b659cc770a9a1b", "score": "0.6448405", "text": "def strip_comment(line, opts); end", "title": "" }, { "docid": "ca65b43e00eb069656615dd3cc7b864d", "score": "0.64407074", "text": "def remove_leading_space(code, regex)\n if code.lines.all? { |line| line =~ /\\A\\r?\\n\\Z/ || line =~ regex }\n code.gsub!(regex) do\n ''\n end\n end\n end", "title": "" }, { "docid": "86d34b227de5bf9dd17eddce663616d4", "score": "0.6440407", "text": "def non_empty_lines(lines)\n lines.split(/\\n+/).reject(&:empty?)\nend", "title": "" }, { "docid": "a8bc3dcc5325db0c1ee1644e85c313a6", "score": "0.6438496", "text": "def test_method_with_no_leading_whitespace\n comments = self.class.parse_comments(@filename)\n\n assert_equal \"step one<BR/>step two\", comments[tst_case_name][\"steps\"], \"Steps comment didn't match\"\n assert_equal \"Test should pass\", comments[tst_case_name][\"expected\"], \"Expected comment wasn't the default\"\n end", "title": "" }, { "docid": "b59157a0262284c3e4e3697107befb96", "score": "0.6426125", "text": "def clean_code(code)\n code.lines.each_with_object([]) do |line, r|\n next if line =~ /^\\s*(#.*)?$/\n line.gsub!(/^\\s+/, '')\n r << line\n end.join\n end", "title": "" }, { "docid": "0c05d99480eff99238a602997cd0da81", "score": "0.64082265", "text": "def reduce_block_comments\n gsub(/^\\s*\\*\\s+\\*\\s*$/, '') # Get rid of otherwise-empty double asterisk lines\n .gsub(/^\\s*\\/\\*+$/, '') # Get rid of *long* opening block comment lines\n .gsub(/^\\s*\\*+\\/\\s*$/, '') # Get rid of *long* closing block comment lines\n .gsub(/\\n\\n/, ?\\n) # Get rid of double newlines\n .gsub(/^(\\s*)(\\*\\s+.*)\\s+(\\*)\\s*$/, '\\1/\\2\\3/') # Make block comment lines open and close their own comments\n .extend MacNokinpy\n end", "title": "" }, { "docid": "19e09b79c5683867267d2fb11a6c2604", "score": "0.64081216", "text": "def ignoreWhiteSpace\n #Extraccion de espacios, saltos de linea y tabuladores\n @myFile =~ /\\A(\\ |\\s)*/ \n self.skip($&)\n end", "title": "" }, { "docid": "60d826c5b1e360542f3767e240e11e56", "score": "0.6405805", "text": "def drop_comment_portion(text)\n if text.include?('#')\n if text.include?(\"\\0\")\n idx1 = text.index('#')\n idx2 = text.index(\"\\0\", idx1)\n text = text.slice(0, idx1) + text.slice(idx2, text.size)\n\n if text.include?('#')\n drop_comment_portion(text)\n else\n text.gsub(\"\\0\", '')\n end\n else\n text = text.split('#').first&.strip\n text == '' ? nil : text\n end\n else\n text.gsub(\"\\0\", '')\n end\n end", "title": "" }, { "docid": "2f61fa0e1f9e20f09e32b6bcc119ad53", "score": "0.64057714", "text": "def strip_comments(code)\n # strip c-comments\n src = code.gsub(%r%\\s*/\\*.*?\\*/%m, '')\n # strip cpp-comments\n src = src.gsub(%r%^\\s*//.*?\\n%, '')\n src = src.gsub(%r%[ \\t]*//[^\\n]*%, '')\n src\n end", "title": "" }, { "docid": "f80b7b26ffe59de82cad60b4bf864d81", "score": "0.6402394", "text": "def test_intra_line_comments\n assert_equal \"ac\", strip_comments(\"a<!-- b -->c\"), 'no whitespace'\n assert_equal \"\\nac\\n\", strip_comments(\"\\na<!-- b -->c\\n\"), 'no whitespace, with linefeeds'\n assert_equal \"a c\", strip_comments(\"a <!-- b -->c\"), 'left whitespace'\n assert_equal \"a c\", strip_comments(\"a<!-- b --> c\"), 'right whitespace'\n assert_equal \"a c\", strip_comments(\"a <!-- b --> c\"), 'double whitespace'\n assert_equal \"ac\", strip_comments(\"a<!--b-->c\"), 'comment w/o whitespace'\n assert_equal \"a \\nc\", strip_comments(\"a <!-- b -->\\nc\"), 'trailing comment'\n assert_equal \"a\\n c\", strip_comments(\"a\\n<!-- b --> c\"), 'leading comment'\n end", "title": "" }, { "docid": "32540cf0865daf1008f021ee5fa6284f", "score": "0.6402367", "text": "def strip!\n lines = self.to_a\n line_after_heading = false\n in_group = \"\"\n copy = []\n lines.each_with_index do |line, i|\n if line_after_heading == true\n # Insert a blank line before the start of a group\n copy << \"\"\n \n line_after_heading = false\n end\n \n unless line == \"\"\n # Copy the line\n copy << line\n end\n \n in_group = line.match(HEADING_REGEX)\n if in_group\n # Insert a blank line after the end of a group\n copy.insert copy.length-1, \"\" unless i == 0\n line_after_heading = true\n end\n \n end\n \n overwrite(copy)\n end", "title": "" }, { "docid": "0d470b4e53a5abcefb4bd3bd3dccd4f8", "score": "0.639939", "text": "def cleanLines\n newlines = []\n @lines.each { |l|\n # skip comment lines\n if l.strip[0,1] == \"#\"\n next\n end\n parts = l.split\n begin\n parts.collect! { |p| p.to_f}\n newlines.push(parts)\n rescue\n uimessage(\"line ignored: '#{l}'\")\n end\n }\n @lines = newlines\n end", "title": "" }, { "docid": "cd96d82736c87d2d9efe679f9c614748", "score": "0.6399301", "text": "def remove_comments(line) # => line\n line.sub(/(?<!\\\\)#.*$/, '')\n end", "title": "" }, { "docid": "d4b7beec3ad67f59b87d7cd997731cbf", "score": "0.63862246", "text": "def change_verbatim_blank_lines\n frag_block = nil\n blank_count = 0\n @fragments.each_with_index do |frag, i|\n if frag_block.nil?\n frag_block = frag if Verbatim === frag\n else\n case frag\n when Verbatim\n blank_count.times { frag_block.add_text(\"\\n\") }\n blank_count = 0\n frag_block.add_text(frag.txt)\n @fragments[i] = nil # remove out current fragment\n when BlankLine\n if frag_block\n blank_count += 1\n @fragments[i] = nil\n end\n else\n frag_block = nil\n blank_count = 0\n end\n end\n end\n @fragments.compact!\n end", "title": "" }, { "docid": "2bc33ebd8b843539e1b65a22a0fe65ef", "score": "0.63725144", "text": "def scrub(text)\n # One-liners are easy! (One-liners may be buffered with extra newlines.)\n return text.strip if text.strip !~ /\\n/\n excluding_first_line = text.partition(\"\\n\").last\n indent = excluding_first_line.scan(/^[ \\t]*(?=\\S)/).min || '' # prevent nil\n # Clean hanging indent, if any\n if indent.length > 0\n text = text.gsub(/^#{indent}/, '')\n end\n # Clean trailing space\n text.lines.map{|line|line.rstrip}.join(\"\\n\").rstrip\n end", "title": "" }, { "docid": "3afcb09c265bee3b6f820da7e0a00a93", "score": "0.6371746", "text": "def strip_comments(string)\n string.gsub Regexp.new('<!--.*?-->', Regexp::MULTILINE, 'u'), ''\n end", "title": "" }, { "docid": "b4926be4500561fd623f80351bb3a540", "score": "0.6367874", "text": "def remove_comments(script)\n t = []\n script.split(\"\\n\").each do |line|\n if line.match(/\\#/)\n t << line.split('#',2)[0]\n else\n t << line\n end\n end\n t.join(\"\\n\")\nend", "title": "" }, { "docid": "3f8dbf36a4cf2215427393f2b112b8d4", "score": "0.6363372", "text": "def remove_blanks(lines)\n lines.reject!(&:blank?) if lines.is_a?(Array)\n end", "title": "" }, { "docid": "48c290818adb5f5e0512833c1387af1d", "score": "0.6361099", "text": "def clean_release_comment\n gsub(\"\\n\", '').gsub(') (', ', ').gsub('(', '').gsub(')', '')\n end", "title": "" }, { "docid": "0c94129ec3ebeda639bab13eda6c773e", "score": "0.63578427", "text": "def skip_blank_lines\n skipped = 0\n # optimized code for shortest execution path\n while !(next_line = get_line).nil?\n if next_line.chomp.empty?\n skipped += 1\n else\n unshift_line next_line\n break\n end\n end \n\n skipped\n end", "title": "" }, { "docid": "65be74443b0b941164def5758c448119", "score": "0.6351901", "text": "def non_blank_source_lines # => Enumerator\n Enumerator.new do |yielder|\n @source_data.each_with_index do |line, index|\n @line_number = index + 1\n line = remove_comments(line).strip\n yielder.yield line if line.length > 0\n end\n end\n end", "title": "" }, { "docid": "c32e5cf48a5006ef906187d2ef497bc1", "score": "0.63457924", "text": "def strip_whitespace\n self.word = word.strip unless word.nil?\n self.sampa = sampa.strip unless sampa.nil?\n self.comment = comment.strip unless comment.nil?\n end", "title": "" }, { "docid": "dd9764a9fdbc565eccc92908e78d6753", "score": "0.63430697", "text": "def test_whole_line_multi_line_comments\n assert_equal \"1\\n4\\n\", strip_comments(\"1\\n<!-- 2\\n3 -->\\n4\\n\"), 'adjacent lines'\n assert_equal \"1\\n\\n\\n4\\n\", strip_comments(\"1\\n\\n<!-- 2\\n3 -->\\n\\n4\\n\"), 'spaced lines'\n assert_equal \" 1\\n 4\\n\", strip_comments(\" 1\\n <!-- 2\\n 3 -->\\n 4\\n\"), 'adjacent lines indented w/spaces'\n assert_equal \"1 \\n \\n4\\t\\n\", strip_comments(\"1 \\n \\n<!-- 2 \\n3 -->\\t\\n4\\t\\n\"), 'spaced lines w/trailing whitespace'\n end", "title": "" }, { "docid": "d9e4227aecfca86859fad0621cbb9354", "score": "0.6342865", "text": "def lines\n format_raw!.map(&:strip).delete_if { |a| a == \"\" }\n end", "title": "" }, { "docid": "bc9b426b798ac98d6cddc290dd7ecd0f", "score": "0.63397545", "text": "def skip_whitespace_tokens\n skip_tokens kinds: [:newline, :line_comment, :block_comment]\n self\n end", "title": "" }, { "docid": "520bd8f4a79dfa682cfd65f213c6704c", "score": "0.6330068", "text": "def stipWhiteSpace(file)\n\t# instantiate an array that will hold all the characters without comments\n\tnocomments = []\n\t# no comments check\n\tln = 0\n\tfile.each{|f|\n\t\t# instantiate an empty string to hold good characters\n\t\tr = \"\"\n\t\t# if we got the no-comments flag we instantiate flag to hold the number of \n\t\t# sequential occurences of '//' o.w. flag is false\n\t\tflag = 0\n\t\t# iterates through the characters in the line, hanging onto the good ones\n\t\tf.each_char {|char| \n\t\t\t# if the flag is not false i.e. if it is an integer and it is equal to\n\t\t\t# 2, we remove the '//' add a newline, and break. We add a newline \n\t\t\t# since we will be cutting off the newline previously occuring in the \n\t\t\t# line by breaking before getting to the end \n\t\t\tif flag && flag == 2 then r = r[0...-2]; break end\n\t\t\t# if the character is a '/' and flag is not false, increment flag\n\t\t\tflag += char == \"/\" ? 1 : 0 if flag \n\t\t\t# add the character to the return string if it is not a space, a tab, or empty\n\t\t\tr += char if ![\" \",\"\\t\",\"\",\"\\r\",\"\\n\"].any?{|x| char == x}\n\t\t}\n\t\tnext if r == \"\"\n\t\tif commandType(r) == 'L'\n\t\t\tmake_address_from_sym(r.slice(1...r.length-1),ln) if !query_symbol(r.slice(1...r.length-1))\n\t\t\tnext\n\t\tend\n\t\tln += 1\n\t\t# add the string to the output file if it's nonempty / is not just a newline\n\t\tnocomments << r\n\t}\n\treturn nocomments\nend", "title": "" }, { "docid": "502b5ef06cc8f7c434fb2b5715c2c4a0", "score": "0.6326258", "text": "def strip_ct_nl\n self.gsub(%r{[\\t\\r\\n]}, '')\n end", "title": "" } ]
1492b1c4d0456e1ecef06f35ca183ced
Reset the license count (System API)
[ { "docid": "e5d6e30f6819f4c45e98cda8e659e50d", "score": "0.85045177", "text": "def reset_license_count(headers=default_headers)\n @logger.info(\"Resetting License Count\")\n put(\"#{@api_url}/license/reset\", {}, headers)\n end", "title": "" } ]
[ { "docid": "84f48ef14863124d2795c9d1d77e4e2b", "score": "0.62636644", "text": "def reset\n @count = 0\n end", "title": "" }, { "docid": "ca3b02098bde6cd4acccddd4ef58cf72", "score": "0.5940462", "text": "def destroy\n @license.destroy\n end", "title": "" }, { "docid": "c1ee12b64de0d3f431c42083fe8bec77", "score": "0.5921154", "text": "def set_license\n @license = License.find(params[:license_id])\n end", "title": "" }, { "docid": "22fc8ed9c358445fe2c027dbbb8d3de4", "score": "0.58876944", "text": "def reset_counter; end", "title": "" }, { "docid": "31c50d6f9c8770058b91e6bdcf8e1ea3", "score": "0.586336", "text": "def reset\r\n @spend = 0\r\n end", "title": "" }, { "docid": "724aac6bc07d3376aaa24b5b095fbade", "score": "0.58570164", "text": "def clear_cache\n @copyright_status = nil\n end", "title": "" }, { "docid": "8e1c18e5c4050c8eb703c28b2c1ef172", "score": "0.5811034", "text": "def set_license\n @license = License.find(params[:id])\n end", "title": "" }, { "docid": "8e1c18e5c4050c8eb703c28b2c1ef172", "score": "0.5811034", "text": "def set_license\n @license = License.find(params[:id])\n end", "title": "" }, { "docid": "8e1c18e5c4050c8eb703c28b2c1ef172", "score": "0.5811034", "text": "def set_license\n @license = License.find(params[:id])\n end", "title": "" }, { "docid": "a33893be84e3534246898675a17d1e91", "score": "0.5798956", "text": "def license=(o)\n self.licenses = [o]\n end", "title": "" }, { "docid": "0252a6f89b04a2d251b6cc7e5e1de8e4", "score": "0.57590806", "text": "def license=(value)\n @license = value\n end", "title": "" }, { "docid": "d59986c6c1ba7813881d9ed5a4a32245", "score": "0.57142824", "text": "def reset!()\n @major_version = TAC_PLUS_MAJOR_VER\n @minor_version = TAC_PLUS_MINOR_VER_DEFAULT\n @type = 0\n @seq_no = 1\n @flags = 0\n @session_id = 0\n @length = 0\n return(nil)\n end", "title": "" }, { "docid": "d803585ce05ee1b520429b28bbaed0c6", "score": "0.5696994", "text": "def remove_licenses=(value)\n @remove_licenses = value\n end", "title": "" }, { "docid": "2a261cbbea0e265b90202ea62e45f07b", "score": "0.567814", "text": "def dec_manufacturer_count\n if !self.is_stub? && self.manufacturer.present?\n self.manufacturer.update_attribute :products_count, self.manufacturer.products_count -= 1\n end\n end", "title": "" }, { "docid": "63a809d62a9e43da8e9b4525bcb34b2a", "score": "0.56566644", "text": "def set_license\n @license = License.find(params[:id])\n end", "title": "" }, { "docid": "da4192a4e0e81512d1f3ea55c69aaacf", "score": "0.56303346", "text": "def private_reset!\n @balance = 0\n end", "title": "" }, { "docid": "b8ec2526653b11f81d71c3664c230034", "score": "0.561575", "text": "def licenses=(licenses)\n @licenses = Array licenses\n end", "title": "" }, { "docid": "f0243fe6c2539f722c7174f8e46bbb7d", "score": "0.5580947", "text": "def set_number_available(count)\n @number_available = count unless @number_available\n end", "title": "" }, { "docid": "1ff34605d8c10f754f49880f6fbc73fe", "score": "0.55438286", "text": "def set_license\n License.where(name: params[:name]).exists? ? @license = License.find_by(name: params[:name]) : @license = License.find(params[:name])\n end", "title": "" }, { "docid": "9f8eaad6dbd91d739b33d94456d85060", "score": "0.5537983", "text": "def reset_rate\n @rate = 500\n end", "title": "" }, { "docid": "b7391a7fd4866f644fadd59f9ff4725d", "score": "0.5514331", "text": "def reset\n @count = @options[:start]\n end", "title": "" }, { "docid": "bf9acef98938f0fab203d2dd02e14131", "score": "0.5484235", "text": "def reset\n\t\tdo_send('ARST 2')\n\tend", "title": "" }, { "docid": "4845bed15ed6d3c69e77162f51b40675", "score": "0.54814047", "text": "def reset_usage!\n @usage.reset!\n end", "title": "" }, { "docid": "f069216f0b5f2c8b16161f6cdf722ba3", "score": "0.54693294", "text": "def update!(**args)\n @cc_license = args[:cc_license] if args.key?(:cc_license)\n end", "title": "" }, { "docid": "f03438f5b126ef7b8b7bf46a7817265b", "score": "0.5435407", "text": "def licenses=(new_licenses)\n @licenses = new_licenses\n end", "title": "" }, { "docid": "91ae8fdd02b5bf87a1136a7f1bd99e60", "score": "0.53922653", "text": "def clear_auth_count\n @auth_count = 0\n end", "title": "" }, { "docid": "6e5a1d549dc5d45b6d76e4159f427c49", "score": "0.5386476", "text": "def reset\n @value = nil\n @count = 0\n end", "title": "" }, { "docid": "cdc623bb3d64e8e5d01230027b265a08", "score": "0.5372724", "text": "def initialize_account\n self.credits = 0\n end", "title": "" }, { "docid": "f888d3db638f88c5e202a679a5670565", "score": "0.5365298", "text": "def reset\n @number = nil\n end", "title": "" }, { "docid": "da5a915f9b01c96482ccc4fcf01a5c50", "score": "0.53493464", "text": "def subscriptions_reset\n self.subscriptions = Subscription.defaults\n end", "title": "" }, { "docid": "25e19d1f23e0103fc02e47796428cf17", "score": "0.5341432", "text": "def set_license_result\n @license_result = LicenseResult.find(params[:id])\n end", "title": "" }, { "docid": "4c34545b1f12941cbf184b8ca2f7dd7d", "score": "0.53301203", "text": "def reset\n @crc = @init_crc\n end", "title": "" }, { "docid": "9bb33a5c774d1cb84b5036bd721a06b1", "score": "0.5320365", "text": "def licenses\n @licenses ||= []\n end", "title": "" }, { "docid": "1f0ce6226110064c8187ad7380cbfaa4", "score": "0.5318494", "text": "def reset!\n self.password_cost = 9\n end", "title": "" }, { "docid": "12ac7c0f67b29f06a45042207fdbffe5", "score": "0.5306077", "text": "def reset\n end", "title": "" }, { "docid": "12ac7c0f67b29f06a45042207fdbffe5", "score": "0.5306077", "text": "def reset\n end", "title": "" }, { "docid": "12ac7c0f67b29f06a45042207fdbffe5", "score": "0.5306077", "text": "def reset\n end", "title": "" }, { "docid": "12ac7c0f67b29f06a45042207fdbffe5", "score": "0.5306077", "text": "def reset\n end", "title": "" }, { "docid": "d5d4ccca8eba447310a20dc0e5769208", "score": "0.52998286", "text": "def reset(value=0)\n @counter = value.to_i\n end", "title": "" }, { "docid": "64de579b82b01469905be62b80a3cd4a", "score": "0.5297967", "text": "def reset_counter\n @run_count = 0\n end", "title": "" }, { "docid": "29bf4204e61ee325176a4eae7a4af8de", "score": "0.5296496", "text": "def reset\n\n end", "title": "" }, { "docid": "d2c14df46cef0bb2141b95088dddd003", "score": "0.52820325", "text": "def reset; end", "title": "" }, { "docid": "d2c14df46cef0bb2141b95088dddd003", "score": "0.52820325", "text": "def reset; end", "title": "" }, { "docid": "d2c14df46cef0bb2141b95088dddd003", "score": "0.52820325", "text": "def reset; end", "title": "" }, { "docid": "d2c14df46cef0bb2141b95088dddd003", "score": "0.52820325", "text": "def reset; end", "title": "" }, { "docid": "d2c14df46cef0bb2141b95088dddd003", "score": "0.52820325", "text": "def reset; end", "title": "" }, { "docid": "d2c14df46cef0bb2141b95088dddd003", "score": "0.52820325", "text": "def reset; end", "title": "" }, { "docid": "d2c14df46cef0bb2141b95088dddd003", "score": "0.52820325", "text": "def reset; end", "title": "" }, { "docid": "d2c14df46cef0bb2141b95088dddd003", "score": "0.52820325", "text": "def reset; end", "title": "" }, { "docid": "d2c14df46cef0bb2141b95088dddd003", "score": "0.52820325", "text": "def reset; end", "title": "" }, { "docid": "d2c14df46cef0bb2141b95088dddd003", "score": "0.52820325", "text": "def reset; end", "title": "" }, { "docid": "d2c14df46cef0bb2141b95088dddd003", "score": "0.52820325", "text": "def reset; end", "title": "" }, { "docid": "d2c14df46cef0bb2141b95088dddd003", "score": "0.52820325", "text": "def reset; end", "title": "" }, { "docid": "d2c14df46cef0bb2141b95088dddd003", "score": "0.52820325", "text": "def reset; end", "title": "" }, { "docid": "d2c14df46cef0bb2141b95088dddd003", "score": "0.52820325", "text": "def reset; end", "title": "" }, { "docid": "d2c14df46cef0bb2141b95088dddd003", "score": "0.52820325", "text": "def reset; end", "title": "" }, { "docid": "d2c14df46cef0bb2141b95088dddd003", "score": "0.52820325", "text": "def reset; end", "title": "" }, { "docid": "d2c14df46cef0bb2141b95088dddd003", "score": "0.52820325", "text": "def reset; end", "title": "" }, { "docid": "d2c14df46cef0bb2141b95088dddd003", "score": "0.52820325", "text": "def reset; end", "title": "" }, { "docid": "7a20b0a85a1f3d2c76a2345756f2f27d", "score": "0.52814287", "text": "def reset\n write(SYSTEM_RESET)\n end", "title": "" }, { "docid": "2beca871c87661c3db4963ccc4b2ad34", "score": "0.52805555", "text": "def reset_password_reset_page_access_counter\n send(:\"#{sorcery_config.reset_password_page_access_count_attribute_name}=\", 0)\n sorcery_adapter.save\n end", "title": "" }, { "docid": "cf0f38b880709f5df7a38dce392befb1", "score": "0.5279619", "text": "def reset\n end", "title": "" }, { "docid": "cf0f38b880709f5df7a38dce392befb1", "score": "0.5279619", "text": "def reset\n end", "title": "" }, { "docid": "6f7ee80c59047f567e6eef8113eb9ba0", "score": "0.52785146", "text": "def reset_money\n @total_rat_money = 0\n\n set_kmuddy_variable(\"total_rat_money\", 0)\n\n @inventory_rats = 0\n\n set_kmuddy_variable(\"current_rat_count\", 0)\n send_kmuddy_command(\"put sovereigns in pack\")\n end", "title": "" }, { "docid": "8b81a548e8ddf15eb038fe5e43b43100", "score": "0.52719283", "text": "def reset\n @lp.reset\n @lp.set_duty_cycle(1, 4)\n @lp.double_buffer = true\n @lp.offline_updates = true\n clear\n end", "title": "" }, { "docid": "93f437f3bb08edc3159a572d76960411", "score": "0.526423", "text": "def reset ; end", "title": "" }, { "docid": "3bb18cb92f509f20113e943b0191a016", "score": "0.5254242", "text": "def reset_password_reset_page_access_counter\n send(\n :\"#{sorcery_config.reset_password_page_access_count_attr_name}=\", 0\n )\n sorcery_adapter.save\n end", "title": "" }, { "docid": "ba67786be1333f2bc8c15b10b1e674b1", "score": "0.52401626", "text": "def reset\n\t\tend", "title": "" }, { "docid": "098fc0478eeafa530299fc236d4e6cfd", "score": "0.5236412", "text": "def reset\n \n end", "title": "" }, { "docid": "d12681a2c2d04896411d09d5e82b5eb7", "score": "0.523528", "text": "def licenses=(licenses)\n @licenses = [licenses].flatten\n end", "title": "" }, { "docid": "612f7c17a036e3e5bcc5644589bd6bfb", "score": "0.5233765", "text": "def reset\n @client = nil\n end", "title": "" }, { "docid": "37cbca51faf1e40ce358d1aa829651df", "score": "0.52279323", "text": "def license_updater\n # Process any changes.\n process_license_changes if request.method == \"POST\"\n\n # Gather data for form.\n @data = Image.connection.select_all(%(\n SELECT COUNT(*) AS license_count, copyright_holder, license_id\n FROM images\n WHERE user_id = #{@user.id.to_i}\n GROUP BY copyright_holder, license_id\n )).to_a\n @data.each do |datum|\n next unless (license = License.safe_find(datum[\"license_id\"].to_i))\n\n datum[\"license_name\"] = license.display_name\n datum[\"licenses\"] = License.current_names_and_ids(license)\n end\n end", "title": "" }, { "docid": "0302b56fc356481bf0120ac9567e8fcd", "score": "0.5226473", "text": "def set_prepaid\n credit = 0\n postpaid = 0\n end", "title": "" }, { "docid": "4b31745de03adea764ea4eb4f0d47c09", "score": "0.5224749", "text": "def reset!\n end", "title": "" }, { "docid": "4b31745de03adea764ea4eb4f0d47c09", "score": "0.5224749", "text": "def reset!\n end", "title": "" }, { "docid": "b794200e94ae72ad0a41f662e805f567", "score": "0.5224389", "text": "def reset()\n \n end", "title": "" }, { "docid": "0254f7713beae4039e005d57310b661b", "score": "0.52192", "text": "def reset!\n client.reset!\n end", "title": "" }, { "docid": "24fce95e9c8c2d928fa8d64599f9c553", "score": "0.5214841", "text": "def remove_licenses\n return @remove_licenses\n end", "title": "" }, { "docid": "16e7263732d2522aa71dff263cebe964", "score": "0.52072203", "text": "def reset()\n end", "title": "" }, { "docid": "416b840132cd0b3d6ad06a7b5a026f25", "score": "0.52068776", "text": "def reset\n # TODO\n end", "title": "" }, { "docid": "2064dc79965cdd0af12bfd8cd5d96fc5", "score": "0.5200723", "text": "def reset\n end", "title": "" }, { "docid": "2064dc79965cdd0af12bfd8cd5d96fc5", "score": "0.5200723", "text": "def reset\n end", "title": "" }, { "docid": "aa55795959ae5eb4af049616a71e7a10", "score": "0.5195842", "text": "def reset() end", "title": "" }, { "docid": "184a0950909a31a88127bcada91ce547", "score": "0.5190347", "text": "def reset!; end", "title": "" }, { "docid": "184a0950909a31a88127bcada91ce547", "score": "0.5190347", "text": "def reset!; end", "title": "" }, { "docid": "184a0950909a31a88127bcada91ce547", "score": "0.5190347", "text": "def reset!; end", "title": "" }, { "docid": "184a0950909a31a88127bcada91ce547", "score": "0.5190347", "text": "def reset!; end", "title": "" }, { "docid": "fcafc30a1a609a5fb983143fbaba3dce", "score": "0.51726955", "text": "def reset!\n @loaded_softwares = nil\n end", "title": "" }, { "docid": "82f69dfbdd772cdca8d0f54bac95bab3", "score": "0.5166541", "text": "def reset\n @gold_coins = 0\n @health_points = 10\n @lives = 5\n end", "title": "" }, { "docid": "fee6e52c1caa79866d0ffcd4c4c168ee", "score": "0.51537466", "text": "def reset()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "title": "" }, { "docid": "7645a99bd008c28a73188fc4d19bf90e", "score": "0.5149778", "text": "def inc_manufacturer_count\n if !self.is_stub? && self.manufacturer.present?\n self.manufacturer.update_attribute :products_count, self.manufacturer.products_count += 1\n end\n end", "title": "" }, { "docid": "1eecbe432c64953ebe5308f967d4ddb6", "score": "0.5148449", "text": "def reset\n self.cpus = 1\n self.ram = 512\n self.video_ram = 18\n self.hardware_id = UUID.generate\n\n self.os = :other \n self.pae = false\n self.acpi = true\n self.io_apic = false\n \n self.hardware_virtualization = true\n self.nested_paging = true\n self.tagged_tlb = true\n self.accelerate_3d = false\n \n self.efi = false\n self.bios_logo_fade_in = false \n self.bios_logo_fade_out = false\n self.bios_logo_display_time = 0\n self.bios_boot_menu = false\n \n self.boot_order = [:disk, :net, :dvd]\n \n self.audio = false\n self\n end", "title": "" }, { "docid": "2351b80cde768122f6a918f8c6d19fae", "score": "0.51462173", "text": "def reset\n\t\tself.rs \t= 0\n\t\tself.ps \t= 0\n\t\tself.ss \t= 0\n\t\tself.gen\t= Random.new(SEED)\n\tend", "title": "" }, { "docid": "33e9fdd88f4cb40da5f8992c38072f4a", "score": "0.5137887", "text": "def revoke!\n self.revoked = Time.now.to_i\n AccessToken.collection.update({ :_id=>token }, { :$set=>{ :revoked=>revoked } })\n Client.collection.update({ :_id=>client_id }, { :$inc=>{ :tokens_revoked=>1 } })\n end", "title": "" }, { "docid": "33e9fdd88f4cb40da5f8992c38072f4a", "score": "0.5137887", "text": "def revoke!\n self.revoked = Time.now.to_i\n AccessToken.collection.update({ :_id=>token }, { :$set=>{ :revoked=>revoked } })\n Client.collection.update({ :_id=>client_id }, { :$inc=>{ :tokens_revoked=>1 } })\n end", "title": "" }, { "docid": "4d68f067aea8587e2dbb21151a6b4df6", "score": "0.5124452", "text": "def reset!\n @products = []\n end", "title": "" }, { "docid": "4d68f067aea8587e2dbb21151a6b4df6", "score": "0.5124452", "text": "def reset!\n @products = []\n end", "title": "" }, { "docid": "204138c2301cab9316e022a6f48ce966", "score": "0.5123668", "text": "def set_distributor_license\n @distributor_license = DistributorLicense.find(params[:id])\n end", "title": "" }, { "docid": "2f13bf45529d649283da6c8ef0b50012", "score": "0.51168096", "text": "def revoke\r\n @fund -= 15\r\n puts \"Project #{@name} pissed someone off, and they revoked their donation.\"\r\nend", "title": "" }, { "docid": "4eba76408d4c7bcf1ed43e01cbc3e75f", "score": "0.511595", "text": "def reset\n @project = nil\n @total_coverage = nil\n @all_modified_files_coverage = nil\n end", "title": "" } ]
e2999c934ed8975dc2b1ab5615f35aa6
end JOB CREATE JOB DETAIL
[ { "docid": "466904a8eac14ff41434f038241aa936", "score": "0.0", "text": "def distance_from_user(user)\n return \"Unavailable\" unless user && user.latitude && self.latitude\n distance = distance_from([user.latitude, user.longitude])\n value = distance.to_s[0..3] if distance >= 1000\n value = distance.to_s[0..2] if distance >= 100\n value = distance.to_s[0..1] if distance >= 10\n value = distance.to_s[0..2] if distance < 10\n value = 0 if distance == 0\n ActionController::Base.helpers.pluralize(value, 'mile')\n end", "title": "" } ]
[ { "docid": "c03049b055e02f76ea9cb1e66d3b6370", "score": "0.6953204", "text": "def create_job\n\n end", "title": "" }, { "docid": "63155aae69c18fd47c7f9efc4e5a3e69", "score": "0.6619196", "text": "def create\n\t\t@job = @resume.jobs.new({\n\t\t\t:title\t\t\t=> 'Job Title',\n\t\t\t:company\t\t=> 'Company',\n\t\t\t:location\t => 'Location',\n\t\t\t:description => 'Description',\n\t\t\t:start_date_string => Date.today.to_s,\n\t\t\t:end_date_string\t => Date.today.to_s\n\t\t})\n\t\t@job.save!\n\trescue\n\t\tflash.now[:error] = 'Job creation FAILED!'\n\t\trender :text => ''\n\tend", "title": "" }, { "docid": "dc39417344b95ac6570f7453071ad4d2", "score": "0.6451755", "text": "def add_job_detail\n\t\tJobDetail.create(person_id: self.id, start_date: DateTime.now.to_date)\n\tend", "title": "" }, { "docid": "ca4b18591847d53af1b58c39dfc5da0d", "score": "0.6407063", "text": "def new\n # puts \"ejecutando accion gui/new\"\n \n @current_job_id=params[:job_id] ||= 0\n \n get_current_stage(params)\n #puts \"NEW\"+@current_stage\n end", "title": "" }, { "docid": "6aeb5635558b22c7ee0e746a098c1a52", "score": "0.63926625", "text": "def job_name; end", "title": "" }, { "docid": "6aeb5635558b22c7ee0e746a098c1a52", "score": "0.63926625", "text": "def job_name; end", "title": "" }, { "docid": "e0b888e000debfee8b204a2b1622bf60", "score": "0.62869525", "text": "def create\n if params[:jobid]\n @job = Job.find_by_runid(params[:jobid])\n unless @job\n env = Environment.find_by_name(params[:environment_name])\n req = env.erequests.create!(:user => User.first, :command => 'start')\n @job = req.jobs.create\n @job.environment_name = env.name\n end\n list = List.find_by_name(params[:list_name])\n @job.start_time = params[:start_time]\n @job.end_time = params[:end_time]\n @job.runid = params[:jobid]\n @job.is_results_final = true\n @job.list = list\n @job.list_name = list.name\n if params[:machine]\n @job.machine = Machine.find_by_nickname(params[:machine])\n else\n @job.machine = Machine.first\n end\n @job.process_oats_results_info(params)\n @job.process_oats_results_info(params)\n end\n respond_with(@job)\n end", "title": "" }, { "docid": "687949c2ffbf7bfff65441dc1a51eb35", "score": "0.61802596", "text": "def job_created(job)\n if job.job_type == Construction::Job::TYPE_CREATE && self.empty?\n self.building_id = job.building_id\n self.level = 0\n self.save\n end\n end", "title": "" }, { "docid": "ccad7ed5a34641f2b299f1d9cb37dcd5", "score": "0.61562943", "text": "def admin_create\n param = job_params\n industry = param[:ind]\n param.delete(:ind)\n @job = Job.new(param)\n @job.client = current_client\n @job.industryjob.new(industry: Industry.find_by_id(industry))\n respond_to do |format|\n if @job.save\n format.html { redirect_to admin_jobs_show_path(@job), notice: 'The job opportunity was successfully created.' }\n else\n format.html { render :admin_new }\n end\n end\n end", "title": "" }, { "docid": "ef868e0beed3b5b67feb90128c6d8009", "score": "0.61021787", "text": "def prepare_job\n if @job_condition\n @job = Job.new\n @job_index = @job_index\n parse_values(\"JOB\", @job)\n @job.guid_number= parse(\"guid_number\")\n @job = update_job @job\n @jobs << @job\n end\n end", "title": "" }, { "docid": "6b80ff6ba92abfe5ebd935ea5651396b", "score": "0.6072816", "text": "def new_job(event) \n # Get a job from the factory - Quartz calls #execute(context) on this \n event.get_job_detail.job \n end", "title": "" }, { "docid": "e5e9440fe9c3d4c9b503e5aa3df3cd4a", "score": "0.6043287", "text": "def destroy_job\n logger.info '** AccountingPlan destroy_job start'\n destroy\n logger.info \"** AccountingPlan destroy_job finnish\"\n end", "title": "" }, { "docid": "d78729684eb13f3f12195fff54cfe1ef", "score": "0.6012816", "text": "def create_job\n job_workflow = restore_workflow_object(session[:workflow])\n @job = job_workflow.job.decorate\n respond_to do |format|\n if @job.save\n job_workflow.save!(session[:workflow])\n format.html { redirect_to workflow_link(job_workflow), notice: current_client ? 'The job opportunity was successfully created.' : flash[:notice] }\n else\n format.html { render :new }\n end\n end\n end", "title": "" }, { "docid": "0edd86bacd0386ab916047d97023c30c", "score": "0.59787726", "text": "def complete_job\r\n @eobs = @job.eob_qas\r\n @eobs.each do |eob|\r\n if eob.prev_status != \"old\"\r\n EobReport.create(:verify_time => eob.time_of_rejection , :processor => @job.processor_id, :accuracy => eob.accuracy,\r\n :qa => @current_user.id, :batch_date => @job.batch.date, :total_fields => eob.total_fields,\r\n :incorrect_fields => eob.total_incorrect_fields, :error_type => eob.eob_error.error_type, :error_severity => eob.eob_error.severity,\r\n :error_code => eob.eob_error.code, :status => eob.status, :payer => eob.payer )\r\n end\r\n eob.prev_status = \"old\"\r\n eob.save\r\n end\r\n end", "title": "" }, { "docid": "3e5a77dd1b28e96cc2329021323ee9ba", "score": "0.59466344", "text": "def create\n\t\t@job = Job.new(job_params)\n\t\t@job.user_id = @current_user.id\n\t\t@job.enquiry_date = DateTime.now() if @job.enquiry_date.blank?\n\n\t\tif @job.save\n\t\t\t# Add tasks later - when changing status\n\t\t\t#@job.add_tasks @current_user.id\n\t\t\tif params[:contact_type] && !params[:contact_type].blank?\n\t\t\t\tredirect_to new_contact_path(:job => @job, :contact_type => params[:contact_type])\n\t\t\telse\n\t\t\t\tredirect_to @job, notice: 'Job was successfully created.'\n\t\t\tend\n\t\telse\n\t\t\trender action: 'new'\n\t\tend\n\tend", "title": "" }, { "docid": "f4c6fb0d0aa1cbc86213a9a08ddc7a77", "score": "0.5945358", "text": "def create_job(job_fail_act, job_type, parameter, optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'CreateJob'\n\t\targs[:query]['JobFailAct'] = job_fail_act\n\t\targs[:query]['JobType'] = job_type\n\t\targs[:query]['Parameter'] = parameter\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :job_name\n\t\t\targs[:query]['JobName'] = optional[:job_name]\n\t\tend\n\t\tself.run(args)\n\tend", "title": "" }, { "docid": "68e32fb3bb93b1bf4a8c3787488492ae", "score": "0.5941714", "text": "def create\n #@job_detail = JobDetail.new(params[:job_detail])\n\n respond_to do |format|\n if @job_detail.save\n format.html { redirect_to @job_detail, notice: 'Job detail was successfully created.' }\n format.json { render json: @job_detail, status: :created, location: @job_detail }\n else\n format.html { render action: \"new\" }\n format.json { render json: @job_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d6c4448c46ce614e5a0f1a57fe2ea60c", "score": "0.5932333", "text": "def new_job\n @owner = Owner.find_by_name(params[:owner_name])\n @logger = Partner.find_by_name(params[:logger_name])\n @trucker = Partner.find_by_name(params[:trucker_name])\n \n @job = Job.create(:name => params[:job_name], :owner_id => @owner.id, :hfi_rate => params[:hfi_rate], :hfi_prime => params[:hfi_prime])\n LoggerAssignment.create(:job_id => @job.id, :partner_id => @trucker.id, :pays_to_trucker => false)\n TruckerAssignment.create(:job_id => @job.id, :partner_id => @trucker.id)\n \n @content_type = 1\n render \"new_whatever.js.erb\"\n end", "title": "" }, { "docid": "50dbd7f742a99436cb67abf01f05d79f", "score": "0.5926496", "text": "def test_job_request\n sketch = handle_active('job', {'name'=> 'new-job'})\n assert(@active_session.jobs.has_key?('new-job'))\n assert_equal(MainPageSketch, sketch.class)\n assert_equal(green_p(\"Job 'new-job' created.\"),\n sketch.last_results_xhtml)\n end", "title": "" }, { "docid": "c5d8c358d4c839ff37ba8e533ce78e80", "score": "0.59256524", "text": "def job?; end", "title": "" }, { "docid": "de4217b86e47aa951d7303c0928aaf42", "score": "0.5881434", "text": "def create\n create_job_with job_params\n end", "title": "" }, { "docid": "01b65f43086b9ea33b49e2c9f7f3dc74", "score": "0.58708656", "text": "def create\n\n @job = Job.new(job_params)\n @job.optional_services = params[:job][:optional_services][0].split(' ')\n @job.status = \"created\"\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to @job, notice: t('.job_created') }\n format.json { render :show, status: :created, location: @job }\n else\n init_categories\n format.html { render :new }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "13c5f2ccb68605adc8cb41d928b212f1", "score": "0.5857328", "text": "def create\n # job type affects who can create jobs\n if !session[:type].nil?\n type = session[:type]\n else\n type = params[:job][:type]\n end\n\n \n # here, the user must be found and their account determined. Then, before going any\n # further, expiry then credits can be checked. Re-direct to job listing with appropriate\n # flash, or give a plain text error message otherwise\n account = Account.first(:users => current_user.id)\n # expiry\n if Time.now - (60 * 60 * 24) > Date.strptime(account.expiry[type], \"%d/%M/%Y\")\n flash[:alert] = \"Your account has expired. Please contact the administrator to re-instate it\"\n redirect_to :jobs and return\n end\n if account.credits[type].to_i <= 0 and account.arrears[type] == 'no'\n flash[:alert] = \"Your account has no credit left. Please contact the administrator to obtain more\"\n redirect_to :jobs and return\n end\n\n # create the job here\n # no bulk assignment unless user tries to set 'vars', which should contain stuff which only\n # comes from a 'safe' source, e.g. one of our private webservices\n #@job = Job.new(params[:job])\n @job = Job.new\n @job.job_name = params[:job][:job_name]\n @job.job_description = params[:job][:job_description]\n @job.parameters = params[:job][:parameters]\n @job.infile = params[:job][:infile] if !params[:job][:infile].nil?\n @job.inputurl = params[:job][:inputurl] if !params[:job][:inputurl].nil?\n if params[:job][:public] == 1 or params[:job][:public] == \"1\"\n @job.public = true\n else\n @job.public = false\n end\n\n # note: some types of job don't pass their parameters as for bulk assignment, so they\n # must be dealt with separately here\n Rails.logger.info(\"TYPE: #{type}\")\n vfile = \"#{Vibrant::Application.config.dropbox}/#{type}/version.txt\"\n if !params[:job][:version].nil?\n version = params[:job][:version]\n elsif File.exists?(vfile)\n version = IO.readlines(vfile)[0].chomp!\n else\n version = \"N/A\"\n end\n Rails.logger.error(\"VERSION: #{version}\")\n \n\n # assign everything else\n @job.type = type\n @job.version = version\n @job.email = current_user.email\n @headers = @job.type\n\n \n respond_to do |format|\n if @job.save \n if StartingWorker.perform_async(@job.id)\n flash[:notice] = 'Job was successfully created.'\n Rails.logger.info(\"StartingWorker success for job: #{@job.id}\")\n else\n flash[:notice] = 'Job failed to run.'\n Rails.logger.info(\"StartingWorker FAIL for job: #{@job.id}\")\n end\n format.html { redirect_to(@job) }\n format.xml { render :xml => @job, :status => :created, :location => @job }\n format.json { render :json => @job, :status => :created, :location => @job }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n format.json { render :json => @job.errors.full_messages, :status => :unprocessable_entity } # an array of relevant errors will be reported\n end\n end\n end", "title": "" }, { "docid": "00e408650b3af862efd2b7d0af850269", "score": "0.58541864", "text": "def create\n @job_detail = JobDetail.new(job_detail_params)\n\n respond_to do |format|\n if @job_detail.save\n job_service_type_save\n format.html { redirect_to @job_detail, notice: 'Job detail was successfully created.' }\n format.json { render action: 'show', status: :created, location: @job_detail }\n else\n format.html { render action: 'new' }\n format.json { render json: @job_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9e4f6a996dd80c714bddc85f46adc3a7", "score": "0.5846679", "text": "def create\n job_id = params[:job_id]\n job = Job.find(job_id)\n client_name = params[:client_name]\n activity = JobActivityLog.new\n activity.current_user_id = current_user.id if current_user\n reason_code_value = params[:reason_code][:reason_code].to_s.strip\n reason_code_description = params[:reason_code][:reason_code_description].to_s.strip\n reason_code_params = !reason_code_value.blank? && !reason_code_description.blank?\n check_information = job.check_information\n check_information_id = check_information.id\n payer_id = cookies[:payer_id].to_s.strip\n payer_name = params[:rc_payer][:popup].to_s.strip\n address_one = params[:rc_payer][:pay_address_one].to_s.strip\n address_two = params[:rc_payer][:pay_address_two].to_s.strip\n city = params[:rc_payer][:payer_city].to_s.strip\n state = params[:rc_payer][:payer_state].to_s.strip\n zip = params[:rc_payer][:payer_zip].to_s.strip\n image_from = params[:rc_payer][:job_image_from].strip.to_i\n parent_job_exists = !job.parent_job_id.blank?\n if client_name.upcase == 'MEDASSETS' || client_name.upcase == 'BARNABAS'\n rc_page_no = params[:eob_reason_codes][:page_no].strip.to_i\n end\n payer_address_fields = {\n :address_one => address_one,\n :city => city,\n :state => state,\n :zip_code => zip\n }\n valid_payer_address, statement_to_alert = validate_payer_address(payer_address_fields)\n valid_payer = !payer_name.blank? && valid_payer_address\n if valid_payer\n payer_details = {:name => payer_name,\n :address_one => !address_one.blank? ? address_one : nil,\n :address_two => !address_two.blank? ? address_two : nil,\n :city => !city.blank? ? city : nil,\n :state => !state.blank? ? state : nil,\n :zip => !zip.blank? ? zip : nil }\n \n invalid_payer_id = (payer_id == 'null' || payer_id.blank? || payer_id == 'undefined')\n if invalid_payer_id\n payer_object = Payer.get_payer_object(payer_details)\n payer_id = payer_object.id unless payer_object.blank?\n end\n valid_payer_id = (payer_id != 'null' && !payer_id.blank? && payer_id != 'undefined')\n if valid_payer_id\n payer = Payer.find(payer_id)\n payer_name = payer.payer\n set_name = payer.reason_code_set_name\n payer_footnote_indicator = payer.footnote_indicator\n else\n payer_name = nil\n\n if parent_job_exists\n set_name = ReasonCodeSetName.find_or_create_by_name(\"JOB_#{job.parent_job_id}_SET\")\n else\n set_name = ReasonCodeSetName.find_or_create_by_name(\"JOB_#{job.id}_SET\")\n end\n payer_footnote_indicator = false\n end\n \n unless set_name.blank?\n set_name_id = set_name.id \n if reason_code_params\n if (reason_code_value.match(/^[A-Za-z0-9\\-\\.\\_]*$/) &&\n !reason_code_value.match(/\\.{2}|\\_{2}|\\-{2}^[\\-\\.\\_]+$/))\n if does_default_reason_code_duplicated?(reason_code_value.upcase, reason_code_description.upcase)\n reason_code = ReasonCode.get_reason_code(reason_code_value, reason_code_description, set_name, payer)\n if reason_code.blank?\n parameters = { :check_id => check_information.id,\n :check_number => check_information.check_number,\n :set_name_id => set_name_id, :payer_name => payer_name,\n :job_id => job.id, :facility_name => params[:facility_name]}\n if params[:batch].present?\n batchid_and_date = params[:batch].split(',')\n parameters[:batchid] = batchid_and_date[0]\n parameters[:batch_date] = batchid_and_date[1]\n end\n \n reason_code = ReasonCode.create_reason_code(reason_code_value, reason_code_description, parameters)\n create_eob_reason_codes(reason_code.id, rc_page_no, job_id) if client_name.upcase == 'MEDASSETS' || client_name.upcase == 'BARNABAS'\n create_reason_code_jobs(reason_code.id, job)\n rc_job_record = ReasonCodesJob.find_by_reason_code_id_and_parent_job_id(reason_code.id, job.get_parent_job_id)\n if !rc_job_record.blank?\n rc_job_record.update_attributes(:existence => false)\n end\n else\n reason_code.update_reason_code(reason_code_value, reason_code_description, payer_footnote_indicator, check_information_id)\n create_eob_reason_codes(reason_code.id, rc_page_no, job_id) if client_name.upcase == 'MEDASSETS' || client_name.upcase == 'BARNABAS'\n create_reason_code_jobs(reason_code.id, job)\n rc_job_record = ReasonCodesJob.find_by_reason_code_id_and_parent_job_id(reason_code.id, job.get_parent_job_id)\n if !rc_job_record.blank?\n rc_job_record.update_attributes(:existence => true)\n end\n end\n if reason_code.unique_code.blank?\n unique_code = reason_code.get_unique_code\n reason_code.update_attributes(:unique_code => unique_code)\n end\n else\n flash[:notice] = \"Default Reason Code & Reason Code Description are already created\"\n end\n else\n flash[:notice] = \"Please try again with valid value as follows : Reason Code should contain alphabet, number, hyphen, underscore and period only.\"\n end\n else\n flash[:notice] = \"Reason Code & Reason Code Description cannot be blank\"\n end\n else\n flash[:notice] = \"Reason Code should have a set name\"\n end\n else\n flash[:notice] = \"PAYER NAME IS MANDATORY. \" + statement_to_alert.to_s.upcase\n end\n redirect_to :action => \"list\", :job_id => job_id\n end", "title": "" }, { "docid": "2ae3f389211a79c2e4570771c84f696d", "score": "0.5835168", "text": "def create\n\n\t\t# Make sure we have permissions to create the job\n\t\tgroup = Group.find(params[:group_id])\n\t\traise SecurityTransgression if !group.user_permissions.administrator && !currentUser.is_admin\n\n\t\t@job = Job.new(params[:job])\n\n\t\t# New Organizations Vs. Old Organizations\n\t\t@job.longitude = group.longitude\n\t\t@job.latitude = group.latitude\n\t\t@job.group = group\n\t\t\n\t\t# Only allow a hard limit of jobs to be \"running\"\n\t\tif @job.status == 'running' && group.job_allowance <= group.jobs.where(:status => 'running').count\n\t\t\tflash[:error] = \"You cannot create more running jobs without buying more packs\"\n\t\t\treturn redirect_to [group, :jobs]\n\t\tend\n\n\n\t\t# Attemp to save and return\n\t\trespond_to do |format|\n\t\t\tif @job.save\n\n\t\t\t\t@job.update_subjects(params[:subjects]) if params[:subjects]\n\t\t\t\t@job.update_grades(params[:grades]) if params[:grades]\n\n\t\t\t\tformat.html {\n\t\t\t\t\tflash[:success] = \"New job was successfully created.\"\n\t\t\t\t\tredirect_to [group, :jobs]\n\t\t\t\t}\n\t\t\t\tformat.json { render json: @job }\n\t\t\telse\n\t\t\t\tformat.html { redirect_to :back }\n\t\t\t\tformat.json { render json: @job.errors, status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "37e20c995e9b01bc14a0ca579c675287", "score": "0.5809986", "text": "def job_cancelled(job)\n if job.job_type == Construction::Job::TYPE_CREATE && self.empty?\n self.building_id = nil\n self.level = nil\n self.save\n end\n end", "title": "" }, { "docid": "4e47aea36628c1c464d4f8589d5964ce", "score": "0.5808658", "text": "def create\n @job = Job.new(job_params)\n\n run\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to @job, notice: 'Job was successfully created.' }\n format.json { render :show, status: :created, location: @job }\n else\n format.html { render :new }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n\n end", "title": "" }, { "docid": "6ccae9ad2d8ba30f7949cfb2410c02d8", "score": "0.57987994", "text": "def post_job\n\n end", "title": "" }, { "docid": "ced5fcac9681085905b3330c72c9f8f3", "score": "0.5791454", "text": "def create\n #@job = Job.new(job_params)\n @job = current_profile.jobs.build(job_params)\n\n\n #@job.company_id = params[:job_id]#company relationship\n\n \n\n respond_to do |format|\n if @job.save\n\n JobMailer.job_created(@profile).deliver #send notification to job owner from jobmailer\n\n\n format.html { redirect_to @job, notice: 'Job was successfully created.' }\n format.json { render :show, status: :created, location: @job }\n else\n format.html { render :new }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "484cd91edd6ca9daf7764b5f17e5d863", "score": "0.57833636", "text": "def create\n if params[:job][:type] == \"CronJob\"\n params[:job].delete(:type)\n params[:job].delete(:frequency)\n @job = CronJob.new(job_params)\n elsif params[:job][:type] == \"IntervalJob\"\n params[:job].delete(:type)\n params[:job].delete(:cron_expression)\n @job = IntervalJob.new(job_params)\n else\n @job = Job.new\n respond_to do |format|\n format.html { render action: \"new\" }\n format.json { render json: {:error => \"Invalid job type\"}, status: :unprocessable_entity }\n end\n return\n end\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to @job, notice: 'Job was successfully created.' }\n format.json { render json: @job, status: :created, location: @job }\n else\n format.html { render action: \"new\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2e522a9e2c7f946b768fc10f13f0c85c", "score": "0.57763547", "text": "def create\n params[:job].parse_time_select! :time\n\n @job = Job.new(params[:job])\n Rails.logger.info(\"--------New job created: \"+params[:job].to_s)\n @job.user = current_user\n @job.status = Job::WAITING\n @job.endtime = @job.time.advance(:hours => @job.hours)\n\n respond_to do |format|\n if @job.save \n @job.mark_created() \n JobMailer.invite_circle_to_job(@job).deliver\n format.html { redirect_to dashboard_path, :notice => 'Job was successfully created.' }\n format.json { render :json => @job, :status => :created, :location => @job }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @job.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "08bf4785367026fa3759448c48cd1fa6", "score": "0.57688206", "text": "def create\n\t\t\t\t \n\t@dial_job = DialJob.new(params[:dial_job])\n \n if(Provider.find_all_by_enabled(true).length == 0)\n\t\t@dial_job.errors.add(\"No providers have been configured or enabled, this job cannot be run\")\n\t\trespond_to do |format|\n\t\t\tformat.html { render :action => \"new\" }\n\t\t\tformat.xml { render :xml => @dial_job.errors, :status => :unprocessable_entity }\n\t\tend\n\t\treturn\n\tend\n\n\t@dial_job.status = 'submitted'\n\t@dial_job.progress = 0\n\t@dial_job.started_at = nil\n\t@dial_job.completed_at = nil\n\t@dial_job.range.gsub!(/[^0-9X:,\\n]/, '')\n\t@dial_job.cid_mask.gsub!(/[^0-9X]/, '') if @dial_job.cid_mask != \"SELF\"\n\n\tif(@dial_job.range_file.to_s != \"\")\n\t\t@dial_job.range = @dial_job.range_file.read.gsub!(/[^0-9X:,\\n]/, '')\n\tend\n\n respond_to do |format|\n if @dial_job.save\n flash[:notice] = 'Job was successfully created.'\n \n # Launch it\t\n WarVOX::JobManager.schedule(::WarVOX::Jobs::Dialer, @dial_job.id)\n\t\n format.html { redirect_to(@dial_job) }\n format.xml { render :xml => @dial_job, :status => :created, :location => @dial_job }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @dial_job.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a9511eea4b537de11d16fb872eb212e2", "score": "0.5740949", "text": "def create\n \n if params[:order_id]\n @order = Order.find(params[:order_id])\n @company = @order.company\n # @employee = Employee.create(employee_params)\n @job = @order.jobs.new(job_params)\n # authorize @job\n # @job.order = @order\n # @employee = @job.create_employee(employee_params)\n else\n # @employee = Employee.create(employee_params)\n @job = Job.new(job_params)\n # authorize @job\n end\n \n respond_to do |format|\n if @job.save\n format.html { redirect_to job_path(@job, anchor: \"job_#{@job.id}\"), notice: 'Job was successfully created.' }\n format.json { render :show, status: :created, location: @job }\n else\n format.html { render :new }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c17aa734d09e3de4e4157c8d951bd6be", "score": "0.574055", "text": "def create\n @job = Job.new(params[:job])\n respond_to do |format|\n if @job.save\n # email the customer including the payment instructions\n JobPostMailer.deliver_confirm_post(@job, \"#{request.protocol}#{request.host}:#{request.port}/payment/index/#{@job.id}\")\n flash[:notice] = \"Your job posting titled \\\"#{@job.title}\\\" was successfully created. Please pay for the posting to be activated. Payment instructions have been emailed to you in case you prefer to pay later.\"\n format.html { redirect_to(:controller => \"payment\", :action => \"index\", :id => @job.id) }\n format.xml { render :xml => @job, :status => :created, :location => @job }\n else\n @category_array = Category.category_array\n @state_array = Job.state_array\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0daca4f24f373880bb7cd3fe94661e4f", "score": "0.57396734", "text": "def create_job\n\n if params[:job].values_at(:title, :description, :job_length, :job_vacancy).all?(&:present?)\n job = Job.new(\n title: params[:job][:title],\n business_name: current_business_user.business_name,\n description: params[:job][:description],\n job_length: params[:job][:job_length],\n job_vacancy: params[:job][:job_vacancy],\n business_user_id: current_business_user.id\n )\n\n if job.save\n render json: job, status: :ok\n else\n render json: {error: job.errors, is_success: false}, status: 422\n end\n else\n render json: {success: false, message: \"Please enter required fields\"}, status: 400\n end\n end", "title": "" }, { "docid": "23d3e9c6ca2873021a79d27950a88ad4", "score": "0.5738593", "text": "def prepare_job_descriptor(uuid)\n <<-eos\nExecutable = \"scalarm_job_#{uuid}.sh\";\nArguments = \"#{uuid}\";\nStdOutput = \"scalarm_job.out\";\nStdError = \"scalarm_job.err\";\nOutputSandbox = {\"scalarm_job.out\", \"scalarm_job.err\"};\nInputSandbox = {\"scalarm_job_#{uuid}.sh\", \"scalarm_simulation_manager_#{uuid}.zip\"};\nRequirements = (other.GlueCEUniqueID == \"dwarf.wcss.wroc.pl:8443/cream-pbs-plgrid\");\nVirtualOrganisation = \"vo.plgrid.pl\"; \n eos\n end", "title": "" }, { "docid": "060fb89febe14ad896125e4489b54995", "score": "0.5736145", "text": "def create\n @job = Job.new(job_params)\n @job.active = 1\n # set appointmend end date\n if @job.appointment.present?\n if @job.appointment_end.nil?\n @job.appointment_end = nil\n else \n @job.appointment_end = @job.appointment.beginning_of_day + ( @job.appointment_end - @job.appointment_end.beginning_of_day)\n end \n end\n respond_to do |format|\n if @job.save\n AuditLog.create(ip: request.remote_ip, user_name: @current_user.try(:full_name) || @api_user.try(:full_name), user_agent: request.user_agent, auditable: @job, details: \"Newly created data, set status to #{@job.status}\")\n \n format.html { redirect_to jobs_path(filter: :all), notice: 'Job was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end", "title": "" }, { "docid": "e45651bfbf1b2b1d908eb094877c04f9", "score": "0.57322276", "text": "def create\n job = Job.new(job_params) \n \n if job.save\n render json: {status:'SUCCESS', message:'Job Added', data:job},status: :ok\n else\n render json: {status:'FAILURE', message:'Job Not Saved', data:job.errors},status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "49202fb7556fbaa319699f9831a4261a", "score": "0.5724881", "text": "def new\n @job = Job.new\n\n\t\n end", "title": "" }, { "docid": "adff10c9a6506bfaaac94ffd6a2cf618", "score": "0.5721185", "text": "def create_toolkit_job ( matches, hhpred_db=ALL_PDB )\n matches.each do |file| \n infilename = File.join(PDB_WATCHLIST,file.gsub(/\\.hhr/,'.fas').gsub(/:,/,'/'))\n infile = File.new(infilename)\n job = Job.new\n job.jobid = job.class.create_id\n job.tool = 'hhpred'\n job.status = 'i'\n job.type = 'HhpredJob'\n job.save!\n \n userdb = Watchlist.find( :first, :conditions => [ \"path = ?\", infilename ])\n parameters = {\"jobid\" => job.jobid, \"reviewing\" => 'true', \"sequence_file\" => \"#{TMP}/#{job.id}/sequence_file\", \"mail_transmitted\" => 'false' }\n parameters.merge!(userdb.params)\n parameters[\"informat\"] = \"fas\"\n parameters[\"hhpred_dbs\"] = \"#{hhpred_db}\"\n \n if !File.exist?(job.job_dir)\n Dir.mkdir(job.job_dir, 0755)\n end\n \n filename = File.join(TMP,\"#{job.id}\", 'sequence_file')\n File.open(filename, \"w\") do |f|\n f.write(infile.read)\n end\n \n newaction = HhpredAction.new( \n \t:params => parameters, \n \t:job => job, \n \t:status => 'i', \n \t:forward_controller => 'hhpred', \n \t:forward_action => 'results'\n \t)\n \n newaction.sequence_file = filename\n parameters.each do |key,value|\n if (key != \"controller\" && key != \"action\" && key != \"job\" && key != \"parent\" && key != \"method\" && key != \"forward_controller\" && key != \"forward_action\" && newaction.respond_to?(key))\n eval \"newaction.\"+key+\" = value\"\n end\n end\n newaction.jobid = job.jobid\n newaction.save!\n \n newaction.run\n \n userdb.job_id = job.jobid\n userdb.save!\n# job.user_id = userdb.user_id\n job.save!\n STDOUT.write(\"\\n#{Time.now} - Toolkit HHpred Job ID: #{job.jobid} created for #{userdb.name}\\n\")\n \n end\nend", "title": "" }, { "docid": "16f604173da0e00ccc865172686107e4", "score": "0.5720208", "text": "def new_job\n frm.link(:text=>\"New Job\").click\n CreateNewJob.new(@browser)\n end", "title": "" }, { "docid": "66978ca3f56b9174b77da3e4cb7f4b1b", "score": "0.5713229", "text": "def jobs; end", "title": "" }, { "docid": "66978ca3f56b9174b77da3e4cb7f4b1b", "score": "0.5713229", "text": "def jobs; end", "title": "" }, { "docid": "39a6b242f978db50d307e1b79d1344df", "score": "0.57080376", "text": "def create\n flash[:alert] = \"Manually creating jobs has been disabled\"\n return redirect_to :root\n @job = Job.new(params[:job])\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to @job, notice: 'Job was successfully created.' }\n format.json { render json: @job, status: :created, location: @job }\n else\n format.html { render action: \"new\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1ef63051c1cac9cd2c7ea6594373b527", "score": "0.569692", "text": "def after_create\n create_and_save_xedl\n create_at_jobs\n logger.debug(\"El after create ha funcionado\")\n \n end", "title": "" }, { "docid": "2d4eb234f08395b06f9c47ebcc8c0468", "score": "0.5695479", "text": "def create\n @job = current_company.jobs.build(job_params)\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to @job, notice: 'Job was successfully created.' }\n format.json { render :show, status: :created, location: @job }\n else\n format.html { render :new }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "934b0d58ff99f43ef65c716d1d97b6e8", "score": "0.5695377", "text": "def manageJob\n\n jobList = getJobList #We start by retrieving a list of our jobs.\n status = getStatus(jobList) #Based on payload, determine status. New job? If not, where in process?\n p \"Status of \" + @job.title + \" job: \" + status.to_s\n\n if status.name == \"error\" then\n p \"ERROR occurred with your Historical Job request. Quitting\"\n exit(status = false)\n end\n\n\n #If this is a NEW job, assemble the Job description and submit it.\n #This includes managing this Job's rules.\n if status.name == \"new\" then\n if !submitJob then\n p \"ERROR occurred with your Historical Job request. Quitting\"\n exit(status = false)\n end\n end\n\n #Confirm job was submitted OK, ask the PowerTrack server again...\n #Whether this is a new job, or one already submitted, determine the Job UUID for current job.\n if status.name == \"new\" then\n @accept = nil #New jobs should always have accept=nil (regardless of what was passed in)\n response = @http.GET #Get the job list again, confirm it was submitted OK, and lead us to the uuid.\n jobList = response.body\n #TODO: confirm the current job is in list.\n status.name = \"estimating\"\n end\n\n @uuid = getUUID(jobList) #This call sets both oJob.uuid and oJob.jobURL\n\n #From this point on, we are operating on the JOB URL.\n @http.url = @job_url #Update the HTTP object's URL to this Job's URL.\n setOutputFolder(@output_folder) #Now that we have the uuid, set the output directory for the Historical daa.\n response = http.GET\n jobInfo = response.body\n\n status = getStatus(jobInfo)\n\n if status.name == \"estimating\" then #loop until the estimate is finished and we've moved to \"quoted\"\n @accept = nil #New jobs should always have accept=nil (regardless of what was passed in)\n #Check to see if estimation is finished. If not pause 5 minutes and recheck\n until status.name == \"quoted\"\n p \"Estimate not ready yet, sleeping for 5 minutes...\"\n sleep(5*60)\n response = @http.GET\n jobInfo = response.body\n status = getStatus(jobInfo)\n end\n end\n\n '''\n At this point the job has been quoted and is ready for approval or rejection. Therefore, there should be some\n mechanism to review the job quote details. In a system with a UI, the job quote would be presented for review.\n\n There is an \"accept\" parameter passed into this script. If accept is set to \"true\", and the job has been\n quoted, then it will charge ahead and run the job. If \"accept\" is set to \"true\" and the quote has not been\n generated, the accept=true will be ignored.\n\n IMPORTANT NOTE: during Historical PowerTrack trials, the accept/reject process is not enabled through the API.\n Instead Gnip will need to perform this manually. After an account becomes live with a subscription, then jobs\n can be accepted/rejected using the API.\n '''\n\n if status.name == \"quoted\" then\n #Display the quote\n setQuoteDetails(jobInfo)\n p \"Job (\" + @job.title + \") has been quoted. | \" + @quote.to_s\n\n if @accept then\n #Accept Job.\n response = @http.PUT(acceptJob) #Accept job.\n if response.code.to_i >= 200 and response.code.to_i < 300 then\n status.name = \"accepted\"\n p \"Job (\" + @job.title + \") was ACCEPTED.\"\n else\n p \"Error occurred. Job (\" + @job.title + \") could not be accepted. \"\n end\n elsif @accept == nil\n p \"Job (\" + @job.title + \") has been quoted, and needs to be ACCEPTED or REJECTED. \"\n p \"Script can be reran with '-a true' or -a false'\"\n elsif not @accept\n response = @http.PUT(rejectJob) #Reject job.\n if response.code.to_i >= 200 and response.code.to_i < 300 then\n status.name = \"rejected\"\n p \"Job (\" + @job.title + \") was REJECTED.\"\n else\n p \"ERROR occurred. Job (\" + @job.title + \") could not be rejected (but still at 'quoted' stage). \"\n end\n\n end\n end\n\n #If accepted, monitor status of Job completion.\n if status.name == \"accepted\" or status.name == \"running\" then\n #Check to see if job is finished. If not pause 5 minutes and recheck\n until status.name == \"finished\"\n p \"Job is running... \" + status.percent.to_s + \"% finished.\"\n sleep(5*60)\n response = @http.GET\n jobInfo = response.body\n status = getStatus(jobInfo)\n end\n end\n\n #If completed, retrieve the files.\n #Server provides a JSON file with paths to the flatfiles...\n #These files can be downloaded in parallel to a local directory...\n #http://support.gnip.com/customer/portal/articles/745678-retrieving-data-for-a-delivered-job\n if status.name == \"finished\" then\n\n downloadData(jobInfo)\n handleSuspectMinutes(jobInfo)\n if @storage == \"files\" then\n uncompressData\n end\n\n end\n end", "title": "" }, { "docid": "1ea5ebc6fc0b46adc0cd523bd1235550", "score": "0.5690394", "text": "def create_user_job\n puts \"creating user jobs\"\n @user_job = UserJob.new \n @user_job.user = current_user\n @user_job.job = Job.last\n @user_job.save\n end", "title": "" }, { "docid": "6b28d7eb8a784bddc099804e911888d2", "score": "0.5684263", "text": "def create\n @tqrdc_job = Tqrdc::Job.new(tqrdc_job_params)\n\n respond_to do |format|\n if @tqrdc_job.save\n format.html { redirect_to @tqrdc_job, notice: 'Job was successfully created.' }\n format.json { render :show, status: :created, location: @tqrdc_job }\n else\n format.html { render :new }\n format.json { render json: @tqrdc_job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a2efca639844fa18af89472cb79a9722", "score": "0.5683817", "text": "def name\n job_code\n end", "title": "" }, { "docid": "99e768cece4ca3f444ae32c62b8356af", "score": "0.56794256", "text": "def job_name\n \"#{action_name}_#{model_name}_job\"\n end", "title": "" }, { "docid": "f9d53da5a35ee0005f49977c2b6a6544", "score": "0.56727564", "text": "def enter\n @jobs = Job.new\n end", "title": "" }, { "docid": "6384246d652fa6ee2aeded55cd24dd88", "score": "0.56713873", "text": "def asyncNew\n @job = Job.new(params[:job])\n\n @job.maxscheduler_id = @maxschedulerId\n @job.site_id = @siteId\n @job.resource_id = 0\n @job.user_id = current_user.id\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to @job, notice: 'Job was successfully created.' }\n format.json { render json: @job, status: :created, location: @job }\n else\n format.html { render action: \"new\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "aba5c010f754a85694110cd80985e904", "score": "0.5662276", "text": "def customize_template_job\n\t\t# TODO\n\tend", "title": "" }, { "docid": "3927c8d813f2350cfb53c0270df07c55", "score": "0.56620544", "text": "def create_job(package_name, options = Hash.new)\n options, unknown_options = Kernel.filter_options options,\n :force => false,\n :type => :package,\n :architectures => Packaging::Config.architectures.keys,\n :distributions => Packaging::Config.active_distributions,\n :job_name => package_name,\n :package_name => package_name,\n :dir_name => package_name\n\n combinations = combination_filter(options[:architectures], options[:distributions], package_name, options[:type] == :gem, options)\n\n\n Packager.info \"Creating jenkins-debian-glue job for #{package_name} with\"\n Packager.info \" options: #{options}\"\n Packager.info \" combination filter: #{combinations}\"\n\n safe_level = nil\n trim_mode = \"%<>\"\n template = ERB.new(File.read(File.join(File.dirname(__FILE__), \"templates\", \"jenkins-debian-glue-job.xml\")), safe_level, trim_mode)\n rendered = template.result(binding)\n rendered_filename = File.join(\"/tmp\",\"#{options[:job_name]}.xml\")\n File.open(rendered_filename, 'w') do |f|\n f.write rendered\n end\n\n if system(\"java -jar ~/jenkins-cli.jar -s http://localhost:8080/ create-job '#{options[:job_name]}' < #{rendered_filename}\")\n Packager.info \"job #{options[:job_name]}': create-job from #{rendered_filename} succeeded\"\n else\n Packager.info \"job #{options[:job_name]}': create-job from #{rendered_filename} failed\"\n if options[:force]\n Packager.info \"job #{options[:job_name]}': trying to update job from #{rendered_filename}\"\n if system(\"java -jar ~/jenkins-cli.jar -s http://localhost:8080/ update-job '#{options[:job_name]}' < #{rendered_filename}\")\n Packager.warn \"job #{options[:job_name]}': update-job from #{rendered_filename} succeeded\"\n else\n Packager.warn \"job #{options[:job_name]}': update-job from #{rendered_filename} failed\"\n end\n end\n end\n end", "title": "" }, { "docid": "497fd52c5e4530f82b509e8d383f9693", "score": "0.56612784", "text": "def job_detail_params\n params.require(:job_detail).permit(:job_start_date, :job_status_id, :how_many_stories, :existing_roof_type_id, :new_roof_type_id, :product_type_id, :product_color_id, :sales_rep_id, :estimate_type_id, :contract_price, :deposit_due, :deposit_method, :date_completed, :job_notes, :lead_sheet_note, :info_taken_by_id, :assign_to_id, :date_taken)if params[:job_detail]\n end", "title": "" }, { "docid": "21dff954db1772c3efbb5aefafbfaa95", "score": "0.5654756", "text": "def prepare_job\n if @job_condition\n @job = Job.new\n parse_values(\"JOB\", @job)\n @job = update_job @job\n @jobs << @job\n end\n end", "title": "" }, { "docid": "61c9a31b405a38cd96d44b1469cebaa9", "score": "0.56495774", "text": "def create\n \tparams[:job][:duration] = params[:job][:duration].to_i * 168\n @job = current_user.jobs.build(params[:job])\n \n @job.wiki = '#'\n @job.status = 'draft'\n \n\t @job.language = \"English\"\n\t @job.favorite = \"No\"\n\t @job.viral = \"Yes\"\n @job.smart = \"No\"\n @job.checkmarkskills = \"No\"\n @job.checkmarksections = \"No\"\n @job.template = \"Section 1,Section 2\"\n @job.keyword1 = \"\"\n @job.keyword2 = \"\"\n @job.keyword3 = \"\"\n @job.keyword4 = \"\"\n @job.keyword5 = \"\"\n @job.qualifier1 = \"\"\n @job.qualifier2 = \"\"\n @job.qualifier3 = \"\"\n @job.qualifier4 = \"\"\n @job.qualifier5 = \"\"\n \n if !Job.where(:name => @job.name, :user_id => current_user.id)[0].nil?\n @i = 2\n while Job.where(:name => @job.name+\"(\" + @i.to_s + \")\").any? do\n @i = @i + 1\n end\n @job.name = @job.name+\"(\" + @i.to_s + \")\" \n end\n \n @success = @job.save\n # check if the fields of the form are empty\n if @success\n \twiki_name = UUIDTools::UUID.random_create.to_s().gsub(\"-\",\"_\")\n \t\n \t@space = Space.create(:name => @job.name, :wiki_name => wiki_name.to_s, :status => \"open\")\n \t\n \t@space.content = \"<div id='index'><ol>\"\n \"Section 1,Section 2\".split(',').each do |pageName|\n @newpage = @space.documents.new(:name => pageName, :status => \"open\")\n @newpage.save\n @space.content = @space.content + '<li><a href=\"/spaces/'+wiki_name+'/documents/'+@newpage.id.to_s+'\">'+pageName+'</a></li>'\n end\n @space.content = @space.content + \"</ol></div>\"\n @space.save\n \t\n \t@job.update_attributes(:wiki => '/spaces/'+wiki_name, :wikispace => wiki_name )\n\n \t@activity = current_user.activities.create(:job_id => @job.id, :message => \"Job \"+ @job.name + \" created. \") \n end\n \n # TODO Process errors\n respond_to do |format|\n if @success\n format.html { redirect_to(job_path(@job)+'#tabs-0', :notice => 'Job was successfully created') }\n format.xml { render :xml => @job, :status => :created, :location => @job }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f1735b8f5c55e341f01f26cc249d228e", "score": "0.56465834", "text": "def create\n\n params['_json'].each do |entry|\n entry[\"LastRunTime\"] = DateTime.strptime(entry[\"LastRunTime\"], \"%m/%d/%Y %H:%M:%S %p\")\n entry[\"NextRunTime\"] = DateTime.strptime(entry[\"NextRunTime\"], \"%m/%d/%Y %H:%M:%S %p\")\n entry[\"LastTaskResult\"] = entry[\"LastTaskResult\"].to_i.abs\n\n @job = Job.new(entry)\n @job.save unless entry[\"NextRunTime\"].year < 1900\n end\n\n UserMailer.test_email(\"Team\").deliver\n# if @job.save\n# format.json { render json: @job, status: :created, location: @job}\n# else\n# format.html { render action: \"new\" }\n# format.json { render json: @job.errors, status: :unprocessable_entity }\n# end\n# end\n end", "title": "" }, { "docid": "5a53669cf2880da9713a2392d311b84f", "score": "0.5646447", "text": "def create\n @job = current_employer.jobs.build(job_params)\n #@job = Job.new(job_params)\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to @job, notice: 'Job was successfully created.' }\n format.json { render :show, status: :created, location: @job }\n else\n format.html { render :new }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "28580347d326fd25a34fccb2a591296e", "score": "0.56440616", "text": "def description\n \"Job #{id}: #{enrollment.service_name} on \" + job_date.strftime(\"%B #{job_date.day.ordinalize}, %Y @ %l:%M %p (#{job_status.status})\") if job_date\n end", "title": "" }, { "docid": "98ce4907e04bb22f06249bb8936bbb48", "score": "0.5640901", "text": "def new\n @job = Job.new\n @job.time = Time.zone.now().advance(:hours => 1,:days => 1)\n @job_types = JobType.all\n @job.user = current_user\n \n Rails.logger.info(\"------NEW JOB, creating from defaults..\")\n #set type to default\n unless params[ :job_type_id ].nil?\n @job.job_type = JobType.find( params[ :job_type_id ] )\n else\n #choose same type as last job if there is one\n unless current_user.latest_job.nil?\n @job.job_type = current_user.latest_job.job_type\n else\n @job.job_type = JobType.first \n end\n end\n Rails.logger.info(\"--------JobType = \"+@job.job_type.to_s) \n #set default stars to job_type default\n @job.stars = @job.job_type.stars\n \n #set default recipients to circle\n @job.request_recipients = current_user.circle.users\n Rails.logger.info(\"--------Recipients = \"+@job.request_recipients.to_s)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @job }\n end\n end", "title": "" }, { "docid": "5019bcf233b5c8609ca00648c2ef1fe0", "score": "0.56404144", "text": "def startJob \n\t\t\n\tend", "title": "" }, { "docid": "2db9b953ae69fda45e9235d332729405", "score": "0.563652", "text": "def add_job(params)\n job_xml = Ox::Element.new('job')\n title_xml = Ox::Element.new('title') << params[:title]\n url_xml = Ox::Element.new('url') << params[:url]\n job_reference_xml = Ox::Element.new('job_reference') << params[:job_reference]\n location_xml = Ox::Element.new('location') << params[:location]\n city_xml = Ox::Element.new('city') << params[:city]\n state_xml = Ox::Element.new('state') << params[:state]\n country_xml = Ox::Element.new('country') << params[:country]\n zip_code_xml = Ox::Element.new('zip_code') << params[:zip_code]\n req_number_xml = Ox::Element.new('req_number') << params[:req_number]\n posted_at_xml = Ox::Element.new('posted_at') << params[:posted_at]\n company_xml = Ox::Element.new('company') << params[:company]\n body_xml = Ox::Element.new('body') << params[:body]\n\n job_xml << title_xml << url_xml << job_reference_xml << location_xml << country_xml << city_xml << state_xml \\\n << zip_code_xml << req_number_xml << posted_at_xml << company_xml << body_xml\n @doc_xml.source.jobs << job_xml\n @jobs_counter += 1\n end", "title": "" }, { "docid": "02c65660a7aafeb054422e807338d41e", "score": "0.56315607", "text": "def create_db_job\n\tm = connect_to_db\n\tusername = m.escape(Thread.current['conn']['user'])\n\tm.query(\"INSERT INTO jobs (userid, target_username, added, status) VALUES ('#{Thread.current['conn']['userdata'].id}', '#{username}', NOW(), 'RUNNING' )\")\nend", "title": "" }, { "docid": "7ea567d78b13f2ce9f3cf3c7680c686c", "score": "0.5628479", "text": "def create\n @job = Job.new(job_params)\n authorize @job\n\n respond_to do |format|\n if @job.save\n flash[:success] = t('flashes.create', model: Job.model_name.human)\n #start_job_if_planned_today @job\n format.html { redirect_to session.delete(:return_to) || jobs_path}\n format.json { render :show, status: :created, location: @job }\n protocol_action(\"создание работы #{@job.name}\")\n else\n format.html { render :new }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2374b6db2049901687cd6d8495b7d74f", "score": "0.5618233", "text": "def generate_jobs(fba_job_infos)\n fba_job_infos.map(&:with_indifferent_access).each do |fba|\n fba[:jobs].each do |style, job_info|\n job = jobs.create(name: \"#{fba[:job_name]} - #{style}\")\n\n if !job_info.nil?\n job_info.each do |imprintable, color, quantities|\n LineItem.create_imprintables(\n job,\n imprintable,\n color,\n quantity: quantities\n )\n end\n end\n end\n end\n end", "title": "" }, { "docid": "64daf95338982ecc6cbad10bc0e2e13a", "score": "0.5617582", "text": "def create\n @job = current_user.company_details.find_by(params[:company_detail_id])\n @company_details = @job.jobs.build(job_params)\n @company_details.user_id = current_user.id\n respond_to do |format|\n if @job.save\n format.html { redirect_to @job, notice: 'Job was successfully created.' }\n format.json { render :show, status: :created, location: @job }\n else\n format.html { render :new }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7bcaf7b60cfcc17a7f9eb909f8389822", "score": "0.56126386", "text": "def makejobinactive()\n\n jobs = JobsResource.new(@driver)\n topjob = jobs.top_refnumber.text\n\n jobs.top_actions()\n jobs.actions_makeinactive()\n\n print topjob\n\n #Verification\n \t\texpect(jobs.top_refnumber.text).not_to eql(topjob)\n\n end", "title": "" }, { "docid": "5610214e311262ecaf53e081b8aa5cf1", "score": "0.56085384", "text": "def fill_out_job\n fill_in 'Job Title', with: \"Sales Representative\"\n fill_in_trix_editor('job_description_trix_input_job', 'You will discover treasures of Anatolia')\n fill_in \"geocomplete\", with: \"Toronto, On, Canada\"\n end", "title": "" }, { "docid": "14933123a695b53eff61849dd94be57b", "score": "0.5602246", "text": "def check_jobs_exist; end", "title": "" }, { "docid": "4e577012f622af13659c3932209be66a", "score": "0.56001025", "text": "def create\n @open_job = OpenJob.new(open_job_params)\n @open_job.companyname = @open_job.company.name\n if not current_user or not @open_job.company.users.includes(current_user)\n redirect_to :root, notice: \"You must be admin of company to create new open job!\"\n end\n if not @open_job.save\n redirect_to :back, notice: \"Nimeä tai viimeistä hakupäivää ei asetettu tai se on menneisyydessä!\"\n return\n end\n respond_to do |format|\n if @open_job.save\n format.html { redirect_to administration_company_path(@open_job.company), notice: t(\"open_job_created_confirmation\") }\n format.json { render :show, status: :created, location: @open_job }\n else\n format.html { render :new }\n format.json { render json: @open_job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9596ef465b098afd23a91d2f7a844721", "score": "0.5599309", "text": "def create(attributes)\n attributes[:status] = :CREATED\n job = Job.create! attributes\n JobEvent.create(description: 'Job Created', status: :CREATED, job: job)\n job\n end", "title": "" }, { "docid": "5011cd23fef6aeec914352f1d06de1f4", "score": "0.559668", "text": "def create\n @job = Job.new\n @job.title = job_params[:title]\n @job.description = job_params[:description]\n @job.age_limit = job_params[:age_limit]\n @job.qualifications = job_params[:qualifications]\n @job.selection_procedure = job_params[:selection_procedure]\n @job.experience = job_params[:experience]\n @job.application_fee = job_params[:application_fee]\n @job.how_to_apply = job_params[:how_to_apply]\n @job.apply_online_link = job_params[:apply_online_link]\n @job.website_ads_link = job_params[:website_ads_link]\n @job.location = job_params[:location]\n @job.job_category_id = job_params[:job_category_id]\n @job.state_id = job_params[:state_id]\n @job.start_date = job_params[:start_date]\n @job.end_date = job_params[:end_date]\n @job.tentative_exam_date = job_params[:tentative_exam_date]\n\n is_validation_failed = false\n if job_params[:job_category_id] == \"2\" && job_params[:state_id].blank?\n is_validation_failed = true\n flash[:info] = \"State is mandatory field with job type State govt job\"\n end\n \n respond_to do |format|\n if !is_validation_failed && @job.save\n format.html { redirect_to new_admin_job_job_post_path(@job), notice: 'Job was successfully created.' }\n format.json { render :show, status: :created, location: @job }\n else\n @job_categories = JobCategory.all\n @states = State.all\n format.html { render :new }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e45b05cc3a77f5429b6e6c6e27d2d27a", "score": "0.55960953", "text": "def jcl_jobcard\n # format paramaters with basic constraints\n # see http://www.ibm.com/support/knowledgecenter/SSLTBW_2.1.0/\n # com.ibm.zos.v2r1.ieab600/iea3b6_Parameter_field8.htm\n #\n jobname = format('%1.8s', datastore['JOBNAME']).strip.upcase\n actnum = format('%1.60s', datastore['ACTNUM']).strip.upcase\n pgmname = format('%1.20s', datastore['PGMNAME']).strip\n jclass = format('%1.1s', datastore['JCLASS']).strip.upcase\n notify = format('%1.8s', datastore['NOTIFY']).strip.upcase\n notify = if !notify.empty? && datastore['NTFYUSR']\n \"// NOTIFY=#{notify}, \\n\"\n else\n \"\"\n end\n msgclass = format('%1.1s', datastore['MSGCLASS']).strip.upcase\n msglevel = format('%5.5s', datastore['MSGLEVEL']).strip\n\n # build payload\n \"//#{jobname} JOB \" \\\n \"(#{actnum}),\\n\" \\\n \"// '#{pgmname}',\\n\" \\\n \"// CLASS=#{jclass},\\n\" \\\n \"#{notify}\" \\\n \"// MSGCLASS=#{msgclass},\\n\" \\\n \"// MSGLEVEL=#{msglevel},\\n\" \\\n \"// REGION=0M \\n\"\n end", "title": "" }, { "docid": "4e767796ea38f101d7269fc460a22c1e", "score": "0.5587479", "text": "def job \n @job\n end", "title": "" }, { "docid": "25a2f1f8b2630ca8b884f25f86d6e7f4", "score": "0.55845064", "text": "def active_job_message; end", "title": "" }, { "docid": "cfa748c0f29d49b4d3985d56b3515304", "score": "0.5577086", "text": "def create\n @job = Job.new(job_params)\n response = HTTParty.get @job.web_address\n noko = Nokogiri::HTML response.body\n if @job.web_address.include?('indeed.com')\n # company = noko.xpath('//*[@id=\"job_header\"]/span[1]').first.content\n position = noko.css('.jobtitle font').text\n # position = noko.xpath('//*[@id=\"job_header\"]/b/font').first.content\n company = noko.css('span.company').text\n elsif @job.web_address.include?('ziprecruiter.com')\n company = noko.css('span[itemprop=\"name\"]').text\n position = noko.css('.job_header h1').text\n else\n company = \"\"\n position = \"\"\n end\n\n p \"<>\"*47\n p company\n p position\n p session[:userinfo].info\n\n @job.position = position\n @job.create_company(name:company)\n @job.save\n\n current_user.jobs << @job\n\n redirect_to edit_job_path(@job), notice: 'Please verify the information obtained from the website.'\n\n end", "title": "" }, { "docid": "a8f47e26ec76e95a3c0bbd66171ed86c", "score": "0.5574107", "text": "def new_job_application(user, job)\n @user_name = user.name.titleize\n @job_title = job.title\n\n mail to: user.email, subject: \"New job application received\"\n end", "title": "" }, { "docid": "7d4a3c4a2ef70fb395603527a70358c1", "score": "0.5572395", "text": "def create\n @company = Company.find(params[:job][:company_id])\n\n @job = @company.jobs.new(params[:job].except(:company_id))\n respond_to do |format|\n if @job.save\n format.html { redirect_to job_url(@job), notice: 'Job was successfully created.' }\n format.json { render json: job_url(@job), status: :created, location: @job }\n else\n format.html { render action: \"new\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "83fbeddc1f938d7df859a62f7b3ffcd7", "score": "0.5571818", "text": "def create\n @build_job = BuildJob.new(:branch_id => params[:build_job][:branch], \n :base_version_id => params[:build_job][:base_version], \n :target_platform_id => params[:build_job][:target_platform], \n :notify_user_id => params[:build_job][:notify_user],\n :started_by_user => current_user,\n :enviroment => @enviroment,\n :status => BuildJob.statuses[:fresh],\n :result => BuildJob.results[:unknown],\n :comment => params[:build_job][:comment],\n :generate_build_numbers_url => generate_build_numbers_url(:json),\n :run_tests => params[:build_job][:run_tests])\n\n respond_to do |format|\n if @build_job.save\n format.html { redirect_to home_enviroments_path, notice: 'Build job was successfully created.' }\n format.json { render :show, status: :created, location: @build_job }\n else\n format.html { flash[:alert] = @build_job.errors.full_messages.join(', '); render :new }\n format.json { render json: @build_job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a5b28c2c65bcae762ed05b05c57b3319", "score": "0.55711", "text": "def job_details(shortcode)\n transform_to(:job, get_request(\"jobs/#{shortcode}\"))\n end", "title": "" }, { "docid": "c2aa6cb7c42ac8f4ca6cc782f185422b", "score": "0.5571046", "text": "def create\n @task = Task.new(task_params)\n @task.set_up_new_task\n @task.name=params[:name]\n job = @task.job\n\n TaskLog.new_log(@task, \"New task\", logged_in_user_helper)\n if @task.save\n redirect_to job_path(job)\n else\n redirect_to job_path(job)\n end\n\n end", "title": "" }, { "docid": "538fc6f0c879d49b43814b9a564d08b4", "score": "0.556703", "text": "def create\n @job = Job.new(params[:job])\n\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to @job, notice: 'Job was successfully created.' }\n format.json { render json: @job, status: :created, location: @job }\n\n else\n format.html { render action: \"new\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a64e184a525ea3d2ff24b46d487fcb21", "score": "0.5566744", "text": "def create\n @empr_job = EmprJob.new(params[:empr_job])\n\n respond_to do |format|\n if @empr_job.save\n format.html { redirect_to @empr_job, notice: 'Empr job was successfully created.' }\n format.json { render json: @empr_job, status: :created, location: @empr_job }\n else\n format.html { render action: \"new\" }\n format.json { render json: @empr_job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8fcfa0bd670e9d92704806e66dbc54f1", "score": "0.55661255", "text": "def create\n @job = Job.new(job_params)\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to tasks_url, notice: 'Lavorazione creata con successo' }\n format.json { render :show, status: :created, location: @job }\n else\n format.html { render :new }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1536a3def2b8e899741bbb394dbdbe53", "score": "0.5566066", "text": "def create\n @job = Job.new(job_params)\n end", "title": "" }, { "docid": "73b8de8f2aa058b18db08b6b30a2c39e", "score": "0.5557734", "text": "def create\n @job = Job.new(job_params)\n # sets the job status to 'created'\n @job.job_status_id = 1\n respond_to do |format|\n if @job.save\n format.html { redirect_to @job }\n format.json { render :show, status: :created, location: @job }\n else\n format.html { render :new }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n JobMailer.with(user: current_user).job_posted_email.deliver_now \n end", "title": "" }, { "docid": "23ce6f1938e9c504cd92fa11be978bc7", "score": "0.555657", "text": "def create\n @aplicationjob = Aplicationjob.new(aplicationjob_params)\n\n respond_to do |format|\n if @aplicationjob.save\n format.html { redirect_to @aplicationjob, notice: 'Aplicationjob was successfully created.' }\n format.json { render :show, status: :created, location: @aplicationjob }\n else\n format.html { render :new }\n format.json { render json: @aplicationjob.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a96a85edd0c85a6df42523af60a4aaa2", "score": "0.5555837", "text": "def new\n\t\tif is_current_user_employer?\n\t\t\t@job = Job.new\n\t\telse\n\n\t\tend\n\n\tend", "title": "" }, { "docid": "db6ea6443b10ce2401aad27556b2c465", "score": "0.55505514", "text": "def create\n params[:job][:status] = \"TO_VALIDATE\"\n params[:job][:language] = Locale.language_code\n @job = Job.new(params[:job])\n \n respond_to do |format|\n if @job.save\n flash[:notice] = 'Job was successfully created. Your offer will be validated soon.'\n UserNotifier.deliver_waiting_validation\n format.html { redirect_to(@job) }\n format.xml { render :xml => @job, :status => :created, :location => @job }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "42573653ba304999a9c589f19bee81b7", "score": "0.5550247", "text": "def create\n job_info = params[:job]\n user_id = current_user.id\n job_info[:user_id] = user_id\n\n @job = Job.new(job_info)\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to(@job, :notice => 'Job was successfully created.') }\n format.xml { render :xml => @job, :status => :created, :location => @job }\n format.json { render :json => @job, :status => :created, :location => @job}\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n format.json {render :json => @job.errors, :status => :unprocessable_entity}\n end\n end\n end", "title": "" }, { "docid": "cce434c8207d9a2f0562eab4bf6477a1", "score": "0.5545561", "text": "def create\n @job = Job.new(job_params)\n @job.update(bizowner_id: Bizowner.find_by(user_id: current_user.id).id)\n @job.update(status: true)\n respond_to do |format|\n if @job.save\n format.html { redirect_to @job, notice: 'Job was successfully created.' }\n format.json { render :show, status: :created, location: @job }\n else\n format.html { render :new }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b25335f81604509e40309e4802018ee6", "score": "0.5542409", "text": "def work(job); end", "title": "" }, { "docid": "b25335f81604509e40309e4802018ee6", "score": "0.5542409", "text": "def work(job); end", "title": "" }, { "docid": "d5f10b35c36e81ae15d0a1d5c495f1da", "score": "0.55414546", "text": "def create()\n\t\tclick Create_Task\n\t\twait_for(20) { is_displayed? Subject }\n\t\tclick Subject\n\t\t# binding.pry\n\t\twait_and_type_enter 'Automated Template', Type_Subject\n\t\twait_and_type_enter 'qateam@toutapp.com', Contact_Person\n\t\ttype_paragraph Notes, 2\n\t\tclick Save_Task\n\t\tsleep(2)\n\tend", "title": "" }, { "docid": "597f62167790ca717af742390f715373", "score": "0.55393195", "text": "def create\n @job = Job.new(params[:job])\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to @job.unit, notice: \"We have received your request for #{@job.task.name}.\" }\n format.json { render json: @job, status: :created, location: @job }\n else\n format.html { render action: \"new\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6ffcad021b5a9bf8ec0f460fcfaa3dbf", "score": "0.55370563", "text": "def create_job(users_file, connection_name)\n fail NotImplementedError\n end", "title": "" }, { "docid": "e21c5dc95168851031bc6a2eac006e9d", "score": "0.5536942", "text": "def create_batch\n begin\n # create the new batch\n batch = BatchJob.new\n batch.name = params[:name]\n batch.job_type = params[:type_id]\n batch.ocr_engine_id = params[:engine_id]\n batch.font_id = params[:font_id]\n batch.parameters = params[:params]\n batch.notes = params[:notes]\n batch.save!\n \n # populate it with pages from the selected works\n # payload: {work: id, pages: [pageId,pageId...]}\n json_payload = ActiveSupport::JSON.decode(params[:json])\n work_id = json_payload['work']\n json_payload['pages'].each do | page_id | \n job = JobQueue.new\n job.batch_id = batch.id\n job.page_id = page_id \n job.job_status = 1 \n job.work_id = work_id\n job.save!\n end\n \n render :text => batch.id, :status => :ok \n \n rescue => e\n render :text => e.message, :status => :error\n end \n end", "title": "" }, { "docid": "55fa12b9e71ccae521b6214d05a07e4b", "score": "0.5525067", "text": "def submit_job\n\n pdef = generate_process_definition\n self.process_definition = pdef\n \n save\n \n # RuoteAMQP::WorkitemListener.new(RuoteKit.engine)\n puts self.process_definition\n wfid = RuoteKit.engine.launch(self.process_definition)\n # Ruote.engine.wait_for(wfid)\n\n self.fei_wfid = wfid\n\n save\n \n end", "title": "" } ]
0dd89bc56841a2a2442ce7fc986e60c8
Deliver all leaflets for specified periodity
[ { "docid": "9dc75ef013096af6e0d5bd151870d7d2", "score": "0.7984575", "text": "def deliver_with_periodity(periodity)\n\n # Find suitable leaflets\n leaflets = Leaflet.with_periodity(periodity).populating\n \n puts \"[INFO] no leaflets found, skipping\" unless leaflets.any?\n\n leaflets.each do |leaflet|\n \n unless leaflet.entries.any?\n puts \"[INFO] no entries found for leaflet #{leaflet.id} in postbox #{leaflet.postbox.id}, skipping\"\n next \n end\n\n puts \"[INFO] leaflet #{leaflet.id} in postbox #{leaflet.postbox.id} scheduled for delivery\"\n deliver(leaflet)\n end\n end", "title": "" } ]
[ { "docid": "c27eb3beb8c88c310c930aa03e4e26dd", "score": "0.5302031", "text": "def schedule_plenaries\n\t\t@plenaries = Plenary.all\n\tend", "title": "" }, { "docid": "c27eb3beb8c88c310c930aa03e4e26dd", "score": "0.5302031", "text": "def schedule_plenaries\n\t\t@plenaries = Plenary.all\n\tend", "title": "" }, { "docid": "4ca8ed849d5c71bca60c489d9fc1ac28", "score": "0.51065964", "text": "def leave_for_delivery(slot_number)\n @parcel.delivery(slot_number)\nend", "title": "" }, { "docid": "9b2b80f4c05ba479d0b86c8eba6c1f2a", "score": "0.5011241", "text": "def perform_deliveries\n @asq.deliveries.each(&:deliver)\n end", "title": "" }, { "docid": "ace1cce23e921f7a21b1909b6c4cd95f", "score": "0.4992917", "text": "def add_people_late\n ### Adding at 50% of finished time\n\n #projected_completion_time = ProjectBlock.tot_cyclo*0.4\n current_work = ($timeline.workdate.day)\n #print \"Current work days \", current_work, \"\\n\"\n #print \"Extimated finish time \", projected_completion_time, \"\\n\"\n if ((current_work > (99.6)) and @idle_people.length > 0) then\n @active_people << @idle_people\n @@active_people2 << @idle_people\n @@active_people2.flatten!\n @active_people.flatten!\n print \" +++++++++++++++++++++++++++++++++++++++++++++++++++\", \"\\n\"\n # print \"Current Work days \", current_work_days/8.to_f, \"\\n\"\n # print \"Adding late arrival\", $timeline.workdate.to_s, \"\\n\"\n\n #@project_manager.add_dependants(@idle_people)\n\n @idle_people = Array.new\n end\n end", "title": "" }, { "docid": "0ee7ad45b53fce5538c1f44c78723c61", "score": "0.4992504", "text": "def redistribute_work_units\n release_work_units\n Thread.new { WorkUnit.distribute_to_nodes }\n end", "title": "" }, { "docid": "c713af095d85c230a748529fe122c744", "score": "0.49706903", "text": "def project_phase_deliverables\n project_phase_deliverables = []\n stock_deliverable_types.each do |stock|\n stock.deliverables.each do |d|\n project_phase_deliverables << d\n end\n end\n\n custom_deliverable_types.each do |custom|\n custom.deliverables.each do |d|\n project_phase_deliverables << d\n end\n end\n project_phase_deliverables\n end", "title": "" }, { "docid": "a3ae531dd4c6d24efbcd44448a0b6fcf", "score": "0.49585336", "text": "def puppetRunBatch(cluster, layer, interval)\n\n epoch = Time.now.to_i\n\n mc = rpcclient \"puppet\"\n mc.compound_filter \"deploop_collection=#{cluster} and deploop_category=/.*#{layer}/\"\n mc.progress = false\n\n nodes = mc.discover\n nodes = mc.discover.sort\n\n puts \"Deploying Puppet Run for nodes:\"\n puts nodes\n\n result = mc.runonce(:forcerun => true, :batch_size => interval)\n waitPuppetRun = Thread.new{checkForPuppetRun nodes, epoch}\n puts 'waiting for puppet run all catalog finished'\n\n waitPuppetRun.join\n puts 'DONE!'\n end", "title": "" }, { "docid": "e8086865c6538105649bb5ac4c3fef37", "score": "0.48762947", "text": "def apply_schedule_to_all\n common_schedule_params = schedule_params #this is to process the params only once. rather than calling inside each.\n @merchant = Merchant.find_by_id(params[:merchant_id])\n if params[:employee_schedules].present?\n @merchant.employees.each do |employee|\n @schedule = current_user.working_schedules.new(common_schedule_params)\n @schedule.schedule_name = employee.name\n if @schedule.save\n @schedule.working_days.each do |wd|\n wd.delay.generate_segment if wd.open\n end\n EmployeeSchedule.create(working_schedule_id: @schedule.id, employee_id: employee.id)\n end\n end\n elsif params[:equipment_schedules].present?\n @merchant.equipments.each do |equipment|\n @schedule = current_user.working_schedules.new(common_schedule_params)\n @schedule.schedule_name = equipment.name\n if @schedule.save\n @schedule.working_days.each do |wd|\n wd.delay.generate_segment if wd.open\n end\n EquipmentSchedule.create(working_schedule_id: @schedule.id, equipment_id:equipment.id)\n end\n end\n end\n\n if params[:schedule_type] == \"to_all\"\n @schedule.schedule_name += \"- #{params[:working_schedule][:schedule_name]}\"\n end\n respond_to do |format|\n flash[:notice] = t(\".create_working_schedule_successfully\")\n flash.keep(:notice)\n format.js { render :js => \"window.location.replace('#{working_schedules_url}');\" }\n end\n end", "title": "" }, { "docid": "e36356c7900178590e2bd3289f409397", "score": "0.48432213", "text": "def execute\r\n @Proxy.foreachDeliverable(@LstTargets) do |iDeliverable|\r\n @Proxy.visitDeliverable(iDeliverable, true) do |iVisitedDeliverable|\r\n buildDeliverable(iVisitedDeliverable)\r\n end\r\n end\r\n end", "title": "" }, { "docid": "703f4862948424fa3555ed9e593b650e", "score": "0.4840584", "text": "def collect_project_persons_egonets\n project = Project.find(params[:project_id]) \n persons = project.persons\n maxfriends = params[:max_friends]\n \n #Collect Friends of person\n persons.each do |person|\n person.friends_ids.each do |friend_id| \n Delayed::Job.enqueue(CollectPersonJob.new(friend_id,project.id,maxfriends))\n end\n end\n \n respond_to do |format|\n flash[:notice] = 'A two step with friendscount smaller than ' + maxfriends.to_s + ' will be collected. This might take a long time.'\n format.js do\n render :update do |page| \n page.reload\n end\n end\n end \n end", "title": "" }, { "docid": "879f3d0d00a7d29290f4cf8e28ad6a1d", "score": "0.48200187", "text": "def deliver_with\n configatron.blabber_mouth.deliver_with\n end", "title": "" }, { "docid": "8182a0caf99803a23f88bd7abcb2a3c7", "score": "0.47698554", "text": "def all(params = {})\n @client.make_request(:get, 'end_shippers', MODEL_CLASS, params)\n end", "title": "" }, { "docid": "a193ca52ce1983ef3313cf423b581333", "score": "0.47092932", "text": "def sell_shipping_countries_all (params={})\r\n req = request_params({locale: @locale}.merge(params))\r\n\r\n feed_or_retry do\r\n RestClient.get url, req\r\n end \r\n end", "title": "" }, { "docid": "4f08590e757cedcfebff4a04e1a9420a", "score": "0.4707701", "text": "def perform\n current_time = Time.now\n packages = find_packages(city_db_id)\n emails = find_emails(city_db_id)\n\n ## Create list of recipients as array of strings\n recipients = []\n emails.each do |email|\n recipients << email.email_value\n end\n\n Emailer.packages_notification(current_time,packages,recipients).deliver\n end", "title": "" }, { "docid": "7f4e015bb979eb3b2443b6f35f83e202", "score": "0.46731892", "text": "def publish_all\n\t\t@schedule.grades.where.not(status: [Grade.statuses[:published], Grade.statuses[:exported]]).each &:published!\n\t\tredirect_back fallback_location: '/'\n\tend", "title": "" }, { "docid": "f5b0830b2f738d4f3ae40acb3e435f64", "score": "0.4670298", "text": "def deliver\n #find all the abonnes emails\n @abonnes = Abonne.all.collect(&:email)\n # Sends the newsletter to each one\n @abonnes.each do |abonne|\n NewsletterMailer.deliver_newsletter(abonne, self)\n end\n # Set the delivered_at time to now\n self.update_attribute(:delivered_at, Time.now)\n end", "title": "" }, { "docid": "9102e52393e0704a77edaa4a4b797b4e", "score": "0.46366593", "text": "def notify_couriers\n @current_time = Time.zone.now\n\n @packages = find_packages(application_params[:city_db_id])\n\n @emails = find_emails(application_params[:city_db_id])\n\n ## Create list of recipients as array of strings\n @recipients = []\n @emails.each do |email|\n @recipients << email.email_value\n end\n\n # Tell the Emailer to send a notification email to all couriers\n Emailer.packages_notification(@current_time,@packages,@recipients).deliver\n end", "title": "" }, { "docid": "ad511886e1a192c266644bc5b7b1943f", "score": "0.46314323", "text": "def notify_finalpayment\n @pack = Packages.find( :all, :conditions => {:finalDelivery => true} )\n @pay = Payment.find( :all )\n if( @pack != nil ) && ( @pay != nil )\n @pack.each do |t|\n @pay.each do |s|\n if( t.id == s.packages_id ) && ( t.carriers_id = s.users_id )\n @notification = Notifications.new\n @notification.users_id = t.carriers_id\n @notification.description = \"an amout has been added to your account and another amount has been deducted\"\n @notification.save\n end\n end\n end\n end\n return;\n end", "title": "" }, { "docid": "4d445c8b20b66c9e3b3ac775a18a2774", "score": "0.46213865", "text": "def collect_all_project_entries\n @project = Project.find(params[:id])\n total_entries = 0\n \n puts \"Analyzing \" + @project.name.to_s + \" with \" + @project.persons.count.to_s + \" persons.\" \n \n @project.persons.each do |person|\n if person.private == false\n if person.statuses_count > 3200\n total_entries = total_entries + person.statuses_count - 3200\n else\n total_entries = total_entries + person.statuses_count\n end\n end\n Delayed::Job.enqueue(CollectAllFeedEntriesJob.new(person.id)) \n end \n \n respond_to do |format|\n flash[:notice] = total_entries.to_s + ' feed entries of the ' + @project.persons.count.to_s + ' people on this project will be collected. Please give it some time to finish.'\n format.js do\n render :update do |page| \n page.reload\n end\n end\n end \n end", "title": "" }, { "docid": "e742c59d35135ca7c33322a94df14463", "score": "0.46191564", "text": "def allocateBySATforEachDemand(demand)\n selfDefnWeightsArray = Array.new();\n nofBus = @simulator.savList.size();\n acceptedSizeArray = Array.new();\n allPairsHashArray = Array.new();\n deadlineArray = Array.new();\n # Anonymous1 04/02 -> extension for the case of (one demand n-passengers) via 'pickDropArray'\n pickDropArray = Array.new();\n # Anonymous1 04/09 -> number of carried\n nofCarried = Array.new();\n newDemandSize = 1;\n capacityArray = Array.new();\n tmpArray = Array.new();\n tmpHash = Hash.new();\n # for dealing with the capacity's inconsistency of dummyPoint\n busIDArrayWhoseBusIncludeDummy = Array.new();\n @simulator.savList.each{|sav|\n #sav.clearDummyViaPointsInTail();\n if sav.viaPointList.size()-1 > sav.viaPointIndex && sav.viaPointList.size() >= 2\n for i in sav.viaPointIndex..sav.viaPointList.size()-2\n if sav.viaPointList[sav.viaPointIndex].mode != :dummy && sav.viaPointList[i].mode == :dummy\n puts \"caught you!\";\n sav.viaPointList.delete_at(i);\n end\n end\n end\n for i in sav.viaPointIndex..sav.viaPointList.size()-1\n if sav.viaPointList[i].mode == :dummy\n busIDArrayWhoseBusIncludeDummy.push(1);\n break;\n elsif i == sav.viaPointList.size()-1 && sav.viaPointList[i].mode != :dummy\n busIDArrayWhoseBusIncludeDummy.push(0);\n end\n end\n tmpArray.clear();\n tmpArray.push(sav.fetchPosition());\n acceptedSizeArray.push(sav.viaPointList.size()-sav.viaPointIndex);\n for i in sav.viaPointIndex..sav.viaPointList.size()-1\n tmpArray.push(sav.viaPointList[i]);\n end\n tmpHash.clear();\n for i in 1..tmpArray.size()-1\n if tmpArray[i].mode == :pickUp\n for j in i+1..tmpArray.size()-1\n if tmpArray[i].demand == tmpArray[j].demand && tmpArray[j].mode == :dropOff\n tmpHash.store(j-1, i-1);\n break;\n end\n end\n end\n end\n allPairsHashArray.push(tmpHash.clone());\n tmpArray.push(demand.tripViaPoint.pickUp);\n tmpArray.push(demand.tripViaPoint.dropOff);\n for i in 1..tmpArray.size()-1\n if tmpArray[i].mode == :dropOff\n deadlineArray.push((1*(tmpArray[i].demand.tripRequiredTime.dropOff)).to_i);\n pickDropArray.push((-1*(tmpArray[i].demand.numPassenger)).to_i);\n elsif tmpArray[i].mode == :pickUp\n deadlineArray.push(0);\n pickDropArray.push((1*(tmpArray[i].demand.numPassenger)).to_i);\n elsif tmpArray[i].mode == :dummy\n deadlineArray.push(0);\n pickDropArray.push(0);\n end\n end\n nofCarried.push(sav.countNumOnBoard());\n for i in 1..tmpArray.size()-1\n for j in 0..tmpArray.size()-1\n selfDefnWeightsArray.push((1+1*(estimateTime(tmpArray[j], tmpArray[i], sav, :averageManhattan))).to_i);\n end\n end\n capacityArray.push(sav.capacity);\n if sav.countNumOnBoard() > sav.capacity\n #puts \"error numOnBorad: #{sav.countNumOnBoard()}\";\n #exit;\n end\n }\n #puts \"selfDefnWeightsArray: #{selfDefnWeightsArray}\";\n #puts \"nofBus: #{nofBus}\";\n #puts \"acceptedSizeArray: #{acceptedSizeArray}\";\n #puts \"allPairsHashArray: #{allPairsHashArray}\";\n #puts \"deadlineArray: #{deadlineArray}\";\n #puts \"pickDropArray: #{pickDropArray}\";\n #puts \"newDemandSize: #{newDemandSize}\";\n #puts \"capacityArray: #{capacityArray}\";\n encodingDone = false;\n if (nofBus * newDemandSize != 0) \n #wcnfGen(selfDefnWeightsArray, nofBus, acceptedSizeArray, allPairsHashArray, deadlineArray, newDemandSize, capacityArray);\n #runMaxSATSolver = \"../../encodedProblem/qmaxsat_g3 -cpu-lim=10 -card=mrwto -pmodel=0 -incr=1 ../../encodedProblem/test.wcnf ../../encodedProblem/externality.txt ../../encodedProblem/answer.txt > ../../encodedProblem/log.txt\";\n # for NCC\n encodingDone = wcnfGenNcc(selfDefnWeightsArray, nofBus, acceptedSizeArray, allPairsHashArray, deadlineArray, newDemandSize, capacityArray, busIDArrayWhoseBusIncludeDummy,pickDropArray,nofCarried);\n runMaxSATSolver = \"../../encodedProblem/qmaxsatNcc_g3 -cpu-lim=10 -card=mrwto -pmodel=0 -incr=1 ../../encodedProblem/test.wcnf ../../encodedProblem/externality.txt ../../encodedProblem/answer.txt > ../../encodedProblem/log.txt\";\n clearPreviousAns = \"rm ../../encodedProblem/answer.txt\";\n if encodingDone \n system(runMaxSATSolver);\n else\n system(clearPreviousAns);\n end\n end\n \n if encodingDone\n maxSATans = IO.readlines(\"../../encodedProblem/answer.txt\");\n else\n maxSATans = Array.new();\n maxSATans.push(\"UNSAT\");\n maxSATans.push(\"noEncodedProblem\");\n end\n if encodingDone && maxSATans[0].include?(\"OPT\") && maxSATans[1] != nil\n allocatedViaPointList = Array.new();\n tmpAnsReadLine = Array.new();\n busID = maxSATans[1].to_i;\n updateFlag = false;\n sav = @simulator.savList[busID-1];\n tmpAnsReadLine = maxSATans[2].split(\" \").map{|str| str.to_i};\n if sav.viaPointIndex == sav.viaPointList.size()\n for i in 0..sav.viaPointList.size()-1\n allocatedViaPointList.push(sav.viaPointList[i]);\n end\n for i in 1..tmpAnsReadLine.size()-1\n updateFlag = true;\n if ( (tmpAnsReadLine[i]-(acceptedSizeArray[busID-1]))%2 == 0 ) # pickUp\n allocatedViaPointList.push( demand.tripViaPoint.pickUp );\n else # dropOff\n allocatedViaPointList.push( demand.tripViaPoint.dropOff );\n end\n end\n elsif acceptedSizeArray[busID-1]+1 < tmpAnsReadLine.size()\n for i in 0..sav.viaPointIndex\n allocatedViaPointList.push(sav.viaPointList[i]);\n end\n for i in 2..tmpAnsReadLine.size()-1\n updateFlag = true;\n if (tmpAnsReadLine[i] > acceptedSizeArray[busID-1]+1)\n if ( (tmpAnsReadLine[i]-(acceptedSizeArray[busID-1]+1))%2 == 1 ) # pickUp\n allocatedViaPointList.push( demand.tripViaPoint.pickUp );\n else # dropOff\n allocatedViaPointList.push( demand.tripViaPoint.dropOff );\n end\n else\n allocatedViaPointList.push(sav.viaPointList[ sav.viaPointIndex+tmpAnsReadLine[i]-2 ]);\n end\n end\n end\n if ( updateFlag )\n tmpViaPointIndex = sav.viaPointIndex;\n sav.viaPointList.clear();\n #for i in 0..allocatedViaPointList.size()-1\n # sav.viaPointList.push(allocatedViaPointList[i]);\n #end\n for i in 0..allocatedViaPointList.size()-1\n if i <= tmpViaPointIndex || allocatedViaPointList[i].mode != :dummy\n sav.viaPointList.push(allocatedViaPointList[i]);\n else\n puts \"planned route includes dummyViaPoint (NOT FIRST POINT)!\";\n end\n end\n \n viaPointIndex = sav.viaPointIndex ;\n prevPos = sav.fetchPosition() ;\n currentTime = @simulator.currentTime ;\n (viaPointIndex...sav.viaPointList.size).each{|idx|\n viaPoint = sav.viaPointList[idx] ;\n diffTime = estimateTime(prevPos, viaPoint, sav, :averageManhattan) ;\n currentTime += diffTime ;\n\n # store new plan\n if(true) then\n if(viaPoint.mode == :pickUp) then\n viaPoint.demand.updatePlannedPickUpTime(currentTime) ;\n elsif(viaPoint.mode == :dropOff) then\n viaPoint.demand.updatePlannedDropOffTime(currentTime) ;\n end\n end\n\n prevPos = viaPoint.pos ;\n }\n \n sav.assignedDemandList.push(demand) ;\n sav.clearDummyViaPointsInTail();\n demand.sav = sav ;\n \n #@simulator.savList[busID-1] = sav;\n\n pushAllocatedDemand( demand ) ;\n end\n\n else #if maxSATans[0].include?(\"UNSAT\") || !encodingDone\n if maxSATans[1] != nil\n if maxSATans[1].include?(\"exceeDeadline\")\n puts \"UNSAT (reason: exceeDeadline)\";\n demand.cancel(@simulator, :exceedDropOffTime);\n elsif maxSATans[1].include?(\"exceedCapacity\")\n puts \"UNSAT (reason: exceedCapacity)\";\n demand.cancel(@simulator, :exceedCapacity);\n elsif maxSATans[1].include?(\"noEncodedProblem\")\n puts \"UNSAT (reason: noEncodedProblem)\";\n demand.cancel(@simulator, :notAssigned);\n else\n puts \"UNSAT (reason: searchTimeout)\";\n demand.cancel(@simulator, :notAssigned);\n end\n else\n puts \"Unknown reason\";\n demand.cancel(@simulator, :notAssigned);\n #exit;\n end\n pushCancelledDemand( demand ) ;\n end\n \n sumOFinished = 0;\n @simulator.savList.each{|sav|\n for i in 0..sav.viaPointIndex-1\n if sav.viaPointList[i] != nil && sav.viaPointList[i].mode == :dropOff\n sumOFinished += 1;\n end\n end\n }\n puts \"sumOFinished : #{sumOFinished} | timeCost : #{@simulator.currentTime}\";\n if @simulator.currentTime >= 44000\n puts \"Finished time : #{@simulator.currentTime}\";\n exit;\n end\n \n end", "title": "" }, { "docid": "dbcb0d237744000d4c259cc553633b70", "score": "0.46176952", "text": "def create_bell_schedule_work_order(type)\n @world[type].each do |school|\n if !school[\"offerings\"].nil? and school[\"offerings\"].size > 0\n school[\"offerings\"].each do |year, course_offerings|\n course_offerings.each do |course_offering|\n id = course_offering[\"id\"]\n ed_org_id = course_offering[\"ed_org_id\"]\n session = course_offering[\"session\"]\n course = course_offering[\"course\"]\n grade = course_offering[\"grade\"]\n\n title = GradeLevelType.to_string(grade) + \" \" + course[\"title\"]\n title = GradeLevelType.to_string(grade) if GradeLevelType.is_elementary_school_grade(grade)\n\n @queue.push_work_order({:type=>BellSchedule, :id=>id, :session=>session})\n end\n end\n end\n end\n end", "title": "" }, { "docid": "ea584d8db070ebc2bfd469bf6cb9aaaf", "score": "0.46018386", "text": "def notify_final_delivery\n @reports = Reports.get_all_reports\n @delivery = Packages.get_all_packages\n if( @delivery != nil ) && ( @reports != nil )\n @reports.each do|t|\n @delivery.each do|s|\n if( ( t.reported_id == s.senders_id ) && ( s.finalDelivery == false ) && ( t.packages_id == s.id ) )\n @notification = Notifications.create(s.senders_id, \"You should confirm the final delivery\")\n end\n end\n end\n end\n return;\n end", "title": "" }, { "docid": "e9caa3e601f876e1e2a2a11e6da6085a", "score": "0.45987737", "text": "def employeCourriels\n @periode = Periode.find(params[:id])\n @periode.paies.each do | paie |\n PaieMailer.releve(paie).deliver_later unless paie.employe.courriel.empty? || paie.total == 0\n end\n # Puisque nous avons expedie des courriels, il est impossible de changer la paie.\n @periode.locked = true;\n @periode.save!\n flash[:notice] = 'Courriels expédiés.'\n redirect_to @periode\n end", "title": "" }, { "docid": "cb6e30077a7cd8483724b919e12e289d", "score": "0.458474", "text": "def available_delivery_blocks(time)\n\n unless opens_today\n return []\n end\n\n # Reset date to compare with Postgres Time\n time = time.change(:month => 1, :day => 1, :year => 2000)\n\n lead_time_for_block_time_slots = 1.hour\n\n all_slots = block_slots.select { |slot| slot[:from] >= (time + lead_time_for_block_time_slots) } +\n live_slots.select { |slot| slot[:from] >= (time) }\n\n all_slots.map do |slot|\n {\n :from => slot[:from].strftime('%H:%M'),\n :to => slot[:to].strftime('%H:%M'),\n :type => slot[:type]\n }\n end\n end", "title": "" }, { "docid": "46eb63732ccd1f84cf5394708b08d9b6", "score": "0.45554477", "text": "def scheduled_notification\n @scheduled_time = params[:time]\n @city_db_id = application_params[:city_db_id]\n\n @scheduled_time.each do |time|\n Delayed::Job.enqueue(NotifyCouriersJob.new(@city_db_id), :run_at => time)\n end\n end", "title": "" }, { "docid": "8a8eb10ad5a9a69f194c9915033d4e76", "score": "0.4545479", "text": "def polled_delivery( recipient_email , pending_deliveries )\n @recipient_email = recipient_email \n @user = User.find_by_email @recipient_email \n @pending_deliveries = pending_deliveries\n time = Time.now\n \n mail( :to => recipient_email, \n :subject => \"pilipoto | Updates (#{pending_deliveries.count}): #{time}\", \n :bcc => [\"rajakuraemas@gmail.com\"] )\n \n end", "title": "" }, { "docid": "7a398e9a5abd5a1eacfe6a8244405b81", "score": "0.45351967", "text": "def download_all\n if platinum_user_and_above?\n @domains=Domain.where(\"name is not null\")\n template = Rails.root.join(\"app\",\"views\",\"reports\", \"DomainPortfolio-template.xlsx\")\n workbook = RubyXL::Parser.parse(template)\n worksheet = workbook.worksheets[0]\n worksheet.sheet_name = 'All'\n index = 0\n @domains.each do |domain|\n next if domain.name.nil?\n next if domain.name.empty?\n index += 1\n if domain.transferable\n my_row = [domain.name, \"yes\"]\n else\n my_row = [domain.name, \"no\"]\n end\n worksheet_write_row(worksheet,index, my_row)\n end\n file = \"DomainPortfolio-All-\" + Time.now.strftime('%m%d%Y') + \".xlsx\"\n send_data workbook.stream.string, filename: file, disposition: 'attachment'\n else\n redirect_back :fallback_location => root_path, :alert => \"Access denied.\"\n end\n end", "title": "" }, { "docid": "209965d8407a5064fcf34fadccf697b1", "score": "0.45321426", "text": "def pay_all_bills\n #self.appointments.update_all(cost: 0)\n self.appointments.each {|a| a.paid}\n end", "title": "" }, { "docid": "8322d3058a2ce4e8037f3c06d89d4762", "score": "0.45298293", "text": "def notify_final_delivery\n @reports = Reports.find( :all )\n @delivery = Packages.find( :all )\n if( @delivery != nil ) && ( @reports != nil )\n @reports.each do|t|\n @delivery.each do|s|\n if( ( t.reported_id == s.senders_id ) && ( s.finalDelivery == false ) && ( t.packages_id == s.id ) )\n @notification = Notifications.new\n @notification.users_id = s.senders_id\n @notification.description = \"You should confirm the delivery of the package\"\n @notification.save\n end\n end\n end\n end\n return;\n end", "title": "" }, { "docid": "d5035d92c37bfcd55074a3c0258bd275", "score": "0.45186427", "text": "def select_group_loan_for_savings_disbursement_start\n setup_group_loan_for_flushing_voluntary_savings \n add_breadcrumb \"Pending Pengembalian Tabungan\", 'select_group_loan_for_savings_disbursement_start_url'\n end", "title": "" }, { "docid": "232800e84424c7b61af225d95b49bc2f", "score": "0.4509625", "text": "def work_with_droplets\n load_droplets\n dispatch_droplets\n logger.debug 'Working with list of DigitalOcean droplets'\n thread_chain\n end", "title": "" }, { "docid": "73b2adb5dbd036d923175e81471ada92", "score": "0.44876736", "text": "def busy_customers(deliveries)\n secs_in_month = 60 * 60 * 24 * 30\n hash = {} # {id: [time difference, # of deliveries]}\n ans = []\n deliveries.each do |id, time|\n if hash[id]\n last_time, delivery_num = hash[id]\n if time - last_time < secs_in_month\n delivery_num += 1\n hash[id][1] = delivery_num\n next\n end\n end\n\n hash[id] = [time, 1]\n end\n\n hash.each do |id, arr|\n ans << id if arr[1] >= 3\n end\n\n ans\nend", "title": "" }, { "docid": "222467b174020d6db46a71f6acba6b1f", "score": "0.44814873", "text": "def publish(workload)\n link_workload = []\n unlink_workload = []\n\n workload.each do |entry|\n\n action = true\n\n @repository.create(entry[:suitename], entry[:component], entry[:architecture])\n\n package = Package.new(entry[:source_fullname], entry[:suitename], entry[:component])\n pool = Architecture.new(package.architecture, entry[:component], entry[:suitename], \"pool\")\n dists = Architecture.new(package.architecture, entry[:component], entry[:suitename], \"dists\")\n pool_fullname = File.join(pool.directory, package.basename)\n dists_fullname = File.join(dists.directory, package.basename)\n stage_fullname = package.fullname\n\n Dir.glob(\"#{pool.directory}/#{package.name}*.deb\") do |pool_fullname|\n pool_package = Package.new(pool_fullname, entry[:suitename], entry[:component] )\n if system(\"#{Cfg.dpkg} --compare-versions #{package.version} gt #{pool_package.version}\")\n puts \"Package: #{pool_package.newbasename} will be replaced with #{package.newbasename}\"\n elsif system(\"#{Cfg.dpkg} --compare-versions #{package.version} eq #{pool_package.version}\")\n puts \"Package: #{pool_package.newbasename} already exists with same version\"\n action = false\n next\n elsif system(\"#{Cfg.dpkg} --compare-versions #{package.version} lt #{pool_package.version}\")\n puts \"Package: #{pool_package.newbasename} already exists with higher version\"\n File.unlink(package.fullname)\n action = false\n next\n end\n end\n\n if action\n link_workload << {\n :source_fullname => pool_fullname,\n :destination_fullname => dists_fullname,\n :suitename => package.suitename,\n :component => package.component,\n :architecture => package.architecture\n }\n \n Dir.glob(\"#{dists.directory}/#{package.name}*.deb\") do |fullname|\n unlink_workload << {\n :destination_fullname => fullname,\n :suitename => package.suitename,\n :component => package.component,\n :category => 'dists'\n }\n end\n \n FileUtils.move(stage_fullname, pool_fullname) unless File.exists?(pool_fullname)\n end\n end\n \n @link.destroy(unlink_workload) unless unlink_workload.empty?\n @link.create(link_workload) unless link_workload.empty?\n @metafile.create unless link_workload.empty?\n end", "title": "" }, { "docid": "427839e069e59ea83bb03b9ce6ba6c14", "score": "0.44524938", "text": "def publish_all\n\t\tschedule = params[:schedule] && Schedule.find_by_id(params[:schedule])\n\t\tgrades = schedule && schedule.grades.where.not(status: [Grade.statuses[:published], Grade.statuses[:published], Grade.statuses[:exported]])\n\t\tgrades.each &:published!\n\t\tredirect_back fallback_location: '/'\n\tend", "title": "" }, { "docid": "ab394d3a72ea82f0f17cdeee1d6efdcd", "score": "0.44523796", "text": "def notify\n graduate_course = GraduateCourse.find(params[:graduate_course])\n subperiod = params[:subperiod].to_i\n year = params[:year]\n if true\n head :ok\n start(graduate_course,subperiod,year)\n cap = Capability.find_by_name(\"Gestione schemi d'orario\")\n puts \"INIZIATO\"\n receivers = graduate_course.users.find(:all, :include => :capabilities, :conditions => [\"capabilities.id = ?\", cap.id])\n receivers.each do |r|\n TeacherMailer.deliver_timetable_calculate_is_started(r,graduate_course,params[:subperiod].to_i)\n end\n else\n head :unavailable\n end\n end", "title": "" }, { "docid": "e908048e104b784aecc61962abc964d2", "score": "0.4451788", "text": "def watermelons\n [Pack.new(3, Money.new(699, 'NZD')),\n Pack.new(5, Money.new(899, 'NZD'))]\n end", "title": "" }, { "docid": "6e49fb06ec56136e67f67f1fe04ab76e", "score": "0.44488284", "text": "def index\n @deliverables = Deliverable.all\n end", "title": "" }, { "docid": "89271f667fe7bfc67aede8211d5ed783", "score": "0.44484308", "text": "def newDemandListForCycle()\n list = @innerFactory.newDemandListForCycle() ;\n list.each{|demand|\n selectParty().allocDemand(demand) ;\n }\n \n return list ;\n end", "title": "" }, { "docid": "b9c91f0be3ce0fdce21f05198ea15c2c", "score": "0.4438422", "text": "def rb_deliver(pj, data)\n if pj != @pid\n puts @pid.to_s+\" rb_deliver \"+data[:m].to_s+\" od \"+pj.to_s+\" s vc:\"+data[:vc].to_s\n\n @pending << [pj, data]\n # potreba nekolikrat zavolat deliver_pending kvuli podmince while exists\n # prvni zprava v pending se totiz muze preskocit, pak se doruci druha\n # a az pak je potreba dorucit tu prvni... tohle je oklika pred slozitym cyklem\n # a podminkami\n 1.upto(THREAD_CNT) {\n self.deliver_pending\n }\n end\n end", "title": "" }, { "docid": "0e782ac740182142acbcb948f005e37d", "score": "0.44360247", "text": "def getLeases\n broker_url = APP_CONFIG['broker_ip'] + ':' + APP_CONFIG['broker_port'].to_s\n result = HTTParty.get(broker_url + \"/resources/leases\", :verify => false)\n temp = JSON.parse(result.body)\n leases = []\n puts \"Test\"\n puts temp\n if ! temp.has_key?(\"exception\")\n temp[\"resource_response\"][\"resources\"].each do |lease|\n #puts \"Allagh wras sta leases sumfwna me to timezone tou xrhshth\"\n #puts lease[\"valid_from\"]\n lease[\"valid_from\"] = Time.strptime(lease[\"valid_from\"], '%Y-%m-%dT%H:%M:%S%z').in_time_zone(Time.zone).to_s\n #puts lease[\"valid_from\"]\n #puts lease[\"valid_until\"]\n lease[\"valid_until\"] = Time.strptime(lease[\"valid_until\"], '%Y-%m-%dT%H:%M:%S%z').in_time_zone(Time.zone).to_s\n #puts lease[\"valid_until\"]\n\n leases << lease\n\n end\n end\n return leases\n end", "title": "" }, { "docid": "c877665ee94c8915c5cb72ff03c16e3b", "score": "0.4434714", "text": "def with_all_portals\n portal(true)\n end", "title": "" }, { "docid": "c877665ee94c8915c5cb72ff03c16e3b", "score": "0.4434714", "text": "def with_all_portals\n portal(true)\n end", "title": "" }, { "docid": "9fc8c1f5c5f2b1600456197ac0a637f9", "score": "0.44329777", "text": "def find_deps\n\t\t# This will list all of the buses with departures on this date.\n\t\t# There will be at least one because the date selector uses a similar formula.\n\t\t@departures = [['UW Campus', 0]] + (Bus.where(:date => params[:date], :status => :open).select{|b| !b.maximum_seats || b.available_tickets('to_waterloo') > 0}.collect {|b| [b.destination.name + ', ' + b.arrive_time.strftime(\"%k:%M\"), b.id]})\n\n\t\tparams[:buying] == 'true' ? (render :partial => \"tickets/buying2\") : (render :partial => \"tickets/selling2\")\n\tend", "title": "" }, { "docid": "4b3fb64e4b2a734a113485b7ac02663a", "score": "0.44167864", "text": "def set_archive\n @archive_eleves = Elefe.where(:created_at => @date_fondation..@sept_courant, :updated_at => @date_fondation..@sept_courant).all\n end", "title": "" }, { "docid": "1bb5c3e259c347889f8af6105f284164", "score": "0.44124883", "text": "def distribute_gels\n show do\n title \"Equally distribute melted gel slices between tubes\"\n note \"Please equally distribute the volume of the following tubes each between two 1.5 mL tubes:\"\n table operations.select{ |op| op.temporary[:is_divided]}.start_table\n .input_item(INPUT)\n .end_table\n note \"Label the new tubes accordingly, and discard the old 1.5 mL tubes.\"\n end if operations.any? { |op| op.temporary[:is_divided] }\n end", "title": "" }, { "docid": "0104ecd844d79a0607a44845b710c70c", "score": "0.44104195", "text": "def generate_bills\n month_to_bill = params[:date][:bill_month]\n year_to_bill = params[:date][:bill_year]\n x=params[:tenant][:id]\n#@invoicearray=[]\n#@tenants = Tenant.all\n@tenant2 = Tenant.find(x)\n @manager = Manager.find(@tenant2.manager_id)\n@testarray = []\n@zones = @tenant2.zones.all\n @zones.each do | zn |\n puts zn.name\n if zn.bill_type=\"BO\"\n puts 'Yippee'\n @to = TovList.new\n @to.zone=zn\n puts zn.event_id\n @to.build_list(zn.event_id, month_to_bill.to_i, year_to_bill.to_i)\n @testarray << @to\n\n end\n end\n\nend", "title": "" }, { "docid": "95b485a022a685fdd191214d9bce59ee", "score": "0.44094223", "text": "def buy\n\t\t@dates = Bus.where(:status => :open).select{|b| !b.maximum_seats || b.available_tickets('from_waterloo') > 0 || b.available_tickets('to_waterloo') > 0 }.collect {|b| b.date }.uniq\n\t\t@gmapkey = Keys.gmap\n\tend", "title": "" }, { "docid": "f1af3a15f56bf07e15024f7965515903", "score": "0.44081262", "text": "def collect\n redirect_to history_path\n if Rails.env == 'production'\n flash[:notice] = \"This feature's for testing only.\"\n return\n end\n\n current_user.pledges.active.each do |p|\n p.collect\n end\n end", "title": "" }, { "docid": "c540633446624b43ee4a823c18b94f4b", "score": "0.44010493", "text": "def collect_all_entries\n person = Person.find(params[:id])\n Delayed::Job.enqueue(CollectAllFeedEntriesJob.new(person.id))\n\n respond_to do |format|\n format.js do\n render :update do |page|\n flash[:notice] = 'FeedEntries will be collected. Around ' + person.statuses_count.to_s + ' Feed entries will be gathered.'\n page.reload\n end\n end\n end\n end", "title": "" }, { "docid": "bd6eb45fc3a785202f330983d195e667", "score": "0.4392423", "text": "def add_leave_types\n add_leave_type_data(params)\n required_leave_type_ids(params) if params[:leave_group].present?\n leave_year = LeaveYear.active_leave_year \n @employees = LeaveGroupEmployee.find_all_by_leave_group_id(params[:id])\n employees_ids = @employees.collect(&:employee_id)\n current_date = FedenaTimeSet.current_time_to_local_time(Time.now).to_date\n update_credit = params[:update_credit]\n if update_credit == \"1\" and employees_ids.present?\n @log = LeaveCredit.new({:credit_value => EmployeeAttendance.reset_value(@credit_type,employees_ids),:employee_count => employees_ids.count,\n :leave_type_ids => @credit_leave_typs_id ,:credited_date => current_date, :credit_type => @credit_type, \n :credited_by => @current_user.id, :is_automatic => false, :status => 1,:remarks => @remarks, :leave_year_id => leave_year.id})\n Delayed::Job.enqueue(DelayedUpdateEmployeeLeave.new(params[:id], @log.id, @credit_leave_typs_id ,employees_ids, true, @removed_leave_types)) if @log.save\n end\n if request.put? and @leave_group.update_attributes(params[:leave_group])\n add_leave_type_flash(update_credit, employees_ids)\n render :update do |page|\n page.redirect_to(leave_group_path(@leave_group))\n end\n else\n @leave_group.build_leave_types\n render_leave_types_form\n end\n end", "title": "" }, { "docid": "1ac33520b4e89b04a09e0264eb296679", "score": "0.43923706", "text": "def cycle_all(formatted_date)\n\n # Create array of current chores for use later when rotating chores\n chore_cycles_previous_chores = []\n @chore_cycles.each do |cycle|\n previous_chores = []\n cycle.people.each { |person| \n previous_chores << person.chore }\n chore_cycles_previous_chores << previous_chores\n end\n\n # Set current chores to nil, then cycle, send emails, and update file info\n @residents.each { |resident| resident.chore = nil}\n @chore_cycles.each_with_index { |cycle, index| cycle.rotate(chore_cycles_previous_chores[index])}\n @residents.each { |resident| resident.send_email(formatted_date)}\n write_info_file\nend", "title": "" }, { "docid": "58d06cdd65ce242e66ca344bd3521e02", "score": "0.43905294", "text": "def perform\n User.find_each do |user|\n transfers =\n user.received_transfers.newest_first.pending\n .where('created_at <= ?', Time.zone.now - 3.days)\n next if transfers.empty?\n TransferMailer.pending_transfers(transfers, user).deliver_now\n end\n end", "title": "" }, { "docid": "602336b81f0e0724969c7cf4a4d1853f", "score": "0.43864304", "text": "def firing\n @number = time_passing # calls on time_passing method to roll die and determine number of people to fire\n @number.times do\n @waiting_list << @people_currently_working.pop\n end\n puts \"Three months have passed. A #{@number} was rolled. Here is our new waiting list.\"\n return @waiting_list\n end", "title": "" }, { "docid": "8d219057271a5c4d5767ad59e244fd03", "score": "0.43834755", "text": "def end_month\n @month += 1\n\n # produce\n production_vol = @factories.select { _2 }.map {|type, employees|\n case type\n when :manual\n employees[:junior] * 20 + employees[:intermediate] * 40 + employees[:senior] * 80\n when :semi\n employees[:junior] * 50 + employees[:intermediate] * 60 + employees[:senior] * 80\n when :full\n employees[:junior] * 80 + employees[:intermediate] * 80 + employees[:senior] * 80\n when :idle\n 0\n else\n raise 'Must not happen'\n end\n }.sum\n if @ingredient * 2 < production_vol\n production_vol = @ingredient * 2\n end\n\n @ingredient -= production_vol / 2\n\n if @ingredient + @product + production_vol <= @storage\n # good\n else\n # pay penalty\n @money -= 100 * (@ingredient + @product + production_vol - @storage)\n production_vol = @storage - @product - @ingredient\n end\n \n @product += production_vol\n\n # gain sales\n @contracts.each do |contract|\n (required_products, fee) = contract[current_month]\n if required_products <= @product\n # good\n @product -= required_products\n @money += fee\n else\n # penalty\n @money -= fee * 10\n end\n end\n\n # pay fees\n @money -= @storage / 100\n @money -= @factories.values.compact.map {|employees|\n employees[:junior] * 3 + employees[:intermediate] * 5 + employees[:senior] * 9\n }.sum\n\n if @money < 0\n puts 'Game over'\n elsif 1000 <= @money\n puts \"Game clear! #{month}\"\n else\n status()\n end\nend", "title": "" }, { "docid": "135e2bedf1c9195fadfcb936256ff9c5", "score": "0.43796423", "text": "def produce_fleet(days, *types)\r\n #..\r\nend", "title": "" }, { "docid": "239224f8deba63eda6e9385abe0aa85a", "score": "0.43763754", "text": "def workload_alerts\n people = Person.find(:all, :conditions=>\"has_left=0 and is_supervisor=0 and is_transverse=0\", :order=>\"name\")\n @workloads = []\n for p in people\n @workloads << Workload.new(p.id,{},{})\n end\n @workloads = @workloads.select{|w| w.next_month_percents < 95 or w.next_month_percents > 115}.sort_by {|w| [w.next_month_percents]}\n\n @from = APP_CONFIG['workload_alerts_email_source']\n @recipients = APP_CONFIG['workload_alerts_email_destination']\n @subject = \"[EISQ] Workload alerts\"\n @headers = {}\n content_type \"text/html; charset=utf-8\"\n end", "title": "" }, { "docid": "27399e287a194ce499f67ac82c7056e3", "score": "0.43694428", "text": "def water_all\n @plants = current_user.plants.all\n failed_plants = []\n success_plants = []\n\n @plants.each do |plant|\n if create_water_event(plant.id.to_s).save\n success_plants.push(plant)\n else\n failed_plants.push(plant)\n end\n end\n\n if !success_plants.empty?\n response = WaterEvent.where(plant_id: @plants.ids, watered: false)\n render json: response, status: :ok\n end\n end", "title": "" }, { "docid": "958f5015a4cb030f61f7ae8dcb299b08", "score": "0.43690294", "text": "def run\n\t\twhile !@collection.complete?\n\t\t\tbuyPack\n\t\tend\n\tend", "title": "" }, { "docid": "653df8d738a3198398cde0f0c97aea4c", "score": "0.4367588", "text": "def batch_update\n params['hold_list']&.each do |hold_key|\n ws_args = { hold_key:, session_token: current_user.session_token }\n\n if params[:pickup_library].present?\n ChangePickupLibraryJob.perform_later **ws_args, pickup_library: params[:pickup_library]\n end\n\n if params[:pickup_by_date].present?\n ChangePickupByDateJob.perform_later **ws_args, pickup_by_date: params[:pickup_by_date]\n end\n end\n\n render plain: 'Update scheduled', status: :ok\n end", "title": "" }, { "docid": "2afe7b2f07904e0008120293a695c977", "score": "0.43670136", "text": "def perform(batch_id)\n # Rails.logger.debug \"\\033[31m UpdateActiveTrayPlansJob: #{batch_id} \\033[0m\"\n # Find the corresponding batch\n batch = Cultivation::Batch.find(batch_id)\n # Find all 'phase' tasks\n phases = Cultivation::QueryBatchPhases.call(batch).booking_schedules\n # Find all tray locations in database\n locations = QueryReadyTrays.call(batch.facility_id).result\n # Find all existing TrayPlans\n tray_plans = Cultivation::TrayPlan.where(batch_id: batch_id)\n # Culculate number of Active Plants, capacity that needs to be booked.\n phases.each do |phase_info|\n plant_groups, total = group_plants_by_location(batch_id, phase_info.phase)\n # p \"total: #{total}\"\n plant_groups.each do |location_id, location_plants|\n tray = locations.detect { |a| a.tray_id.to_s == location_id.to_s }\n if !location_plants.empty?\n quantity = location_plants.length\n # Find existing TrayPlan for this location & phase\n phase_plans = tray_plans.where(phase: phase_info.phase,\n tray_id: location_id)\n # Delete existing Tray Plans\n phase_plans.delete_all if !phase_plans.empty?\n # Create Tray Plan(s)\n recreate_tray_plans(batch_id, phase_info, quantity, tray)\n # Update batch's growth stage\n batch.current_growth_stage = phase_info.phase\n end\n end\n # Update info back to batch\n batch.quantity = total\n batch.save!\n end\n end", "title": "" }, { "docid": "2a4ef43fcc859c1a79429e7c95442b64", "score": "0.43669713", "text": "def transfer_to_streams params\n \n Notifyer.print( 'Stake#transfer_to_streams' , params: params ) if Rails.env.development?\n\n begin\n self.stakeholders.each do |stake|\n\n params[:amount] = stake.flat_rate_in_cent * params[:all_fees_in_percent]\n params[:application_fee] = stake.flat_rate_in_cent - params[:amount]\n \n stake.charge_succeeded params\n end\n rescue => e\n errored('Stake#transfer_to_streams', e )\n end \n end", "title": "" }, { "docid": "f2b8d7dede0472b2276eddf93e675819", "score": "0.4366062", "text": "def getDeliverableTypes\n @projectPhase = ProjectPhase.find(@project_phase_id)\n @deliverableTypes = DeliverableType.find_all_by_lifecycle_phase_id(@projectPhase.lifecycle_phase_id)\n @deliverableTypesArray = []\n @deliverableTypes.each do |type|\n @deliverableTypesArray.append([type.name,type.id])\n end\n end", "title": "" }, { "docid": "8a49df48d80f8323d2129c05d59aac06", "score": "0.4365855", "text": "def publish_finished\n\t\t@schedule.grades.finished.each &:published!\n\t\tredirect_back fallback_location: '/'\n\tend", "title": "" }, { "docid": "80f370335853783705c8e24572960996", "score": "0.43631494", "text": "def periodic_inventory period, store=nil\n # get sales, conditional filter for store\n inventories = Inventory.where(product: self)\n inventories = inventories.where(store: store) unless store.nil?\n\n # conditional filters based on day, week, month\n case period\n when \"day\"\n sales = inventories.group_by_day(:lcbo_updated_on).sum(:sales)\n shipments = inventories.group_by_day(:lcbo_updated_on).sum(:shipment)\n when \"week\"\n sales = inventories.group_by_week(:lcbo_updated_on).sum(:sales)\n shipments = inventories.group_by_week(:lcbo_updated_on).sum(:shipment)\n when \"month\"\n sales = inventories.group_by_month(:lcbo_updated_on).sum(:sales)\n shipments = inventories.group_by_month(:lcbo_updated_on).sum(:shipment)\n end\n\n # helper function to merge sales, shipments in to weeks\n ApplicationHelper.merge_group_stats(\n sales,\n shipments\n )\n end", "title": "" }, { "docid": "a44576c3c791a508614649587f3054dc", "score": "0.43631196", "text": "def getDeliverableTypeList(lifecycle_phase)\n return DeliverableType.find_all_by_lifecycle_phase_id(lifecycle_phase)\n end", "title": "" }, { "docid": "ee697ce0ae4779ca5ee1006ef893e47e", "score": "0.43611804", "text": "def handle_completly_uncontested!\n\n # sole party get three seats\n sole_party = @parties.first\n sole_party.award(3)\n\n # TODO: fix this demeter violation\n other_major = sole_party.null_opposing_major\n other_major.award(1)\n @parties << other_major\n\n # one seat to third party\n # TODO: fix this demeter violation\n third_party = sole_party.null_coalition_minor\n third_party.award(1)\n @parties << third_party\n end", "title": "" }, { "docid": "4554046bc87e02a381291fe830555b28", "score": "0.43595323", "text": "def leave_settlement\n if @faculty.eligible_for_leave_settlement?(@generation_date)\n leaves_to_encash = LeaveEncashment.employee_leave_encashments(@faculty, @generation_date.year.to_s).first.try(:no_of_leaves_to_be_encashed).to_i\n ((basic.to_f/@generation_date.end_of_month.day) * leaves_to_encash)\n end\n end", "title": "" }, { "docid": "77aef9c3903d0bb065a63cf06f528666", "score": "0.43536437", "text": "def launch_longships(longships)\n # new scope\n launch_longships = 0 # < we can use launch_ships here cause its within a new scope\n\n longships.each do |longship|\n # new scope\n longship_name = \"#{longship.owner.name}'s Reaver\"\n\n longship.launch\n launched_ships += 1\n puts \"#{longship_name} successfully launched\"\n end\n # Now we exited the loop no long have access to longship or longship_name\n # launched_ships is within scope\n puts \"We launched #{launched_ships} ships!\"\n end", "title": "" }, { "docid": "b8dcc23ff90dc70a885027d5fdc05c4d", "score": "0.43533784", "text": "def exchange_bay(from_bay_id , to_bay_id)\n from_level = Level.where(:bay_id => from_bay_id)\n to_bay = Bay.find(to_bay_id)\n from_level.each do |level|\n from_position = Position.where(:level_id => level.id)\n from_position.each do |position|\n to_position = Position.where(\"sm_warehouse_id = ? AND sm_zone_id = ? AND sm_aisle_id = ? AND sm_bay_id = ? AND sm_level_id = ? AND sm_pos_id = ? \" , \n to_bay.sm_warehouse_id, to_bay.sm_zone_id, to_bay.sm_aisle_id, to_bay.sm_bay_id , level.sm_level_id , position.sm_pos_id).first\n exchange_location(position.id , to_position.id) \n end\n end\n end", "title": "" }, { "docid": "abeb5a2d5dffe16826f3da92e13e19fb", "score": "0.43501264", "text": "def periodic period, options={}, &block\n worker([], options.merge({:with_period => period}), &block)\n end", "title": "" }, { "docid": "e8698926e32ec1f6c8042af4d8869f9f", "score": "0.4344908", "text": "def setup_deliveries(order)\n recent_deliveries = order.market.deliveries.recent.active.uniq\n future_deliveries = order.market.deliveries.future.active.uniq\n\n @deliveries = recent_deliveries | future_deliveries | [order.delivery]\n end", "title": "" }, { "docid": "524b4c5a39d0858605129f1cd270dc5a", "score": "0.43436438", "text": "def loan(lender, lendee, amount)\n lender[:monies] -= amount\n lendee[:monies] += amount\n return [lender[:monies], lendee[:monies]]\nend", "title": "" }, { "docid": "c4d24891681f9d3172336a485ce396f9", "score": "0.432581", "text": "def send_to_all\n User.newsletters_allowed.each do |user|\n UserMailer.delay.new_newsletter(user, self)\n end\n end", "title": "" }, { "docid": "26483201ac66ff96dd22e7741f99de2d", "score": "0.43258092", "text": "def notify_finalpayment\n @pack = Packages.get_packages_final_payment\n @pay = Payment.get_all_payments\n if( @pack != nil ) && ( @pay != nil )\n @pack.each do |t|\n @pay.each do |s|\n if( t.id == s.packages_id ) && ( t.carriers_id = s.users_id )\n @notification = Notifications.create(t.carriers_id, \"as a carrier an amount has been added to your account and another amount has been deducted\")\n end\n end\n end\n end\n return;\n end", "title": "" }, { "docid": "0fc3fba532682b69384e2a2c738d95f8", "score": "0.43229848", "text": "def pay_active_subscriptions!\n\t\t# puts \"PAY_ACITVE_SUBSCRIPTIONS 1, center: #{@center.inspect} subs: #{@center.subscriptions.size} #{@center.subscriptions.inspect}\"\n result = @center.subscriptions.map { |sub|\n\t\t\t# puts \"SUB_SERVICE: pay #{sub.inspect}\"\n\t \t\tsub.pay! }\n\t\t# puts \"PAY_ACTIVE_SUBSCRIPTIONS result: #{result.inspect}\"\n end", "title": "" }, { "docid": "77a2bb98bcbbe3196751d37dfa9210d7", "score": "0.43100893", "text": "def deliver(start_address, end_address)\n papertotal = 0\n\n\n\n if @side == \"even\"\n (start_address..end_address).each do |x|\n if x.even?\n papertotal += 1\n end\n end\n else\n (start_address..end_address).each do |x|\n if x.odd?\n papertotal += 1\n end\n end\n end\n\n if papertotal > quota\n @daypay = quota * 0.25 + (( papertotal - quota) * 0.5)\n @earnings += @daypay\n else\n @daypay = papertotal*0.25\n @earnings += @daypay - 2\n end\n @experience += papertotal\n return @daypay\n end", "title": "" }, { "docid": "bc8c06d6e8740996cb23f40edae28992", "score": "0.43096456", "text": "def in_transit_days\n \tresult = []\n \tdelivery_duration.times do |num|\n active_day = num_to_day((day_to_num(self.order_day) + num) % 7)\n \t\tresult << active_day if active_day != self.order_day && active_day != self.delivery_day\n \tend\n \tresult\n end", "title": "" }, { "docid": "881eebc86eb2eb07719b8deb427c2dd5", "score": "0.4306318", "text": "def find_all_pending_publication\n find(:all, :conditions => [\"kases.status = ? AND kases.published_at < ?\", \n 'created', Time.now.utc - 30.days])\n end", "title": "" }, { "docid": "72a2f63f1c08e8dc69f255c6d2c66bc5", "score": "0.43003997", "text": "def winners_head_of_organisation_notification(award_year)\n awarded_application_ids = award_year.form_answers.business.winners.pluck(:id)\n\n awarded_application_ids.each do |form_answer_id|\n Users::WinnersHeadOfOrganisationMailer.notify(form_answer_id).deliver_later!\n end\n end", "title": "" }, { "docid": "75a525aff37beb7db98c39d524ca3f65", "score": "0.429746", "text": "def killall\n scheduler_enabled = scheduler.enabled?\n\n plan.permanent_tasks.clear\n plan.permanent_events.clear\n plan.missions.clear\n plan.transactions.each do |trsc|\n trsc.discard_transaction!\n end\n\n scheduler.enabled = false\n quit\n join\n\n if @application_exceptions\n process_pending_application_exceptions\n end\n\n start_new_cycle\n process_events\n cycle_end(Hash.new)\n\n ensure\n scheduler.enabled = scheduler_enabled\n end", "title": "" }, { "docid": "0de8baa6e084308fca64e01c1060fb23", "score": "0.42940482", "text": "def cyclic_occupation_detail(month, year)\n\n date_from = Date.civil(year, month, 1)\n date_to = Date.civil(year, month, -1)\n result = {}\n\n # Get planned activities\n condition = Conditions::JoinComparison.new('$and', \n [Conditions::Comparison.new(:date,'$gte', date_from),\n Conditions::Comparison.new(:date,'$lte', date_to)\n ]) \n planned_activities = condition.build_datamapper(::Yito::Model::Booking::PlannedActivity).all(\n :order => [:date, :time, :activity_code]\n ) \n\n # Build the structure\n activities = ::Yito::Model::Booking::Activity.all(active: true, occurence: :cyclic)\n\n activities.each do |activity|\n \n # Build item prices hash\n item_prices = {}\n if activity.number_of_item_price > 0\n (1..activity.number_of_item_price).each do |item_price|\n item_prices.store(item_price, 0)\n end\n end\n \n\n # Fill with the activity turns\n activity_detail = {}\n activity.cyclic_turns_summary.each do |turn|\n # Build days hash\n days = {}\n (1..(date_to.day)).each do |day| \n date = Date.civil(year, month, day)\n modified_capacity = planned_activities.select do |item|\n item.date.strftime('%Y-%m-%d') == date.strftime('%Y-%m-%d') and \n item.time == turn and\n item.activity_code == activity.code\n end\n real_capacity = modified_capacity.size > 0 ? modified_capacity.first.capacity : activity.capacity\n\n if activity.cyclic_planned?(date.wday)\n days.store(day, {quantity: (item_prices.empty? ? 0 : item_prices.clone),\n pending_confirmation: (item_prices.empty? ? 0 : item_prices.clone),\n capacity: real_capacity,\n planned: true})\n else\n days.store(day, {quantity: '-',\n pending_confirmation: (item_prices.empty? ? 0 : item_prices.clone),\n capacity: real_capacity,\n planned: false})\n end \n end\n activity_detail.store(turn, days) \n end\n\n # Store the item\n result.store(activity.code, {name: activity.name,\n capacity: activity.capacity,\n price_literals: activity.price_definition_detail,\n number_of_item_price: activity.number_of_item_price,\n occupation: activity_detail})\n end\n\n # Fill with the orders\n\n sql =<<-SQL\n select o_i.item_id, o_i.date, o_i.time, o_i.item_price_type, CAST (o_i.status AS UNSIGNED) as status, sum(quantity) as quantity\n from orderds_order_items o_i\n join orderds_orders o on o.id = o_i.order_id\n join bookds_activities a on a.code = o_i.item_id \n where o.status NOT IN (3) and o_i.date >= ? and o_i.date <= ? and \n a.occurence IN (3)\n group by o_i.item_id, o_i.date, o_i.time, o_i.item_price_type, o_i.status\n SQL\n\n orders = repository.adapter.select(sql, date_from, date_to)\n\n orders.each do |order|\n if result[order.item_id] and\n result[order.item_id][:occupation] and\n result[order.item_id][:occupation][order.time] and \n result[order.item_id][:occupation][order.time][order.date.day]\n # Prepare not planned activities that have been ordered\n if result[order.item_id][:occupation][order.time][order.date.day][:quantity] == '-'\n activity = ::Yito::Model::Booking::Activity.first(code: order.item_id)\n item_prices = {}\n if activity.number_of_item_price > 0\n (1..activity.number_of_item_price).each do |item_price|\n item_prices.store(item_price, 0)\n end\n end\n result[order.item_id][:occupation][order.time][order.date.day][:quantity] = item_prices\n end\n if result[order.item_id][:occupation][order.time][order.date.day][:quantity][order.item_price_type] and\n result[order.item_id][:occupation][order.time][order.date.day][:pending_confirmation][order.item_price_type]\n result[order.item_id][:occupation][order.time][order.date.day][:pending_confirmation][order.item_price_type] += order.quantity if order.status == 1\n result[order.item_id][:occupation][order.time][order.date.day][:quantity][order.item_price_type] += order.quantity if order.status == 2\n end\n end\n end\n\n # Result\n result\n\n end", "title": "" }, { "docid": "ea936e7d791c9d78251ba3f87fca0ec4", "score": "0.42901552", "text": "def recreate_tray_plans(batch_id, phase_info, quantity, tray)\n # p \"Quantity: #{quantity}\"\n loop do\n plan_capacity = if quantity >= tray.tray_capacity\n tray.tray_capacity\n else\n quantity\n end\n new_tray_plan = build_tray_plan(batch_id,\n phase_info,\n tray,\n plan_capacity)\n # p \"TrayPlan # capacity : #{plan_capacity}\"\n Cultivation::TrayPlan.create(new_tray_plan)\n quantity -= plan_capacity\n break if quantity <= 0\n end\n end", "title": "" }, { "docid": "ace9eca52af5bc30b63dd05d5126cfe4", "score": "0.42897752", "text": "def view_fg_products_side_a_allocation\n\n list_pack_stations \"A\", true\n\n end", "title": "" }, { "docid": "c462ea51938e5f077654b5bcaa393e45", "score": "0.4288396", "text": "def notify_all\n MemberMailerWorker.perform_async(member_id: self.freelancer.id.to_s, job_order_id: self.id.to_s, perform: :send_job_paid_to_freelancer)\n MemberMailerWorker.perform_async(member_id: self.employer.id.to_s, job_order_id: self.id.to_s, perform: :send_job_paid_to_employer)\n TeamMailerWorker.perform_async(job_order_id: self.id.to_s, perform: :send_job_order_paid)\n\n\n MemberMailerWorker.perform_in(4.hours, member_id: self.employer.id.to_s, job_order_id: self.id.to_s, perform: :resend_job_paid_to_employer)\n MemberMailerWorker.perform_in(4.hours, member_id: self.freelancer.id.to_s, job_order_id: self.id.to_s, perform: :resend_job_paid_to_freelancer)\n\n km_properties = self.job.km_properties\n km_properties[:paid_job] = self.currency.convert_to_idr(self.budget)\n km_properties[:job_order_id] = self.id.to_s\n km_properties[:type] = self.class.to_s\n\n KissmetricsWorker.perform_async(perform: :job_paid, identity: self.job.member.email, properties: km_properties)\n\n # notify other applicants that a freelancer has been hired, only for the first job order\n if self.first_paid_order?\n all_applicants = self.job.job_applications\n all_applicants.each do |ja|\n if ja != self.job_application\n MemberMailerWorker.perform_async(member_id: ja.member.id.to_s, job_order_id: self.id.to_s, perform: :send_freelancer_hired_to_other_applicants)\n end\n end\n end\n end", "title": "" }, { "docid": "2e8f56ba15d708561bdbae14dca7bec3", "score": "0.42866343", "text": "def select_group_loan_for_grace_period_payment\n @office = current_user.active_job_attachment.office\n \n @group_loans = []\n current_user.group_loans.each do |group_loan|\n if group_loan.is_grace_period?\n @group_loans << group_loan\n end\n \n end\n add_breadcrumb \"#{t 'process.select_group_loan'}\", 'select_group_loan_for_grace_period_payment_url' \n end", "title": "" }, { "docid": "76512ef0718d60f8ea3a05ad69f7d078", "score": "0.4283345", "text": "def distribute_to(postbox)\n leaflet = postbox.find_or_create_active_leaflet\n leaflet.entries << self unless leaflet.entries.exists? self\n end", "title": "" }, { "docid": "61a443d12756b3a6acfcca66f46f16ea", "score": "0.42793226", "text": "def stop_all\n checklist = registry.checked_workers( policy )\n checklist.live.each { |key| reap(key) }\n checklist.late.each { |key| reap(key) }\n checklist.hung.each { |key| reap(key) }\n checklist.dead.each { |key| reap(key) }\n end", "title": "" }, { "docid": "bbd59ebbf47aeb746ccae5f443cc45c9", "score": "0.42759478", "text": "def workspaces(params)\n params[:status] = 'all' if params[:status].blank?\n\n job_applications_id = self.job_applications.collect &:id\n job_orders_id = JobOrder.any_in(job_application_id: job_applications_id).collect &:id\n\n services_id = self.services.collect &:id\n service_orders_id = ServiceOrder.any_in(service_id: services_id).collect &:id\n\n package_orders_id = PackageOrder.where(freelancer: self).collect &:id\n\n case params[:status]\n when \"all\"\n job_workspace = JobWorkspace.any_in(job_order_id: job_orders_id)\n service_workspace = ServiceWorkspace.any_in(service_order_id: service_orders_id)\n package_workspace = PackageWorkspace.any_in(package_order_id: package_orders_id)\n when \"on_progress\"\n job_workspace = JobWorkspace.any_in(job_order_id: job_orders_id).where( :\"events._type\" => {\"$nin\" => [\"AdminCanceledEvent\", \"AdminRefundedEvent\", \"EmployerClosedJobEvent\", \"AdminReleasedPayoutEvent\", \"FreelancerRequestedPayoutEvent\"]} )\n service_workspace = ServiceWorkspace.any_in(service_order_id: service_orders_id).any_in(service_order_id: service_orders_id).where( :\"events._type\" => {\"$nin\" => [\"AdminCanceledEvent\", \"AdminRefundedEvent\", \"EmployerClosedJobEvent\", \"AdminReleasedPayoutEvent\", \"FreelancerRequestedPayoutEvent\"]})\n package_workspace = PackageWorkspace.any_in(package_order_id: package_orders_id).where( :\"events._type\" => {\"$nin\" => [\"AdminCanceledEvent\", \"AdminRefundedEvent\", \"EmployerClosedJobEvent\", \"AdminReleasedPayoutEvent\", \"FreelancerRequestedPayoutEvent\"]})\n when \"completed\"\n job_workspace = JobWorkspace.any_in(job_order_id: job_orders_id).where( :\"events._type\" => { \"$in\" => [\"EmployerClosedJobEvent\", \"AdminReleasedPayoutEvent\"] } )\n service_workspace = ServiceWorkspace.any_in(service_order_id: service_orders_id).where( :\"events._type\" => { \"$in\" => [\"EmployerClosedJobEvent\", \"AdminReleasedPayoutEvent\"] } )\n package_workspace = PackageWorkspace.any_in(package_order_id: package_orders_id).where( :\"events._type\" => { \"$in\" => [\"EmployerClosedPackageEvent\", \"AdminReleasedPayoutEvent\"] } )\n\n when \"cancelled\"\n job_workspace = JobWorkspace.any_in(job_order_id: job_orders_id).where(:\"events._type\" => \"AdminCanceledEvent\")\n service_workspace = ServiceWorkspace.any_in(service_order_id: service_orders_id).where(:\"events._type\" => \"AdminCanceledEvent\")\n package_workspace = PackageWorkspace.any_in(package_order_id: package_orders_id).where(:\"events._type\" => \"AdminCanceledEvent\")\n\n when \"refunded\"\n job_workspace = JobWorkspace.any_in(job_order_id: job_orders_id).where(:\"events._type\" => \"AdminRefundedEvent\")\n service_workspace = ServiceWorkspace.any_in(service_order_id: service_orders_id).where(:\"events._type\" => \"AdminRefundedEvent\")\n package_workspace = PackageWorkspace.any_in(package_order_id: package_orders_id).where(:\"events._type\" => \"AdminRefundedEvent\")\n end\n\n if params[:username].present?\n job_workspace = job_workspace.where(employer_username: /#{Regexp.escape(params[:username])}/i)\n service_workspace = service_workspace.where(employer_username: /#{Regexp.escape(params[:username])}/i)\n package_workspace = package_workspace.where(employer_username: /#{Regexp.escape(params[:username])}/i)\n end\n\n job_workspace + service_workspace + package_workspace\n end", "title": "" }, { "docid": "2eddfef4a044dca735ba337f6122f14b", "score": "0.42748708", "text": "def release_cold_meets\n # Eliminate processed clusters and corresponding mpost from pool if their\n # latest time_from_now is larger than cold_time_limit\n released_count = 0\n @meet_pool.processed_clusters.each {|cluster|\n if is_cluster_cold?(cluster)\n @meet_pool.pop_cluster(cluster)\n released_count += 1\n end\n }\n if released_count > 0\n debug(:processer, 2, \"*** released %s\", pluralize(released_count, \"cold meets\"))\n end\n end", "title": "" }, { "docid": "82560468474690ffb14fbd9bfc281105", "score": "0.42743263", "text": "def wait_list(course)\n \twl = course.registrations.where(:wl => true)\n \treturn wl\n end", "title": "" }, { "docid": "9d336b5b208c5356d222eff7180f46ab", "score": "0.42666146", "text": "def arrivals(refresh = false)\n if tvs\n trains(:arrival, refresh)\n end\n end", "title": "" }, { "docid": "22623de4b0d4da0bd52953867c6cfdfe", "score": "0.42662272", "text": "def getLeasesBySlice(slice)\n leases = getLeases()\n this_slice_leases = []\n leases.each do |lease|\n if lease[\"status\"] == \"accepted\"\n if lease[\"account\"][\"name\"] == slice\n if lease[\"valid_until\"].split(' ')[0] > Time.zone.today.to_s \n this_slice_leases << lease\n elsif lease[\"valid_until\"].split(' ')[0] == Time.zone.today.to_s \n if lease[\"valid_until\"].split(' ')[1][0...-3] > Time.zone.now.to_s.split(' ')[1][0...-3]\n this_slice_leases << lease\n end \n end\n end\n end\n end\n return this_slice_leases\n end", "title": "" }, { "docid": "6c6e850aaeaa0cf2cfce5b05cec7846a", "score": "0.42630702", "text": "def sell_all(ticker, days_ago)\n @broker.sell_all(self, ticker, days_ago)\n end", "title": "" }, { "docid": "10953d094af222c6f859e433750f537e", "score": "0.42586055", "text": "def unboundRequest(params)\n broker_url = APP_CONFIG['broker_ip'] + ':' + APP_CONFIG['broker_port'].to_s\n\n resources = []\n\n h1 = Hash.new\n h2 = Hash.new\n\n # puts Time.zone.now\n\n if params[:start_date] != \"\"\n valid_from = params[:start_date] + \":00 \"\n valid_from = Time.zone.parse(valid_from)\n else\n time_now = Time.zone.now.to_s.split(\" \")[1][0...-3]\n time_from = roundTimeUp(time_now)\n valid_from = Time.zone.now.to_s.split(\" \")[0] + \" \" +time_from+ \":00 \"\n valid_from = Time.zone.parse(valid_from)\n end\n\n #For nodes\n if params[:number_of_nodes] != \"\"\n if params[:duration_t1] != \"\"\n if params[:domain1] != \"\"\n h1 = { type: \"Node\", exclusive: true, duration: params[:duration_t1].to_i, valid_from: valid_from, domain: params[:domain1]}\n else\n h1 = { type: \"Node\", exclusive: true, duration: params[:duration_t1].to_i, valid_from: valid_from}\n end\n else\n if params[:domain1] != \"\"\n h1 = { type: \"Node\", exclusive: true, valid_from: valid_from, domain: params[:domain1]}\n else\n h1 = { type: \"Node\", exclusive: true, valid_from: valid_from}\n end\n end \n\n params[:number_of_nodes].to_i.times {resources << h1}\n\n end\n\n #For channels\n if params[:number_of_channels] != \"\"\n if params[:duration_t1] != \"\"\n if params[:domain1] != \"\"\n h1 = { type: \"Channel\", exclusive: true, duration: params[:duration_t1].to_i, valid_from: valid_from, domain: params[:domain1]}\n else\n h1 = { type: \"Channel\", exclusive: true, duration: params[:duration_t1].to_i, valid_from: valid_from}\n end\n else\n if params[:domain1] != \"\"\n h1 = { type: \"Channel\", exclusive: true, valid_from: valid_from, domain: params[:domain1]}\n else\n h1 = { type: \"Channel\", exclusive: true, valid_from: valid_from}\n end\n end \n\n params[:number_of_channels].to_i.times {resources << h1}\n\n end\n\n options = {body: {\n resources: resources\n }.to_json, :headers => { 'Content-Type' => 'application/json' } , :verify => false}\n response = HTTParty.get(broker_url+\"/resources\", options)\n\n puts options\n\n if response.header.code != '200'\n puts \"Something went wrong\"\n puts response\n flash[:danger] = response\n else \n puts response\n response[\"resource_response\"][\"resources\"].each do |element|\n element[\"valid_from\"] = Time.zone.parse(element[\"valid_from\"]).to_s\n element[\"valid_until\"] = Time.zone.parse(element[\"valid_until\"]).to_s\n end\n\n return response\n end\n end", "title": "" }, { "docid": "dec94a740675ed56c2ae7941ce61d80e", "score": "0.42579183", "text": "def notify_payment\n @pack = Packages.find( :all,:conditions =>{:receivedByCarrier => true} )\n @pay = Payment.find( :all )\n if( @pack != nil ) && ( @pay != nil )\n @pack.each do |t|\n @pay.each do |s|\n if( t.id == s.packages_id )\n if( t.senders_id == s.users_id )\n @notification = Notifications.new\n @notification.users_id = t.senders_id\n @notification.description = \"an amount has been deducted from your account\"\n @notification.save\n elsif( t.carriers_id == s.users_id )\n @notifications = Notifications.new\n @notifications.users_id = t.carriers_id\n @notifications.description = \"an amount of has been deducted from your account\"\n @notifications.save\n end\n end\n end\n end\n end\n return;\n end", "title": "" }, { "docid": "1daa90d156609071990ba3b50223bb79", "score": "0.4257024", "text": "def pickup_list(from, to, rental_location_code=nil, include_journal=false)\n\n # Get reservations\n\n conditions = {:date_from.gte => from,\n :date_from.lte => to,\n :status => [:confirmed, :in_progress, :done]}\n conditions.store(:rental_location_code, rental_location_code) if rental_location_code\n \n data = BookingDataSystem::Booking.all(\n :conditions => conditions,\n :order => [:date_from.asc, :time_from.asc]).map do |item|\n product = item.booking_lines.inject('') do |result, b_l|\n result << b_l.item_id\n b_l.booking_line_resources.each do |b_l_r|\n result << ' - '\n result << (b_l_r.booking_item_reference.nil? ? 'NO ASIGNADO' : b_l_r.booking_item_reference)\n result << ' '\n end\n result\n end\n extras = item.booking_extras.inject('') do |result, b_e|\n result << b_e.extra_description\n result << \"(#{b_e.quantity}) \"\n result\n end\n {id: item.id, date_from: item.date_from.to_date.to_datetime, time_from: item.time_from, pickup_place: item.pickup_place, product: product,\n status: item.status, customer: \"#{item.customer_name} #{item.customer_surname}\", customer_phone: item.customer_phone, customer_mobile_phone: item.customer_mobile_phone,\n customer_email: item.customer_email, flight: \"#{item.flight_airport_origin} #{item.flight_company} #{item.flight_number} #{item.flight_time}\",\n total_pending: item.total_pending, extras: extras, notes: item.notes, days: item.days, rental_location_code: item.rental_location_code}\n end\n \n # Include journal\n \n if include_journal\n journal_calendar = ::Yito::Model::Calendar::Calendar.first(name: 'booking_journal')\n event_type = ::Yito::Model::Calendar::EventType.first(name: 'booking_pickup')\n journal_events = ::Yito::Model::Calendar::Event.all(\n :fields => [:id, :from, :description],\n :conditions => {:from.gte => from, :from.lt => to+1, event_type_id: event_type.id,\n :calendar_id => journal_calendar.id},\n :order => [:from.asc]).map.each do |journal_event|\n {id: '.', date_from: journal_event.from.to_date.to_datetime,\n time_from: journal_event.from.strftime('%H:%M'), pickup_place: '', product: journal_event.description,\n status: '', customer: '', customer_phone: '', customer_mobile_phone: '',\n customer_email: '', flight: '', total_pending: 0, extras: '', notes: '', days: 0}\n end\n data.concat(journal_events)\n end\n\n data.sort! do |x, y|\n comp = x[:date_from] <=> y[:date_from]\n if comp.zero?\n begin\n Time.parse(x[:time_from]) <=> Time.parse(y[:time_from])\n rescue\n comp\n end\n else\n comp\n end\n end\n\n return data\n\n end", "title": "" }, { "docid": "e8586ccd28c00040116f8a4e5fc565e8", "score": "0.42567122", "text": "def fetch_qoo10_delivered_orders(smp)\n @message = []\n @all_cart_numbers = []\n fba_complete_states = ['complete', 'customer_complete', 'self_collect_complete', 'collect_complete', 'return_complete']\n market_place = smp.market_place\n #qoo10_statuses = {\"5\"=>\"Delivered\", \"4\"=>\"On delivery\"}\n qoo10_statuses = {\"5\"=>\"Delivered\"}\n for j in 1..10\n begin\n s_date = j.day.ago.strftime(\"%Y%m%d\")\n e_date = (j-1).day.ago.strftime(\"%Y%m%d\")\n qoo10_statuses.keys.each do |k|\n uri = URI(market_place.domain_url+'/ShippingBasicService.api/GetShippingInfo')\n req = Net::HTTP::Post.new(uri.path)\n req.set_form_data({'key'=>smp.api_secret_key,'ShippingStat'=>k,'search_Sdate'=>s_date,'search_Edate'=>e_date})\n res = Net::HTTP.start(uri.hostname, uri.port) do |http|http.request(req)end\n if res.code == \"200\"\n res_body = Hash.from_xml(res.body).to_json\n res_body = JSON.parse(res_body, :symbolize_names=>true)\n begin\n if res_body[:ShippingAPIService][:ResultMsg] == \"Success\"\n for i in 1..res_body[:ShippingAPIService][:TotalOrder].to_i\n order = res_body[:ShippingAPIService][(\"Order\"+i.to_s).to_sym]\n # find out the order\n @order = nil\n @order = Spree::Order.where(\"market_place_order_no=? AND seller_id=?\", order[:orderNo], smp.seller_id).try(:first)\n # check order present or not and order should not be cancelled already\n if @order.present? && !@order.is_cancel?\n # code to delivered the order\n if @order.update_attributes!(:market_place_order_status => \"Delivered\")\n @all_cart_numbers << @order.cart_no if @order.market_place_order_status == \"Delivered\" && (!fba_complete_states.include?@order.fulflmnt_state)\n else\n @message << \"Order not found!\"\n end # End of success status change in SF if\n end # End if order nil\n end # End of for loop\n end # End of success if\n @all_cart_numbers = @all_cart_numbers.uniq\n #Call to FBA to change status\n Spree::Order.update_fba_state(@all_cart_numbers.uniq, smp, \"Completed\") if @all_cart_numbers.present?\n rescue Exception => e\n @message << e.message\n end\n else\n res_body = Hash.from_xml(res.body).to_json\n res_body = JSON.parse(res_body, :symbolize_names=> true)\n @message << res_body[:ShippingAPIService][:ResultMsg]\n end\n end # End of status do\n rescue Exception => e\n @message << e.message\n end\n end # End for loop for day\n return @message.join(\"; \")\n end", "title": "" }, { "docid": "3112b50ed316d0d15fa54908ed8904f5", "score": "0.4256166", "text": "def create_course_offerings_work_order(type)\n @world[type].each do |school|\n if !school[\"offerings\"].nil? and school[\"offerings\"].size > 0\n school[\"offerings\"].each do |year, course_offerings|\n course_offerings.each do |course_offering|\n id = course_offering[\"id\"]\n ed_org_id = course_offering[\"ed_org_id\"]\n session = course_offering[\"session\"]\n course = course_offering[\"course\"]\n grade = course_offering[\"grade\"]\n\n title = GradeLevelType.to_string(grade) + \" \" + course[\"title\"]\n title = GradeLevelType.to_string(grade) if GradeLevelType.is_elementary_school_grade(grade)\n\n @queue.push_work_order({:type=>CourseOffering, :id=>id, :title=>title, :edOrgId=>ed_org_id, :session=>session, :course=>course})\n end\n end\n end\n end\n end", "title": "" }, { "docid": "59caa877415b33c0517d35cc234b17e4", "score": "0.42535794", "text": "def open_orders\r\n # store_user = StoreUser.find_by_erp_account_number \"CU 0101388\"\r\n # store_user.order_users.find(:first).orders.find(:first)\r\n # ERP::ThreadPool.new(@options[:threads], time_blocks).start do |pair|\r\n # sleep(1 * rand)\r\n # result = search_by_modified_date( pair.first, pair.last )\r\n # nodes.concat result unless result.empty?\r\n # end\r\n store_user = session[:web_user]\r\n web_orders = Order.find_by_store_user_id(store_user.id)\r\n sales_ids = @customer.sales_orders.collect{|sales_order| sales_order.sales_id}\r\n web_orders.delete_if { |web_order| sales_ids.include?(web_order.erp_order_number) }\r\n # raise web_orders.to_yaml\r\n @orders = @customer.open_orders\r\n web_orders.each do |web_order|\r\n virtual_order = ERP::SalesOrder.new(\r\n :sales_status => \"Invoice\",\r\n :document_status => \"Invoice\",\r\n :shipping_charges => web_order.shipping_cost,\r\n :sales_tax => web_order.tax,\r\n :synchronized => true,\r\n :purch_order_form_num => web_order.order_number,\r\n :delivery_mode_id => 0,\r\n :completed => true,\r\n :erp_modstamp => web_order.created_on\r\n )\r\n \r\n web_order.order_line_items.each do |line|\r\n virtual_order.sales_lines.build(\r\n :sales_order => virtual_order,\r\n :item_id => line.product.erp_product_item,\r\n :sales_qty => line.quantity,\r\n :status => \"Downloading\",\r\n :remain_sales_physical => 0,\r\n :sales_price => line.product.price,\r\n :line_amount => line.quantity * line.product.price\r\n )\r\n end\r\n \r\n web_ship_to = web_order.order_user.order_addresses.find_by_is_shipping(true)\r\n virtual_order.ship_to_address = ERP::DeliveryAddress.new(\r\n :name => web_ship_to.company,\r\n :street => web_ship_to.address,\r\n :address => \"#{web_ship_to.address}\\n#{web_ship_to.city}, #{web_ship_to.state} #{web_ship_to.zip}\\n#{web_ship_to.country.fedex_code}\",\r\n :city => web_ship_to.city,\r\n :state => web_ship_to.state,\r\n :zip_code => web_ship_to.zip,\r\n :country_region_id => web_ship_to.country.fedex_code\r\n )\r\n web_bill_to = web_order.order_user.order_addresses.find_by_is_shipping(false)\r\n virtual_order.bill_to_address = ERP::InvoiceAddress.new(\r\n :name => web_bill_to.company,\r\n :street => web_bill_to.address,\r\n :address => \"#{web_bill_to.address}\\n#{web_bill_to.city}, #{web_bill_to.state} #{web_bill_to.zip}\\n#{web_bill_to.country.fedex_code}\",\r\n :city => web_bill_to.city,\r\n :state => web_bill_to.state,\r\n :zip_code => web_bill_to.zip,\r\n :country_region_id => web_bill_to.country.fedex_code\r\n )\r\n @orders.unshift(virtual_order)\r\n end\r\n end", "title": "" } ]
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "a0cd71d2c195c45a09fe60fcc3d9df0a", "score": "0.0", "text": "def user_params\n params.require(:user).permit(:username,:email,:password)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.74939764", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.6955084", "text": "def strong_params\n params.require(:request).permit(param_whitelist)\n end", "title": "" }, { "docid": "c72da3a0192ce226285be9c2a583d24a", "score": "0.69205093", "text": "def strong_params\n params.require(:post).permit(param_whitelist)\n end", "title": "" }, { "docid": "3d346c1d1b79565bee6df41a22a6f28d", "score": "0.6891745", "text": "def strong_params\n params.require(:resource).permit(param_whitelist)\n end", "title": "" }, { "docid": "aa06a193f057b6be7c0713a5bd30d5fb", "score": "0.67835", "text": "def strong_params\n params.require(:listing).permit(param_whitelist)\n end", "title": "" }, { "docid": "f6060519cb0c56a439976f0c978690db", "score": "0.6742323", "text": "def permitted_params\n params.permit!\n end", "title": "" }, { "docid": "fad8fcf4e70bf3589fbcbd40db4df5e2", "score": "0.66817623", "text": "def allowed_params\n # Only this one attribute will be allowed, no hacking\n params.require(:user).permit(:username)\n end", "title": "" }, { "docid": "b453d9a67af21a3c28a62e1848094a41", "score": "0.6635011", "text": "def strong_params\n params.require(:kpi).permit(param_whitelist)\n end", "title": "" }, { "docid": "2c8e2be272a55477bfc4c0dfc6baa7a7", "score": "0.66280156", "text": "def strong_params\n params.require(:community_member).permit(param_whitelist)\n end", "title": "" }, { "docid": "1685d76d665d2c26af736aa987ac8b51", "score": "0.66248137", "text": "def permitted_params\n params.permit!\n end", "title": "" }, { "docid": "77f5795d1b9e0d0cbd4ea67d02b5ab7f", "score": "0.6561888", "text": "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "title": "" }, { "docid": "cc1542a4be8f3ca5dc359c2eb3fb7d18", "score": "0.6489396", "text": "def strong_params\n params.require(:message).permit(param_whitelist)\n end", "title": "" }, { "docid": "e291b3969196368dd4f7080a354ebb08", "score": "0.64763314", "text": "def permitir_parametros\n \t\tparams.permit!\n \tend", "title": "" }, { "docid": "2d2af8e22689ac0c0408bf4cb340d8c8", "score": "0.64523757", "text": "def allowed_params\n params.require(:user).permit(:name, :email)\n end", "title": "" }, { "docid": "236e1766ee20eef4883ed724b83e4176", "score": "0.63985187", "text": "def param_whitelist\n [\n :name,\n :tagline, :contact, :summary, :stage,\n :website, :facebook, :twitter, :linkedin, :github,\n :founded_at,\n community_ids: [],\n sectors: [\n :commercial,\n :social,\n :research\n ],\n privacy: [\n contact: [],\n kpis: []\n ],\n permission: [\n listings: [],\n profile: [],\n posts: [],\n kpis: []\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "title": "" }, { "docid": "b29cf4bc4a27d4b199de5b6034f9f8a0", "score": "0.6379674", "text": "def safe_params\n params\n .require( self.class.model_class.name.underscore.to_sym )\n .permit( self.class.params_list )\n end", "title": "" }, { "docid": "bfb292096090145a067e31d8fef10853", "score": "0.636227", "text": "def param_whitelist\n whitelist = [\n :title, :description, :skills,\n :positions, :category, :salary_period,\n :started_at, :finished_at,\n :deadline,\n :salary_min, :salary_max, :hours,\n :equity_min, :equity_max,\n :privacy,\n :owner_id, :owner_type,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:owner_id)\n whitelist.delete(:owner_type)\n end\n \n whitelist\n end", "title": "" }, { "docid": "6bf3ed161b62498559a064aea569250a", "score": "0.6337434", "text": "def require_params\n return nil\n end", "title": "" }, { "docid": "b4c9587164188c64f14b71403f80ca7c", "score": "0.6335199", "text": "def sanitize_params!\n request.sanitize_params!\n end", "title": "" }, { "docid": "b63e6e97815a8745ab85cd8f7dd5b4fb", "score": "0.63245684", "text": "def excluded_from_filter_parameters; end", "title": "" }, { "docid": "38bec0546a7e4cbf4c337edbee67d769", "score": "0.63194174", "text": "def user_params\n # Returns a sanitized hash of the params with nothing extra\n params.permit(:name, :email, :img_url, :password)\n end", "title": "" }, { "docid": "37d1c971f6495de3cdd63a3ef049674e", "score": "0.6313726", "text": "def param_whitelist\n whitelist = [\n :name,\n :overview,\n :website, :facebook, :twitter,\n :privacy,\n :avatar_id, :community_id, :category_ids,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:community_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "5ec018b4a193bf3bf8902c9419279607", "score": "0.63134545", "text": "def user_params # contains strong parameters\n params.require(:user).permit(:name, :email, :password,\n :password_confirmation)\n # strong parameters disallows any post information that is not permitted (admin security) when signing_up\n # so not all users will get admin access by hacking params using curl\n end", "title": "" }, { "docid": "91bfe6d464d263aa01e776f24583d1d9", "score": "0.6304745", "text": "def permitir_parametros\n params.permit!\n end", "title": "" }, { "docid": "e012d7306b402a37012f98bfd4ffdb10", "score": "0.6299775", "text": "def strong_params\n params.require(:team).permit(param_whitelist)\n end", "title": "" }, { "docid": "157e773497f78353899720ad034a906a", "score": "0.62989247", "text": "def white_list_params\n params.require(:white_list).permit(:ip, :comment)\n end", "title": "" }, { "docid": "8c384af787342792f0efc7911c3b2469", "score": "0.6294581", "text": "def whitelisted_vegetable_params\n params.require(:vegetable).permit(:name, :color, :rating, :latin_name)\n end", "title": "" }, { "docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c", "score": "0.6291996", "text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end", "title": "" }, { "docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c", "score": "0.6291996", "text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end", "title": "" }, { "docid": "9b76b3149ac8b2743f041d1af6b768b5", "score": "0.62786806", "text": "def filter_params\n params.permit(\n\t\t\t\t:name,\n\t\t\t\t:sitedefault,\n\t\t\t\t:opinions,\n\t\t\t\t:contested,\n\t\t\t\t:uncontested,\n\t\t\t\t:initiators,\n\t\t\t\t:comments,\n\t\t\t\t:following,\n\t\t\t\t:bookmarks,\n\t\t\t\t:lone_wolf,\n\t\t\t\t:level_zero,\n\t\t\t\t:level_nonzero,\n\t\t\t\t:private,\n\t\t\t\t:public_viewing,\n\t\t\t\t:public_comments,\n\t\t\t\t:has_parent,\n\t\t\t\t:has_no_parent,\n\t\t\t\t:today,\n\t\t\t\t:last_week,\n\t\t\t\t:last_month,\n\t\t\t\t:last_year,\n\t\t\t\t:sort_by_created_at,\n\t\t\t\t:sort_by_updated_at,\n\t\t\t\t:sort_by_views,\n\t\t\t\t:sort_by_votes,\n\t\t\t\t:sort_by_scores,\n\t\t\t\t:who_id)\n end", "title": "" }, { "docid": "603f4a45e5efa778afca5372ae8a96dc", "score": "0.62717277", "text": "def param_whitelist\n [:role]\n end", "title": "" }, { "docid": "f6399952b4623e5a23ce75ef1bf2af5a", "score": "0.62658894", "text": "def allowed_params\n\t\tparams.require(:password).permit(:pass)\n\tend", "title": "" }, { "docid": "37c5d0a9ebc5049d7333af81696608a0", "score": "0.6254184", "text": "def safe_params\n\t\tparams.require(:event).permit(:title, :event_date, :begti, :endti, :comments, :has_length, :is_private)\n\tend", "title": "" }, { "docid": "505e334c1850c398069b6fb3948ce481", "score": "0.625358", "text": "def sanitise!\n @params.keep_if {|k,v| whitelisted? k}\n end", "title": "" }, { "docid": "6c4620f5d8fd3fe3641e0474aa7014b2", "score": "0.62506795", "text": "def white_listed_parameters\n params\n .require(:movie)\n .permit(:title, :description, :year_released)\n end", "title": "" }, { "docid": "d14bb69d2a7d0f302032a22bb9373a16", "score": "0.62342095", "text": "def protect_my_params\n return params.require(:photo).permit(:title, :artist, :url)\n\tend", "title": "" }, { "docid": "5629f00db37bf403d0c58b524d4c3c37", "score": "0.62271494", "text": "def filtered_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end", "title": "" }, { "docid": "d370098b1b3289dbd04bf1c073f2645b", "score": "0.62269396", "text": "def allow_params\n params.permit(:id, :email, :password)\n end", "title": "" }, { "docid": "78cbf68c3936c666f1edf5f65e422b6f", "score": "0.6226112", "text": "def whitelisted_user_params\n if params[:user]\n params.require(:user).permit(:email, :username, :password)\n else\n { :email => params[:email],\n :username => params[:username],\n :password => params[:password] }\n end\nend", "title": "" }, { "docid": "fde8b208c08c509fe9f617229dfa1a68", "score": "0.6224588", "text": "def strong_params\n params.require(:thread).permit(param_whitelist)\n end", "title": "" }, { "docid": "d38efafa6be65b2f7da3a6d0c9b7eaf5", "score": "0.62000334", "text": "def roaster_params\n # Returns a sanitized hash of the params with nothing extra\n params.permit(:name, :email, :img_url, :password_digest, :address, :website, :phone, :latitude, :longitutde, :description)\n end", "title": "" }, { "docid": "d724124948bde3f2512c5542b9cdea74", "score": "0.619004", "text": "def alpha_provider_params\n params.require(:alpha_provider).permit!\n end", "title": "" }, { "docid": "d18a36785daed9387fd6d0042fafcd03", "score": "0.6182373", "text": "def white_listed_parameters\n params\n .require(:company)\n .permit(:company_name, :company_avatar)\n end", "title": "" }, { "docid": "36956168ba2889cff7bf17d9f1db41b8", "score": "0.61777395", "text": "def set_param_whitelist(*param_list)\n self.param_whitelist = param_list\n end", "title": "" }, { "docid": "07bc0e43e1cec1a821fb2598d6489bde", "score": "0.61629707", "text": "def accept_no_params\n accept_params {}\n end", "title": "" }, { "docid": "fc4b1364974ea591f32a99898cb0078d", "score": "0.6160594", "text": "def request_params\n params.permit(:username, :password, :user_id, :status, :accepted_by, :rejected_by)\n end", "title": "" }, { "docid": "13e3cfbfe510f765b5944667d772f453", "score": "0.61548823", "text": "def admin_security_params\n params.require(:security).permit(:name, :url, :commonplace_id)\n end", "title": "" }, { "docid": "84bd386d5b2a0d586dca327046a81a63", "score": "0.6153307", "text": "def good_params\n permit_params\n end", "title": "" }, { "docid": "b9432eac2fc04860bb585f9af0d932bc", "score": "0.61359197", "text": "def wall_params\n params.permit(:public_view, :guest)\n end", "title": "" }, { "docid": "f2342adbf71ecbb79f87f58ff29c51ba", "score": "0.61332136", "text": "def housing_request_params\n params[:housing_request].permit! #allow all parameters for now\n end", "title": "" }, { "docid": "8fa507ebc4288c14857ace21acf54c26", "score": "0.6117462", "text": "def strong_params\n # to dooo\n end", "title": "" }, { "docid": "9292c51af27231dfd9f6478a027d419e", "score": "0.6113605", "text": "def domain_params\n params[:domain].permit!\n end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.61135256", "text": "def check_params; true; end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.61135256", "text": "def check_params; true; end", "title": "" }, { "docid": "a3aee889e493e2b235619affa62f39c3", "score": "0.61102164", "text": "def user_params\n params.permit(:full_name, :email, :job, :about, :max_search_distance,\n :website_url, :linkedin_url,\n :behance_url, :github_url, :stackoverflow_url)\n end", "title": "" }, { "docid": "585f461bf01ed1ef8d34fd5295a96dca", "score": "0.610241", "text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "585f461bf01ed1ef8d34fd5295a96dca", "score": "0.610241", "text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "b63ab280629a127ecab767e2f35b8ef0", "score": "0.60958886", "text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end", "title": "" }, { "docid": "b63ab280629a127ecab767e2f35b8ef0", "score": "0.60958886", "text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end", "title": "" }, { "docid": "677293afd31e8916c0aee52a787b75d8", "score": "0.6085571", "text": "def newsletter_params\n params.permit!.except(:action, :controller, :_method, :authenticity_token)\n end", "title": "" }, { "docid": "e50ea3adc222a8db489f0ed3d1dce35b", "score": "0.608522", "text": "def params_without_facebook_data\n params.except(:signed_request).permit!.to_hash\n end", "title": "" }, { "docid": "b7ab5b72771a4a2eaa77904bb0356a48", "score": "0.6084166", "text": "def search_params\n params.permit!.except(:controller, :action, :format)\n end", "title": "" }, { "docid": "b2841e384487f587427c4b35498c133f", "score": "0.60775006", "text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end", "title": "" }, { "docid": "3f5347ed890eed5ea86b70281803d375", "score": "0.6073921", "text": "def user_params\n params.permit!\n end", "title": "" }, { "docid": "0c8779b5d7fc10083824e36bfab170de", "score": "0.6067218", "text": "def white_base_params\n params.fetch(:white_base, {}).permit(:name)\n end", "title": "" }, { "docid": "fa0608a79e8d27c2a070862e616c8c58", "score": "0.6065894", "text": "def vampire_params\n # whitelist all of the vampire attributes so that your forms work!\n end", "title": "" }, { "docid": "a3dc8b6db1e6584a8305a96ebb06ad21", "score": "0.6064601", "text": "def need_params\n end", "title": "" }, { "docid": "7646659415933bf751273d76b1d11b40", "score": "0.6064436", "text": "def whitelisted_observation_params\n return unless params[:observation]\n\n params[:observation].permit(whitelisted_observation_args)\n end", "title": "" }, { "docid": "4f8205e45790aaf4521cdc5f872c2752", "score": "0.60631806", "text": "def search_params\n params.permit(:looking_for, :utf8, :authenticity_token, :min_age,\n :max_age, :sort_by, likes:[])\n end", "title": "" }, { "docid": "e39a8613efaf5c6ecf8ebd58f1ac0a06", "score": "0.6061806", "text": "def permitted_params\n params.permit :utf8, :_method, :authenticity_token, :commit, :id,\n :encrypted_text, :key_size\n end", "title": "" }, { "docid": "c436017f4e8bd819f3d933587dfa070a", "score": "0.6060409", "text": "def filtered_parameters; end", "title": "" }, { "docid": "d6886c65f0ba5ebad9a2fe5976b70049", "score": "0.6056974", "text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end", "title": "" }, { "docid": "96ddf2d48ead6ef7a904c961c284d036", "score": "0.6047898", "text": "def user_params\n permit = [\n :email, :password, :password_confirmation,\n :image, :name, :nickname, :oauth_token,\n :oauth_expires_at, :provider, :birthday\n ]\n params.permit(permit)\n end", "title": "" }, { "docid": "f78d6fd9154d00691c34980d7656b3fa", "score": "0.6047841", "text": "def authorize_params\n super.tap do |params|\n %w[display with_offical_account forcelogin].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "title": "" }, { "docid": "f78d6fd9154d00691c34980d7656b3fa", "score": "0.6047841", "text": "def authorize_params\n super.tap do |params|\n %w[display with_offical_account forcelogin].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "title": "" }, { "docid": "75b7084f97e908d1548a1d23c68a6c4c", "score": "0.604599", "text": "def allowed_params\n params.require(:sea).permit(:name, :temperature, :bio, :mood, :image_url, :favorite_color, :scariest_creature, :has_mermaids)\n end", "title": "" }, { "docid": "080d2fb67f69228501429ad29d14eb29", "score": "0.6041073", "text": "def filter_user_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end", "title": "" }, { "docid": "aa0aeac5c232d2a3c3f4f7e099e7e6ff", "score": "0.60329294", "text": "def parameters\n params.permit(permitted_params)\n end", "title": "" }, { "docid": "0bdcbbe05beb40f7a08bdc8e57b7eca8", "score": "0.6029157", "text": "def filter_params\n end", "title": "" }, { "docid": "cf73c42e01765dd1c09630007357379c", "score": "0.602574", "text": "def params_striper\n\t \tparams[:user].delete :moonactor_ability\n\t end", "title": "" }, { "docid": "793abf19d555fb6aa75265abdbac23a3", "score": "0.60209215", "text": "def user_params\n if admin_user?\n params.require(:user).permit(:email, :password, :password_confirmation, :name, :address_1, :address_2, :apt_number, :city, :state_id, :zip_code, :newsletter, :active, :admin, :receive_customer_inquiry)\n else\n # Don't allow non-admin users to hack the parameters and give themselves admin security; self created records automatically set to active\n params.require(:user).permit(:email, :password, :password_confirmation, :name, :address_1, :address_2, :apt_number, :city, :state_id, :zip_code, :newsletter)\n end\n end", "title": "" }, { "docid": "2e70947f467cb6b1fda5cddcd6dc6304", "score": "0.60183305", "text": "def strong_params(wimpy_params)\n ActionController::Parameters.new(wimpy_params).permit!\nend", "title": "" }, { "docid": "2a11104d8397f6fb79f9a57f6d6151c7", "score": "0.6016583", "text": "def user_params\n sanitize params.require(:user).permit(:username, :password, :password_confirmation, :display_name, :about_me, :avatar, :current_password, :banned, :ban_message)\n end", "title": "" }, { "docid": "a83bc4d11697ba3c866a5eaae3be7e05", "score": "0.6013783", "text": "def user_params\n\t params.permit(\n\t :name,\n\t :email,\n\t :password\n\t \t )\n\t end", "title": "" }, { "docid": "2aa7b93e192af3519f13e9c65843a6ed", "score": "0.6007249", "text": "def user_params\n params[:user].permit!\n end", "title": "" }, { "docid": "9c8cd7c9e353c522f2b88f2cf815ef4e", "score": "0.6005397", "text": "def case_sensitive_params\n params.require(:case_sensitive).permit(:name)\n end", "title": "" }, { "docid": "45b8b091f448e1e15f62ce90b681e1b4", "score": "0.6005393", "text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "title": "" }, { "docid": "45b8b091f448e1e15f62ce90b681e1b4", "score": "0.6005393", "text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "title": "" }, { "docid": "9736586d5c470252911ec58107dff461", "score": "0.6003378", "text": "def params_without_classmate_data\n params.clone.permit!.except(*(CLASSMATE_PARAM_NAMES + DEBUG_PARAMS))\n end", "title": "" }, { "docid": "e7cad604922ed7fad31f22b52ecdbd13", "score": "0.6001586", "text": "def member_params\n # byebug\n params.require(:member).permit(\n :first_name, \n :last_name, \n :username, \n :email, \n :password, \n :image, \n :family_size, \n :address)\n\n end", "title": "" }, { "docid": "58ad32a310bf4e3c64929a860569b3db", "score": "0.6000142", "text": "def user_params\n\t\tparams.require(:user).permit!\n\tend", "title": "" }, { "docid": "58ad32a310bf4e3c64929a860569b3db", "score": "0.6000142", "text": "def user_params\n\t\tparams.require(:user).permit!\n\tend", "title": "" }, { "docid": "f70301232281d001a4e52bd9ba4d20f5", "score": "0.5999887", "text": "def room_allowed_params\n end", "title": "" }, { "docid": "2e6de53893e405d0fe83b9d18b696bd5", "score": "0.5998492", "text": "def user_params\n params.require(:user).permit(:username, :password, :realname, :email, :publicvisible)\n end", "title": "" }, { "docid": "19bd0484ed1e2d35b30d23b301d20f7c", "score": "0.5996129", "text": "def unsafe_params\n ActiveSupport::Deprecation.warn(\"Using `unsafe_params` isn't a great plan\", caller(1))\n params.dup.tap(&:permit!)\n end", "title": "" }, { "docid": "19bd0484ed1e2d35b30d23b301d20f7c", "score": "0.5996129", "text": "def unsafe_params\n ActiveSupport::Deprecation.warn(\"Using `unsafe_params` isn't a great plan\", caller(1))\n params.dup.tap(&:permit!)\n end", "title": "" }, { "docid": "a50ca4c82eaf086dcbcc9b485ebd4261", "score": "0.5992997", "text": "def white_listed_parameters\n params\n .require(:story)\n .permit(:title, :link, :upvotes, :category)\n end", "title": "" }, { "docid": "0f53610616212c35950b45fbcf9f5ad4", "score": "0.5992662", "text": "def user_params(params)\n\tparams.permit(:email, :password, :name, :blurb)\n end", "title": "" }, { "docid": "b545ec7bfd51dc43b982b451a715a538", "score": "0.59919816", "text": "def user_params\n params_allowed = %i[email password password_confirmation is_admin]\n params.require(:user).permit(params_allowed)\n end", "title": "" }, { "docid": "0b704016f3538045eb52c45442e7f704", "score": "0.59903735", "text": "def admin_params\n filtered_params = params.require(:admin).permit(:display_name, :email, :password, :password_confirmation)\n if filtered_params[:password] == \"\"\n filtered_params.delete(:password)\n filtered_params.delete(:password_confirmation)\n end\n filtered_params\n end", "title": "" }, { "docid": "6af3741c8644ee63d155db59be10a774", "score": "0.59890324", "text": "def allowed_params\n %i[\n lock_version\n comments\n organization\n job_title\n pronouns\n year_of_birth\n gender\n ethnicity\n opted_in\n invite_status\n acceptance_status\n registered\n registration_type\n can_share\n registration_number\n can_photo\n can_record\n name\n name_sort_by\n name_sort_by_confirmed\n pseudonym\n pseudonym_sort_by\n pseudonym_sort_by_confirmed\n ]\n end", "title": "" } ]
af630984682f1a0b5a68e6092af0d102
Update properties of this object
[ { "docid": "2543ec723b41e21685397d689d00ed8c", "score": "0.0", "text": "def update!(**args)\n @config = args[:config] if args.key?(:config)\n @expanded_config = args[:expanded_config] if args.key?(:expanded_config)\n @id = args[:id] if args.key?(:id)\n @imports = args[:imports] if args.key?(:imports)\n @insert_time = args[:insert_time] if args.key?(:insert_time)\n @layout = args[:layout] if args.key?(:layout)\n @name = args[:name] if args.key?(:name)\n @self_link = args[:self_link] if args.key?(:self_link)\n end", "title": "" } ]
[ { "docid": "150fa2bdc1fc43d28ac45e2278a1f797", "score": "0.7012263", "text": "def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "37ae8a386fde14c02d7021605aa72f45", "score": "0.67403597", "text": "def refresh\n self.class.base_properties.each_with_index do |prop, prop_id|\n @properties[prop] = get_property(prop_id)\n end\n refresh_features\n refresh_status\n refresh_config\n self\n end", "title": "" }, { "docid": "10e41ec39ba2af73495ccece21c2d8a3", "score": "0.6709326", "text": "def update!(**args)\n @subobject_properties = args[:subobject_properties] if args.key?(:subobject_properties)\n end", "title": "" }, { "docid": "10e41ec39ba2af73495ccece21c2d8a3", "score": "0.6709326", "text": "def update!(**args)\n @subobject_properties = args[:subobject_properties] if args.key?(:subobject_properties)\n end", "title": "" }, { "docid": "092b765ad7cf3ce4b6bf4e7d8a2e6af7", "score": "0.6696149", "text": "def update(attrs)\n super(attrs)\n end", "title": "" }, { "docid": "092b765ad7cf3ce4b6bf4e7d8a2e6af7", "score": "0.6696149", "text": "def update(attrs)\n super(attrs)\n end", "title": "" }, { "docid": "092b765ad7cf3ce4b6bf4e7d8a2e6af7", "score": "0.6696149", "text": "def update(attrs)\n super(attrs)\n end", "title": "" }, { "docid": "092b765ad7cf3ce4b6bf4e7d8a2e6af7", "score": "0.6696149", "text": "def update(attrs)\n super(attrs)\n end", "title": "" }, { "docid": "47bbd8b88b35da987fc3775b82211e56", "score": "0.6618882", "text": "def update_properties!(branch_id=nil)\n properties = fetch_properties(false, branch_id)\n length = properties.length\n counter = 0\n properties.each do |property|\n counter += 1\n if Vebra.debugging?\n puts \"[Vebra]: #{counter}/#{length}: live updating property with Vebra ref: #{property.attributes[:vebra_ref]}\"\n end\n live_update!(property)\n Vebra.set_last_updated_at(Time.now) if counter == length\n end\n end", "title": "" }, { "docid": "769b77b7f7f9f82ae847f5968eb201dc", "score": "0.6571848", "text": "def update_self obj\n obj.each do |k,v|\n instance_variable_set(\"@#{k}\", v) if v\n end\n end", "title": "" }, { "docid": "c3b6fccdeb696de5e9dbc38a9486b742", "score": "0.65386343", "text": "def update_attributes(properties_hash)\n self.class.get_class_properties.each do |property|\n key = property[:name].to_sym\n if properties_hash.has_key? key\n self.setValue(properties_hash[key], forKey:key)\n end\n end\n end", "title": "" }, { "docid": "bb403006cc5423d9b1820fe684a7c5a5", "score": "0.65178275", "text": "def update\n # TODO: implement update\n end", "title": "" }, { "docid": "1ee90e4f66e82aec13076a98b288a2d1", "score": "0.6394807", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n @states = args[:states] if args.key?(:states)\n end", "title": "" }, { "docid": "23eb6f5fbeae4bf9f56ac93a4126b4b5", "score": "0.6389745", "text": "def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @object = args[:object] if args.key?(:object)\n end", "title": "" }, { "docid": "23eb6f5fbeae4bf9f56ac93a4126b4b5", "score": "0.6389745", "text": "def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @object = args[:object] if args.key?(:object)\n end", "title": "" }, { "docid": "3f85752da065340d4ca70ce879a3b23d", "score": "0.63328", "text": "def update!(**args)\n @property = args[:property] if args.key?(:property)\n @total_value_count = args[:total_value_count] if args.key?(:total_value_count)\n @value = args[:value] if args.key?(:value)\n @value_status = args[:value_status] if args.key?(:value_status)\n end", "title": "" }, { "docid": "da63345424fc9aecef032928485bd149", "score": "0.6319025", "text": "def update\n \n end", "title": "" }, { "docid": "5a8e82caac01cee661bc875a5b0cf723", "score": "0.6283673", "text": "def refresh\n set_attributes\n end", "title": "" }, { "docid": "60d8c4f58de490a0d7cdd918c16a2cce", "score": "0.6269463", "text": "def update(attrs)\n @attrs.update(attrs)\n self\n end", "title": "" }, { "docid": "7a41bc9d5a07220fb8626d1fa90d2d79", "score": "0.62639254", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n @source = args[:source] if args.key?(:source)\n end", "title": "" }, { "docid": "29c22ae2290ffca9b9682a5f20f48103", "score": "0.62410724", "text": "def update_resource object, attributes\n object.update attributes\n end", "title": "" }, { "docid": "91dc386ff8fa066852510a5d62b13078", "score": "0.62170374", "text": "def update(attrs)\n @attrs ||= {}\n @attrs.update(attrs)\n self\n end", "title": "" }, { "docid": "6249943d1eeff63f8f611fcf73254058", "score": "0.62152076", "text": "def update\n \n end", "title": "" }, { "docid": "1c12f310aca206a2cefff8c291007668", "score": "0.6210263", "text": "def update!(**args)\n @property = args[:property] if args.key?(:property)\n @schema = args[:schema] if args.key?(:schema)\n end", "title": "" }, { "docid": "1c0316f22c6db917fa4719767b5326a9", "score": "0.6204041", "text": "def update!(**args)\n @name = args[:name] if args.key?(:name)\n @options = args[:options] if args.key?(:options)\n @property_definitions = args[:property_definitions] if args.key?(:property_definitions)\n end", "title": "" }, { "docid": "1c0316f22c6db917fa4719767b5326a9", "score": "0.6204041", "text": "def update!(**args)\n @name = args[:name] if args.key?(:name)\n @options = args[:options] if args.key?(:options)\n @property_definitions = args[:property_definitions] if args.key?(:property_definitions)\n end", "title": "" }, { "docid": "85a79fb5c3cc199e689344861658b09b", "score": "0.62021106", "text": "def _update!\n self.class.properties.each do |property, predicate|\n if dirty?(property)\n self.class.repository_or_fail.delete([subject, predicate[:predicate], nil])\n if self.class.is_list?(property)\n repo = RDF::Repository.new\n attribute_get(property).each do |value|\n repo << RDF::Statement.new(subject, predicate[:predicate], self.class.build_rdf_value(value, self.class.properties[property][:type]))\n end\n self.class.repository_or_fail.insert(*repo)\n else\n self.class.repository_or_fail.insert(RDF::Statement.new(subject, predicate[:predicate], self.class.build_rdf_value(attribute_get(property), self.class.properties[property][:type])))\n end\n end\n @dirty[property] = nil\n @attributes[:original][property] = attribute_get(property)\n end\n self.class.repository_or_fail.insert(RDF::Statement.new(@subject, RDF.type, type)) unless type.nil?\n end", "title": "" }, { "docid": "5d229ea224b1dfa7ac9ce6808ca63fc4", "score": "0.62017816", "text": "def update(attributes = {})\n super(attributes)\n retrieve!\n self\n end", "title": "" }, { "docid": "549a7eef6c18558dea47a8e8d72df295", "score": "0.62017", "text": "def update\n @objects.map(&:update);\n end", "title": "" }, { "docid": "e1f766468b11768b786daa133483b157", "score": "0.61730784", "text": "def update\n raise NotImplementedError\n end", "title": "" }, { "docid": "e1f766468b11768b786daa133483b157", "score": "0.61730784", "text": "def update\n raise NotImplementedError\n end", "title": "" }, { "docid": "b76d372399abbb21b748df3ae7b06470", "score": "0.6159277", "text": "def live_update!(property)\n property_class = Vebra.models[:property][:class].to_s.camelize.constantize\n\n # ensure we have the full property attributes\n property.get_property if !property.attributes[:status] && property.attributes[:action] != 'deleted'\n\n # find & update or build a new property\n property_model = property_class.find_or_initialize_by_vebra_ref(property.attributes[:vebra_ref])\n\n # make sure property object is not empty\n return false if !property.attributes || !property.attributes[:property_type]\n\n # if the property has been deleted, mark it appropriately and move on\n if property.attributes[:action] == 'deleted'\n return property_model.destroy\n end\n\n # extract accessible attributes for the property\n property_accessibles = property_class.accessible_attributes.map(&:to_sym)\n property_attributes = property.attributes.inject({}) do |result, (key, value)|\n result[key] = value if property_accessibles.include?(key)\n result\n end\n\n # update the property model's attributes\n property_model.no_callbacks = true if property_model.respond_to?(:no_callbacks)\n property_model.update_attributes(property_attributes)\n\n # find & update or build a new address\n if Vebra.models[:address]\n address_class = Vebra.models[:address][:class].to_s.camelize.constantize\n address_model = property_model.send(Vebra.models[:property][:address_method])\n address_model = property_model.send(\"build_#{Vebra.models[:property][:address_method]}\") unless address_model\n\n # extract accessible attributes for the address\n address_accessibles = address_class.accessible_attributes.map(&:to_sym)\n address_attributes = property.attributes[:address].inject({}) do |result, (key, value)|\n result[key] = value if address_accessibles.include?(key)\n result\n end\n\n # update the address model's attributes\n address_model.update_attributes(address_attributes)\n end\n\n # find & update or build new rooms\n if Vebra.models[:room]\n room_class = Vebra.models[:room][:class].to_s.camelize.constantize\n\n # accessible attributes for the rooms\n room_accessibles = room_class.accessible_attributes.map(&:to_sym)\n\n # delete any rooms which are no longer present\n property_rooms = property.attributes[:rooms] || []\n property_model_rooms = property_model.send(Vebra.models[:property][:rooms_method])\n refs_to_delete = property_model_rooms.map(&:vebra_ref) - property_rooms.map { |r| r[:vebra_ref] }\n property_model_rooms.each do |room|\n room.destroy if refs_to_delete.include?(room.vebra_ref)\n end\n\n # find & update or build new rooms\n property_rooms.each do |room|\n room_model = room_class.find_by_property_id_and_vebra_ref(property_model.id, room[:vebra_ref])\n room_model = property_model_rooms.build unless room_model\n\n # extract accessible attributes for the room\n room_attributes = room.inject({}) do |result, (key, value)|\n result[key] = value if room_accessibles.include?(key)\n result\n end\n\n # update the room model's attributes\n room_model.update_attributes(room_attributes)\n end\n end\n\n # find & update or build new file attachments\n if Vebra.models[:file]\n file_class = Vebra.models[:file][:class].to_s.camelize.constantize\n\n # accessible attributes for the files\n file_accessibles = file_class.accessible_attributes.map(&:to_sym)\n\n # first normalize the collection (currently nested collections)\n property_files = property.attributes[:files].inject([]) do |result, (kind, collection)|\n collection.each do |file|\n file[:type] = kind.to_s.singularize.camelize if file_accessibles.include?(:type)\n file[\"remote_#{Vebra.models[:file][:attachment_method]}_url\".to_sym] = file.delete(:url)\n # if file[:type] is set, it means the attachment file class can be subclassed. In this\n # case we need to ensure that the subclass exists. If not, we ignore this file\n begin\n file[:type].constantize if file_accessibles.include?(:type)\n result << file\n rescue NameError => e\n # ignore - this means the subclass does not exist\n puts \"[Vebra]: #{e.message}\" if Vebra.debugging?\n end\n end\n\n result\n end\n\n # delete any files which are no longer present\n property_model_files = property_model.send(Vebra.models[:property][:files_method])\n refs_to_delete = property_model_files.map(&:vebra_ref) - property_files.map { |f| f[:vebra_ref] }\n property_model_files.each do |file|\n file.destroy if refs_to_delete.include?(file.vebra_ref)\n end\n\n # find & update or build new files\n property_files.each do |file|\n begin\n file_model = property_model_files.find_by_vebra_ref(file[:vebra_ref])\n file_model = property_model_files.build unless file_model\n\n # extract accessible attributes for the file\n file_attributes = file.inject({}) do |result, (key, value)|\n result[key] = value if file_accessibles.include?(key)\n result\n end\n\n # update the room model's attributes\n file_model.update_attributes(file_attributes)\n rescue CarrierWave::ProcessingError, OpenURI::HTTPError => e\n # just ignore the file\n puts \"[Vebra]: #{e.message}\" if Vebra.debugging?\n end\n end\n end\n\n property_model.no_callbacks = false if property_model.respond_to?(:no_callbacks)\n property_model.save\n return property_model\n end", "title": "" }, { "docid": "01219537b43bd1cf8341e0f00e27d4c8", "score": "0.6156169", "text": "def update!(**args)\n @id = args[:id] if args.key?(:id)\n @property_value = args[:property_value] if args.key?(:property_value)\n end", "title": "" }, { "docid": "147d62c4df79ff1ca86cbd477112bf7f", "score": "0.61445665", "text": "def update\n end", "title": "" }, { "docid": "f3dea89f306804c3f2aa813c06584d06", "score": "0.6125433", "text": "def update!(**args)\n @mid = args[:mid] if args.key?(:mid)\n @property_value = args[:property_value] if args.key?(:property_value)\n end", "title": "" }, { "docid": "44756fd86dd095556580199f7e78936f", "score": "0.61241156", "text": "def modified_properties=(value)\n @modified_properties = value\n end", "title": "" }, { "docid": "593de84fa9950baa68153e4fa9b6e17c", "score": "0.6121413", "text": "def apply_properties!(properties)\n # Non-commutitivity etc. eventually.\n end", "title": "" }, { "docid": "ea25adea5b43c27e6c84f27ad88c3d9f", "score": "0.6110477", "text": "def set_properties(hash)\n hash.each do |key, value|\n add_or_remove_ostruct_member(key, value)\n end\n rest_reset_properties\n end", "title": "" }, { "docid": "147138a710a0ff53e9288ae66341894f", "score": "0.6105694", "text": "def update\n\t\t\n\t\tend", "title": "" }, { "docid": "7b1d2242b1a6bd8d3cad29be97783a80", "score": "0.61016303", "text": "def set_props(props)\n @props.merge!(props)\n end", "title": "" }, { "docid": "cb2162d3a1fd3434effd12aa702f250f", "score": "0.60845226", "text": "def update() end", "title": "" }, { "docid": "231370ed2400d22825eba2b5b69e7a67", "score": "0.6084427", "text": "def update!(**args)\n @property_definitions = args[:property_definitions] if args.key?(:property_definitions)\n end", "title": "" }, { "docid": "86ff97cc222b987bff78c1152a1c8ee1", "score": "0.6065455", "text": "def assign_properties\n self.properties ||= {}\n listing_properties.each do |prop|\n self.properties[prop.key] ||= prop.value\n end\n end", "title": "" }, { "docid": "0f6ea4c54f9bc18020c08410f67289cd", "score": "0.6059506", "text": "def change_properties(new_current_floor, new_next_floor, new_movement)\n @current_floor = new_current_floor\n @next_floor = new_next_floor\n @movement = new_movement\n end", "title": "" }, { "docid": "453da6bb915596261c5b82f2d17cabf8", "score": "0.6054869", "text": "def update!(**args)\n @property_value = args[:property_value] if args.key?(:property_value)\n end", "title": "" }, { "docid": "52a81d6eb0fed16fe2a23be3d9ebc264", "score": "0.6051708", "text": "def update!(**args)\n @property_name = args[:property_name] if args.key?(:property_name)\n end", "title": "" }, { "docid": "52a81d6eb0fed16fe2a23be3d9ebc264", "score": "0.6051708", "text": "def update!(**args)\n @property_name = args[:property_name] if args.key?(:property_name)\n end", "title": "" }, { "docid": "874639781ed80ae451fbdd6ebbef2218", "score": "0.60413384", "text": "def update(attributes)\n (@attributes ||= {}).merge! attributes\n\n (self.class.attr_initializables & attributes.keys).each do |name|\n instance_variable_set :\"@#{name}\", attributes[name]\n end\n\n self\n end", "title": "" }, { "docid": "d175f5bedd91a8daf191cad42b04dc0c", "score": "0.6030853", "text": "def update_attributes(attrs)\n super({})\n end", "title": "" }, { "docid": "b8d1a7cd8f443ee5f30b5085aadff479", "score": "0.6022535", "text": "def update\n @dirty = true\n end", "title": "" }, { "docid": "d7d62f9c97f629ef8c88e56d3d1ce8ee", "score": "0.6015561", "text": "def update\n\n # Run through the mixin updates\n colourable_update\n movable_update\n\n end", "title": "" }, { "docid": "71750bae7e3d6bdde2b60ec30e70949a", "score": "0.59932375", "text": "def set(props)\n props.each do |prop, val|\n self.send(:\"#{ prop }=\", val)\n end\n end", "title": "" }, { "docid": "73fe9bc31bfeeab4d84483e2fa65cbbb", "score": "0.59898263", "text": "def update\n super\n end", "title": "" }, { "docid": "a98ac99e6e5115383e9148202286ff9e", "score": "0.5976479", "text": "def update!(**args)\n @property_id = args[:property_id] if args.key?(:property_id)\n @value_status = args[:value_status] if args.key?(:value_status)\n end", "title": "" }, { "docid": "fb14f35e7fab31199053a7b87ef451a4", "score": "0.5973787", "text": "def update!(**args)\n @object_size_bytes = args[:object_size_bytes] if args.key?(:object_size_bytes)\n @object_version = args[:object_version] if args.key?(:object_version)\n end", "title": "" }, { "docid": "6441b3fa93c3dfd974c66a975adb9d9c", "score": "0.59678394", "text": "def movable_update\n\n # Work through the different aspects we update\n movable_location_update\n movable_size_update\n movable_angle_update\n\n end", "title": "" }, { "docid": "51a59f953548d1eff10532bdffdd8df9", "score": "0.5963291", "text": "def properties=(value)\n @properties = value\n end", "title": "" }, { "docid": "e7a3d5504fcc6e382b06845ede0d5fd8", "score": "0.5962048", "text": "def update(attrs)\n attrs.each_pair do |key, value|\n send(\"#{key}=\", value) if respond_to?(\"#{key}=\")\n # attributes[key] = value <- lets make use of virtual attributes too\n end\n end", "title": "" }, { "docid": "c7a2880c3da02b3708afc43c48d37f2e", "score": "0.5961157", "text": "def update(context={})\n self.pre_cast_attributes\n m2o = @relations.reject{|k, v| !self.class.many2one_relations.has_key?(k)}\n vals = @attributes.reject {|key, value| key == 'id'}.merge(m2o.merge(m2o){|k, v| v.is_a?(Array) ? v[0] : v})\n self.class.rpc_execute('write', self.id, vals, context)\n reload_from_record!(self.class.find(self.id, :context => context))\n end", "title": "" }, { "docid": "c3f11e80d4ed9199aaaf751efade4812", "score": "0.5950731", "text": "def update; end", "title": "" }, { "docid": "c3f11e80d4ed9199aaaf751efade4812", "score": "0.5950731", "text": "def update; end", "title": "" }, { "docid": "c3f11e80d4ed9199aaaf751efade4812", "score": "0.5950731", "text": "def update; end", "title": "" }, { "docid": "c3f11e80d4ed9199aaaf751efade4812", "score": "0.5950731", "text": "def update; end", "title": "" }, { "docid": "c3f11e80d4ed9199aaaf751efade4812", "score": "0.5950731", "text": "def update; end", "title": "" }, { "docid": "c3f11e80d4ed9199aaaf751efade4812", "score": "0.5950731", "text": "def update; end", "title": "" }, { "docid": "c3f11e80d4ed9199aaaf751efade4812", "score": "0.5950731", "text": "def update; end", "title": "" }, { "docid": "c3f11e80d4ed9199aaaf751efade4812", "score": "0.5950731", "text": "def update; end", "title": "" }, { "docid": "5ca2caa1a207739e77f437de35e41cf1", "score": "0.59500545", "text": "def update ; end", "title": "" }, { "docid": "a20f534093aba7e3633ca0ac07a56d53", "score": "0.59443134", "text": "def update!(**args)\n @freshness_duration = args[:freshness_duration] if args.key?(:freshness_duration)\n @freshness_property = args[:freshness_property] if args.key?(:freshness_property)\n end", "title": "" }, { "docid": "a20f534093aba7e3633ca0ac07a56d53", "score": "0.59443134", "text": "def update!(**args)\n @freshness_duration = args[:freshness_duration] if args.key?(:freshness_duration)\n @freshness_property = args[:freshness_property] if args.key?(:freshness_property)\n end", "title": "" }, { "docid": "2c309c8084bf29f0b8d8674d22086956", "score": "0.59424853", "text": "def method_missing(method, *args)\n super if @updated\n set_up_properties_from(@client.get(@path))\n self.send method, *args\n end", "title": "" }, { "docid": "2c309c8084bf29f0b8d8674d22086956", "score": "0.59424853", "text": "def method_missing(method, *args)\n super if @updated\n set_up_properties_from(@client.get(@path))\n self.send method, *args\n end", "title": "" }, { "docid": "879f1214e030bb2d9e43a0aedb1bc3ea", "score": "0.593523", "text": "def update_with(attributes)\n assign_attributes(attributes)\n end", "title": "" }, { "docid": "10b1cb39dbb1f67820e37bb6d2632986", "score": "0.5926413", "text": "def update\n # don't need to update; hash is shared\n end", "title": "" }, { "docid": "51982942bd4f09be3f7adc59da4cf104", "score": "0.5924831", "text": "def update(attributes)\n HashProxy.with(attributes) do |proxy|\n self.class.attribute_names.each do |name|\n send(\"#{name}=\", proxy[name]) if proxy.key?(name)\n end\n end\n save\n end", "title": "" }, { "docid": "f0dd489c52fa73b1c3846fa43727c29e", "score": "0.592427", "text": "def update!(**args)\n @object_id_prop = args[:object_id_prop] if args.key?(:object_id_prop)\n @relation = args[:relation] if args.key?(:relation)\n @subject_id = args[:subject_id] if args.key?(:subject_id)\n end", "title": "" }, { "docid": "4229acd17d03e94871226b09dd3bd37d", "score": "0.59233046", "text": "def update!(**args)\n @boolean_property_options = args[:boolean_property_options] if args.key?(:boolean_property_options)\n @date_property_options = args[:date_property_options] if args.key?(:date_property_options)\n @display_options = args[:display_options] if args.key?(:display_options)\n @double_property_options = args[:double_property_options] if args.key?(:double_property_options)\n @enum_property_options = args[:enum_property_options] if args.key?(:enum_property_options)\n @html_property_options = args[:html_property_options] if args.key?(:html_property_options)\n @integer_property_options = args[:integer_property_options] if args.key?(:integer_property_options)\n @is_facetable = args[:is_facetable] if args.key?(:is_facetable)\n @is_repeatable = args[:is_repeatable] if args.key?(:is_repeatable)\n @is_returnable = args[:is_returnable] if args.key?(:is_returnable)\n @is_sortable = args[:is_sortable] if args.key?(:is_sortable)\n @is_suggestable = args[:is_suggestable] if args.key?(:is_suggestable)\n @is_wildcard_searchable = args[:is_wildcard_searchable] if args.key?(:is_wildcard_searchable)\n @name = args[:name] if args.key?(:name)\n @object_property_options = args[:object_property_options] if args.key?(:object_property_options)\n @text_property_options = args[:text_property_options] if args.key?(:text_property_options)\n @timestamp_property_options = args[:timestamp_property_options] if args.key?(:timestamp_property_options)\n end", "title": "" }, { "docid": "4229acd17d03e94871226b09dd3bd37d", "score": "0.59233046", "text": "def update!(**args)\n @boolean_property_options = args[:boolean_property_options] if args.key?(:boolean_property_options)\n @date_property_options = args[:date_property_options] if args.key?(:date_property_options)\n @display_options = args[:display_options] if args.key?(:display_options)\n @double_property_options = args[:double_property_options] if args.key?(:double_property_options)\n @enum_property_options = args[:enum_property_options] if args.key?(:enum_property_options)\n @html_property_options = args[:html_property_options] if args.key?(:html_property_options)\n @integer_property_options = args[:integer_property_options] if args.key?(:integer_property_options)\n @is_facetable = args[:is_facetable] if args.key?(:is_facetable)\n @is_repeatable = args[:is_repeatable] if args.key?(:is_repeatable)\n @is_returnable = args[:is_returnable] if args.key?(:is_returnable)\n @is_sortable = args[:is_sortable] if args.key?(:is_sortable)\n @is_suggestable = args[:is_suggestable] if args.key?(:is_suggestable)\n @is_wildcard_searchable = args[:is_wildcard_searchable] if args.key?(:is_wildcard_searchable)\n @name = args[:name] if args.key?(:name)\n @object_property_options = args[:object_property_options] if args.key?(:object_property_options)\n @text_property_options = args[:text_property_options] if args.key?(:text_property_options)\n @timestamp_property_options = args[:timestamp_property_options] if args.key?(:timestamp_property_options)\n end", "title": "" }, { "docid": "32ed734ad4f899f0ee9ec74a760ca1d0", "score": "0.5921224", "text": "def update\n raise NotImplementedError\n end", "title": "" }, { "docid": "900f4c147e0916b2e9270373fb83c7e2", "score": "0.59144294", "text": "def update_attributes attributes\n @attributes.merge! attributes\n end", "title": "" }, { "docid": "f63de190ae582620103d96f60d684114", "score": "0.59142506", "text": "def update!(**args)\n @async_options = args[:async_options] if args.key?(:async_options)\n @input_mappings = args[:input_mappings] if args.key?(:input_mappings)\n @name_property = args[:name_property] if args.key?(:name_property)\n @validation_options = args[:validation_options] if args.key?(:validation_options)\n end", "title": "" }, { "docid": "512d9095b05a696270730ee09c640773", "score": "0.58887535", "text": "def update\r\n end", "title": "" }, { "docid": "5b1f6d40d29f0afb908434d0a6404ac8", "score": "0.58854496", "text": "def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @type = args[:type] if args.key?(:type)\n end", "title": "" }, { "docid": "efcb8c985b9e7911a606a9149b4ab171", "score": "0.5883008", "text": "def update\n raise NotImplemented\n end", "title": "" }, { "docid": "65f67197ac4544cbebca350d889922ee", "score": "0.58792305", "text": "def update_obj\n mean, sd = rating.to_glicko_rating\n @obj.rating = mean\n @obj.rating_deviation = sd\n @obj.volatility = volatility\n end", "title": "" }, { "docid": "c71a8be944fb89ab77a17fd4c16f7193", "score": "0.5876954", "text": "def update_values\n end", "title": "" }, { "docid": "c71a8be944fb89ab77a17fd4c16f7193", "score": "0.5876954", "text": "def update_values\n end", "title": "" }, { "docid": "10e162e857be9c47150e8eccd327cad9", "score": "0.58744955", "text": "def update\n raise NotImplementedError\n end", "title": "" }, { "docid": "389ac4585e8143f353e2535499a23085", "score": "0.5857968", "text": "def update!(**args)\n @answers_header_signals = args[:answers_header_signals] if args.key?(:answers_header_signals)\n @property_value = args[:property_value] if args.key?(:property_value)\n @response_meaning_application = args[:response_meaning_application] if args.key?(:response_meaning_application)\n end", "title": "" }, { "docid": "c202a823016f05ee2fc4aade77320497", "score": "0.5845542", "text": "def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @method_prop = args[:method_prop] if args.key?(:method_prop)\n @name = args[:name] if args.key?(:name)\n @state = args[:state] if args.key?(:state)\n end", "title": "" }, { "docid": "dc268f568dcb7aca1d3905736d2477af", "score": "0.5841629", "text": "def update attributes, collection #:nodoc:\n 0\n end", "title": "" }, { "docid": "9763ac25d7fdf4b4f35a971609f70b04", "score": "0.58363605", "text": "def update_property_groups(roll)\n @property_groups.each { |_, v| v.update_rent(roll) }\n end", "title": "" }, { "docid": "541550458a4c8f94afeb6b10c0cb2293", "score": "0.5829255", "text": "def update!(**args)\n @source_property = args[:source_property] if args.key?(:source_property)\n end", "title": "" }, { "docid": "49a282f2ce0c099a5ced60524a492b4f", "score": "0.582919", "text": "def update_info(update_attr_hash)\n update_attr_hash.each do |k,v| \n\t\t\tself.send(\"#{k}=\",v)\n\t\tend\n end", "title": "" }, { "docid": "f6c4eafa4f48a0c81157fb03ff350901", "score": "0.5822138", "text": "def update_properties(path, properties)\n prop_patch = PropPatch.new(properties)\n emit('propPatch', [path, prop_patch])\n prop_patch.commit\n\n prop_patch.result\n end", "title": "" }, { "docid": "524a6a969929f9af4bad05dbd9c8f935", "score": "0.58208305", "text": "def update\n set_deltatime\n set_last_update_at\n end", "title": "" } ]
8bd0bb61a89236131da7ef5e5f31c2a9
The player adds a card to his side of the board, fails if he does not have enough mana.
[ { "docid": "3412d412c01fa09e2bfee5da7804f6a0", "score": "0.67811495", "text": "def playCard (card)\n\t\tif card.cost > @remaining_mana\n\t\t\tp \"Not enough mana!\"\n\t\telse\n\t\t\t@board.addToBoard(self, card)\n\t\tend\n\tend", "title": "" } ]
[ { "docid": "4d9b96adf2e3e751f9003c43f922d1a1", "score": "0.7081044", "text": "def addToBoard(player, card)\n\t\tif player.side == 1\n\t\t\t@p1Board.push(card)\n\t\telse\n\t\t\t@p2Board.push(card)\n\t\tend\n\tend", "title": "" }, { "docid": "ebedfedd2e9b8b304e215a64895ee6c4", "score": "0.6888787", "text": "def add_a_card(card)\n if is_full?\n puts \"Deck is full.You can't add a card\"\n return false\n elsif empty?\n @deck << card\n @added_cards << card\n cards_left\n elsif !find_card(card)\n random = rand(cards_left)\n insert_card(random, card)\n @added_cards << card\n random\n else\n puts \"Can't add a duplicate card to the Deck\"\n return false\n end\n end", "title": "" }, { "docid": "6fbfe08d61cdf488e714c34152024717", "score": "0.6756242", "text": "def addCard(card)\n\t\t@cards << card\n\t\t@value += getValue(card.rank)\n\t\tif card.rank == 'Ace'\n\t\t\t@hasAce = true\n\t\tend\n\t\tif @cards.length == 2 and @value == 21 and @hasAce # updates should be in different method\n\t\t\t@blackjack = true\n\t\tend\n\t\tif @value > 21 and @hasAce\n\t\t\t@value -= 10\n\t\t\t@hasAce = false\n\t\tend\n\tend", "title": "" }, { "docid": "7066b7b3a1d3d52e15572c58b4a46a32", "score": "0.6727916", "text": "def addCard(card)\n \tif @can_get_cards\n \t @cards.push(card)\n else\n raise ArgumentError, \"Cards cannot be added to this hand anymore.\"\n \tend\n end", "title": "" }, { "docid": "d457e8b1de4a37a84dce5240e0aed656", "score": "0.6720749", "text": "def add card\r\n # Unlucky for some !\r\n # Sometimes Moody Players won't play.\r\n if rand(40)==13\r\n puts \"Moody player didn't play!\"\r\n else\r\n @card_list.add card\r\n end\r\n end", "title": "" }, { "docid": "8fc04700aed575badac78a0d566ad5a9", "score": "0.6669639", "text": "def add_card(card)\n @addhand = @addhand + card\n end", "title": "" }, { "docid": "b9f8fc0eba0a0cc03da8e2365b0081d3", "score": "0.6509936", "text": "def add!(playing_card)\n if playing_card.suit == suit &&\n (\n (playing_cards.empty? && playing_card.rank == 1) ||\n playing_card.rank == (playing_cards.last.rank + 1)\n )\n playing_cards.push(playing_card)\n else\n raise \"Cannot add #{playing_card} to #{self}\"\n end\n end", "title": "" }, { "docid": "70248b29b45cf4f5311b4ad67e4692e4", "score": "0.6466054", "text": "def add_card_without_revealing_details(card)\n player.add_card_to_hand(card)\n message = \"#{player.name} drew a card from the center.\"\n game.players.each {|player| player.send_message_to_user(message)}\n end", "title": "" }, { "docid": "bc6db3e0c3cb9e9d6741f44ac60c56ce", "score": "0.6387781", "text": "def add_member_to_card\n @trello.add_commander_to_card(find_member, @card)\n end", "title": "" }, { "docid": "0e665a06970284112292143534c04467", "score": "0.63616115", "text": "def add_cards_to_deck(card)\n @game_deck.deck << card\n end", "title": "" }, { "docid": "425b8c93d48e4a355243c826fda004d4", "score": "0.6341675", "text": "def add_to_hand(card)\n # add the new card to each \"hand\"\n @values = @values.map { |val| val + card.rank }\n\n # change accordngly if there is an ace\n update_for_ace if card.rank.eql?(1)\n\n @cards.push(card)\n end", "title": "" }, { "docid": "bad622f46d3484b2d7b4494d0c0570ad", "score": "0.63311416", "text": "def add_card(card)\n @deck.add(card, :back)\n end", "title": "" }, { "docid": "951949089537360782d3bd85a937b0b2", "score": "0.63252634", "text": "def add_to_pile_beneath(card)\n @pile_beneath << @pile.remove(card)\n end", "title": "" }, { "docid": "2c33d9e0a76f02a00f9651fbea98d703", "score": "0.6278065", "text": "def add(card)\n return unless card.is_a? Card\n # only allow cards to be added\n @cards << card\n end", "title": "" }, { "docid": "4d40388feabb3ac7dc3e18c259b20854", "score": "0.6265862", "text": "def add_card(new_card)\n self.cards.append(new_card)\n end", "title": "" }, { "docid": "c99b831413287794c6611a2d833f0264", "score": "0.62200946", "text": "def add_cards\n\t\t3.times { @board << @deck.draw }\n\tend", "title": "" }, { "docid": "3b10b8d07646d96262c0b9f2aecd2412", "score": "0.6191531", "text": "def add_card(new_card)\n cards.push(new_card)\n end", "title": "" }, { "docid": "a36bbe9b5f9ef758350247589b327197", "score": "0.6172718", "text": "def draw_card(card)\r\n\t\thand.add_card(card)\r\n\tend", "title": "" }, { "docid": "9ac368bc29aabf30ff51868e6863e89f", "score": "0.6158309", "text": "def add card\n if card.is_a? Card\n @hand.push card\n else\n @hand.push Card.new(card)\n end\n\n @analysis = analyse @hand\n end", "title": "" }, { "docid": "219b81d66a1ecd1b66685f28624690b5", "score": "0.6150158", "text": "def deal_card(player)\n if !self.is_empty?\n player.hand << cards.pop\n else\n self.initialize(1)\n end\n end", "title": "" }, { "docid": "4bf9c1c3f701a081c5ac66840f1e25c0", "score": "0.6139559", "text": "def player_deal_card\n player.add_card(deck.deal_card)\n player.add_card(deck.deal_card)\n player.show_hand\n end", "title": "" }, { "docid": "96ab04266191022db0eabd0f0702e7fe", "score": "0.61297655", "text": "def add_card(card)\n @cards << card\n end", "title": "" }, { "docid": "96ab04266191022db0eabd0f0702e7fe", "score": "0.61297655", "text": "def add_card(card)\n @cards << card\n end", "title": "" }, { "docid": "026812c0abce10e784c5acdf5b6239ac", "score": "0.61261696", "text": "def add_card(card)\n \t@cards << card\n end", "title": "" }, { "docid": "4406228936f45e35331b32d73d3c110b", "score": "0.6119977", "text": "def add_card(card)\n @cards.push(card)\n end", "title": "" }, { "docid": "c89df846354cdd4caa92d0547561c94b", "score": "0.611835", "text": "def add_card(card)\r\n\t\tcards << card\r\n\t\tcalc_value\r\n\tend", "title": "" }, { "docid": "e4a5da2a6c441150ebabf28d0baffe7e", "score": "0.60909605", "text": "def add_item_to_card(item)\n @card.add(get_item_text(item), item.rule.col, item.rule.row) if item.rule.max.positive?\n end", "title": "" }, { "docid": "96f14830f97c252f17bd48bf37e402d8", "score": "0.6039851", "text": "def add_card(c)\n @cards_showing.push(c)\n @table_size += 1\n end", "title": "" }, { "docid": "1d62609feff4bc84ff25406b668aa764", "score": "0.60324526", "text": "def add_card_to_hand(curr_hand)\n curr_hand.push(get_rand_card)\n end", "title": "" }, { "docid": "1a6aec3f4ff99db754aec47f23cb885f", "score": "0.6029575", "text": "def add_card(card)\n @cards.push\n end", "title": "" }, { "docid": "aaf4b6671d9cc508aace8e0cfa78b8da", "score": "0.6019729", "text": "def add(card)\n\t\t@hand_contents.push(card)\n\tend", "title": "" }, { "docid": "8593b4990a61d7df23ddc5080b80fcf2", "score": "0.6011353", "text": "def add_card(card)\n raise \"invalid placement!\" unless valid_placement?(card)\n @store << card\n end", "title": "" }, { "docid": "7c545aeedd800cb75b8524b211a39d08", "score": "0.5959715", "text": "def deal_card(game_deck,player)\n card = game_deck.deck.pop\n ace_checker(card,player)\n player.hand.push(card)\n puts\"#{player.player_name} received #{card.identify}\"\n puts \"Current hand: #{player.display_hand}\"\n win_or_bust(player)\n hit_or_stay(player)\nend", "title": "" }, { "docid": "11ef7f4eb122b37c79b64ccff748c348", "score": "0.59570163", "text": "def generate_card (player)\n new_card = Card.new face, suit, value\n player.hand << new_card\n #update total for player\n player.total = player.total + new_card.value\n end", "title": "" }, { "docid": "5f40233849ba8c65a237112ea516703d", "score": "0.5943633", "text": "def add_stone( col )\n col = col.is_a?(Fixnum) ? col : letter_to_number(col)\n\n return false if game_over\n return false unless (1..Connect4::COLUMNS).include?( col )\n return false if Connect4::ROWS <= @fill_heights[col]\n\n @fill_heights[col] += 1\n\n#p (col + (next_player ? 64 : 96)).chr\n begin\n @board[col][@fill_heights[col]] << next_player\n rescue => exception\n print \"\\n\"\n p exception\n p moves\n print '-'*40, \"\\n\"; print analyze(true); print '#'*40, \"\\n\"\n raise\n end #begin-resuce\n\n @moves << (col + (next_player ? 64 : 96)).chr\n @last_column = col\n @last_row = @fill_heights[col]\n @possible_cells.delete( @board[col][@fill_heights[col]] )\n @possible_cells << @board[col][@fill_heights[col]+1] if Connect4::ROWS > @fill_heights[col]\n\n @total_stones += 1\n\n if @board[col][@fill_heights[col]].winner\n @game_over = true\n @winner = last_player\n elsif Connect4::TOTAL_CELLS <= @total_stones\n @game_over = true\n @winner = Connect4::DRAW\n end #if\n\n return true\n end", "title": "" }, { "docid": "d86f014f40fa346dae2d99d5cc70287f", "score": "0.5925558", "text": "def add_card card\n card.deck = self\n @cards[card.id] = card\n end", "title": "" }, { "docid": "c21412a1f3abdbec90e7334f7896ad82", "score": "0.5901786", "text": "def add_bottom (card)\n @cards.unshift(card);\n end", "title": "" }, { "docid": "1651b183c724b743378757f61a9e60e8", "score": "0.59000987", "text": "def add card\r\n @card_list.add card\r\n end", "title": "" }, { "docid": "9e49483609f5b0d357b9661317072843", "score": "0.58833414", "text": "def addCardToHand(card)\n @hand << card\n end", "title": "" }, { "docid": "76a9a038006aae288ddaf983f8bf052c", "score": "0.581975", "text": "def add card\n @cards.push card\n end", "title": "" }, { "docid": "78c9aa7a98bc559b03ba09b37aaa544a", "score": "0.5819649", "text": "def restock_hand!\n return if Bot::CONFIG.hand_size == unplayed_cards.count\n (Bot::CONFIG.hand_size - unplayed_cards.count).times do\n add_player_card PlayerCard.create(answer: game.available_answers.sample)\n end\n end", "title": "" }, { "docid": "33e5fcbe94874c59f7b9efb46326ac06", "score": "0.58176863", "text": "def add card\n @card_list.add card\n end", "title": "" }, { "docid": "33e5fcbe94874c59f7b9efb46326ac06", "score": "0.58176863", "text": "def add card\n @card_list.add card\n end", "title": "" }, { "docid": "33e5fcbe94874c59f7b9efb46326ac06", "score": "0.58176863", "text": "def add card\n @card_list.add card\n end", "title": "" }, { "docid": "47065d76d0fcd7e7dd844d266eaecfea", "score": "0.5806569", "text": "def give_card_to_player(card,player)\n\t\t#player is another player object\n\t\t@cards[card].times do\n\t\t\tplayer.add_card(card)\n\t\tend\n\n\n\t\t#remove cards from hand if selected by another player\n\t\tself.remove_set_from_hand(card)\n\tend", "title": "" }, { "docid": "5f4f109de93feb60ef5ca7a2074c011c", "score": "0.58034277", "text": "def add_player(player)\n # Confirm user isn't already playing a game\n return errors.add(:base, 'Player is already playing a game') unless player.games.active.count == 0\n # Confirm the game is not full\n return errors.add(:base, 'Game is full') unless players.count < num_players\n # Add player\n game_players.create(player: player)\n start if players.count == num_players\n end", "title": "" }, { "docid": "17d8965e803c35bdf67f3b125e7c8039", "score": "0.5790966", "text": "def add_card(aCard)\n @cards << aCard\n @cards.sort!() {|card1, card2| card1.rank <=> card2.rank}\n @rank_histogram[aCard.rank] += 1\n @suit_histogram[aCard.suit] += 1\n @evaluation = nil\n @score = 0\nend", "title": "" }, { "docid": "cf7a4f72a5eabfcd0acc548567082543", "score": "0.57666326", "text": "def hit (deck)\n @hand << deck.deal_card\n calc_score\n true\n end", "title": "" }, { "docid": "9e96a28a6efe4e1e95a91c34625f364c", "score": "0.57551324", "text": "def add_player ( player )\n if self.players.size == 3 then \n raise \"can't add players\" \n end\n self.players << player \n self.status = self.players.size\n end", "title": "" }, { "docid": "9c37baff8650d4cde2a37b9b4124e2d6", "score": "0.5751581", "text": "def hit\n new_card = @deck.cards.pop\n @current_hand << new_card\n @total += new_card.value\n puts \"drew #{@current_hand[-1].card_id}\"\n\n @current_hand.each do |card|\n if @total > 21\n if card.value == 11 && card.ace_low == false\n @total -= 10\n card.ace_low = true\n end\n end\n end\n end", "title": "" }, { "docid": "ecb19212d7e119d802db2af1915236ab", "score": "0.57492006", "text": "def insert_at(column, player)\n return false if(@height[column] > 5)\n \n # Insert a disc at the next possible slot in the specified column\n @board[@height[column]][column] = player\n @height[column] += 1\n return true\n end", "title": "" }, { "docid": "538eb0b5ac74e0d2840828b0bcc0ce5d", "score": "0.57232577", "text": "def addCard(givenCard)\n \tcards_users.create(card_id: givenCard.id, is_shared: false)\n end", "title": "" }, { "docid": "74bd324a9a433774d7992c4d0e296432", "score": "0.5713485", "text": "def add_card(rank)\n @cards << Card.new(rank)\n end", "title": "" }, { "docid": "fb8b943f3f193072bb1e7c3b1337109f", "score": "0.5706505", "text": "def place(row, column, piece)\n\tif (row > @rows-1)\n\t\tputs \"Error:Row #{row} is out of bound\"\n\t\treturn\n\tend\n\tif (column > @columns-1)\n\t\tputs \"Error:Column #{column} is out of bound\"\n\t\treturn\n\tend\n\tif @board[row][column].nil?\n\t\t@board[row][column] = piece\n\t\tputs \"Piece #{piece} added at location board[#{row}][#{column}]\"\n\telse\n\t\tputs \"Piece is already placed at location board[#{row}][#{column}]\"\n\tend\n\t\n # Add logic & return output on console\n end", "title": "" }, { "docid": "2a571b76e04e47be55248b1f362f1c9d", "score": "0.57025456", "text": "def buy_card(card_name)\n mapping = Cardmapping.find_by(name: card_name)\n current_player.discard.cards.create!( cardmapping_id: mapping.id ) \n decrement_supply_count(card_name, 1)\n update_attributes(buys: buys - 1, treasure: treasure - mapping.cost )\n end", "title": "" }, { "docid": "6ae3494e718457e5bdd403196b5a4a11", "score": "0.569966", "text": "def action_useCard(pockerCard_id)\n\n if check_cardOwn(pockerCard_id) and check_currentTurn()#only owner can play card and current turn on\n if check_usableNumShape(pockerCard_id) #check bottom number and shape\n\n sourcePlayer_id = Game.last.players.by_user(current_user).id\n destPlayer_id = Game.last.players.dummy.id # destPlayer_id = 2 (dummy) \n\n action_moveCard(dest_id: destPlayer_id, source_id: sourcePlayer_id, card_id: pockerCard_id)\n\n #check effect of cards\n card_effect = Pockercard.find(pockerCard_id).effect\n action_addDummyList(pockerCard_id)\n action_putBottomCard(pockerCard_id)\n if card_effect == \"none\"\n action_endTurn(1) #move to next player=[\n elsif card_effect == \"back\" \n Game.last.toggle_order!\n action_endTurn(1) #skip next player\n elsif card_effect == \"jump\" \n action_endTurn(2) #move to next next player\n elsif card_effect == \"attack\"\n action_attackCard(pockerCard_id)\n action_endTurn(1) #move to next next player\n elsif card_effect == \"change\"\n action_setBottomCardStep()\n elsif card_effect == \"onemore\" \n else\n action_endTurn(1) #skip next player\n end\n check_winOrLose() \n end\n end\n\n\n\n end", "title": "" }, { "docid": "9f37cc47e5dbae660c33df5522a12094", "score": "0.56878215", "text": "def add_card_to_bottom(card)\n unless self.id.nil? or (card.deck_id == self.id and card.card_order == 1)\n # Decrese the orders for the cards above in the old deck\n if card.deck_id\n card.deck.cards.where(\"card_order > ?\", card.card_order).each do |r|\n r.update_attributes(card_order: (r.card_order-1) )\n end\n end\n # Increase the orders for cards above in the new deck\n cards.each do |r|\n r.update_attributes(card_order: (r.card_order+1) )\n end\n # Add the card to the bottom of the new deck\n card.update_attributes(deck_id: id, card_order: 1)\n end\n end", "title": "" }, { "docid": "a317fd3c054442f3f83420f37314beb1", "score": "0.5679972", "text": "def add_to_deck (suit)\n cards = [2,3,4,5,6,7,8,9,10,'J','Q','K','A']\n cards.each {|val| @deck << Card.new(val, suit)}\n end", "title": "" }, { "docid": "6af987f26302918eb5fbd342bdc317ba", "score": "0.56552833", "text": "def request_add_piece\n while true\n coordinates = get_player_input\n\n if valid_coordinates?(coordinates)\n if @board.add_piece(coordinates, @piece)\n @board.update_board_and_eat_count(coordinates[0], coordinates[1], @piece)\n break\n end\n end\n end\n end", "title": "" }, { "docid": "abc9c74ae7279a96afcab60264737915", "score": "0.5648533", "text": "def hit(card)\n hand = @hands[@current_hand]\n hand.cards.push(card)\n puts \"New card received - #{card}\"\n if hand.is_bust()\n print_player_hands()\n puts \"Player #{@position} busts!\"\n @current_hand += 1\n end\n end", "title": "" }, { "docid": "fab278f996b19dfc43bd3dc69dcef2e7", "score": "0.5633215", "text": "def add_queen_to_board(position)\n\t\t# Determine if the square is free\n\t\tif board[position] != 0\n\t\t\treturn false\n\t\tend\n\n\t\t# If this square is free, put a queen on it\n\t\tboard[position] = 1\n\n\t\t# Sets the moves available by the queen to be attacked\n\t\tQueen.moves(position).each do |attack_position|\n\t\t\tboard[attack_position] = 2 if board[attack_position] == 0\n\t\tend\n\n\t\treturn true\n\tend", "title": "" }, { "docid": "ca29d841441be5252214fdee5324496d", "score": "0.5633085", "text": "def draw_final_card\n @card3 = Card.draw(@card1.id, @card2.id)\n puts \"The next card is the #{@card3}\"\n\n # player wins if card is Joker\n raise Rules::Win::Joker if @card3.joker?\n end", "title": "" }, { "docid": "5f220c5f7d320ca666b97eb9864eeac4", "score": "0.5626572", "text": "def add_commander_to_card(commander, card)\n card.add_member(commander) if commander\n end", "title": "" }, { "docid": "8a0a29af37e6bd567e1b06b3cacac2dc", "score": "0.5620779", "text": "def update_board\n if !sets_available?\n add_three_cards\n return true\n else\n return false\n end\n end", "title": "" }, { "docid": "1f87139bed2e26cfbbe414ef02b56f4e", "score": "0.56107825", "text": "def choose_and_add_card_to_user_deck\n prompt = TTY::Prompt.new\n card = choose_hero\n response = prompt.select('Do you want to add this card to your collection?', %w(Yes No))\n if response == \"Yes\"\n added_card = UserCard.create(user_id: self.id, card_id: card.id)\n puts \"#{added_card.card.name.upcase} was added to your collection.\"\n sleep(1)\n end\n system('clear')\n title\n response = prompt.select('Do you want to look for another card?', %w(Yes No))\n if response == \"Yes\"\n self.choose_and_add_card_to_user_deck\n end\n end", "title": "" }, { "docid": "239d5069466a2d15e277703694f9515d", "score": "0.5577973", "text": "def draw\n raise \"not enough cards\" if @cards.empty?\n @cards.shift\n end", "title": "" }, { "docid": "e3190a715dc311ed5ff3bd1fd714ba78", "score": "0.5574873", "text": "def add(point, bug)\n validate_point(point)\n return false unless legal_addition?(point, bug)\n add_to_hive(point, bug)\n @board[point] = bug\n return true\n end", "title": "" }, { "docid": "56616c2ed690c001f466efe6a2fe7e5e", "score": "0.55738163", "text": "def push(card)\n @pile.push(card)\n card.arm!\n end", "title": "" }, { "docid": "4b9c15958759915bfbcb8716929db867", "score": "0.55502224", "text": "def addCardsToHand(cards)\n @hand.concat(cards)\n end", "title": "" }, { "docid": "fd34ea751f28e95185b5220acd4745dd", "score": "0.5537311", "text": "def onalg_player_cardsnot_allowed(player, cards)\r\n lbl_card = cards[0]\r\n log \"#{player.name} ha giocato una carta non valida [#{nome_carta_ita(lbl_card)}]\\n\"\r\n @player_on_gui[:can_play] = true\r\n end", "title": "" }, { "docid": "e26c6b2a2e8318ca7098ba9f0c7ecd5a", "score": "0.5518777", "text": "def addPiece(piece)\n\t\tif(@piece == nil)\n\t\t\t@piece = piece;\n\t\t\t@piece.addSpace(self);\n\t\t\treturn true;\n\t\telse\n\t\t\treturn false;\n\t\tend\n\tend", "title": "" }, { "docid": "4fb7f1a91bb313d39b42f721a9978099", "score": "0.54713833", "text": "def deal_card\n\t\tCard.deal_new(self)\n\t\tupdate_total\n\tend", "title": "" }, { "docid": "79c01fee784ef4c977dff6dadcf992dc", "score": "0.5462736", "text": "def deal_cards\n MAX_CARDS.times do |d|\n @player_manager.players.each do |player| \n player.rack.add_card(@decks_manager.draw_pile.draw_card)\n end\n end\n\n # prep the discard pile with one card from the top of the draw pile\n @decks_manager.discard_top_card\n end", "title": "" }, { "docid": "96cd09a9bbc3ff0fa0041e8c7ef8031b", "score": "0.54474545", "text": "def drawCard\n\t\t@hand = @hand.push(@deck.pop)\n\tend", "title": "" }, { "docid": "7c662bf73ac6b49d9c70160c874f3bd3", "score": "0.54441154", "text": "def take_card(card)\n @cards << card\n end", "title": "" }, { "docid": "204812f87927bf2a0573eef58c062a22", "score": "0.54423743", "text": "def push_card_on_table(player, card)\n \tp_cards = player.get_player_cards\n \tif key = p_cards.index(card)\n \t\tself.cards_on_table << card\n \t\tp_cards.delete_at(key)\n \t\tplayer.player_cards = p_cards\n\t\tend\n send_update\n\t\treturn self.cards_on_table\n end", "title": "" }, { "docid": "7aa29bf3761c87e0a9fcbcd340e0d860", "score": "0.5438084", "text": "def add_piece(piece, pos)\n\n end", "title": "" }, { "docid": "d43447cc5f66278ea1b1644537802d21", "score": "0.5434855", "text": "def add_top (card)\n @cards.push(card);\n end", "title": "" }, { "docid": "49d8b777ed82746bbbb85b6c350034bd", "score": "0.5428833", "text": "def add_player(user)\n if self.players.count < self.max_players\n self.players.build(:user => user)\n end\n end", "title": "" }, { "docid": "dab769bb412e6754e1162bb725253fe4", "score": "0.5428203", "text": "def isOver?\n @deck.cardsRemaining < MIN_CARDS\n end", "title": "" }, { "docid": "1b3448eaec0400960571cdad88d5446c", "score": "0.5427666", "text": "def save_card_into_player_win(player)\n cont = @cards_thrown.length - 1\n while cont >= 0\n card = @cards_thrown[cont]\n player.cards_wins.push(card)\n @cards_thrown.delete_at(cont)\n cont -= 1\n end\n end", "title": "" }, { "docid": "bf17677efe3062e48cdc777750f4b147", "score": "0.5422105", "text": "def place_bet(player, amount)\n raise Exceptions::NotEnoughChips if player.chips < amount\n @pot += amount\n player.chips -= amount\n end", "title": "" }, { "docid": "ee945248697b475e40059820a73e91ba", "score": "0.5417946", "text": "def add_card(name, suit, rank)\r\n card = Card.new(name, suit, rank)\r\n @cards << card\r\n @order << card.to_s\r\n end", "title": "" }, { "docid": "df134207d0a81625998c1729490c401e", "score": "0.54024404", "text": "def move_card(draw, play)\n if play.empty? && draw.any?\n play << draw.shift\n elsif draw.any? && (within_one?(draw[0].rank.to_i, play[-1].rank.to_i))\n play << draw.shift\n else\n end\nend", "title": "" }, { "docid": "17765bd448c89c0dda1111325424825f", "score": "0.53990376", "text": "def take_card\n raise OutOfCardsError if empty?\n @cards.pop\n end", "title": "" }, { "docid": "fa4a095ededaac16ff8f229576084e08", "score": "0.53951925", "text": "def add_piece(board, move, piece=\"R\")\n spot = board[move].rindex(nil)\n board[move][spot] = piece\n board\n end", "title": "" }, { "docid": "3fa2280c6382a86941d9d0da6e1ac59d", "score": "0.539296", "text": "def add_health_pack(health_pack)\n @life_points = life_points + health_pack\n @life_points = 100 if life_points > 100 \n puts \" Tu as maintenant #{life_points} point de vie\"\n end", "title": "" }, { "docid": "acda8ceaa29ddd4b2ccb18860ea7547b", "score": "0.53923106", "text": "def add_rook(player, row, col)\n game.pieces << Rook.create(piece(player, row, col))\n end", "title": "" }, { "docid": "16202f09bd2811efc219ac0654852d5d", "score": "0.5391692", "text": "def deal_card_to_player(player, card, show)\n if show\n puts \"Dealing to #{player.name}: #{card}\"\n elsif\n puts \"Dealing hidden card to #{player.name}\"\n end\n player.hands[0].add_card(card, false)\n end", "title": "" }, { "docid": "cd925b65696a1e91250e68a8fc63678b", "score": "0.5383894", "text": "def deal(card)\n\t\t@hand.push(card)\n\tend", "title": "" }, { "docid": "9224f36eacd4f4320975afd9578d9d46", "score": "0.53711236", "text": "def check_all_cards\n all_cards = @cpu_hand.cards + @player_hand.cards\n\n if all_cards.length == 0\n complete\n elsif !all_cards.any? { |c| @total + c.value <= 31 }\n # There was no way to continue with the previous set, start a new one with\n # the other player.\n\n @scorer.peg_player( @turn, 1, 'a Go' )\n\n start_set\n\n @turn = other_player @turn\n end\n\n @engine.delay_update( 1 ) if @turn == :cpu\n end", "title": "" }, { "docid": "641f1d01075f0103e6add966e007058c", "score": "0.5369052", "text": "def add_card_to_top(card)\n unless self.id.nil? or (card.deck_id == self.id and card.card_order == get_top_order)\n #Update order of card's current deck\n if card.deck_id\n card.deck.cards.where(\"card_order > ?\", card.card_order).each do |r|\n r.update_attributes(card_order: (r.card_order-1) )\n end\n end\n # Add the card to the top of the new deck\n card.update_attributes(deck_id: id, card_order: (get_top_order+1) )\n end\n end", "title": "" }, { "docid": "cbc12fe3bf6407f0a0cd3bdcea257fd5", "score": "0.5335817", "text": "def <<(card)\n @cards << card\n end", "title": "" }, { "docid": "d06e3433d20ed417ac27db8eee9bec13", "score": "0.5334927", "text": "def human_can_not_play(player, deck)\n puts \"#{player.name} has no possible cards to play\"\n puts 'Press enter to pick up from deck'\n gets.chomp\n player.cards << deck.take_card\n return \"drew a card\"\n end", "title": "" }, { "docid": "a76517c2a513dfcc86d08d6609e65859", "score": "0.5331487", "text": "def place(row, column, piece)\n if row >= self.rows\n raise \"Board has #{self.rows} rows and index #{row} is out of bounds.\"\n end\n\n if row >= self.rows\n raise \"Board has #{self.columns} columns and index #{column} is out of bounds.\"\n end\n\n if @board[row][column] != nil\n raise \"Cannot place #{piece.inspect} at row #{row}, column #{column}: #{@board[row][column].inspect} is already there.\"\n end\n\n @board[row][column] = piece\n end", "title": "" }, { "docid": "2efdb63283f10cb29d2de7dcbfe2e8de", "score": "0.532599", "text": "def add_row\n @rows += 1\n @current_cards.push [@deck.removeAny, @deck.removeAny, @deck.removeAny]\n end", "title": "" }, { "docid": "43dbabacd125c556d9311c2383bea148", "score": "0.53256476", "text": "def add_piece(piece,position)\n\t\tposition_grille = convert_position_to_array(position)\n\t\tx = position_grille[0]\n\t\ty = position_grille[1]\n\t\t@board[x][y] = piece\n\t\t@coordinate = [x,y]\n\tend", "title": "" }, { "docid": "725fd064a07371904c15c87f9b063d66", "score": "0.5316316", "text": "def << new_cards\n if new_cards.is_a?(PokerHand)\n new_cards = new_cards.to_a\n elsif new_cards.is_a?(Card) || new_cards.is_a?(String)\n new_cards = [new_cards]\n end\n \n #debugger\n new_cards.each do |nc|\n unless @@allow_duplicates\n raise \"A card with the value #{nc} already exists in this hand. Set PokerHand.allow_duplicates to true if you want to be able to add a card more than once.\" if self =~ /#{nc}/\n end\n \n @hand << Card.new(nc)\n end\n end", "title": "" }, { "docid": "0784cde2e90ee7b93f11e39a8fce315b", "score": "0.53142035", "text": "def place_piece!(brd, crt_player)\n case crt_player\n when 'PLR'\n player_places_piece!(brd)\n when 'CPU'\n computer_places_piece!(brd)\n end\n end", "title": "" }, { "docid": "3b96dab1469f9b9f886b96417ae2ef8e", "score": "0.53087795", "text": "def push?\n (session[:player].hand_total == session[:dealer].hand_total) && !( !session[:player].blackjack? && session[:dealer].blackjack? )\n end", "title": "" } ]
1cbe3c089721f9c6fc92967449983a23
E: time = O(n), mem = O(1) Special case if alphabet <= 64 (for 64 bits systems), and alphabet is continuous
[ { "docid": "8d610d8feece5453196e881a46955ab5", "score": "0.0", "text": "def all_uniq_e?(str)\n bits = 0\n\n str.each_char do |c|\n bit = 2 ** (c.ord - 'a'.ord)\n\n if bits & bit == 1\n return false\n else\n bits |= bit\n end\n end\n\n true\nend", "title": "" } ]
[ { "docid": "eae14b764de7d7dbc97c41085560bcba", "score": "0.69608915", "text": "def fourth_anagram?(string,target)\n letters_hash = Hash.new(0)\n\n string.chars.each do |letter| # O(N)\n letters_hash[letter] += 1 # O(1)\n end\n p letters_hash\n target.chars.each do |letter| # O(N)\n letters_hash[letter] -= 1 # O(1)\n end\n p letters_hash\n letters_hash.values.all?{|v| v == 0}\nend", "title": "" }, { "docid": "c575ee99b23111b5a85fc99fd1a1584b", "score": "0.6924274", "text": "def find_alphabet(string)\n hash_table = {}\n alphabet = [*('a'..'z')]\n\n string.split('').each do |c|\n hash_table[c] = true\n end\n\n alphabet.each do |a|\n return a unless hash_table[a]\n end\n\n return\nend", "title": "" }, { "docid": "e6ea6e1b70d814887a3ad7fffb0407ba", "score": "0.67891836", "text": "def calculate_alphabet(str)\n ('X'..'Z').map { |n| str.count(n) }\nend", "title": "" }, { "docid": "3ba6953953490d73273c501bbbe6cd2e", "score": "0.67791444", "text": "def change a\nstore = Array.new(26){0}\n a.chars.map do |x|\n if x.chr.ord.between?(97, 122)\n store[x.chr.ord - 97] = 1\n elsif x.chr.ord.between?(65, 90)\n store[x.chr.ord - 65] = 1\n end\n end\nstore.join\nend", "title": "" }, { "docid": "ff14df3df514541b97c750884b683cb8", "score": "0.67751044", "text": "def getAlphabets(i)\n if (i<=26)\n return (i+97).chr #a is 97 according to ASCII table\n else \n return getAlphabets(i/26-1)+getAlphabets(i%26-1) #minus one to ensure it start from zero\n end\nend", "title": "" }, { "docid": "694b4028db435ab088988be4eb7d0025", "score": "0.67660224", "text": "def add_letters(a)\n v = 0\n alphabet = (\"a\"..\"z\").to_a\n if a.empty?\n z = \"z\"\n else\n a.each do |element|\n v += alphabet.index(element)+1\n end\n r,v = v.divmod(26)\n z = alphabet[v-1]\n end\n return z\nend", "title": "" }, { "docid": "28f0b78930d4b4298be9a6d2adb1ef04", "score": "0.6757793", "text": "def letters\n (\"AA\"..\"ZZ\").first(673).lazy.cycle \n end", "title": "" }, { "docid": "0dba642d6a22d400c30e61f87f3de901", "score": "0.67087084", "text": "def anagrams5(str1, str2)\r\n hash = Hash.new(0) \r\n str1.each_char {|char| hash[char] += 1} # O(n)\r\n str2.each_char {|char| hash[char] -= 1} # O(m)\r\n hash.all? {|k, v| v.zero? } # O(n) * O(1) => O(n)\r\nend", "title": "" }, { "docid": "c9938841be496ad86466e685dc6f5db6", "score": "0.6696579", "text": "def index_of_alphabet(num)\n # create hash for alphabets with corresponding value assuming only using capital letters\n alphabet_hash = Hash.new\n result = []\n (\"A\"..\"Z\").each_with_index do |letter, index|\n alphabet_hash[letter] = index+1\n end\n\n #return if one letter alphabet\n if num < 27\n puts alphabet_hash.key(num)\n return alphabet_hash.key(num)\n end\n\n x = num\n while x > 26\n tail = x%26\n x = x/26\n \n \n result << alphabet_hash.key(tail)\n result << alphabet_hash.key(x) if x < 26\n end\n puts \"#{result.reverse.join}\"\n result.reverse.join\nend", "title": "" }, { "docid": "e7efec5556c7281afac34b49b968ac18", "score": "0.66846377", "text": "def alpha()\n array = ('a'..'z').to_a\n alpha_pos = Hash.new(0)\n array.each_with_index do |letter, idx|\n alpha_pos[letter] = (idx + 1)\n end\n alpha_pos\nend", "title": "" }, { "docid": "e2bd377dba01eb47b527d2899a66959f", "score": "0.6670754", "text": "def calculate_alphabet(word)\n word.chars.sort.tally.values\nend", "title": "" }, { "docid": "fe7c788d185bdf3b0558977dce71f1fc", "score": "0.666625", "text": "def fourth_anagram?(string1, string2) #big O = O(n) time; space O(1) only 26 keys\n\n h = Hash.new(0)\n string1.each_char {|char| h[char] += 1 }\n string2.each_char {|char| h[char] -= 1 }\n\n h.values.all? {|ele| ele == 0} \n\nend", "title": "" }, { "docid": "2f229fd8b7201017fb771a79efcf99c8", "score": "0.66618484", "text": "def calculate_alphabet(str)\n str.each_char.tally\nend", "title": "" }, { "docid": "e303ba5676aa0d826cb713559fb2b516", "score": "0.66616446", "text": "def vigenere_cipher(str, arr)\n # get length of the arr to get how many keys are in a sequence\n # iterate through str characters using while loop that skips every length number of indexes\n # transform indexed characters by their changes\n output = \"\"\n alpha = (\"a\"..\"z\").to_a\n sequence_length = arr.length\n\n i = 0\n until output.length == str.length\n arr.each do |seq|\n idx = (alpha.index(str[i]) + seq) % 26\n output += alpha[idx]\n i += 1\n break if output.length == str.length\n end\n end\n\n output\nend", "title": "" }, { "docid": "8089bc94e14fe47441a097414449af19", "score": "0.6658026", "text": "def jumble_sort(str, alphabet = nil)\n alphabet ||= (\"a\"..\"z\").to_a\n hsh = Hash.new(0)\n str.each_char { |ch| hsh[ch] += 1 }\n result = \"\"\n alphabet.each do |ch|\n hsh[ch].times { result += ch }\n end\n result\nend", "title": "" }, { "docid": "9c1dafd59a47b7dd020dd280e012946e", "score": "0.6612172", "text": "def love_letter string\n count, arr = 0, string.chars\n alpha = ('a'..'z').to_a\n arr.each_with_index do |x,xi|\n while arr[xi] != arr[-(xi+1)]\n opp = arr[-(xi+1)]\n cur_let = [arr[xi], opp].max\n a_index = alpha.index(cur_let) - 1\n new_char = alpha[a_index]\n\n if opp > arr[xi]\n arr[-(xi+1)] = new_char\n count+=1\n else\n arr[xi] = new_char\n count +=1\n end\n end\n end\n count\nend", "title": "" }, { "docid": "f08da4db49b7e36acfe823b8fe18dae5", "score": "0.66116214", "text": "def anagram(s)\n temp = 0\n s.each_byte do |letter|\n temp ^= 1 << (letter - 97)\n end\n\n return true if temp == 0 || (temp & (temp-1)) == 0\n false\nend", "title": "" }, { "docid": "b5c05fc7c1211629871e9ef0601af36f", "score": "0.6595562", "text": "def vigenere_cipher(str, arr)\n alpha = (\"a\"..\"z\").to_a\n str.chars.each_with_index do |char, idx|\n key = arr[idx % arr.length]\n alpha_idx = alpha.index(char)\n new_char = alpha[(alpha_idx + key) % 26]\n str[idx] = new_char\n end\n str\nend", "title": "" }, { "docid": "090053f246ca0a9ed8bd34ae081b8cf4", "score": "0.6572057", "text": "def premutation_optimize? element1, element2\n if element1.length != element2.length\n return false\n end\n\n letters = Array.new(128, 0)\n\n for i in 1...(element1.length)\n temp = element1[i].ord\n letters[temp] += 1\n end\n\n for j in 1...(element2.length)\n c = element2[j].ord\n letters[c] -= 1\n\n if letters[c] < 0\n return false\n end\n end\n\n return true\nend", "title": "" }, { "docid": "202d0e43ecd659c51496abb032ee0cdf", "score": "0.6568117", "text": "def next_letter(str)\n a = ('a'..'z').to_a\n hash = a.zip(a.rotate(1)).to_h\n str.chars.map { |e| hash.keys.include?(e) ? hash[e] : e }.join\nend", "title": "" }, { "docid": "793762dd3f25a741e65f9943977ae67f", "score": "0.6547357", "text": "def love_letter string\n arr,count = string.chars,0\n alpha = ('a'..'z').to_a\n\n arr.each_with_index do |x,xi|\n while arr[xi] != arr[-(xi+1)]\n opposite = arr[-(xi+1)]\n cur_letter = [arr[xi], opposite].max\n a_index = alpha.index(cur_letter) -1\n new_char = alpha[a_index]\n\n if opposite > arr[xi]\n arr[-(xi+1)] = new_char\n count +=1\n else\n arr[xi] = new_char\n count +=1\n end\n end\n end\n count\n \nend", "title": "" }, { "docid": "d71d31cab92d4ea9b5ba1902a1ab445e", "score": "0.6540781", "text": "def non_unique_letters(string)\n hash = Hash.new(0)\n string.split('').each do |char|\n hash[char] += 1 if char.between?('a','z')\n end\n ret =[]\n hash.each { |k,v| ret << k if v > 1 }\n ret\nend", "title": "" }, { "docid": "049b316060565cf55dc2756d524e0651", "score": "0.65290165", "text": "def love_letter string\n arr = string.chars\n alpha = ('a'..'z').to_a\n count = 0\n\n arr.each_with_index do |x,xi|\n \n while arr[xi] != arr[-(xi+1)]\n opposite = arr[-(xi+1)]\n cur_letter = [arr[xi], opposite].max\n a_index = alpha.index(cur_letter)\n new_char = alpha[a_index-1]\n\n if opposite > arr[xi]\n arr[-(xi+1)] = new_char\n count +=1\n else\n arr[xi] = new_char\n count +=1\n end\n end\n end\n count\n \nend", "title": "" }, { "docid": "de8322da4e659c3c94e5bd585b52903b", "score": "0.652053", "text": "def fourth_anagram?(str1, str2) \n hash = Hash.new(0) #O(1)\n str1.each_char {|char| hash[char] += 1} #O(n)\n hash2 = Hash.new(0) #O(1)\n str2.each_char {|char| hash[char] += 1} #O(n)\n hash == hash2 #O(n)\n\nend", "title": "" }, { "docid": "c1314e09d8e6db17f56cc5b35be7a15d", "score": "0.65148014", "text": "def beautiful_string(str)\n chars = number_by_chars(str)\n\n sum = 0\n chars.sort_by{ |_k,v| -v }.each_with_index do |hash, i|\n sum += (26 - i) * hash.last\n end\n sum\nend", "title": "" }, { "docid": "0b16185424e69346626c95639a596695", "score": "0.6509604", "text": "def converter(n)\n letters_arr = *('a'..'z')\n return letters_arr[n-1] if n < 26\n indeces, ans, i = [], [], 0\n i+=1 while n > 26**i\n ((i-1).downto(0)).to_a.each do |j|\n index = n / 26**(j)\n indeces << index\n n -= 26**j*index\n end\n indeces.each { |index| ans << letters_arr[index-1] }\n ans.join\nend", "title": "" }, { "docid": "d04b483dac79c95a83ed28968c309e14", "score": "0.6498486", "text": "def include_every_alphabet?(word)\n for i in 0..word.length-1\n return false if (check_hash(word[i])==[])\n end\n return true\n end", "title": "" }, { "docid": "d64b721de1c8e75bdc592609cb79bef4", "score": "0.64967436", "text": "def the_next_alphabet(word)\n\nend", "title": "" }, { "docid": "29817ea216e19f343ed76ebf0ae57731", "score": "0.6495578", "text": "def frequent_letters(string)\r\n letters = Hash.new(0)\r\n string.each_char {|char| letters[char] += 1}\r\n frequentLetters = []\r\n letters.each {|key, val| if val > 2 then frequentLetters << key end}\r\n return frequentLetters\r\nend", "title": "" }, { "docid": "33d47564dbbb150399880e5ea65c33a6", "score": "0.6494941", "text": "def frequent_letters(str)\n hash = Hash.new(0)\n res_arr = []\n str.each_char{|char| hash[char] += 1}\n hash.each{|k, v| res_arr << k if v > 2}\n res_arr\nend", "title": "" }, { "docid": "fb7e48e30b694538d2364768a4501b09", "score": "0.6486079", "text": "def hashWord(word)\n word = word.downcase\n h = Array.new(26, 0)\n \n word.each_byte do |char|\n h[char.ord - 'a'.ord] += 1\n end\n return h\nend", "title": "" }, { "docid": "77d45b37e610e6e903940c0ab9cff8e1", "score": "0.6482692", "text": "def jumble_sort(str, alphabet = nil)\n new_string = String.new\n\n str_hash = Hash.new(0)\n str.chars.each { |l| str_hash[l] += 1}\n\n if alphabet.nil? == false\n alphabet.each do |dict_letter|\n if str_hash.keys.include?(dict_letter)\n str_hash[dict_letter].times { new_string += dict_letter }\n end\n end\n else\n interim_array = str.chars.sort\n new_string += interim_array.join(\"\")\n end\n\n new_string\nend", "title": "" }, { "docid": "6422afa03fca0560280469530624be79", "score": "0.6481924", "text": "def alphabet_hash\nhash = (('a'..'z').map.with_index.to_a).to_h\nend", "title": "" }, { "docid": "7f0bb30e278d835b8acf10eb6f38ed1e", "score": "0.6476752", "text": "def valid_anagram_ascii_array_single_loop?(s1, s2)\n ascii_array = []\n 180.times { ascii_array << 0 }\n return false if s1.length != s2.length\n s1.length.times do |i|\n ascii_array[s1[i].ord] += 1\n ascii_array[s2[i].ord] -= 1\n end\n ascii_array.each do |a|\n return false if a != 0\n end\n true\nend", "title": "" }, { "docid": "68de83126601b6f64acf51b1efb57fcc", "score": "0.64628714", "text": "def bonus_anagram?(str1,str2) #O(n)\n hash = Hash.new(0) #O(1)\n str1.each_char do |char1| #O(n) \n hash[char1] += 1 #O(1)\n end\n str2.each_char do |char2| #O(n)\n hash[char2] -= 1 #O(1)\n end\n hash.values.all?{|value| value == 0} #O(n)\nend", "title": "" }, { "docid": "d0777181b9e1d7378a9dbd56d05d1e7a", "score": "0.6460874", "text": "def fourth_anagram?(first_word, second_word) #O(n)\n letter_hash = Hash.new(0)\n first_word.each_char do |letter|\n letter_hash[letter] += 1\n end\n second_word.each_char do |letter|\n return false unless letter_hash.has_key?(letter) #optimization\n letter_hash[letter] -= 1\n return false if letter_hash[letter] < 0 #optimization\n end\n return true if letter_hash.values.all?{ |value| value == 0 }\n return false\nend", "title": "" }, { "docid": "ee346e5962e81766f22f37ff06ec4c94", "score": "0.64561", "text": "def alpha_position( array )\n\n hash_alphabets = {}\n # {0=>\"a\", 1=>\"b\", 2=>\"c\", 3=>\"d\", 4=>\"e\", 5=>\"f\", 6=>\"g\", 7=>\"h\", 8=>\"i\", 9=>\"j\", 10=>\"k\", 11=>\"l\", 12=>\"m\", 13=>\"n\", 14=>\"o\", 15=>\"p\", 16=>\"q\", 17=>\"r\", 18=>\"s\", 19=>\"t\", 20=>\"u\", 21=>\"v\", 22=>\"w\", 23=>\"x\", 24=>\"y\", 25=>\"z\"}\n\n i = 0\n while( i < 26 ) # 26 letters, a will be at index[zero]\n\n ascii = \"a\".ord + i\n\n hash_alphabets[i] = ascii.chr\n\n i += 1\n end # while\n\n # p hash_alphabets\n\n result = \"\"\n\n j = 0\n while( array.length > j )\n\n result += hash_alphabets[ array[j] ]\n\n j += 1\n end # while\n\n p \"Letter positions of #{array} from the alphabet correspond to: #{result}\"\n return result\n\nend", "title": "" }, { "docid": "4b8d833bae04bed509ea61f8e909bfe2", "score": "0.6453894", "text": "def repeated_chars(word)\n hasher = Hash.new(0)\n arr = []\n count = 0\n if arr.empty?\n arr\n end\n word.each_char do |letters|\n if word.include?(letters)\n hasher[letters]+=1\n arr << letters\n end\n end\n p arr.any? { |i| \n arr.uniq!\n }\n p hasher\nend", "title": "" }, { "docid": "6e031f6ba2ab58e017b8d0ed2887b161", "score": "0.6438285", "text": "def vigenere_cipher(word, arr)\n alpha = (\"a\"..\"z\").to_a\n i = 0\n while i<word.length\n j = 0\n while j<arr.length && i+j<word.length\n word[i+j] = alpha[(alpha.index(word[i+j])+arr[j])%26]\n j+=1\n end\n i += arr.length\n end\n word\nend", "title": "" }, { "docid": "2f06c9ae65561250183186cbaf699ad8", "score": "0.6438187", "text": "def folding_cipher(str)\n result = [];\n abc = ('a'..'z').to_a\n hash = {}\n (0..25).each do |n|\n hash[abc[n]] = n\n end\n split_str = str.split(\"\")\n split_str.each do |ltr|\n new_idx = 25 - hash[ltr]\n result.push(abc[new_idx])\n end\n result.join\n\nend", "title": "" }, { "docid": "3e1322059780495bd1c12ae36b1308cd", "score": "0.6435356", "text": "def first_non_repeating_letter(s)\r\n # Code go here\r\n letter = \"\"\r\n new_arr = []\r\n hash = Hash.new(0)\r\n s.each_char { |char| hash[char] += 1 }\r\n hash.each do |k, v|\r\n if v == 1\r\n new_arr << k\r\n end\r\n end\r\n return new_arr[0]\r\nend", "title": "" }, { "docid": "cabb0116758818e7950b7419ade95ebe", "score": "0.6433701", "text": "def frequent_letters(string)\n count_hash = Hash.new(0)\n string.each_char do |char|\n count_hash[char] += 1\n end\n # Now we have a hash with all the letters and how many times they showed up.\n alpha = (\"a\"..\"z\")\n frequent_arr = []\n count_hash.each_pair do |key, val|\n if val > 2 && alpha.include?(key.downcase)\n frequent_arr << key\n end\n end\n return frequent_arr\nend", "title": "" }, { "docid": "41503517aaa999cbcf3133740a91dfb4", "score": "0.6425615", "text": "def missing_letters(string)\n alphabet = Hash.new(0)\n ('a'..'z').each {|e| alphabet[e] = 0 }\n string.each_char { |c| alphabet[c] += 1 unless c == ' ' }\n arr = Array.new\n alphabet.each {|a, i| arr << a if i == 0}\n arr\nend", "title": "" }, { "docid": "fbbbf5b9587d96f26505d7787fcc5cde", "score": "0.6421372", "text": "def vigenere_cipher(str, key)\n alphabet = (\"a\"..\"z\").to_a\n new_str = \"\"\n\n str.each_char.with_index do |char, i|\n alpha_index = alphabet.index(char)\n num = key[i % key.length]\n \n new_alpha_index = (alpha_index + num) % alphabet.length\n new_char = alphabet[new_alpha_index]\n new_str += new_char\n end\n\n new_str\nend", "title": "" }, { "docid": "e88395955fe72d04658b3e1fbe9118bd", "score": "0.64210373", "text": "def non_unique_letters(str)\nend", "title": "" }, { "docid": "e88395955fe72d04658b3e1fbe9118bd", "score": "0.64210373", "text": "def non_unique_letters(str)\nend", "title": "" }, { "docid": "95208d2b7608e6e1b2734e6d55367815", "score": "0.6408125", "text": "def fourth_anagram?(str1, str2)\n hash = Hash.new(0)\n str1.each_char {|char| hash[char] += 1} #O(N)\n hash2 = Hash.new(0)\n str2.each_char {|char| hash2[char] += 1} #O(N)\n hash == hash2\nend", "title": "" }, { "docid": "2924e29fb3d981cc68312fb2e6f1f03d", "score": "0.64072526", "text": "def frequent_letters(string)\n count = Hash.new(0)\n string.each_char do |char|\n count[char] +=1\n end \n\n arrayL = []\n count.each do |ele,num|\n if num >2\n arrayL << ele\n end \n end \n return arrayL\nend", "title": "" }, { "docid": "62b474e2c01ed8b07c6f047f1d1f366f", "score": "0.64069474", "text": "def jumble_sort(str, alphabet = nil)\n if alphabet.nil?\n return str.split(\"\").sort.join(\"\")\n else\n new_hash = Hash.new(0)\n str.each_char { |l| new_hash[l] += 1 }\n\n new_string = \"\"\n alphabet.each do |l|\n if new_hash[l] > 0\n new_hash[l].times { new_string += l }\n end\n end\n\n return new_string\n end\nend", "title": "" }, { "docid": "b6328af5f0057ec5694c61def071b318", "score": "0.6405277", "text": "def isUniqueChar(str)\n bitarr = Array.new(26)\n i = 0\n while i < 26\n bitarr[i] = 0\n i += 1\n end\n size = str.size\n i = 0\n while i < size\n c = str[i].ord\n if 'A'.ord <= c and 'Z'.ord >= c\n c = (c - 'A'.ord )\n elsif 'a'.ord <= c and 'z'.ord >= c\n c = (c - 'a'.ord )\n else\n print \"Unknown Char!\\n\"\n return false\n end\n if bitarr[c] != 0\n print \"Duplicate detected!\\n\"\n return false\n end\n bitarr[c] += 1\n i += 1\n end\n print \"No duplicate detected!\\n\"\n return true\nend", "title": "" }, { "docid": "62efaf0799aede5d49118228bfe443aa", "score": "0.64044905", "text": "def jumble_sort(str, alphabet = nil)\n if alphabet == nil\n alphabet = (\"a\"..\"z\").to_a\n end\n\n result = []\n letter_frequency = Hash.new(0)\n new_alphabet_indices = {}\n\n str.split(\"\").each do |letter|\n letter_frequency[letter] += 1\n new_alphabet_indices[letter] = alphabet.find_index(letter)\n end\n\n new_order = new_alphabet_indices.sort_by { |_key, value| value }\n\n new_order.each do |sorted_value|\n letter_frequency[sorted_value[0]].times { result << sorted_value[0] }\n end\n result.join\n\nend", "title": "" }, { "docid": "20864dbd7da6efba4aaaabfe1a1ff787", "score": "0.6402302", "text": "def alphabetical_value(string)\n value = 0\n string.upcase!\n string.split(//).each do |char|\n value += char.ord - 64\n end\n return value\nend", "title": "" }, { "docid": "5e98e4711f4be0fc95af187b1e62b8b4", "score": "0.63996416", "text": "def vigenere_find_key_probable_key_length(alphabet, ary2)\n count = 0\n i = 0\n 0.upto(50) do |r|\n temp = ary2[0...ary2.length].chars.rotate(r).join\n #puts temp\n temp.each_char do |x|\n if x == ary2[i] && alphabet[x] != 0\n count +=1\n end\n i +=1\n end\n puts \"#{r} and #{count}\"\n count = 0\n i=0\n end\nend", "title": "" }, { "docid": "b247069438357a0bb185711d39a13f52", "score": "0.63972473", "text": "def add_letters(*letters)\n return 'z' if letters.size.zero?\n\n dict = {}\n sum = 0\n ('a'..'z').each_with_index { |char, idx| dict[char] = idx + 1 }\n letters.each { |char| sum += dict[char] }\n\n return dict.index(sum) if sum <= 26\n\n (sum % 26).zero? ? 'z' : dict.index(sum % 26)\nend", "title": "" }, { "docid": "9d19396319ea6eb1ee2cd70092d055ce", "score": "0.6393323", "text": "def alphabet_position(str)\n letter_score = {}\n position = 1\n ('a'..'z').to_a.each do |letter|\n letter_score[letter] = position.to_s\n position += 1\n end\n\n digits_str = []\n str.downcase.each_char do |character|\n next if letter_score.keys.include?(character) == false\n\n digits_str << letter_score[character]\n end\n digits_str.join(' ')\nend", "title": "" }, { "docid": "aa3c3d94c88a7a5dfa77f2fdd2878869", "score": "0.63834685", "text": "def high(string)\n letters =*(\"a\"..\"z\")\n hsh = letters.reduce({}) do |acc, char|\n acc[char] = char.bytes[0] - 96\n acc\n end\n\n result = []\n string.split(\" \").each do |str|\n val = str.split(\"\").reduce(0) do |sum, letter|\n sum += hsh[letter]\n sum\n end\n result << val\n end\n index = result.find_index(result.max)\n string.split(\" \")[index]\nend", "title": "" }, { "docid": "1f2913c554e3babafba0c11a2f15ad4e", "score": "0.6379", "text": "def find_anagrams arr, str\n result = []\n str = str.chars.sort.join # n + n log n + n\n arr.each do |s| # m\n s2 = s.chars.sort.join # n + n log n + n\n result << s if s2 == str\n end\n result\nend", "title": "" }, { "docid": "421814a254a250479a9ded8ae4e81471", "score": "0.6377285", "text": "def jumble_sort(str, alphabet = nil)\n result = ''\n alpha = ('a'..'z').to_a\n if alphabet\n str_n = str.chars.uniq\n alph -= str\n alphabet = (hello += alph)\n result = alphabet\n end\n\n alphabet\n\n\n\nend", "title": "" }, { "docid": "0f495c46864b6aa5859c43dd1c56687b", "score": "0.6374054", "text": "def fourth_anagram?(str1,str2) # O(n)\n\n hash1 = Hash.new(0) # O(1)\n hash2 = Hash.new(0) # O(1)\n\n str1.each_char { |char| hash1[char] += 1 } # O(n)\n str2.each_char { |char| hash2[char] += 1 } # O(n)\n\n hash1 == hash2 # O(n)\n\nend", "title": "" }, { "docid": "8cb31655fe1a5aa97a6bdf5eb08272a3", "score": "0.63706124", "text": "def decrypt(words)\n #break the words into indexs again \n #take index of alphabet then returning the letter before the alphabet\nindex = 0 \nalphabet = \"abcdefghijklmnopqrstuvwxyz\" \n\n while index < words.length \n alphabet.index(words[index]) - 1 \n \n until words[index] = alphabet[index]\n alphabet[index] += 1 \n end \n# print alphabet[location]\n# words[index] = alphabet[index] - 1 \n index += 1 \n end \n words \nend", "title": "" }, { "docid": "15a831b7873ec7fcd7639aa92453ae70", "score": "0.6369375", "text": "def anagram?(str1, str2) # 3 O(n + m)\n hash = Hash.new(0)\n str1.each_char { |char| hash[char] += 1 } # n \n str2.each_char { |char| hash[char] -= 1 } # m\n hash.values.all? { |val| val == 0 } # n + m in the worst case\nend", "title": "" }, { "docid": "0d74bc650ce2704672bfd511c723cb5f", "score": "0.63563365", "text": "def non_unique_letters(string)\n str = string.chars\n h = Hash.new(0)\n str.reject! { |o| o == ' '}\n str.each do |l|\n h[l] += 1\n end\n arr = Array.new\n h.each do |k, e|\n arr << k if e > 1\n end\n arr\nend", "title": "" }, { "docid": "06ca8d3e27d606f1737a272e83e4edf6", "score": "0.63484275", "text": "def remove_duplicate_letters(s)\n last_occurrences = (0...s.size).reduce({}) { |acc, i|\n acc[s[i]] = i\n acc\n }\n \n result = \"\"\n last = 0\n while last_occurrences.any?\n min_occurrence = last_occurrences.min { |x, y| x.last <=> y.last }\n min_char = ('z'.ord + 1).chr\n (last..min_occurrence.last).each { |i|\n if s[i] < min_char && last_occurrences[s[i]]\n last = i + 1\n min_char = s[i]\n end\n }\n \n last_occurrences.delete(min_char)\n result += min_char\n end\n \n result\nend", "title": "" }, { "docid": "48f744d1398c44272e9155b37607c0df", "score": "0.63471574", "text": "def frequent_letters(string)\n count = Hash.new(0)\n\n new_array = []\n string.each_char do |char|\n count[char] += 1\n end\n count.each do |char,num|\n if num > 2\n new_array << char\n end\n end\n new_array\nend", "title": "" }, { "docid": "8d51d28cde781818746d98c56019c38d", "score": "0.6341588", "text": "def alphabet_position(text)\n text.split('').reduce([]) {|accu, x| ((x =~ /[[:alpha:]]/) == 0) ? accu << (x.upcase.ord - 64) : accu }.join(' ')\n \n # #===== other sol 1:\n # text.gsub(/[^a-zA-Z]/, '').upcase.bytes.map {|x| x - 64 }.join(' ')\n\n # #===== other sol 2:\n # text.gsub(/[^a-z]/i, '').chars.map{ |c| c.downcase.ord - 96 }.join(' ')\nend", "title": "" }, { "docid": "183dc0fc190dffed2519aefa22c0efd1", "score": "0.63407123", "text": "def get_alphabet_hash\n alphabet = {}\n ('a'..'z').each do |c|\n alphabet[c] = true\n end\n alphabet\nend", "title": "" }, { "docid": "fd39b891fd9b3b4318cdf87edadbb032", "score": "0.63360745", "text": "def encode_word(word)\n total = 0\n alpha = ('a'..'z').to_a \n word.each_char { |char| total += alpha.index(char) + 1}\n total\nend", "title": "" }, { "docid": "e1d808ca97388e7aca43d9bcde185379", "score": "0.63345027", "text": "def non_unique_letters(string)\nend", "title": "" }, { "docid": "b0f06c99fe7ade579b1e80b433f616d7", "score": "0.63339186", "text": "def fourth_anagram?(str1, str2)\n letter_count1 = Hash.new(0)\n letter_count2 = Hash.new(0)\n\n str1.each_char { |char| letter_count1[char] += 1} \n str2.each_char { |char| letter_count2[char] += 1 }\n # Here, the intuitive answer to the space complexity is\n # O(n) because we're adding a separate key in the hash\n # for each character. But if the keys in the hash are single \n # characters, then how many different keys can we have? \n # How many different chars in the alphabet? A constant number \n # (26 + numbers and symbols for English alphabet).\n # It uses the \"best case\" here, because 26 numbers is\n # relatively small.\n\n letter_count1 == letter_count2\nend", "title": "" }, { "docid": "1b8d26de4645ad80bc14e4a31026d6f5", "score": "0.6333698", "text": "def anagrams4(str1, str2)\r\n hash1 = Hash.new(0) \r\n hash2 = Hash.new(0)\r\n str1.each_char {|char| hash1[char] += 1} # O(n)\r\n str2.each_char {|char| hash2[char] += 1} # O(m)\r\n hash1 == hash2\r\nend", "title": "" }, { "docid": "f45bac5722fdd1698fc119374176094d", "score": "0.63267475", "text": "def non_unique_letters(string)\n arr = []\n hash = Hash.new(0)\n string.each_char do |ch|\n hash[ch] += 1 \n end\n hash.each do |key, value|\n if key != \" \"\n if value >= 2\n arr << key\n end\n end\n end\n \n return arr\nend", "title": "" }, { "docid": "754407afe190e3692c801d4badeddcc4", "score": "0.6326201", "text": "def alphabet_position(str)\n array = ('a'..'z').to_a\n hash = {}\n result = []\n array.each_with_index do |char, idx|\n hash[char] = (idx + 1)\n end\n str.each_char do |char|\n if char =~ /\\w/\n result << \"#{hash[char.downcase]} \"\n else next\n end\n end\n result.join.rstrip\nend", "title": "" }, { "docid": "6a0f46a52a0e5c072310c218d4c9f5f5", "score": "0.6325973", "text": "def alphabet\n {\n 'a' => '.-',\n 'b' => '-...',\n 'c' => '-.-.',\n 'd' => '-..',\n 'e' => '.',\n 'f' => '..-.',\n 'g' => '--.',\n 'h' => '....',\n 'i' => '..',\n 'j' => '.---',\n 'k' => '-.-',\n 'l' => '.-..',\n 'm' => '--',\n 'n' => '-.',\n 'o' => '---',\n 'p' => '.--.',\n 'q' => '--.-',\n 'r' => '.-.',\n 's' => '...',\n 't' => '-',\n 'u' => '..-',\n 'v' => '...-',\n 'w' => '.--',\n 'x' => '-..-',\n 'y' => '-.--',\n 'z' => '--..',\n '1' => '.----',\n '2' => '..---',\n '3' => '...--',\n '4' => '....-',\n '5' => '.....',\n '6' => '-....',\n '7' => '--...',\n '8' => '---..',\n '9' => '----.',\n '0' => '-----',\n }\nend", "title": "" }, { "docid": "28c5c8f6b0311a6e2756eb1e781daddd", "score": "0.63247967", "text": "def second_anagram?(string1, string2) \n string1.each_char do |letter| #O(n)\n index = string2.index(letter) #O(n) Needs to iterate over string in order to find index hence O(n) \n if index != nil #O(1) \n string2 = string2[0...index] + string2[index+1..-1] #O(n)\n else \n return false\n end\n end \n return true \nend", "title": "" }, { "docid": "fcd85b64363e095c44b731a41da38879", "score": "0.63243526", "text": "def hashkey(str)\n str.each_char.map.inject(0){|res,c| res += c.downcase.ord * 13}\nend", "title": "" }, { "docid": "cf712605fa8f9aa81ce7ee549a1c1250", "score": "0.6322332", "text": "def caesar_guesser(encrypted_string, alphabet)\n return 'e' if encrypted_string.length == 1\n key = encrypted_string.chars.max_by { |x| encrypted_string.count(x) }\n shift = alphabet.index(key) - alphabet.index('e')\n res = \"\"\n encrypted_string.chars.each do |letter|\n letter_idx = alphabet.index(letter)\n new_idx = (letter_idx - shift) % 26\n res << alphabet[new_idx]\n end\n res\nend", "title": "" }, { "docid": "a08949d63e104cfe2f50bae6928ca7df", "score": "0.6321404", "text": "def missing_letters(phrase)\n result = []\n alphabet = Hash.new(0)\n ('a'..'z').each {|letter| alphabet[letter] = 0}\n phrase.each_char do |char|\n alphabet[char] += 1\n end\n alphabet.each {|key, value| result << key if value == 0}\n result\nend", "title": "" }, { "docid": "cd8bba0a89fb14d8ecede8463f5a6d7a", "score": "0.6320649", "text": "def create_alphabet\n return (\"A\"..\"Z\").to_a\nend", "title": "" }, { "docid": "0a644a37c0cf2f1eb064a789f529dd18", "score": "0.6316804", "text": "def NumberEncoding(str)\n alphabet = (\"a\"..\"z\").to_a\n\n result = []\n\n str.each_char do |i|\n if alphabet.include?(i)\n i = (alphabet.index(i) + 1)\n result << i\n else\n result << i\n end\n end\n\n result.join\nend", "title": "" }, { "docid": "d0e5b25dbe5e7e6588d174ecfe8c6dca", "score": "0.6312318", "text": "def letter_code(string)\n total = 0\n\n i = 0\n while i < string.length\n if (string[i]).to_i <= 26\n total += 1\n if (string[i] + string[i+1]).to_i <= 26\n total += 1\n end \n end\n i += 1\n end\n\n return total\nend", "title": "" }, { "docid": "b5b4d9e484325d52b81747615885ed13", "score": "0.63056225", "text": "def first_anagram?(str1, str2)\r\n # debugger\r\n chars = str1.split(\"\") #O(1)\r\n\r\n anagrams = chars.permutation.to_a.map { |sub| sub.join(\"\")} #O(n!)\r\n anagrams.include?(str2) # O(1)\r\n\r\nend", "title": "" }, { "docid": "d51b5e993d05e161914e05243f330e16", "score": "0.630503", "text": "def string_anagrams(str1, str2)\n return false if !str1 || !str2 || str1.length != str2.length\n ascii_array = Array.new(57, 0)\n str1.length.times do |i|\n ascii_array[str1[i].ord - 65] += 1\n ascii_array[str2[i].ord - 65] -= 1\n end\n 57.times { |i| return false if ascii_array[i] != 0 }\n return true\nend", "title": "" }, { "docid": "a9783bdac6f789c5a9951a048af187da", "score": "0.6301642", "text": "def get_alphabet(n)\n ('a'..'z').to_a[n] || n.to_s\n end", "title": "" }, { "docid": "81e3967af4b898b2442d5dca4d73f27f", "score": "0.6301374", "text": "def sherlockAndAnagrams(s)\n counter = Hash.new(0)\n (1..s.size).each do |length|\n s.chars.each_cons(length) do |sub_str| \n counter[sub_str.sort.join] += 1\n end\n end\n counter.values.map { |n| n * (n - 1) / 2 }.sum\nend", "title": "" }, { "docid": "db2d670bc779dac05e621cc759efcb11", "score": "0.63004845", "text": "def vigenere_cipher(str, keys)\n alpha = (\"a\"..\"z\").to_a\n new_str = \"\"\n str.each_char do |char|\n idx = (alpha.index(char) + keys[0]) % 26\n new_str += alpha[idx]\n ele = keys.shift\n keys.push(ele)\n end\n new_str\nend", "title": "" }, { "docid": "1a77a1141b9a8c9560e496d8fbab2cb8", "score": "0.62978876", "text": "def fourth_anagram?(anagram, margana) # O(n + n)\n a_hash = Hash.new(0)\n m_hash = Hash.new(0)\n\n anagram.chars.each do |char|\n a_hash[char] += 1\n end\n\n margana.chars.each do |char|\n m_hash[char] += 1\n end\n a_hash == m_hash\nend", "title": "" }, { "docid": "ed12568f1bc21c236ecde87f756577dc", "score": "0.6295435", "text": "def fourth_anagram(first, second) # time complexity O(n) | # space complexity O(1)\r\n hash = Hash.new { |h, k| h[k] = 0 }\r\n \r\n first.each_char do |c1|\r\n hash[c1] += 1\r\n end\r\n\r\n second.each_char do |c1|\r\n hash[c1] -= 1\r\n end\r\n\r\n hash.values.all? {|val| val == 0}\r\nend", "title": "" }, { "docid": "b7af89053dcc513215128a13d4dd231f", "score": "0.62914747", "text": "def bonus_anagram?(str1, str2) #O(n) | O(n)\n hash = Hash.new(0)\n\n str1.each_char do |char| \n hash[char] += 1 \n end\n\n str2.each_char do |char|\n hash[char] -= 1\n end\n\n hash.values.all? { |ele| ele == 0}\nend", "title": "" }, { "docid": "34faa913ef7337b5c4978e604498b9d4", "score": "0.62882113", "text": "def non_repeating_letter(string)\n letter = \"\"\n hash = {}\n string.each_char do |char|\n if hash[char]\n hash[char] += 1\n else\n hash[char] = 1\n end\n end\n hash.each do |k, v|\n if v === 1\n letter = k\n break\n end\n end\n return string.index(letter)\nend", "title": "" }, { "docid": "2906ffd1a200abf7bd874e1d223246a6", "score": "0.6287363", "text": "def valid_anagram_ascii_array?(s1, s2)\n ascii_array = []\n 180.times { ascii_array << 0 }\n s1.each_char do |c|\n ascii_array[c.ord] += 1\n end\n s2.each_char do |c|\n ascii_array[c.ord] -= 1\n end\n ascii_array.each do |a|\n return false if a != 0\n end\n true\nend", "title": "" }, { "docid": "9e908fbb21bca351b8069cb634b1e0e9", "score": "0.62841034", "text": "def anagrams(str1, str2)\nletters = Hash.new(0)\n\nstr1.split(\"\").each do |char|\n letters[char] += 1\nend\n\nstr2.split(\"\").each do |char|\n letters[char] -= 1\nend\n\nletters.all? {|_, v| v.zero? }\nend", "title": "" }, { "docid": "bbd98c6b45669761682b226bebde12b8", "score": "0.62813646", "text": "def lowers\n chars = [\"a\"]\n chars << chars.last.succ while chars.size < 26\n chars\n end", "title": "" }, { "docid": "bb2b0d7fde9992a7ff7fa76c3faee229", "score": "0.627899", "text": "def test_hash_char \n\t\tmem = Hash.new\n\t\thashed = hash_char('A', mem)\n\t\t\n\t\tx = 65\n\t\ttest = ((x ** 2000) * ((x + 2) ** 21) - ((x + 5) ** 3)) % 65536\n\t\tassert_equal test, hashed \n\tend", "title": "" }, { "docid": "8c5c6edd9ed338cf4c0e60e64b9e2563", "score": "0.6275259", "text": "def frequent_letters(string)\n count_hash = letter_count(string)\n frequent_arr = []\n count_hash.each do |key_char, val|\n if val > 2\n frequent_arr << key_char\n end\n end\n return frequent_arr\nend", "title": "" }, { "docid": "8e97234210a050a67b5bb8282799fd96", "score": "0.62744623", "text": "def repeating_letters?(str)\n (\"a\"..\"z\").any? { |ch| str.downcase.count(ch) > 1 } # O(N*M)?\n # str.uniq.length == str.length # NOTE: O(N) amortized?\nend", "title": "" }, { "docid": "ef6bdba9387b7e26bc5a87a8dd3d5c28", "score": "0.6268532", "text": "def all_unique_characters?(input)\n # Important: early return if the input is longer than 128/256 as it must have contain duplicates\n return false if input.size > 128\n\n # if hashmap is allowed\n # approach: iterate the string, have a hashmap / array to compare if a character has been seen.\n seen_characters = {}\n input.chars.each do |c| # iteration O(n)\n return false if seen_characters[c] # hash map lookup O(1)\n seen_characters[c] = 1\n end\n # runtime O(n), space O(n) for array and apparently hash is also O(n)?\n\n true\nend", "title": "" }, { "docid": "5a068d5b7989959eeea3ee5ba41f19c5", "score": "0.6264618", "text": "def frequent_letters(string)\n\tcharacters = []\n \tlettersCount = Hash.new(0)\n \n \tstring.each_char { |letter|\n \tlettersCount[letter] += 1\n \tif lettersCount[letter] > 2 && !characters.include?(letter)\n \tcharacters.push(letter)\n end\n }\n \treturn characters\nend", "title": "" }, { "docid": "e81da92e9db5d30fd36075a74220e576", "score": "0.6263981", "text": "def find_anagrams(str, anagram)\n res = []\n histo = Hash.new(0)\n temp_histo = Hash.new(0)\n len = anagram.length\n anagram.each_char {|char|histo[char] += 1}\n str.each_char.with_index do |char, index|\n temp_histo[char] += 1\n prev = str[index - len]\n if index >= len\n temp_histo[prev] -= 1\n temp_histo.delete(prev) if temp_histo[prev] == 0\n end\n res << (index - len + 1) if histo == temp_histo\n end\n res\nend", "title": "" }, { "docid": "52d146bfba0259c10d9d34f1d9b3aa14", "score": "0.6262837", "text": "def frequent_letters(string)\n arr = []\n counter = Hash.new(0)\n string.each_char do |char|\n counter[char] += 1\n end\n counter.each do |key, value|\n if value > 2\n arr << key\n end\n end\n return arr\nend", "title": "" }, { "docid": "297390ba05d92faf4186ef9481231099", "score": "0.62626606", "text": "def frequent_letters(string)\n counter = Hash.new(0)\n arr=[]\n string.each_char { |char| counter[char] += 1 }\n\n s = counter.sort_by { |k,v| v }\n s.each do |el|\n if el[1] > 2\n arr << el[0]\n end\n end\n return arr\nend", "title": "" }, { "docid": "a4c4594ac34e48a5f6204425bb1a329f", "score": "0.62607837", "text": "def alphabet\n ('A'..'Z').to_a\n end", "title": "" } ]
6d849009323e56429fc7b0bd31d43b6f
Return the selected photo with some extra data to render a preview quiclky from the grid.
[ { "docid": "1ba786289f1108fe0dee64e94c19ddfc", "score": "0.7048752", "text": "def selected_photo\n photo = current_photo\n\n photo.then do |photo|\n if photo\n # Scale the photo to fit into the window\n window_width = `$(window).width()`\n window_height = `$(window).height() - 100`\n\n width_ratio = window_width / photo.width.to_f\n height_ratio = window_height / photo.height.to_f\n\n scale_factor = [width_ratio, height_ratio].min\n\n width = (photo.width * scale_factor).round\n height = (photo.height * scale_factor).round\n\n preview_url = photo.file_url_largest_cached(width, height)\n url = photo.file_url_at_least(width, height)\n\n SelectedPhoto.new(width, height, url, preview_url, photo)\n end\n end\n end", "title": "" } ]
[ { "docid": "5793f4e0007b443f18013c524d43681d", "score": "0.72561806", "text": "def preview_photo\n photos.first\n end", "title": "" }, { "docid": "88c82cb38a6e5f6afb161ad3ce2303b1", "score": "0.649841", "text": "def show\n # @photo\n end", "title": "" }, { "docid": "dc6d121fd5e22cefc0bedbc3b3fc0840", "score": "0.64249605", "text": "def selected_image\n @selected_image || self.images[0]\n end", "title": "" }, { "docid": "61f7e9d0fb9eee20ef6b41ea32efbaaa", "score": "0.6424132", "text": "def choosephoto\n if self.photo.url\n photo.url(:standard)\n else\n gphoto\n end\n end", "title": "" }, { "docid": "49be31f6aa3d1e996d43ec5237081deb", "score": "0.63271385", "text": "def cur_image\n self\n end", "title": "" }, { "docid": "b9155eb9fccadbed9d4e6611c4f78a0d", "score": "0.61049116", "text": "def preview\n return @preview\n end", "title": "" }, { "docid": "36f39494483391c9f1530e712216ac34", "score": "0.6028033", "text": "def photo\n @attributes[:photo] ||= PublicEarth::Db::Photo.find_by_id(@attributes[:photo_id])\n end", "title": "" }, { "docid": "89f6c8197e3c6070dba3d6558c179045", "score": "0.6007806", "text": "def form_image_select(post)\n return image_tag post.image.url,\n id: 'image-preview',\n class: 'img-responsive'\n\n\nend", "title": "" }, { "docid": "81c8bea9c02b33773bf9273a1b83f6e7", "score": "0.60037863", "text": "def rep_image\n\t photos.first\n\tend", "title": "" }, { "docid": "33c187d3d93953b2f5e085630477f2b7", "score": "0.5995418", "text": "def show\n render(\n status: :ok,\n json: @photo.as_json(\n only: [:photo_id, :country, :state, :city, :landmark, :latitude, :longitude, :perspective, :user_id, :photo_url],\n )\n )\n end", "title": "" }, { "docid": "e3fa1efd678ba1ca822fe997da248bc7", "score": "0.5966004", "text": "def main_photo\n recipe_photos.first.try(:photo)\n end", "title": "" }, { "docid": "dbfac90b4233bb27b2800ba1f86eec88", "score": "0.59645486", "text": "def render_section_editor_selected_item_image(section, inline_css = false)\n image = section.editor_selected_or_top_rated(1).first\n\n if image\n path = image.large_public_filename\n if inline_css\n \"background: url(#{path_to_image(path)})\"\n else\n tag('img', :src => path_to_image(path), :atl => image.caption)\n end\n else\n nil\n end\n end", "title": "" }, { "docid": "294c6ba3117b3635b07d79a3224189af", "score": "0.59620684", "text": "def select_image\n compute.images.map { |i| [i.name, i.id] }\n end", "title": "" }, { "docid": "bc4e0bfc5351f8e265796d70fb5d2c8b", "score": "0.5958636", "text": "def cover\n photos.first\n end", "title": "" }, { "docid": "18672332cfc751a06a62391b2249c562", "score": "0.5932812", "text": "def photo\n Photo.find_by_id(self.profile_photo_id)\n end", "title": "" }, { "docid": "9d572314df25e743341a27f6d65e0d6d", "score": "0.5886807", "text": "def show\n @photo = @surrounding.photos.find(params[:id])\n end", "title": "" }, { "docid": "bc8e46af2af1032d27bcf40830b0ec36", "score": "0.588226", "text": "def photo_src\n self.photo.present? ? self.photo.picture_url : Prize::DEFAULT_IMG\n end", "title": "" }, { "docid": "36bd38c30726e9cbe49b7fab5f95e098", "score": "0.5869208", "text": "def photo( photo_id )\n Photo.find( photo_id, self )\n end", "title": "" }, { "docid": "25f93f20195d3fd35daedad7f5b0c09f", "score": "0.5841101", "text": "def preview\n end", "title": "" }, { "docid": "25f93f20195d3fd35daedad7f5b0c09f", "score": "0.5841101", "text": "def preview\n end", "title": "" }, { "docid": "f609eed537e09f620e650aa2fa8862ea", "score": "0.58223474", "text": "def cl_photo\n if photo?\n photo\n else\n 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSb0kZ2CA6D46RXZVJ3dvJPusC66fBq1uENE8jN3q8golJ73Ayd'\n end\n end", "title": "" }, { "docid": "55059d6d31df2c17125746a16f91a42d", "score": "0.581811", "text": "def main_preview_img_header_variant\n if realty.preview_img.attached?\n view_context.image_tag realty.preview_img.variant(resize: '750X484^').processed, class: 'img-responsive project_img_top box-shadow img-rounded'\n end\n end", "title": "" }, { "docid": "38f09cbdb52cf78000f02cd2068f2077", "score": "0.5817785", "text": "def edit_real_picture\n end", "title": "" }, { "docid": "f98303c0448c816bad3bc69db8bf1f99", "score": "0.5794754", "text": "def show\n render json: @sample_photo\n end", "title": "" }, { "docid": "bce733e790a5edc32ef5d631775a694d", "score": "0.5763681", "text": "def set_photo\n @gallery = Gallery.find params[:gallery_id]\n @photo = @gallery.photos.find params[:id]\n end", "title": "" }, { "docid": "a8f34e058226c814656ddb40b2d8ad34", "score": "0.5750329", "text": "def pic_preview_widget templateer, options={}\n page_url = templateer.url rescue nil\n img_url_display = templateer.picdata_with_fallback\n img_url_value = templateer.picurl\n entity_id = templateer.id\n input_id = pic_preview_input_id(templateer, :picurl) # \"recipe_picurl\"\n input_name = templateer.field_name(:picurl) # \"recipe[picurl]\"\n img_id = pic_preview_img_id(templateer)\n link_id = \"golink#{entity_id}\"\n pic_picker_link = pic_preview_golink page_url, img_url_value, link_id, img_id, input_id\n pic_preview =\n %Q{<img alt=\"Image Link is Broken\"\n id=\"#{img_id}\"\n src=\"#{img_url_display}\"\n style=\"width:100%; height: auto\">\n <input type=\"hidden\"\n id=\"#{input_id}\"\n name=\"#{input_name}\"\n rel=\"jpg,png,gif\"\n type=\"text\"\n value=\"#{img_url_value}\">\n }.html_safe\n content_tag( :div, pic_preview, :class => :pic_preview)+\n content_tag( :div, pic_picker_link, :class => :pic_picker_link)\n end", "title": "" }, { "docid": "a3cf34cbb64917ac210f1176808e632b", "score": "0.5744118", "text": "def get_selection_mode_next_pic(current_picture, something)\n next_pic = current_picture.next_pic_selection_mode\n \n if not next_pic.nil?\n destination_url = large_picture_preview_for_selection_url( next_pic)\n return create_galery_navigation_button( NEXT_BUTTON_TEXT, \"next\",destination_url )\n else\n \"\"\n end\n \n end", "title": "" }, { "docid": "980e91a536f00fd8653672b6d5c379c8", "score": "0.5738957", "text": "def profilepicture\n if portfolio\n portfolio.photo\n end\n end", "title": "" }, { "docid": "8e1568dd9a7fd0d46c9ec63bd7542d84", "score": "0.5737023", "text": "def form_image_select(post)\n return image_tag post.image.url(:medium),\n id: 'image-preview',\n class: 'img-responsive' if post.image.exists?\n image_tag 'placeholder.jpg', id: 'image-preview', class: 'img-responsive'\n end", "title": "" }, { "docid": "0f4906bba5ef190b3389f5e5df04ce23", "score": "0.5736642", "text": "def render_work_thumbnail(page)\n image_slider = page.find_elements(only: ['image_slider',\n 'image_gallery']).first\n\n if image_slider && image_slider.nested_elements.present?\n Alchemy::PictureView.new(\n image_slider.nested_elements.first.ingredients.first,\n { size: '170x170', crop: true },\n { class: 'dh-works-page-thumbnail' }\n ).render\n else\n image_tag('question_mark.png', alt: 'No preview found')\n end\n end", "title": "" }, { "docid": "6753f6712df1a195431c87bdb83b1e36", "score": "0.5715221", "text": "def thumbnail\n\t\t\t@data[\"thumbnail\"][\"source\"]\n\t\tend", "title": "" }, { "docid": "904ce3b952edfb8d8d8187df1d87213d", "score": "0.5713656", "text": "def thumb_title_photo\n title_photo\n end", "title": "" }, { "docid": "8c32e1896ccb5893a96a25300508f2c0", "score": "0.57123774", "text": "def show\n @photo = Photo.find(params[:id])\n end", "title": "" }, { "docid": "8c32e1896ccb5893a96a25300508f2c0", "score": "0.57123774", "text": "def show\n @photo = Photo.find(params[:id])\n end", "title": "" }, { "docid": "ed1d58289f636d6a46105c06600856c7", "score": "0.5707395", "text": "def show\n @greet = ['A magnificent submission', 'Love this photo? It was uploaded']\n @photo = Photo.find(params[:id])\n\n end", "title": "" }, { "docid": "d489fcfebfcf95e379a5ebd703bc2518", "score": "0.5696692", "text": "def show_preview(model_class, options = {}, &block)\n return unless params[:preview_id]\n previewed = model_class.find(params[:preview_id], options)\n return unless previewed\n locals = {:body=>capture(previewed, &block)}\n concat(render(:partial => \"shared/ubiquo/preview_box\", :locals => locals))\n end", "title": "" }, { "docid": "168f24e8d82d4978667f5482b3dd8652", "score": "0.5694948", "text": "def chosen_image(photo)\n if photo\n remote_file = nil\n open(photo[\"photo_link\"]) do |f|\n remote_file = Base64.encode64(f.read)\n end\n puts(\"\\x1b]1337;File=;inline=1:\" + remote_file + \"\\a\\n\")\n end\n end", "title": "" }, { "docid": "35603d5092a160b03d83f3e2af7e0f4c", "score": "0.5693177", "text": "def pic_preview_golink page_url, img_url, link_id, img_id, input_id\n queryparams = { picurl: img_url, golinkid: link_id }\n queryparams[:pageurl] = page_url if page_url\n button_to_submit page_url ? \"Pick Picture...\" : \"Get Picture from Web...\",\n pic_picker_new_path(queryparams),\n \"default\",\n \"small\",\n id: link_id,\n preload: true,\n :mode => :modal,\n class: \"pic_picker_golink\",\n data: { inputid: input_id, imageid: img_id }\n end", "title": "" }, { "docid": "7f6f19d160ab2818cd915b393420ba94", "score": "0.56920815", "text": "def load_photo_full_detail\n @picture = Picture.find(params[:id])\n render :partial=>\"photo_full_detail\", :locals=>{:pic=>@picture}\n end", "title": "" }, { "docid": "2701f29ba8936b9386332f013e9a816f", "score": "0.5665068", "text": "def main_photo\n photos.main_photos.first\n end", "title": "" }, { "docid": "a3a1a00e5594354dbd36027c7d8676f8", "score": "0.5659851", "text": "def show\n @main_image = @camp.images.first&.attachment&.url(:large)\n end", "title": "" }, { "docid": "fac7f51ec23d43fb538c07c158af0cdb", "score": "0.5657938", "text": "def image_column(record)\n image_tag url_for_file_column(record, 'image') if record.image\nend", "title": "" }, { "docid": "dcc7b4831e297905d10fad319b3ea013", "score": "0.56558263", "text": "def show()\n @photo = Photo.find(params[:id])\n end", "title": "" }, { "docid": "46213cf2ab40c04be9d1ec44dd366d4e", "score": "0.5650462", "text": "def preview_id\n @attributes[:preview_id]\n end", "title": "" }, { "docid": "79ef37fe1602fc574219fe8bda72d0bd", "score": "0.56459624", "text": "def main_image\n self.images.first.image\n end", "title": "" }, { "docid": "f7fd4bd03aed6481ce53af265589bfa4", "score": "0.5637671", "text": "def image\n self['image'] || self['image_src']\n end", "title": "" }, { "docid": "0560eb6db8d6148ac5e5a7edb4d4e23d", "score": "0.5624672", "text": "def show\n # Pull the selected photo album.\n @photo_tag = PhotoTag.find(params[:id])\n\n respond_to do |format|\n format.json do\n render json: @photo_tag\n end\n end\n end", "title": "" }, { "docid": "34a150bf2977306bd0601224d99f5444", "score": "0.5619549", "text": "def picdata\n object.imgdata\n end", "title": "" }, { "docid": "259208b7117f432ac5878e96bb7fd31d", "score": "0.5616155", "text": "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo.as_json(:methods => Photo::FIELDS) }\n end\n end", "title": "" }, { "docid": "2657ec7e75ec4d34fffa280f63ac49e7", "score": "0.56161356", "text": "def load_photo_full_detail\n @picture = Image.find(params[:id])\n render :partial=>\"discussion_groups/image_partials/photo_full_detail\", :locals=>{:pic=>@picture}\n end", "title": "" }, { "docid": "25bd3003201e6da2f8cdb9f197fab8c5", "score": "0.55970246", "text": "def choose_pic\n $testCaseID = \"VT229-0290\"\n Camera::choose_picture(url_for :action => :camera_callback)\n end", "title": "" }, { "docid": "22d30c3c2af1afa7b2fc2cfa624efce0", "score": "0.5592363", "text": "def make_primary\n photo = Photo.find(params[:photo_id])\n @venue.set_primary_photo(photo.id)\n render json: { images: gallery_images(@venue) }\n end", "title": "" }, { "docid": "85612cbe8e2d6d6a2f0c3ffa610ae8bc", "score": "0.55862004", "text": "def set_image_preview\n @image_preview = ImagePreview.find(params[:id])\n @image = @image_preview.image\n end", "title": "" }, { "docid": "d5c8634f805eb3d860b23708d2490185", "score": "0.5581754", "text": "def thumbnail\n thumbnails[3]\n end", "title": "" }, { "docid": "4c87f59041e53c6bab7d9c9a3229259f", "score": "0.55811185", "text": "def full_picture\n if self.photo.file != nil\n self.photo_url\n elsif self.picture\n self.picture\n else\n \"http://res.cloudinary.com/geertkeularts/image/upload/v1467110899/defaultpicture_jj0nwa.jpg\"\n end\n end", "title": "" }, { "docid": "77b8ee138d9ee2e33ca04cc414213057", "score": "0.55653095", "text": "def set_photo_detail\n @photo_detail = PhotoDetail.find(params[:id])\n end", "title": "" }, { "docid": "2279cbdcd94edfdca7e6e357c917f5fb", "score": "0.5565155", "text": "def show\n @photo = Photo.find_by_sql [\"SELECT id, name FROM photos WHERE id = ?\", params[:id]]\n# @photo = Photo.select(\"id, name\").where(params[:id])\n# @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @photo }\n end\n end", "title": "" }, { "docid": "c620bb6b4f097d27d92967d80febc3af", "score": "0.5561067", "text": "def show\n render json: @rock_photo\n end", "title": "" }, { "docid": "62ff5aae674e1782ec632f93e5140d03", "score": "0.5559768", "text": "def show\n respond_to do |format|\n format.html { @photo.generate unless @photo.exists? }\n format.jpg { render_preview(@photo) }\n end\n end", "title": "" }, { "docid": "522e7921a2b9a2ea9022086fdd16e0d6", "score": "0.55535424", "text": "def show\n\n #render plain: @myimage\n end", "title": "" }, { "docid": "d3173a15364852155c5ffac1eee1eb1b", "score": "0.5546482", "text": "def images\n @picturesandmeta = Pictureandmeta.all\n @kind = Kind.find(params[:kind_id])\n Rails.logger.info(\"Kind: #{@kind.inspect}\")\n end", "title": "" }, { "docid": "bd15980a63883287a4eef1ed55ebdbdf", "score": "0.55457604", "text": "def image\n images.first\n end", "title": "" }, { "docid": "bb03262da07a993e183b84faeef9b74f", "score": "0.5542825", "text": "def main_picture\n @main_picture ||= object.pictures.first\n end", "title": "" }, { "docid": "e0df09ef0108550be874d931b36779b8", "score": "0.5539333", "text": "def get_selection\n return [@tvpq.selection.selected[4].xlink]\n end", "title": "" }, { "docid": "a04f429802efcaa84a243b2b1868d1fe", "score": "0.5536486", "text": "def current_main_pictures # teaser \n self.pictures.where(:is_deleted => false,:is_feature_picture => false, :is_main_picture => true).order(\"name ASC\")\n end", "title": "" }, { "docid": "963afcf6f298d1f0423ceff0406b1088", "score": "0.55348986", "text": "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n # format.json { render json: @photos.map{|photo| photo.to_jq_image } }\n end\n end", "title": "" }, { "docid": "df06bd6d4ae884b5dee50daf19111cb9", "score": "0.55323875", "text": "def images_for_project\n if project = find_or_goto_index(Project, params[:id].to_s)\n query = create_query(:Image, :for_project, :project => project)\n show_selected_images(query, {:always_index => 1})\n end\n end", "title": "" }, { "docid": "70e0215dd7489f3f3b6028094513f9cb", "score": "0.5531597", "text": "def show\n # @photo = @gallery.photos.build\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gallery }\n end\n end", "title": "" }, { "docid": "cb83c05b74f0d611bde2c4b69f3a506a", "score": "0.55263036", "text": "def show\n @project_photo = ProjectPhoto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project_photo }\n end\n end", "title": "" }, { "docid": "1cf3d22fefd64f5d722d7aae9b173be1", "score": "0.55223334", "text": "def photos\n super.select { |p| p.unitID == unitID }\n end", "title": "" }, { "docid": "ee287196881113af7561474dc10cb169", "score": "0.5513046", "text": "def extract_thumbnails\n\t\t\t@small = @preview[\"small\"]\n\t\t\t@medium = @preview[\"medium\"]\n\t\t\t@large = @preview[\"large\"]\n\t\t\t@template = @preview[\"template\"]\n\t\tend", "title": "" }, { "docid": "3ee01c8c9976abf0a083382723f79d58", "score": "0.55122775", "text": "def photo_format; end", "title": "" }, { "docid": "d94327f555eedb69973961d04337a18c", "score": "0.55104023", "text": "def photo_fields\n @photos = []\n @q = if !params[:q].blank?\n params[:q]\n elsif taxon_id = params[:taxon_id]\n @taxon = Taxon.find_by_id(taxon_id)\n @taxon.name\n end\n \n per_page = params[:limit].to_i\n per_page = 36 if per_page.blank? || per_page.to_i > 36\n page = params[:page].to_i\n page = 1 if page == 0\n offset = per_page*(page-1)+(page-1)\n limit = if offset > per_page\n 75\n else\n per_page\n end\n\n @photos = EolPhoto.search_eol(@q, page: page, per_page: per_page, eol_page_id: params[:eol_page_id])\n \n partial = params[:partial].to_s\n partial = 'photo_list_form' unless %w(photo_list_form bootstrap_photo_list_form).include?(partial) \n respond_to do |format|\n format.html do\n render partial: \"photos/#{partial}\", locals: {\n photos: @photos, \n index: params[:index],\n local_photos: false\n }\n end\n format.json { render json: @photos }\n end\n end", "title": "" }, { "docid": "458595237ec169b32d248f03f520b843", "score": "0.55074495", "text": "def show\n @post = Post.find(params[:id])\n f= open(\"#{root_url}#{@post.image}\")\n @picture = EXIFR::JPEG.new(f)\n @latitude=convert_to_google(@picture.exif.to_hash[:gps_latitude],\n @picture.exif.to_hash[:gps_latitude_ref])\n @longitude=convert_to_google(@picture.exif.to_hash[:gps_longitude],\n @picture.exif.to_hash[:gps_longitude_ref])\n\n if geo = Geocoder.search(\"#{@latitude},#{@longitude}\").first\n @city = geo.city || \"\"\n @state = geo.state || \"\"\n @zipcode = geo.postal_code || \"\"\n end\n\n # and in the view : <% @picture.exif.to_hash.each do |key, value| %>\n end", "title": "" }, { "docid": "47e9746a0d7aa24dae93513b9ea87cdd", "score": "0.5504603", "text": "def preview=(value)\n @preview = value\n end", "title": "" }, { "docid": "bae8f3ad4aea2bbb3c63de9dc978e1bc", "score": "0.54942226", "text": "def show\n @kpictures = @kokuin.photos\n @kmatch = KokuinMatch.new\n # @kokuin.photos.build\n end", "title": "" }, { "docid": "251bdd4106305f000a98c44083c7bd72", "score": "0.5492723", "text": "def photo\n\t\ts = picture\n\t\treturn s if s.to_s != \"\"\n\t\t\n\t\t#i = image\n\t\treturn Artist.default_pic\n\t\t\n\t\tupdate_attribute(:picture, i)\n\t\tsave\n\t\treturn i\n\tend", "title": "" }, { "docid": "accffbdb58522bc0d6aa45ffb81b4eec", "score": "0.54895544", "text": "def set_photo\n Photo.find(params[:id])\n end", "title": "" }, { "docid": "cd34ebb85f2b97fd1eb47ba02604c17e", "score": "0.5488183", "text": "def selection_image_url\n images.first.file.try(:cdn_url)\n end", "title": "" }, { "docid": "7ceda248bd4988f75cb93315858d9ee6", "score": "0.5478216", "text": "def relative_path_to_selected_image\n relative_path_to(self.selected_image)\n end", "title": "" }, { "docid": "2aac5605e9a16506b2710c104eba3e8d", "score": "0.5476366", "text": "def main_variant_image(color_id)\n variants.main.where(color_id: color_id).first.main_photo&.image || Color.find(color_id).photo\n end", "title": "" }, { "docid": "d8992e2b67df8d97584c6049a716b193", "score": "0.54749167", "text": "def show\n @album_photo = AlbumPhoto.find_by(id: 3)\n end", "title": "" }, { "docid": "c4b9e155bb79f37e43fc2e756295d39c", "score": "0.54742414", "text": "def pictures_helper(plan_id)\r\n @plan = Plan.find(plan_id)\r\n @photo_info = @plan.flickr_photos_info(current_timezone)\r\n return render_to_string(:partial => 'pictures_async')\r\n end", "title": "" }, { "docid": "f9fdd950e6e7c18295d9560b512c7aa0", "score": "0.54699576", "text": "def show\n photo_obj = API.get_one(params[:id])\n if photo_obj['error'].nil?\n photo = PhotoPresenter.new(photo_obj['photo'])\n render :json => photo.as_json\n else\n render :json => photo_obj\n end\n end", "title": "" }, { "docid": "207003d7d67001c459baabf0e9d19e9c", "score": "0.5466265", "text": "def preview\n @preview ||= Preview.new(self) #if has_preview?\n end", "title": "" }, { "docid": "0154979e104612c9433a2b96c6262b5f", "score": "0.5459263", "text": "def get_preview\n get_filtered_dataset false, 10\n end", "title": "" }, { "docid": "07817aabec45396cc74761f7cbde0164", "score": "0.5455059", "text": "def preview\r\n\t\t\trender(\"option_#{self.id}_preview\")\r\n\t\tend", "title": "" }, { "docid": "d4f833c70ed0eaae8c99ed0f8eac5505", "score": "0.5450407", "text": "def picture_url\n picture.url(:featured_project)\n end", "title": "" }, { "docid": "017950b3d22d890dc4b25d730dd4a76b", "score": "0.54486156", "text": "def set_photo\n @possible_photos = get_possible_photos\n @photo = @possible_photos.find_by_id(params[:id])\n end", "title": "" }, { "docid": "3fdb9df5167305d3e5ef96bcf9e596c2", "score": "0.54424304", "text": "def current_preview\n RequestStore.store[:alchemy_current_preview]\n end", "title": "" }, { "docid": "1928a7352544d1574fedd116732a2a68", "score": "0.54401314", "text": "def image_library\n @title = \"Insert image\"\n # Only interested in images\n get_files(params.merge({:key => 'Image'}))\n render :layout => 'admin_modal'\n end", "title": "" }, { "docid": "bbb8bd85fc533e394910f8b1f09eb54a", "score": "0.5439004", "text": "def pic_field(form, pic_attribute, page_attribute=nil, options={})\n obj = form.object\n picurl = obj.send(pic_attribute)\n pageurl = page_attribute && obj.send(page_attribute)\n if home = options[:home]\n picurl = valid_url(picurl, home) unless picurl.blank?\n pageurl = valid_url(pageurl, home) if pageurl\n end\n input_id = pic_preview_input_id(obj, pic_attribute)\n img_id = pic_preview_img_id(obj)\n link_id = \"golink#{obj.id}\"\n pic_area = page_width_pic picurl, img_id, options[:fallback_img]\n preview = content_tag :div,\n pic_area+form.hidden_field(pic_attribute, rel: \"jpg,png,gif\", class: \"hidden_text\"),\n class: \"pic_preview\"\n preview << content_tag(:div,\n pic_preview_golink(pageurl, picurl, link_id, img_id, input_id),\n class: \"pic_picker_link\") unless options[:nopicker]\n preview\n end", "title": "" }, { "docid": "f1f670c1a0f31eec58b344c84d0bc78e", "score": "0.54357785", "text": "def tvPicture _args\n \"tvPicture _args;\" \n end", "title": "" }, { "docid": "509917b7a86378eb7ccaee2f749ff75c", "score": "0.54356146", "text": "def render_picture_gallery_editor(element, options={})\n default_options = {\n :maximum_amount_of_images => nil,\n :grouped => true\n }\n options = default_options.merge(options)\n render(\n :partial => \"alchemy/admin/elements/picture_gallery_editor\",\n :locals => {\n :pictures => element.contents.gallery_pictures,\n :element => element,\n :options => options\n }\n )\n end", "title": "" }, { "docid": "10fb7d11796c87bd1a02ab58944663cb", "score": "0.5433817", "text": "def photo(photo, options = {})\n get(\"photos/#{photo}\", options).pop\n end", "title": "" }, { "docid": "c859f05e0408d322ef6c93b4d00fb74d", "score": "0.54277146", "text": "def choose_existing\n Camera::choose_picture(url_for(:action => :choose_existing_callback))\n end", "title": "" }, { "docid": "c416d35e4b2c3e30f228764edcd62a0d", "score": "0.54127854", "text": "def show\n render json: @structure_photo\n end", "title": "" }, { "docid": "b57ba7391a8f78ef2c63d354c8e65743", "score": "0.5411646", "text": "def photo_url\n self.photo.url(:tile) # but now, self is the recipe\n end", "title": "" }, { "docid": "791a8a287b17dcf81b1ddd2fd4217668", "score": "0.5407258", "text": "def image\n end", "title": "" }, { "docid": "791a8a287b17dcf81b1ddd2fd4217668", "score": "0.5407258", "text": "def image\n end", "title": "" } ]
6515e9e9063863c4f7a83db0dd41de39
This method adds a method _reference_ (:whatever) to the hash defined above.
[ { "docid": "2cd3da9c1b468c08aa42496b555b2ed8", "score": "0.0", "text": "def register(hook, method)\n @hooks[hook].push method\n end", "title": "" } ]
[ { "docid": "d87c09bc61fa1aaab1633c36bbb62219", "score": "0.6904698", "text": "def method_reference; end", "title": "" }, { "docid": "ae7631590c91080dbc6af7a3ebf80fef", "score": "0.6839621", "text": "def method_reference=(_arg0); end", "title": "" }, { "docid": "7edb50c12b5ef8cf91dfe75ad5dfa068", "score": "0.6483031", "text": "def ref!\n grab_method[-1] = :ref\n end", "title": "" }, { "docid": "ecaa256d0398dcfd6ffc4037baa6e6de", "score": "0.6382567", "text": "def add_reference(reference_data, key: nil, ref: nil)\n reference = build_reference(reference_data, ref)\n specific_references = references[reference.ref] ||= {}\n\n specific_references[reference.stringified_reference] = reference\n\n # If we access an attribute of the value, using a :key, we want to keep a track of that\n attribute_references << key if key\n end", "title": "" }, { "docid": "2f3aff1f0cec8ff81c1ac61d458ccc7a", "score": "0.6370801", "text": "def define_hash_method\n module_eval <<-RUBY, __FILE__, __LINE__ + 1\n def hash\n self.class.hash ^ #{keys.map { |key| \"#{key}.hash\" }.join(' ^ ')}\n end\n RUBY\n end", "title": "" }, { "docid": "2f3aff1f0cec8ff81c1ac61d458ccc7a", "score": "0.6370801", "text": "def define_hash_method\n module_eval <<-RUBY, __FILE__, __LINE__ + 1\n def hash\n self.class.hash ^ #{keys.map { |key| \"#{key}.hash\" }.join(' ^ ')}\n end\n RUBY\n end", "title": "" }, { "docid": "20497c993040c3dc9b7e435815939ad4", "score": "0.62993056", "text": "def reference; end", "title": "" }, { "docid": "20497c993040c3dc9b7e435815939ad4", "score": "0.62993056", "text": "def reference; end", "title": "" }, { "docid": "20497c993040c3dc9b7e435815939ad4", "score": "0.62993056", "text": "def reference; end", "title": "" }, { "docid": "20497c993040c3dc9b7e435815939ad4", "score": "0.62993056", "text": "def reference; end", "title": "" }, { "docid": "20497c993040c3dc9b7e435815939ad4", "score": "0.62993056", "text": "def reference; end", "title": "" }, { "docid": "20497c993040c3dc9b7e435815939ad4", "score": "0.62993056", "text": "def reference; end", "title": "" }, { "docid": "20497c993040c3dc9b7e435815939ad4", "score": "0.62993056", "text": "def reference; end", "title": "" }, { "docid": "20497c993040c3dc9b7e435815939ad4", "score": "0.62993056", "text": "def reference; end", "title": "" }, { "docid": "20497c993040c3dc9b7e435815939ad4", "score": "0.62993056", "text": "def reference; end", "title": "" }, { "docid": "20497c993040c3dc9b7e435815939ad4", "score": "0.62993056", "text": "def reference; end", "title": "" }, { "docid": "20497c993040c3dc9b7e435815939ad4", "score": "0.62993056", "text": "def reference; end", "title": "" }, { "docid": "20497c993040c3dc9b7e435815939ad4", "score": "0.62993056", "text": "def reference; end", "title": "" }, { "docid": "20497c993040c3dc9b7e435815939ad4", "score": "0.62993056", "text": "def reference; end", "title": "" }, { "docid": "20497c993040c3dc9b7e435815939ad4", "score": "0.62993056", "text": "def reference; end", "title": "" }, { "docid": "afa07ec61322952a3eccc7bef78e2fa9", "score": "0.6186146", "text": "def hash\n super +\n @methods.hash\n end", "title": "" }, { "docid": "3c0c33f4b43a2567d6309b72290af440", "score": "0.61450136", "text": "def add_ref(ref)\n @refs << ref\n end", "title": "" }, { "docid": "a40916a6832c705d8cec663fc72048d4", "score": "0.61178696", "text": "def hash_for_delegation; end", "title": "" }, { "docid": "e2addb6c2894669c6b402474b1d3efce", "score": "0.6111439", "text": "def add(hash); end", "title": "" }, { "docid": "e2addb6c2894669c6b402474b1d3efce", "score": "0.6111439", "text": "def add(hash); end", "title": "" }, { "docid": "920aecd8ccb063c7b81b5967fb7816fe", "score": "0.6090143", "text": "def reference=(_arg0); end", "title": "" }, { "docid": "fee1a8d27597a9af7d35a32809c5a835", "score": "0.60830843", "text": "def def_hash_delegator(hash, method, key: T.unsafe(nil), **kwd); end", "title": "" }, { "docid": "2c3b256b7ae84e4c93d828560824e7d4", "score": "0.60274845", "text": "def define_hash_method\n keys = @keys\n define_method(:hash) do\n keys.map { |key| send(key) }.push(self.class).hash\n end\n end", "title": "" }, { "docid": "d4f411b2a327d0c5622d2b122db9f3d0", "score": "0.5991473", "text": "def def_hash_delegators(hash, *methods); end", "title": "" }, { "docid": "3d7806735d6ec58ec6b3ddf48af3f08e", "score": "0.59240204", "text": "def define_hash_method(immutable:); end", "title": "" }, { "docid": "8da1df1557234a543794e67af5ddb224", "score": "0.588903", "text": "def ref; end", "title": "" }, { "docid": "8da1df1557234a543794e67af5ddb224", "score": "0.588903", "text": "def ref; end", "title": "" }, { "docid": "8da1df1557234a543794e67af5ddb224", "score": "0.588903", "text": "def ref; end", "title": "" }, { "docid": "8da1df1557234a543794e67af5ddb224", "score": "0.588903", "text": "def ref; end", "title": "" }, { "docid": "8da1df1557234a543794e67af5ddb224", "score": "0.588903", "text": "def ref; end", "title": "" }, { "docid": "361ef41739f1cf754d99b174b23c34d5", "score": "0.5830231", "text": "def references; end", "title": "" }, { "docid": "361ef41739f1cf754d99b174b23c34d5", "score": "0.5830231", "text": "def references; end", "title": "" }, { "docid": "361ef41739f1cf754d99b174b23c34d5", "score": "0.5830231", "text": "def references; end", "title": "" }, { "docid": "361ef41739f1cf754d99b174b23c34d5", "score": "0.5830231", "text": "def references; end", "title": "" }, { "docid": "361ef41739f1cf754d99b174b23c34d5", "score": "0.5830231", "text": "def references; end", "title": "" }, { "docid": "1c85a57ab4d0a1d36d9f23a29e889954", "score": "0.5825056", "text": "def method_added(meth); end", "title": "" }, { "docid": "e15e705576fca106f32567e70ce70651", "score": "0.58145297", "text": "def add_function(hash_function)\n\t\t@hash_functions << hash_function\n\tend", "title": "" }, { "docid": "ae1a628dcfbcd0df0510d0ce3bf0cde6", "score": "0.5780046", "text": "def hash=(_arg0); end", "title": "" }, { "docid": "ae1a628dcfbcd0df0510d0ce3bf0cde6", "score": "0.5780046", "text": "def hash=(_arg0); end", "title": "" }, { "docid": "ae1a628dcfbcd0df0510d0ce3bf0cde6", "score": "0.5780046", "text": "def hash=(_arg0); end", "title": "" }, { "docid": "5cf71224319442dac8bc8dda1bdd0355", "score": "0.5761442", "text": "def delegate_hash; end", "title": "" }, { "docid": "5cf71224319442dac8bc8dda1bdd0355", "score": "0.5761442", "text": "def delegate_hash; end", "title": "" }, { "docid": "58dd202db316c0c29122e06f862fa587", "score": "0.5737059", "text": "def method_added(name); end", "title": "" }, { "docid": "48fd8169603625207d6b39a82730626d", "score": "0.57317096", "text": "def add_def_link(*); end", "title": "" }, { "docid": "0dee7db18c7b9c35bdec252121336cb8", "score": "0.57185864", "text": "def record_reference(name:, line: nil)\n refs[name] << line\n end", "title": "" }, { "docid": "2514cee2452cd9da9cd1eb827201ad27", "score": "0.57172596", "text": "def acts_as_lookup_add_shortcut(name)\n method_name = get_method_name(name)\n if respond_to?(method_name.to_sym)\n raise \"Cannot create method '#{method_name}' to #{self.inspect} \" +\n \"as it conflicts with existing method with same name\"\n end\n\n instance_eval \"def #{method_name}; self.lookup_by_name '#{name}'; end\"\n end", "title": "" }, { "docid": "e7e8979415bc9d6d84a4d0c55c69240c", "score": "0.5696798", "text": "def <<(reference_data)\n add_reference(reference_data)\n end", "title": "" }, { "docid": "29154843556467fba3562ce3d407e6a3", "score": "0.56875056", "text": "def store_key_references=(_arg0); end", "title": "" }, { "docid": "029ff3a0cad526664356a6b9239597d0", "score": "0.5685171", "text": "def reference_setters(*args)\n references = args.empty? ? reference_attrs : args\n\n references.each do |attribute|\n last_index = attribute.to_s.rindex('_ref')\n field_name = !last_index.nil? ? attribute.to_s.slice(0, last_index) : attribute\n method_name = \"#{field_name}_id=\".to_sym\n unless instance_methods(false).include?(method_name)\n method_definition = <<-METH\n def #{method_name}(id)\n self.#{attribute} = BaseReference.new(id)\n end\n METH\n class_eval(method_definition)\n end\n end\n end", "title": "" }, { "docid": "f6c1eae3b9260a9c19107cce358539c0", "score": "0.5683375", "text": "def set_reference_information(event, payload)\n if(event.empty?)\n event = 'push'\n end\n method_name = \"#{event}_reference\"\n if(self.respond_to?(method_name, true))\n ref, sha = send(method_name, payload)\n payload.set(:data, :code_fetcher, :info, :reference, ref)\n payload.set(:data, :code_fetcher, :info, :commit_sha, sha)\n end\n payload\n end", "title": "" }, { "docid": "18b7c223ee80c5dabc619b86a9b9c4c8", "score": "0.5680784", "text": "def tag_table_add(table, ref, body)\n if table.impl.key?(ref.tag)\n hashes = table.impl[ref.tag]\n if hashes.key?(ref.hash)\n hashes[ref.hash].tagrefs.push(ref)\n else\n hashes[ref.hash] = TagDef.new([ref], body)\n end\n else\n table.impl[ref.tag] = { ref.hash => TagDef.new([ref], body) }\n end\nend", "title": "" }, { "docid": "553d8fbce78fd8bbf9c32fd9b56631d6", "score": "0.56712526", "text": "def add_hash(hash) \n return add \"MagicFilter::#{clazz = hash[0]}\".to_class.new [*hash[1..-1]]\n end", "title": "" }, { "docid": "8ab51c716222ba919a944c2f6ed51e84", "score": "0.5657395", "text": "def add(def_name)\n end", "title": "" }, { "docid": "15ab111544bfee6d598c82c6a202f376", "score": "0.5628459", "text": "def hashfunc; end", "title": "" }, { "docid": "b95365387278eb0a4611a07daf379d5b", "score": "0.5623368", "text": "def add_backreference(obj)\n return unless supports_backreference?(obj)\n backreferences = obj.instance_variable_get(:@__weak_backreferences__) if obj.instance_variable_defined?(:@__weak_backreferences__)\n unless backreferences\n backreferences = []\n obj.instance_variable_set(:@__weak_backreferences__, backreferences)\n end\n backreferences << object_id\n end", "title": "" }, { "docid": "b5f3e991d0a1389fb4577ec37e089463", "score": "0.56117034", "text": "def pfadd(key, member); end", "title": "" }, { "docid": "b5f3e991d0a1389fb4577ec37e089463", "score": "0.56117034", "text": "def pfadd(key, member); end", "title": "" }, { "docid": "d54808c9683e2bd4f124d8d43470044e", "score": "0.5611613", "text": "def REF02=(arg)", "title": "" }, { "docid": "d9e3bc442f4b6f5b6e0a433cff3d03b7", "score": "0.56084746", "text": "def method_name\n METHOD_PREFIX + hash_key\n end", "title": "" }, { "docid": "fe90c4b8586a04f1e8c573978aa9e2f2", "score": "0.560297", "text": "def add_backreference(obj) #:nodoc:\n return unless supports_backreference?(obj)\n backreferences = obj.instance_variable_get(:@__weak_backreferences__) if obj.instance_variable_defined?(:@__weak_backreferences__)\n unless backreferences\n backreferences = []\n obj.instance_variable_set(:@__weak_backreferences__, backreferences)\n end\n backreferences << object_id\n end", "title": "" }, { "docid": "d0652d7bd73a46f87776691e55e84f73", "score": "0.5599388", "text": "def hash\n super +\n @name.hash\n end", "title": "" }, { "docid": "d166ef62a274c9323faab7e2deb52f09", "score": "0.5588004", "text": "def fp_add_method(sym, argument_names, code)\n\t\t@code_cache[sym] = \"#mixed into #{self.class.name}\\ndef #{sym}(#{argument_names})\\n#{code.rstrip}\\nend\"\n\t\tself.class.class_eval(@code_cache[sym])\n\tend", "title": "" }, { "docid": "025ea0334760a4ba8e3d3065c7245370", "score": "0.5585204", "text": "def rehash_static; end", "title": "" }, { "docid": "025ea0334760a4ba8e3d3065c7245370", "score": "0.5585204", "text": "def rehash_static; end", "title": "" }, { "docid": "c8c84931b3a9074bd343904d8ad2b2a0", "score": "0.5583262", "text": "def reference\n [ type, self.identifier ]\n end", "title": "" }, { "docid": "c8c84931b3a9074bd343904d8ad2b2a0", "score": "0.5583262", "text": "def reference\n [ type, self.identifier ]\n end", "title": "" }, { "docid": "15ddb7f36a370f74dad9cc4b4038f22e", "score": "0.55804104", "text": "def make_url(method, params) # :nodoc:\n set_hash params if method.to_s =~ /^add_/\n\n super method, params\n end", "title": "" }, { "docid": "aadf8e241680fc4adcf65f95c5a56753", "score": "0.5566174", "text": "def build_stringified_reference(hash, keys)\n ::InventoryRefresh::InventoryCollection::Reference.build_stringified_reference(hash, keys)\n end", "title": "" }, { "docid": "4c33c11e43a05ec129d793d8921f5247", "score": "0.55523473", "text": "def define_hash\n define_method(:hash) do\n klass = self.class\n attrs = klass.comparison_attrs\n ([klass] + attrs.map { |attr| send(attr) }).hash\n end\n end", "title": "" }, { "docid": "b24c8b53ed829bfbdecaef7f0350045a", "score": "0.5546879", "text": "def add_reference(table_name, *args)\n ReferenceDefinition.new(*args).add_to(update_table_definition(table_name, self))\n end", "title": "" }, { "docid": "54414707e9a12c137e197345a196d33c", "score": "0.55328983", "text": "def hash_args; end", "title": "" }, { "docid": "54414707e9a12c137e197345a196d33c", "score": "0.55328983", "text": "def hash_args; end", "title": "" }, { "docid": "54414707e9a12c137e197345a196d33c", "score": "0.55328983", "text": "def hash_args; end", "title": "" }, { "docid": "54414707e9a12c137e197345a196d33c", "score": "0.55328983", "text": "def hash_args; end", "title": "" }, { "docid": "54414707e9a12c137e197345a196d33c", "score": "0.55328983", "text": "def hash_args; end", "title": "" }, { "docid": "54414707e9a12c137e197345a196d33c", "score": "0.55328983", "text": "def hash_args; end", "title": "" }, { "docid": "b368b3e2bac7c47b8ad4bce9ff5a9c40", "score": "0.5530277", "text": "def __method__ => Symbol", "title": "" }, { "docid": "d9e6a255b2579fb62b9961756a2363fd", "score": "0.5529817", "text": "def REF03=(arg)", "title": "" }, { "docid": "b0f7c11e1858fe4ef5e998646815ba3c", "score": "0.552224", "text": "def ref(uri)\n assert empty? do\n 'Reference schemas cannot have other properties: ' +\n keys.join(', ')\n end\n @members['$ref'] = Json::URI.new(uri)\n freeze\n end", "title": "" }, { "docid": "3ef012112d5baa09f27aa7608666b788", "score": "0.5521873", "text": "def method_missing(m, *args, &b)\n if Geoblacklight::Constants::URI.key?(m)\n references m\n else\n super\n end\n end", "title": "" }, { "docid": "8f12636af332f9b25f4c8137ac5bf3be", "score": "0.5511503", "text": "def stash(method, new_name)\n metaclass.class_eval do\n if method_defined?(method) || private_method_defined?(method)\n alias_method new_name, method\n end\n end\n @@stash << new_name\n end", "title": "" }, { "docid": "b0b699c99ebacd0d08f77b6b1463bed1", "score": "0.55067873", "text": "def hash\n super +\n @assignment_method.hash +\n @ip.hash\n end", "title": "" }, { "docid": "b4fe8c95f18518537affacf0cefef99d", "score": "0.55058193", "text": "def define_as(hash)\n hash.each_pair do\n |method_name, value|\n\n define_method(method_name) do value end\n end\n end", "title": "" }, { "docid": "083ff9a07751eebc97363c080b6f2125", "score": "0.5505058", "text": "def references(*args)\n options = args.extract_options!\n args.each do |ref_name|\n @base.add_reference(name, ref_name, options)\n end\n end", "title": "" }, { "docid": "69521558ec34eea7b6c96390322f47b0", "score": "0.54876685", "text": "def attach_lookup_reference_callback name, options\n return if options[:inherit]\n \n set_callback :save, :before do\n maintain_lookup_reference(name)\n true\n end\n end", "title": "" }, { "docid": "e2153a0dd1f90054c73a6095bf171485", "score": "0.5487245", "text": "def hash\n super +\n @assignment_method.hash +\n @custom_value.hash\n end", "title": "" }, { "docid": "3faced73c9494180b495937adb62fa4e", "score": "0.54833585", "text": "def argument_references(argument); end", "title": "" }, { "docid": "8603bd8949aeb3a3319ce33790f4ac9f", "score": "0.5473246", "text": "def method_added name\n Peekaboo.wrap self, name, :instance if traced_instance_methods.include? name\n end", "title": "" }, { "docid": "1d45d450007a916cfd27dca9d74327b8", "score": "0.5467562", "text": "def store_key_references; end", "title": "" }, { "docid": "e525993ee4055fd2a64dabe8ce1728b7", "score": "0.5461242", "text": "def add_method(name,arguments,returns)\n @methods[name] = {\n :name => name,\n :arguments => parameterize(arguments),\n :return => returns\n }\n end", "title": "" }, { "docid": "fef21b70f03c82c594ebf42219bec155", "score": "0.54565036", "text": "def geoadd(key, *member); end", "title": "" }, { "docid": "1bcf85ebf130b9215ce28f58cb8d05ad", "score": "0.5449368", "text": "def REF01=(arg)", "title": "" }, { "docid": "4438e5828acc31d603d2f2325a4c7ee3", "score": "0.5438583", "text": "def resolve_reference; end", "title": "" }, { "docid": "0272362e03a4b1853837ef98e13e476f", "score": "0.5435773", "text": "def ref_key(hash)\n\t\t\t(REF_PROPERTIES.collect { |k| hash[k] } ).to_json\n\t\tend", "title": "" }, { "docid": "b68eec72fcec94d491d1f593d77f6ef2", "score": "0.54324895", "text": "def ajouterRef(id)\r\n\t\t@reference = id\r\n\tend", "title": "" }, { "docid": "4053bf122fb100e23b5ae291bcfa9892", "score": "0.54282635", "text": "def resolve_ruby_references(shapshot)\n end", "title": "" } ]
6451a89c6d4a12fcb16e4c31861ad3fb
lexer rule whitespace! (WHITESPACE) (in Pohua.g)
[ { "docid": "e1b04cb11cf2ec8047ca3786836853c0", "score": "0.79073405", "text": "def whitespace!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 7 )\n\n type = WHITESPACE\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 30:15: ( ' ' | '\\\\t' | '\\\\r' | '\\\\n' )\n if @input.peek( 1 ).between?( 0x9, 0xa ) || @input.peek(1) == 0xd || @input.peek(1) == 0x20\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n # --> action\n channel=HIDDEN;\n # <-- action\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 7 )\n\n end", "title": "" } ]
[ { "docid": "a2754ca666a5b8c8fc4ecc35a388bb74", "score": "0.7828548", "text": "def whitespace!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 50 )\n\n\n\n type = WHITESPACE\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 137:13: ( '\\\\t' | '\\\\f' | ' ' | '\\\\u00A0' )+\n # at file 137:13: ( '\\\\t' | '\\\\f' | ' ' | '\\\\u00A0' )+\n match_count_9 = 0\n while true\n alt_9 = 2\n look_9_0 = @input.peek( 1 )\n\n if ( look_9_0 == 0x9 || look_9_0 == 0xc || look_9_0 == 0x20 || look_9_0 == 0xa0 )\n alt_9 = 1\n\n end\n case alt_9\n when 1\n # at line \n if @input.peek(1) == 0x9 || @input.peek(1) == 0xc || @input.peek(1) == 0x20 || @input.peek(1) == 0xa0\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n\n end\n\n\n\n else\n match_count_9 > 0 and break\n eee = EarlyExit(9)\n\n\n raise eee\n end\n match_count_9 += 1\n end\n\n\n\n # --> action\n channel = HIDDEN \n # <-- action\n\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 50 )\n\n\n end", "title": "" }, { "docid": "e1385879bb5a82ce413e6a75d6ec89ba", "score": "0.76911885", "text": "def whitespace!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 14 )\n\n type = WHITESPACE\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 111:14: ( '\\\\t' | ' ' | '\\\\r' | '\\\\n' | '\\\\u000C' )+\n # at file 111:14: ( '\\\\t' | ' ' | '\\\\r' | '\\\\n' | '\\\\u000C' )+\n match_count_2 = 0\n while true\n alt_2 = 2\n look_2_0 = @input.peek( 1 )\n\n if ( look_2_0.between?( 0x9, 0xa ) || look_2_0.between?( 0xc, 0xd ) || look_2_0 == 0x20 )\n alt_2 = 1\n\n end\n case alt_2\n when 1\n # at line \n if @input.peek( 1 ).between?( 0x9, 0xa ) || @input.peek( 1 ).between?( 0xc, 0xd ) || @input.peek(1) == 0x20\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n\n else\n match_count_2 > 0 and break\n eee = EarlyExit(2)\n\n\n raise eee\n end\n match_count_2 += 1\n end\n\n # --> action\n channel = HIDDEN; \n # <-- action\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 14 )\n\n end", "title": "" }, { "docid": "33742481f32a2b6e48b04a049c1c3186", "score": "0.7667224", "text": "def parse_whitespace\n gotit = false\n\n while @lexer.get and @lexer.get.type == :whitespace\n @lexer.next!\n gotit = true\n end\n\n gotit\n end", "title": "" }, { "docid": "b9cebaeb962653b998f7f58f6d333b46", "score": "0.7397414", "text": "def space!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 8 )\n\n \n # - - - - main rule block - - - -\n # at line 88:5: ( ' ' | '\\\\t' )+\n # at file 88:5: ( ' ' | '\\\\t' )+\n match_count_12 = 0\n while true\n alt_12 = 2\n look_12_0 = @input.peek( 1 )\n\n if ( look_12_0 == 0x9 || look_12_0 == 0x20 )\n alt_12 = 1\n\n end\n case alt_12\n when 1\n # at line \n if @input.peek(1) == 0x9 || @input.peek(1) == 0x20\n @input.consume\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n\n else\n match_count_12 > 0 and break\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n eee = EarlyExit(12)\n\n\n raise eee\n end\n match_count_12 += 1\n end\n\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 8 )\n\n end", "title": "" }, { "docid": "70cd66fd13a0954ec32f472db146822d", "score": "0.7206604", "text": "def eat_whitespace(input)\n if parser.whitespace.is_a?(Regexp)\n # Eat whitespace before a non-terminal\n input.skip(parser.whitespace)\n elsif parser.whitespace.is_a?(Rule)\n parser.whitespace.parse(input) # throw away result\n end\n end", "title": "" }, { "docid": "7b67869f7e3b494bf5ed801ab873fc3d", "score": "0.70867586", "text": "def ws!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 9 )\n\n \n # - - - - main rule block - - - -\n # at line 93:5: ( ' ' | '\\\\t' | '\\\\n' )+\n # at file 93:5: ( ' ' | '\\\\t' | '\\\\n' )+\n match_count_13 = 0\n while true\n alt_13 = 2\n look_13_0 = @input.peek( 1 )\n\n if ( look_13_0.between?( 0x9, 0xa ) || look_13_0 == 0x20 )\n alt_13 = 1\n\n end\n case alt_13\n when 1\n # at line \n if @input.peek( 1 ).between?( 0x9, 0xa ) || @input.peek(1) == 0x20\n @input.consume\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n\n else\n match_count_13 > 0 and break\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n eee = EarlyExit(13)\n\n\n raise eee\n end\n match_count_13 += 1\n end\n\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 9 )\n\n end", "title": "" }, { "docid": "d9cba3e4510c395f802d1c82aa233695", "score": "0.7077545", "text": "def ws!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 32)\n\n type = WS\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 378:5: ( ' ' )+\n # at file 378:5: ( ' ' )+\n match_count_13 = 0\n loop do\n alt_13 = 2\n look_13_0 = @input.peek(1)\n\n if (look_13_0 == ?\\s) \n alt_13 = 1\n\n end\n case alt_13\n when 1\n # at line 378:6: ' '\n match(?\\s)\n\n else\n match_count_13 > 0 and break\n eee = EarlyExit(13)\n\n\n raise eee\n end\n match_count_13 += 1\n end\n\n # --> action\n skip()\n # <-- action\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 32)\n\n end", "title": "" }, { "docid": "f258bcb07e2335b6faa0a578dd81ea3b", "score": "0.70566505", "text": "def _whitespace\n _tmp = scan(/\\A(?-mix:([ \\t\\r\\n]*))/)\n set_failed_rule :_whitespace unless _tmp\n return _tmp\n end", "title": "" }, { "docid": "6c582052be347749571fc61c29471aac", "score": "0.69284767", "text": "def ws!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 5 )\n\n type = WS\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 6:6: ( ' ' | '\\\\t' | '\\\\r' | '\\\\n' )\n if @input.peek( 1 ).between?( 0x9, 0xa ) || @input.peek(1) == 0xd || @input.peek(1) == 0x20\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n # --> action\n skip \n # <-- action\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 5 )\n\n end", "title": "" }, { "docid": "c3f9854f6ba066d100a171bd9d5b1c31", "score": "0.689042", "text": "def next_token_ignoring_whitespace\n t = @tokens.next\n while Tokens.ignore_whitespace?(t)\n t = @tokens.next\n end\n t\n end", "title": "" }, { "docid": "cf5a22a093ff06ddbfec99931a5718fd", "score": "0.68364775", "text": "def whitespace=(_); end", "title": "" }, { "docid": "06abd9f23fe67d39340c02b9dc1f97c6", "score": "0.6792271", "text": "def test_whitespace_can_be_implicitly_ignored\n result = @parser.interpret(\"hello [world]\")\n assert result.match(\"hello\")\n assert result.match(\"hello world\")\n assert ! result.match(\"helloworld\")\n end", "title": "" }, { "docid": "c3c55dc49ed5c3ea3c32bf08516c5474", "score": "0.6766605", "text": "def ws!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 61 )\n\n type = WS\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 598:6: ( ' ' | '\\\\t' | ( '\\\\r' )? '\\\\n' )+\n # at file 598:6: ( ' ' | '\\\\t' | ( '\\\\r' )? '\\\\n' )+\n match_count_19 = 0\n while true\n alt_19 = 4\n case look_19 = @input.peek( 1 )\n when 0x20 then alt_19 = 1\n when 0x9 then alt_19 = 2\n when 0xa, 0xd then alt_19 = 3\n end\n case alt_19\n when 1\n # at line 598:8: ' '\n match( 0x20 )\n\n when 2\n # at line 599:5: '\\\\t'\n match( 0x9 )\n\n when 3\n # at line 600:5: ( '\\\\r' )? '\\\\n'\n # at line 600:5: ( '\\\\r' )?\n alt_18 = 2\n look_18_0 = @input.peek( 1 )\n\n if ( look_18_0 == 0xd )\n alt_18 = 1\n end\n case alt_18\n when 1\n # at line 600:5: '\\\\r'\n match( 0xd )\n\n end\n match( 0xa )\n\n else\n match_count_19 > 0 and break\n eee = EarlyExit(19)\n\n\n raise eee\n end\n match_count_19 += 1\n end\n\n # --> action\n channel=HIDDEN\n # <-- action\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 61 )\n\n end", "title": "" }, { "docid": "96091d679c8d6cda8dadb06ab46562b1", "score": "0.676539", "text": "def eat_whitespace\n h=@head\n @head+=1 while input=~/\\A\\s/\n h!=@head\n end", "title": "" }, { "docid": "65e505eecc296d7864c6abde12de3a1f", "score": "0.67579526", "text": "def ws!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 13 )\n\n type = WS\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 131:6: ( ' ' | '\\\\r' | '\\\\t' | '\\\\n' )\n if @input.peek( 1 ).between?( 0x9, 0xa ) || @input.peek(1) == 0xd || @input.peek(1) == 0x20\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n # --> action\n channel=HIDDEN;\n # <-- action\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 13 )\n\n end", "title": "" }, { "docid": "c62decd39fd900ccd713beb2f1a52189", "score": "0.673746", "text": "def whitespace; end", "title": "" }, { "docid": "558ea763bb31ecfe78822be54c86192c", "score": "0.6735575", "text": "def ws!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 21 )\n\n type = WS\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 86:9: ( ' ' | '\\\\t' | '\\\\r' | '\\\\n' )\n if @input.peek( 1 ).between?( 0x9, 0xa ) || @input.peek(1) == 0xd || @input.peek(1) == 0x20\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n # --> action\n channel=HIDDEN;\n # <-- action\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 21 )\n\n end", "title": "" }, { "docid": "407f9d2c22d7f8b7a5c1b7fdd253fb72", "score": "0.6730838", "text": "def _Whitespace\n\n begin # choice\n _tmp = apply(:_Spacechar)\n break if _tmp\n _tmp = apply(:_Newline)\n end while false # end choice\n\n set_failed_rule :_Whitespace unless _tmp\n return _tmp\n end", "title": "" }, { "docid": "f03496adb86b4ebb64a2284ca51f30a2", "score": "0.6724853", "text": "def ws!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 3)\n\n type = WS\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 23:5: ( ' ' | '\\\\t' )+\n # at file 23:5: ( ' ' | '\\\\t' )+\n match_count_5 = 0\n while true\n alt_5 = 2\n look_5_0 = @input.peek(1)\n\n if (look_5_0 == ?\\t || look_5_0 == ?\\s) \n alt_5 = 1\n\n end\n case alt_5\n when 1\n # at line \n if @input.peek(1) == ?\\t || @input.peek(1) == ?\\s\n @input.consume\n else\n mse = MismatchedSet(nil)\n recover(mse)\n raise mse\n end\n\n\n\n else\n match_count_5 > 0 and break\n eee = EarlyExit(5)\n\n\n raise eee\n end\n match_count_5 += 1\n end\n\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 3)\n\n end", "title": "" }, { "docid": "e7902d4a293a584b674e59e4d34d1f20", "score": "0.671421", "text": "def ws!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 94)\n\n type = WS\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 529:8: ( ' ' | '\\\\r' | '\\\\t' | '\\\\u000C' | '\\\\n' )\n if @input.peek(1).between?(?\\t, ?\\n) || @input.peek(1).between?(?\\f, ?\\r) || @input.peek(1) == ?\\s\n @input.consume\n else\n mse = MismatchedSet(nil)\n recover(mse)\n raise mse\n end\n\n\n # --> action\n channel=HIDDEN;\n # <-- action\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 94)\n\n end", "title": "" }, { "docid": "948f5002b57470c02a57e88067d3fa1b", "score": "0.67044103", "text": "def ws!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 44 )\n\n type = WS\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 72:6: ( ' ' | '\\\\t' | '\\\\r' | '\\\\n' )\n if @input.peek( 1 ).between?( 0x9, 0xa ) || @input.peek(1) == 0xd || @input.peek(1) == 0x20\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n # --> action\n channel=HIDDEN;\n # <-- action\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 44 )\n\n end", "title": "" }, { "docid": "3d66ce1845753a04e26d90daad0b082c", "score": "0.6703793", "text": "def ws!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 39 )\n\n type = WS\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 408:9: ( ' ' | '\\\\t' | '\\\\r' | '\\\\n' )\n if @input.peek( 1 ).between?( 0x9, 0xa ) || @input.peek(1) == 0xd || @input.peek(1) == 0x20\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n # --> action\n channel=HIDDEN;\n # <-- action\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 39 )\n\n end", "title": "" }, { "docid": "b322bf3979c6cb1ad2acbfcce838ffdb", "score": "0.6696719", "text": "def ws!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 42 )\n\n type = WS\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 1069:9: ( ' ' | '\\\\t' | '\\\\r' | '\\\\n' )\n if @input.peek( 1 ).between?( 0x9, 0xa ) || @input.peek(1) == 0xd || @input.peek(1) == 0x20\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n # --> action\n channel=HIDDEN;\n # <-- action\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 42 )\n\n end", "title": "" }, { "docid": "15582dfd60b5bdfd0a8d04499bc0048e", "score": "0.6683194", "text": "def accept_spaces; end", "title": "" }, { "docid": "15582dfd60b5bdfd0a8d04499bc0048e", "score": "0.6683194", "text": "def accept_spaces; end", "title": "" }, { "docid": "06bf9c06b75d37d3267795da35ad43f9", "score": "0.66752726", "text": "def whitespace?(tok = T.unsafe(nil)); end", "title": "" }, { "docid": "df2de259634f9479d58f5b6446bd0ed9", "score": "0.66672784", "text": "def ws!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 8 )\n\n type = WS\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 174:5: ( ' ' | '\\\\t' | '\\\\n' )+\n # at file 174:5: ( ' ' | '\\\\t' | '\\\\n' )+\n match_count_16 = 0\n while true\n alt_16 = 2\n look_16_0 = @input.peek( 1 )\n\n if ( look_16_0.between?( 0x9, 0xa ) || look_16_0 == 0x20 )\n alt_16 = 1\n\n end\n case alt_16\n when 1\n # at line \n if @input.peek( 1 ).between?( 0x9, 0xa ) || @input.peek(1) == 0x20\n @input.consume\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n\n else\n match_count_16 > 0 and break\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n eee = EarlyExit(16)\n\n\n raise eee\n end\n match_count_16 += 1\n end\n\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 8 )\n\n end", "title": "" }, { "docid": "9296495175e62b761dd2d19013235a7e", "score": "0.6662115", "text": "def ws!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 119 )\n\n\n\n type = WS\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 279:9: ( ' ' | '\\\\r' '\\\\n' | '\\\\n' | '\\\\t' )\n # at line 279:9: ( ' ' | '\\\\r' '\\\\n' | '\\\\n' | '\\\\t' )\n alt_5 = 4\n case look_5 = @input.peek( 1 )\n when 0x20 then alt_5 = 1\n when 0xd then alt_5 = 2\n when 0xa then alt_5 = 3\n when 0x9 then alt_5 = 4\n else\n raise NoViableAlternative( \"\", 5, 0 )\n\n end\n case alt_5\n when 1\n # at line 279:11: ' '\n match( 0x20 )\n\n when 2\n # at line 279:17: '\\\\r' '\\\\n'\n match( 0xd )\n match( 0xa )\n\n when 3\n # at line 279:29: '\\\\n'\n match( 0xa )\n\n when 4\n # at line 279:36: '\\\\t'\n match( 0x9 )\n\n end\n\n # --> action\n channel=HIDDEN;\n # <-- action\n\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 119 )\n\n\n end", "title": "" }, { "docid": "744582728d18e1db47687b54eed7bfb8", "score": "0.66551816", "text": "def lexer_error_tokenizer\n /\\s*\\S*/n\n end", "title": "" }, { "docid": "a620283486007bf43bcb876f1d531c47", "score": "0.6644588", "text": "def skip_whitespace_tokens\n skip_tokens kinds: [:newline, :line_comment, :block_comment]\n self\n end", "title": "" }, { "docid": "f5a0abdd5013fd2dea369e0437c51b1a", "score": "0.6631273", "text": "def skip_whitespace\n\t\twhile not(@current_char == nil) and @current_char.is_space?\n\t\t\tadvance\n\t\tend\n\tend", "title": "" }, { "docid": "06f77c0d2af530a916d2c4a8ff0cdff2", "score": "0.66296524", "text": "def whitespace_token\n return false unless whitespace = @chunk[WHITESPACE, 1]\n @i += whitespace.length\n end", "title": "" }, { "docid": "06f77c0d2af530a916d2c4a8ff0cdff2", "score": "0.66296524", "text": "def whitespace_token\n return false unless whitespace = @chunk[WHITESPACE, 1]\n @i += whitespace.length\n end", "title": "" }, { "docid": "c98f2ce535e0474bd593c9761c6ac721", "score": "0.6589817", "text": "def ws!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 17 )\n\n type = WS\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 57:5: ( ' ' | '\\\\r' | '\\\\n' | '\\\\t' | '\\\"' | '\\\\'' )\n if @input.peek( 1 ).between?( 0x9, 0xa ) || @input.peek(1) == 0xd || @input.peek(1) == 0x20 || @input.peek(1) == 0x22 || @input.peek(1) == 0x27\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n # --> action\n channel=HIDDEN; \n # <-- action\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 17 )\n\n end", "title": "" }, { "docid": "b6756eefda5ca812fbec0f412bec2b19", "score": "0.6589213", "text": "def skip_any_whitespace\n get_char while any_whitespace?(@look)\n end", "title": "" }, { "docid": "94b58f44390be989771213c73cd1821a", "score": "0.6572916", "text": "def lexes_cleanly?(lexer); end", "title": "" }, { "docid": "1dc844ba8fd6158a8b8d206184355738", "score": "0.6564388", "text": "def can_ignore_whitespace; true; end", "title": "" }, { "docid": "cd43a74887b3122855a8347e087d3140", "score": "0.65609527", "text": "def ws!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 15 )\n\n type = WS\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 51:6: ( ' ' | '\\\\t' | '\\\\n' | '\\\\r' )+\n # at file 51:6: ( ' ' | '\\\\t' | '\\\\n' | '\\\\r' )+\n match_count_7 = 0\n while true\n alt_7 = 2\n look_7_0 = @input.peek( 1 )\n\n if ( look_7_0.between?( 0x9, 0xa ) || look_7_0 == 0xd || look_7_0 == 0x20 )\n alt_7 = 1\n\n end\n case alt_7\n when 1\n # at line \n if @input.peek( 1 ).between?( 0x9, 0xa ) || @input.peek(1) == 0xd || @input.peek(1) == 0x20\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n\n else\n match_count_7 > 0 and break\n eee = EarlyExit(7)\n\n\n raise eee\n end\n match_count_7 += 1\n end\n\n # --> action\n channel = HIDDEN \n # <-- action\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 15 )\n\n end", "title": "" }, { "docid": "9b359399b41c7e1cc0be2d2c1c2afc1e", "score": "0.65587676", "text": "def ws!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 14)\n\n type = WS\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 53:5: ( ' ' | '\\\\t' | '\\\\r' | '\\\\n' )+\n # at file 53:5: ( ' ' | '\\\\t' | '\\\\r' | '\\\\n' )+\n match_count_15 = 0\n loop do\n alt_15 = 2\n look_15_0 = @input.peek(1)\n\n if (look_15_0.between?(?\\t, ?\\n) || look_15_0 == ?\\r || look_15_0 == ?\\s) \n alt_15 = 1\n\n end\n case alt_15\n when 1\n # at line \n if @input.peek(1).between?(?\\t, ?\\n) || @input.peek(1) == ?\\r || @input.peek(1) == ?\\s\n @input.consume\n else\n mse = MismatchedSet(nil)\n recover(mse)\n raise mse\n end\n\n\n\n else\n match_count_15 > 0 and break\n eee = EarlyExit(15)\n\n\n raise eee\n end\n match_count_15 += 1\n end\n\n # --> action\n channel = HIDDEN \n # <-- action\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 14)\n\n end", "title": "" }, { "docid": "bae6fd8f2a645f24cf181e138d94d502", "score": "0.65454924", "text": "def parse_literal_whitespace(line)\n @output += if @in_literal\n (line[@current_indent..-1] || '').gsub('$', '\\$')\n else\n line.lstrip\n end\n end", "title": "" }, { "docid": "dd67827fd877e56c5e5aae22e3f1d34f", "score": "0.6541944", "text": "def ws!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 45 )\n\n\n\n type = WS\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 91:5: ( '\\\\t' | '\\\\f' | ' ' | '\\\\u00A0' )+\n # at file 91:5: ( '\\\\t' | '\\\\f' | ' ' | '\\\\u00A0' )+\n match_count_9 = 0\n while true\n alt_9 = 2\n look_9_0 = @input.peek( 1 )\n\n if ( look_9_0 == 0x9 || look_9_0 == 0xc || look_9_0 == 0x20 || look_9_0 == 0xa0 )\n alt_9 = 1\n\n end\n case alt_9\n when 1\n # at line \n if @input.peek(1) == 0x9 || @input.peek(1) == 0xc || @input.peek(1) == 0x20 || @input.peek(1) == 0xa0\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n\n end\n\n\n\n else\n match_count_9 > 0 and break\n eee = EarlyExit(9)\n\n\n raise eee\n end\n match_count_9 += 1\n end\n\n\n\n # --> action\n channel = HIDDEN \n # <-- action\n\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 45 )\n\n\n end", "title": "" }, { "docid": "0fadde06111087c73bf5def7a9c342aa", "score": "0.65323204", "text": "def skip_whitespace\n @scanner.skip(/\\p{Blank}+/)\n end", "title": "" }, { "docid": "72138ab4fab3ad225a63e18e541e93e0", "score": "0.6512286", "text": "def ws!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 9 )\n\n\n\n type = WS\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 36:5: ( ' ' | '\\\\t' | '\\\\r' | '\\\\n' )+\n # at file 36:5: ( ' ' | '\\\\t' | '\\\\r' | '\\\\n' )+\n match_count_4 = 0\n while true\n alt_4 = 2\n look_4_0 = @input.peek( 1 )\n\n if ( look_4_0.between?( 0x9, 0xa ) || look_4_0 == 0xd || look_4_0 == 0x20 )\n alt_4 = 1\n\n end\n case alt_4\n when 1\n # at line \n if @input.peek( 1 ).between?( 0x9, 0xa ) || @input.peek(1) == 0xd || @input.peek(1) == 0x20\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n\n end\n\n\n\n else\n match_count_4 > 0 and break\n eee = EarlyExit(4)\n\n\n raise eee\n end\n match_count_4 += 1\n end\n\n\n\n # --> action\n channel = HIDDEN \n # <-- action\n\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 9 )\n\n\n end", "title": "" }, { "docid": "3d1d101086bc6928f38e91119cc28e70", "score": "0.6486714", "text": "def ws!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 41 )\n\n type = WS\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 182:12: ( '\\\\t' | ' ' | '\\\\r' | '\\\\n' | '\\\\u000C' )+\n # at file 182:12: ( '\\\\t' | ' ' | '\\\\r' | '\\\\n' | '\\\\u000C' )+\n match_count_4 = 0\n while true\n alt_4 = 2\n look_4_0 = @input.peek( 1 )\n\n if ( look_4_0.between?( 0x9, 0xa ) || look_4_0.between?( 0xc, 0xd ) || look_4_0 == 0x20 )\n alt_4 = 1\n\n end\n case alt_4\n when 1\n # at line \n if @input.peek( 1 ).between?( 0x9, 0xa ) || @input.peek( 1 ).between?( 0xc, 0xd ) || @input.peek(1) == 0x20\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n\n else\n match_count_4 > 0 and break\n eee = EarlyExit(4)\n\n\n raise eee\n end\n match_count_4 += 1\n end\n\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 41 )\n\n end", "title": "" }, { "docid": "55c8b94eebf199d8400aa5e61e3e809a", "score": "0.64461", "text": "def ws!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 39 )\n\n type = WS\n channel = ANTLR3::DEFAULT_CHANNEL\n\n\n # - - - - main rule block - - - -\n # at line 163:11: ( '\\\\t' | ' ' | '\\\\r' | '\\\\n' | '\\\\u000C' )+\n # at file 163:11: ( '\\\\t' | ' ' | '\\\\r' | '\\\\n' | '\\\\u000C' )+\n match_count_3 = 0\n while true\n alt_3 = 2\n look_3_0 = @input.peek(1)\n\n if (look_3_0.between?(0x9, 0xa) || look_3_0.between?(0xc, 0xd) || look_3_0 == 0x20)\n alt_3 = 1\n\n end\n case alt_3\n when 1\n # at line\n if @input.peek(1).between?(0x9, 0xa) || @input.peek(1).between?(0xc, 0xd) || @input.peek(1) == 0x20\n @input.consume\n else\n mse = MismatchedSet(nil)\n recover mse\n raise mse\n end\n\n\n else\n match_count_3 > 0 and break\n eee = EarlyExit(3)\n\n\n raise eee\n end\n match_count_3 += 1\n end\n\n\n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 39 )\n\n end", "title": "" }, { "docid": "6022f97b8708fd4c1afb0004ca360ecb", "score": "0.6432487", "text": "def skip_whitespace\n while @char =~ /[\\s,;#]/\n # Comments begin with a semicolon and extend to the end of the line\n # Treat #! as a comment for shebang lines\n if @char == ';' || (@char == '#' && peek_char == '!')\n while @char && @char != \"\\n\"\n next_char\n end\n elsif @char == '#'\n break unless peek_char == '_'\n next_char; next_char # skip #_\n skip_whitespace\n incomplete_error \"Unexpected end of program after #_, expected a form\" unless @char\n read_form # discard next form\n else\n next_char\n end\n end\n end", "title": "" }, { "docid": "42e4e27678faaa2cb77fc5de2cee63e7", "score": "0.6427797", "text": "def space!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 42 )\n\n \n # - - - - main rule block - - - -\n # at line \n if @input.peek(1) == 0x9 || @input.peek(1) == 0x20\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 42 )\n\n end", "title": "" }, { "docid": "bc9b426b798ac98d6cddc290dd7ecd0f", "score": "0.64173263", "text": "def skip_whitespace_tokens\n skip_tokens kinds: [:newline, :line_comment, :block_comment]\n self\n end", "title": "" }, { "docid": "cef87e8f1770c0676a2d40067231ab81", "score": "0.63649464", "text": "def whitespace?(tok = @tok)\n if tok\n @scanner.string[0...tok.pos] =~ /\\s\\Z/\n else\n @scanner.string[@scanner.pos, 1] =~ /^\\s/ ||\n @scanner.string[@scanner.pos - 1, 1] =~ /\\s\\Z/\n end\n end", "title": "" }, { "docid": "cef87e8f1770c0676a2d40067231ab81", "score": "0.63649464", "text": "def whitespace?(tok = @tok)\n if tok\n @scanner.string[0...tok.pos] =~ /\\s\\Z/\n else\n @scanner.string[@scanner.pos, 1] =~ /^\\s/ ||\n @scanner.string[@scanner.pos - 1, 1] =~ /\\s\\Z/\n end\n end", "title": "" }, { "docid": "cb0794e7e7c165a4c33d0d69038f8c65", "score": "0.6361132", "text": "def skip_whitespace \n @cursor += 1 while @text[@cursor, 1] == ' '\n end", "title": "" }, { "docid": "2aa99d4d123a05d3e975cb2d897a0b14", "score": "0.63357276", "text": "def at_whitespace?()\n [ self.class::TYPE_WHITESPACE,\n self.class::TYPE_SIGNIFICANT_WHITESPACE ].include?(self.node_type)\n end", "title": "" }, { "docid": "8f49d698b00ed609ce0570d89440a907", "score": "0.62981135", "text": "def skip_space_or_newline\n skipped_one_newline = false\n skipped_empty_line = false\n\n loop do\n debug(\"skip_space_or_newline: start #{current_token_kind} #{current_token_value}\")\n case current_token_kind\n when :on_nl, :on_ignored_nl\n skipped_empty_line = skipped_one_newline\n skipped_one_newline = true\n move_to_next_token\n when :on_sp, :on_semicolon\n move_to_next_token\n when :on_comment\n write_breaking_hardline if skipped_empty_line\n\n handle_comment(trailing: !skipped_one_newline)\n move_to_next_token\n else\n debug(\"skip_space_or_newline: end #{current_token_kind} #{current_token_value}\")\n break\n end\n end\n end", "title": "" }, { "docid": "5d9792f2394b9f9772dbe80a11c1a34a", "score": "0.6261734", "text": "def fix_whitespace_in token\n if token.length > 3\n new_token = token[3..-1]\n token[3..-1] = ''\n @tokens.unshift new_token\n end\n token\n end", "title": "" }, { "docid": "ccd3dc4e9223a6665df7bbe30cf8cb0f", "score": "0.62217635", "text": "def whitespace_token\n return nil unless md=WHITESPACE.match(@chunk)\n input = md.to_a[0]\n input.length\n end", "title": "" }, { "docid": "8de8afbdd78a151a0e16d579fc3ff897", "score": "0.61834896", "text": "def lsthe!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 12 )\n\n type = LSTHE\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 20:9: '<='\n match( \"<=\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 12 )\n\n end", "title": "" }, { "docid": "7e7d7cae391db22021420294b430248f", "score": "0.6182947", "text": "def skip_whitespace\n current = @marker.character\n (current = read_next) while current == ' ' || current == \"\\t\" || current == \"\\r\"\n end", "title": "" }, { "docid": "eaec78c67f200fb4a2cbed1739d2fe53", "score": "0.6131437", "text": "def parse_skip_space\n expect(SPACE_SYMBOLS) while peek?(SPACE_SYMBOLS)\n end", "title": "" }, { "docid": "796a26b8f0c38b1e8666c57a2abbb65a", "score": "0.6130546", "text": "def tokens!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 59 )\n\n type = TOKENS\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 587:4: 'tokens' WS_LOOP '{'\n match( \"tokens\" )\n ws_loop!\n match( 0x7b )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 59 )\n\n end", "title": "" }, { "docid": "8e5680e4fae920d549893131dbd7b586", "score": "0.6121565", "text": "def semicolon!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 31 )\n\n type = SEMICOLON\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 170:4: ';'\n match( 0x3b )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 31 )\n\n end", "title": "" }, { "docid": "2b2bdb695e374fb036172814685b481a", "score": "0.6117934", "text": "def semicolon!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 49 )\n\n type = SEMICOLON\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 427:4: ';'\n match( 0x3b )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 49 )\n\n end", "title": "" }, { "docid": "fdb89a769ecc33aa988e410d5851eabd", "score": "0.6095241", "text": "def whitespace_leading(node); end", "title": "" }, { "docid": "45b3d6b8b5138bdc464461bc8cae1461", "score": "0.6092639", "text": "def skip_space; end", "title": "" }, { "docid": "8adfc5bd141dabb082a4bfd361d2bede", "score": "0.60861146", "text": "def semicolon!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 12)\n\n type = SEMICOLON\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 353:12: ';'\n match(?;)\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 12)\n\n end", "title": "" }, { "docid": "994339912fc640119ec3cd1d25f7129d", "score": "0.6056475", "text": "def test_only_whitespace\n assert_tokenises_as ' '\n assert_tokenises_as \"\\t\"\n assert_tokenises_as \"\\n\"\n assert_tokenises_as \"\\n \\t\"\n end", "title": "" }, { "docid": "f25fac941f0e8bee7a9649da6ddb55d3", "score": "0.60547936", "text": "def yylex # 461 lines\n c = ''\n self.space_seen = false\n command_state = false\n ss = self.src\n\n self.token = nil\n self.yacc_value = nil\n\n return yylex_string if lex_strterm\n\n command_state = self.command_start\n self.command_start = false\n\n loop do # START OF CASE\n if scan(/[\\ \\t\\r\\f\\v]/) then # \\s - \\n + \\v\n self.space_seen = true\n next\n elsif check(/[^a-zA-Z]/) then\n if scan(/\\n|\\#/) then\n self.lineno = nil\n c = matched\n if c == '#' then\n ss.pos -= 1\n\n while scan(/\\s*#.*(\\n+|\\z)/) do\n @comments << matched.gsub(/^ +#/, '#').gsub(/^ +$/, '')\n end\n\n return RubyLexer::EOF if end_of_stream?\n end\n\n # Replace a string of newlines with a single one\n scan(/\\n+/)\n\n next if in_lex_state?(:expr_beg, :expr_value, :expr_class,\n :expr_fname, :expr_dot)\n\n if scan(/([\\ \\t\\r\\f\\v]*)\\./) then\n self.space_seen = true unless ss[1].empty?\n\n ss.pos -= 1\n next unless check(/\\.\\./)\n end\n\n self.command_start = true\n\n return result(:expr_beg, :tNL, nil)\n elsif scan(/[\\]\\)\\}]/) then\n if matched == \"}\" then\n self.brace_nest -= 1\n else\n self.paren_nest -= 1\n end\n\n cond.lexpop\n cmdarg.lexpop\n\n text = matched\n state = text == \")\" ? :expr_endfn : :expr_endarg\n token = {\n \")\" => :tRPAREN,\n \"]\" => :tRBRACK,\n \"}\" => :tRCURLY\n }[text]\n\n return result(state, token, text)\n elsif scan(/\\!/) then\n if in_arg_state? then\n return result(:expr_arg, :tUBANG, \"!@\") if scan(/@/)\n end\n\n text = scan(/[=~]/) ? \"!#{matched}\" : \"!\"\n\n return result(arg_state, TOKENS[text], text)\n elsif scan(/\\.\\.\\.?|,|![=~]?/) then\n return result(:expr_beg, TOKENS[matched], matched)\n elsif check(/\\./) then\n if scan(/\\.\\d/) then\n rb_compile_error \"no .<digit> floating literal anymore put 0 before dot\"\n elsif scan(/\\./) then\n return result(:expr_dot, :tDOT, \".\")\n end\n elsif scan(/\\(/) then\n token = if ruby18 then\n yylex_paren18\n else\n yylex_paren19\n end\n\n self.paren_nest += 1\n\n return expr_result(token, \"(\")\n elsif check(/\\=/) then\n if scan(/\\=\\=\\=|\\=\\=|\\=~|\\=>|\\=(?!begin\\b)/) then\n tok = matched\n return result(:arg_state, TOKENS[tok], tok)\n elsif scan(/\\=begin(?=\\s)/) then\n @comments << matched\n\n unless scan(/.*?\\n=end( |\\t|\\f)*[^\\n]*(\\n|\\z)/m) then\n @comments.clear\n rb_compile_error(\"embedded document meets end of file\")\n end\n\n @comments << matched\n\n next\n else\n raise \"you shouldn't be able to get here\"\n end\n elsif scan(/\\\"(#{SIMPLE_STRING})\\\"/o) then\n string = matched[1..-2].gsub(ESC) { unescape $1 }\n return result(:expr_end, :tSTRING, string)\n elsif scan(/\\\"/) then # FALLBACK\n string STR_DQUOTE, '\"' # TODO: question this\n return result(nil, :tSTRING_BEG, '\"')\n elsif scan(/\\@\\@?#{IDENT_CHAR}+/o) then\n self.token = matched\n\n rb_compile_error \"`#{self.token}` is not allowed as a variable name\" if\n self.token =~ /\\@\\d/\n\n tok_id = matched =~ /^@@/ ? :tCVAR : :tIVAR\n return result(:expr_end, tok_id, self.token)\n elsif scan(/\\:\\:/) then\n if is_beg? || in_lex_state?(:expr_class) || is_space_arg? then\n return result(:expr_beg, :tCOLON3, \"::\")\n end\n\n return result(:expr_dot, :tCOLON2, \"::\")\n elsif ! is_end? && scan(/:([a-zA-Z_]#{IDENT_CHAR}*(?:[?!]|=(?==>)|=(?![=>]))?)/) then\n # scanning shortcut to symbols\n return result(:expr_end, :tSYMBOL, ss[1])\n elsif ! is_end? && (scan(/\\:\\\"(#{SIMPLE_STRING})\\\"/) ||\n scan(/\\:\\'(#{SIMPLE_SSTRING})\\'/)) then\n symbol = ss[1].gsub(ESC) { unescape $1 }\n\n rb_compile_error \"symbol cannot contain '\\\\0'\" if\n ruby18 && symbol =~ /\\0/\n\n return result(:expr_end, :tSYMBOL, symbol)\n elsif scan(/\\:/) then\n # ?: / then / when\n if is_end? || check(/\\s/) then\n # TODO warn_balanced(\":\", \"symbol literal\");\n return result(:expr_beg, :tCOLON, \":\")\n end\n\n case\n when scan(/\\'/) then\n string STR_SSYM, matched\n when scan(/\\\"/) then\n string STR_DSYM, matched\n end\n\n return result(:expr_fname, :tSYMBEG, \":\")\n elsif check(/[0-9]/) then\n return parse_number\n elsif scan(/\\[/) then\n self.paren_nest += 1\n\n token = nil\n\n if in_lex_state? :expr_fname, :expr_dot then\n case\n when scan(/\\]\\=/) then\n self.paren_nest -= 1 # HACK? I dunno, or bug in MRI\n return result(:expr_arg, :tASET, \"[]=\")\n when scan(/\\]/) then\n self.paren_nest -= 1 # HACK? I dunno, or bug in MRI\n return result(:expr_arg, :tAREF, \"[]\")\n else\n rb_compile_error \"unexpected '['\"\n end\n elsif is_beg? then\n token = :tLBRACK\n elsif is_arg? && space_seen then\n token = :tLBRACK\n else\n token = :tLBRACK2\n end\n\n return expr_result(token, \"[\")\n elsif scan(/\\'#{SIMPLE_SSTRING}\\'/) then\n text = matched[1..-2].gsub(/\\\\\\\\/, \"\\\\\").gsub(/\\\\'/, \"'\") # \"\n return result(:expr_end, :tSTRING, text)\n elsif check(/\\|/) then\n if scan(/\\|\\|\\=/) then\n return result(:expr_beg, :tOP_ASGN, \"||\")\n elsif scan(/\\|\\|/) then\n return result(:expr_beg, :tOROP, \"||\")\n elsif scan(/\\|\\=/) then\n return result(:expr_beg, :tOP_ASGN, \"|\")\n elsif scan(/\\|/) then\n return result(:arg_state, :tPIPE, \"|\")\n end\n elsif scan(/\\{/) then\n self.brace_nest += 1\n if lpar_beg && lpar_beg == paren_nest then\n self.lpar_beg = nil\n self.paren_nest -= 1\n\n return expr_result(:tLAMBEG, \"{\")\n end\n\n token = if is_arg? || in_lex_state?(:expr_end, :expr_endfn) then\n :tLCURLY # block (primary)\n elsif in_lex_state?(:expr_endarg) then\n :tLBRACE_ARG # block (expr)\n else\n :tLBRACE # hash\n end\n\n self.command_start = true unless token == :tLBRACE\n\n return expr_result(token, \"{\")\n elsif scan(/->/) then\n return result(:expr_endfn, :tLAMBDA, nil)\n elsif scan(/[+-]/) then\n sign = matched\n utype, type = if sign == \"+\" then\n [:tUPLUS, :tPLUS]\n else\n [:tUMINUS, :tMINUS]\n end\n\n if in_arg_state? then\n if scan(/@/) then\n return result(:expr_arg, utype, \"#{sign}@\")\n else\n return result(:expr_arg, type, sign)\n end\n end\n\n return result(:expr_beg, :tOP_ASGN, sign) if scan(/\\=/)\n\n if (is_beg? || (is_arg? && space_seen && !check(/\\s/))) then\n arg_ambiguous if is_arg?\n\n if check(/\\d/) then\n return self.parse_number if utype == :tUPLUS\n return result(:expr_beg, :tUMINUS_NUM, sign)\n end\n\n return result(:expr_beg, utype, sign)\n end\n\n return result(:expr_beg, type, sign)\n elsif check(/\\*/) then\n if scan(/\\*\\*=/) then\n return result(:expr_beg, :tOP_ASGN, \"**\")\n elsif scan(/\\*\\*/) then\n token = space_vs_beginning :tDSTAR, :tDSTAR, :tPOW\n\n return result(:arg_state, token, \"**\")\n elsif scan(/\\*\\=/) then\n return result(:expr_beg, :tOP_ASGN, \"*\")\n elsif scan(/\\*/) then\n token = space_vs_beginning :tSTAR, :tSTAR, :tSTAR2\n\n return result(:arg_state, token, \"*\")\n end\n elsif check(/\\</) then\n if scan(/\\<\\=\\>/) then\n return result(:arg_state, :tCMP, \"<=>\")\n elsif scan(/\\<\\=/) then\n return result(:arg_state, :tLEQ, \"<=\")\n elsif scan(/\\<\\<\\=/) then\n return result(:arg_state, :tOP_ASGN, \"<<\")\n elsif scan(/\\<\\</) then\n if (!in_lex_state?(:expr_dot, :expr_class) &&\n !is_end? &&\n (!is_arg? || space_seen)) then\n tok = self.heredoc_identifier\n return tok if tok\n end\n\n return result(:arg_state, :tLSHFT, \"\\<\\<\")\n elsif scan(/\\</) then\n return result(:arg_state, :tLT, \"<\")\n end\n elsif check(/\\>/) then\n if scan(/\\>\\=/) then\n return result(:arg_state, :tGEQ, \">=\")\n elsif scan(/\\>\\>=/) then\n return result(:arg_state, :tOP_ASGN, \">>\")\n elsif scan(/\\>\\>/) then\n return result(:arg_state, :tRSHFT, \">>\")\n elsif scan(/\\>/) then\n return result(:arg_state, :tGT, \">\")\n end\n elsif scan(/\\`/) then\n case lex_state\n when :expr_fname then\n return result(:expr_end, :tBACK_REF2, \"`\")\n when :expr_dot then\n state = command_state ? :expr_cmdarg : :expr_arg\n return result(state, :tBACK_REF2, \"`\")\n else\n string STR_XQUOTE, '`'\n return result(nil, :tXSTRING_BEG, \"`\")\n end\n elsif scan(/\\?/) then\n if is_end? then\n state = ruby18 ? :expr_beg : :expr_value # HACK?\n return result(state, :tEH, \"?\")\n end\n\n if end_of_stream? then\n rb_compile_error \"incomplete character syntax\"\n end\n\n if check(/\\s|\\v/) then\n unless is_arg? then\n c2 = { \" \" => 's',\n \"\\n\" => 'n',\n \"\\t\" => 't',\n \"\\v\" => 'v',\n \"\\r\" => 'r',\n \"\\f\" => 'f' }[matched]\n\n if c2 then\n warning(\"invalid character syntax; use ?\\\\\" + c2)\n end\n end\n\n # ternary\n state = ruby18 ? :expr_beg : :expr_value # HACK?\n return result(state, :tEH, \"?\")\n elsif check(/\\w(?=\\w)/) then # ternary, also\n return result(:expr_beg, :tEH, \"?\")\n end\n\n c = if scan(/\\\\/) then\n self.read_escape\n else\n ss.getch\n end\n\n if version == 18 then\n return result(:expr_end, :tINTEGER, c[0].ord & 0xff)\n else\n return result(:expr_end, :tSTRING, c)\n end\n elsif check(/\\&/) then\n if scan(/\\&\\&\\=/) then\n return result(:expr_beg, :tOP_ASGN, \"&&\")\n elsif scan(/\\&\\&/) then\n return result(:expr_beg, :tANDOP, \"&&\")\n elsif scan(/\\&\\=/) then\n return result(:expr_beg, :tOP_ASGN, \"&\")\n elsif scan(/&/) then\n token = if is_arg? && space_seen && !check(/\\s/) then\n warning(\"`&' interpreted as argument prefix\")\n :tAMPER\n elsif in_lex_state? :expr_beg, :expr_mid then\n :tAMPER\n else\n :tAMPER2\n end\n\n return result(:arg_state, token, \"&\")\n end\n elsif scan(/\\//) then\n if is_beg? then\n string STR_REGEXP, '/'\n return result(nil, :tREGEXP_BEG, \"/\")\n end\n\n if scan(/\\=/) then\n return result(:expr_beg, :tOP_ASGN, \"/\")\n end\n\n if is_arg? && space_seen then\n unless scan(/\\s/) then\n arg_ambiguous\n string STR_REGEXP, '/'\n return result(nil, :tREGEXP_BEG, \"/\")\n end\n end\n\n return result(:arg_state, :tDIVIDE, \"/\")\n elsif scan(/\\^=/) then\n return result(:expr_beg, :tOP_ASGN, \"^\")\n elsif scan(/\\^/) then\n return result(:arg_state, :tCARET, \"^\")\n elsif scan(/\\;/) then\n self.command_start = true\n return result(:expr_beg, :tSEMI, \";\")\n elsif scan(/\\~/) then\n scan(/@/) if in_lex_state? :expr_fname, :expr_dot\n return result(:arg_state, :tTILDE, \"~\")\n elsif scan(/\\\\/) then\n if scan(/\\r?\\n/) then\n self.lineno = nil\n self.space_seen = true\n next\n end\n rb_compile_error \"bare backslash only allowed before newline\"\n elsif scan(/\\%/) then\n return parse_quote if is_beg?\n\n return result(:expr_beg, :tOP_ASGN, \"%\") if scan(/\\=/)\n\n return parse_quote if is_arg? && space_seen && ! check(/\\s/)\n\n return result(:arg_state, :tPERCENT, \"%\")\n elsif check(/\\$/) then\n if scan(/(\\$_)(\\w+)/) then\n self.token = matched\n return result(:expr_end, :tGVAR, matched)\n elsif scan(/\\$_/) then\n return result(:expr_end, :tGVAR, matched)\n elsif scan(/\\$[~*$?!@\\/\\\\;,.=:<>\\\"]|\\$-\\w?/) then\n return result(:expr_end, :tGVAR, matched)\n elsif scan(/\\$([\\&\\`\\'\\+])/) then\n # Explicit reference to these vars as symbols...\n if lex_state == :expr_fname then\n return result(:expr_end, :tGVAR, matched)\n else\n return result(:expr_end, :tBACK_REF, ss[1].to_sym)\n end\n elsif scan(/\\$([1-9]\\d*)/) then\n if lex_state == :expr_fname then\n return result(:expr_end, :tGVAR, matched)\n else\n return result(:expr_end, :tNTH_REF, ss[1].to_i)\n end\n elsif scan(/\\$0/) then\n return result(:expr_end, :tGVAR, matched)\n elsif scan(/\\$\\W|\\$\\z/) then # TODO: remove?\n return result(:expr_end, \"$\", \"$\") # FIX: \"$\"??\n elsif scan(/\\$\\w+/)\n return result(:expr_end, :tGVAR, matched)\n end\n elsif check(/\\_/) then\n if beginning_of_line? && scan(/\\__END__(\\r?\\n|\\Z)/) then\n self.lineno = nil\n return RubyLexer::EOF\n elsif scan(/\\_\\w*/) then\n self.token = matched\n return process_token command_state\n end\n end\n end # END OF CASE\n\n if scan(/\\004|\\032|\\000/) || end_of_stream? then # ^D, ^Z, EOF\n return RubyLexer::EOF\n else # alpha check\n rb_compile_error \"Invalid char #{ss.rest[0].chr} in expression\" unless\n check IDENT\n end\n\n self.token = matched if self.scan IDENT\n\n return process_token command_state\n end\n end", "title": "" }, { "docid": "b75304115337e44c38549e98b18a3daf", "score": "0.6049407", "text": "def t__80!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 25 )\n\n type = T__80\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 31:9: ','\n match( 0x2c )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 25 )\n\n end", "title": "" }, { "docid": "746527e8fad10921ab4af5248ff450ad", "score": "0.60470235", "text": "def t__11!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 1)\n\n type = T__11\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 7:9: ';'\n match(?;)\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 1)\n\n end", "title": "" }, { "docid": "70472003efac88d4ee937ec389521d42", "score": "0.60211396", "text": "def t__32!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 10)\n\n type = T__32\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 16:9: 'char'\n match(\"char\")\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 10)\n\n end", "title": "" }, { "docid": "0e00892d6e2127686ffd29a99ab90af7", "score": "0.60206115", "text": "def lex_init\n @OP = IRB::SLex.new\n\n @OP.def_rules(\"\\0\", \"\\004\", \"\\032\") do \n\t|op, io|\n\tEOFToken.new(self)\n end\n\n @OP.def_rules(\" \", \"\\t\", \"\\f\", \"\\r\", \"\\13\") do \n\t|op, io|\n\t@space_seen = true\n\twhile io.getc =~ /[ \\t\\f\\r\\13]/; end\n\tio.ungetc\n\tSpaceToken.new(self)\n end\n\n @OP.def_rule(\"#\") do \n\t|op, io|\n\tio.gets\n\tself.lex_state = EXPR_BEG\n\t@continue = true\n\tSimpleToken.new(self, :NL)\n end\n\n @OP.def_rule(\"\\n\") do\n\t|op, io|\n\tself.lex_state = EXPR_BEG\n\t@continue = true\n\tSimpleToken.new(self, :NL)\n end\n\n @OP.def_rule('\\\\') do\n\t|op, io|\n\tif io.getc == \"\\n\"\n\t @space_seen = true\n\t @continue = true\n\t SpaceToken.new(self)\n\telse\n\t io.ungetc\n\t SimpleToken.new(self, op)\n\tend\n end\n\n @OP.def_rules(\"=\") do\n |op, io|\n\tself.lex_state = EXPR_EQ_ARG\n\tReservedWordToken.new(self, \"=\")\n end\n\n @OP.def_rule(\"=>\") do\n\t|op, io|\n\tSimpleToken.new(self, :ASSOC)\n end\n\n @OP.def_rules(\"'\", '\"') do\n\t|op, io|\n\tidentify_string(op, io)\n end\n\n @OP.def_rules(\"`\") do\n\t|op, io|\n\tif lex_state?(EXPR_FNAME)\n\t self.lex_state = EXPR_END\n\t Token(op)\n\telsif indent_current.kind_of?(SimpleToken) && indent_current.token_id == :XSTRING_BEG\n\t self.lex_state = EXPR_END\n\t SimpleToken.new(self, :XSTRING_END)\n\telse\n\t self.lex_state = EXPR_BEG\n\t SimpleToken.new(self, :XSTRING_BEG)\n\tend\n end\n\n @OP.def_rule(\"(\") do\n\t|op, io|\n\tcond_push(false)\n\tif !@space_seen && (IDToken === @pretoken || PathToken === @pretoken)\n\t self.lex_state = EXPR_ARG\n\t SimpleToken.new(self, :LPARLEN_ARG)\n\telse\n\t self.lex_state = EXPR_BEG\n\t SimpleToken.new(self, op)\n\tend\n end\n\n @OP.def_rule(\"[\") do\n \t|op, io|\n\tif lex_state?(EXPR_BEG_ANY)\n\t self.lex_state = EXPR_ARG\n\t SimpleToken.new(self,:LBLACK_A)\n\telsif @space_seen || lex_state?(EXPR_EQ_ARG)\n\t io.ungetc\n\t identify_wildcard(io)\n\telse\n\t self.lex_state = EXPR_ARG\n\t SimpleToken.new(self,:LBLACK_I)\n\tend\n end\n\n @OP.def_rule(\"{\") do\n \t|op, io|\n\n\tif lex_state?(EXPR_BEG_ANY)\n\t self.lex_state = EXPR_ARG\n\t SimpleToken.new(self, :LBRACE_H)\n\telsif lex_state?(EXPR_ARG | EXPR_END)\n\t self.lex_state = EXPR_DO_BEG\n\t SimpleToken.new(self, :LBRACE_I)\n\telse\n\t io.ungetc\n\t identify_wildcard(io)\n\tend\n end\n\n# @OP.def_rule(\"{\") do\n# \t|op, io|\n# \tcond_push(false)\n# \tself.lex_state = EXPR_BEG\n# \tSimpleToken.new(self, op)\n# end\n\n\n# @OP.def_rules(\"]\", \")\", \"}\") do\n @OP.def_rules(\"]\", \")\", \"}\") do\n\t|op, io|\n\tcond_lexpop\n\tself.lex_state = EXPR_END\n\tSimpleToken.new(self, op)\n end\n\n @OP.def_rule(\"!\") do\n\t|op, io|\n\tself.lex_state = EXPR_BEG\n\tReservedWordToken.new(self, :BANG)\n end\n\n @OP.def_rule(\"|\") do\n\t|op, io|\n\tif lex_state?(EXPR_BEG)\n\t self.lex_state = EXPR_ARG\n\t SpecialToken.new(self, '|')\n\telse # lex_state?(EXPR_DO_BEG)\n\t self.lex_state = EXPR_BEG\n\t ReservedWordToken.new(self, '|')\n\tend\n end\n\n @OP.def_rule(\":\") do\n\t|op, io|\n\n\tif lex_state?(EXPR_END) || io.peek(0) =~ /\\s/\n\t self.lex_state = EXPR_BEG\n\t SimpleToken.new(self, op)\n\telse\n\t self.lex_state = EXPR_FNAME\n\t ReservedWordToken.new(self, :SYMBEG)\n\tend\n end\n\n @OP.def_rule(\"::\") do\n\t|op, io|\n\tself.lex_state = EXPR_BEG\n\tReservedWordToken.new(self, :COLON2)\n end\n\n @OP.def_rule(\".\") do\n \t|op, io|\n\n\tif lex_state?(EXPR_BEG_ANY)\n\t self.lex_state = EXPR_ARG\n\t SimpleToken.new(self, :DOT_COMMAND)\n\telsif @space_seen\n\t io.ungetc\n\t identify_word(io)\n\telse\n\t self.lex_state = EXPR_BEG\n\t SimpleToken.new(self, \".\")\n\tend\n end\n\n @OP.def_rule(\";\") do\n\t|op, io|\n\tself.lex_state = EXPR_BEG\n\tSimpleToken.new(self, ';')\n end\n\n# @OP.def_rule(\",\") do\n# \t|op, io|\n# #\tself.lex_state = EXPR_BEG\n# \tSimpleToken.new(self, ',')\n# end\n\n @OP.def_rule(\"&\") do\n\t|op, io|\n\n\tif lex_state?(EXPR_BEG_ANY)\n\t self.lex_state = EXPR_ARG\n\t SpecialToken.new(self, op)\n\telse\n\t self.lex_state = EXPR_BEG\n\t tk = SimpleToken.new(self, '&')\n\tend\n end\n\n @OP.def_rule(\"&&\") do\n\t|op, io|\n\tif lex_state?(EXPR_BEG_ANY)\n\t self.lex_state = EXPR_ARG\n\t SpecialToken.new(self, op)\n\telse\n\t self.lex_state = EXPR_BEG\n\t SimpleToken.new(self, :AND_AND)\n\tend\n end\n\n @OP.def_rule(\"||\") do\n\t|op, io|\n\tif lex_state?(EXPR_BEG_ANY)\n\t self.lex_state = EXPR_ARG\n\t SpecialToken.new(self, op)\n\telse\n\t self.lex_state = EXPR_BEG\n\t SimpleToken.new(self, :OR_OR)\n\tend\n end\n\n @OP.def_rules(\"$[\", \"%[\") do\n \t|op, io|\n \tcond_push(false)\n \tself.lex_state = EXPR_ARG\n \tSimpleToken.new(self, :LBLACK_A)\n end\n\n @OP.def_rules(\"${\", \"%{\") do\n \t|op, io|\n \tcond_push(false)\n \tself.lex_state = EXPR_ARG\n \tSimpleToken.new(self, :LBRACE_H)\n end\n\n @OP.def_rules(\"$/\", \"%/\") do\n\t|op, io|\n\tidentify_regexp(\"/\", io)\n end\n\n @OP.def_rule(\"$(\") do\n\t|op, io|\n\tio.ungetc\n\tidentify_compstmt(io, RubyToken::TkRPAREN)\n end\n\n @OP.def_rule(\"$begin\", proc{|op, io| /\\s|;/ =~ io.peek(0)}) do\n\t|op, io|\n\t\"begin\".split(//).reverse.each{|c| io.ungetc c}\n\tidentify_compstmt(io, RubyToken::TkEND)\n end\n\n @OP.def_rule(\"$$\") do\n\t|op, io|\n\tidentify_gvar(op, io)\n end\n\n @OP.def_rule(\"$@\") do\n\t|op, io|\n\tio.ungetc\n\tidentify_variable(op, io)\n end\n\n mods =[\"$if\", \"$unless\", \"$while\", \"$until\", \"$rescue\"]\n preproc = proc{|op, io| !lex_state?(EXPR_BEG_ANY) && /\\s/ =~ io.peek(0)}\n mods.each do |mod|\n\t@OP.def_rule(mod, preproc) do\n\t |op, io|\n\t tid = Modifiers[mod]\n\t self.lex_state = TransState[tid]\n\t ReservedWordToken.new(self, tid)\n\tend\n end\n\n @OP.def_rule(\"$do\", proc{|op, io| /\\s|;/ =~ io.peek(0)}) do\n\t|op, io|\n\tif cond?\n\t tid = :DO_COND\n\telse\n\t tid = :DO\n\tend\n\tself.lex_state = TransState[tid]\n\tReservedWordToken.new(self, tid)\n end\n\n @OP.def_rule(\"--do\", proc{|op, io| lex_state?(EXPR_ARG)}) do\n\ttid = :DO\n\tself.lex_state = TransState[tid]\n\tReservedWordToken.new(self, tid)\n end\n\n @OP.def_rule(\"$\") do\n\t|op, io|\n\tself.lex_state = EXPR_BEG\n\tSimpleToken.new(self, \"$\")\n end\n\n @OP.def_rules(*Redirections) do\n\t|op, io|\n\tif lex_state?(EXPR_BEG_ANY) && [\">\", \"<\", \">>\", \"<<\"].include?(op)\n\t self.lex_state = EXPR_ARG\n\t SpecialToken.new(self, op)\n\telse\n\t self.lex_state = EXPR_ARG\n\t ReservedWordToken.new(self, Redirection2ID[op])\n\tend\n end\n\n @OP.def_rule(\"-\", proc{|op, io| lex_state?(EXPR_BEG_ANY)}) do\n\t|op, io|\n\tif /\\s/ =~ io.peek(0)\n\t self.lex_state = EXPR_ARG\n\t SpecialToken.new(self, op)\n\telse\n\t token = \"\"\n\t while /[[:graph:]]/ =~ (ch = io.getc) && /[\\|&;\\(\\)\\}\\]]/ !~ ch\n\t token.concat ch\n\t end\n\t io.ungetc\n\t self.lex_state = EXPR_ARG\n\t TestToken.new(self, token)\n\tend\n end\n\n ops = [\"+\", \"/\", \"*\", \">=\", \"<=\", \"==\", \"<=>\", \"=~\", \"!~\"]\n preproc = proc{|op, io| lex_state?(EXPR_BEG_ANY) && /\\s/ =~ io.peek(0)}\n ops.each do |op|\n\t@OP.def_rule(op, preproc) do\n\t |op, io|\n\t self.lex_state = EXPR_ARG\n\t SpecialToken.new(self, op)\n\tend\n end\n\n @OP.def_rule(\"\") do\n\t|op, io|\n\n\tif /[0-9]/ =~ io.peek(0) || /[-+]/ =~ io.peek(0) && /[0-9]/ =~ io.peek(1)\n\t identify_number(io)\n\telsif lex_state?(EXPR_BEG_ANY|EXPR_FNAME)\n\t identify_id(io)\n\telse\n\t identify_word(io)\n\tend\n end\n end", "title": "" }, { "docid": "067be14ca5fde6eaa220d961487341e2", "score": "0.6018465", "text": "def lex s\n tokens.concat s.scan(%r%[()\\[\\]]|\\\"[^\"]*\\\"|/[^/]*/|[\\w-]+%) # \"\n end", "title": "" }, { "docid": "d5f088bed025ee61a0dcf5ec23a74907", "score": "0.60016614", "text": "def test_whitespace_can_be_ignored_after_optional\n result = @parser.interpret(\"[hello] world\")\n assert result.match(\"hello world\")\n assert result.match(\"world\")\n end", "title": "" }, { "docid": "9a656f798203f8aa168368e22c451a26", "score": "0.6000774", "text": "def chunk_char!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 13)\n\n \n # - - - - main rule block - - - -\n # at line 62:3: (~ ( '>' | '<' | '#' | '`' | '\\\"' | '\\\\'' | '|' | '(' | ')' | '$' | ';' | ' ' | '?' | '*' | '~' | '\\\\\\\\' | '\\\\t' | '{' | '}' | '\\\\n' | '\\\\r' ) | '\\\\\\\\' . )\n alt_20 = 2\n look_20_0 = @input.peek(1)\n\n if (look_20_0.between?(0x0000, ?\\b) || look_20_0.between?(0x000B, ?\\f) || look_20_0.between?(0x000E, 0x001F) || look_20_0 == ?! || look_20_0.between?(?%, ?&) || look_20_0.between?(?+, ?:) || look_20_0 == ?= || look_20_0.between?(?@, ?[) || look_20_0.between?(?], ?_) || look_20_0.between?(?a, ?z) || look_20_0.between?(0x007F, 0xFFFF)) \n alt_20 = 1\n elsif (look_20_0 == ?\\\\) \n alt_20 = 2\n else\n nvae = NoViableAlternative(\"\", 20, 0)\n raise nvae\n end\n case alt_20\n when 1\n # at line 62:5: ~ ( '>' | '<' | '#' | '`' | '\\\"' | '\\\\'' | '|' | '(' | ')' | '$' | ';' | ' ' | '?' | '*' | '~' | '\\\\\\\\' | '\\\\t' | '{' | '}' | '\\\\n' | '\\\\r' )\n if @input.peek(1).between?(0x0000, ?\\b) || @input.peek(1).between?(0x000B, ?\\f) || @input.peek(1).between?(0x000E, 0x001F) || @input.peek(1) == ?! || @input.peek(1).between?(?%, ?&) || @input.peek(1).between?(?+, ?:) || @input.peek(1) == ?= || @input.peek(1).between?(?@, ?[) || @input.peek(1).between?(?], ?_) || @input.peek(1).between?(?a, ?z) || @input.peek(1).between?(0x007F, 0x00FF)\n @input.consume\n else\n mse = MismatchedSet(nil)\n recover(mse)\n raise mse\n end\n\n\n\n when 2\n # at line 64:5: '\\\\\\\\' .\n match(?\\\\)\n match_any\n\n end\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 13)\n\n end", "title": "" }, { "docid": "002fb2f642549a164f4db8704113ebda", "score": "0.6000494", "text": "def skip_space=(_arg0); end", "title": "" }, { "docid": "2263432ea663c181d62f4ea60ca9f81d", "score": "0.59993225", "text": "def t__67!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 12 )\n\n type = T__67\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 18:9: 'lexer'\n match( \"lexer\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 12 )\n\n end", "title": "" }, { "docid": "6e4832a6e2390ebe9915ed57e45d1976", "score": "0.5987038", "text": "def lex(source)\n lexer = Lexer.new\n lexer.skip_comments = true\n lexer.skip_newlines = false\n lexer.run(source).tokens\nend", "title": "" }, { "docid": "2b30af74b3f0ddbe845354d15fae0772", "score": "0.5986018", "text": "def semicolon!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 41 )\n\n\n\n type = SEMICOLON\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 116:12: ';'\n match( 0x3b )\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 41 )\n\n\n end", "title": "" }, { "docid": "95d4d89e8e03fbc9abefcdef312b032f", "score": "0.5971607", "text": "def t__80!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 58)\n\n type = T__80\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 64:9: '^'\n match(?^)\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 58)\n\n end", "title": "" }, { "docid": "ce8fb5367d18493c133e0f5e8bcff530", "score": "0.5968384", "text": "def t__10!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 2 )\n\n type = T__10\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 8:9: ';'\n match( 0x3b )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 2 )\n\n end", "title": "" }, { "docid": "0a43acbdfd2f31076b91c5c59bb487ee", "score": "0.5962999", "text": "def separadores!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 8 )\n\n type = SEPARADORES\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 32:14: ( ':' | '(' | ')' | ';' | WHITESPACE | ',' )\n # at line 32:14: ( ':' | '(' | ')' | ';' | WHITESPACE | ',' )\n alt_6 = 6\n case look_6 = @input.peek( 1 )\n when 0x3a then alt_6 = 1\n when 0x28 then alt_6 = 2\n when 0x29 then alt_6 = 3\n when 0x3b then alt_6 = 4\n when 0x9, 0xa, 0xd, 0x20 then alt_6 = 5\n when 0x2c then alt_6 = 6\n else\n raise NoViableAlternative( \"\", 6, 0 )\n end\n case alt_6\n when 1\n # at line 32:16: ':'\n match( 0x3a )\n\n when 2\n # at line 32:22: '('\n match( 0x28 )\n\n when 3\n # at line 32:28: ')'\n match( 0x29 )\n\n when 4\n # at line 32:34: ';'\n match( 0x3b )\n\n when 5\n # at line 32:40: WHITESPACE\n whitespace!\n\n when 6\n # at line 32:53: ','\n match( 0x2c )\n\n end\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 8 )\n\n end", "title": "" }, { "docid": "f248e1322afb2d75b5d4ff670217d6f8", "score": "0.59582144", "text": "def _space\n _tmp = match_string(\" \")\n set_failed_rule :_space unless _tmp\n return _tmp\n end", "title": "" }, { "docid": "f248e1322afb2d75b5d4ff670217d6f8", "score": "0.59582144", "text": "def _space\n _tmp = match_string(\" \")\n set_failed_rule :_space unless _tmp\n return _tmp\n end", "title": "" }, { "docid": "4f54acf2a526a714c2bc7c46aaab117e", "score": "0.5949648", "text": "def whitespace\n @whitespace = nil\n if @context\n if @context[:respect_whitespace]\n @whitespace = (@context[:respect_whitespace] == :all or\n @context[:respect_whitespace].include? expanded_name)\n end\n @whitespace = false if (@context[:compress_whitespace] and\n (@context[:compress_whitespace] == :all or\n @context[:compress_whitespace].include? expanded_name)\n )\n end\n @whitespace = true unless @whitespace == false\n @whitespace\n end", "title": "" }, { "docid": "0ec873d798764139c007e452bee206eb", "score": "0.594509", "text": "def sql_separator_2!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 6 )\n\n \n # - - - - main rule block - - - -\n # at line 78:5: CR ( SPACE )* '/' ( SPACE )* ( CR | EOF )\n cr!\n # at line 78:9: ( SPACE )*\n while true # decision 8\n alt_8 = 2\n look_8_0 = @input.peek( 1 )\n\n if ( look_8_0 == 0x9 || look_8_0 == 0x20 )\n alt_8 = 1\n\n end\n case alt_8\n when 1\n # at line 78:9: SPACE\n space!\n\n else\n break # out of loop for decision 8\n end\n end # loop for decision 8\n match( 0x2f )\n # at line 78:20: ( SPACE )*\n while true # decision 9\n alt_9 = 2\n look_9_0 = @input.peek( 1 )\n\n if ( look_9_0 == 0x9 || look_9_0 == 0x20 )\n alt_9 = 1\n\n end\n case alt_9\n when 1\n # at line 78:20: SPACE\n space!\n\n else\n break # out of loop for decision 9\n end\n end # loop for decision 9\n # at line 78:27: ( CR | EOF )\n alt_10 = 2\n look_10_0 = @input.peek( 1 )\n\n if ( look_10_0 == 0xa )\n alt_10 = 1\n else\n alt_10 = 2\n end\n case alt_10\n when 1\n # at line 78:28: CR\n cr!\n\n when 2\n # at line 78:33: EOF\n match( ANTLR3::EOF )\n\n\n end\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 6 )\n\n end", "title": "" }, { "docid": "b16fc85bebe0d0dcf96ef31940586ea4", "score": "0.59356683", "text": "def nonspaces\n @nonspaces ||= Rexp.raw(\"\\\\S\").one_or_more\n end", "title": "" }, { "docid": "76a8436fa93963ebc8ba23e471065843", "score": "0.5922149", "text": "def test_is_newline_whitespace()\n\t\tassert Wexpr::Expression.s_is_newline(\"\\n\")\n\t\tassert Wexpr::Expression.s_is_whitespace(\"\\n\")\n\t\tassert Wexpr::Expression.s_is_not_bareword_safe(\"\\n\")\n\tend", "title": "" }, { "docid": "e0dddf56ba957bb6b3dee5120c0f20c9", "score": "0.59165365", "text": "def yylex\n c = ''\n space_seen = false\n command_state = false\n\n if lex_strterm then\n token = nil\n\n if lex_strterm[0] == :heredoc then\n token = self.heredoc(lex_strterm)\n if token == :tSTRING_END then\n self.lex_strterm = nil\n self.lex_state = :expr_end\n end\n else\n token = self.parse_string(lex_strterm)\n\n if token == :tSTRING_END || token == :tREGEXP_END then\n self.lex_strterm = nil\n self.lex_state = :expr_end\n end\n end\n\n return token\n end\n\n command_state = self.command_start\n self.command_start = false\n\n last_state = lex_state\n\n loop do\n c = src.read\n case c\n when /\\004|\\032|\\000/, RubyLexer::EOF then # ^D, ^Z, EOF\n return RubyLexer::EOF\n when /\\ |\\t|\\f|\\r|\\13/ then # white spaces, 13 = '\\v\n space_seen = true\n next\n when /#|\\n/ then\n return 0 if c == '#' and read_comment(c) == 0 # FIX 0?\n # Replace a string of newlines with a single one\n while (c = src.read) == \"\\n\"\n # do nothing\n end\n\n src.unread c\n\n if (lex_state == :expr_beg ||\n lex_state == :expr_fname ||\n lex_state == :expr_dot ||\n lex_state == :expr_class) then\n next\n end\n\n self.command_start = true\n self.lex_state = :expr_beg\n return \"\\n\"\n when '*' then\n c = src.read\n if c == '*' then\n c = src.read\n if c == '=' then\n self.lex_state = :expr_beg\n self.yacc_value = t(\"**\")\n return :tOP_ASGN\n end\n src.unread c\n self.yacc_value = t(\"**\")\n c = :tPOW\n else\n if c == '=' then\n self.lex_state = :expr_beg\n self.yacc_value = t(\"*\")\n return :tOP_ASGN\n end\n src.unread c\n if lex_state.is_argument && space_seen && c !~ /\\s/ then\n warning(\"`*' interpreted as argument prefix\")\n c = :tSTAR\n elsif lex_state == :expr_beg || lex_state == :expr_mid then\n c = :tSTAR\n else\n c = :tSTAR2\n end\n self.yacc_value = t(\"*\")\n end\n\n if lex_state == :expr_fname || lex_state == :expr_dot then\n self.lex_state = :expr_arg\n else\n self.lex_state = :expr_beg\n end\n\n return c\n when '!' then\n self.lex_state = :expr_beg\n if (c = src.read) == '=' then\n self.yacc_value = t(\"!=\")\n return :tNEQ\n end\n if c == '~' then\n self.yacc_value = t(\"!~\")\n return :tNMATCH\n end\n src.unread(c)\n self.yacc_value = t(\"!\")\n return :tBANG\n when '=' then\n # documentation nodes - FIX: cruby much cleaner w/ lookahead\n if src.was_begin_of_line and src.match_string \"begin\" then\n self.token_buffer.clear\n self.token_buffer << \"begin\"\n c = src.read\n\n if c =~ /\\s/ then\n # In case last next was the newline.\n src.unread(c)\n\n loop do\n c = src.read\n token_buffer << c\n\n # If a line is followed by a blank line put it back.\n while c == \"\\n\"\n c = src.read\n token_buffer << c\n end\n\n if c == RubyLexer::EOF then\n raise SyntaxError, \"embedded document meets end of file\"\n end\n\n next unless c == '='\n\n if src.was_begin_of_line && src.match_string(\"end\") then\n token_buffer << \"end\"\n token_buffer << src.read_line\n src.unread \"\\n\"\n break\n end\n end\n\n # parser_support.result.add_comment(Node.comment(token_buffer.join))\n next\n end\n src.unread(c)\n end\n\n\n if lex_state == :expr_fname || lex_state == :expr_dot then\n self.lex_state = :expr_arg\n else\n self.lex_state = :expr_beg\n end\n\n c = src.read\n if c == '=' then\n c = src.read\n if c == '=' then\n self.yacc_value = t(\"===\")\n return :tEQQ\n end\n src.unread(c)\n self.yacc_value = t(\"==\")\n return :tEQ\n end\n if c == '~' then\n self.yacc_value = t(\"=~\")\n return :tMATCH\n elsif c == '>' then\n self.yacc_value = t(\"=>\")\n return :tASSOC\n end\n src.unread(c)\n self.yacc_value = t(\"=\")\n return '='\n when '<' then\n c = src.read\n if (c == '<' &&\n lex_state != :expr_end &&\n lex_state != :expr_dot &&\n lex_state != :expr_endarg &&\n lex_state != :expr_class &&\n (!lex_state.is_argument || space_seen)) then\n tok = self.heredoc_identifier\n return tok unless tok == 0\n end\n if lex_state == :expr_fname || lex_state == :expr_dot then\n self.lex_state = :expr_arg\n else\n self.lex_state = :expr_beg\n end\n if c == '=' then\n if (c = src.read) == '>' then\n self.yacc_value = t(\"<=>\")\n return :tCMP\n end\n src.unread c\n self.yacc_value = t(\"<=\")\n return :tLEQ\n end\n if c == '<' then\n if (c = src.read) == '=' then\n self.lex_state = :expr_beg\n self.yacc_value = t(\"\\<\\<\")\n return :tOP_ASGN\n end\n src.unread(c)\n self.yacc_value = t(\"<<\")\n return :tLSHFT\n end\n self.yacc_value = t(\"<\")\n src.unread(c)\n return :tLT\n when '>' then\n if lex_state == :expr_fname || lex_state == :expr_dot then\n self.lex_state = :expr_arg\n else\n self.lex_state = :expr_beg\n end\n\n if (c = src.read) == '=' then\n self.yacc_value = t(\">=\")\n return :tGEQ\n end\n if c == '>' then\n if (c = src.read) == '=' then\n self.lex_state = :expr_beg\n self.yacc_value = t(\">>\")\n return :tOP_ASGN\n end\n src.unread c\n self.yacc_value = t(\">>\")\n return :tRSHFT\n end\n src.unread c\n self.yacc_value = t(\">\")\n return :tGT\n when '\"' then\n self.lex_strterm = s(:strterm, STR_DQUOTE, '\"', \"\\0\") # TODO: question this\n self.yacc_value = t(\"\\\"\")\n return :tSTRING_BEG\n when '`' then\n self.yacc_value = t(\"`\")\n if lex_state == :expr_fname then\n self.lex_state = :expr_end\n return :tBACK_REF2\n end\n if lex_state == :expr_dot then\n if command_state then\n self.lex_state = :expr_cmdarg\n else\n self.lex_state = :expr_arg\n end\n return :tBACK_REF2\n end\n self.lex_strterm = s(:strterm, STR_XQUOTE, '`', \"\\0\")\n return :tXSTRING_BEG\n when \"\\'\" then\n self.lex_strterm = s(:strterm, STR_SQUOTE, \"\\'\", \"\\0\")\n self.yacc_value = t(\"'\")\n return :tSTRING_BEG\n when '?' then\n if lex_state == :expr_end || lex_state == :expr_endarg then\n self.lex_state = :expr_beg\n self.yacc_value = t(\"?\")\n return '?'\n end\n\n c = src.read\n\n raise SyntaxError, \"incomplete character syntax\" if c == RubyLexer::EOF\n\n if c =~ /\\s/ then\n if !lex_state.is_argument then\n c2 = 0\n c2 = case c\n when ' ' then\n 's'\n when \"\\n\" then\n 'n'\n when \"\\t\" then\n 't'\n when \"\\v\" then\n 'v'\n when \"\\r\" then\n 'r'\n when \"\\f\" then\n 'f'\n end\n\n if c2 != 0 then\n warning(\"invalid character syntax; use ?\\\\\" + c2)\n end\n end\n\n # ternary\n src.unread c\n self.lex_state = :expr_beg\n self.yacc_value = t(\"?\")\n return '?'\n# elsif ismbchar(c) then # ternary, also\n# rb_warn(\"multibyte character literal not supported yet; use ?\\\\\" + c)\n# support.unread c\n# self.lex_state = :expr_beg\n# return '?'\n elsif c =~ /\\w/ && ! src.peek(\"\\n\") && self.is_next_identchar then\n # ternary, also\n src.unread c\n self.lex_state = :expr_beg\n self.yacc_value = t(\"?\")\n return '?'\n elsif c == \"\\\\\" then\n c = self.read_escape\n end\n c[0] &= 0xff\n self.lex_state = :expr_end\n self.yacc_value = c[0]\n return :tINTEGER\n when '&' then\n if (c = src.read) == '&' then\n self.lex_state = :expr_beg\n if (c = src.read) == '=' then\n self.yacc_value = t(\"&&\")\n self.lex_state = :expr_beg\n return :tOP_ASGN\n end\n src.unread c\n self.yacc_value = t(\"&&\")\n return :tANDOP\n elsif c == '=' then\n self.yacc_value = t(\"&\")\n self.lex_state = :expr_beg\n return :tOP_ASGN\n end\n\n src.unread c\n\n if lex_state.is_argument && space_seen && c !~ /\\s/ then\n warning(\"`&' interpreted as argument prefix\")\n c = :tAMPER\n elsif lex_state == :expr_beg || lex_state == :expr_mid then\n c = :tAMPER\n else\n c = :tAMPER2\n end\n\n if lex_state == :expr_fname || lex_state == :expr_dot then\n self.lex_state = :expr_arg\n else\n self.lex_state = :expr_beg\n end\n self.yacc_value = t(\"&\")\n return c\n when '|' then\n if (c = src.read) == '|' then\n self.lex_state = :expr_beg\n if (c = src.read) == '=' then\n self.lex_state = :expr_beg\n self.yacc_value = t(\"||\")\n return :tOP_ASGN\n end\n src.unread c\n self.yacc_value = t(\"||\")\n return :tOROP\n end\n if c == '=' then\n self.lex_state = :expr_beg\n self.yacc_value = t(\"|\")\n return :tOP_ASGN\n end\n if lex_state == :expr_fname || lex_state == :expr_dot then\n self.lex_state = :expr_arg\n else\n self.lex_state = :expr_beg\n end\n src.unread c\n self.yacc_value = t(\"|\")\n return :tPIPE\n when '+' then\n c = src.read\n if lex_state == :expr_fname || lex_state == :expr_dot then\n self.lex_state = :expr_arg\n if c == '@' then\n self.yacc_value = t(\"+@\")\n return :tUPLUS\n end\n src.unread c\n self.yacc_value = t(\"+\")\n return :tPLUS\n end\n\n if c == '=' then\n self.lex_state = :expr_beg\n self.yacc_value = t(\"+\")\n return :tOP_ASGN\n end\n\n if (lex_state == :expr_beg || lex_state == :expr_mid ||\n (lex_state.is_argument && space_seen && c !~ /\\s/)) then\n arg_ambiguous if lex_state.is_argument\n self.lex_state = :expr_beg\n src.unread c\n if c =~ /\\d/ then\n c = '+'\n return parse_number(c)\n end\n self.yacc_value = t(\"+\")\n return :tUPLUS\n end\n self.lex_state = :expr_beg\n src.unread c\n self.yacc_value = t(\"+\")\n return :tPLUS\n when '-' then\n c = src.read\n if lex_state == :expr_fname || lex_state == :expr_dot then\n self.lex_state = :expr_arg\n if c == '@' then\n self.yacc_value = t(\"-@\")\n return :tUMINUS\n end\n src.unread c\n self.yacc_value = t(\"-\")\n return :tMINUS\n end\n if c == '=' then\n self.lex_state = :expr_beg\n self.yacc_value = t(\"-\")\n return :tOP_ASGN\n end\n if (lex_state == :expr_beg || lex_state == :expr_mid ||\n (lex_state.is_argument && space_seen && c !~ /\\s/)) then\n arg_ambiguous if lex_state.is_argument\n self.lex_state = :expr_beg\n src.unread c\n self.yacc_value = t(\"-\")\n if c =~ /\\d/ then\n return :tUMINUS_NUM\n end\n return :tUMINUS\n end\n self.lex_state = :expr_beg\n src.unread c\n self.yacc_value = t(\"-\")\n return :tMINUS\n when '.' then\n self.lex_state = :expr_beg\n if (c = src.read) == '.' then\n if (c = src.read) == '.' then\n self.yacc_value = t(\"...\")\n return :tDOT3\n end\n src.unread c\n self.yacc_value = t(\"..\")\n return :tDOT2\n end\n src.unread c\n if c =~ /\\d/ then\n raise SyntaxError, \"no .<digit> floating literal anymore put 0 before dot\"\n end\n self.lex_state = :expr_dot\n self.yacc_value = t(\".\")\n return :tDOT\n when /[0-9]/ then\n return parse_number(c)\n when ')' then # REFACTOR: omg this is lame... next 3 are all the same\n cond.lexpop\n cmdarg.lexpop\n self.lex_state = :expr_end\n self.yacc_value = t(\")\")\n return :tRPAREN\n when ']' then\n cond.lexpop\n cmdarg.lexpop\n self.lex_state = :expr_end\n self.yacc_value = t(\"]\")\n return :tRBRACK\n when '}' then\n cond.lexpop\n cmdarg.lexpop\n self.lex_state = :expr_end\n self.yacc_value = t(\"end\")\n return :tRCURLY\n when ':' then\n c = src.read\n if c == ':' then\n if (lex_state == :expr_beg ||\n lex_state == :expr_mid ||\n lex_state == :expr_class ||\n (lex_state.is_argument && space_seen)) then\n self.lex_state = :expr_beg\n self.yacc_value = t(\"::\")\n return :tCOLON3\n end\n\n self.lex_state = :expr_dot\n self.yacc_value = t(\":\")\n return :tCOLON2\n end\n\n if lex_state == :expr_end || lex_state == :expr_endarg || c =~ /\\s/ then\n src.unread c\n self.lex_state = :expr_beg\n self.yacc_value = t(\":\")\n return ':'\n end\n\n case c\n when \"\\'\" then\n self.lex_strterm = s(:strterm, STR_SSYM, c, \"\\0\")\n when '\"' then\n self.lex_strterm = s(:strterm, STR_DSYM, c, \"\\0\")\n else\n src.unread c\n end\n\n self.lex_state = :expr_fname\n self.yacc_value = t(\":\")\n return :tSYMBEG\n when '/' then\n if lex_state == :expr_beg || lex_state == :expr_mid then\n self.lex_strterm = s(:strterm, STR_REGEXP, '/', \"\\0\")\n self.yacc_value = t(\"/\")\n return :tREGEXP_BEG\n end\n\n if (c = src.read) == '=' then\n self.yacc_value = t(\"/\")\n self.lex_state = :expr_beg\n return :tOP_ASGN\n end\n\n src.unread c\n\n if lex_state.is_argument && space_seen then\n unless c =~ /\\s/ then\n arg_ambiguous\n self.lex_strterm = s(:strterm, STR_REGEXP, '/', \"\\0\")\n self.yacc_value = t(\"/\")\n return :tREGEXP_BEG\n end\n end\n\n self.lex_state = if (lex_state == :expr_fname ||\n lex_state == :expr_dot) then\n :expr_arg\n else\n :expr_beg\n end\n\n self.yacc_value = t(\"/\")\n return :tDIVIDE\n when '^' then\n if (c = src.read) == '=' then\n self.lex_state = :expr_beg\n self.yacc_value = t(\"^\")\n return :tOP_ASGN\n end\n if lex_state == :expr_fname || self.lex_state == :expr_dot then\n self.lex_state = :expr_arg\n else\n self.lex_state = :expr_beg\n end\n src.unread c\n self.yacc_value = t(\"^\")\n return :tCARET\n when ';' then\n self.command_start = true\n self.lex_state = :expr_beg\n self.yacc_value = t(\";\")\n return c\n when ',' then\n self.lex_state = :expr_beg\n self.yacc_value = t(\",\")\n return c\n when '~' then\n if lex_state == :expr_fname || lex_state == :expr_dot then\n if (c = src.read) != '@' then\n src.unread c\n end\n end\n if lex_state == :expr_fname || lex_state == :expr_dot then\n self.lex_state = :expr_arg\n else\n self.lex_state = :expr_beg\n end\n self.yacc_value = t(\"~\")\n return :tTILDE\n when '(' then\n c = :tLPAREN2\n self.command_start = true\n if lex_state == :expr_beg || lex_state == :expr_mid then\n c = :tLPAREN\n elsif space_seen then\n if lex_state == :expr_cmdarg then\n c = :tLPAREN_ARG\n elsif lex_state == :expr_arg then\n warning(\"don't put space before argument parentheses\")\n c = :tLPAREN2\n end\n end\n cond.push false\n cmdarg.push false\n self.lex_state = :expr_beg\n self.yacc_value = t(\"(\")\n return c\n when '[' then\n if lex_state == :expr_fname || lex_state == :expr_dot then\n self.lex_state = :expr_arg\n if (c = src.read) == ']' then\n if src.peek('=') then\n c = src.read\n self.yacc_value = t(\"[]=\")\n return :tASET\n end\n self.yacc_value = t(\"[]\")\n return :tAREF\n end\n src.unread c\n self.yacc_value = t(\"[\")\n return '['\n elsif lex_state == :expr_beg || lex_state == :expr_mid then\n c = :tLBRACK\n elsif lex_state.is_argument && space_seen then\n c = :tLBRACK\n end\n self.lex_state = :expr_beg\n cond.push false\n cmdarg.push false\n self.yacc_value = t(\"[\")\n return c\n when '{' then\n c = :tLCURLY\n\n if lex_state.is_argument || lex_state == :expr_end then\n c = :tLCURLY # block (primary)\n elsif lex_state == :expr_endarg then\n c = :tLBRACE_ARG # block (expr)\n else\n c = :tLBRACE # hash\n end\n cond.push false\n cmdarg.push false\n self.lex_state = :expr_beg\n self.yacc_value = t(\"{\")\n return c\n when \"\\\\\" then\n c = src.read\n if c == \"\\n\" then\n space_seen = true\n next # skip \\\\n\n end\n src.unread c\n self.yacc_value = t(\"\\\\\")\n return \"\\\\\"\n when '%' then\n if lex_state == :expr_beg || lex_state == :expr_mid then\n return parse_quote(src.read)\n end\n\n c = src.read\n if c == '=' then\n self.lex_state = :expr_beg\n self.yacc_value = t(\"%\")\n return :tOP_ASGN\n end\n\n return parse_quote(c) if lex_state.is_argument && space_seen && c !~ /\\s/\n\n self.lex_state = case lex_state\n when :expr_fname, :expr_dot then\n :expr_arg\n else\n :expr_beg\n end\n\n src.unread c\n self.yacc_value = t(\"%\")\n\n return :tPERCENT\n when '$' then\n last_state = lex_state\n self.lex_state = :expr_end\n token_buffer.clear\n c = src.read\n case c\n when '_' then # $_: last read line string\n c = src.read\n\n token_buffer << '$'\n token_buffer << '_'\n\n unless c =~ /\\w/ then\n src.unread c\n self.yacc_value = t(token_buffer.join)\n return :tGVAR\n end\n when /[~*$?!@\\/\\\\;,.=:<>\\\"]/ then\n token_buffer << '$'\n token_buffer << c\n self.yacc_value = t(token_buffer.join)\n return :tGVAR\n when '-' then\n token_buffer << '$'\n token_buffer << c\n c = src.read\n if c =~ /\\w/ then\n token_buffer << c\n else\n src.unread c\n end\n self.yacc_value = t(token_buffer.join)\n # xxx shouldn't check if valid option variable\n return :tGVAR\n when /[\\&\\`\\'\\+]/ then\n # Explicit reference to these vars as symbols...\n if last_state == :expr_fname then\n token_buffer << '$'\n token_buffer << c\n self.yacc_value = t(token_buffer.join)\n return :tGVAR\n end\n\n self.yacc_value = s(:back_ref, c.to_sym)\n return :tBACK_REF\n when /[1-9]/ then\n token_buffer << '$'\n begin\n token_buffer << c\n c = src.read\n end while c =~ /\\d/\n src.unread c\n if last_state == :expr_fname then\n self.yacc_value = t(token_buffer.join)\n return :tGVAR\n else\n self.yacc_value = s(:nth_ref, token_buffer.join[1..-1].to_i)\n return :tNTH_REF\n end\n when '0' then\n token_buffer << '$'\n else\n unless c =~ /\\w/ then\n src.unread c\n self.yacc_value = t(\"$\")\n return '$'\n end\n token_buffer << '$'\n end\n when '@' then\n c = src.read\n token_buffer.clear\n token_buffer << '@'\n if c == '@' then\n token_buffer << '@'\n c = src.read\n end\n if c =~ /\\d/ then\n if token_buffer.length == 1 then\n raise SyntaxError, \"`@\" + c + \"' is not allowed as an instance variable name\"\n else\n raise SyntaxError, \"`@@\" + c + \"' is not allowed as a class variable name\"\n end\n end\n unless c =~ /\\w/ then\n src.unread c\n self.yacc_value = t(\"@\")\n return '@'\n end\n when '_' then\n if src.was_begin_of_line && src.match_string(\"_END__\\n\", false) then\n self.end_seen = true\n return RubyLexer::EOF\n end\n token_buffer.clear\n else\n unless c =~ /\\w/ then\n raise SyntaxError, \"Invalid char '#{c.inspect}' in expression\"\n end\n token_buffer.clear\n end\n\n begin\n token_buffer << c\n # if ismbchar(c) then\n # len = mbclen(c) - 1\n # (0..len).each do\n # c = src.read;\n # token_buffer << c\n # end\n # end\n c = src.read\n end while c =~ /\\w/\n\n if c =~ /\\!|\\?/ && token_buffer[0] =~ /\\w/ && src.peek != '=' then\n token_buffer << c\n else\n src.unread c\n end\n\n result = nil\n last_state = lex_state\n\n case token_buffer[0]\n when '$' then\n self.lex_state = :expr_end\n result = :tGVAR\n when '@' then\n self.lex_state = :expr_end\n if token_buffer[1] == '@' then\n result = :tCVAR\n else\n result = :tIVAR\n end\n else\n if token_buffer[-1] =~ /[!?]/ then\n result = :tFID\n else\n if lex_state == :expr_fname then\n if (c = src.read) == '=' then\n c2 = src.read\n\n if c2 != '~' && c2 != '>' && (c2 != '=' || (c2 == \"\\n\" && src.peek('>'))) then\n result = :tIDENTIFIER\n token_buffer << c\n src.unread c2\n else\n src.unread c2\n src.unread c\n end\n else\n src.unread c\n end\n end\n if result.nil? && token_buffer[0] =~ /[A-Z]/ then\n result = :tCONSTANT\n else\n result = :tIDENTIFIER\n end\n end\n\n unless lex_state == :expr_dot then\n # See if it is a reserved word.\n keyword = Keyword.keyword(token_buffer.join, token_buffer.length)\n\n unless keyword.nil? then\n state = lex_state\n self.lex_state = keyword.state\n\n if state == :expr_fname then\n self.yacc_value = t(keyword.name)\n else\n self.yacc_value = t(token_buffer.join)\n end\n\n if keyword.id0 == :kDO then\n self.command_start = true\n return :kDO_COND if cond.is_in_state\n return :kDO_BLOCK if cmdarg.is_in_state && state != :expr_cmdarg\n return :kDO_BLOCK if state == :expr_endarg\n return :kDO\n end\n\n return keyword.id0 if state == :expr_beg\n\n self.lex_state = :expr_beg unless keyword.id0 == keyword.id1\n\n return keyword.id1\n end\n end\n\n if (lex_state == :expr_beg ||\n lex_state == :expr_mid ||\n lex_state == :expr_dot ||\n lex_state == :expr_arg ||\n lex_state == :expr_cmdarg) then\n if command_state then\n self.lex_state = :expr_cmdarg\n else\n self.lex_state = :expr_arg\n end\n else\n self.lex_state = :expr_end\n end\n end\n\n\n temp_val = token_buffer.join\n\n # Lame: parsing logic made it into lexer in ruby...So we\n # are emulating\n # FIXME: I believe this is much simpler now...\n# HACK\n# scope = parser_support.current_scope\n# if (IdUtil.var_type(temp_val) == IdUtil.LOCAL_VAR &&\n# last_state != :expr_dot &&\n# (BlockStaticScope === scope && (scope.is_defined(temp_val) >= 0)) ||\n# (scope.local_scope.is_defined(temp_val) >= 0)) then\n# self.lex_state = :expr_end\n# end\n\n self.yacc_value = t(temp_val)\n\n return result\n end\n end", "title": "" }, { "docid": "92c91ec0e340a4900360ee388785f396", "score": "0.59072185", "text": "def space_before?; end", "title": "" }, { "docid": "92c91ec0e340a4900360ee388785f396", "score": "0.59072185", "text": "def space_before?; end", "title": "" }, { "docid": "de3ca1918ce6e1565f7b90c29417a584", "score": "0.59060156", "text": "def semi!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 96 )\n\n\n\n type = SEMI\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 256:8: ';'\n match( 0x3b )\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 96 )\n\n\n end", "title": "" }, { "docid": "1aae47207cde4255aa7b79dad1a162ab", "score": "0.5893131", "text": "def match_lexeme(scanner, accepting_regexp)\n @lexemes[scanner.peek(1)].each do |lexeme|\n next if lexeme.name == :REGEXP && !accepting_regexp\n\n token = lexeme.match(scanner)\n return token if token\n end\n\n # When some other character encountered, try to match it as\n # whitespace, as in JavaScript whitespace can contain any\n # Unicode whitespace character.\n if str = scanner.check(WHITESPACE_REGEX)\n return Token.new(:S, str)\n end\n end", "title": "" }, { "docid": "bcaa2a1e5732dd4b8c5a8f0f61ed1ae7", "score": "0.5881193", "text": "def star!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 100 )\n\n\n\n type = STAR\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 260:8: '*'\n match( 0x2a )\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 100 )\n\n\n end", "title": "" }, { "docid": "9da9dc02653af31d7208e4873aabf4be", "score": "0.5869747", "text": "def test_slash_s_is_a_shortcut_for_a_whitespace_character_class\n assert_equal \" \\t\\n\", \"space: \\t\\n\"[/\\s+/]\n end", "title": "" }, { "docid": "0792fa7bf4cb88468c6314f61c0bc352", "score": "0.5868152", "text": "def nonspace\n @nonspace ||= Rexp.raw(\"\\\\S\")\n end", "title": "" }, { "docid": "684e8e663eaa565d4c183117d20f2193", "score": "0.5867546", "text": "def skip_white_space()\n @input.gsub!(/^[^\\S\\r\\n]+/, \"\")\n end", "title": "" }, { "docid": "45dfdcfeefc5ff9373da2a8951fc3f6c", "score": "0.58586663", "text": "def sl_comment!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 14 )\n\n type = SL_COMMENT\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 134:4: '--' (~ ( '\\\\n' | '\\\\r' ) )* ( '\\\\r' )? '\\\\n'\n match( \"--\" )\n # at line 134:9: (~ ( '\\\\n' | '\\\\r' ) )*\n while true # decision 4\n alt_4 = 2\n look_4_0 = @input.peek( 1 )\n\n if ( look_4_0.between?( 0x0, 0x9 ) || look_4_0.between?( 0xb, 0xc ) || look_4_0.between?( 0xe, 0xffff ) )\n alt_4 = 1\n\n end\n case alt_4\n when 1\n # at line 134:9: ~ ( '\\\\n' | '\\\\r' )\n if @input.peek( 1 ).between?( 0x0, 0x9 ) || @input.peek( 1 ).between?( 0xb, 0xc ) || @input.peek( 1 ).between?( 0xe, 0xff )\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n\n else\n break # out of loop for decision 4\n end\n end # loop for decision 4\n # at line 134:23: ( '\\\\r' )?\n alt_5 = 2\n look_5_0 = @input.peek( 1 )\n\n if ( look_5_0 == 0xd )\n alt_5 = 1\n end\n case alt_5\n when 1\n # at line 134:23: '\\\\r'\n match( 0xd )\n\n end\n match( 0xa )\n # --> action\n channel=HIDDEN;\n # <-- action\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 14 )\n\n end", "title": "" }, { "docid": "1b202974e694d139c73558723e87f380", "score": "0.58540046", "text": "def t__31!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 23 )\n\n type = T__31\n channel = ANTLR3::DEFAULT_CHANNEL\n\n\n # - - - - main rule block - - - -\n # at line 29:9: '\\\\\\\\'\n match(0x5c)\n\n\n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 23 )\n\n end", "title": "" }, { "docid": "a9f5b417bd84a4b9f85265f179290ebb", "score": "0.5843176", "text": "def t__53!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 31)\n\n type = T__53\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 37:9: '...'\n match(\"...\")\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 31)\n\n end", "title": "" }, { "docid": "d7983f9cc7e8e8fea4d0042beab5e308", "score": "0.5835327", "text": "def _ws\n _tmp = scan(/\\A(?-mix:[ \\t\\n]+)/)\n set_failed_rule :_ws unless _tmp\n return _tmp\n end", "title": "" }, { "docid": "244edcc325cfb64f84000f1cdee100d2", "score": "0.5829006", "text": "def t__11!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 3 )\n\n type = T__11\n channel = ANTLR3::DEFAULT_CHANNEL\n\n\n # - - - - main rule block - - - -\n # at line 9:9: ';'\n match(0x3b)\n\n\n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 3 )\n\n end", "title": "" } ]
bf74e855d44a31ceb982e6d9621504cd
returns a map from section to the users in that section
[ { "docid": "de898fb4a9c6f52b73b55ac01b1f8dd5", "score": "0.70358676", "text": "def students_by_section\n class_map = Hash.new{ |h,k| h[k] = [] }\n self.followers.includes([:section, :student_user]).each do |f|\n class_map[f.section] << f.student_user\n end\n class_map\n end", "title": "" } ]
[ { "docid": "031202ea29fb689fffe5e43da03a41ec", "score": "0.67438775", "text": "def users\n result_hash['usr']\n end", "title": "" }, { "docid": "454e38732a402fa8470169905f11ea13", "score": "0.6412522", "text": "def users\n Section.find_roles.pluck(:name).inject(Array.new) do |result, role|\n result += User.with_role(role, self)\n end.uniq\n end", "title": "" }, { "docid": "981cd4f813a8e9ddf4bb5a031746f122", "score": "0.6348279", "text": "def users_sections\n unless session[:mySections]\n session[:mySections] = []\n end\n session[:mySections]\n end", "title": "" }, { "docid": "9fa593f884aafb60bcfdeb3fd24d0c27", "score": "0.6289069", "text": "def users_by_function\n members.includes(:user, :functions).inject({}) do |h, m|\n m.functions.each do |r|\n h[r] ||= []\n h[r] << m.user\n end\n h\n end\n end", "title": "" }, { "docid": "9fa593f884aafb60bcfdeb3fd24d0c27", "score": "0.6289069", "text": "def users_by_function\n members.includes(:user, :functions).inject({}) do |h, m|\n m.functions.each do |r|\n h[r] ||= []\n h[r] << m.user\n end\n h\n end\n end", "title": "" }, { "docid": "d4b0fcf831e2d1807238f5949eded30a", "score": "0.6272213", "text": "def users_by_role\n members.includes(:user, :roles).where(\"name != 'Observateur'\").all.inject({}) do |h, m|\n m.roles.each do |r|\n h[r] ||= []\n h[r] << m.user\n end\n h\n end\n end", "title": "" }, { "docid": "44e656a224bd1a97a8f7291d7796e6e3", "score": "0.62407416", "text": "def users\n @users_by_href.values\n end", "title": "" }, { "docid": "e8e6627414c72ff68a5c600f5f2610b4", "score": "0.6093096", "text": "def index\n @user_sections = UserSection.all\n end", "title": "" }, { "docid": "aa92b4a0a2934b89c9cb09ac0a9b39cc", "score": "0.60425055", "text": "def users\n return [member_1, member_2];\n end", "title": "" }, { "docid": "893773d0909ec17ebed4828e6fa850d6", "score": "0.60054654", "text": "def users\n res = []\n url = data['links']['roleUsers']\n tmp = GoodData.get url\n tmp['associatedUsers']['users'].each do |user_url|\n user = GoodData.get user_url\n res << GoodData::Profile.new(user)\n end\n res\n end", "title": "" }, { "docid": "1884661e0ebb7406f44f875490be7f69", "score": "0.59417325", "text": "def core_user_get_users(criteria)\n params = {}\n\n counter = 0\n criteria.each do |key,value|\n params['criteria[' + counter.to_s + '][key]'] = key.to_s\n params['criteria[' + counter.to_s + '][value]'] = value\n counter += 1\n end\n\n response = request(params: params)\n\n if response['users']\n response['users'].map { |user| Hashie::Mash.new(user) }\n end\n end", "title": "" }, { "docid": "3ee5c64e091648ff0814d2f0da5f75a2", "score": "0.5928348", "text": "def core_user_get_users(criteria)\n params = {}\n\n counter = 0\n criteria.each do |key,value|\n params['criteria[' + counter.to_s + '][key]'] = key.to_s\n params['criteria[' + counter.to_s + '][value]'] = value\n counter = counter + 1\n end\n\n response = request(params)\n\n if response['users']\n users = response['users'].map { |user| Hashie::Mash.new(user) }\n end\n end", "title": "" }, { "docid": "b6da55942ad9f17fc9de3635416c0570", "score": "0.59027696", "text": "def users()\n\t\t\tusers = {}\n\t\t\t@table.items.where(:type => 'USER').each do |user_row|\n\t\t\t\tusers[user_row.attributes[:user_name]] = ServerUser.new(user_row.attributes[:user_name], @dynamo_table, user_row, @metadata, self)\n\t\t\tend\n\t\t\treturn users\n\t\tend", "title": "" }, { "docid": "3e8ceaeecc7f2d6e9f93e7ec8b8142ee", "score": "0.58677894", "text": "def students # Want: student id and student names on Users Table\n return User.joins(:sections).where(:sections => {:id => self.id}).all\n end", "title": "" }, { "docid": "4c9ea6becd1bd016b1ff99d2866ea03e", "score": "0.58663154", "text": "def transform_users\n Hash[@users.map { |name, entry| [name.intern, (yield name, entry)] }]\n end", "title": "" }, { "docid": "8ca4bc03a5cfdb47c728a1b5ef376781", "score": "0.5860471", "text": "def users_by_size\n map = {}\n for user in @size_data.values\n size = user[:size]\n map[size] ||= []\n map[size].push(user)\n end\n return map\nend", "title": "" }, { "docid": "7dc21be616dde33078e82cbc2a78a362", "score": "0.5836711", "text": "def get_sections_for_user(userId)\n @sections = Section.find(:all,:conditions => [\"userId = ?\", userId])\n return @sections\nend", "title": "" }, { "docid": "699a956b016d6c0b6374ba36d9b6e8e4", "score": "0.579245", "text": "def users\n recipes.map {|recipe| recipe.user}\n end", "title": "" }, { "docid": "a26344c3928ae8aac5f501c590201cfd", "score": "0.57746404", "text": "def get_students\n registrations.select{|r| !r.instructor}.map{|r| r.user}\n end", "title": "" }, { "docid": "0ab30913e9de156a06a1e3503ba1e9ef", "score": "0.5715496", "text": "def users\n @users.each_key.to_a\n end", "title": "" }, { "docid": "f3affc4bdbcce453cdb55387f3f1cc27", "score": "0.5709191", "text": "def users_by_team\n result = {}\n \n memberships.each do |membership|\n result[membership.team] ||= []\n result[membership.team] << membership.user.nickname\n end\n \n result\n end", "title": "" }, { "docid": "5669631820e571e539f8f2b531b77750", "score": "0.57084334", "text": "def users\n recipe_cards.map do |r|\n r.user\n end\n end", "title": "" }, { "docid": "51ea88ae77e5d78a3b7be4a9257e7a33", "score": "0.56569594", "text": "def users\n GroupMembers.new(:id => id).get.items\n end", "title": "" }, { "docid": "03d88aa38a733b48e87241478cea10c5", "score": "0.56226736", "text": "def extra_users_data_look_up\n return if @results.empty?\n\n tickets = DataStore.instance.tickets\n @results.each do |user|\n ticket_names = tickets.select { |t| t['assignee_id'] == user['_id'] }.map { |t| t['subject'] }\n user['tickets'] = ticket_names\n end\n end", "title": "" }, { "docid": "9c621b4e24d83b39d03e33ca8e31f599", "score": "0.5596488", "text": "def get_users input\n\t\t@users[input]\n\tend", "title": "" }, { "docid": "d17cc11339182478345743995ceb0ab3", "score": "0.55933434", "text": "def group_users(table)\n @group_users ||= {}\n @group_users[table] ||= User.where(id: group_user_ids(table)).to_a\n end", "title": "" }, { "docid": "aa6d6e11d4bbb22d9e5943af2bc0be9f", "score": "0.55926436", "text": "def users\n recipe_rc = RecipeCard.all.select {|rc| rc.recipe == self}\n # recipe_rc.map {|rc| rc.user}\n end", "title": "" }, { "docid": "b5db4b1477d7ed5213167945a3f7e6c9", "score": "0.55795103", "text": "def sorted_users\n _users_hash = Hash.new( 0)\n category_users.each{|_u| _users_hash[ _u] +=1 }\n _users_hash.sort {|u1,u2| u2[1] <=> u1[1]}.collect{|k,v| k}\n end", "title": "" }, { "docid": "3d6fe27174c65be428601d45f4bd9d77", "score": "0.55633956", "text": "def index # working\n @members = {}\n @channels = User.find(current_user.id).channels\n\n @channels.each do |channel|\n @members[channel.id] = channel.members\n end\n\n @members.keys.each do |channel_id|\n @members[channel_id] = @members[channel_id].map do |user|\n user.id\n end\n end\n end", "title": "" }, { "docid": "0c65e1e8f78a3729add2a9441bbaacb2", "score": "0.55551636", "text": "def friendgroups; user_details[\"friendgroups\"] end", "title": "" }, { "docid": "1132b72d113c8e9c8ef0a41e8b0c1789", "score": "0.5545284", "text": "def users\n\t\tusers = []\n\t\trooms.each do |room|\n\t\t\troom.users.each do |user|\n\t\t\t\tusers << user\n\t\t\tend\n\t\tend\n\t\tusers\n\tend", "title": "" }, { "docid": "6f05dd88ec712e50967bbe5ad439f47c", "score": "0.554219", "text": "def users\n @attributes[:users]\n end", "title": "" }, { "docid": "06bf7e444282be58866d8480e3a262bf", "score": "0.55320287", "text": "def by_my_tasks_section(tasks, project_gid)\n by_section = {}\n sections = client.sections.get_sections_for_project(project_gid: project_gid)\n sections.each_entry { |section| by_section[section_key(section.name)] = [] }\n tasks.each do |task|\n assignee_section = task.assignee_section\n current_section = section_key(assignee_section.name)\n by_section[current_section] ||= []\n by_section[current_section] << task\n end\n by_section\n end", "title": "" }, { "docid": "77029986784307ad5c00877216ea51f8", "score": "0.5525289", "text": "def list_user_ids(opts = {})\n @transporter.read(:GET, '/1/clusters/mapping', {}, opts)\n end", "title": "" }, { "docid": "001c5998178306eb092c2c7c20f45cdf", "score": "0.5524934", "text": "def userids\n metadata[\"userids\"]\n end", "title": "" }, { "docid": "fa1c93e13810b94db57d0ed71ae57ef4", "score": "0.5485238", "text": "def users\n records do |instance|\n instance['users'] = user.where('organization_id': instance['_id'])\n end\n end", "title": "" }, { "docid": "09d3df69f728ab294c2ea9500e06f7a4", "score": "0.5485017", "text": "def sections\n account.accessible_sections if account\n end", "title": "" }, { "docid": "a7e3c0f31e8853887333b70e3621aa4e", "score": "0.54820335", "text": "def sections\n @sections.values\n end", "title": "" }, { "docid": "8bf0f4bd0583f924bd0f185ea37cc715", "score": "0.5479291", "text": "def users\n @circle.keySet.to_a\n end", "title": "" }, { "docid": "28675d6631e83ee0dd0f0a283a4537bb", "score": "0.5460328", "text": "def org_users\n synchronize { return @org_users if @org_users }\n\n users = {}\n orgs = settings.github_orgs || []\n orgs.each do |org|\n octokit.organization_members(org).each do |user|\n if users.has_key?(user.login)\n users[user.login][:orgs] << org\n else\n users[user.login] = user.to_h\n users[user.login][:mfa_enabled] = true\n users[user.login][:orgs] = [org]\n end\n end\n end\n orgs.each do |org|\n octokit.organization_members(org, filter: '2fa_disabled').each do |user|\n users[user.login][:mfa_enabled] = false\n end\n end\n\n synchronize { @org_users = users }\n end", "title": "" }, { "docid": "ff6ae0b3f8b00934487f1fe32c8d4b40", "score": "0.5459947", "text": "def get_student_section_columns_hash(students)\n students.inject({}) do |map, student|\n map[student[:student_id]] = section_columns_hash(student[:sections])\n map\n end\n end", "title": "" }, { "docid": "a0f2f7d52204eaec0d71ee333a059ef0", "score": "0.5449962", "text": "def user_member_ids\n member_ids(\"User\")\n end", "title": "" }, { "docid": "0ee2403cd2cc08f27cb480af9c7284ea", "score": "0.5445858", "text": "def meta_data\n u_ids = object.message_status.user_ids\n {\n read_by_count: u_ids.count,\n read_by: User.select(:id,:name,:last_name).where(\"users.id IN (?)\",u_ids).map {|u| {id: u.id,name: full_name(u.name,u.last_name)}},\n is_read: object.read\n }\n end", "title": "" }, { "docid": "a88df2f93452cd994245ab998691bd0b", "score": "0.5439888", "text": "def sections\n @sections ||= @account.sections\n end", "title": "" }, { "docid": "b5bede8a1968832dd8e8822171bb2536", "score": "0.54367095", "text": "def name_and_role\n instructors.map do |instructors_hash|\n {instructors_hash[:name] => instructors_hash[:role]}\n end\nend", "title": "" }, { "docid": "281d07fdf1f24185f16859fdc8c66028", "score": "0.54275316", "text": "def get_user_data(users, username)\n user_array = []\n users.each do |user|\n if user['username'] == username\n user_array << user['name']\n user_array << user['username']\n user_array << user['password']\n user_array << user['admin']\n end\n end\n return user_array\nend", "title": "" }, { "docid": "c252769230a4a8b49e7f996d90a274b8", "score": "0.5425378", "text": "def find_user (map)\n user = []\n for i in 0..map.length-1\n for j in 0..map.length-1\n if map[i][j] == \" U \"\n user = [i,j]\n end\n end\n end\n user\n end", "title": "" }, { "docid": "41eda8061ad388dbaf369320a7025108", "score": "0.5421119", "text": "def get_all_users(spec)\n user = spec.or_contributors_to_spec\n if @users.include? user\n @numbers[user] = @numbers[user] + 1\n else\n @users.add user\n @numbers[user] = 1\n end\nend", "title": "" }, { "docid": "c1d3da8522401d06a1c6c4897ac37647", "score": "0.54170454", "text": "def user_info\n {\n 'uid' => user_hash['feed']['author'][0]['email']['$t'],\n 'nickname' => user_hash['feed']['author'][0]['name']['$t']\n }\n end", "title": "" }, { "docid": "be172581d3e89fddecbfdf9a39fb268d", "score": "0.54167867", "text": "def visible_sections(user)\n user.filter_sections(sections).select { |s| s.lecture.visible_for_user?(user) }\n end", "title": "" }, { "docid": "7f78e9ab0f32edc6b783c0b11f4ac34a", "score": "0.5415338", "text": "def users\n users = []\n if current_user.lead?\n users = object.users.select { |u| u.id != current_user.id }\n users = users.unshift(current_user)\n elsif current_user.dev?\n vms_v = object.vms.select { |vm| vm.is_jenkins }\n users = vms_v.flat_map(&:user).uniq.select { |u| u.id != current_user.id }\n users = users.unshift(current_user)\n else\n users <<= current_user\n end\n users.map { |u| u.id }\n end", "title": "" }, { "docid": "327ec1cb79eda708bdc1dab70c64543a", "score": "0.5415165", "text": "def user_group_general_info_hash\n wait_until_bus_section_load\n array = general_info_spans.map{ |span| span.text }\n Hash[*array]\n end", "title": "" }, { "docid": "528ded2c18f157483b274aaa18b555dc", "score": "0.5412438", "text": "def user_info\n {\n 'uid' => user_hash['feed']['author'][0]['email']['$t'],\n 'nickname' => user_hash['feed']['author'][0]['name']['$t'],\n }\n end", "title": "" }, { "docid": "92b307dff3288dd4900cfe83f1d3b6a5", "score": "0.54101014", "text": "def user_info\n {\n 'nickname' => user_hash['NickName'],\n 'name' => user_hash['NickName']\n }\n end", "title": "" }, { "docid": "4454a2b9648aea934a63edb86b7b5b67", "score": "0.54041076", "text": "def users\n res = []\n\n tmp = GoodData.get @json['project']['links']['users']\n tmp['users'].map do |user|\n res << GoodData::Membership.new(user)\n end\n\n res\n end", "title": "" }, { "docid": "f127d10b4ead781b696ea6bdd1fc7adf", "score": "0.54006696", "text": "def users\n\t\tRecipeCard.all.map do |recipe_card| \n\t\t\tif recipe_card.recipe == self \n\t\t\t\trecipe_card.user \n\t\t\tend\n\t\tend.compact\n\tend", "title": "" }, { "docid": "f2dfa0c154eb5478cd7900f4a0191bda", "score": "0.5397415", "text": "def users()\n\t\t\t\tusers = UserList.new()\n\n if dscl?\n # The dscl version is still limited\n idlist = `#{DSCLBIN} . -list /Users UniqueID`\n grouplist = `#{DSCLBIN} . -list /Users PrimaryGroupID`\n idlist.each do | line |\n user = UserInfo.new()\n name,id = line.split\n user.username = name\n user.uid = id.to_i\n users[name] = user\n end\n else\n # get the list of users using niutil\n textlist = `niutil -list . /users`\n textlist.each() { |line|\n line.strip!()\n user = UserInfo.new()\n user.username = line[/^[0-9]+\\s+(\\S+)$/, 1]\n userlist = `niutil -read . /users/#{user.username}`\n userlist.each() { |subline|\n subline.strip!()\n case(subline)\n when(/^home:/)\n user.homedir = subline[/:\\s*(.*)$/, 1]\n when(/^uid:/)\n user.uid = subline[/:\\s*(.*)$/, 1].to_i()\n when(/^gid:/)\n user.gid = subline[/:\\s*(.*)$/, 1].to_i()\n when(/^realname:/)\n user.fullname = subline[/:\\s*(.*)$/, 1]\n end\n }\n users[user.username] = user\n }\n end\n\t\t\t\treturn(users)\n\t\t\tend", "title": "" }, { "docid": "31d654ba030598c3433f34891883d11f", "score": "0.53971887", "text": "def users\n\t\tproficiencies_by_type(\"User\")\n\tend", "title": "" }, { "docid": "00286cedcf806ab4891fa451623b8a05", "score": "0.5395789", "text": "def users\n self.recipe_cards.map {|recipe_card| recipe_card.user}\n end", "title": "" }, { "docid": "03accda4cf1a3da53c54b230ee2611a6", "score": "0.5395494", "text": "def usernames\n @attributes[:usernames]\n end", "title": "" }, { "docid": "03accda4cf1a3da53c54b230ee2611a6", "score": "0.5395494", "text": "def usernames\n @attributes[:usernames]\n end", "title": "" }, { "docid": "3f6727ac7eb6ef231d0d99aeb76c58bc", "score": "0.5391751", "text": "def users\n User.where(network_id: context[:current_network]&.id)\n end", "title": "" }, { "docid": "eabfbd92c42291a63fe9ec1d9e5bbf62", "score": "0.539051", "text": "def users\n get(:users)['Users'].map do |details|\n User.new(details['Url'], party: self, details: details)\n end\n end", "title": "" }, { "docid": "38c3efa108d5fc780ce02f7f9b224843", "score": "0.53734004", "text": "def list\n get('users')['users']\n end", "title": "" }, { "docid": "80c0cfc0e63688ee7a8dd4ae7ed83dae", "score": "0.5369383", "text": "def all\n xml_doc.xpath('/MediaContainer/User').map {|n| [n['email'],n['username']] }\n end", "title": "" }, { "docid": "4326a9b1bba9d1b39c6e0a34ed95caa1", "score": "0.53548265", "text": "def users\n # TODO use SQL\n results = self.approvers + self.observers + [self.requester]\n results.compact\n end", "title": "" }, { "docid": "a910f51022b28947cb7386893eb66f4a", "score": "0.53500825", "text": "def instructors\n course_enrollments.where(course_role: CourseRole.instructor).map(&:user)\n end", "title": "" }, { "docid": "5f4fe8aa7fa1886a10da7e590e5ba79c", "score": "0.53453296", "text": "def users\n my_recipe_cards.map do |recipecard|\n recipecard.user\n end\n end", "title": "" }, { "docid": "ca23c37a03b2027a210bd9d525192e52", "score": "0.5333744", "text": "def users\n Ecore::User.where(\"group_ids LIKE '%#{id}%'\").all\n end", "title": "" }, { "docid": "a703451c795c44fadd51399d5d7cb732", "score": "0.5333044", "text": "def users_and_groups\n return @users_and_groups\n end", "title": "" }, { "docid": "c8ea725e9f3879d4564dde64dad854f4", "score": "0.5326231", "text": "def category_users\n images.collect{|e| e.user}\n end", "title": "" }, { "docid": "5af1611d1b434c420f047fddad3367b9", "score": "0.53231347", "text": "def sections\n temp_sections = []\n if @section_ids.count > 0\n @section_ids.each do |section_id|\n temp_sections.push @client.section(@org_id, section_id)\n end\n end\n return temp_sections\n end", "title": "" }, { "docid": "f32f8c856e828e2f6b5cb729e5850b8b", "score": "0.53219503", "text": "def users\n RecipeCard.all.select { |c| c.recipe == self }.map { |c| c.user }\n end", "title": "" }, { "docid": "1e8f7e88c0552208f106228ca7a8eba2", "score": "0.53200877", "text": "def users\n return @users_array\n \tend", "title": "" }, { "docid": "46ce8ace49244e4b02e048e41fea7c3a", "score": "0.5319303", "text": "def sections\n @data.keys\n end", "title": "" }, { "docid": "f73e19b4b0cb672577eaf05b2f291fb1", "score": "0.53188705", "text": "def user_ids \n @user_ids ||= input[\"users\"].map{|user| user[\"id\"]}\nend", "title": "" }, { "docid": "780901daea680c446560ae8df553edc4", "score": "0.53183085", "text": "def index\n @user_to_roles = UserToRole.all\n @users = Hash.new { |h, k| h[k] = Array.new}\n UserToRole.joins(:user, :role).map do |row|\n @users[row.user] << row.role.name\n end\n end", "title": "" }, { "docid": "149d0fedd07a38c8ece5577548d787c5", "score": "0.53148246", "text": "def user_data(filename)\n user_data = CSV.read Dir.pwd + filename\n descriptor = user_data.shift\n descriptor = descriptor.map { |key| key.to_sym }\n user_data.map { |user| Hash[ descriptor.zip(user) ] }\n end", "title": "" }, { "docid": "7f3e6d7c5fb989fdd66c8785cb4c4243", "score": "0.53131664", "text": "def associates_list()\n\t\tassocs = Contract.associates_for(current_user()).all.inject([]) \\\n\t\t\t{ |ret, assoc| ret << ([assoc.username, assoc.id] unless assoc.id == 2) }.compact\n\tend", "title": "" }, { "docid": "d151a0661112eb0f6a774adc87f646c3", "score": "0.5304506", "text": "def parse_user search\n Hash[*search.split(',').map{|pair| pair.split('=').values_at(0..1)}.flatten]['uid']\n end", "title": "" }, { "docid": "b114db6332789c82e3fb7c12c84dc991", "score": "0.53042895", "text": "def users\n if @group\n @users ||= @group.users.tracking_enabled.with_waypoints.order(:name)\n else\n @users ||= User.tracking_enabled.with_waypoints.order(:name)\n end\n end", "title": "" }, { "docid": "ead423953f9f439cf80a29516aa33c1b", "score": "0.53017765", "text": "def users\n category_users.uniq\n end", "title": "" }, { "docid": "d19ccdf1b90569bdccf4af078b0dece3", "score": "0.5299704", "text": "def user_info\n {\n 'nickname' => user_hash['Nickname'],\n 'first_name' => user_hash['FirstName'],\n 'last_name' => user_hash['LastName'],\n 'name' => [user_hash['FirstName'], user_hash['LastName']].reject{|n| n.nil? || n.empty?}.join(' '),\n }\n end", "title": "" }, { "docid": "4a097fe4a74766add3a07771d3a83edb", "score": "0.52983403", "text": "def show_Users\n theUsers = User.select{ |user| user.group_id == self.id}\n theUsers\n end", "title": "" }, { "docid": "c8eb20c2ccfe02900353915ef0e9a206", "score": "0.52763695", "text": "def sections\n result = @nsx_client.get(@url_sections)\n result['results']\n end", "title": "" }, { "docid": "855d5eb587941716baf0613258841e5e", "score": "0.52761245", "text": "def sites_list\n hash = {}\n self.div(:id=>\"profilesection_generalinfo\").divs.each do |div|\n if div.id=~/profilesection_section_\\d{2,}/\n hash.store(div.text_field(:title=>\"Site\").text, div.text_field(:title=>\"URL\").text)\n end\n end\n return hash\n end", "title": "" }, { "docid": "01ea2d253600b7b496f29bba999d8732", "score": "0.5272313", "text": "def curator_list\n users.map(&:email)\n end", "title": "" }, { "docid": "275c0c1386a2e5704613f409a252e37c", "score": "0.5268809", "text": "def user_hash\n @user_hash ||= MultiJson.decode(@access_token.get('/services/api/json/1.2.2/?method=smugmug.auth.checkAccessToken').body)['Auth']['User']\n end", "title": "" }, { "docid": "2e49aae135273bae3f70560999bd4f4a", "score": "0.52652097", "text": "def members\n users\n end", "title": "" }, { "docid": "2e49aae135273bae3f70560999bd4f4a", "score": "0.52652097", "text": "def members\n users\n end", "title": "" }, { "docid": "f2d1fac53f78144d6c308734ebb98423", "score": "0.52650595", "text": "def get_user_info()\n return_map = nil\n if session[:google_unique] != nil && user_credentials.access_token != nil\n return_map = {}\n return_map['email'] = session[:googleemail]\n return_map['sub'] = session[:google_unique]\n return_map['useralias'] = session[:useralias]\n end\n return return_map\nend", "title": "" }, { "docid": "8951e92bc61451f30132385ff21480f1", "score": "0.52578986", "text": "def users_ids\n object.member_ids\n end", "title": "" }, { "docid": "ccff99da841deefa812665cb22fafcbe", "score": "0.5248285", "text": "def users\n @users ||= rows.map { |r| UserImport::User.new(r) }\n end", "title": "" }, { "docid": "14e8a57b1b9ae7ff968d38b5600b337d", "score": "0.5246927", "text": "def associated_users(permission: nil)\n owner = self.user\n shares = permission.present? ? self.study_shares.where(permission: permission) : self.study_shares\n share_users = shares.map { |share| User.find_by(email: /#{share.email}/i) }.compact\n [owner] + share_users\n end", "title": "" }, { "docid": "91cde81c574814dce0902a561ca4d612", "score": "0.5245399", "text": "def users\n result = Rails.cache.read([:ibiza, id, :users])\n get_users_only_once if result.nil?\n result\n end", "title": "" }, { "docid": "a96ed9ce8e0cd7ca5addf9d4c34b0573", "score": "0.52424455", "text": "def get_name_and_location\n @top_ten.each do |user|\n user_details = self.class.get(\"/users/#{user[0]}\").parsed_response\n user << user_details[\"name\"]\n user << user_details[\"location\"]\n end\n end", "title": "" }, { "docid": "bf305ae5b6143cb5d2798e2466088d72", "score": "0.52367157", "text": "def get_users\n res = search(@config[:userdn])\n \n if (res[:message] != \"Success\")\n # tbd handle error\n return nil\n end\n \n if (res[:values] == [])\n return nil\n end\n \n users = []\n \n res[:values].each do |user|\n begin\n uid = user.uidnumber.first\n gid = user.gidnumber.first\n rescue\n uid = 0\n gid = 0\n end\n \n users << {\n :username => user.uid.first,\n :uid => uid,\n :gid => gid,\n :first => user.givenname.first,\n :last => user.sn.first\n }\n end\n \n return users\n end", "title": "" }, { "docid": "4ac3e7a1d363d31b982c9be9889b76d2", "score": "0.52351546", "text": "def users(*room_names)\n users = Hpricot(get.body).search(\"div.room\").collect do |room|\n if room_names.empty? || room_names.include?((room/\"h2/a\").inner_html)\n room.search(\"//li.user\").collect { |user| user.inner_html }\n end\n end\n users.flatten.compact.uniq.sort\n end", "title": "" }, { "docid": "b3376164c36186f3a0b00672df3d5b32", "score": "0.5233149", "text": "def names\n @users.values.map(&:name)\n end", "title": "" }, { "docid": "5ef55679e2da94f440a899ab57d4d001", "score": "0.52325183", "text": "def user_data_from_results(res, username, key)\n users = res['users']\n users.each do |user|\n return user[key] if user['name'] == username\n end\n nil\n end", "title": "" } ]
c4eda072a6b3519b02e58bbea37785df
Create a new user
[ { "docid": "a80debea1e3e43d82eb9c485b7e910e7", "score": "0.7980625", "text": "def create\n @user = User.new(user_attributes)\n if @user.save\n created(@user)\n else\n validation_errors(@user)\n end\n end", "title": "" } ]
[ { "docid": "542b142dd9e7366ef81150fc7aaeb808", "score": "0.82948214", "text": "def create\n\t\t\t\t@user = User.create!(create_user_params)\n\t\t\tend", "title": "" }, { "docid": "71d4ce23424967b5aa36dcaa1b2da993", "score": "0.8284585", "text": "def create_user\n User.create name: \"test\", email: \"test@example.com\", password: \"123456\"\n end", "title": "" }, { "docid": "862cac6f52e9eecfd76924fb02b6ec55", "score": "0.8250587", "text": "def create_user\n User.create name: 'test', email: 'test@example.com', password: '123456'\n end", "title": "" }, { "docid": "9001a1e7cf8986de1cac261f343d1d34", "score": "0.821524", "text": "def create_user\n params = {\n :client_id => Swiftype.platform_client_id,\n :client_secret => Swiftype.platform_client_secret\n }\n post(\"users.json\", params)\n end", "title": "" }, { "docid": "99475e3c4ae3f8e979e49bc56be14a31", "score": "0.81598026", "text": "def create_user(options = {})\n post \"/users\", options\n end", "title": "" }, { "docid": "808135375b38d1dca67591c4e04fe4ee", "score": "0.80994177", "text": "def create_user(attributes)\n BrickFTP::API::User.create(attributes)\n end", "title": "" }, { "docid": "808135375b38d1dca67591c4e04fe4ee", "score": "0.80993736", "text": "def create_user(attributes)\n BrickFTP::API::User.create(attributes)\n end", "title": "" }, { "docid": "cbf5f004b4d0847e807a72622daf3347", "score": "0.8040818", "text": "def new_user\n User.new({\n email: 'hoge@hoge',\n password: 'hoge',\n password_confirmation: 'hoge'\n })\n end", "title": "" }, { "docid": "0b19e6daa9d74be5920165f5dc93bc63", "score": "0.8033829", "text": "def create_user\n User.create name: 'test', email: 'test@example.com', password: '123456'\n end", "title": "" }, { "docid": "8d867f3cc5dbeb97bd019127efe59771", "score": "0.79476595", "text": "def create\n user = User.new(user_params)\n msg = if user.save\n 'User has successfully created.'\n else\n set_error(:unprocessable_entity, user)\n end\n common_response(msg, user: user)\n end", "title": "" }, { "docid": "3863c9164261d5695df93f09f4b3372e", "score": "0.79409075", "text": "def create_user(name, email, password)\n\n # Password is hashed automatically\n user = User.new(name: name, email: email, password: password)\n user.save!\n end", "title": "" }, { "docid": "ffecf21578b5c3a13103c9111e0c655a", "score": "0.79358286", "text": "def create_user(params:)\n parse(JSON.parse(connection.post(\"users\", params.to_json).body))\n end", "title": "" }, { "docid": "ca4bab0639b1dc2b049ef2f9b99d01ed", "score": "0.792977", "text": "def new_user(name)\n User.create(name: name)\nend", "title": "" }, { "docid": "710d6c6e047537342e45cfdf9519e16e", "score": "0.7929295", "text": "def create_new_user\n username = find_username\n @user = User.new(\n email: auth_email,\n username: username,\n password: Devise.friendly_token[0, 20]\n )\n @user.skip_confirmation!\n @user.save!\n\n @user\n end", "title": "" }, { "docid": "96eadffe7e98d455227b403377eb0731", "score": "0.79115295", "text": "def create_user(options={})\n\t\t\tUser.create({\n\t\t\t\tusername: \"user example\",\n\t\t\t\temail: \"example@email.com\",\n\t\t\t\tpassword: \"password\",\n\t\t\t\tpassword_confirmation: \"password\"\n\t\t\t}.merge(options))\n\t\tend", "title": "" }, { "docid": "5026cc3fb352bc3067979ddf0baf58b1", "score": "0.79087037", "text": "def create\n @user = User.new(params[:user])\n if @user.save\n redirect_to users_path\n else\n redirect_to new_user_path\n end\n end", "title": "" }, { "docid": "d1b1e08076d73ae67cf739e39a3840bc", "score": "0.7900655", "text": "def create\n name = params[:name]\n email = params[:email]\n password = params[:password]\n new_user = User.create!(\n name: name,\n email: email,\n password: password,\n )\n\n response = \"Hey #{name}, You are registered successfully!\"\n render plain: response\n end", "title": "" }, { "docid": "0ca14f202b86917ac636752c5f28c307", "score": "0.7884614", "text": "def new_user_create\n @user = User.create_user(user_params, current_user.account_id) # New User\n begin\n @user.save!\n @users = User.get_all(current_user.account_id)\n flash[:success] = \"User was created successfully!\"\n rescue => e\n flash[:alert] = \"User creation failed!\"\n end \n end", "title": "" }, { "docid": "28024810fc31ffb6c62cf708ba430bdb", "score": "0.78796273", "text": "def create_user(user_hash={})\n @user = User.new(user_hash)\n @user.save\n end", "title": "" }, { "docid": "28024810fc31ffb6c62cf708ba430bdb", "score": "0.78796273", "text": "def create_user(user_hash={})\n @user = User.new(user_hash)\n @user.save\n end", "title": "" }, { "docid": "a6c3299e86d752e4c810063618f69dad", "score": "0.78733623", "text": "def create\n\t\t@user = User.new(user_params)\n\t\tif @user.save\n\t\t\tredirect_to sign_in_path\n\t\telse\n\t\t\tredirect_to sign_up_path\n\t\tend\n\tend", "title": "" }, { "docid": "ff9a99af4cafaa0816527d033b637245", "score": "0.78662676", "text": "def create\n # Note this is different to the usual situation where anybody can create\n # an account. Here, only administrators can create accounts for others;\n # and doing so does not log them out.\n unless current_user.admin?\n flash[:error] = \"Users can only be created by administrators.\"\n redirect_to (request.env[\"HTTP_REFERER\"] || root_path) and return\n end\n \n @user = User.new(params[:user])\n success = @user && @user.save\n if success && @user.errors.empty?\n # Protects against session fixation attacks, causes request forgery\n # protection if visitor resubmits an earlier form using back\n # button. Uncomment if you understand the tradeoffs.\n # reset session\n redirect_to users_path\n flash[:notice] = \"The account #{ERB::Util.h @user.login} has been setup for #{ERB::Util.h @user.name}.\"\n else\n flash.now[:error] = \"We couldn't set up that account, sorry.\"\n render :action => 'new'\n end\n end", "title": "" }, { "docid": "f5e866648c114d8c6859e49637b248fd", "score": "0.7863431", "text": "def create\n @user = User.new_user(params[:user])\n @user.attributes.each do |attr, val|\n logger.debug(\"attr: #{attr}, val: #{val}\")\n end\n\n if @user.save\n flash[:success] = \"Successfully created account, please sign in\"\n redirect_to login_path\n else\n flash[:warning] = \"Couldn't process the user\"\n render action: \"new\"\n end\n\n end", "title": "" }, { "docid": "e4418e88bea01fe00f71828b92da5196", "score": "0.78529954", "text": "def create\n user = User.new(user_params)\n if user.save\n render json: {status: \"Se creo el usuario\"}, status: :ok\n else\n render json: {status: \"Error al crear el usuario\", errors: user.errors }, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "b9153c4a5c454d148a46ad10fa635653", "score": "0.7838719", "text": "def create\n @user = User.new(user_params)\n\n # save was requested by either current_user or else must be a new registration\n if @user.save(current_user)\n redirect_to users_path\n else\n render('new', status: :unprocessable_entity)\n end\n end", "title": "" }, { "docid": "83b051fa40b82e70e621af0d23c79b31", "score": "0.78349817", "text": "def create_user(body)\n post 'create_user', body\n end", "title": "" }, { "docid": "be577e7ebb75b1c05785a0eb7130abdd", "score": "0.78235275", "text": "def create\n\n @new_user = User.new\n\n new_user = @new_user.add(params['user_name'], params['pswd1'], params['email'], params['full_name'])\n\n if new_user.errors.any?\n redirect_to \"/\", :flash => { :error => 'User already exists'}\n else\n redirect_to \"/main\"\n end\n end", "title": "" }, { "docid": "b1bdadcd6efdd2e888423fe86b3243f2", "score": "0.78105766", "text": "def new_user(username, password, full_name, email)\n representation = form_encoded({ \"user[name]\" => username,\n \"user[password]\" => password,\n \"user[full_name]\" => full_name,\n \"user[email]\" => email }) \n puts representation\n begin\n response = open(@service_root + '/users', :method => :post, \n :body => representation)\n puts \"User #{username} created at #{response.meta['location']}\"\n rescue OpenURI::HTTPError => e\n response_code = e.io.status[0].to_i\n if response_code == \"409\" # Conflict\n puts \"Sorry, there's already a user called #{username}.\"\n else\n raise e\n end\n end\n end", "title": "" }, { "docid": "fb67c9039fc8e660706a8f0993559ea5", "score": "0.7806395", "text": "def create\n user = User.new(user_params)\n if user.save\n auth_token = AuthenticateUser.new(user.email, user.password)\n .call\n # send email using welcome template\n UserMailer.welcome_email(user).deliver_now\n response = { message: Message.account_created, token: auth_token }\n json_response(response, :created)\n else\n json_response(user.errors, :unprocessable_entity)\n end\n end", "title": "" }, { "docid": "c9d03b46a26fde8ba50950f7a152a98c", "score": "0.77932465", "text": "def create user_name\n response = @client.action \"RegisterUser\", \"Name\" => user_name\n\n Response::User.new response.body['RegisterUserResponse']\n end", "title": "" }, { "docid": "113ad64367c0c0319d9bf8d161997e27", "score": "0.77799803", "text": "def create\n @user = User.new(user_params)\n if @user.save\n\n redirect_to edit_user_path(@user.id)\n else\n redirect_to sign_up_path\n end\n end", "title": "" }, { "docid": "891e45751e0229e93d4ee54154f0d264", "score": "0.77716565", "text": "def create\n\t\t@user = User.new(user_params)\n\t\t# If user was save with succes, then sign in automaticly, else, render new.\n\t\tif @user.save\n\t\t\tsign_in @user\n\t\t \tflash[:sucess] = \"Seja bem-vindo!\"\n\t\t\tredirect_to :action => :show, :id => @user.id\n\t\t\tCUSTOM_LOGGER.info(\"Created and associated user to params #{@user.to_yaml}\")\n\t\telse\n\t\t\trender 'new'\n\t\t\tCUSTOM_LOGGER.error(\"Not created and associated user to params #{@user.to_yaml}\")\n\t\tend\n\tend", "title": "" }, { "docid": "98283e5ce84cebb015a858d2b2dd594e", "score": "0.776607", "text": "def create\n first_name, last_name, email, password = *params.values_at(:first_name, :last_name, :email, :password)\n\n if [first_name, last_name, email, password].any?(&:blank?)\n return render_success({status:\"error\", message: 'invalid create parameters'})\n end\n\n #User already exists\n if User.exists?(email: email.downcase)\n return render_success({status:\"error\", message:\"user already exists\"})\n end\n #create user\n User.transaction do\n @user = User.new(\n name: (first_name + \" \" + last_name).titleize,\n email: email.downcase,\n password: password,\n password_confirmation: password\n )\n if @user.save!\n render_success({status:\"success\", message:\"created\"})\n else\n render_success({status:\"error\", message:\"user creation failed\"})\n end\n end\n end", "title": "" }, { "docid": "5418ee7a06c663a17c1a799472c13057", "score": "0.776567", "text": "def create\n @user = User.new(user_to_be_created)\n\n error = @user.validate_user?\n\n if error.nil? && @user.save\n handler_notice('Usuário cadastrado com sucesso!', login_path)\n else\n handler_notice_error(error, new_user_path)\n end\n end", "title": "" }, { "docid": "177e164c5684580ef9bc51553b67f146", "score": "0.7753614", "text": "def createUser(nickname) \n usr = User.new(nickname)\n backend_addUser(usr) \n end", "title": "" }, { "docid": "a9cdff60a31fa643a4dd8ebf0b415c6b", "score": "0.77508557", "text": "def create\n @user = User.create! user_params\n logger.info \"New User with id #{@user.id} has been saved.\"\n #\n # log-in the user immediately after sign-up\n # issue a refresh token with that the\n # user will request an access token.\n set_refresh_token @user\n render :show, status: :created\n end", "title": "" }, { "docid": "50e7e5de18451e4dd29a10b09bdfb03e", "score": "0.77492076", "text": "def create\n @user = User.new(params[:user])\n\n if @user.save\n flash[:notice] = t('users.create.notice')\n redirect_to users_path\n else\n render :action => \"new\"\n end\n end", "title": "" }, { "docid": "cbd2b31528aef6870d6506a85a8fd797", "score": "0.7747492", "text": "def create_user\n @user = User.new(params[:user])\n @user.save\n \n redirect_to :action => :users\n end", "title": "" }, { "docid": "928f2759ebbd272628eb25ce71301b9a", "score": "0.7746239", "text": "def create_user\n fake_password = Faker::Internet.password\n params = {\n user: {\n username: Faker::Internet.user_name,\n email: Faker::Internet.email,\n password: fake_password,\n password_confirmation: fake_password\n }\n }\n post signup_post_url, { params: params }\n params[:user]\n end", "title": "" }, { "docid": "b6aeb17c9f32dd8dd9a26bd3750d1f4c", "score": "0.7744911", "text": "def create_user(attributes)\n post(\"/v1/users\", attributes)\n end", "title": "" }, { "docid": "8561b6dc598b2e6ff2352b86b5e0b307", "score": "0.77422553", "text": "def create_user(options = {})\n post :create, {:user => { :name => 'quire', :point_value => \"2\", :login => 'quire', :email => 'quire@example.com',\n :password => 'quire', :password_confirmation => 'quire' }.merge(options)}, {:user_id => \"1\"}\n end", "title": "" }, { "docid": "9f2be9f2ff6c15672dbabf749238ca25", "score": "0.77291715", "text": "def create\n user = User.create(user_params)\n render json: user, message: 'user succefully create', status: 200\n end", "title": "" }, { "docid": "98aa0b0c9997dbaccbb2dd813ba123f4", "score": "0.7727039", "text": "def create_user(**args)\n params = parameters(args) do\n required_params :name, :email, :active_flag\n optional_params :name, :email, :active_flag\n end\n request(:post, 'users', params)\n end", "title": "" }, { "docid": "740ce8be835dc3171f04b9289fd8b472", "score": "0.7725821", "text": "def create\n user = User.new(user_params)\n if user.save\n render json: {status: 200, msg: 'User was created.'}\n else\n render json: {errors: user.errors.messages}\n end\n end", "title": "" }, { "docid": "a0c09f30164e4302bceaf2d436ec5650", "score": "0.7725207", "text": "def create\n user = User.new(\n first_name: params[:first_name],\n last_name: params[:last_name],\n email: params[:email],\n password: params[:password]\n )\n if user.save\n session[:current_user_id] = user.id\n redirect_to \"/\"\n else\n flash[:error] = user.errors.full_messages.join(\". \")\n redirect_to new_user_path\n end\n end", "title": "" }, { "docid": "6ddf14960e61aeb2a87e8a1e74233f9a", "score": "0.7724128", "text": "def create_user(options = {})\n\t\trecord = Factory.build(:user,options)\n\t\trecord.save\n\t\trecord\n\tend", "title": "" }, { "docid": "6ddf14960e61aeb2a87e8a1e74233f9a", "score": "0.7724128", "text": "def create_user(options = {})\n\t\trecord = Factory.build(:user,options)\n\t\trecord.save\n\t\trecord\n\tend", "title": "" }, { "docid": "f451a2253cb283a65d5eb95f9040507c", "score": "0.77177507", "text": "def create\n\t\tuser_params = params.require(:user).permit(:first_name, :last_name, :email, :password)\n\t\t@user = User.create(user_params)\n\t\tlogin(@user) #log in user\n\t\tredirect_to \"/users/#{@user.id}\" #go to show\n\tend", "title": "" }, { "docid": "1942f8a657dc406b642bce781669185a", "score": "0.7714318", "text": "def create\n\t\t@user = User.new(params[:user])\n\t\tif @user.save\n\t\t\tredirect_to root_url, notice: \"Added new user to the database\"\n\t\telse\n\t\t\trender \"new\"\n\t\tend\n\tend", "title": "" }, { "docid": "21fd8737bffe29940c47ac50b6ccc2a0", "score": "0.7712338", "text": "def createNewUser(userName, initialGroup, userEmail, fname, lname, password)\n\n password = password.encrypt\n user = {\"login\" => userName,\n \"group0\" => initialGroup,\n \"email\" => userEmail,\n \"fname\" => fname,\n \"lname\" => lname,\n \"password\" => password,\n \"orga\" => \"0\"}\n saveUser(userName, user)\n end", "title": "" }, { "docid": "bd890d3642d641179007199784ae10c7", "score": "0.7712321", "text": "def new_user\n\t @user = User.new\t \n\tend", "title": "" }, { "docid": "2c5b9b7acb9b23d732d819970921969b", "score": "0.7711755", "text": "def create\n\t\t@user = User.new(user_params)\n\t\t\n\t\tif @user.save\n\t\t\tredirect_to users_path\n\t\telse\n\t\t\trender 'new'\n\t\tend\n\tend", "title": "" }, { "docid": "ba4ed9e9344eb8357b34e882f197e8f6", "score": "0.7711385", "text": "def create_user\n\t \to = [('a'..'z'), ('1'..'9')].map { |i| i.to_a }.flatten\n\t \tstring = (0...9).map { o[rand(o.length)] }.join\n\t \t@user = User.create( username: params[:user][:username],password: string ,rol: params[:user][:rol], name: params[:user][:name], carrier: params[:user][:carrier], email: params[:user][:email], landline: params[:user][:landline], cell_phone: params[:user][:cell_phone], container: params[:user][:cell_phone], liquid_charge: params[:user][:liquid_charge], dry_charge: params[:user][:dry_charge] )\n\t \trespond_to do |format|\n\t \t\tif @user.save\n\t \t\t\tflash[:notice] = 'Se ha creado un nuevo usuario'\n\t \t\t\tformat.html { redirect_to users_path }\n\t \t\t\tformat.js {}\n\t \t\t\tformat.json { render :show, status: :created, location: @user }\n\t \t\telse\n\t \t\t\twarden.custom_failure!\n\t \t\t\tformat.html { render :new }\n\t \t\t\tformat.json { render json: @user.errors, status: :unprocessable_entity }\n\t \t\tend\n\t \tend\n\t end", "title": "" }, { "docid": "202a2ec5884e8441a48a2d281bac8172", "score": "0.7708516", "text": "def create_user\n # provide the interface asking for name, destination and duration\n # then, create and store the User object\n end", "title": "" }, { "docid": "78d28f2ffd7b1dd154ec7ad5e920ce37", "score": "0.77033854", "text": "def create\n @user = User.new(email:session[:userinfo].info.email,\n name:session[:userinfo].info.name,\n uid:session[:userinfo].uid)\n if @user.save\n @user.save\n redirect_to @user, notice: \"Welcome #{@user.name}!\"\n else\n redirect_to root_path, status: \"Something went wrong. Let's try this again.\"\n end\n end", "title": "" }, { "docid": "adc9a2ea2407d04277011b41f05681c1", "score": "0.7697105", "text": "def create\n user = User.new(user_params)\n if user.save\n render json: user\n else\n render json: {errors: \"Cannot create user\"}, :status => 420\n end\n end", "title": "" }, { "docid": "501afdaed83731e0843777bc654d28b3", "score": "0.7696445", "text": "def create\n user = User.new(user_params)\n render json: { status: 200, msg: 'User was created.', data: \"User Id #{user.id}\" } if user.save\n end", "title": "" }, { "docid": "31e5aec11d3f0862358bde8210d6b919", "score": "0.7696374", "text": "def create\n @user = User.new(user_params)\n if @user.save\n flash[:success] = 'User created!'\n redirect_to login_path\n else\n flash[:danger] = @user.errors.full_messages\n redirect_to signup_path\n end\n end", "title": "" }, { "docid": "65e7bd97067202dea3dbe196fc8152a5", "score": "0.76948875", "text": "def create\n @user = User.new(username: params[:username], email: params[:email], password: params[:password])\n\n if @user.save\n render json: {status: 'SUCCESS', message: 'Account successfully created', accessToken: @user.access_token}.to_json\n else\n render json: {errors: [\"Sign up failed!\"], status: 422}.to_json\n end\n\n end", "title": "" }, { "docid": "6fcf33ce9b325e6e356f0384efdf6412", "score": "0.76915336", "text": "def create\n\t\t@user = User.create(user_params)\n\t\tlogin(@user)\n\t\tredirect_to root_path\n\tend", "title": "" }, { "docid": "08271349d810217416ac0277753726d9", "score": "0.7687987", "text": "def create_user\n params = {\n client_id: @client_id,\n email: @email\n }\n @user = User.using_client_shard(client: @client).create!(params)\n end", "title": "" }, { "docid": "68ca826968abce522a7c7d71ab1e3635", "score": "0.7686244", "text": "def create\n\n #.create is a method we get from AR.\n #it returns a new object in local memory with the specified params\n #it then saves the hash object in the database.\n @user = User.create user_params\n if @user.save\n session[:user_id] = @user.id.to_s\n flash['alert-success'] = \"You have been registered #{@user.username}, please login.\"\n redirect_to new_session_path\n else\n flash['alert-warning'] = 'Unable to create a user account.'\n redirect_to new_user_path\n end\n end", "title": "" }, { "docid": "1cd0e6af37e272cd70a31bf2acb41b00", "score": "0.76812726", "text": "def create_user(description= {})\n request(Net::HTTP::Post, \"/api/#{API_VERSION}/user\", nil, description, true)\n end", "title": "" }, { "docid": "9dceaa63916c005f320d1cd484d43ede", "score": "0.7677564", "text": "def create\n \n user = User.new(user_params)\n\n if user.save\n\n render json: {status: 200, msg: 'User was created.'}\n\n else \n render json: {\n errors: user.errors.full_messages\n }, status: :unprocessable_entity\n\n end\n\n end", "title": "" }, { "docid": "1af58dfd294c1e2bb67a8399611d8731", "score": "0.7672627", "text": "def create\n @user = User.new(params[:user])\n \n if @user.create_first\n flash[:message] = \"<h2>#{t('welcome', :scope => 'refinery.users.create', :who => @user.username).gsub(/\\.$/, '')}.</h2>\".html_safe\n\n sign_in(@user)\n redirect_back_or_default(refinery.admin_root_path)\n else\n render :new\n end\n end", "title": "" }, { "docid": "587ff93117f127905877bd42b7c2d2c9", "score": "0.7667873", "text": "def create_user(attributes = {})\n elektron_identity.post(\"users\") { { user: attributes } }.body[\"user\"]\n end", "title": "" }, { "docid": "728b86d900fe09fe17b830e10c55e627", "score": "0.7664851", "text": "def create\n @user = User.new(user_params)\n if @user.save\n flash[:success] = \"正常に保存されました。\"\n redirect_to users_url\n else\n render 'new'\n end\n end", "title": "" }, { "docid": "e1fc12ba3ae60556c260551f9580bd08", "score": "0.766008", "text": "def create\n @user = User.new(user_params)\n\n if @user.save\n redirect_to users_path, notice: \"ユーザが保存されました\"\n else\n render :new\n end\n end", "title": "" }, { "docid": "1820d51ec82033f2234e690bf90dd650", "score": "0.7659689", "text": "def create\n @user = User.new(user_params)\n if @user.save\n flash[:user] = t('user_create')\n redirect_to user_path(@user)\n else\n render 'new'\n end\n end", "title": "" }, { "docid": "c780e77e16f54885790092805d68c48f", "score": "0.7657448", "text": "def create\n @user = User.new(params[:user])\n if @user.save\n redirect_to users_path, notice: t('users.update.updated')\n else\n @page_title = t(\"actions.new_user\")\n render action: 'new'\n end\n end", "title": "" }, { "docid": "6bc2a80dd532aeccdc3c5d6a8a29981e", "score": "0.7655454", "text": "def user_new(opts = {})\n call(\"user\", \"new\", opts)\n end", "title": "" }, { "docid": "569cfa291ee6f2e12e8587b2416c9f0d", "score": "0.7655098", "text": "def create\n puts \"******* create *******\"\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end", "title": "" }, { "docid": "d007be5bde1ef1c08817b510d15deb53", "score": "0.765071", "text": "def create_user(input)\n User.create(name: input)\n end", "title": "" }, { "docid": "55629015a65de51f0624d3dea8e470d3", "score": "0.7650176", "text": "def create\n @user = User.new(user_params)\n if @user.save\n redirect_to @user, notice: 'Se creo un usuario exitosamente.'\n else\n render :new\n end\n end", "title": "" }, { "docid": "db64d13a9b0ea1729f119ecb93da06fb", "score": "0.7647288", "text": "def create\n\t\t\n\t\treg_params = params.require(:user).permit(\n\t\t\t:name, :email, :password, :password_confirmation\n\t\t)\n\n\t\tname = reg_params[:name]\n\t\temail = reg_params[:email]\n\t\tpassword = reg_params[:password]\n\t\tpassword_confirmation = reg_params[:password_confirmation]\n\n\t\tnew_user = User.new(\n\t\t\tname: name,\n\t\t\temail: email,\n\t\t\tpassword: password,\n\t\t\tpassword_confirmation: password_confirmation\n\t\t)\n\n\t\tif new_user.valid?\n\t\t\tnew_user.save(validate: false)\n\t\t\tflash[:success] = \"Account successfully created.\"\n\t\telse\n\t\t\tflash[:error] = new_user.errors.full_messages\n\t\tend\n\t\tredirect_to root_path\n\tend", "title": "" }, { "docid": "c3055a34ba28f95ac6ae569ba0005fc9", "score": "0.7647186", "text": "def create\n @new_user = NewUser.new(new_user_params)\n\n respond_to do |format|\n if @new_user.save\n format.html { redirect_to @new_user, notice: 'New user was successfully created.' }\n format.json { render :show, status: :created, location: @new_user }\n else\n format.html { render :new }\n format.json { render json: @new_user.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cebe0d31b0d0c8305c7d8abc94251ce4", "score": "0.76457506", "text": "def create\n @user = User.new(params[:user])\n @user.attributes = params[:user]\n if @user.save\n flash[:success] = I18n.t('users.created')\n redirect_to users_path\n else\n self.bread\n add_crumb(I18n.t('users.new'),new_user_path)\n render 'new'\n end\n end", "title": "" }, { "docid": "9e9f561266e08b22cd1c15c5d7a89761", "score": "0.7644345", "text": "def new_user\n\t\t@resource = User.new\n\t\t@resource_name = 'user'\n\tend", "title": "" }, { "docid": "b3b17e4a8ba568b1a786189efcb1ca90", "score": "0.76430553", "text": "def create\n\t\t@user = User.new(user_params)\n\t\n\t\tif @user.save\n\t\t\tsign_in @user\n\t\t\tflash[:success] = \"Welcome, #{@user.name}!\"\n\t\t\tredirect_to root_path\n\t\telse\n\t\t\trender action: 'new'\n\t\tend\n\n\tend", "title": "" }, { "docid": "1cf7b9696c966cd203d3c468005d4b61", "score": "0.7637868", "text": "def create_user\n if current_user.manager? || current_user.admin?\n @user = User.new(user_params)\n @user.password = 'test@123'\n @user.password_confirmation = 'test@123'\n redirect_to @user if @user.save\n else\n flash[:notice] = NOT_AUTHORIZED\n redirect_to home_index_path\n end\n end", "title": "" }, { "docid": "4fd438cf40080fac18651d012c0e6bb9", "score": "0.7635107", "text": "def create\n user = User.new(user_params)\n\n respond_to do |format|\n if user.save\n render json: user, status: :ok\n else\n format.json { render json: user.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5c8a4694c245db47fec868f98db74243", "score": "0.7632599", "text": "def create\n logger.debug(\"user create\")\n @user = User.new(params[:user])\n respond_to do |format|\n if @user.save\n format.html { redirect_to home_path, notice: 'User was successfully created.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "efc9cb3495b03c75fdaa5e93a12f456e", "score": "0.7625031", "text": "def create\n\t\t@user = User.new(user_params)\n\t\tif @user.save\n\t\t\tredirect_to login_path\n\t\telse\n\t\t\trender :new\n\t\tend\n\tend", "title": "" }, { "docid": "f83e7d0bf793f9a64cc6f3784e6a2266", "score": "0.76229286", "text": "def create\n @user = User.new(user_params)\n\n if @user.save\n redirect_to root_path, notice: 'User was successfully created'\n else\n render action: 'new'\n end\n end", "title": "" }, { "docid": "834a3de9bf3c2e184e60b76edc8372af", "score": "0.7617326", "text": "def create\n user = User.create!(user_params)\n auth_token = AuthenticateUser.new(user.username, user.password).call\n response = { message: Message.account_created, auth_token: auth_token }\n json_response(response, :created)\n end", "title": "" }, { "docid": "dd75ced57f999299af8bbc25599246ac", "score": "0.76090586", "text": "def create\n raise\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'Usuário foi inserido com sucesso' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3f2ac836ca5b2e89fe83f4fc8635675", "score": "0.7608273", "text": "def create_user(email, password, full_name = nil, language = nil)\n options = { email: email, password: password }\n options[:language] = language if language\n options[:full_name] = full_name if full_name\n\n query_api '/auth/user', options\n end", "title": "" }, { "docid": "558b74696078bb9be1e32a78f7566f6f", "score": "0.7605679", "text": "def create\n @user = User.new(user_params)\n \n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'user was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5d237aae72614c5979b7390f04a5ddca", "score": "0.7592361", "text": "def create\n\n up = user_params\n\n if up[:name].present?\n up[:first_name] = up[:name].split(' ')[0]\n up[:last_name] = up[:name].split(' ')[1]\n up.delete :name\n end\n @user = User.new(up)\n\n respond_to do |format|\n if @user.save\n # render json: {user: user, token: token}\n\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: api_user_url(@user)}\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "35de7aa2fe233c571fc244d327ff6543", "score": "0.7590146", "text": "def create\n\t\tuser = User.new()\n \n user.username = params[:username]\n user.password = params[:password]\n user.password_confirmation = params[:password_confirmation]\n user.email_address = params[:email_address]\n user.first_name = params[:first_name]\n user.last_name = params[:last_name]\n user.activation = SecureRandom.hex 16\n \n\t\tif user.save()\n UserMailer.activation_email(user).deliver_later!(wait: 15.seconds)\n\t\t\tpayload = {\n\t\t\t\terror: false,\n\t\t\t\tid: user.id\n\t\t\t}\n\t\t\trender status: 200, json: payload\n\t\telse\n\t\t\terrors = []\n\t\t\tuser.errors.keys.each do |key|\n\t\t\t\terrors << {field: key, message: user.errors.full_messages_for(key).first}\n\t\t\tend\n\t\t\tpayload = {\n\t\t\t\terror: true,\n\t\t\t\terrors: errors\n\t\t\t}\n\t\t\trender status: 200, json: payload\n\t\tend\n\tend", "title": "" }, { "docid": "79c79e08399c9c31ddc1df35c234678f", "score": "0.75808954", "text": "def create_user(username, options = {})\n payload = {\n \"username\" => username,\n \"email\" => \"#{username}@opscode.com\",\n \"first_name\" => username,\n \"last_name\" => username,\n \"display_name\" => username,\n \"password\" => \"foobar\"\n }\n\n users_url = \"#{@server}/users\"\n\n r = post(users_url, @superuser, :payload => payload)\n if r.code == 409\n puts \"The user #{username} already exists... regenerating a key for it now\"\n payload[\"private_key\"] = true\n r = put(\"#{users_url}/#{username}\", @superuser, :payload => payload)\n end\n\n private_key = parse(r)[\"private_key\"]\n\n # The \"admin\" and \"associate\" options here are more of a metadata\n # than actually creating an admin or associating. This allows\n # Pedant tests to succeed even if the users config table has changed.\n Pedant::User.new(username, private_key, platform: self, preexisting: false, admin: options[:admin], associate: options[:associate])\n end", "title": "" }, { "docid": "1e34386d2888c5db32a9036824311cb6", "score": "0.75793225", "text": "def create\n\t\tnew_user = User.new(user_params)\n\t\tif new_user.save\n\t\t render status: 200, json: {\n\t\t \tstatus: 200,\n\t\t message:\"New User Created\",\n\t\t response: {\n\t\t name: new_user.name,\n\t\t email: new_user.email,\n\t\t id: new_user.id,\n\t\t facebook_id: new_user.facebook_id,\n\t\t device_id: new_user.device_id,\n\t\t authentication_token: new_user.authentication_token\n\t\t }\n\t\t \n\t\t }.to_json\n\t\telse\n\t\t render status: 404, json: {\n\t\t \tstatus: 404,\n\t\t errors: new_user.errors\n\t\t }.to_json\n\t\tend\n\tend", "title": "" }, { "docid": "c99998ee46982df30e1355147e9b4d70", "score": "0.75786513", "text": "def create\n user = User.create(user_params)\n if user.save\n render json: user\n else\n render json: user.errors, status: :bad\n end\n end", "title": "" }, { "docid": "d3e5773347f2ae2686c114a12066a57a", "score": "0.7574414", "text": "def create\n @user = User.new(params[:user])\n\n if @user.save\n redirect_to(root_url, :notice => 'User was successfully created.')\n else\n render :action => \"new\"\n end\n end", "title": "" }, { "docid": "4b3dd03806a301d71ebf4076c493962d", "score": "0.75694185", "text": "def create\n if params[:via_linkedin] == false\n # create the new user instance with params from sign up form\n user = User.create(user_params)\n else\n params[:user][:password] = SecureRandom.hex\n\n # find or create the new user instance via linkedin\n user = User.where(provider: user_params[:provider], uid: user_params[:uid])\n .first_or_create(user_params)\n end\n # check the user save ok\n if user.persisted?\n # use the Knock AuthToken model to create a token for us\n render json: { jwt: auth_token(user).token, user: UserSerializer.new(user) }, status: 200\n else\n # bad request\n render json: user, status: 400\n end\n end", "title": "" }, { "docid": "9057a97cf9a1f347310d32bb331848bd", "score": "0.7567213", "text": "def create\n user = User.new(user_params)\n if user.save\n auth_token = AuthenticateUser.new(user.email, user.password).call\n response = { message: Message.account_created, auth_token: auth_token }\n json_response(response, :created)\n else\n response = { message: Message.account_not_created}\n json_response(response)\n end\n\n end", "title": "" }, { "docid": "0b95217689e4e14a1219bd32f394b094", "score": "0.7567074", "text": "def create\n\t\t@user = User.new(user_params)\n\t if @user.save\n\t \tsession[:user_id] = @user.id\n\t \tredirect_to user_url(@user)\n\t else\n\t \tflash.notice = \"User Registration failed. Try again.\"\n\t \trender 'new'\n\t end\n\tend", "title": "" }, { "docid": "ef049a2eb0ccb83ccdb1b92e99428448", "score": "0.7565098", "text": "def create\n @user = User.create( user_params )\nend", "title": "" }, { "docid": "50cbfa465ef977bcd37513f9c02d517b", "score": "0.7563982", "text": "def create\n @user = User.new(user_params)\n if @user.save\n\t sign_in @user unless signed_in?\n\t flash[:success] = \"Signup successful\"\n redirect_to @user\n else\n render 'new'\n end\n end", "title": "" }, { "docid": "c56c9d44508f70ddfa5a52e32c44d118", "score": "0.7557641", "text": "def create\n logout_keeping_session!\n\n\t\t# create a new user with the parameters provided\n @user = User.new(params[:user])\n\t\t\n\t\t# if creation of @user is successful and if it was written to the database successfully\n success = @user && @user.save\n\t\t\n\t\t# if success is TRUE and if there were no errors\n if success && @user.errors.empty?\n\t\t\t# redirect back and flash a pop up regarding successful creation \n redirect_back_or_default('/')\n gflash :success => \"Thanks for signing up! We're sending you an email with your activation code.\"\n else\n\t\t\t# else display pop up error and redirect back to the page\n gflash :error => \"We couldn't set up that account, sorry. Please try again, or contact an admin (link is above).\"\n render :action => 'new'\n end\n end", "title": "" } ]
1b32779ea2fc6873be7b73d4b9af1c42
============================================================================== validate_args() ============================================================================== validate options hash
[ { "docid": "04d5fac35e6c93d3b5ea0d75b25aa48c", "score": "0.0", "text": "def validate_args(to_validate,known_args)\n to_validate.each do |x|\n raise ArgumentError, \"Unrecognized argument '#{x}'. Valid arguments are \" +\n \"#{known_args.join(', ')}\" if (!known_args.include?(x))\n end\nend", "title": "" } ]
[ { "docid": "af629eba5e95ab39f4f54b82e277d605", "score": "0.7741315", "text": "def validate_options(opts); end", "title": "" }, { "docid": "0a2f649dbdf2e12ace1b025f6698bca1", "score": "0.7726384", "text": "def validate_options(options); end", "title": "" }, { "docid": "0a2f649dbdf2e12ace1b025f6698bca1", "score": "0.7726384", "text": "def validate_options(options); end", "title": "" }, { "docid": "432c438225656d123d20a08c50b54372", "score": "0.7528044", "text": "def arguments_valid?\n true if @options.author.length >= 1 or @options.key.length >= 1 or\n @options.conf.length >= 1 or @options.keyword.length >= 1 or @options.input != nil\n end", "title": "" }, { "docid": "2786f166d0651d33dc727e81edebbd2b", "score": "0.7429754", "text": "def validateArgs()\n \n return true\nend", "title": "" }, { "docid": "2d6252ef2e9fdf12ea10f7f31e7f497c", "score": "0.7408895", "text": "def validate_field_options!(options)\n incorrect_options = (SINGLE_OPTS & options.keys).first\n return unless incorrect_options && options.keys.size > 1\n incompatible_options = (options.keys - [incorrect_options]).map { |i| \":#{i}\" }.join(', ')\n exception_message = \":#{incorrect_options} can not be used with other args(#{incompatible_options})\"\n fail OmniScrapper::InvalidFieldArgumentsException, exception_message\n end", "title": "" }, { "docid": "65bc0e5d4013d4ab340c75e8cd6f9458", "score": "0.7168583", "text": "def validate_arguments(args_hash, fields_list, type_ns = nil)\n check_extra_fields(args_hash, array_from_named_list(fields_list))\n add_order_key(args_hash, fields_list)\n fields_list.each do |field|\n key = field[:name]\n item = args_hash[key]\n check_required_argument_present(item, field)\n unless item.nil?\n original_name = field[:original_name]\n if original_name\n key = handle_name_override(args_hash, key, original_name)\n end\n\n item_type = get_full_type_signature(field[:type])\n item_ns = field[:ns] || type_ns\n key = handle_namespace_override(args_hash, key, item_ns) if item_ns\n\n # Separate validation for choice types as we need to inject nodes into\n # the tree. Validate as usual if not a choice type.\n unless validate_choice_argument(item, args_hash, key, item_type)\n validate_arg(item, args_hash, key, item_type)\n end\n end\n end\n return args_hash\n end", "title": "" }, { "docid": "76a18a12d806b17355641c5d5fee7910", "score": "0.7158483", "text": "def validate_args args\n\n\t#pp args\n\n\tif args.size != 2\n\t\tfalse\n\telse\n\t\tconfig = JSON.parse(File.read(ARGV[0]))\n\t\tconfig[\"password\"] = args[1]\n\t\tconfig\n\tend\n\nend", "title": "" }, { "docid": "cb87ee739e67230993edaf797f320bdb", "score": "0.71500087", "text": "def valid_and_invalid_options(options); end", "title": "" }, { "docid": "4c31962e1c6090ef7af80b3fb8d1815e", "score": "0.71128714", "text": "def check_options!\n apply_to_given = !(@options.keys & APPLY_TO_OPTIONS).empty?\n recipe_given = !(@options.keys & RECIPE_OPTIONS).empty? ||\n !@options[:recipes].empty? ||\n !@options[:actions].empty?\n\n if apply_to_given && recipe_given\n abort \"You cannot specify both recipe options and framework integration options.\"\n elsif !apply_to_given\n abort \"You must specify at least one recipe\" if @options[:recipes].empty?\n abort \"You must specify at least one action\" if @options[:actions].empty?\n else\n @options[:application] = args.shift\n @options[:recipe_file] = args.shift\n end\n end", "title": "" }, { "docid": "fa35d40350312d9ffcc6cfb29cbf274f", "score": "0.7112395", "text": "def validate_arguments\n print \"DataContainer::validating KEY\\n\"\n case ARGV[0].downcase\n when 'jira', 'lb', 'mutable'\n return \n else\n abort(\"invalid KEY, aborting\")\n end\n\n end", "title": "" }, { "docid": "41a8f56699bbebc1b3025c42a40213da", "score": "0.7109472", "text": "def validate_options(options)\n InvalidOptionsError.check(options)\n options = options.to_hash rescue options.to_h unless options.is_a?(Hash)\n \n options\n end", "title": "" }, { "docid": "fd50c54da7c087e06aa33723ed70a856", "score": "0.71057266", "text": "def parse_options(options)\n options.each { |key, val| remove_required(options, key, val) }\n provided_args = check_assignment!(options)\n check_requirement!(*provided_args.keys)\n end", "title": "" }, { "docid": "85ef1aed7615998af0eecaeca3688837", "score": "0.71019536", "text": "def validate\n begin\n @optparse.parse!(@arguments)\n missing = @mandatory.select{|p| @options[p].nil? }\n if not missing.empty?\n puts \"Missing options: #{missing.join(', ')}\"\n puts @optparse\n @isvalid = false\n end\n rescue OptionParser::ParseError,\n OptionParser::InvalidArgument,\n OptionParser::InvalidOption,\n OptionParser::MissingArgument\n puts $!.to_s\n puts @optparse\n exit\n end\n end", "title": "" }, { "docid": "7b939a8d19a8b897711df60dd0c11bee", "score": "0.709389", "text": "def valid_options(*args)\n @option_list = args.flatten\n end", "title": "" }, { "docid": "39cfb624d14177c5432b3676bfa5e4ec", "score": "0.7079794", "text": "def validate_options options\n bad_opts = options.flat_map { |k,v|\n ALLOWABLE_OPTIONS.include?(k.to_sym) ? [] : k\n }\n unless bad_opts.empty?\n msg = \"Illegal option(s): #{bad_opts.join ' '}\"\n raise ArgumentError.new(msg)\n end\n end", "title": "" }, { "docid": "63d69d95f23b0ecdee514a8224a0c6ac", "score": "0.7074147", "text": "def validate_options!\n if override_and_named_given?\n ui.error('--override_runlist and --named_run_list are exclusive')\n exit 1\n end\n if json_attribs_without_override_given?\n ui.error(\n '--json-attributes must be used with --override-runlist ' \\\n 'or passed json should includes key `run-list` ' \\\n 'to avoid unexpected updating local node object.'\n )\n exit 1\n end\n true\n end", "title": "" }, { "docid": "f3b887f634fb8fb7c19b8cf56f92d1a5", "score": "0.70709854", "text": "def validate_args!(valid_args, actual_args)\n invalid_args = actual_args.keys - valid_args\n unless invalid_args.empty?\n msg = \"Invalid argument(s) %s. Valid are: %s\" % [format_args(invalid_args), format_args(valid_args)]\n raise ArgumentError.new(msg)\n end\n end", "title": "" }, { "docid": "d52c00395e70d557a23fb2a36bb49852", "score": "0.7052398", "text": "def validate_options!(options)\n header = options[:header]\n rows = options[:rows]\n\n if header && (!header.is_a?(Array) || header.empty?)\n raise InvalidArgument, \":header must be a non-empty array\"\n end\n\n if rows && !(rows.is_a?(Array) || rows.is_a?(Hash))\n raise InvalidArgument, \":rows must be a non-empty array or hash\"\n end\n end", "title": "" }, { "docid": "ccda5b5fef58fe73fbeecde5fd7e9115", "score": "0.70398045", "text": "def validate_options(options, *known_options)\n\toptions ||= Hash.new\n\topt, unknown = Kernel.filter_options(options.to_hash, *known_options)\n\tunless unknown.empty?\n\t not_valid = unknown.keys.map { |m| \"'#{m}'\" }.join(\" \")\n\t raise ArgumentError, \"unknown options #{not_valid}\", caller(1)\n\tend\n\n\topt\n end", "title": "" }, { "docid": "da162a9c710f33d0795c7cd018fb2b8d", "score": "0.70335156", "text": "def validate_args(args, required)\n required.each do |required_arg|\n raise 'Missing required argument' if args[required_arg].nil?\n end\n args\n end", "title": "" }, { "docid": "734bfc95d2d13c93fd3c74ce34ad2692", "score": "0.70069", "text": "def validate_args!(actual, required, optional)\n validate_required_arguments(actual, required)\n validate_valid_arguments(actual, required, optional)\n end", "title": "" }, { "docid": "bbcfddec4331856614ed2ba1844c8d3c", "score": "0.70061773", "text": "def validate(args)\n args = args.dup\n kw_args = Hash.new\n\n last_is_proc = false\n begin\n if args.last.kind_of?(Proc)\n args.pop\n last_is_proc = true\n end\n rescue NoMethodError\n end\n\n last_is_kw_hash = false\n if expects_keyword_arguments?\n last_is_kw_hash =\n begin\n args.last.kind_of?(Hash)\n rescue NoMethodError\n end\n\n if last_is_kw_hash\n kw_args = args.pop\n elsif requires_keyword_arguments?\n raise ValidationFailed, \"#{@exp} expects keyword arguments but none were provided\"\n end\n end\n\n # There is currently no way to disambiguate \"given a block\" from \"given a\n # proc as last argument\" ... give some leeway in this case\n positional_count = args.size\n\n if required_arguments > positional_count\n if requires_keyword_arguments?\n raise ValidationFailed, \"#{@exp} expects at least #{required_arguments} positional arguments but got only #{positional_count}\"\n end\n\n if (required_arguments - positional_count) == 1 && (last_is_kw_hash || last_is_proc)\n if last_is_kw_hash\n last_is_kw_hash = false\n kw_args = Hash.new\n else\n last_is_proc = false\n end\n positional_count += 1\n elsif (required_arguments - positional_count) == 2 && (last_is_kw_hash && last_is_proc)\n last_is_kw_hash = false\n kw_args = Hash.new\n last_is_proc = false\n positional_count += 2\n else\n raise ValidationFailed, \"#{@exp} expects at least #{required_arguments} positional arguments but got only #{positional_count}\"\n end\n end\n\n if !splat? && (required_arguments + optional_arguments) < positional_count\n if !last_is_proc || (required_arguments + optional_arguments) < positional_count - 1\n raise ValidationFailed, \"#{@exp} expects at most #{required_arguments + optional_arguments} positional arguments but got #{positional_count}\"\n end\n end\n\n missing_keyword_arguments = required_keyword_arguments.\n find_all { |k| !kw_args.has_key?(k) }\n if !missing_keyword_arguments.empty?\n raise ValidationFailed, \"#{@exp} missing required keyword arguments #{missing_keyword_arguments.map(&:to_s).sort.join(\", \")}\"\n end\n if !keyword_splat?\n kw_args.each_key do |k|\n if !optional_keyword_arguments.include?(k) && !required_keyword_arguments.include?(k)\n raise ValidationFailed, \"#{@exp} given unexpected keyword argument #{k}\"\n end\n end\n end\n end", "title": "" }, { "docid": "01344212c6c2d48363cfb142f8cc78c1", "score": "0.69792795", "text": "def validate_options # :nodoc:\n options.assert_valid_keys(self.class.valid_options)\n end", "title": "" }, { "docid": "7669e77342039fcb151f2e7b3d659a66", "score": "0.6976214", "text": "def validate_options(valid_option_keys, supplied_option_keys)\n unknown_option_keys = supplied_option_keys - valid_option_keys\n raise(ActiveRecord::ActiveRecordError, \"Unknown options: #{unknown_option_keys}\") unless unknown_option_keys.empty?\n end", "title": "" }, { "docid": "e61b7b307dd81f6b8286cc9e6cc119e6", "score": "0.6971329", "text": "def check_args\n # check if interface and action are set\n mandatory = [:interface, :action]\n missing = mandatory.select { |param| @options[param].nil? }\n unless missing.empty?\n report_error \"Missing options: #{missing.join(', ')}\", 1\n end\n # forum interface is set, but not source or wrong action\n if @options[:interface] == :forum\n e = 'Source URL not specified.' if @options[:source].nil?\n e = 'No such action for forum.' if @options[:action] == :download\n unless e.nil?\n report_error \"Wrong arguments: #{e} Use --help or -h to show help.\", 1\n end\n end\n end", "title": "" }, { "docid": "d83a95757d0bf61617c4655ba2322f9c", "score": "0.696341", "text": "def arguments_valid?\n return true if @options.list\n # TO DO - implement your real logic here\n @arguments.length > 0 ? true : false\n end", "title": "" }, { "docid": "5010772ae08906c51ade176b9babcf8d", "score": "0.694382", "text": "def validate_options(opts)\n operations = ['migrate', 'persist', 'expire', 'del', 'move']\n if !opts.has_key?(:op)\n puts \"You must specify an operation (e.g. --op migrate)\"\n return false\n elsif !operations.include?(opts[:op])\n puts \"Invalid operation: #{opts[:op]}\"\n elsif opts[:op] == 'expire' && !opts.has_key?(:ttl)\n puts \"You must specify '--expire-ttl TTL' when using '--op expire'\"\n return false\n elsif opts[:op] == 'del' && !opts.has_key?(:prefix)\n puts \"You must specify '--except-prefix PREFIX' when using '--op del'\"\n return false\n end\n return true\nend", "title": "" }, { "docid": "df5ec0d3156c787c04e655423e05c9eb", "score": "0.69358504", "text": "def validate_options(opts)\n if opts[:user] && !opts[:password]\n raise InvalidCommandOption, \"You must supply a password when supplying a user in windows\"\n end\n\n if !opts[:user] && opts[:password]\n raise InvalidCommandOption, \"You must supply a user when supplying a password in windows\"\n end\n\n if opts[:elevated] && !opts[:user] && !opts[:password]\n raise InvalidCommandOption, \"`elevated` option should be passed only with `username` and `password`.\"\n end\n\n if opts[:elevated] && opts[:elevated] != true && opts[:elevated] != false\n raise InvalidCommandOption, \"Invalid value passed for `elevated`. Please provide true/false.\"\n end\n end", "title": "" }, { "docid": "df5ec0d3156c787c04e655423e05c9eb", "score": "0.69358504", "text": "def validate_options(opts)\n if opts[:user] && !opts[:password]\n raise InvalidCommandOption, \"You must supply a password when supplying a user in windows\"\n end\n\n if !opts[:user] && opts[:password]\n raise InvalidCommandOption, \"You must supply a user when supplying a password in windows\"\n end\n\n if opts[:elevated] && !opts[:user] && !opts[:password]\n raise InvalidCommandOption, \"`elevated` option should be passed only with `username` and `password`.\"\n end\n\n if opts[:elevated] && opts[:elevated] != true && opts[:elevated] != false\n raise InvalidCommandOption, \"Invalid value passed for `elevated`. Please provide true/false.\"\n end\n end", "title": "" }, { "docid": "4aab77e0e7dedce374d05fe6ef101d0d", "score": "0.69077295", "text": "def arguments_valid?\n true if @arguments.length == 1 || @options.list == true\n end", "title": "" }, { "docid": "4bf72f22edd9232a14d26e64c5d91f8f", "score": "0.6904377", "text": "def validate_options(valid_option_keys, supplied_option_keys)\n unknown_option_keys = supplied_option_keys - valid_option_keys\n raise(ActionController::ActionControllerError, \"Unknown options: #{unknown_option_keys}\") unless unknown_option_keys.empty?\n end", "title": "" }, { "docid": "fb898ad29147067d99befa8dc2b92270", "score": "0.69033295", "text": "def validate_options\n # do nothing\n end", "title": "" }, { "docid": "d6744a619cb9181ff157677d2b8e5c0e", "score": "0.6899261", "text": "def validate_arguments(args, skip_validations: false)\n if validate_required_arguments?(skip_validations)\n validate_required_arguments(args)\n end\n\n return unless validate_received_arguments?(skip_validations)\n validate_received_arguments(args)\n end", "title": "" }, { "docid": "6d5365fc4dac63d6ffec48a261cec737", "score": "0.68991035", "text": "def check_keys(*args)\n options = args.shift\n args.each do |key|\n raise MissingParameter.new(key) unless options.key?(key)\n end\n end", "title": "" }, { "docid": "a58519d3ea08bb1e04a2d147634b5263", "score": "0.6896133", "text": "def options_validate(options)\n options\n end", "title": "" }, { "docid": "8bac988523927a92284adf8890e3344b", "score": "0.6876768", "text": "def arguments_valid?\n raise \"TODO - parse arguments\"\n end", "title": "" }, { "docid": "e8de4791dee4651bf8002608a9c1e506", "score": "0.6865893", "text": "def validate_args(opts={})\n return if (missing = [:rows, :cols].select{ |a| opts[a].to_i <= 0 }).empty?\n return if (missing ||= [:out, :rows, :cols].select{|a| opts[a].nil? }).empty?\n usage(missing)\n end", "title": "" }, { "docid": "4240a47dad9ebb8b04e7c2c2b9e007fb", "score": "0.6864322", "text": "def arguments_valid?\n # No arguments to validate so just return true \n true\n end", "title": "" }, { "docid": "52ca5eea4fc6e53a1571766d6af87810", "score": "0.6863702", "text": "def check_options(options)\n [:host, :port].each { |option| raise ArgumentError.new(\"option '#{option}' must be specified\") unless options.has_key? option }\nend", "title": "" }, { "docid": "52ca5eea4fc6e53a1571766d6af87810", "score": "0.6863702", "text": "def check_options(options)\n [:host, :port].each { |option| raise ArgumentError.new(\"option '#{option}' must be specified\") unless options.has_key? option }\nend", "title": "" }, { "docid": "61dda352cce11940513f26f8dcd107f3", "score": "0.68565375", "text": "def validate_options(opts)\n [:key, :port].each do |s|\n next if opts.include? s\n puts \"#{s} is required.\"\n return false\n end\n true\nend", "title": "" }, { "docid": "677407f36d32efaa516d87f968ceb04d", "score": "0.68357664", "text": "def arguments_valid?\n \n end", "title": "" }, { "docid": "fd9a05d371b7acdd53033cb66972f2b7", "score": "0.68345124", "text": "def check_options(options)\n raise ArgumentError, \"Unknown field option #{options.keys.first.inspect} provided for field #{name.inspect}\" unless options.empty?\n end", "title": "" }, { "docid": "3d9a51cdd31459eeb082477dc1229b39", "score": "0.681826", "text": "def arguments_valid?\n true\n end", "title": "" }, { "docid": "3d9a51cdd31459eeb082477dc1229b39", "score": "0.681826", "text": "def arguments_valid?\n true\n end", "title": "" }, { "docid": "3d9a51cdd31459eeb082477dc1229b39", "score": "0.681826", "text": "def arguments_valid?\n true\n end", "title": "" }, { "docid": "3d9a51cdd31459eeb082477dc1229b39", "score": "0.681826", "text": "def arguments_valid?\n true\n end", "title": "" }, { "docid": "3d9a51cdd31459eeb082477dc1229b39", "score": "0.681826", "text": "def arguments_valid?\n true\n end", "title": "" }, { "docid": "3d9a51cdd31459eeb082477dc1229b39", "score": "0.681826", "text": "def arguments_valid?\n true\n end", "title": "" }, { "docid": "3d9a51cdd31459eeb082477dc1229b39", "score": "0.681826", "text": "def arguments_valid?\n true\n end", "title": "" }, { "docid": "5a01ff9b215257ee6de1f3e88d02b5fb", "score": "0.68157953", "text": "def validate_options(options, attrs)\n matched_attrs = options.keys & attrs\n if matched_attrs.to_set != attrs.to_set\n raise SendgridApi::Error::OptionsError.new(\"#{(attrs - matched_attrs).join(\", \")} required options are missing\")\n end\n end", "title": "" }, { "docid": "eaa0a1837658836979489dfb2197e5c6", "score": "0.68100166", "text": "def arguments_valid?\n # LOG.info(\"Checking arguments/options @arguments.length=#{ @arguments.length} @options.username=#{@options.username} @options.hostname=#{@options.hostname} @options.destination=#{@options.destination}\")\n true if @arguments.length == 1 && @options.username && @options.hostname && @options.destination\n end", "title": "" }, { "docid": "4730400f47accb9835c482a20e0d09c2", "score": "0.6799632", "text": "def ensure_valid_options!\n missing_options = (Array(self.class.required_options) - options.keys.map(&:to_sym))\n\n missing_options.reject! do |key|\n respond_to?(key) && !send(key).nil?\n end\n\n if missing_options.length > 0\n raise 'Error: failure to supply the following options: ' + missing_options.map(&:to_s).join(\",\")\n end\n end", "title": "" }, { "docid": "e1c2a917a4c937d3936fd759e22e8de9", "score": "0.6774912", "text": "def check_args(args)\n # check for invalid commands\n bad = args.select { |arg| !COMMANDS.key?(arg) }\n if bad.size > 0\n warn \"Invalid commands (see 'help'): #{bad}\"\n exit -1\n end\n end", "title": "" }, { "docid": "6a14c089a3f8300e38d6984f46704149", "score": "0.67722523", "text": "def arguments_valid?\n\n true\n\n end", "title": "" }, { "docid": "a45f6586748757e2c5f2c200ee146c80", "score": "0.67703897", "text": "def arguments_valid?\n \n true \n \n end", "title": "" }, { "docid": "0dd3c6890a414c84c4fc58c20537554b", "score": "0.6754703", "text": "def validate_args\n # First, validate that no capture names (for flags or arugments) overlap\n capture_names = Set.new\n cmd.definition.arguments.each do |arg|\n name = arg.name\n if capture_names.include?(name)\n raise Runner::Errors::CaptureNameSpecifiedMultipleTimes.new(name)\n end\n capture_names << name\n end\n cmd.definition.flags.each do |flag|\n arg = flag.arg\n next if arg.nil?\n if capture_names.include?(arg)\n raise Runner::Errors::CaptureNameSpecifiedMultipleTimes.new(arg)\n end\n capture_names << arg\n end\n\n mapped_flags = {}\n opt_parser = OptionParser.new do |opts|\n cmd.definition.flags.each do |flag|\n parser_args = []\n l = \"--#{flag.flag}\"\n if flag.arg\n if flag.arg =~ /^\\[(.+)+\\]$/\n # if the arg is optional (surrounded by []) then the long form must look like `--key[=VALUE]` while\n # the short form must look like `-k[VALUE]`\n l += \"[=#{$1}]\"\n else\n l += \" #{flag.arg.upcase}\" unless flag.arg.nil?\n end\n end\n parser_args << l\n if flag.short\n s = \"-#{flag.short}\"\n s += \"#{flag.arg.upcase}\" unless flag.arg.nil?\n parser_args << s\n end\n opts.on(*parser_args) do |value|\n mapped_flags[flag.arg.upcase] = value unless flag.arg.nil?\n end\n end\n end\n # parse! destructively removes args and we want to see what non-option args were passed to use in\n # mapped_args later\n leftover_args = provided_args.dup\n opt_parser.parse!(leftover_args)\n\n # Now populate @mapped_args with all captured args from flags and command line\n @mapped_args = mapped_flags.dup\n cmd.definition.arguments.each_with_index do |arg, i|\n @mapped_args[arg.name] = leftover_args[i]\n end\n # Allow output to reference the name of the main\n # command as CMD, which makes less work when\n # we decide to change a command.\n @mapped_args[\"CMD\"] = cmd.name\n # TODO handle unexpected arguments, mapping them\n # such as EXTRA1, EXTRA2, etc.\n end", "title": "" }, { "docid": "3fdb5daf2dd04c165f220c4ec59a5c4d", "score": "0.67374116", "text": "def check_arguments\n check_b64_arguments\n\n unless @options[\"argument\"].nil?\n @checkpoints[\"argument\"] = false\n begin\n parsed_arg = JSON.parse(options[\"argument\"])\n @options[\"jsonArgument\"] = parsed_arg\n @checkpoints[\"argument\"] = true\n rescue JSON::ParserError => e\n finish(false, \"Error parsing JSON argument: #{e.message}\")\n end\n end\n end", "title": "" }, { "docid": "038ebb88e8ffbaddc30f608efd8edfe3", "score": "0.6730231", "text": "def arguments_valid?\n if not @options.file then\n return false\n end\n return true\n end", "title": "" }, { "docid": "538d8bfed0a985b4935e7c812a09ae59", "score": "0.67131776", "text": "def validate_options!(options)\n if options[:chef_api] == :knife\n return true\n end\n\n missing_options = [:node_name, :client_key] - options.keys\n\n unless missing_options.empty?\n missing_options.collect! { |opt| \"'#{opt}'\" }\n raise InvalidChefAPILocation, \"Source '#{name}' is a 'chef_api' location with a URL for it's value but is missing options: #{missing_options.join(', ')}.\"\n end\n\n self.class.validate_node_name!(options[:node_name])\n self.class.validate_client_key!(options[:client_key])\n self.class.validate_uri!(options[:chef_api]) \n end", "title": "" }, { "docid": "3930e47b20c5f2895532748721505430", "score": "0.671074", "text": "def arguments_valid?\n @options.user && @options.password && @options.group\n end", "title": "" }, { "docid": "3865dc76b1c3e24f5452174d59e19383", "score": "0.66904527", "text": "def valid_args_for_help?(args)\n args.empty? || ALL_COMMANDS.has_key?(args)\n end", "title": "" }, { "docid": "6044782cefa45d2f60e71bb8d4fe0280", "score": "0.6686812", "text": "def valid_options; end", "title": "" }, { "docid": "f4112c6cea0b0e3a3f1d045f4e373b37", "score": "0.66863245", "text": "def validate_arguments(workitem, required_keys)\n fields = workitem.fields\n required_keys.each do |key|\n raise ArgumentError, \"Missing required argument #{key}\" unless fields[key]\n end\n end", "title": "" }, { "docid": "f2e9a1a6d1c4f1b23065425e2bd68028", "score": "0.66838473", "text": "def arguments_valid?\n if !@options.parameter.nil? && !@options.start.nil? && !@options.end.nil? && !@options.steps.nil? && @arguments.length == 1\n true\n elsif @arguments.length == 2\n true\n else\n false\n end\n end", "title": "" }, { "docid": "85f09d922681ab92fda6c345e1b31d81", "score": "0.6671081", "text": "def validate_received_arguments(args)\n extras = args.keys - (receives | requires)\n raise UnexpectedReceivedArgumentError, extras if extras.any?\n end", "title": "" }, { "docid": "7c7744a4daed82ce829f3c5f30e4c5c0", "score": "0.66696", "text": "def validate_options()\r\n # Override the base class method because export does not require any options\r\n end", "title": "" }, { "docid": "45e818913fb6ede220fdec0013f7d5fd", "score": "0.66577756", "text": "def verify_args!(opts={})\n args = opts[:args] || []\n count = opts[:count]\n # simplify output for verify_args!(min:2, max:2) or verify_args!(max:0)\n if opts[:min] && opts[:max] && opts[:min] == opts[:max]\n count = opts[:min]\n elsif opts[:max] == 0\n count = 0\n end\n if count\n if args.count < count\n raise_args_error(\"not enough arguments, expected #{count} and got #{args.count == 0 ? '0' : args.count.to_s + ': '}#{args.join(', ')}\", args, opts[:optparse])\n elsif args.count > count\n raise_args_error(\"too many arguments, expected #{count} and got #{args.count == 0 ? '0' : args.count.to_s + ': '}#{args.join(', ')}\", args, opts[:optparse])\n end\n else\n if opts[:min]\n if args.count < opts[:min]\n raise_args_error(\"not enough arguments, expected #{opts[:min] || '0'}-#{opts[:max] || 'N'} and got #{args.count == 0 ? '0' : args.count.to_s + ': '}#{args.join(', ')}\", args, opts[:optparse])\n end\n end\n if opts[:max]\n if args.count > opts[:max]\n raise_args_error(\"too many arguments, expected #{opts[:min] || '0'}-#{opts[:max] || 'N'} and got #{args.count == 0 ? '0' : args.count.to_s + ': '}#{args.join(', ')}\", args, opts[:optparse])\n end\n end\n end\n true\n end", "title": "" }, { "docid": "621d0f3522815fcfaddb2d3e313aa95e", "score": "0.6653488", "text": "def arguments_valid?\n if @options.ipaddress == ''\n return false\n elsif @options.secret == ''\n return false\n elsif @options.hostname == ''\n return false\n elsif @options.server == ''\n return false\n elsif @options.password == ''\n return false\n elsif @options.username == ''\n return false\n end\n true\n end", "title": "" }, { "docid": "01a5958bc0f1661591df8f2e645cd71d", "score": "0.6651744", "text": "def validate_arg(*arg)\n arg.each do |a|\n return false unless a && (a.to_s =~ /^\\{.*\\}$/) == nil && a != '' && a != {}\n end\n end", "title": "" }, { "docid": "bfb47a1fcd0ff198e6d87092dc45c19c", "score": "0.6647388", "text": "def validate_invalid_options! *options\n if options.all?(&:nil?)\n raise ArgumentError, 'You have to supply an option for this matcher'\n end\n end", "title": "" }, { "docid": "e171007a4df52338ab590f5a84cce981", "score": "0.6640966", "text": "def parse_and_validate_options(option_items, banner, logic = nil)\n options = {}\n #uuid = @web_command ? @prev_args.peek(1) : @prev_args.peek(0)\n uuid = @prev_args.peek(0)\n # Get our optparse object passing our options hash, option_items hash, and our banner\n optparse = get_options(options, :options_items => option_items, :banner => banner)\n # set the command help text to the string output from optparse\n @command_help_text << optparse.to_s\n # if it's a web command, get the web options that were passed\n if @web_command\n options = get_options_web\n end\n # parse our ARGV with the optparse unless options are already set from get_options_web\n optparse.parse!(@command_array) unless option_items.any? { |k| options[k] }\n # validate required options, we use the :require_one logic to check if at least one :required value is present\n validate_options(:option_items => option_items, :options => options, :logic => logic)\n return uuid, options\n end", "title": "" }, { "docid": "6158fdf796603b589d573819a7102f39", "score": "0.66393024", "text": "def arguments_valid?\n valid = true\n\n # If there is a config option set and the file doesnt' exist, then we have a\n # problem\n if (@options.config && !File::exists?(File.expand_path(@options.config)))\n puts \"Invalid configuration file path #{@options.config}\"\n valid = false\n end\n\n valid\n end", "title": "" }, { "docid": "2d733b88204b9f2a644eba99bae4b79b", "score": "0.66305804", "text": "def validate_required_arguments(args)\n missing = requires - args.keys\n raise MissingRequiredArgumentError, missing if missing.any?\n end", "title": "" }, { "docid": "2ed65c18e4866d72dd8d4c49fe76b71b", "score": "0.6629468", "text": "def validate_single_use_args! opts\n return true if opts.nil? || opts.empty?\n valid_keys = %i[strong timestamp read_timestamp staleness\n exact_staleness bounded_timestamp\n min_read_timestamp bounded_staleness max_staleness]\n if opts.keys.count == 1 && valid_keys.include?(opts.keys.first)\n return true\n end\n raise ArgumentError,\n \"Must provide only one of the following single_use values: \" \\\n \"#{valid_keys}\"\n end", "title": "" }, { "docid": "19551e072949d3bb24d18cfe3b816b6d", "score": "0.6621554", "text": "def check_opts(opts,valid,exception) # :nodoc:\n unless(opts.empty?)\n err = opts.inject({}) do |h,(k,v)|\n h[k] = v unless(valid.include?(k))\n h\n end\n unless err.empty?\n raise exception, \"unrecognized options: #{err.keys}\"\n end\n end\n opts\n end", "title": "" }, { "docid": "f17fa48f3681a7b60a8fd4805ecd44e5", "score": "0.6618286", "text": "def validate_args(action_name, args)\n validated_args = {}\n in_params = get_service_registry.get_method_signature(action_name)[:input]\n in_params.each_with_index do |in_param, index|\n key = in_param[:name]\n value = deep_copy(args[index])\n validated_args[key] = (value.nil?) ? nil :\n validate_arg(value, validated_args, key)\n end\n return validated_args\n end", "title": "" }, { "docid": "91abf1198a134b73d6005dba58b1b08a", "score": "0.6616068", "text": "def arguments_valid?\n true if (@arguments.length >= 1 || @options.web)\n end", "title": "" }, { "docid": "5bf0aeca09d4821016a4d51e0077f28c", "score": "0.66120553", "text": "def opts_from_validator_args(args, defaults = nil)\n opts = args.last.kind_of?(Hash) ? args.pop : {}\n context = :default \n context = opts[:context] if opts.has_key?(:context)\n context = opts.delete(:on) if opts.has_key?(:on)\n context = opts.delete(:when) if opts.has_key?(:when)\n context = opts.delete(:group) if opts.has_key?(:group)\n opts[:context] = context\n opts.mergs!(defaults) unless defaults.nil?\n opts \n end", "title": "" }, { "docid": "9b433193d1cccc8e47ec46571a6f4071", "score": "0.6609428", "text": "def check_build_arguments(attrs)\n unless attrs.is_a?(Hash)\n raise ArgumentError, \"Journeyman expected a Hash, but received: #{attrs}\"\n end\n end", "title": "" }, { "docid": "df2ab25e806ed70d9bed2b0a1c77027e", "score": "0.66092813", "text": "def validate_options!\n raise RuntimeError if data.blank?\n raise RuntimeError if margin.present? and !margin.to_i.between?(0, 50)\n raise RuntimeError if ecc.present? and ![\"L\", \"M\", \"Q\", \"H\"].include?(ecc)\n \n if size.present?\n width, height = size.split(\"x\").collect(&:to_i)\n raise RuntimeError if width != height\n raise RuntimeError unless width.between?(10, 1000)\n end\n end", "title": "" }, { "docid": "c64b26fdf6a6c266d394b0a5d0440905", "score": "0.6600692", "text": "def validate_arg(*arg)\n arg.each do |a|\n return false unless a && (a.to_s =~ /^\\{.*\\}$/) == nil && a != '' && a != {}\n end\n end", "title": "" }, { "docid": "efb4e09ba1c7952a0386e95c4f495ff7", "score": "0.6593934", "text": "def arguments_valid?\n valid = true\n\n # If there is a config option set and the file doesnt' exist, then we have a problem\n if (@options.config && !File::exists?(File.expand_path(@options.config)))\n puts \"Invalid configuration file path #{@options.config}\"\n valid = false\n end\n\n valid\n end", "title": "" }, { "docid": "0e8aa5d9c9fbcbb55fa3772e8e0c2a4d", "score": "0.6585833", "text": "def args_valid?\n return true if !args\n return true if args.is_a?(String)\n return true if args.is_a?(Integer)\n if args.is_a?(Array)\n args.each do |a|\n return false if !a.kind_of?(String) && !a.kind_of?(Integer)\n end\n\n return true\n end\n end", "title": "" }, { "docid": "0e8aa5d9c9fbcbb55fa3772e8e0c2a4d", "score": "0.6585833", "text": "def args_valid?\n return true if !args\n return true if args.is_a?(String)\n return true if args.is_a?(Integer)\n if args.is_a?(Array)\n args.each do |a|\n return false if !a.kind_of?(String) && !a.kind_of?(Integer)\n end\n\n return true\n end\n end", "title": "" }, { "docid": "d94a778fa97d5cf2865f8db7f5d8c3b1", "score": "0.6585496", "text": "def _valid_options(options, required, optionnal = [])\n return nil unless options.is_a?(Hash)\n return nil unless required.is_a?(Array)\n optionnal = [] unless optionnal.is_a?(Array)\n\n result = [[], []]\n\n required.each do |key|\n return nil unless options.key?(key)\n result[0] << options[key]\n end\n\n optionnal.each { |key| result[1] << options[key] }\n\n result\n end", "title": "" }, { "docid": "11a753d6507c7e4cb6261b14b1225af9", "score": "0.65852916", "text": "def validate_options\n return unless options[:moleable]\n \n %w[app_name environment perf_threshold store].each do |k|\n raise \"[M()le] -- Unable to locate required option key `#{k}\" unless options[k.to_sym]\n end\n \n # Barf early if something is wrong in the configuration\n configured?( :twitter, [:username, :password, :alert_on], true )\n configured?( :email , [:from, :to, :alert_on], true )\n end", "title": "" }, { "docid": "2731143a187b7617ee8e2d194aa1f4aa", "score": "0.6581368", "text": "def validate_arguments(required_keys)\n participant :argument_validator, :required_keys => required_keys\n end", "title": "" }, { "docid": "1847136b4fc6435184ec9b18f4c77e0b", "score": "0.6573165", "text": "def validate_options\n input ? input.validate : raise(InputError, 'No input defined')\n output ? output.validate : raise(OutputError, 'No output defined')\n profiles ? profiles.validate : raise(ProfileError, 'No profiles defined')\n flags ? flags.validate : raise(FlagError, 'No flags defined')\n end", "title": "" }, { "docid": "6c1b4f743cc0385af33ecbd78c689a3b", "score": "0.6567467", "text": "def validate_options\n return unless options[:moleable]\n \n %w[app_name environment perf_threshold store].each do |k|\n raise \"[M()le] -- Unable to locate required option key `#{k}\" unless options[k.to_sym]\n end\n \n # Barf early if something is wrong in the configuration\n configured?( :twitter, [:username, :password, :alert_on], true )\n configured?( :email , [:from, :to, :alert_on], true )\n configured?( :growl , [:to, :alert_on], true ) \n end", "title": "" }, { "docid": "8ce8d89604ca23ff5362965ef762789d", "score": "0.65650946", "text": "def validate_options(options, cluster)\n options\n end", "title": "" }, { "docid": "7354681dd35f5057a54dc2ad247eeecf", "score": "0.65631807", "text": "def test_check_args_invalid2\n args = CheckArgs.new\n assert_equal false, args.check_args([1])\n end", "title": "" }, { "docid": "6885373a2633013d4126e9ec5dbd9b30", "score": "0.65547615", "text": "def check_arg_structure(args)\n valid = true\n valid &&= args.class == Array\n \n args.each do |a|\n valid &&= a.class == Array \n valid &&= a.size == 2\n a.each do |s|\n valid &&= s.class == String\n end\n end\n\n raise \"Imported function arguments in invalid form\" unless valid\n end", "title": "" }, { "docid": "9f5ccfedc3ee7d20683a771d316d0749", "score": "0.6549012", "text": "def check_options(options)\n raise ArgumentError, 'host name must not be nil' if options['host'].nil?\n raise ArgumentError, 'userna)e must not be nil' if options['username'].nil?\n raise ArgumentError, 'password must not be nil' if options['password'].nil?\n end", "title": "" }, { "docid": "7be0bf47caead6432ceb558d4225da70", "score": "0.65488374", "text": "def has_valid_args()\n if ARGV[1] == nil\n puts \"Missing id or content for the option. Pass -h or --help for what to pass.\"\n return false\n end\n return true\nend", "title": "" }, { "docid": "3c087d9746657420c504ec92b4102100", "score": "0.65419626", "text": "def verify_args(args = {})\n if args.blank?\n return { message: Scraper::StatusCodeScraper::PARAMETERS_BLANK }\n elsif args[:url].blank?\n return { message: Scraper::StatusCodeScraper::INVALID_PARAMETERS }\n elsif args[:elements].blank?\n return { message: Scraper::StatusCodeScraper::INVALID_PARAMETERS }\n else\n initialize_agent\n @args = args\n end\n end", "title": "" }, { "docid": "72338dd11a4638cf99af9373606e77b6", "score": "0.6541812", "text": "def valid_arguments?\n @args.size == 1\n end", "title": "" }, { "docid": "0812f80cec2e1f940fca7029ecdb90b2", "score": "0.6539128", "text": "def validate_options!(opts)\n raise MissingRequiredOption.new(:tarball) unless opts.key? :tarball\n raise MissingRequiredOption.new(:depositor) unless opts.key? :depositor\n\n raise InvalidTarball.new(opts[:tarball]) unless File.exists? opts[:tarball]\n end", "title": "" }, { "docid": "aa27b07e8ea6052f34583e8e47e7c704", "score": "0.65298223", "text": "def check_form!(args, correct_args)\n raise TUIException, ARG_NUM_ERROR if args.nil? || (args.size < correct_args.size)\n\n (0..(correct_args.size - 1)).each do |i|\n check_arg(args[i], correct_args[i])\n end\n end", "title": "" }, { "docid": "2908cc997772324a656c5423012c6d6f", "score": "0.65289414", "text": "def validate_input(dest, args)\n return true unless should_validate(dest)\n @input.each do |p|\n val = args[p[:symbol]]\n \n # if the argument has a value, no need to test whether it is optional.\n next unless !val || val == '*' || val == ''\n \n opts = p[:opts]\n unless opts[:optional]\n raise ArgumentError, \"You must specify the required input #{p[:symbol]}\"\n end\n end\n return true\n end", "title": "" } ]
63447379aeffd12d290bb633d4669862
functions (also called METHODS) javascript... this would be function square(a) '(a)' is the INPUT....
[ { "docid": "ebc9a978d3f3a583cf65fc78fa0a0825", "score": "0.8114164", "text": "def square(a)\n\ta * a\nend", "title": "" } ]
[ { "docid": "6e2260f9ff927c161628808947e2e997", "score": "0.8196796", "text": "def square(a)\n a * a\nend", "title": "" }, { "docid": "b0b364fe5141fc44d36fbe7a43a80402", "score": "0.81543964", "text": "def square(x)\nend", "title": "" }, { "docid": "b8c0ffa4868b84d9bd4b9a796fbbfbf3", "score": "0.8145554", "text": "def square(a)\n a * a\nend", "title": "" }, { "docid": "655246392f59d1747bfb797c0229f28f", "score": "0.79551196", "text": "def square(x)\n x*x\nend", "title": "" }, { "docid": "655246392f59d1747bfb797c0229f28f", "score": "0.79551196", "text": "def square(x)\n x*x\nend", "title": "" }, { "docid": "fa68a2650118955433c261e562be6146", "score": "0.79546165", "text": "def square a\n a * a\nend", "title": "" }, { "docid": "2be64b2cb7eb88edf28b48be274fff23", "score": "0.7952541", "text": "def square(x) # Define a method named square with one parameter x\n x*x # Return x squared\nend", "title": "" }, { "docid": "a2bbf5d1c5cc1dbcd8ab8eae68ddabd8", "score": "0.79296976", "text": "def square(x)\n x*x\nend", "title": "" }, { "docid": "62ba8969890f30040e41cde3afc6b010", "score": "0.7915331", "text": "def square(num)\n num * num\nend", "title": "" }, { "docid": "62ba8969890f30040e41cde3afc6b010", "score": "0.7915331", "text": "def square(num)\n num * num\nend", "title": "" }, { "docid": "1010b07fc89f9d6459a01a2bcde18c00", "score": "0.790931", "text": "def square(number)\n number * number\nend", "title": "" }, { "docid": "c4828ab21ea11b09a0b41dfabe53f3a9", "score": "0.78867555", "text": "def square(a) #a is the variable\n\t# is the input \n\t# the output is the LAST thing that it does - like the return in javascript\n\ta * a #so this is the last line and it becomes the output to whatever called it\nend", "title": "" }, { "docid": "efca73424fad68180641cb62323b5d23", "score": "0.78486466", "text": "def square number\n number * number\nend", "title": "" }, { "docid": "6dcc13ffd46ba273f66429babb21355d", "score": "0.7798423", "text": "def square(x)\n\tx*x\nend", "title": "" }, { "docid": "b30ce1345956780fd12c2febbb771a31", "score": "0.7791002", "text": "def square(number)\n number**2\nend", "title": "" }, { "docid": "e8d1c9f9f839277bce0e62c837393b03", "score": "0.7788187", "text": "def square(a)\n multiply(a, a)\nend", "title": "" }, { "docid": "9a6ce300c62fd8caaa0c18d502f7be08", "score": "0.77648443", "text": "def square(num) #I calculate a simple method for calculating squares (after I will need it)\n return num * num\n end", "title": "" }, { "docid": "c72241999ebfb082cc5ee51a80db73bf", "score": "0.7742127", "text": "def square_it_method(num)\n num * num\nend", "title": "" }, { "docid": "c72241999ebfb082cc5ee51a80db73bf", "score": "0.7742127", "text": "def square_it_method(num)\n num * num\nend", "title": "" }, { "docid": "ab8ee1b73517c9a869599b4e433c4367", "score": "0.77352595", "text": "def square(num)\n return num*num\nend", "title": "" }, { "docid": "95c7189b7eca8ec5835918f7e3b31e90", "score": "0.7716678", "text": "def square(x) = x * x", "title": "" }, { "docid": "548f8b171b28d4d46b4dcce8877854e9", "score": "0.7710599", "text": "def square(num)\n return num * num\nend", "title": "" }, { "docid": "548f8b171b28d4d46b4dcce8877854e9", "score": "0.7710599", "text": "def square(num)\n return num * num\nend", "title": "" }, { "docid": "97be07287c03e6cde6825c0567b7e2a6", "score": "0.7709746", "text": "def square(number)\n return number * number\nend", "title": "" }, { "docid": "97be07287c03e6cde6825c0567b7e2a6", "score": "0.7709746", "text": "def square(number)\n return number * number\nend", "title": "" }, { "docid": "97be07287c03e6cde6825c0567b7e2a6", "score": "0.7709746", "text": "def square(number)\n return number * number\nend", "title": "" }, { "docid": "97be07287c03e6cde6825c0567b7e2a6", "score": "0.7709746", "text": "def square(number)\n return number * number\nend", "title": "" }, { "docid": "97be07287c03e6cde6825c0567b7e2a6", "score": "0.7709746", "text": "def square(number)\n return number * number\nend", "title": "" }, { "docid": "29be54c742e917dcb8b4ab72d0e66de1", "score": "0.76957715", "text": "def square(number)\n return number*number\nend", "title": "" }, { "docid": "b1b9617cdfa3e7679c4a00b37c2a38d9", "score": "0.76626086", "text": "def square(x)\n x ** 2\nend", "title": "" }, { "docid": "a5f28e754f24778b0ec497cc6b257bf9", "score": "0.7660237", "text": "def square(x)\n x*x\n end", "title": "" }, { "docid": "4d6da88b6a609dd0fbb35f37bdf5a468", "score": "0.7659404", "text": "def square(number)\n return number * number\nend", "title": "" }, { "docid": "14740aa337678b9fa49f6c1806cc5035", "score": "0.7643297", "text": "def square(num)\n return num**2\nend", "title": "" }, { "docid": "14740aa337678b9fa49f6c1806cc5035", "score": "0.7643297", "text": "def square(num)\n return num**2\nend", "title": "" }, { "docid": "14740aa337678b9fa49f6c1806cc5035", "score": "0.7643297", "text": "def square(num)\n return num**2\nend", "title": "" }, { "docid": "ed4215fa97257222dda7ca1647803820", "score": "0.7628442", "text": "def square (x)\n return x * x\nend", "title": "" }, { "docid": "c6e262e8ce65419b82bb719e3669a1d8", "score": "0.75846165", "text": "def square(x)\n x * x\n end", "title": "" }, { "docid": "c6e262e8ce65419b82bb719e3669a1d8", "score": "0.75846165", "text": "def square(x)\n x * x\n end", "title": "" }, { "docid": "bda2ce74cf0989af6ead3e65c174abd0", "score": "0.75679994", "text": "def square(number)\n return number*number*number\nend", "title": "" }, { "docid": "724b9776e1f385697a19412b606b7096", "score": "0.75275016", "text": "def square(number)\n output = number * number \nend", "title": "" }, { "docid": "889c44ff3d78393daed2dcec79f8423b", "score": "0.746327", "text": "def square_num(num)\n return num*num\nend", "title": "" }, { "docid": "5daa5bb036f56219165dafc340d1d4c0", "score": "0.74630785", "text": "def square x\n puts (x * x)\nend", "title": "" }, { "docid": "f6ce92329117b8383e205d7cb01882e8", "score": "0.74556875", "text": "def square(num1)\n multiply(num1, num1)\nend", "title": "" }, { "docid": "1ae8fdf846254af0154cf407307a9e53", "score": "0.7441709", "text": "def square(x)\n\tx ** 2\nend", "title": "" }, { "docid": "1ae8fdf846254af0154cf407307a9e53", "score": "0.7441709", "text": "def square(x)\n\tx ** 2\nend", "title": "" }, { "docid": "82b788f7165521e80c2cf7c43ac6f5e0", "score": "0.74355763", "text": "def square(num)\n multiply(num, num)\nend", "title": "" }, { "docid": "82b788f7165521e80c2cf7c43ac6f5e0", "score": "0.74355763", "text": "def square(num)\n multiply(num, num)\nend", "title": "" }, { "docid": "82b788f7165521e80c2cf7c43ac6f5e0", "score": "0.74355763", "text": "def square(num)\n multiply(num, num)\nend", "title": "" }, { "docid": "82b788f7165521e80c2cf7c43ac6f5e0", "score": "0.74355763", "text": "def square(num)\n multiply(num, num)\nend", "title": "" }, { "docid": "82b788f7165521e80c2cf7c43ac6f5e0", "score": "0.74355763", "text": "def square(num)\n multiply(num, num)\nend", "title": "" }, { "docid": "82b788f7165521e80c2cf7c43ac6f5e0", "score": "0.74355763", "text": "def square(num)\n multiply(num, num)\nend", "title": "" }, { "docid": "75cf3afd302ab1b18208a5366c6b95df", "score": "0.73728895", "text": "def square_of_number(number)\n number * number\nend", "title": "" }, { "docid": "95ad5a0ebe8699755887c3b2fe6bba23", "score": "0.7346575", "text": "def squared(number)\n return number * number\nend", "title": "" }, { "docid": "d2f7ac8c2c1692c5f81f41080e7e0060", "score": "0.73195744", "text": "def square(num)\n Math.sqrt(num)\nend", "title": "" }, { "docid": "43aa81ed559a7e7cc3cf4b6d2924e0db", "score": "0.7308622", "text": "def squared\n end", "title": "" }, { "docid": "fb6330b8473e85610081e5565353de56", "score": "0.7301918", "text": "def square number\n return number ** 2\nend", "title": "" }, { "docid": "5a8169583d1572627e8665b6aa1316ef", "score": "0.72608995", "text": "def square(num)\n\treturn num**2\nend", "title": "" }, { "docid": "810d5086b78a5ad8d8bd090151df7068", "score": "0.72552353", "text": "def square(siffra)\n return siffra**2\nend", "title": "" }, { "docid": "2444bea4bc81a4e1e5ed810e9bd9e1f7", "score": "0.72315204", "text": "def square(n)\n n * n\nend", "title": "" }, { "docid": "2444bea4bc81a4e1e5ed810e9bd9e1f7", "score": "0.72315204", "text": "def square(n)\n n * n\nend", "title": "" }, { "docid": "34f0c9f7458af07c3a8b51c16ea8d03c", "score": "0.71962744", "text": "def square(num)\n output = num * num\n return output\nend", "title": "" }, { "docid": "458783af5775f73555cc2dc1b137e658", "score": "0.7151315", "text": "def square(number)\n number *= number\nend", "title": "" }, { "docid": "dd32fe8e8b0ffcc936ec1d4e46a4d682", "score": "0.7139993", "text": "def square!\n return square\n end", "title": "" }, { "docid": "fa1cf88908b521520e6002c42a199fc4", "score": "0.71388185", "text": "def square(n)\n\tn * n\nend", "title": "" }, { "docid": "62dcbc233a28038d990a3afec7727d6a", "score": "0.71183395", "text": "def square(n)\n return n * n\nend", "title": "" }, { "docid": "fdd40e043f7a4e2c13bf346033b869df", "score": "0.70910305", "text": "def square(n)\n return n*n\nend", "title": "" }, { "docid": "0d1d31f71801a01821c19e7193f3a413", "score": "0.707627", "text": "def square(n)\n return n * n\nend", "title": "" }, { "docid": "db7d61f4b1ab04f30be3b199acf5d4c3", "score": "0.7032915", "text": "def sqr(x)\n puts x*x\nend", "title": "" }, { "docid": "38783df3734198a0f85afd37fd6b2cb9", "score": "0.70293045", "text": "def square(n)\n puts n * n\nend", "title": "" }, { "docid": "066fd6a413b969a78cbbd6a89e30306c", "score": "0.702645", "text": "def sum_square(x, y)\n\tx**2 + y**2\nend", "title": "" }, { "docid": "d7f5332a7cdb4baa11f77d55ced29ded", "score": "0.702229", "text": "def square(num)\n multiply(multiply(num, num), num)\nend", "title": "" }, { "docid": "769eafc10dc0c247d537311df746f096", "score": "0.6978133", "text": "def square(n) # Here we have a method that would work for the task at hand - we can reuse it as a\n n ** 2 # parameter by converting it into a Method object and passing it to our map! method.\nend", "title": "" }, { "docid": "e5aa53cb0bf34a0af4e7a13de6240cdd", "score": "0.6951152", "text": "def sqr(x)\n x * x\nend", "title": "" }, { "docid": "9c94489f1ea39bf13ff077ce0363d502", "score": "0.69389606", "text": "def squared(num1)\n\tnum1 ** 2\nend", "title": "" }, { "docid": "7089a1ab92b8423b9c58979768e0a0f6", "score": "0.692955", "text": "def square_of_number(number)\n return(number * number)\nend", "title": "" }, { "docid": "7089a1ab92b8423b9c58979768e0a0f6", "score": "0.692955", "text": "def square_of_number(number)\n return(number * number)\nend", "title": "" }, { "docid": "11825167f7c6e9bae198ab7d8f36b156", "score": "0.69162065", "text": "def square(number)\n output = number **2\n return output\nend", "title": "" }, { "docid": "5b3e34b86bcb6223bc027b5ede637852", "score": "0.69157535", "text": "def a(x,y)\n x + y\n end", "title": "" }, { "docid": "cfd2251566a60691cded1719875e2dc0", "score": "0.690108", "text": "def square(n)\n puts n**2\nend", "title": "" }, { "docid": "9d340c962f6677abc26b182eae0a8758", "score": "0.6893177", "text": "def square(n)\r\n n * n\r\n end", "title": "" }, { "docid": "789084370d75fb382122fae35ff1ef5a", "score": "0.68846107", "text": "def square(num1)\n square_result = num1 * num1 # => 9\nend", "title": "" }, { "docid": "021bf60e9e6623554303aaa7fba1cd51", "score": "0.6755804", "text": "def square_of_sum\n end", "title": "" }, { "docid": "e9fe863c9b81a396bcf2a8addcee9430", "score": "0.6718959", "text": "def multiply(a,b)\n a*b\nend", "title": "" }, { "docid": "419705a3de99dd5bfbc9a7745e711772", "score": "0.6698917", "text": "def multiply(a,b)\n a*b\nend", "title": "" }, { "docid": "b1d993924c4f7b5585c1d737931229ac", "score": "0.66983795", "text": "def sum_of_squares\n end", "title": "" }, { "docid": "c6791350b10055c25944f11a16b7f5e4", "score": "0.66944426", "text": "def square(value)\n puts value**2\n return value**2\nend", "title": "" }, { "docid": "880adfa289b61c7f93642d55fb7df09b", "score": "0.66943127", "text": "def multiply(x,y)\n x*y\nend", "title": "" }, { "docid": "880adfa289b61c7f93642d55fb7df09b", "score": "0.66943127", "text": "def multiply(x,y)\n x*y\nend", "title": "" }, { "docid": "880adfa289b61c7f93642d55fb7df09b", "score": "0.66943127", "text": "def multiply(x,y)\n x*y\nend", "title": "" }, { "docid": "3d1c4bf236e80b3e366e5cdeec7fb494", "score": "0.66712993", "text": "def squares(a, b, c)\n return a*a, b*b, c*c\nend", "title": "" }, { "docid": "3d1c4bf236e80b3e366e5cdeec7fb494", "score": "0.66712993", "text": "def squares(a, b, c)\n return a*a, b*b, c*c\nend", "title": "" }, { "docid": "a3f5665754429c19b99225316a3640bd", "score": "0.6657652", "text": "def double(a)\r\n\t2*a\r\nend", "title": "" }, { "docid": "649d5aecdf3bd1f6b9570683196725dd", "score": "0.66557646", "text": "def square\n\t\tmap { |x| x*x }\n\tend", "title": "" }, { "docid": "889eb0df0cd82e40a675dde113859721", "score": "0.6652573", "text": "def multiply (a,b)\n return a*b\nend", "title": "" }, { "docid": "1e9a3b060a6f6045e157afbcf9682fbb", "score": "0.6619558", "text": "def square!\n\t\tmap! { |x| x*x }\n\tend", "title": "" }, { "docid": "de78e6139445502c20fd9bd277f12180", "score": "0.66013265", "text": "def squared_sum(a, b)\n # Q1 CODE HERE\n return (a + b) ** 2\nend", "title": "" }, { "docid": "1f1436cb753a6bdb55d4999baa39e9ba", "score": "0.6595159", "text": "def multiply (a b)\r\n a * b\r\nend", "title": "" }, { "docid": "2be7d1253a8d4d4a3fd5290d1cef39a7", "score": "0.6594017", "text": "def method(x, y)\n x * y\nend", "title": "" }, { "docid": "f833ee2bba07de1d667a40c4b4da5a88", "score": "0.65676385", "text": "def multiply(a,b)\n a * b\nend", "title": "" }, { "docid": "f833ee2bba07de1d667a40c4b4da5a88", "score": "0.65676385", "text": "def multiply(a,b)\n a * b\nend", "title": "" } ]
133bd599b439aab48778c8a93fd336f8
Given a URL that points to somewhere on the Drupal site (according to is_internal_url), looks for a node or file attachment at that URL If nothing is found, returns nil, else returns the absolute URL of the object
[ { "docid": "8be7bc7e664c9af5c76499cee05a3a9f", "score": "0.7184249", "text": "def get_internal_object_url_from_url(parent_url, url)\r\n # Compute the URL of this content relative to the base URL of the site\r\n relative_url = get_url_relative_to_base(parent_url, url)\r\n @logger.log_trace \"Route to '#{url}' from '#{@baseurl}' is '#{relative_url}'\"\r\n\r\n if !relative_url.relative?\r\n @logger.log_trace(\"URL #{url} is not relative to #{@baseurl} so returning nil for internal object URL\")\r\n return nil\r\n end\r\n\r\n # If this is a node/<nodeid> URL, look for a node with that ID\r\n if relative_url.path =~ /node\\/(\\d+)/\r\n node_id = $1.to_i()\r\n\r\n node = DrupalModel::Node.find(:first, :conditions => {:nid => node_id})\r\n if node != nil\r\n @logger.log_trace \"Url '#{url}' points to node ID #{node_id}\"\r\n #If there's a URL alias for this node, use that, else just use the raw node URL\r\n if @url_aliases.has_key?(relative_url.path)\r\n @logger.log_trace(\"URL '#{url}' node ID #{node_id} has URL alias '#{@url_aliases[relative_url.path]}'; using alias for node URL\")\r\n @baseurl.merge(@url_aliases[relative_url.path])\r\n else\r\n @logger.log_trace(\"URL '#{url}' node ID #{node_id} does not have a URL alias; using raw node URL\")\r\n @baseurl.merge(relative_url.path)\r\n end\r\n else\r\n @logger.log_trace \"Url '#{url}' points to non-existent node ID #{node_id}\"\r\n nil\r\n end\r\n else\r\n #Doesn't look like a node URL. Look for a URL alias\r\n if @url_alias_sources.has_key?(relative_url.path)\r\n @logger.log_trace \"URL '#{relative_url.path}' corresponds to a URL alias\"\r\n @baseurl.merge(relative_url.path)\r\n elsif @files.has_key?(CGI.unescape(relative_url.path))\r\n #Only other thing it could be is a file attachment. \r\n @logger.log_trace \"URL '#{relative_url}' corresponds to a file attachment\"\r\n @baseurl.merge(relative_url.path)\r\n elsif relative_url.to_s.length == 0\r\n #This is a link back to the main site\r\n @baseurl\r\n else\r\n @logger.log_trace \"URL '#{relative_url}' doesn't correspond to any Drupal content\"\r\n nil\r\n end\r\n end\r\n end", "title": "" } ]
[ { "docid": "1fc320057a5ef746846496d2239dc5da", "score": "0.6310374", "text": "def url\n file.try(:url)\n end", "title": "" }, { "docid": "c0af853cc858243fb772441bf8621b79", "score": "0.62360305", "text": "def href_is_local_link(href)\n file_uri = href.to_s.sub(/(#|\\?).*/,'')\n\n if( href and (href[/^http:\\/\\/www.fys.uio.no\\/pgp/] or href[/^http:\\/\\/varme.uio.no\\/pgp/]) and file_uri[/\\.php$/])\n # Open the link and see if we can extract filename from its breadcrumb\n doc = Nokogiri::HTML(open(href))\n filename = extract_filename2(doc)\n return @vortex_path + filename.gsub(/^\\//,'')\n end\n return nil\n end", "title": "" }, { "docid": "49e811ad4a41aff8a26cbd9ed8448ab4", "score": "0.6225288", "text": "def attachment\n object.attachment.try(:url)\n end", "title": "" }, { "docid": "7fc3265b03418d6cff0bf0749c5eea2e", "score": "0.61434245", "text": "def attachment_url\n return if attachments.nil?\n return unless %w[image audio video file].include? attachment_type\n\n attachments.first['payload']['url']\n end", "title": "" }, { "docid": "f70144f23a46e708473d64630d7fd4d0", "score": "0.61114", "text": "def is_internal_url_file_attachment(relative_url)\r\n #The URL may or may not have things like spaces and such escaped out, but in the Drupal\r\n #database such things are never escaped\r\n relative_url = CGI.unescape(relative_url)\r\n\r\n return @files.has_key?(relative_url)\r\n end", "title": "" }, { "docid": "3797f70816665ea3965c177a391c79bb", "score": "0.58809525", "text": "def file_url\n # implements by children\n end", "title": "" }, { "docid": "c9227b81bf25f337b4f3f27dec4d5b9a", "score": "0.58343834", "text": "def location\n @file.xpath('./location[@type=\"url\"]').first.try(:text) if @file.xpath('./location[@type=\"url\"]').present?\n end", "title": "" }, { "docid": "8f47317f09a95f7a503ee4f5da0d0c08", "score": "0.581102", "text": "def location\n @file.xpath('./location[@type=\"url\"]').first.try(:text) if @file.xpath('./location[@type=\"url\"]').present?\n end", "title": "" }, { "docid": "2f2a6f4d9185d3a710fdc0b3165106b4", "score": "0.57794267", "text": "def get_hyperlink\n unless cfr_location_type_id.nil? || uri.blank? \n /\\A(https?|file|ftp):\\/\\//i =~ uri ? uri : \"file://#{ uri }\"\n end\n end", "title": "" }, { "docid": "b2851e4ba1aaf46d787d581af5c94317", "score": "0.57550406", "text": "def thumbnail_url\n begin\n (ipaper_document && ipaper_document.thumbnail_url) || attached_file.url(:thumb)\n rescue\n raise ScribdFu::ScribdFuError, \"The thumbnail doesn't exist.\"\n end\n end", "title": "" }, { "docid": "3d420fd51b70178c7565921e504b5db4", "score": "0.5750821", "text": "def file_url\n url\n end", "title": "" }, { "docid": "fc05dab92099e58b259a600a91366ed2", "score": "0.5716238", "text": "def url\n file.url\n end", "title": "" }, { "docid": "fc05dab92099e58b259a600a91366ed2", "score": "0.5716238", "text": "def url\n file.url\n end", "title": "" }, { "docid": "21a13017d168f02abad4f8e021a75333", "score": "0.5711764", "text": "def download_url\n if URI.parse(file_uri).host.nil?\n PuppetForge.host + file_uri\n else\n file_uri\n end\n end", "title": "" }, { "docid": "6b7385c46f0ec424afc62517fc8a0a73", "score": "0.5699137", "text": "def does_internal_url_exist(parent_url, url)\r\n get_internal_object_from_url(parent_url, url) != nil\r\n end", "title": "" }, { "docid": "00d3057414e2c1976f8e62e397231cbd", "score": "0.5690541", "text": "def attachment_url\n @attributes[:attachment_url]\n end", "title": "" }, { "docid": "00d3057414e2c1976f8e62e397231cbd", "score": "0.5690541", "text": "def attachment_url\n @attributes[:attachment_url]\n end", "title": "" }, { "docid": "dcd70d7a7072c4e10d8102811d9345e7", "score": "0.56620586", "text": "def fetch_if_url(path, dest: '/tmp')\n if url?(path)\n fetch(path, dest)\n else\n # do nothing if local file\n path\n end\n end", "title": "" }, { "docid": "85ec8bf15fa1a8d5d8225be65ff6a394", "score": "0.56033576", "text": "def download_url\n if URI.parse(file_uri).host.nil?\n URI.join(PuppetForge.host, file_uri[1..-1]).to_s\n else\n file_uri\n end\n end", "title": "" }, { "docid": "2e6bb469972fe91d3d8b7520caa08dd3", "score": "0.5596503", "text": "def attachment_url\n image_url || original_image_url\n end", "title": "" }, { "docid": "eca13d83ba36158c157c81f3a947ec71", "score": "0.55896854", "text": "def url(type = nil)\n begin\n self.photo.url(type)\n rescue NoMethodError\n nil\n end\n if self.photo.url(type)\n self.photo.url(type)\n else\n \"\"\n end\n end", "title": "" }, { "docid": "5d6af29d2e2900ef527d9559de926a46", "score": "0.5564423", "text": "def file\n return nil unless self.valid?\n /(\\w+)(\\.\\w+)+(?!.*(\\w+)(\\.\\w+)+)/.match(url)[0]\n end", "title": "" }, { "docid": "f42f530e1f23f9f30028f6c76d5d483f", "score": "0.55483836", "text": "def obj_by_url(url)\n begin\n u = URI.parse(url)\n rescue URI::InvalidURIError\n return nil\n end\n\n if match = CONTENT_MATCHES.find { |k,_| u.path =~ k }\n # build the obj_key\n key = match[1].constantize.obj_key($~[1])\n article = Outpost.obj_by_key(key)\n article && article.published? ? article : nil\n else\n nil\n end\n end", "title": "" }, { "docid": "86ec32af157540e7ddc049034e83fd18", "score": "0.5539243", "text": "def path_url url\n begin\n path_to(url)\n rescue RuntimeError\n url\n end\nend", "title": "" }, { "docid": "ba729197888590f731e2bdf0b73c81d6", "score": "0.55370325", "text": "def is_valid_node?(node)\n url_from_artifact(node)\n end", "title": "" }, { "docid": "67fef4bd3a54672c769795fc0a28a5fa", "score": "0.5537008", "text": "def url\t\n \tself.file.url\n end", "title": "" }, { "docid": "d30c15507088e829a74d4d5683d09c67", "score": "0.553163", "text": "def url_for(path)\n if self.url\n File.join(url, path)\n else\n file.public_url\n end\n end", "title": "" }, { "docid": "cd0c95353e5a2953bfdc6ab039b03122", "score": "0.55134124", "text": "def file_url(file_path)\n \n url = nil\n \n if gd_file=get_file(file_path)\n url = gd_file.document_feed_entry.css(\"content\")[0][\"src\"]\n else\n puts \"fichero no existe\"\n end\n \n url\n \n end", "title": "" }, { "docid": "9fbd34eb805b6b818cdf8933a2917eb8", "score": "0.55083394", "text": "def obtain_source_from_url( url )\n id = make_guid()\n log_message( \"Downloading #{url} as #{id} ...\" ) unless @logging == false\n resp = @connection.post( \"source\", [{name: id, type: 'url', contentType: 'xml', data: url}] )\n parsed = JSON.parse(resp) \n if parsed.length > 0\n parsed[0]\n else\n nil\n end\n end", "title": "" }, { "docid": "4e1af60a82a50129547ca30e6b5195b8", "score": "0.5504264", "text": "def external_or_uploaded_image_url\n self.external_image_url && !self.external_image_url.empty? ? self.external_image_url : self.image_url\n end", "title": "" }, { "docid": "5ed71209da492c212fc4b51b13e09582", "score": "0.5503115", "text": "def thumbnail_reference?\n return true if fetch(references.reference_field, {})[\"http://schema.org/thumbnailUrl\"]\n false\n end", "title": "" }, { "docid": "08bc611a00c12588b26f18f70fd2f11a", "score": "0.54954666", "text": "def target(url)\n # An internal URL could have a path, but no host, like /plays/2.\n # It could also have the absolute URL with a scheme and host, in which\n # case, we can make the decision using the public URL whitelist\n is_internal = url.scheme.nil? || InternalHostWhitelist.any? do |host|\n url.host.downcase == host\n end\n\n return nil if is_internal\n\n \"_blank\"\n end", "title": "" }, { "docid": "e15f6f1e850552748a453af5e1fc07e9", "score": "0.54929554", "text": "def mini_url\n attachment.mini.url\n end", "title": "" }, { "docid": "69d616eceb7f9b8129265eb5090109ee", "score": "0.54928404", "text": "def content_url(usr)\n return nil # FIXME we have no target_dir anymore\n return nil unless metainfo\n if archived?\n return File.join(usr.target_dir_mountpoint,metainfo.name) if usr.target_dir_mountpoint\n else\n return File.join(usr.content_dir_mountpoint,metainfo.name) if usr.content_dir_mountpoint\n end\n return nil\n end", "title": "" }, { "docid": "c84d57932c4e38095d2e2197a0cb3524", "score": "0.5465608", "text": "def direct_reference?\n !url.nil?\n end", "title": "" }, { "docid": "c9ad8ddfabf4e208343a14c724f3827f", "score": "0.54560405", "text": "def abs_url url, host\n uri = url\n if uri && uri !~ /^http/\n uri = \"http://#{host}#{uri}\"\n end\n uri\n end", "title": "" }, { "docid": "32251910cb030208004d4f2b69e22d09", "score": "0.5452578", "text": "def uri\n return nil if page.nil?\n page.uri\n end", "title": "" }, { "docid": "2b767fdfe30a706d7ccf7e0fa8a7672a", "score": "0.5451295", "text": "def url_for_file(file)\n (file =~ /^(http:\\/\\/|\\/)/i) ? file : base_url + file if file\n end", "title": "" }, { "docid": "56d67550b99b6686a870ad6f206ea52a", "score": "0.5446784", "text": "def url\n begin\n URI.join(self.resource.root, self.href.to_s).to_s\n rescue StandardError\n nil\n end\n end", "title": "" }, { "docid": "babbd86cf86c0de03657bf556b61d593", "score": "0.5444985", "text": "def get(url)\n File.open(filepath(url), \"rb\")\n rescue Errno::ENOENT\n nil\n end", "title": "" }, { "docid": "c67a5448b0d1e5f75ca8a41edef395c1", "score": "0.5443809", "text": "def find(url, options = {})\n config = Resource::System.configuration(options)\n find_from_config(\"config/urlBase[text()='#{url}']\", config, options)\n rescue Error::HTTPError => e\n raise unless e.code == 404\n\n nil\n end", "title": "" }, { "docid": "e53726bdbf977fd9f9da546c9b67de34", "score": "0.5436257", "text": "def get_url(type)\n attachment = self.attachments.find{|att| att.name.include?(\"#{self.reconcilation_ref_number}-#{type}\")}\n if attachment.present?\n s3_file = Aws::S3::Bucket.new(attachment.s3_bucket).object(attachment.s3_path)\n url = s3_file.presigned_url(:get, secure: true, expires_in: 7200).to_s\n @file = open(url)\n else\n @file = open(\"https://s3.amazonaws.com/syportalattachments/sample_files/ccavenue_reconcilation_with_no_data.xls\")\n end\n return @file\n end", "title": "" }, { "docid": "3bef0edbec04346da83554f1a4f97573", "score": "0.5425672", "text": "def find_link\r\n @linkable.link if @linkable.present?\r\n end", "title": "" }, { "docid": "61bc3b0e8c229dcbf2f28c7038df929a", "score": "0.54236376", "text": "def best_url(record)\n url(record).select { |u| u.include?('libraries.mit.edu/get') }.first\n end", "title": "" }, { "docid": "d43fe45e44083f077bed036d893e7895", "score": "0.54230225", "text": "def node_external_ref?\n nil\n end", "title": "" }, { "docid": "05f490677d09159ce7a060b0156a640d", "score": "0.5421598", "text": "def uri\n @uri ||= URI(url.link)\n end", "title": "" }, { "docid": "e06c7f4d76dbdffc81034bc25d02b49e", "score": "0.5413726", "text": "def url\n nil\n end", "title": "" }, { "docid": "86b86a6052895879bf400bb4aac0801c", "score": "0.54069644", "text": "def external_url(url)\n if url.present?\n if (url.starts_with?(\"http://\") || url.starts_with?(\"https://\"))\n url\n else\n \"http://#{url}\"\n end\n end\n end", "title": "" }, { "docid": "e23d2f7b7f88213817c915dbe5d56856", "score": "0.5388513", "text": "def sample_url(sample_attachment)\n begin\n if sample_attachment != nil\n if sample_attachment.media_item != nil\n return sample_attachment.media_item.public_filename\n end\n end\n rescue\n logger.debug(\"sample attachment filename error\")\n end\n #default\n return \"http://sounz.org.nz/home\"\n\n end", "title": "" }, { "docid": "d6fe80e3b2623cad0cb3e594abadddce", "score": "0.5379245", "text": "def image_reference\n return nil if @document[@document.references.reference_field].nil?\n\n JSON.parse(@document[@document.references.reference_field])['http://schema.org/thumbnailUrl']\n end", "title": "" }, { "docid": "553b9f845ebaeb5677637af9c1e9c90a", "score": "0.5377189", "text": "def medium_url\n is_processed ? FileSystem.url(medium_path) : image_url\n end", "title": "" }, { "docid": "bc17494fd04641536a850a70515317d4", "score": "0.53680164", "text": "def download_url\n object.file.url\n end", "title": "" }, { "docid": "fe6c0f69333446483a2056451a6eebfd", "score": "0.5357012", "text": "def attachment_default_url\n ''\n end", "title": "" }, { "docid": "d6241cfd1d66d19f7c9dd88fd7076fb6", "score": "0.5352989", "text": "def thumbnail_reference\n JSON.parse(@document[@document.references.reference_field])['http://schema.org/thumbnailUrl']\n end", "title": "" }, { "docid": "84a8f8173b7d06bcd5c093f91ec1e690", "score": "0.53389245", "text": "def url_display_as(url) \n begin\n return URI.parse(url).host\n rescue\n return url\n end \n end", "title": "" }, { "docid": "b3cd4b43bac298d30c2065049f6d190a", "score": "0.53374946", "text": "def url\n begin\n URI.join(self.root, (self.href || '')).to_s\n rescue StandardError\n nil\n end\n end", "title": "" }, { "docid": "bbd9a4ec42d82447d9fa8df75de97439", "score": "0.5334312", "text": "def find_from_url(url)\n # If the url contains the word '_view' it means it will return objects as an array,\n # how ever if it doesn't it means the user is getting an ID-based url like /properties/abcd\n # which will only return a single object\n if url =~ /_view/\n instantiate_collection(connection.get(url))\n else\n begin\n instantiate_object(connection.get(url))\n rescue ResourceNotFound\n nil\n end\n end\n end", "title": "" }, { "docid": "1c45d9b61ee9dda3fb80cbb5d072b833", "score": "0.53311616", "text": "def external_download_url\n @file.external_bytestream_uri.to_s\n end", "title": "" }, { "docid": "19313f4d51a747ad23b261ab62a1814e", "score": "0.5325324", "text": "def extractPathFromURL(url)\n path = URI(url).path\n return path == nil || path.length == 0 ? url : path \nend", "title": "" }, { "docid": "a0ce2df29790a793a0fe37f8d88f8fcd", "score": "0.53231555", "text": "def url\n nil\n end", "title": "" }, { "docid": "a0ce2df29790a793a0fe37f8d88f8fcd", "score": "0.53231555", "text": "def url\n nil\n end", "title": "" }, { "docid": "b21cc65da789cb5f66a4ca196b9e0edc", "score": "0.5322665", "text": "def url(url_type = nil)\n url = media.url\n\n url_by_url_type url, url_type\n end", "title": "" }, { "docid": "da2a21bb128f3dc2e1441b29dcfbfbbf", "score": "0.5322344", "text": "def check_file(url, ref)\n if get_head(url) == false\n add_invalid_url(url, ref)\n else\n add_valid_url(url, ref)\n end\n end", "title": "" }, { "docid": "faaa443228f21104f79580d67ac0a195", "score": "0.5319486", "text": "def photo_link(object)\n # get external record id from contributor association with\n # to create a link to the external url for the photo\n @extern_rec = get_contr_from_id(object)\n unless @extern_rec.blank?\n if @extern_rec.contr_id == 9\n return \"http://www.canadianheadstones.com/ab/view.php?id=\" + @extern_rec.ex_rec_id.to_s\n else \n return object.photo_URL\n end\n else\n # else return nil\n return nil\n end\n return nil\n end", "title": "" }, { "docid": "2715b370f488176b6152e67f244354a8", "score": "0.5313154", "text": "def og_image_url\n job_image.try(:attachment_full_url, :jumbo)\n end", "title": "" }, { "docid": "c7e8cb72dc224f7a49306ed56725e09d", "score": "0.53126585", "text": "def abs_url url, host\n uri = url\n if uri && uri !~ /^http/\n uri = \"//#{host}#{uri}\"\n end\n uri\n end", "title": "" }, { "docid": "b555f458a45ac9bab8d5f527c47f684e", "score": "0.5312598", "text": "def fix_relative_url(url)\n begin\n return URI.join(self.link, url).to_s if URI.parse(url).host.nil? && !URI.join(self.link, url).host.nil?\n rescue\n end\n return url\n end", "title": "" }, { "docid": "0484e568e2ff5dbbe01fd5a46e4e8434", "score": "0.53091604", "text": "def get_url(result)\n if result.item_links.item_link[0]\n url = result.item_links.item_link[0].url\n else\n url = \"n/a\"\n end\n return url\n end", "title": "" }, { "docid": "7ca876d3c8af08432a5a50df6014cbc6", "score": "0.53078437", "text": "def page_url\n nil\n end", "title": "" }, { "docid": "7ca876d3c8af08432a5a50df6014cbc6", "score": "0.53078437", "text": "def page_url\n nil\n end", "title": "" }, { "docid": "0cfaeec0df4577c32d2418108eca5d58", "score": "0.5307431", "text": "def url\n @url || @url_text_html || @url_notype\n end", "title": "" }, { "docid": "91089071d2f8325035638f81b179a516", "score": "0.5305988", "text": "def url_must_open\n file = URI.parse(url).open\n end", "title": "" }, { "docid": "128518d0040cc774173179e82ea5c757", "score": "0.5304634", "text": "def guess_url(host = nil)\n this = self.class.new(model, mounted_as)\n this.retrieve_from_store!(model.read_uploader(mounted_as))\n\n if this.url =~ /^http/ || host.blank?\n this.url\n else\n URI.join(\"http://#{host}\", this.url).to_s\n end\n end", "title": "" }, { "docid": "02ee7c7982823eb9870f8defc2287a65", "score": "0.53044105", "text": "def node\n @node ||=\n if @permalink \n TreeNode.find_by_permalink_and_has_url(@permalink, true) rescue nil\n else\n website_node\n end\n end", "title": "" }, { "docid": "6b8aead9ba27c3c02f0b236794c007d0", "score": "0.5300758", "text": "def file_is_present?(file)\n return unless file && file.respond_to?(:url)\n\n file.present?\n end", "title": "" }, { "docid": "0b4086d8862f8c23255c503eb90f2960", "score": "0.5288263", "text": "def update_url_if_redirected(url, url_object)\n\t\t#puts \"Comparing the original URL with the return object base_uri. Return the one where the true content is found. \" if @verbose\n\t\tif url != url_object.base_uri.to_s\n\t\t\treturn url_object.base_uri.to_s\n\t\tend\n\t\treturn url\n rescue => ee\n puts \"Exception on method #{__method__}: #{ee}\" if @verbose\n return nil\n end", "title": "" }, { "docid": "f63b3eeebdaa406200a0464cd74581cb", "score": "0.5286843", "text": "def url_for_document doc\n doc\n end", "title": "" }, { "docid": "a84ea4d53a832dd42c950e891b24a4dd", "score": "0.5281782", "text": "def link_lookup(url)\n return get_request(\n \"/user/link_lookup\", \n :url => url\n ){|data| data['link_lookup'].first} \n end", "title": "" }, { "docid": "521dd2a8665e471f159d9988240dc673", "score": "0.5281362", "text": "def url\n link.href\n end", "title": "" }, { "docid": "00e7517a2d4a49698ab7c98983f98258", "score": "0.5269802", "text": "def is_foreign?(url, page=nil)\n\n page = @base_url if page.nil?\n \n different_site = false\n\n has_bad_scheme = url[0..1] == '//'\n\n different_site = url.match(page).nil? unless url[0] == '/'\n\n has_bad_scheme or different_site\n end", "title": "" }, { "docid": "f620cbd6b4734247e9e5888c1938598b", "score": "0.5264155", "text": "def url\n @url ||= presentable\n end", "title": "" }, { "docid": "cce384ff064e9a59d49a7ac0b2f266a3", "score": "0.5261134", "text": "def fetch_url(item)\n\tif !item\n\t\treturn \"http://www.gumtree.com/all/london\"\n\telse\n\t\treturn item.at_css(\"a\").attributes[\"href\"].value\n\tend\nend", "title": "" }, { "docid": "c00fe8ebb21af8a895424c0dbc00a82f", "score": "0.52560306", "text": "def default_url\n if attachment_options[:default_url].respond_to?(:call)\n attachment_options[:default_url].call(@attachment)\n elsif attachment_options[:default_url].is_a?(Symbol)\n @attachment.instance.send(attachment_options[:default_url])\n else\n attachment_options[:default_url]\n end\n end", "title": "" }, { "docid": "c00fe8ebb21af8a895424c0dbc00a82f", "score": "0.52560306", "text": "def default_url\n if attachment_options[:default_url].respond_to?(:call)\n attachment_options[:default_url].call(@attachment)\n elsif attachment_options[:default_url].is_a?(Symbol)\n @attachment.instance.send(attachment_options[:default_url])\n else\n attachment_options[:default_url]\n end\n end", "title": "" }, { "docid": "090e7f88cb5b81d6610bb90c0a4fda6b", "score": "0.52511704", "text": "def url_for filename\n file = @gist.files[filename]\n file.rels[:raw].href if file\n end", "title": "" }, { "docid": "d822876a39d5e2cbb29c847af6136a3b", "score": "0.5246841", "text": "def path\n return false unless url\n url.path\n end", "title": "" }, { "docid": "cbcc036203d5892795c438263dfd1505", "score": "0.52465326", "text": "def find_by_url(url)\n begin\n u = URI.parse(url)\n rescue URI::InvalidURIError\n return nil\n end\n\n u.path.match(%r{\\A/(\\d+)}) do |match|\n Post.published.find_by_id(match[1])\n end\n end", "title": "" }, { "docid": "bf0f88208d865975c81c2e0d6c0490d7", "score": "0.52328527", "text": "def absolutize link_or_path, attr=:href\n path =\n case link_or_path\n when String\n link_or_path\n when Mechanize::Page::Link\n link_or_path.href\n when Nokogiri::XML::Element\n link_or_path.attribute(attr.to_s).to_s\n when Nokogiri::XML::Attr\n link_or_path.to_s\n when respond_to?(attr.to_sym)\n link_or_path.send attr.to_sym\n when nil\n return nil\n end\n path.present? ? URI.decode(safe_uri_join(url, path).to_s) : url\n end", "title": "" }, { "docid": "e03b81a74047997d3e411b6b58a63a86", "score": "0.5231729", "text": "def find_link\n @link = @node.content\n end", "title": "" }, { "docid": "c08980e01be324c88447a12305d0e8dd", "score": "0.5224816", "text": "def absolute_website_url\n if author.website.blank?\n nil\n elsif author.website[0,7] == \"http://\" or author.website[0,8] == \"https://\"\n author.website\n else\n \"http://#{author.website}\"\n end\n end", "title": "" }, { "docid": "c64de7a4aa50df05fbf571a63d4d3f4d", "score": "0.5217772", "text": "def file_reference\n file_data&.presence&.symbolize_keys&.values_at(:name, :url)&.compact&.first\n end", "title": "" }, { "docid": "dd5455d0e5e7da2d4914e5695b23999e", "score": "0.5203731", "text": "def file_from_url( url )\n # parsed_url = URI.parse( url )\n # \n # if parsed_url.class != URI::HTTP \n # raise \"Invalid URL. Could not parse #{url} as a HTTP url.\"\n # end\n \n begin\n file = open( url )\n return file\n rescue OpenURI::HTTPError => e\n raise \"Could not retrieve file from #{url}. Error: #{e}\"\n rescue Exception => e \n raise \"Could not retrieve file from #{url}. Error: #{e}\"\n end\n end", "title": "" }, { "docid": "f6955621909a82c67f870665665848f8", "score": "0.5202567", "text": "def url\n \"http://192.41.170.159:3000\"+\"#{attachment.url}\"\n end", "title": "" }, { "docid": "22edf2933a354807d00d1a746b8e696b", "score": "0.5201027", "text": "def check_for_url\n raise NoUrlError.new, NoUrlError.default_message if arkenstone_url.nil?\n end", "title": "" }, { "docid": "5160c9112650187663c1dcb9e4f636b2", "score": "0.5194871", "text": "def url\n @options[:url] || children.first.url\n end", "title": "" }, { "docid": "802cf32c16f327bb44b0e91d3758eae1", "score": "0.51877296", "text": "def service_url\n return unless @document.available?\n protocol = @document.viewer_protocol\n return if protocol == 'map' || protocol.nil?\n \"#{protocol.camelcase}Thumbnail\".constantize.thumbnail_url(@document, size)\n rescue NameError\n return nil\n end", "title": "" }, { "docid": "69db2ea45dca6413898069a5f3e56fce", "score": "0.5186336", "text": "def download_uri\n return nil unless self.export_id\n # the first match from https:// until a space or the end of the line\n @download_uri ||= @mail.text_part.body.decoded[/(https?:\\/\\/[^\\s$]+)/, 1]\n end", "title": "" }, { "docid": "79a687424848b8cb5ab2a83043a60cc7", "score": "0.5184033", "text": "def migrate_linked_file?(uri)\n host = uri.host.to_s\n path = uri.path.to_s\n if(host == 'www.cma.uio.no')\n if(path != '/' and path != '')\n return true\n else\n return false\n end\n elsif(host != '')\n return false\n end\n return super(uri)\n end", "title": "" }, { "docid": "281872d19d2b8a3a1a6d0d082605f3bc", "score": "0.5175189", "text": "def url\n self.external_link\n end", "title": "" }, { "docid": "4b78a5a096c31e0edf756697d19c6549", "score": "0.51727825", "text": "def get_file_input(event)\n\tif (event.message.attachments.empty?)\n\t\tchan_hist = event.channel.history(50)\n\t\tchan_hist.each do |msg|\n\t\t\tif (!msg.attachments.empty?)\n\t\t\t\tdebug_puts(msg.attachments[0].url)\n\t\t\t\treturn msg.attachments[0].url\n\t\t\telsif (!msg.embeds.empty?)\n\t\t\t\tdebug_puts(msg.embeds[0].url)\n\t\t\t\treturn msg.embeds[0].url\n\t\t\tend\n\t\tend\n\telse\n\t\tdebug_puts(event.message.attachments[0].url)\n\t\treturn event.message.attachments[0].url\n\tend\n\treturn nil\nend", "title": "" } ]
3f92157c5defbbe3ba7d9f8f1e31d490
Checks if the stack is empty
[ { "docid": "ddb139ab2cdb07d024bfa816136dd30d", "score": "0.89308864", "text": "def empty?\n\t\t@stack.empty?\n\tend", "title": "" } ]
[ { "docid": "a33cdbd34d0831e1368d6d3d9e84e45f", "score": "0.9192175", "text": "def is_empty?\n return @stack.length == 0\n end", "title": "" }, { "docid": "2fd3e24a7a81e331e11d7b96f057ba56", "score": "0.9045652", "text": "def empty?\n @stack.length == 0\n end", "title": "" }, { "docid": "755320db37a136eb926691574bd5a43b", "score": "0.90008324", "text": "def empty?\n @stack.empty?\n end", "title": "" }, { "docid": "755320db37a136eb926691574bd5a43b", "score": "0.90008324", "text": "def empty?\n @stack.empty?\n end", "title": "" }, { "docid": "755320db37a136eb926691574bd5a43b", "score": "0.90008324", "text": "def empty?\n @stack.empty?\n end", "title": "" }, { "docid": "755320db37a136eb926691574bd5a43b", "score": "0.90008324", "text": "def empty?\n @stack.empty?\n end", "title": "" }, { "docid": "57b8c6dbd039e23df6cacfdd596b36fb", "score": "0.8994214", "text": "def empty?()\n return @stack.empty?\n end", "title": "" }, { "docid": "a279aaf28aa80c1330289472dd6bc9e0", "score": "0.89658415", "text": "def empty?\n @stack.length === 0 ? true : false\n end", "title": "" }, { "docid": "24e6a244cfb9a35d6e1ff7a31d94da06", "score": "0.8961481", "text": "def empty?\n @stack.empty?\n end", "title": "" }, { "docid": "11bcc54068825e0f5c4901664299075a", "score": "0.89359355", "text": "def is_empty()\n @stack1.empty?\n end", "title": "" }, { "docid": "7fc3dddb66e1ff605e6b8a466bed7d3f", "score": "0.870208", "text": "def empty\n @stack.empty?\n end", "title": "" }, { "docid": "3b907680cc828c67c65b35b983dc9be4", "score": "0.85999006", "text": "def stack_empty?(stack)\n if stack.empty?\n puts \"Error: empty stack\"\n return true\n end\n false\nend", "title": "" }, { "docid": "07429e4aca69851e1438afd30c7e8c6d", "score": "0.8149075", "text": "def empty?\n return (@source.empty? and @stack.empty?)\n end", "title": "" }, { "docid": "623fb849a33c3b96960a06dde16c6028", "score": "0.80973697", "text": "def empty?\n event_stack.empty?\n end", "title": "" }, { "docid": "0c3d75f29895caaac9b3c8db9c852737", "score": "0.80654943", "text": "def empty?(&block)\n empty = @stack.empty?\n yield empty if not block.nil?\n return empty\n end", "title": "" }, { "docid": "2c4abcb35857615029db6eb9eb629683", "score": "0.8035585", "text": "def empty()\n @stack1.empty? && @stack2.empty?\n end", "title": "" }, { "docid": "8fc77ad96c1c0720b6b72613bebe91ef", "score": "0.79854405", "text": "def any?\n @stack.size != 0\n end", "title": "" }, { "docid": "4a9b95c3c039eb36fe6f80ca48f79aab", "score": "0.79490376", "text": "def test_empty_stack\n assert_equal true, @stack.empty?\n end", "title": "" }, { "docid": "677f86f2045d22d8f09a9b5231c3693e", "score": "0.78787076", "text": "def check_stack\n\t\tif @stack.empty?\n\t\t\traise \"calculator is empty\"\n\t\tend\n\tend", "title": "" }, { "docid": "b7941db6ff57c3ae8b7d5b8a048ac060", "score": "0.78754264", "text": "def empty?\n @top == 0\n end", "title": "" }, { "docid": "79d85ac1ce92ffdb99694a0500cc99ad", "score": "0.7869935", "text": "def empty\n stack1.empty? && stack2.empty?\n end", "title": "" }, { "docid": "244f7f8fe123e5ff18f460a008a1a754", "score": "0.7858093", "text": "def empty?\n if @top.nil?\n true\n else\n false\n end\n end", "title": "" }, { "docid": "ebbaa7c7d4f31091ba6f521b12114a7b", "score": "0.7850407", "text": "def empty()\n support_stack1 == [] && support_stack2 == []\n end", "title": "" }, { "docid": "c51dfff62226fce02e03a9fcba4efe84", "score": "0.7816282", "text": "def empty?\n @top.nil? || @top < 0\n end", "title": "" }, { "docid": "43ccb7cc32b06913eb3a637a23e601a6", "score": "0.7752446", "text": "def empty?\n @top.nil?\n end", "title": "" }, { "docid": "43ccb7cc32b06913eb3a637a23e601a6", "score": "0.7752446", "text": "def empty?\n @top.nil?\n end", "title": "" }, { "docid": "a2935c22181b0105a22f0c4a576ddbcf", "score": "0.7745753", "text": "def check_empty_nodes!\n return unless @nodes.empty? && @options[:stacks]\n logger.error \"ERROR: No stacks were found that match: #{@options[:stacks].join(' ')}\".color(:red)\n exit 1\n end", "title": "" }, { "docid": "08b3196557358af424260c1eb05a14ee", "score": "0.7742224", "text": "def stack_empty(command, stack)\n if stack.empty?\n \"Error, stack empty when trying to #{command}\"\n else\n nil\n end\nend", "title": "" }, { "docid": "e7e1fba243d7dc39695b48990171a74b", "score": "0.76624393", "text": "def empty?\n @top == -1\n end", "title": "" }, { "docid": "e7e1fba243d7dc39695b48990171a74b", "score": "0.76624393", "text": "def empty?\n @top == -1\n end", "title": "" }, { "docid": "8cf2cd565921c44054d51aa0c7b76ce2", "score": "0.73659366", "text": "def is_empty?\n size == 0\n end", "title": "" }, { "docid": "892aa68caadfa311075deef12000a484", "score": "0.736294", "text": "def is_empty?\n size == 0\n end", "title": "" }, { "docid": "babb3a776b91195fcc726eccbf34d6b9", "score": "0.73599017", "text": "def is_empty\n @size == 0\n end", "title": "" }, { "docid": "24b0bca3144f19540986a3fc883f216f", "score": "0.73472285", "text": "def empty?\n return size == 0\n end", "title": "" }, { "docid": "941ddeccf6eee063828718ff983c5467", "score": "0.7335036", "text": "def empty?\n @state == :empty\n end", "title": "" }, { "docid": "19567efdf86d2d415a3ca7a3fb94032e", "score": "0.7324503", "text": "def empty?\n scope.size == 0\n end", "title": "" }, { "docid": "00cba19ecf2c2c97a6cf6a9f465b1ea0", "score": "0.7323568", "text": "def empty?\n size == 0\n end", "title": "" }, { "docid": "00cba19ecf2c2c97a6cf6a9f465b1ea0", "score": "0.7323568", "text": "def empty?\n size == 0\n end", "title": "" }, { "docid": "00cba19ecf2c2c97a6cf6a9f465b1ea0", "score": "0.7323568", "text": "def empty?\n size == 0\n end", "title": "" }, { "docid": "fa6dd36571486ec9a4f34cba04e73a08", "score": "0.7304892", "text": "def stack_has_next?\n !@next_stack_element.nil?\n end", "title": "" }, { "docid": "fea436b33d11798735b2130b6ea54d36", "score": "0.73039687", "text": "def empty?\n size == 0\n end", "title": "" }, { "docid": "fea436b33d11798735b2130b6ea54d36", "score": "0.73039687", "text": "def empty?\n size == 0\n end", "title": "" }, { "docid": "849e29deb96d8bfeeace10438b005d0a", "score": "0.7294791", "text": "def empty?\n size == 0\n end", "title": "" }, { "docid": "849e29deb96d8bfeeace10438b005d0a", "score": "0.7294791", "text": "def empty?\n size == 0\n end", "title": "" }, { "docid": "849e29deb96d8bfeeace10438b005d0a", "score": "0.7294791", "text": "def empty?\n size == 0\n end", "title": "" }, { "docid": "849e29deb96d8bfeeace10438b005d0a", "score": "0.7294791", "text": "def empty?\n size == 0\n end", "title": "" }, { "docid": "849e29deb96d8bfeeace10438b005d0a", "score": "0.7294791", "text": "def empty?\n size == 0\n end", "title": "" }, { "docid": "849e29deb96d8bfeeace10438b005d0a", "score": "0.7294791", "text": "def empty?\n size == 0\n end", "title": "" }, { "docid": "849e29deb96d8bfeeace10438b005d0a", "score": "0.7294791", "text": "def empty?\n size == 0\n end", "title": "" }, { "docid": "849e29deb96d8bfeeace10438b005d0a", "score": "0.7294791", "text": "def empty?\n size == 0\n end", "title": "" }, { "docid": "849e29deb96d8bfeeace10438b005d0a", "score": "0.7294791", "text": "def empty?\n size == 0\n end", "title": "" }, { "docid": "849e29deb96d8bfeeace10438b005d0a", "score": "0.7294791", "text": "def empty?\n size == 0\n end", "title": "" }, { "docid": "849e29deb96d8bfeeace10438b005d0a", "score": "0.7294791", "text": "def empty?\n size == 0\n end", "title": "" }, { "docid": "dad392ab7ab002dc86a9f02d7c134562", "score": "0.7285325", "text": "def empty?\n @mutex.synchronize do\n return @traces.empty?\n end\n end", "title": "" }, { "docid": "dad392ab7ab002dc86a9f02d7c134562", "score": "0.7285325", "text": "def empty?\n @mutex.synchronize do\n return @traces.empty?\n end\n end", "title": "" }, { "docid": "83736838c1ecf2d9a3517861ace15911", "score": "0.72753066", "text": "def test_not_empty_stack\n @stack.push(5)\n @stack.push(6)\n assert_equal false, @stack.empty?\n end", "title": "" }, { "docid": "56c33be255b0437433daa66be3f93eac", "score": "0.7274893", "text": "def empty?\n size.zero?\n end", "title": "" }, { "docid": "7bf4413c5f39818a86cbc6d148808ce2", "score": "0.7274649", "text": "def empty?\n size.zero?\n end", "title": "" }, { "docid": "7bf4413c5f39818a86cbc6d148808ce2", "score": "0.7274649", "text": "def empty?\n size.zero?\n end", "title": "" }, { "docid": "7bf4413c5f39818a86cbc6d148808ce2", "score": "0.7274649", "text": "def empty?\n size.zero?\n end", "title": "" }, { "docid": "34af49ad2f7afb4515d6a264871952fd", "score": "0.7271287", "text": "def empty?\n return size == 0\n end", "title": "" }, { "docid": "51591746fe62836dbf8ff0477995f267", "score": "0.72617227", "text": "def is_empty?\n @size == 0\n end", "title": "" }, { "docid": "b7063f58fc2a649e8ff2c9f52e4f3248", "score": "0.72497994", "text": "def empty?()\n @size==0\n end", "title": "" }, { "docid": "f426e7c60aa34fa7aea64065a5cf273d", "score": "0.72485405", "text": "def empty?\r\n @size == 0\r\n end", "title": "" }, { "docid": "e666760fd07f1d61258f616afb94dc77", "score": "0.72348243", "text": "def empty?\n @size == 0\n end", "title": "" }, { "docid": "e666760fd07f1d61258f616afb94dc77", "score": "0.72348243", "text": "def empty?\n @size == 0\n end", "title": "" }, { "docid": "e666760fd07f1d61258f616afb94dc77", "score": "0.72348243", "text": "def empty?\n @size == 0\n end", "title": "" }, { "docid": "e666760fd07f1d61258f616afb94dc77", "score": "0.72348243", "text": "def empty?\n @size == 0\n end", "title": "" }, { "docid": "52a6ce8203ff8a201e452aa26717721b", "score": "0.72328836", "text": "def empty?\n @size == 0\n end", "title": "" }, { "docid": "52a6ce8203ff8a201e452aa26717721b", "score": "0.72328836", "text": "def empty?\n @size == 0\n end", "title": "" }, { "docid": "52a6ce8203ff8a201e452aa26717721b", "score": "0.72328836", "text": "def empty?\n @size == 0\n end", "title": "" }, { "docid": "52a6ce8203ff8a201e452aa26717721b", "score": "0.72328836", "text": "def empty?\n @size == 0\n end", "title": "" }, { "docid": "52a6ce8203ff8a201e452aa26717721b", "score": "0.72328836", "text": "def empty?\n @size == 0\n end", "title": "" }, { "docid": "52a6ce8203ff8a201e452aa26717721b", "score": "0.72328836", "text": "def empty?\n @size == 0\n end", "title": "" }, { "docid": "52a6ce8203ff8a201e452aa26717721b", "score": "0.72328836", "text": "def empty?\n @size == 0\n end", "title": "" }, { "docid": "52a6ce8203ff8a201e452aa26717721b", "score": "0.72328836", "text": "def empty?\n @size == 0\n end", "title": "" }, { "docid": "52a6ce8203ff8a201e452aa26717721b", "score": "0.72328836", "text": "def empty?\n @size == 0\n end", "title": "" }, { "docid": "52a6ce8203ff8a201e452aa26717721b", "score": "0.72328836", "text": "def empty?\n @size == 0\n end", "title": "" }, { "docid": "52a6ce8203ff8a201e452aa26717721b", "score": "0.72328836", "text": "def empty?\n @size == 0\n end", "title": "" }, { "docid": "52a6ce8203ff8a201e452aa26717721b", "score": "0.72328836", "text": "def empty?\n @size == 0\n end", "title": "" }, { "docid": "52a6ce8203ff8a201e452aa26717721b", "score": "0.72328836", "text": "def empty?\n @size == 0\n end", "title": "" }, { "docid": "52a6ce8203ff8a201e452aa26717721b", "score": "0.72328836", "text": "def empty?\n @size == 0\n end", "title": "" }, { "docid": "195268cdc7bd2a0d61fda344430fb163", "score": "0.72314405", "text": "def is_empty()\n @root == nil\n end", "title": "" }, { "docid": "e830e2457f08403c782ecbe0ae85fff8", "score": "0.72242165", "text": "def empty?\n return @size == 0\n end", "title": "" }, { "docid": "e830e2457f08403c782ecbe0ae85fff8", "score": "0.72242165", "text": "def empty?\n return @size == 0\n end", "title": "" }, { "docid": "61ee73c5a55c9e5abb4f39af3a8605d3", "score": "0.7202449", "text": "def empty?\n @size.zero?\n end", "title": "" }, { "docid": "6a72a43e29687ab2b79d686adc25cf7c", "score": "0.71988755", "text": "def is_empty()\n @queue == []\n end", "title": "" }, { "docid": "cf86330b9fa63e6eb180598c004918b8", "score": "0.71943575", "text": "def empty?\n @msg_frames.empty?\n end", "title": "" }, { "docid": "09a669dc4276439d93ac16c542304396", "score": "0.71907705", "text": "def empty?\n\n\t\t0 == size\n\tend", "title": "" }, { "docid": "44b762fac0dd5c5357ec18a07ad44dc4", "score": "0.71848536", "text": "def empty?()\n return (count == 0)\n end", "title": "" }, { "docid": "1237b0ee923cc892aea060884508bc86", "score": "0.71835655", "text": "def empty?\n count == 0\n end", "title": "" }, { "docid": "1237b0ee923cc892aea060884508bc86", "score": "0.71835655", "text": "def empty?\n count == 0\n end", "title": "" }, { "docid": "824c7ac447e07f9e796800a4a2b29f9b", "score": "0.7180692", "text": "def empty?\n size == 0\n end", "title": "" }, { "docid": "824c7ac447e07f9e796800a4a2b29f9b", "score": "0.7180692", "text": "def empty?\n size == 0\n end", "title": "" }, { "docid": "824c7ac447e07f9e796800a4a2b29f9b", "score": "0.7180692", "text": "def empty?\n size == 0\n end", "title": "" }, { "docid": "6963872ff1dfff738b075937a0a7fffd", "score": "0.7170738", "text": "def empty?\n count == 0\n end", "title": "" }, { "docid": "6963872ff1dfff738b075937a0a7fffd", "score": "0.7170738", "text": "def empty?\n count == 0\n end", "title": "" }, { "docid": "6963872ff1dfff738b075937a0a7fffd", "score": "0.7170738", "text": "def empty?\n count == 0\n end", "title": "" }, { "docid": "6963872ff1dfff738b075937a0a7fffd", "score": "0.7170738", "text": "def empty?\n count == 0\n end", "title": "" }, { "docid": "574cd9fe8adc220ee98bced9eeef3a3d", "score": "0.7169677", "text": "def empty?\n Count() == 0\n end", "title": "" } ]
39308470b746211981c85ae5e615af08
Returns the median grade for this assessment, using all grades in self.completed_result_marks. If +points+ is true, this returns the raw median point grade for this assessment. Otherwise, the median percentage grade for this assessment is returned.
[ { "docid": "596fdbd67d021a52673923d9dee9902c", "score": "0.7868807", "text": "def results_median(points: false)\n return 0 if self.max_mark.zero?\n\n marks = self.completed_result_marks\n if marks.empty?\n 0\n else\n point_median = DescriptiveStatistics.median(marks)\n points ? point_median : (point_median * 100 / self.max_mark).round(2).to_f\n end\n end", "title": "" } ]
[ { "docid": "a6d4d0d11739812d82fd9b96942b192d", "score": "0.6726727", "text": "def median\n return 0 if self.max_mark.zero?\n\n marks = grades_array\n marks.empty? ? 0 : DescriptiveStatistics.median(marks)\n end", "title": "" }, { "docid": "a7608d6e45d247cad8e112c031d09a3a", "score": "0.6708305", "text": "def median\n return 0 if self.out_of.zero?\n\n marks = grades_array\n marks.empty? ? 0 : DescriptiveStatistics.median(marks)\n end", "title": "" }, { "docid": "e024bea3b17d603dcb5763a5ea28982f", "score": "0.63758796", "text": "def median_percentage\n marks = enrolled_students.map{ |x| x.average_percentage }\n median(marks)\n end", "title": "" }, { "docid": "bb0872d7acb9e77ffff2fa0bd6c8d73b", "score": "0.6320328", "text": "def calculate_median\n percentage_grades = percentage_grades_array\n percentage_grades.blank? ? 0 : DescriptiveStatistics.median(percentage_grades)\n end", "title": "" }, { "docid": "49b929cc9e54e18f60fbd22df1a5e82a", "score": "0.62718815", "text": "def median_mark\n marks = answers.map{|x| x.earned_marks }\n median(marks)\n end", "title": "" }, { "docid": "5b74d6700cf70a2181b3dcee7332eafc", "score": "0.6122048", "text": "def grade\n median(grades.sort_by(&:to_sym))\n end", "title": "" }, { "docid": "5765c5bb47a0fcf5898cc45a1cb14c5b", "score": "0.60861367", "text": "def median_marks_earned\n marks = student_test.map{ |x| x.earned_marks }\n median(marks)\n end", "title": "" }, { "docid": "56737481e75d5bd52c84f2fde6e3d7d1", "score": "0.6074834", "text": "def results_average(points: false)\n return 0 if self.max_mark.zero?\n\n marks = self.completed_result_marks\n if marks.empty?\n 0\n else\n point_average = DescriptiveStatistics.mean(marks)\n points ? point_average : (point_average * 100 / self.max_mark).round(2).to_f\n end\n end", "title": "" }, { "docid": "f2f921ba3760ee55f431bcc7730ad204", "score": "0.5900251", "text": "def median\n value(0.5)\n end", "title": "" }, { "docid": "d0093f17aa1ea06672bca4fe77621c27", "score": "0.58403647", "text": "def median\n return nil if @answer_counter < 1\n\n # Calculate median\n midpoint = @answer_counter / 2\n acc = 0\n @sums.each do |value, freq|\n acc += freq\n return value if acc >= midpoint\n end\n end", "title": "" }, { "docid": "a806394b414683675362cda9ccd2469c", "score": "0.58011353", "text": "def median\n apply_method :numeric, :median\n end", "title": "" }, { "docid": "a806394b414683675362cda9ccd2469c", "score": "0.58011353", "text": "def median\n apply_method :numeric, :median\n end", "title": "" }, { "docid": "0d3b7bffa220d52579fd4d8948070a65", "score": "0.5712411", "text": "def median\n return nil unless @count > 0\n\n # Sort the values if we arent sure if they are sorted or not.\n @values.sort! unless @values_sorted\n @values_sorted = true\n\n # If the set is even, we need the average of the two middle values\n # If we ignore that and always average the two middle values the\n # answer works for even and odd sets.\n (@values[@count/2] + @values[(@count-0.5)/2])/2.0\n end", "title": "" }, { "docid": "a29ea860c0aeeb141e1a250493cfba4f", "score": "0.56932795", "text": "def calculate_released_median\n percentage_grades = released_percentage_grades_array\n percentage_grades.blank? ? 0 : DescriptiveStatistics.median(percentage_grades)\n end", "title": "" }, { "docid": "a8b2eb1035b45af74e973982775bb2dc", "score": "0.56529754", "text": "def median\n percentile(50)\n end", "title": "" }, { "docid": "f5f8e4d38f74397c96df8557d22f6014", "score": "0.5636744", "text": "def median_time_taken\n times = student_tests.map{ |x| x.time_taken }\n median(times)\n end", "title": "" }, { "docid": "77bf11c1e8002d818a8dc09cc579fc16", "score": "0.5555243", "text": "def median\n raise 'this method should be overriden and return the median of the data'\n end", "title": "" }, { "docid": "92448db0725ddc909c97b1443c0e3eba", "score": "0.5531173", "text": "def median\n @median ||= DoubleDescriptive.median(sorted_data)\n end", "title": "" }, { "docid": "3c347a6dfcdcfc43ec7070c9843884aa", "score": "0.5500617", "text": "def median\n sorted = self.sort\n mid = sorted.length / 2.0\n if mid % 1 == 0\n (sorted[mid] + sorted[mid - 1]) / 2.0\n else\n sorted[mid.to_i]\n end\n end", "title": "" }, { "docid": "5de71b88e86d3d0ef9c0027403ee1f5a", "score": "0.5500337", "text": "def median\n return nil unless @count > 0\n\n # The Hi/Lo index for the median to get.\n midpoint_hi = (@count/2).floor\n midpoint_lo = ((@count-0.5)/2).floor\n mid_lo = nil\n mid_hi = nil\n\n # First element is 0, just like if its an array.\n total = -1\n\n # Cache the result of sorting the values for improved performance.\n # Approximately 10x faster than sorting every time.\n @values = @quantum.sort_by { | val, cnt | val } unless not @values.nil?\n\n # Sort the quantum of values, and scan through them\n @values.each { | val |\n # count up until we get to the median point\n total += val[1]\n # at the median point, capture the median values\n mid_lo = val[0] if mid_lo.nil? && total >= midpoint_lo\n mid_hi = val[0] if mid_hi.nil? && total >= midpoint_hi\n\n # Finish once we have both the median values\n break if not (mid_lo.nil? || mid_hi.nil?)\n }\n (mid_lo+mid_hi)/2.0\n end", "title": "" }, { "docid": "a7ab27a69b704fad86dfc536246daceb", "score": "0.5436781", "text": "def find_median()\n return if @nums.empty?\n\n middle = @nums.size / 2\n\n if @nums.size.even?\n (@nums[middle] + @nums[middle - 1]) / 2.0\n else\n @nums[middle]\n end\n end", "title": "" }, { "docid": "a9d4ea910ebd999a609bcf823e7fb6d3", "score": "0.54146516", "text": "def median\n sorted = self.sort\n mid = self.length / 2\n\n return nil if self.empty?\n\n if self.length.even?\n [sorted[mid-1], sorted[mid]].average\n else\n sorted[mid]\n end\n \n end", "title": "" }, { "docid": "105fae2f2cca451f1e1b37fe3441d101", "score": "0.5401399", "text": "def find_median()\n \n end", "title": "" }, { "docid": "105fae2f2cca451f1e1b37fe3441d101", "score": "0.5401399", "text": "def find_median()\n \n end", "title": "" }, { "docid": "23dbe62ed476020b05914aae5ffb0880", "score": "0.53857833", "text": "def median(v)\n require_calculation\n Math.sqrt((2 * sq(sides(rest(v))).inject(&:+) - sq(side(v))) / 4)\n end", "title": "" }, { "docid": "f6a41e0796816bf51449cae127c3abd5", "score": "0.5361628", "text": "def median\n return nil if self.empty?\n sorted = self.sort\n size = self.size\n\n if size % 2 == 1\n sorted[size / 2]\n else\n (sorted[(size - 1) / 2] + sorted[size / 2]) / 2.0\n end\n end", "title": "" }, { "docid": "9567398ff4275d4108d08c96d003c708", "score": "0.5360691", "text": "def find_median()\n p @left\n p @right\n if @left.length > @right.length\n return @left[0]\n elsif @right.length > @left.length\n return @right[0]\n else\n return (@right[0] + @left[0]) / 2.0\n end\n end", "title": "" }, { "docid": "6e788970cd582838e1ac748a11be57f6", "score": "0.5328692", "text": "def fast_median\n fast_percentile(50)\n end", "title": "" }, { "docid": "7d27f0f2c2c4306e2ce1d6327950c4d4", "score": "0.5291213", "text": "def find_median()\n\n end", "title": "" }, { "docid": "af07d25f332d7b64c46a929f6c995ab5", "score": "0.52849704", "text": "def median(values, default_value: 0)\n values = Array(values).sort\n return default_value if (count = values.count).zero?\n\n middle_idx = values.count / 2\n return values[middle_idx] if count.odd?\n\n (values[middle_idx - 1] + values[middle_idx]) / 2\n end", "title": "" }, { "docid": "ecb73ea717fc782b3756dea8b4d86ce4", "score": "0.5276313", "text": "def median\n end", "title": "" }, { "docid": "ce59891e3bd63c9b845df88ad4aed05e", "score": "0.52743137", "text": "def median_time_taken\n times = answers.map{ |x| x.time_taken }\n median(times)\n end", "title": "" }, { "docid": "839c0efd3529b30bf188e13f196bdbf0", "score": "0.5244298", "text": "def median\n begin\n raise RuntimeError if self.empty?\n (self.sort!.size.odd?) ? self[(self.size/2)] : (self[(self.size/2)] + self[((self.size-1)/2)])/2.0\n rescue Exception => e\n \"The median could not be calculated for this array\"\n end \n end", "title": "" }, { "docid": "7edc6d0f25c35ce1343172610c3d966f", "score": "0.52296245", "text": "def median(enumerable)\n Stats.calculate(enumerable, :median)\n end", "title": "" }, { "docid": "547e73a6f1d53564c79aaf915d16538d", "score": "0.5228328", "text": "def median\n verify_not_empty\n middle = size / 2 \n median = sort_data[middle]\n return median.to_f if size.odd?\n 0.5 * (sort_data[middle - 1] + median)\n end", "title": "" }, { "docid": "03b56e93e3027536d4a4346c8c47cee5", "score": "0.52140945", "text": "def value\n\tself.combined_median || 1\nend", "title": "" }, { "docid": "788761f007466a79c9da0b8146f0bd2e", "score": "0.52088505", "text": "def median\n return nil if self.length == 0\n sorted = self.sort\n mid = self.length / 2\n self.length.even? ? (sorted[mid - 1] + sorted[mid])/2.0 : sorted[mid]\n end", "title": "" }, { "docid": "e1741ef904c38c9beb646d036ea3d4a6", "score": "0.5199844", "text": "def sorted_median\n at_fraction(0.5)\n end", "title": "" }, { "docid": "c4c35cf4dd0e0e988a3e6cc8b6f4c866", "score": "0.51863945", "text": "def find_median()\n @median || (@heap1.first + @heap2.first)/2.0\n end", "title": "" }, { "docid": "35158be504a59e673cb639d6c7cc3404", "score": "0.51672715", "text": "def score(y_true, y_pred)\n (y_true - y_pred).abs.median\n end", "title": "" }, { "docid": "c2b06b58fb480babf528cea3a15fdbb1", "score": "0.5149416", "text": "def median\n if self.count == 0\n nil\n elsif self.count.odd?\n self.sort[self.count/2]\n else\n sorted = self.sort\n (sorted[self.count/2 - 1] + sorted[self.count/2]).to_f / 2\n end\n end", "title": "" }, { "docid": "62b4bce49e831830b6001a5f9b215410", "score": "0.51326364", "text": "def median\n len = self.size\n sorted = self.sort\n (len % 2 == 1) ? sorted[len/2] : (sorted[len/2-1]+sorted[len/2]).to_f/2\n end", "title": "" }, { "docid": "796f0f7726bf2bff628b7f8845d17b4c", "score": "0.5132014", "text": "def results_standard_deviation\n return 0 if self.max_mark.zero?\n\n marks = self.completed_result_marks\n if marks.empty?\n 0\n else\n DescriptiveStatistics.standard_deviation(marks)\n end\n end", "title": "" }, { "docid": "f1bd82e25526d6df0ed0cba57e63a528", "score": "0.510992", "text": "def median\n raise ArgumentError.new('Array size must be > 0') if self.size.zero?\n case self.size % 2\n when 0\n return self.sort[(self.size / 2) - 1, 2].mean\n when 1\n return self.sort[self.size / 2]\n end\n end", "title": "" }, { "docid": "5f0185cd65f0c5d27eafd0a8b077c0d2", "score": "0.51088774", "text": "def median\n\t\tnums = numerics\n\t\treturn nil if nums.empty?\n\t\tsorted = nums.sort\n\t\tif sorted.length.odd?\n\t\t\tnums[nums.length/2]\n\t\telse\n\t\t\t(nums[nums.length/2-1] + nums[nums.length/2]) / 2.0\n\t\tend\n\tend", "title": "" }, { "docid": "12da50c405547805d66459bf0afd7883", "score": "0.5098987", "text": "def find_median()\n n = @x.size\n if n.odd?\n @x[n/2]\n else\n (@x[n/2] + @x[(n/2) - 1])/2.0\n end\n end", "title": "" }, { "docid": "feafe4b393349ee89cae06924c976a41", "score": "0.5062353", "text": "def percentile\n scores = quiz.scores.sort\n ((scores.index(score) + 1) * 100) / scores.length\n end", "title": "" }, { "docid": "f2d508b14ab4ad9321c43d38ca402b8c", "score": "0.50540245", "text": "def calc_median\n @storage.sort_by! { :age }\n right = @storage.size / 2\n left = @storage.size / 2 - 1\n center = (@storage.size - 1) / 2\n avg = (@storage[left].age + @storage[right].age).to_f / 2\n if @storage.size.odd? # odd\n @storage[center].age\n else\n avg\n end\n end", "title": "" }, { "docid": "19cefaaca17bdb3cf2451683de95ce38", "score": "0.50387275", "text": "def find_median()\r\n \r\n end", "title": "" }, { "docid": "5dc3406583403b6d94b4c15d05a43db2", "score": "0.5036865", "text": "def median\n return nil if empty?\n sorted = sort\n len = length\n if 1 == len % 2\n sorted[len/2]\n else\n (sorted[len/2 - 1] + sorted[len/2]).to_f / 2\n end\n end", "title": "" }, { "docid": "99c379fcc466899107d2c5364b370c19", "score": "0.50331646", "text": "def median\r\n data = self.sort\r\n if (data.size % 2 == 0) then #even\r\n (data[data.size/2-1].to_f + data[data.size/2].to_f)/2\r\n else #odd\r\n data[(data.size-1)/2].to_f\r\n end\r\n end", "title": "" }, { "docid": "ec5e7a54bb869ab0525ef198e08a2254", "score": "0.50199175", "text": "def calculate_median(genes, cell)\n values = genes.map {|gene| gene['scores'][cell].to_f}\n Gene.array_median(values)\n end", "title": "" }, { "docid": "a803cfe75bfe1d199c4046e8fa7f4d94", "score": "0.5010492", "text": "def find_median()\n size = @nums_array.size\n return_val = nil\n \n if size % 2 == 1\n return_val = @nums_array[(size / 2)] * 1.0\n else\n num1 = @nums_array[(size / 2)]\n num2 = @nums_array[(size / 2) - 1]\n \n return_val = (num1 + num2) / 2.0\n end\n\n return_val\n end", "title": "" }, { "docid": "c28e2203f3bcaee537d357b28a31c27e", "score": "0.4993098", "text": "def median_ish\n sorted = self.sort\n len = sorted.length\n return self[len / 2]\n end", "title": "" }, { "docid": "c70c50cfe205c3e39dc6f70f441223ff", "score": "0.49918333", "text": "def summary(indent, points)\n [].tap do |lines|\n lines << format('%*sscore: %g', indent, '', score)\n lines << format('%*smedian: %g', indent, '', median)\n lines << format('%*spercentiles:', indent, '')\n points.each do |pct|\n lines << format('%*s%g: %g', indent + 2, '', pct, percentiles[pct])\n end\n end.join(\"\\n\")\n end", "title": "" }, { "docid": "6109499de4b9afda938b07a343cb5d79", "score": "0.49918136", "text": "def quiz_percentile(publish,marks,total)\n marks_less = 0\n #L/N(100) = P\n return 0\n end", "title": "" }, { "docid": "bf2db9b94968a545efa3e119cf9eeae1", "score": "0.499123", "text": "def median( already_sorted = false )\n return nil if empty?\n a = sort_and_extend( already_sorted )\n m_pos = size / 2\n size % 2 == 1 ? a[m_pos] : (a[m_pos-1] + a[m_pos]).to_f / 2\n end", "title": "" }, { "docid": "b43a0c9d0c56451b588f3017274391bd", "score": "0.49365303", "text": "def median\n ary = self.to_a.compact.sort.uniq\n return nil if ary.empty?\n if ary.size % 2 == 1 # Even number of entries\n ary[(ary.size-1) / 2]\n else # Odd number of entries\n idx = (ary.size-1) / 2\n (ary[idx] + ary[idx+1]) / 2.0\n end\n end", "title": "" }, { "docid": "012f56e0b2f4e4c0fa1990ed771c88f6", "score": "0.49304768", "text": "def lower_quartile\n sorted = self.sort\n midpoint = sorted.length/2 - 1 \n sorted[0..midpoint].median\n end", "title": "" }, { "docid": "b4c61d1634bcaf7f1bdd4b55f7030d6c", "score": "0.4921405", "text": "def median\n data = self\n\n halfway = data.count / 2\n\n # Sort the array\n data = data.sort\n\n # The median will be different based on the number of numbers in the array\n # If there is an even number in the array\n if(data.count % 2) == 0\n median = (data[halfway] + data[halfway-1]) / 2.0\n\n # Else, there is an odd number of elements in the array\n else\n median = data[halfway]\n end\n\n median\n end", "title": "" }, { "docid": "2418de3b50a3c12cf3ef6ed3ee464d62", "score": "0.4910527", "text": "def upper_quartile\n sorted = self.sort\n midpoint = if sorted.length.even?\n sorted.length/2\n else\n sorted.length/2 + 1\n end\n sorted[midpoint..-1].median\n end", "title": "" }, { "docid": "a343ebe71284cf96615ef54037558be2", "score": "0.491033", "text": "def percentile_score; end", "title": "" }, { "docid": "cc24f094eb6d9695b83acc54cfbba5c4", "score": "0.48797673", "text": "def median(user_ordinate)\n\t len = user_ordinate.length\n\t return (user_ordinate[(len - 1) / 2] + user_ordinate[len / 2]) / 2\n\tend", "title": "" }, { "docid": "7d154f6922b7510c03af396c8a0796dd", "score": "0.48781812", "text": "def process_points(points)\n op = @definition[\"metric\"][0,3]\n points.map!(&:last)\n\n case op\n when \"sum\" then points.max\n when \"avg\" then points.last\n when \"max\" then points.max\n else 0\n end\n end", "title": "" }, { "docid": "c6bf496759322b7e4a66349082f7a364", "score": "0.48541585", "text": "def quantile(&block)\n [\n min(&block), \n first_half(&block).median(0.25, &block), \n median(&block), \n second_half(&block).median(0.75, &block), \n max(&block)\n ]\n end", "title": "" }, { "docid": "ab79206e9b4f61ad416b957f92aa7457", "score": "0.48520258", "text": "def star_series_reading_percentile\n percentile_ranks_to_highcharts(student.star_reading_results)\n end", "title": "" }, { "docid": "2062a06acb22c2a6d28e0251f60fea91", "score": "0.48491663", "text": "def percentage_grades_array\n return [] if self.max_mark.zero?\n\n factor = 100 / self.max_mark\n self.completed_result_marks.map { |mark| mark * factor }\n end", "title": "" }, { "docid": "a7be1dec4d406c36a615c90e69a8e465", "score": "0.48410726", "text": "def median(column = nil, options = {:already_sorted => true})\n \t options, column = column, nil if column && column.is_a?(Hash)\n \t data = column ? map(&column.to_sym) : self\n \t return nil if data.empty?\n \t data = data.sort unless options[:already_sorted]\n \t median_position = length / 2\n \t length_is_even? ? data[median_position-1..median_position].mean : data[median_position]\n \tend", "title": "" }, { "docid": "894f1719ab5216c6d9f24de5da407cf9", "score": "0.48291218", "text": "def mround(num)\n if (x = num * div(num)) == self\n self\n elsif x + x+num == self + self # if self is median\n [x, x+num].max_by(&:abs)\n else\n [x, x+num].min_by{|t| (t - self).abs}\n end\n end", "title": "" }, { "docid": "db2eb18112d0338221605cd0ce061f9a", "score": "0.48220104", "text": "def median\n self.sort[self.length/2]\n end", "title": "" }, { "docid": "28724fa3b829ac71a0c7b09d207e8930", "score": "0.48137653", "text": "def medians\n @median_times ||= step_times.reduce([]) do |medians, (step, times)|\n medians.push [step, median(times)]\n end.freeze\n end", "title": "" }, { "docid": "ff32a3b359fb85d391af4998538e2531", "score": "0.48029098", "text": "def median(numbers)\r\n sorted = numbers.sort\r\n count = numbers.length\r\n count % 2 != 0 ? sorted[(count / 2)] : (sorted[count/2] + sorted[(count/2) - 1]).to_f / 2.0\r\nend", "title": "" }, { "docid": "715cf69e19b4fabab89a01ed1ec68779", "score": "0.4784434", "text": "def get_percentile_for_learners(current_learner,assessment,learners)\n logger.info\"In get_percentile_for_learners\"\n scores = learners.pluck(:assessment_score).sort\n n = scores.length\n if n != 0 then\n learners.each do |learner|\n b = get_no_of_scores_below_current_score(learner.score_raw.to_i,scores)\n e = get_no_of_scores_equal_to_current_score(learner.score_raw.to_i,scores)\n unless n.zero?\n percentile = ((b + (0.5 * e))/n) * 100\n else\n percentile = 0\n end\n # The percentile will get updated for only the current learner\n if learner.id == current_learner.id\n unless learner.percentile.eql? assessment.check_if_integer_or_float(percentile) \n learner.update_attribute(:percentile, assessment.check_if_integer_or_float(percentile))\n end\n end\n end\n end\n end", "title": "" }, { "docid": "d2f9c544db5acc87ea2018655d58a0c5", "score": "0.47613472", "text": "def median\n return 0 if size == 0\n if size%2==0\n # Average two middle values\n # [1,2,3,4,5,6].median #=> 3.5\n (self[size / 2] + self[size / 2 - 1]) / 2.0\n else\n # Use middle value\n # [1,2,3,4,5].median #=> 3\n self[size / 2].to_f\n end\n end", "title": "" }, { "docid": "20e9c81dcac1bb23f253a34063c4564d", "score": "0.47592333", "text": "def summary\n # Get assignment and it's submissions for given ID\n assignment = Assignment.find(params[:assignment_id])\n grades = assignment.submissions.pluck(:grade)\n grades.compact!\n\n # Return blank JSON if no grades\n if (grades.empty?)\n render json: \"{}\"\n return\n end\n\n # Calculate relevant metrics and assign to hash\n grades.sort!\n summary = {};\n summary[:min] = format_grade(grades[0])\n summary[:med] = format_grade(get_median(grades))\n summary[:max] = format_grade(grades[grades.length - 1])\n summary[:avg] = format_grade(grades.sum/grades.length.to_f)\n\n # Split in two and get their medians\n grades_left, grades_right = grades.each_slice((grades.length/2.0).round).to_a\n if (grades_left == nil || grades_right == nil)\n summary[:q1] = format_grade(grades[0])\n summary[:q3] = format_grade(grades[0])\n else\n summary[:q1] = format_grade(get_median(grades_left))\n summary[:q3] = format_grade(get_median(grades_right))\n end\n\n # Append other relevant info\n summary[:title] = assignment.title\n summary[:max_marks] = assignment.max_points\n\n # Return as a JSON\n render json: summary\n end", "title": "" }, { "docid": "fb647abce4b619dd813de504a6232554", "score": "0.47542226", "text": "def median(sym = :to_f)\n return nil if size == 0\n\n tmp = self.dup.sort\n middle = (tmp.size - 1) / 2\n middle2 = tmp.size / 2\n\n if tmp.size % 2 == 0\n (tmp[middle] + tmp[middle2]) / 2.send(sym)\n else\n tmp[middle].send(sym)\n end\n end", "title": "" }, { "docid": "fcd7bb9e7ca2843fa1dbaaf7ef332658", "score": "0.47517958", "text": "def percentile(q, strategy = :midpoint)\n sorted = only_valid(:array).sort\n\n case strategy\n when :midpoint\n v = (n_valid * q).quo(100)\n if(v.to_i!=v)\n sorted[v.to_i]\n else\n (sorted[(v-0.5).to_i].to_f + sorted[(v+0.5).to_i]).quo(2)\n end\n when :linear\n index = (q / 100.0) * (n_valid + 1)\n\n k = index.truncate\n d = index % 1\n\n if k == 0\n sorted[0]\n elsif k >= sorted.size\n sorted[-1]\n else\n sorted[k - 1] + d * (sorted[k] - sorted[k - 1])\n end\n else\n raise NotImplementedError.new \"Unknown strategy #{strategy.to_s}\"\n end\n end", "title": "" }, { "docid": "75c49bf75ba527bd92fd1b804f938d9b", "score": "0.4748285", "text": "def median\n return nil if size == 0\n sorted = sort\n med_norm = sorted[size/2]\n med_even = sorted[size/2-1]\n size % 2 ? (med_norm + med_even)/2 : med_norm\n end", "title": "" }, { "docid": "2bbed5b0522b6cb76da123cb8d23540e", "score": "0.47457907", "text": "def median array\n array.sort!\n length = array.length\n\n if array.any? { |object| object.is_a?String }\n array[length / 2]\n else\n (array[(length - 1) / 2] + array[length / 2]) / 2.0\n end\nend", "title": "" }, { "docid": "dfa5d4146f059002ed468ac47883823d", "score": "0.47093686", "text": "def determine_median(data_series)\n\t\t\t#Sort array values in ascending order\n\t\t\tsorted_data_series = data_series.sort\n\t\t\t#Determine if array of data is odd or even\n\t\t\tif (data_series.length%2==0) #If data array is of even length\n\t\t\t\t#Determine index number of element just before and after of middle of array\n\t\t\t\tmiddle_index_lower = data_series.length/2-1\t#Index of value just left of array middle\n\t\t\t\tmiddle_index_upper = data_series.length/2\t#Index of value just right of array middle\n\t\t\t\t\n\t\t\t\t#Obtain values for sorted elements with index just before and after array middle point\n\t\t\t\tmiddle_value_lower = sorted_data_series[middle_index_lower]\n\t\t\t\tmiddle_value_upper = sorted_data_series[middle_index_upper]\n\t\t\t\t\n\t\t\t\treturn median = ((middle_value_lower+middle_value_upper)/2).to_f\n\t\t\telse # If data array is of odd length\n\t\t\t\tmiddle_index = data_series.length/2 #Note this will return integer round down\n\t\t\t\treturn median = sorted_data_series[middle_index]\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "98fba035e52c807b85ffd4ab4c56e15b", "score": "0.47078523", "text": "def median\n sort.middle\n end", "title": "" }, { "docid": "98fba035e52c807b85ffd4ab4c56e15b", "score": "0.47078523", "text": "def median\n sort.middle\n end", "title": "" }, { "docid": "47e4a0d73f2d1015d8c2e823511443ac", "score": "0.47010946", "text": "def find_median\n return (@min_heap.elements.size > @max_heap.elements.size) ? (@min_heap.elements[1] * 1.0) : ((@min_heap.elements[1] + @max_heap.elements[1]) * 0.5)\n end", "title": "" }, { "docid": "91342bb390588c39e20d329b730725ab", "score": "0.46943778", "text": "def median(data=@data)\n unless @sorted and data == @data\n data.sort!\n @sort = true\n end\n if data.size == 0\n return 0\n end\n if data.size % 2 == 0\n return (data[data.size / 2 - 1] + data[(data.size / 2)]) / 2\n else \n split = (data.size + 1) / 2\n return (data[split - 1.5] + data[split - 0.5]) / 2\n end\n end", "title": "" }, { "docid": "b6f2a774a193ae4fb7c295b54684d58a", "score": "0.4678946", "text": "def median(a)\n b = a.sort\n len = b.size\n c = len / 2\n if len % 2 == 1\n b[c]\n else\n (b[c-1] + b[c]) / 2.0\n end\nend", "title": "" }, { "docid": "e2ff7d09a3693262cdf897c9e1096770", "score": "0.46555296", "text": "def median(num)\n\n\nnum = num.sort\n \n\n m = (num.length)/2\n\n if (num.length % 2 ==0)\n\n\n return ((num[m].to_f + num[m-1].to_f)/2)\n\n\n\n else\n\n return(num[m])\n end\n\nend", "title": "" }, { "docid": "3cacf203a06574ee9c69969ed6b7f7ad", "score": "0.46542934", "text": "def median(array)\n\tsorted = array.sort\n\n\t# Check if the array has string values by testing the first element\n\n\tif sorted[0].is_a?(String)\n\tmed = sorted[(sorted.length/2).floor]\n\telse\n\n\t# Calculate median if there are no string values\n\t\tif sorted.length%2 != 0\n\t\t\tmed = sorted[(sorted.length/2).floor]\n\t\telse\n\t\t\tmed = (sorted[sorted.length/2]+sorted[(sorted.length/2)-1])/2.to_f\n\t\tend\n\tend\n\n\nend", "title": "" }, { "docid": "9d736d7d385ef885038203042f848872", "score": "0.46473518", "text": "def median(data, opts={})\n return 0 if data.nil? || data.empty?\n data = data.sort unless block_given? || opts[:sorted] == true\n\n index = data.size / 2\n if data.size % 2 == 0 #even\n\n if block_given?\n median = (yield(data[index-1]) + yield(data[index])) / 2.0\n else\n median = (data[index-1] + data[index]) / 2.0\n end\n\n else #odd\n\n if block_given?\n median = yield(data[index])\n else\n median = data[index]\n end\n end\n\n return median\n end", "title": "" }, { "docid": "b571a4cde8855bba4b9849001bf4039e", "score": "0.4628944", "text": "def median(data)\n data = data.sort\n\tif data.length % 2 != 0\n \t\tmedian = data[data.length / 2]\n \telse\n \t\tmedian = (data[data.length / 2] + data[((data.length / 2) - 1)]) / 2.to_f\n\tend\n return median\nend", "title": "" }, { "docid": "f2e8410f787c2111f1122deb289f5d0f", "score": "0.46173796", "text": "def median_index\n (self.size + 1) / 2 - 1\n end", "title": "" }, { "docid": "fcfb146cbb302748532c44606c5df9b3", "score": "0.4614387", "text": "def median(arr)\n\tsorted_arr = arr.sort\n\tcount = sorted_arr.count \n\tif sorted_arr.empty?\n\t\t\"There is no median\"\n\telsif count % 2 == 0\n\t\t(sorted_arr[count / 2] + sorted_arr[(count / 2) -1 ])/2.0\n\telse\n\t\tsorted_arr[count / 2]\n\tend\nend", "title": "" }, { "docid": "883f394ecb9058aefdc226036411f84c", "score": "0.46107623", "text": "def mean_vs_median(numbers)\n # calculate mean\n mean = numbers.inject(:+) / numbers.length \n arr_length = numbers.sort!.length\n\n # calculate median\n median = arr_length.odd? ? numbers[(numbers.length - 1) / 2] : ( numbers[numbers.length/2] + numbers[numbers.length/2 - 1] )/2.to_f\n\n return \"mean\" if mean > median\n return \"median\" if median > mean\n return \"same\"\n end", "title": "" }, { "docid": "877466c255d33227d65c5f163fdc8bcf", "score": "0.46072036", "text": "def median(max)\n if max.even?\n max / 2\n else\n (max + 1) / 2\n end\n end", "title": "" }, { "docid": "76ddf3a7d3ea5291c6db1f04d486d685", "score": "0.460089", "text": "def median(array)\n sorted = array.sort\n len = sorted.length\n return (sorted[(len - 1) / 2] + sorted[len / 2]) / 2.0\n end", "title": "" }, { "docid": "1ea68c72b0584064e426c432e96cfe49", "score": "0.45967823", "text": "def get_median(array)\n # Edge case: empty\n if (array.empty?)\n return nil\n end\n\n # Handle even/odd sizes\n if (array.length % 2 == 0)\n mid = array.length/2\n return (array[mid - 1] + array[mid])/2.0\n else\n return array[array.length/2]\n end\n end", "title": "" }, { "docid": "53139dcfe51cec8069471370d895e6a5", "score": "0.45965892", "text": "def median(array)\n\tsorted = array.sort\n\n\t# Calculate median if there are no string values\n\t\tif sorted.length%2 != 0\n\t\t\tmed = sorted[(sorted.length/2).floor]\n\t\telse\n\t\t\tmed = (sorted[sorted.length/2]+sorted[(sorted.length/2)-1])/2.to_f\n\t\tend\n\nend", "title": "" }, { "docid": "c21a27f56c7d0fe18cc00f89c117b54c", "score": "0.45944464", "text": "def median(array)\n sorted = array.sort\n if array.length.odd? # if odd, return middlemost number\n sorted[array.length / 2].to_f\n else # if even, return mean of two middlemost numbers\n left_index = array.length / 2\n right_index = left_index + 1\n (sorted[left_index] + sorted[right_index]) / 2.0\n end\n end", "title": "" }, { "docid": "19b156a09e22232113d396d54bffd357", "score": "0.45913953", "text": "def standard_deviation\n return 0 if self.max_mark.zero?\n\n marks = grades_array\n marks.empty? ? 0 : DescriptiveStatistics.standard_deviation(marks)\n end", "title": "" }, { "docid": "1ced7fa2f748d95e3b6ac3800de330bb", "score": "0.45765448", "text": "def last_quartile( already_sorted = false )\n return nil if size < 4\n a = already_sorted ? self : sort\n a[((size / 2) + 1)..-1].extend(Utilities::Statistics).median( true )\n end", "title": "" }, { "docid": "6ce278f3273036f4f47d59e1690b3d0c", "score": "0.4566793", "text": "def median(ar)\n raise TypeError \"Expected an array\" if not ar.kind_of?(Array)\n mid = ar.length / 2\n return (mid % 1 != 0) ? mean( [ ar[(mid).floor], ar[(mid).round ]] ) : ar[mid]\n end", "title": "" } ]
4cf31c047573636878ceffe51c4c792d
Closes a Ruby block.
[ { "docid": "515c7393540e03c7864a4b8fe3f11cb5", "score": "0.0", "text": "def close_script(_1, _2, push_end = true)\n push_silent(\"end\", true) if push_end\n @template_tabs -= 1\n end", "title": "" } ]
[ { "docid": "09bef5a2fa3bff01d0ecb5fc646660f7", "score": "0.81262", "text": "def close( &block )\n compile!( :close!, &block )\n end", "title": "" }, { "docid": "cf10bcfe077feaed88fc1abfe93e956e", "score": "0.6873272", "text": "def close\n if !block_given?\n return @j_del.java_method(:close, []).call()\n end\n raise ArgumentError, \"Invalid arguments when calling close()\"\n end", "title": "" }, { "docid": "cf10bcfe077feaed88fc1abfe93e956e", "score": "0.6873272", "text": "def close\n if !block_given?\n return @j_del.java_method(:close, []).call()\n end\n raise ArgumentError, \"Invalid arguments when calling close()\"\n end", "title": "" }, { "docid": "cf10bcfe077feaed88fc1abfe93e956e", "score": "0.6873272", "text": "def close\n if !block_given?\n return @j_del.java_method(:close, []).call()\n end\n raise ArgumentError, \"Invalid arguments when calling close()\"\n end", "title": "" }, { "docid": "403373352d46cb71f076ac72a80a5aa2", "score": "0.6830456", "text": "def close_block\n push_silent \"end\"\n @template_tabs -= 1\n end", "title": "" }, { "docid": "05eb7e0f2438ee677c9975545742a66d", "score": "0.6788309", "text": "def close\n case @state\n when :open_block, :closed_block\n @selectors.pop\n @properties.pop\n else\n raise \"#close not available when state is #{@state.inspect}\"\n end\n \n @state = :closed_block\n end", "title": "" }, { "docid": "f7fe6db06882e68b8e29311e623ff7f3", "score": "0.66180015", "text": "def on_close &block\n @close_handler = block\n end", "title": "" }, { "docid": "2414cf8f595f34f113c2e3635ed6c6c1", "score": "0.6501231", "text": "def on_close(&block)\n @on_close.callback(&block) if block\n @on_close\n end", "title": "" }, { "docid": "619edca59c5128bd53cf8fe5c61fb5ba", "score": "0.64997464", "text": "def closed_block\n case @state\n when :open_block, :closed_block\n @selectors.pop\n @properties.pop\n else\n raise \"You can't get to :closed_block from #{@state.inspect}\"\n end\n \n @state = :closed_block\n end", "title": "" }, { "docid": "ca47e5be25cbcce96bdd45402ec26cd6", "score": "0.6482776", "text": "def on_close(&block)\n\t\t@close_handler = block\n\tend", "title": "" }, { "docid": "019e24d6c99a6a38196819ccf4f3011d", "score": "0.64688987", "text": "def close_command *args, &block\n @close_command ||= []\n @close_args ||= []\n @close_command << block\n @close_args << args\n end", "title": "" }, { "docid": "450c36fe47b8827a22236ab40508621c", "score": "0.63957846", "text": "def close(buffer = \"\")\n return if @block.nil?\n\n to_call, @block = @block, nil\n to_call.call(self, slice_from_buffer(buffer))\n end", "title": "" }, { "docid": "2417ccb9a788ab554da372a44e77c195", "score": "0.6365916", "text": "def autoclose_open_blocks_and_return\n ( rslt = close_block; chain rslt; pipe_2_variable ) while @head.size > 1\n return close_block\n end", "title": "" }, { "docid": "fdfec35f0f4ad60e5664726983baef5c", "score": "0.6283044", "text": "def close_block\n unless @rr.empty? then @r = @rr.pop end # back with the register\n @pipe.pop; @opener.pop; @finisher.pop # pop the writing stack\n ( @head.pop + @tail.pop ).join # join head and tail\n end", "title": "" }, { "docid": "df0c492f6415e1ccc670f724bb7da375", "score": "0.6227082", "text": "def on_close( &block )\n @on_close = block\n end", "title": "" }, { "docid": "cee1684baee9dd290a958ca4f4caf814", "score": "0.61157036", "text": "def on_close(&block)\n IORequest.logger.debug(prog_name) { 'Saved on_close block' }\n @on_close = block\n end", "title": "" }, { "docid": "2572494edd1d3f991ed338aff27c7444", "score": "0.60545677", "text": "def close\n\t\t\t\t@body&.close\n\t\t\tend", "title": "" }, { "docid": "414ddb9b80bf065cfbf7ad7ab45dc7e6", "score": "0.60503143", "text": "def close *args\n end", "title": "" }, { "docid": "0a12ecade567f3f63479e0458d26d62d", "score": "0.6018441", "text": "def close(node)\r\n end", "title": "" }, { "docid": "8ec3121094f48dc37d607c13430d2cd9", "score": "0.60027874", "text": "def on_close(&block); end", "title": "" }, { "docid": "8bd52fdb6442bb6bf5707fc3dd902ce2", "score": "0.595364", "text": "def close\n if !block_given?\n return @j_del.java_method(:close, []).call()\n elsif block_given?\n return @j_del.java_method(:close, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))\n end\n raise ArgumentError, \"Invalid arguments when calling close()\"\n end", "title": "" }, { "docid": "8bd52fdb6442bb6bf5707fc3dd902ce2", "score": "0.595364", "text": "def close\n if !block_given?\n return @j_del.java_method(:close, []).call()\n elsif block_given?\n return @j_del.java_method(:close, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))\n end\n raise ArgumentError, \"Invalid arguments when calling close()\"\n end", "title": "" }, { "docid": "f4bbe559bebb0463284db2d983628139", "score": "0.5914816", "text": "def execute(&block)\n block.call\n puts \"End of block\"\nend", "title": "" }, { "docid": "ad4b64647421b408db54eb5113812f7c", "score": "0.5897377", "text": "def _close_open_block_commands\n return unless @stack.size > 1\n until @stack.size == 1\n sub = @stack.pop\n @stack.last << sub\n end\n end", "title": "" }, { "docid": "f3fee0731c6a03a2c5c251b1efd6fed3", "score": "0.58955365", "text": "def close!\n close(true)\n end", "title": "" }, { "docid": "38932a4146543d93fb32fa36e3d779be", "score": "0.5879301", "text": "def finish(*args,&ruby_block)\n # Gain access to the finisher as local variable.\n finisher_proc = @finisher_proc\n # # The context is the one of the finisher.\n # Execute the code generating the finisher in context.\n HDLRuby::High.space_push(@namespace)\n HDLRuby::High.cur_block.open do\n instance_exec(ruby_block,*args,&finisher_proc)\n end\n HDLRuby::High.space_pop\n end", "title": "" }, { "docid": "29cd70cadaa2ea6ae362653db0ef2795", "score": "0.58530104", "text": "def finish(*args,&ruby_block)\n # Gain access to the finisher as local variable.\n finisher_proc = @finisher_proc\n # Execute the code generating the accesser in context.\n HDLRuby::High.space_push(@namespace)\n HDLRuby::High.cur_block.open do\n instance_exec(ruby_block,*args,&finisher_proc)\n end\n HDLRuby::High.space_pop\n end", "title": "" }, { "docid": "861f8a9d2feca1d2dcde99fd571cb7b6", "score": "0.5850272", "text": "def on_close(&block)\n raise(ArgumentError, \"Must have a Proc.\") unless block_given?\n @procs_close << block\n return self\nend", "title": "" }, { "docid": "0acf970dc656d267567b522a52b894da", "score": "0.58489954", "text": "def close\n # no-op\n end", "title": "" }, { "docid": "b9b8e69535cee3a9b497a95f3abe91c7", "score": "0.58489406", "text": "def close\n # ..\n end", "title": "" }, { "docid": "f0912d02eb84f266e700c2784e6c7c05", "score": "0.58362603", "text": "def close!\n end", "title": "" }, { "docid": "f18d0784e5e40f70ec901af13e697f8e", "score": "0.5828377", "text": "def close()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = Layout.new(Native.LayoutEditor_close(@handle.ptr))\n @handle.ptr = nil\n result\n end", "title": "" }, { "docid": "5113a412bb98297de859f79e2f85bb2b", "score": "0.58196896", "text": "def close_body(body)\n end", "title": "" }, { "docid": "ae31e0c4690030e28237f4e74c417a3a", "score": "0.58193105", "text": "def close\n tagged_response(\"CLOSE\")\n end", "title": "" }, { "docid": "6f2775bdff3a47c000c6ae12238f21ce", "score": "0.58175653", "text": "def closing?; end", "title": "" }, { "docid": "b360bf0936a9f8332548ef549b73ef20", "score": "0.5815858", "text": "def close\n SLPClose(@handle)\n end", "title": "" }, { "docid": "289e297191fc28b646e379e18cd49fe4", "score": "0.58146703", "text": "def do_close; end", "title": "" }, { "docid": "2e18fc142c2a79fb84a33fd30995e670", "score": "0.5807867", "text": "def close\n\n # nothing to do here.\n end", "title": "" }, { "docid": "e6f3af65bfabe101bde021d6dc0447ad", "score": "0.5803", "text": "def close!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 33 )\n\n\n\n type = CLOSE\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 208:8: 'end'\n match( \"end\" )\n\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 33 )\n\n\n end", "title": "" }, { "docid": "a91f7f681d3f6659af5d647c91521ca0", "score": "0.5795936", "text": "def close(fill=false)\n show(\n {\n :done => fill && !state.total.is_a?(Symbol) ? state.total : state.done,\n :tty => {\n :finite => { :show_eta => false },\n :infinite => { :show_eta => false },\n },\n :notty => {\n :finite => { :show_eta => false },\n :infinite => { :show_eta => false },\n },\n }, true)\n scope.output.call(scope.template.close) unless scope.template.close.nil?\n state.closed = true\n end", "title": "" }, { "docid": "2d7cffa4fe9d383d855b1c00f4135c1d", "score": "0.57878447", "text": "def close(&block)\n on_close(&block)\n\n logger.debug { \"#{self.class.name}: close called, closed? #{closed?} running? #{running?}\" }\n\n if @_running\n @start_stop_mutex.synchronize do\n @_running = false\n end\n\n if @em_connection\n EM.next_tick do\n @em_connection.detach do\n logger.debug { \"#{self.class.name}: connection unbound, continuing with shutdown\" }\n finish_closing\n end\n end\n else\n logger.debug { \"#{self.class.name}: em_connection was never set up, finish closing\" }\n finish_closing\n end\n else\n logger.debug { \"#{self.class.name}: we are not running, so returning on_close deferred\" }\n end\n\n on_close\n end", "title": "" }, { "docid": "2c099ebff8d962936e791cb997d30faa", "score": "0.5787315", "text": "def close() end", "title": "" }, { "docid": "2c099ebff8d962936e791cb997d30faa", "score": "0.5787315", "text": "def close() end", "title": "" }, { "docid": "2c099ebff8d962936e791cb997d30faa", "score": "0.5787315", "text": "def close() end", "title": "" }, { "docid": "2c099ebff8d962936e791cb997d30faa", "score": "0.5787315", "text": "def close() end", "title": "" }, { "docid": "2c099ebff8d962936e791cb997d30faa", "score": "0.5784675", "text": "def close() end", "title": "" }, { "docid": "2fab2360ff2e1051a5f35bc46b7c5874", "score": "0.5759305", "text": "def close\n # NOOP\n end", "title": "" }, { "docid": "2fab2360ff2e1051a5f35bc46b7c5874", "score": "0.5759305", "text": "def close\n # NOOP\n end", "title": "" }, { "docid": "80c96211803ca830f58937462828fdf1", "score": "0.574125", "text": "def close\n handle_action_exceptions(__method__) do\n priv_close\n logger('debug', 'close') { 'done!' }\n @closed = true\n @json ? { 'result' => 'Success' } : true\n end\n end", "title": "" }, { "docid": "082971813c3e867c18df04dedd920b97", "score": "0.57402426", "text": "def finish(*args,&ruby_block)\n # Gain access to the accesser as local variable.\n finisher_proc = @finisher_proc\n # Execute the code generating the accesser in context.\n HDLRuby::High.space_push(@namespace)\n HDLRuby::High.cur_block.open do\n instance_exec(ruby_block,*args,&finisher_proc)\n end\n HDLRuby::High.space_pop\n end", "title": "" }, { "docid": "3abcf397d44d426cd1a1c04f580f817c", "score": "0.57291484", "text": "def block; end", "title": "" }, { "docid": "3abcf397d44d426cd1a1c04f580f817c", "score": "0.57291484", "text": "def block; end", "title": "" }, { "docid": "3abcf397d44d426cd1a1c04f580f817c", "score": "0.57291484", "text": "def block; end", "title": "" }, { "docid": "3abcf397d44d426cd1a1c04f580f817c", "score": "0.57291484", "text": "def block; end", "title": "" }, { "docid": "3abcf397d44d426cd1a1c04f580f817c", "score": "0.57291484", "text": "def block; end", "title": "" }, { "docid": "3abcf397d44d426cd1a1c04f580f817c", "score": "0.57291484", "text": "def block; end", "title": "" }, { "docid": "3abcf397d44d426cd1a1c04f580f817c", "score": "0.57291484", "text": "def block; end", "title": "" }, { "docid": "3abcf397d44d426cd1a1c04f580f817c", "score": "0.57291484", "text": "def block; end", "title": "" }, { "docid": "3abcf397d44d426cd1a1c04f580f817c", "score": "0.57291484", "text": "def block; end", "title": "" }, { "docid": "3abcf397d44d426cd1a1c04f580f817c", "score": "0.57291484", "text": "def block; end", "title": "" }, { "docid": "3abcf397d44d426cd1a1c04f580f817c", "score": "0.57291484", "text": "def block; end", "title": "" }, { "docid": "3abcf397d44d426cd1a1c04f580f817c", "score": "0.57291484", "text": "def block; end", "title": "" }, { "docid": "3abcf397d44d426cd1a1c04f580f817c", "score": "0.57291484", "text": "def block; end", "title": "" }, { "docid": "3abcf397d44d426cd1a1c04f580f817c", "score": "0.57291484", "text": "def block; end", "title": "" }, { "docid": "3abcf397d44d426cd1a1c04f580f817c", "score": "0.57291484", "text": "def block; end", "title": "" }, { "docid": "3abcf397d44d426cd1a1c04f580f817c", "score": "0.57291484", "text": "def block; end", "title": "" }, { "docid": "3abcf397d44d426cd1a1c04f580f817c", "score": "0.57291484", "text": "def block; end", "title": "" }, { "docid": "3abcf397d44d426cd1a1c04f580f817c", "score": "0.57291484", "text": "def block; end", "title": "" }, { "docid": "3abcf397d44d426cd1a1c04f580f817c", "score": "0.57291484", "text": "def block; end", "title": "" }, { "docid": "3abcf397d44d426cd1a1c04f580f817c", "score": "0.57291484", "text": "def block; end", "title": "" }, { "docid": "896b607f81b0215a62d60bdb96aee5c2", "score": "0.57281095", "text": "def exit &block\n @actions[:exit] = block\n end", "title": "" }, { "docid": "216cccabd1b29da9b2c2718e063b8df8", "score": "0.57130224", "text": "def closing; end", "title": "" }, { "docid": "216cccabd1b29da9b2c2718e063b8df8", "score": "0.57130224", "text": "def closing; end", "title": "" }, { "docid": "b2de10e3018c50804b307610a2347e84", "score": "0.5710705", "text": "def close\n synchronize do\n @callbacks.values.flatten.each(&:close)\n @state = :closed\n clear!\n end\n end", "title": "" }, { "docid": "973c1c9a576675a00dd87c07650f7e6f", "score": "0.57085675", "text": "def close\n @closed = true\n @on_close and @on_close.call\n end", "title": "" }, { "docid": "cdc4c9cf0b63c58883bddebe58aa0505", "score": "0.57025224", "text": "def on_closed(&block)\n define_callback :disconnect, &block\n end", "title": "" }, { "docid": "546c66230971c1543224392ebc39a54d", "score": "0.5702364", "text": "def rblock\n if block_given?\n # yield execute the block\n yield\n else\n puts \"No block\"\n end\n end", "title": "" }, { "docid": "660ac79eaf20520f7f0456676a2244af", "score": "0.56648374", "text": "def close\n @handler.close if @handler\n @handler = nil\n end", "title": "" }, { "docid": "ab085f455c892ad7d259e5a28f276f3d", "score": "0.56646794", "text": "def each(*args, &block)\n @body.each(*args, &block)\n ensure\n unless @closed\n @closed = true\n @block.call\n end\n end", "title": "" }, { "docid": "23ddd49b603770c47d493441b101f304", "score": "0.56493956", "text": "def _close\n end", "title": "" }, { "docid": "8242ff3a350a8c6cfb0f5f6a9166bc28", "score": "0.56461924", "text": "def close!\n safe_close\n end", "title": "" }, { "docid": "ace7f80ad86cdfa200a008106e905edb", "score": "0.56424516", "text": "def close(error = nil)\n\t\t\t\t\tif @body\n\t\t\t\t\t\t@body.close(error)\n\t\t\t\t\t\t@body = nil\n\t\t\t\t\tend\n\t\t\t\tend", "title": "" }, { "docid": "f7d3e35017ade0d4b8475b2ef1f092a6", "score": "0.5632706", "text": "def block\n (@blocks ||= Array.new) << Block.new\n @in_block = @blocks.last\n yield\n @in_block = nil\n end", "title": "" }, { "docid": "4c8c7fc7a394be14e199e1bf32210282", "score": "0.5628921", "text": "def close\n if open? then\n @stmt_api.close\n @open = false\n end\n end", "title": "" }, { "docid": "ad167a824a1a57aeb7a917d1a24f472b", "score": "0.5595172", "text": "def block?; end", "title": "" }, { "docid": "13ec0247349448d9fffad0b33a80f1e8", "score": "0.55864394", "text": "def close\n UV.close(@handle)\n self.emit('close')\n @handle = nil\n end", "title": "" }, { "docid": "edc983e5b47d8610c172a145ff4f6f5f", "score": "0.5577209", "text": "def close\n end", "title": "" }, { "docid": "edc983e5b47d8610c172a145ff4f6f5f", "score": "0.5577209", "text": "def close\n end", "title": "" }, { "docid": "edc983e5b47d8610c172a145ff4f6f5f", "score": "0.5577209", "text": "def close\n end", "title": "" }, { "docid": "edc983e5b47d8610c172a145ff4f6f5f", "score": "0.5577209", "text": "def close\n end", "title": "" }, { "docid": "edc983e5b47d8610c172a145ff4f6f5f", "score": "0.5577209", "text": "def close\n end", "title": "" }, { "docid": "edc983e5b47d8610c172a145ff4f6f5f", "score": "0.5577209", "text": "def close\n end", "title": "" }, { "docid": "edc983e5b47d8610c172a145ff4f6f5f", "score": "0.5577209", "text": "def close\n end", "title": "" }, { "docid": "edc983e5b47d8610c172a145ff4f6f5f", "score": "0.5577209", "text": "def close\n end", "title": "" }, { "docid": "edc983e5b47d8610c172a145ff4f6f5f", "score": "0.5577209", "text": "def close\n end", "title": "" }, { "docid": "5e25b5ba70e59afc5d14d4397ecf00c1", "score": "0.55655116", "text": "def close\n @w.each{|w|\n w.close\n }\n end", "title": "" }, { "docid": "4d7d6c19eb1f81e7ae78bd62d0633ef1", "score": "0.55638456", "text": "def close\n\t\t\tKernel.exit 0\n\t\tend", "title": "" }, { "docid": "d38315851350dae90eed19c5bd6ebff5", "score": "0.5555358", "text": "def close\n @stmt.close\n end", "title": "" }, { "docid": "0933ee5eabb8a7a4bb52c4bae8b70138", "score": "0.55553216", "text": "def close!(handle, &callback)\n wait_for(close(handle, &callback))\n end", "title": "" }, { "docid": "b5146f239097f3e6c9aebdcb7b89b6d8", "score": "0.5554727", "text": "def close\n @ring&.close\n @ring = nil\n end", "title": "" }, { "docid": "7af00b0250b3e3c2cad453fe56d7fee0", "score": "0.554764", "text": "def close\n close!\n end", "title": "" } ]
69d3da863ea4c150befdbd07203469c9
this does an extra lookup but may be more straightforward than guess_for_game
[ { "docid": "8b4ac8af0e31529c81bd1ba274a70b51", "score": "0.68292284", "text": "def guess_for_user(user)\n if user.class == User\n game = Game.find_by(user: user, deck: deck)\n Guess.find_by(game: game, user: user)\n elsif user.class == Fixnum\n game = Game.find_by(user_id: user.id, deck: deck)\n Guess.find_by(game: game, user_id: user.id)\n end\n end", "title": "" } ]
[ { "docid": "cd528d79e1f0be18b6cab5421fb91751", "score": "0.7150322", "text": "def guess\n get_input\n check_letter\n if word_done?\n win_game\n end\n if !more_tries?\n lose_game\n end\n end", "title": "" }, { "docid": "4da650783c524da8ec2111e260b05fd1", "score": "0.7146333", "text": "def guess\n @guesser = @guesser || Guesser.new(@dictionary, @length, @gameboard)\n @guesser.run\n end", "title": "" }, { "docid": "92d1bf7b2ea0d0b25ab1f7f3b02c117f", "score": "0.70679015", "text": "def guesses_so_far\n end", "title": "" }, { "docid": "b93e95e4f952a7858684fce07951694f", "score": "0.70557487", "text": "def make_guess; end", "title": "" }, { "docid": "e5f63bb6ea0b57e62be63dd013d70f49", "score": "0.690833", "text": "def gameplay_guess\n @matches = 0\n @i = 0\n until @i == 12 || @matches == 4\n puts 'Guess four numbers up to 6'\n input\n compare\n print \"#{@human_input.join(', ')} = \"\n symbols\n puts\n puts '-----------------'\n results_guess\n @i += 1\n end\n end", "title": "" }, { "docid": "bb3490f39eede638975b901795dd704d", "score": "0.6788651", "text": "def guess\n status = @game.guess!(@guess) ? :ok : 418\n render :text => @game.score, :status => status\n end", "title": "" }, { "docid": "f38a3b8f4a9b2a1a9c50dec980cf17d1", "score": "0.67836124", "text": "def guess(players_guess)\n \tif players_guess < @answer\n \t\t@players_guess = :low\n \telsif players_guess > @answer\n \t\t@players_guess = :high\n \telse \n \t\t@players_guess = :correct\n \tend\n\n end", "title": "" }, { "docid": "d2964016fa2c6e682155b833860b584d", "score": "0.6776093", "text": "def guess(board)\n case board.this_turn\n when 1\n return \"AAAA\"\n when 2\n remove_impossibles(\"A\", board)\n return \"BBBB\"\n when 3\n remove_impossibles(\"B\", board)\n return \"CCCC\"\n when 4\n remove_impossibles(\"C\", board)\n return \"DDDD\"\n when 5\n remove_impossibles(\"D\", board)\n return \"EEEE\"\n when 6\n remove_impossibles(\"E\", board)\n return \"FFFF\"\n when 7\n remove_impossibles(\"F\", board)\n return @all_possible_guesses.sample\n else\n @all_possible_guesses.select! {|code| code != board.last_guess}\n return @all_possible_guesses.sample\n end\n end", "title": "" }, { "docid": "74d45447edd9ba809d70452e06f674b6", "score": "0.67452437", "text": "def get_guessers_answer\n self.game.get_answer(:guesser) if self.answers_available?\n end", "title": "" }, { "docid": "4c45aa25a8b5005a37e8b20e268dd367", "score": "0.6744844", "text": "def getGuess\n value = false\n\n #checks for the weapon to guess for randomly\n weaponIdx = 0\n weaponSample = @weaponsGuess.sample\n @weapons.each_index do\n |weapon_idx|\n if(weaponSample.value == @weapons[weapon_idx].value)\n weaponIdx = weapon_idx\n end\n end\n\n #checks for the location to guess for randomly\n\n locationIdx = 0\n locationSample = @locationsGuess.sample\n @locations.each_index do\n |location_idx|\n if(locationSample.value == @locations[location_idx].value)\n locationIdx = location_idx\n end\n end\n\n\n #checks for the suspect to guess for randomly\n suspectIdx = 0\n suspectSample = @suspectsGuess.sample\n @suspects.each_index do\n |suspect_idx|\n if(suspectSample.value == @suspects[suspect_idx].value)\n suspectIdx = suspect_idx\n end\n end\n\n\n if(@weaponsGuess.size == 1 && @locationsGuess.size == 1 && @suspectsGuess.size == 1)\n value = true\n end\n\n\n\n return Guess.new(@suspects[suspectIdx],@locations[locationIdx],@weapons[weaponIdx],value)\n\n end", "title": "" }, { "docid": "fdc173da64fe1519f3d4e5d2eb4a435d", "score": "0.6700089", "text": "def guess_turn\n \n end", "title": "" }, { "docid": "be43ab626939f371a28180d4a417a8d4", "score": "0.6696216", "text": "def guess(guess)\n \tif guess > answer\n \t\t:high\n \telsif guess < answer\n \t\t:low\n \telse guess = answer\n \t\t:correct\n end\n \n def solved?\n \tif @guess == @answer \n \t\ttrue\n \telse \n \t\tfalse\n end\n \nend\n\n\n\n\n# 1. DRIVER TESTS GO BELOW THIS LINE\ngame= GuessingGame.new(rand(100))\nlast_try =nil\nlast_actual =nil\n\nuntil game.solved?\n\tputs \"Nope! You picked (#{last_try}), and it was (#{last_actual})!\"\n\tputs \"\"\t\nend\n\nputs \"Try your luck and guess the number that I am thinking: \"\nlast_try = gets.chomp.to_i\nlast_actual = game.guess(last_try)\nend", "title": "" }, { "docid": "01786478dbaaf2c1ced0fb746aa782eb", "score": "0.6692478", "text": "def play_round(codemaker, codebreaker, p1, p2)\n board = GameBoard.new\n hidden_code = make_hidden_code(codemaker)\n a = [1, 2, 3, 4, 5, 6, 7]\n combinations = Hash[a.product(a.product(a.product(a))).map(&:flatten).map {|b| [b, 0]}]\n \n #lists of previous guesses to pass to CPU guess and ###POSS LOC AND POSS NUM NOT NEEDED HERE???\n \n prev_guesses = {} \n\n #create spoiler wall if both players are human to conceal the code\n system 'clear' if p1.human == true && p2.human == true\n guess_number = 1\n code_broken = false\n \n #then loop till 12 OR correct guess\n while (code_broken == false && guess_number <= 12) do\n\n #Get a guess from the codebreaker\n if codebreaker.human == true\n breaker_guess = get_guess(codebreaker)\n elsif prev_guesses == {}\n breaker_guess = first_cpu_guess()\n else \n breaker_guess = cpu_guess(prev_guesses, combinations)\n end\n if codebreaker.human == true && prev_guesses.keys.include?(breaker_guess)\n puts \"You have already made this guess\"\n breaker_guess = get_guess(codebreaker)\n end\n\n #guess is compared to hidden_code and generates a key peg array in response.\n guess_val = guess_vs_code(breaker_guess, hidden_code)\n #add guess paired with key peg response to hash of previous guesses\n prev_guesses[breaker_guess] = guess_val\n #update game board rows & show previous guesses and matches\n board.rows[12 - guess_number] = {breaker_guess => guess_val}\n board.show_board\n #check if code has been broken. End loop & update scores if true\n if guess_val == [\"b\", \"b\", \"b\", \"b\"]\n code_broken = true\n puts \"Congratulations #{codebreaker.name}\"\n puts \"You have broken the code #{hidden_code} in #{guess_number} guesses!\"\n puts \"Your opponent gains #{guess_number} points.\"\n codemaker.score += guess_number \n else guess_number += 1\n if guess_number > 12\n puts \"Out of guesses this round. The code was #{hidden_code}.\"\n puts \"Awarding #{codemaker.name}, the codemaker, 13 points.\"\n codemaker.score += 13\n end\n end\n end\nend", "title": "" }, { "docid": "8db739ec6023d7c1e25ace5d8d6a2f59", "score": "0.66865253", "text": "def getGuess\n accuse = false\n if @accuseNext ||\n (@suspects.length == 1 and @locations.length == 1 and @weapons.length == 1)\n accuse = true\n end\n return Guess.new(@suspects[0], @locations[0], @weapons[0], accuse)\n end", "title": "" }, { "docid": "57c61a7f59c6b2a67a2e1b35dd17bae1", "score": "0.664977", "text": "def guess(guessNum) \n if guessNum < @answer\n @solved = false # If we implement our game in the way that it stops whenever a guess is correct, this line might not be needed\n return :low\n elsif guessNum > @answer\n @solved = false\n return :high \n else\n @solved = true \n return :correct \n end\n end", "title": "" }, { "docid": "838bcce6111a2cbadaba3f69dec98d98", "score": "0.66407454", "text": "def get_guess\r\n guess = @current_player.guess\r\n if valid_play?(guess)\r\n return guess\r\n else\r\n puts \"This was not a valid guess. Has to be exactly one alphabetic letter!\"\r\n get_guess\r\n end\r\n end", "title": "" }, { "docid": "42190f63141ebf84c39606710eace374", "score": "0.66374624", "text": "def check_guess\n @guess_word.each_with_index do |letter, i|\n @print_guess.each_with_index do |l, j|\n j = i\n if @player_guess =~ /#{letter}/\n @print_guess[j] = @player_guess\n @swapped = true\n break\n else\n break\n end\n end\n end\n if @swapped != true\n @guess_counter += 1\n end\n @swapped = false\n end", "title": "" }, { "docid": "198f51aa3838ecca2bf149a2d281dd10", "score": "0.662439", "text": "def com_guess\n com_guess_structure\n #guess like this every single game\n @initial_guess_list = [[1,1,2,2],[1,1,3,3],[1,1,4,4],[1,1,5,5],[1,1,6,6]]\n #check if this initial list matches with the random code\n @initial_guess_list.each do |guess|\n @guess = guess\n @compareguess = @guess.dup\n execute\n #put the pegs into the array to keep track of number positions\n @black_pegs << @black_peg\n @white_pegs << @white_peg\n end\n com_guess_analyze\n execute\n while @game_over == false\n swap_values\n execute\n end\n end", "title": "" }, { "docid": "8f74d015b989021d2c549fbaf28238d4", "score": "0.6615369", "text": "def guess\n @expression = Expression.find params[:id]\n @correct = params[:guess].strip == @expression.name.strip\n # save in session hash\n session[:guessed] = {} if !session[:guessed]\n session[:guessed].merge!({@expression.id => @correct})\n set_correct\n end", "title": "" }, { "docid": "bb1a8440167cba14cdf8fb58260cccbc", "score": "0.6613227", "text": "def guess(board) \n letter_counts = Hash.new(0); \n nil_spots = []; \n\n if board.all?() { |ele| ele == nil }; \n @dictionary.each() do |word| \n word.each_char() { |ch| letter_counts[ch] += 1 }; \n end \n else \n @dictionary.each() do |word| \n word.each_char().with_index() do |ch, idx| \n letter_counts[ch] += 1 if board[idx] == nil; \n end \n end \n end \n\n sorted = letter_counts.sort_by() { |k,v| v }; \n # letter = sorted.last().first(); \n\n # I don't think I need this pitfall catch here in the \"intelligent guess\" version \n # It seems that it would be more beneficial in the \"random guess\" version above \n # while @guesses.include?(letter) \n # self.guess(board); # I think this will get caught in an endless loop like the HumanPlayer\n # # I want to return this back to the Hangman.take_turn instance method \n # end \n\n # @guesses << letter; \n # return letter; \n return sorted.last().first(); \n end", "title": "" }, { "docid": "b8333ac68eb3dcfe41e88ee945e273ed", "score": "0.6599144", "text": "def play_game\n show_game_info\n while @game_won == false && @guess_count < @guess_limit\n player_guess\n if @display_word.split(' ') == @game_word\n player_wins\n elsif @guess_count >= @guess_limit\n puts \"You have run out of guesses. You lose! The word was #{@game_word.join()}\"\n break\n end\n end\n end", "title": "" }, { "docid": "bc4f01c9da7665be2c53fa6391888ffa", "score": "0.65930927", "text": "def play_the_game\n pick_a_word\n update_board\n until @wrong_count == 0\n guess\n end\n lose_game\n end", "title": "" }, { "docid": "c9bb573f6836878a08c86a8877e84511", "score": "0.65903896", "text": "def game_match(hangman, word)\n\tguess = \"\"\n\tloop do\n\t\tputs hangman.draw_hangman()\n\n\t\tputs \"Your progress in guessing the word is:\"\n\t\tputs word.hidden_word.join(\" \")\n\n\t\tputs \"You have guessed the following letters:\"\n\t\tputs word.guesses.join(\", \")\n\t\n\t\tputs \"Please make a new guess:\" \n\t\tputs \"Or, alternatively, write \\\"save\\\" to save the game's current state.\"\n\n\t\tloop do \n\t\tguess = gets().chomp()\n\t\t\tif guess == \"save\"\n\t\t\t\tsave_game(hangman, word)\n\t\t\t\tputs \"Thanks for playing! See you when you return!\"\n\t\t\t\texit(0)\n\t\t\tend\n\t\tbreak if word.valid_guess?(guess) and !word.guessed_already?(guess)\n\t\tend\n\n\t\tresult = word.make_guess(guess)\n\t\tif result\n\t\telse\n\t\t\thangman.increment_mistakes()\n\t\tend\n\n\t\t\n\t\tif word.word_guessed?()\n\t\t\tdelete_saved_game()\n\t\t\tputs \"That's correct! The word was #{word.word}!\"\n\t\t\tbreak\n\t\tend\n\t\t\n\t\tif hangman.max_mistakes?\n\t\t\tdelete_saved_game()\n\t\t\tputs hangman.draw_hangman()\n\t\t\tputs \"Too bad! You lost, the word was #{word.word}!\"\n\t\t\tbreak\n\t\tend\n\tend\nend", "title": "" }, { "docid": "26b9d9cd72e4cf4eac38a46069bd2b8a", "score": "0.6587069", "text": "def check_guess(hangman)\n if @guess == @guessing_word.join\n win\n elsif @guessing_word.include?(@guess)\n index = 0\n @guessing_word.map do |character|\n @hidden_word[index] = @guess if @guess == character\n index += 1\n end\n puts @hidden_word.join(' ')\n win if @hidden_word == @guessing_word\n else\n @attempts.push(@guess)\n hangman.guesses += 1\n if hangman.guesses == 9\n system 'clear'\n puts hangman.draw_hangman\n puts \"Oh no...You hung him...the word was #{@guessing_word.join}\"\n @lost = true\n sleep 2\n else\n puts \"Oh no! That's incorrect.\"\n end\n sleep 1\n end\n end", "title": "" }, { "docid": "3f4108edd40fbff83f813984f3beb9c8", "score": "0.6582284", "text": "def handle_guess guess\n if @secret_word.include? guess\n @secret_word.length.times do |index|\n if @secret_word[index] == guess\n @guesses[index] = guess\n end\n end\n puts \"Correct guess!\"\n else\n @incorrect_guesses << guess\n puts \"Incorrect guess :(\"\n end\n end", "title": "" }, { "docid": "11da7727d9bf7de2a8550a2679855717", "score": "0.65772265", "text": "def run_game(user_id, user)\n #Accessing Marvel Api to get a single character name\n prng = Random.new\n characters_array = []\n offset = prng.rand(1...14) * 100\n\n @client.characters(limit: 100, offset: offset).each do |character|\n characters_array << character[:name]\n end\n\n split_characters_array = []\n characters_array.each do |character|\n split_characters_array << character.split(\" (\")[0]\n end\n\n character = split_characters_array.uniq.sample\n character_display_key = character.split(//)\n character_display_key_downcase = character.downcase.split(//)\n character_answer_key = character_display_key_downcase.select {|char| ALPHABET.include?(char)}\n\n character_name_blank_spaces = character_display_key_downcase.map do |char|\n if ALPHABET.include?(char)\n char = \"_\"\n else\n char\n end\n end\n\n\n #New Game running\n game = Game.create\n game_id = game.id\n usergame = UserGame.create(user_id: user_id, game_id: game_id)\n guesses = []\n image_index = 0\n num_incorrect = 0\n num_correct = 0\n puts \"Let's Play!\"\n while (character_answer_key - guesses).any?\n if num_incorrect < 6\n #displaying hangman\n puts HANGMAN_PICS[image_index]\n #displaying blank spaces\n character_name_blank_spaces.each do |char|\n print char\n end\n #display previous guesses\n guesses.uniq.each do |char|\n if char == guesses.uniq.first\n print \"\\nPrevious Guesses: #{char}\"\n elsif char == guesses.uniq[1]\n print \", #{char}, \"\n elsif char == guesses.uniq.last\n print \"#{char}\"\n else\n print \"#{char}, \"\n end\n end\n puts \"\\nMake a guess:\"\n guess = gets.chomp.downcase\n if validate(guess, guesses)\n if character_answer_key.include?(guess)\n num_correct += 1\n update_index = 0\n update_index_array = []\n character_display_key_downcase.each do |char|\n if char == guess\n update_index_array << update_index\n end\n update_index += 1\n end\n update_index_array.each do |index|\n character_name_blank_spaces[index] = character_display_key[index]\n end\n else\n num_incorrect += 1\n image_index += 1\n end\n guesses << guess\n if (character_answer_key - guesses).empty?\n puts WIN\n #add another hangman pic and add filled blank spaces\n puts \"The answer was: #{character}.\"\n puts \"Number of Wrong Guesses: #{num_incorrect}\"\n puts \"Number of Right Guesses: #{num_correct}\"\n usergame.user_win = true\n user.number_wins += 1\n break\n end\n end\n else\n puts HANGMAN_PICS[image_index]\n puts LOSE\n puts \"The answer was: #{character}.\"\n puts \"Number of Wrong Guesses: #{num_incorrect}\"\n puts \"Number of Right Guesses: #{num_correct}\"\n #save data from game into user_game and user tables\n usergame.user_win = false\n user.number_losses += 1\n break\n end\n end\n usergame.correct_guesses = num_correct\n usergame.incorrect_guesses = num_incorrect\n user.total_correct_guesses += num_correct\n user.total_incorrect_guesses += num_incorrect\n usergame.save\n user.save\nend", "title": "" }, { "docid": "f6f08edbc66fb729f80d4fc55729156a", "score": "0.6570808", "text": "def\tget_guesses\n\n \t#While the user hasn't made 6 bad guesses (head, torso, arms, legs) in a row, get the next guess\n \tif @letters_remain\n \t\tare_there_any_letters_left?\n\t \twhile @bad_guesses < MAX_BAD_GUESSES && @letters_remain\n\t \t\tputs\n\t \t\tthis_letter = ask_for_a_guess\n\t \t\tdoes_it_match?(this_letter) \n\t end #while\n\tend #if\n\t@this_turn += 1\nend", "title": "" }, { "docid": "85d48e7835b9086e21c05836d3c21023", "score": "0.65547186", "text": "def round\n @games = @tournament.games.select(\"games.*, guesses.result as guess_result, guesses.id as guess_id\").includes(:home, :away, :stadium).joins(\"LEFT JOIN guesses ON games.id = guesses.game_id and guesses.member_id = #{current_user.member_id_for_faction(@faction.id)} and guesses.faction_id = #{@faction.id}\").where(round: params[:round_id]).order(:kickoff_at)\n @guess = Guess.new(:faction => @faction)\n end", "title": "" }, { "docid": "def362ab9a37810d712fabe6d034c138", "score": "0.65539247", "text": "def guess!\n\t\t@guesses += 1\n\tend", "title": "" }, { "docid": "f346e3d69fc92ac3f18265d0cbc71ebd", "score": "0.65466267", "text": "def prompt_guesser\n # display all game info\n output_display\n puts @@hangman_pics[@game.guesses.length]\n incorrect_guesses_count\n display_incorrect_guesses\n\n puts \"What letter would you like to guess?\"\n input = user_input.downcase\n already_guessed?(input)\n\n @game.game_over? == true ? end_game : prompt_guesser\n end", "title": "" }, { "docid": "e1000045b2fa12982b81fb5b444cc128", "score": "0.6544127", "text": "def guess\n @last_guess = @possible_codes[0]\n @possible_codes.shift\n @last_guess\n end", "title": "" }, { "docid": "f80033d3a3b4a43a5aac1f2b3d259cbc", "score": "0.65440583", "text": "def guess_word(word)\n word == self.word ? self.game_state = word\n : self.bad_guesses += 1\n self.save\n end", "title": "" }, { "docid": "ea514154ff799d6d31a6308f7b2f32e7", "score": "0.65438753", "text": "def loaded_game\n puts \"Welcome back, here is where you left off: \"\n hidden_display\n user_guess\n end", "title": "" }, { "docid": "fb02f0141584017852d5d337610de540", "score": "0.6542307", "text": "def try_attempt(guess)\r\n raise ArgumentError unless check_attempt(guess)\r\n raise GameOver if @attempts >= @attempts_max\r\n\r\n @attempts += 1\r\n return hits(guess)\r\n end", "title": "" }, { "docid": "469350ccda43778bec8da9b49f5d5b3d", "score": "0.6540263", "text": "def guess\n correct = false\n if controller_store[:current_presenter] != message[:connection_id] and controller_store[:current_item].name.casecmp(message[:guess]) == 0\n #controller_store[:score][message[:connection_id]] += controller_store[:current_item].score\n #controller_store[:score][controller_store[:current_presenter]] += 1\n\n broadcast_clear_canvas\n broadcast_presenter message[:connection_id]\n broadcast_score(message[:connection_id], controller_store[:current_item].score)\n broadcast_score(controller_store[:current_presenter], 1)\n\n correct = true\n end\n broadcast_message :receive_guess, { :guess => message[:guess], :correct => correct, :user => message[:connection_id]}\n end", "title": "" }, { "docid": "a1fe79ea53b3f091d133a6c05c265426", "score": "0.6533729", "text": "def prev_guess(game_hash, cursor)\n\tcursor -= 1\n\treturn cursor unless game_hash[cursor][:fixed]\n\treturn prev_guess(game_hash, cursor)\nend", "title": "" }, { "docid": "9b9673199aadd583ceb239f2f1fc82e1", "score": "0.6533104", "text": "def code_breaker_game\n until @guesses_left == 0\n guess_sequence = @player.get_guess\n if guess_sequence == @code_sequence\n end_game('You')\n end\n \n analysis = @ai.ai_feedback(guess_sequence, @code_sequence)\n display_feedback(analysis)\n @guesses_left -= 1\n display_remaining_guesses(@guesses_left)\n end\n end_game('You')\n end", "title": "" }, { "docid": "e6c20d214212e21f9531962d942b0845", "score": "0.6529253", "text": "def guess_game\n\tputs \"Bro, Won Jun Hong made this game! Enjoy buddy!\"\n\tputs \"I have a number in my mind, and you have to guess what's in my mind.\"\n\tputs \"It\\'s interger from 1 to 10\"\n\trandom_number = rand(1 .. 10)\n\trandom_number_string = random_number.to_s\n\tary = [1,2,3,4]\n\tary.each do |i|\n\t\ti_string = i.to_s\n\t\tif i > 3\n\t\t\tputs \"Man you NEVER gonna get this right. I will just give you the answer. The number was \" + random_number_string\n\t\t\tbreak\n\t\telse\n\t\t\tputs \"This is your \" + i_string + \" attempt. Good Luck\"\n\t\t\tprint \"Please guess your number: \"\n\t\t\tguessed_number = gets\n\t\t\tguessed_number = guessed_number.to_i\n\t\t\t\tif guessed_number == random_number\n\t\t\t\t\tputs \"OMG! You are a psychic. You got it! Good Job\"\n\t\t\t\t\tbreak\n\t\t\t\telsif guessed_number > random_number\n\t\t\t\t\tputs \"Bro, too high; aim lower\"\n\t\t\t\telsif guessed_number < random_number\n\t\t\t\t\tputs \"Dawg, too low; aim higher\"\n\t\t\t\tend\n\t\tend\n\tend\nend", "title": "" }, { "docid": "15d6e566c1d10e1a7258b36facb91c32", "score": "0.6525923", "text": "def play\n \n isOver = false # indicate if the game is over.\n indexOfPlayer = 0; # the index of the player of the current turn.\n \n while( isOver == false )\n \n # find the next player that has not be removed. \n while( @indiceOfRemovedPlayers.index(indexOfPlayer) != nil )\n indexOfPlayer = (indexOfPlayer + 1) % @arrayOfPlayers.length\n end\n \n puts \"Current turn: #{indexOfPlayer}\"\n \n theGuess = @arrayOfPlayers[indexOfPlayer].getGuess\n \n if(theGuess.type == true)\n puts \"Player #{indexOfPlayer}: accusation: #{theGuess.person.value} in #{theGuess.place.value} with the #{theGuess.weapon.value}. \"\n else\n puts \"Player #{indexOfPlayer}: suggestion: #{theGuess.person.value} in #{theGuess.place.value} with the #{theGuess.weapon.value}. \"\n end\n \n # if the guess is an accusation.\n if(theGuess.type == true)\n # if accusation is true, game over.\n if(theGuess.person.value == @criminal.value && theGuess.place.value == @crimeScene.value && theGuess.weapon.value == @lethalWeapon.value) \n isOver = true\n puts \"Player #{indexOfPlayer} won the game. \"\n # otherwise, remove the player who made the accusation.\n else\n @indiceOfRemovedPlayers.push(indexOfPlayer)\n puts \"Player #{indexOfPlayer} made a bad accusation and was removed from the game. \"\n if( @indiceOfRemovedPlayers.length == @arrayOfPlayers.length - 1 )\n isOver = true\n puts \"There is only one player left. Game Over! \"\n end\n end\n # if the guess is an suggestion.\n else\n # Asking the next player.\n indexOfAnswerer = (indexOfPlayer + 1) % @arrayOfPlayers.length\n isAnswered = false\n \n theAnswer = nil\n # ask all other players until there is an answer or no one can answer.\n while( indexOfAnswerer != indexOfPlayer && !isAnswered )\n theAnswer = @arrayOfPlayers[indexOfAnswerer].canAnswer( indexOfPlayer, theGuess )\n \n if(theAnswer != nil)\n puts \"Player #{indexOfAnswerer} answered. \"\n isAnswered = true \n else\n indexOfAnswerer = (indexOfAnswerer + 1) % @arrayOfPlayers.length \n end\n \n end\n \n # give the answer to the guesser.\n if(theAnswer == nil)\n @arrayOfPlayers[indexOfPlayer].receiveInfo( -1, theAnswer )\n else\n @arrayOfPlayers[indexOfPlayer].receiveInfo( indexOfAnswerer, theAnswer )\n end \n end#if\n \n indexOfPlayer = (indexOfPlayer + 1) % @arrayOfPlayers.length\n end#while \n end", "title": "" }, { "docid": "6a5afab9db0a11439fe9792c37fa8a9c", "score": "0.65239024", "text": "def check_guess(player_guess)\n \n# if it completely matches, victory\n if player_guess == guess_me\n puts \"\\nCongratulations! You won!\"\n exit\n else\n# if match not an exact match, call method below\n make_feedback(player_guess)\n end\n end", "title": "" }, { "docid": "c0f77709df36073a51e60c87c024511e", "score": "0.6502227", "text": "def guess_code\n # prune any initial guesses that are guaranteed to give 'xxxx' response\n\n # for example, if the code is '1123' and the AI has already guessed '1111', '2222', and '3333', then the AI\n # already knows that the code does not include any '4', '5', or '6', and will not waste turns making those guesses\n\n # reverse is needed to ensure every index is checked when entries are being deleted\n @initial_guesses.reverse.each { |g| @initial_guesses.delete(g) if @s.none? { |c| c.include?(g.slice(0)) } }\n\n # choose initial guesses at random until all are guessed or eliminated, then choose randomly from @s\n super(@initial_guesses.empty? ? @s.sample : @initial_guesses.slice!(rand(@initial_guesses.length)))\n end", "title": "" }, { "docid": "3c3c4cac09fe55221527c0c7b7a03a5c", "score": "0.6498445", "text": "def player_guess \n if $rounds == 8\n puts \"GAME OVER. The code you were trying to break was #{$computer_code}. You have earned 0 points.\"\n\n else \n puts \"Symbols: ! @ # $ % ^ & * ?\"\n puts \"Enter your guess:\"\n $guess = gets.chomp.split(//)\n guess_evaluation($guess)\n end\n end", "title": "" }, { "docid": "f18a047a9cff0bb41f8941bddb901492", "score": "0.6497224", "text": "def getGuess\n\t\t#store the guess\n\t\ttheGuess = nil\n\t\tputs \"It is your turn.\"\n\n\t\t###### Prompt the user for a person, place, weapon, and guess type ######\n\t\tputs \"Who do you suspect?\"\n\t\tlength = @suspects.length\n\t\tlength.times{ |i| puts \"#{i}. #{@suspects[i].toString}\"}\n\t\t#ask for input\n\t\tchoice1 = gets.to_i\n\n\t\t#make sure input is valid\n\t\twhile (choice1 >= length && choice1 >= 0)\n\t\t\tputs \"Please enter a valid integer response.\"\n\t\t\tchoice1 = gets.to_i\n\t\tend\n\n\n\t\tputs \"Where do you think it happened?\"\n\t\tlength = @locations.length\n\t\tlength.times{ |i| puts \"#{i}. #{@locations[i].toString}\"}\n\t\t#ask for input\n\t\tchoice2 = gets.to_i\n\n\t\t#make sure input is valid\n\t\twhile (choice2 >= length && choice2 >= 0)\n\t\t\tputs \"Please enter a valid integer response.\"\n\t\t\tchoice2 = gets.to_i\n\t\tend\n\n\t\t\n\t\tputs \"What weapon did they use?\"\n\t\tlength = @weapons.length\n\t\tlength.times{ |i| puts \"#{i}. #{@weapons[i].toString}\"}\n\t\t#ask for input\n\t\tchoice3 = gets.to_i\n\n\t\t#make sure input is valid\n\t\twhile (choice3 >= length && choice3 >= 0)\n\t\t\tputs \"Please enter a valid integer response.\"\n\t\t\tchoice3 = gets.to_i\n\t\tend\n\t\t\n\t\t#store all the guess values\n\t\tguessSuspect = @suspects[choice1]\n\t\tguessLocation = @locations[choice2]\n\t\tguessWeapon = @weapons[choice3]\n\n\t\tputs \"Is this an accusation (Y/N)?\"\n\t\tguessType = gets.chomp\n\t\t###### Done prompts ######\n\n\t\t#make sure the input is valid\n\t\twhile(guessType != \"Y\" && guessType != \"y\" && guessType != \"N\" && guessType != \"n\")\n\t\t\tputs \"Please enter one of the valid options: \\\"Y\\\", \\\"y\\\", \\\"N\\\",\\\"n\\\"\"\n\t\t\tguessType = gets.chomp\n\t\tend\n\n\t\t#create the guess\n\t\tif(guessType == \"Y\" || guessType == \"y\")\n\t\t\ttheGuess = Guess.new(guessSuspect, guessLocation, guessWeapon, true)\n\t\telse\n\t\t\ttheGuess = Guess.new(guessSuspect, guessLocation, guessWeapon, false)\n\t\tend\n\n\t\t#return the guess\n\t\ttheGuess\n\tend", "title": "" }, { "docid": "f242b8652fd914b75a93eeca0ef5eba5", "score": "0.6489619", "text": "def hangman(answer)\n\tguesses1 = Set.new\n\tguesses2 = Set.new\n\tgreeting\n\tplayer1 = get_name(\"Player 1\")\n\tplayer2 = get_name(\"Player 2\")\n\tcurrent_player = player1\n\tcurrent_guesses = guesses1\n\tuntil gameover?(current_guesses, answer)\n\t\tguess = take_turn(current_guesses, answer, current_player)\n\t\tcurrent_guesses.add(guess)\n\t\t#ternary operator\n\t\tcurrent_player = current_player == player1 ? player2 : player1\n\t\t# current_player = switch_players(current_player, player1, player2)\n\t\tcurrent_guesses = current_guesses == guesses1 ? guesses2 : guesses1\n\tend\n\tcurrent_player = current_player == player1 ? player2 : player1\n\t# current_player = switch_players(current_player, player1, player2)\n\tpostmortem(answer, current_guesses, current_player)\nend", "title": "" }, { "docid": "f923a447ceb01a2a3d544d26df9a0e1a", "score": "0.64875376", "text": "def winning_team\nif game_hash[:home][:players].include?(most_points_scored)\nreturn game_hash[:home][:team_name]\nelse return game_hash[:away][:team_name]\nend\nend", "title": "" }, { "docid": "264a81ee94b6e9c1aa651cf75b10533f", "score": "0.6487486", "text": "def getGuess\n\n if(@listOfSus.length == 1 &&\n @listOfPlace.length == 1 &&\n @listOfWpn.length == 1 ) #can only be one answer\n myGuess = Guess.new(@listOfSus[0],@listOfPlace[0],@listOfWpn[0],true)\n else if @luckyGuess == false #keep on guessing\n @listOfSus.shuffle!\n @listOfPlace.shuffle!\n @listOfWpn.shuffle!\n myGuess = Guess.new(@listOfSus[0],@listOfPlace[0],@listOfWpn[0],false)\n \n else #only make it here if lucky guess and found answer\n myGuess = Guess.new(@listOfSus[0],@listOfPlace[0],@listOfWpn[0],true) #makes exact same guess because it luckily guessed the right answer so computer wins\n end\n end\n \n myGuess #returns the guess\n end", "title": "" }, { "docid": "8a0e799ae35917ec3987e44eef1731c8", "score": "0.64841706", "text": "def ask_a_guess\r\n if @creator == 2 # guesser = human\r\n @guess = get_code\r\n else # guesser = computer\r\n 4.times do |index|\r\n \tif @memo_peg[index]\r\n \t @guess[index] = @memo_peg[index]\r\n else\r\n @guess[index] = rand(1..6).to_s\r\n end\r\n end\r\n end\r\n puts\r\n puts \"Guess: \" + @guess.join('-')\r\n end", "title": "" }, { "docid": "84524b581353a051902884a370776601", "score": "0.6479284", "text": "def gameplay\n\t\t@turn = 0\n\t\tputs \"You can only guess the six colors of the rainbow.\\nRed (r), Orange (o), Yellow (y), Green (g), Blue (b), Purple (p).\"\n\t\twhile not won? || @turn >= 12\n\t\t\toutput = []\n\t\t\t@input = get_input\n\t\t\tinput = @input.split(//)\n\t\t\tanswer = @answer.split(//)\n\t\t\tinput.each.with_index do |x, i|\n\t\t\t\tif answer[i] == x\n\t\t\t\t\toutput.push \"*\"\n\t\t\t\t\tanswer = answer.join.sub!(x, \" \").split(//)\n\t\t\t\t\tinput = input.join.sub!(x, \"*\").split(//)\t\n\t\t\t\tend\n\t\t\tend\n\t\t\tinput.each do |x|\n\t\t\t\tif answer.include?(x)\n\t\t\t\t\toutput.push \"?\"\n\t\t\t\t\tanswer = answer.join.sub!(x, \" \").split(//)\n\t\t\t\tend\n\t\t\tend\n\t\t\tputs output.sort.join + \"\\n\\n\"\n\t\t\t@turn += 1\n\t\tend\n\t\tif won?\n\t\t\tprint %x{clear}\n\t\t\tputs \"Please enter your guess: #{@input}\"\n\t\t\tputs \"****\"\n\t\t\tputs \"\\nCongratulations #{@name}! You guessed right, the code was #{@answer},\\nand you guessed it in #{@turn} tries!\"\n\t\telse\n\t\t\tputs %x{clear} + \"You were unable to guess the correct answer in the allotted number of tries!\\nGAME OVER!!!!! Better luck next time.\"\n\t\tend\n\t\tnew_game\n\tend", "title": "" }, { "docid": "44c9023abb7e2e02cd143cba0ebc53eb", "score": "0.64748174", "text": "def getGuess\n puts \"It is your turn. \"\n \n # Let the human player choose 3 card for the guess.\n puts \"Which person do you want to suggest? \"\n for i in 0... @listOfAllSuspects.length\n puts \"#{i}: #{@listOfAllSuspects[i].value}\" \n end \n input = gets.chomp.to_i\n while( input < 0 || input > @listOfAllSuspects.length - 1 )\n puts \"Invalid number. Please enter again. \"\n input = gets.chomp.to_i\n end \n personInGuess = @listOfAllSuspects[input]\n\n puts \"Which location do you want to suggest? \" \n for i in 0... @listOfAllLocations.length\n puts \"#{i}: #{@listOfAllLocations[i].value}\" \n end \n input = gets.chomp.to_i \n while( input < 0 || input > @listOfAllLocations.length - 1 )\n puts \"Invalid number. Please enter again. \"\n input = gets.chomp.to_i\n end \n placeInGuess = @listOfAllLocations[input]\n\n puts \"Which weapon do you want to suggest? \" \n for i in 0... @listOfAllWeapons.length\n puts \"#{i}: #{@listOfAllWeapons[i].value}\" \n end \n input = gets.chomp.to_i \n while( input < 0 || input > @listOfAllWeapons.length - 1 )\n puts \"Invalid number. Please enter again. \"\n input = gets.chomp.to_i\n end \n weaponInGuess = @listOfAllWeapons[input]\n \n puts \"Is this an accusation ([Y]/[N])? \"\n input = gets.chomp.upcase\n \n # validity checking\n while( input != \"Y\" && input != \"N\" )\n puts \"Invalid number. Please enter again. \"\n input = gets.chomp.upcase\n end\n \n if( input == \"Y\") \n isAccusation = true\n else \n isAccusation = false \n end\n \n return Guess.new( personInGuess, placeInGuess, weaponInGuess, isAccusation )\n \n end", "title": "" }, { "docid": "5803d588237f3127ec57713c953da4c4", "score": "0.6471898", "text": "def correct_guess\n Output.guess(@guess.code, @game_type)\n if @game_type == 'maker'\n puts \"\\nYou lost :( the computer guessed your secret code :#{Output.color(@secretcode)}\\n\\n\"\n else\n puts \"\\nCongratulations! You've won!! the code was #{Output.color(@secretcode)}\\n\\n\"\n end\n @game_over = true\n end", "title": "" }, { "docid": "afb9ef7d072faa05a5c05718a3f54a2b", "score": "0.64697444", "text": "def turn\n know_the_word\n obtain_guess\n add_guess\n update_gameboard\n game_status\n end", "title": "" }, { "docid": "56a6afca18302ee9bee74919deeb21bb", "score": "0.6464385", "text": "def check_guess(letter_guessed)\n while @word_to_guess.include?(letter_guessed)\n letter_index = @word_to_guess.index(letter_guessed)\n update_game_state(letter_index)\n end\n end", "title": "" }, { "docid": "cab43ba1560d71fe4681dbe6cdeed0c2", "score": "0.6463745", "text": "def winning_team()\n home_team_hash = game_hash[:home]\n home_players_array = home_team_hash[:players]\n home_points = 0\n\n away_team_hash = game_hash[:away]\n away_players_array = away_team_hash[:players]\n away_points = 0\n i = 0\n h_len = home_players_array.length()\n a_len = away_players_array.length()\n while i < h_len && i < a_len\n h_player = home_players_array[i]\n h_points = h_player[:points]\n home_points += h_points\n a_player = away_players_array[i]\n a_points = a_player[:points]\n away_points += a_points\n i += 1\n end\n if(home_points > away_points)\n name = home_team_hash[:team_name]\n return name\n end\n name = name = away_team_hash[:team_name]\n return name\nend", "title": "" }, { "docid": "8dfe1230925650d867752b60772c80b7", "score": "0.64551973", "text": "def replay(game)\n\t\tif @type == :begin\n\t\t\tgame.beginGuess\n\t\telsif @type == :remove\n\t\t\tgame.removeGuess\n\t\telse\n\t\t\tgame.applyGuess\n\t\tend\n\tend", "title": "" }, { "docid": "456824acf9bc5059e28e15f4621537cf", "score": "0.6447725", "text": "def game\n system(\"clear\")\n\n # Set game up with selecting topic, game_word, and reseting the board to have the empty letters\n topic = topic_selection\n self.game_word = select_word(topic)\n reset_game(game_word)\n hangman_art_use = hangman_art\n\n # Set win to false and number_of_guesses to 0\n win = false \n self.number_of_guesses = 0\n\n # While loop through the actual game of hangman\n while true do\n system(\"clear\")\n\n play_round_guess(hangman_art_use)\n\n if self.number_of_guesses == 6\n # Game lost\n break\n elsif !self.board.index(\"_\")\n # Game won\n win = true \n break\n end\n end\n\n # Reveal the guessing game word\n puts\n puts \"Game Word: #{self.game_word}\"\n puts\n\n # Calculate final total score (1 incorrect guess equals minus 10 points from 60)\n total_score = self.score - (self.number_of_guesses * 10)\n\n # Display You Win or You Lose based off if they win or lose\n # Utilize the TTY::Font ascii art creation gem\n if win\n puts TTY::Font.new(:doom).write(\"You Win!\")\n puts \"Total Score - #{total_score} pts\"\n else\n puts TTY::Font.new(:doom).write(\"You Lose!\")\n puts \"Total Score - #{total_score} pts\"\n end\n\n # Update 'user' instance variable high score if it needs to be updated\n # Update also occurs in users table \n if self.user.high_score < total_score\n self.user.update({:high_score => total_score})\n end\n\n prompt = TTY::Prompt.new \n\n prompt.keypress(\"Press Enter or Space to continue.\", keys: [:space, :return])\n end", "title": "" }, { "docid": "5047af6164f2c12c87420de2d0dd7c7a", "score": "0.64408267", "text": "def test_it_knows_when_game_over\n game = Game.new(4, %w(r g b y))\n guess = Guess.new(%w(g r y b), 4)\n guess.results[:full_match] = true\n game.add_guess(guess)\n \n assert game.game_over?\n end", "title": "" }, { "docid": "cee1e716f2a781b257ff614ee78f0f9d", "score": "0.6439507", "text": "def get_guess\n print \"Enter guess: \"\n loop do\n guess = gets.chomp.downcase\n guess == \"save\" ? save_game : guess = guess[0]\n\n if (!@incorrect_guesses.include? guess) && (!@guesses.include? guess)\n return guess\n end\n print \"You've already guessed that letter, try again: \"\n end\n end", "title": "" }, { "docid": "676f768f24d7a2657b36bd1b7e6767fd", "score": "0.64373744", "text": "def human_play\n\n\t\tGAME_LENGTH.times do |turn|\n\t\t\tbreak if correct_guess?\n\t\t\tputs \"Guess #{turn+1} of #{GAME_LENGTH}:\"\n\t\t\t@guess = gets.chomp\n\t\t\tuntil is_valid?(@guess) do\n\t\t\t\tputs \"Enter #{CODE_SIZE} numbers between #{CODE_RANGE.first} and #{CODE_RANGE.last}:\"\n\t\t\t\t@guess = gets.chomp\n\t\t\tend\n\t\t\tputs hint(@guess).join\n\t\tend\n\n\t\tputs correct_guess? ? \"You win!\" : \"Game over! The code was: #{@code.to_s}\"\n\tend", "title": "" }, { "docid": "e933e872cc4db371dd515b07caa06721", "score": "0.64371914", "text": "def play_game\n until ((@guesses_left == 0) || (compare_to_word))\n # take letter from user\n # search original word for letters\n # if the letter is a duplicate\n # do nothing\n # if the letter is found,\n # modifiy the underscore string to reveal that letter\n # return the underscore string\n # reduce count var\n # if the letter is not found\n # return the underscore string\n # reduce count var\n puts \"Guess a letter. #{@guesses_left} guesses left.\"\n user_guess = gets.chomp\n if @guess_status.include? \"#{user_guess}\"\n # do nothing\n elsif @word.include? \"#{user_guess}\"\n reveal_char(user_guess)\n @guesses_left -= 1\n elsif !@word.include? \"#{user_guess}\"\n @guesses_left -=1\n end\n p @guess_status\n end\n\n if @guess_status == @word_expanded\n puts \"You won! #{@word} is the correct answer. Good job!\"\n else\n puts \"You lost! Too bad. Try again.\"\n end\n\n end", "title": "" }, { "docid": "d55cec17ed0512551b9292e9514383d2", "score": "0.64319956", "text": "def game_loop\n\t\tgame_over = nil\n\t\twhile game_over == nil\n\t\t\tguess = get_codebreaker_guess\n\t\t\tgame_over ||= check_guess?(guess)\n\t\t\t\n\t\t\t@turns += 1\n\t\t\tgame_over ||= out_of_turns?\n\t\tend\n\tend", "title": "" }, { "docid": "96c0a82695d465f12d7a2a5f7f8936c6", "score": "0.64304465", "text": "def matchup(round, game)\n return @winners[round-1][(game-1)*2..(game-1)*2+1]\n end", "title": "" }, { "docid": "130138b0d4f628ea628ced7a5193beee", "score": "0.64303297", "text": "def do_guess(current_player, actualGuess, correct_answer)\n if actualGuess == correct_answer\n puts \"#{current_player.name}, correct!\"\n puts \"\"\n else \n puts \"#{current_player.name} Wrong response!\"\n puts \"\"\n doc_player(current_player)\n end\n end", "title": "" }, { "docid": "08986c76b9d73a060ea9ecf7c6ee5a33", "score": "0.6422894", "text": "def guess(dictionary, fragment, player_nums)\n return ALPHABET.sample if fragment == \"\"\n # 1 is win move, 0 no zero move but not full word, -1 is full word\n alpha_status = Hash.new()\n ALPHABET.each do |char|\n \n \n new_frag = fragment + char\n dictionary.each do |word|\n if word == new_frag\n alpha_status[char] = -1\n break\n elsif word[0...new_frag.length] == new_frag && word.length - new_frag.length >= player_nums\n alpha_status[char] = 0\n elsif word[0...new_frag.length] == new_frag && word.length - new_frag.length < player_nums\n alpha_status[char] = 1 if alpha_status[char].nil?\n end\n end\n end\n\n test = alpha_status.keys.inject() do |acc, char|\n acc = char if alpha_status[char] > alpha_status[acc]\n acc \n end\n p alpha_status\n puts @name + \" enters a character: \"\n # p test\n test\n \n\n\n # puts @name + \" enters a character: \"\n # char = ALPHABET.sample\n # char\n\n end", "title": "" }, { "docid": "e487fc5cea3afbdd7094509f288f646b", "score": "0.64224845", "text": "def parse_guess(guess)\n if is_a_word?(guess)\n if correct_word?(guess) # if it is a word, is it the correct word?\n @hidden_word.reveal_word # if so, reveal the word\n else\n subtract_player_life() # call other function to dock life\n end\n else # if not a word\n guess_letter(guess)\n end\n end", "title": "" }, { "docid": "c9df3b25e6bbaa3d789e4411eb267a33", "score": "0.6421974", "text": "def next_guess\n user_selection\n compare\n end", "title": "" }, { "docid": "22cccee4637b04af5ca0e5fd90876d10", "score": "0.6416376", "text": "def winning_team\n if home_team_score > away_team_score\n game_hash[:home][:team_name]\n else\n game_hash[:away][:team_name]\n end\nend", "title": "" }, { "docid": "0d55cc7f5ad83e38725fae2820593d5e", "score": "0.6410227", "text": "def guess_with_repetition\n\tend", "title": "" }, { "docid": "55dcd027a324c9fecf4fe8324055a080", "score": "0.64072764", "text": "def unknown_guess(current_guess)\n\toutcome = { :precise => [], :close => []}\n\tcurrent_guess.each_with_index do |pick, placement|\n\t\tif precise_match?(choice, position)\n\t\t\tresults[:precise] << true\n\t\telsif close_match?(pick)\n\t\t\tresults[:close] << true\n\t\tend\n\tend\n\tresults\n\nend", "title": "" }, { "docid": "d70ec421e55930d7dc679dc3d4ce0845", "score": "0.6406379", "text": "def guess(guess)\n @guess = guess\n @guesses += 1\n if !@guess.valid?\n @guesses -= 1\n Output.invalid\n guess(Input.code_input)\n elsif win?\n correct_guess\n elsif lose?\n last_guess\n else\n wrong_guess\n end\n end", "title": "" }, { "docid": "0936142d6ddcc820c44651799ca5e4bd", "score": "0.6403866", "text": "def guess(letter)\n if /[A-z]/.match(letter)\n letter = letter.downcase\n if guesses.include?(letter)\n return\n else\n self.guesses << letter\n end\n\n if word.include?(letter)\n if !word_display.include?(\"_\") && wrong_guesses < 6\n self.game_status = STATUS_WON\n end\n else\n self.wrong_guesses += 1\n if self.wrong_guesses >= 6\n self.game_status = STATUS_LOST\n end\n end\n self.save!\n else\n return\n end\n end", "title": "" }, { "docid": "4b1c12c706abb962c3887653766124e6", "score": "0.64008385", "text": "def update_guess(guess_letter)\n @game_word.include?(guess_letter) == false ? incorrect_letter(guess_letter) : correct_letter(guess_letter)\n show_game_info\n end", "title": "" }, { "docid": "e028cf4e402d8467a4dcd716ee52cb88", "score": "0.6393857", "text": "def guess\n found = false\n if @guesses.empty?\n return random_array\n else\n until found\n candidate = random_array\n if @guesses.all? { |guess, output| consistent?(candidate, guess, output) }\n found = true\n end\n end\n end\n candidate\n end", "title": "" }, { "docid": "e2daf01e767b5f431500ca990376c6c1", "score": "0.6392729", "text": "def play_game(p1_r1, p1_r2, p1_r3, p2_r1, p2_r2, p2_r3)\n #Seteo en 0 y vacio las variables globales\n $rounds_wins_p1 = 0\n $rounds_wins_p2 = 0\n $count_tie = 0\n @rounds = []\n #Juego las primeras 2 rondas\n self.play_round(p1_r1,p2_r1)\n self.play_round(p1_r2,p2_r2)\n if (not hay_ganador())\n self.play_round(p1_r3,p2_r3) \n end\n #Muestro cual fue el resultado de la partida\n self.result_global_is()\n\n end", "title": "" }, { "docid": "8d2c1920efb90a79cc14d921d254825f", "score": "0.63895595", "text": "def guess(user_guess)\n if(!@game_over)\n user_guess = validate_input(user_guess)\n @guesses.push(user_guess.dup)\n sc = @secret_code.dup\n data = \"\"\n #search for correct colors in the correct spot\n user_guess.split(\"\").each_with_index do |c, i|\n #if the letter is found in the secret code at the correct spot, add a 'B' to the \n #data string and replace that letter in the user_guess and the secret_code duplication\n if (c == sc[i])\n data += 'B'\n sc.slice!(i)\n sc.insert(i, ' ')\n user_guess.slice!(i)\n user_guess.insert(i, '_')\n end\n end\n #search for correct colors in the wrong spot\n user_guess.split(\"\").each do |c|\n #if the letter is found in the secret code at the wrong spot, add a 'W' to the \n #data string and replace that letter in the user_guess and the secret_code duplication\n if (sc.include? c)\n data += 'W'\n index = sc.index(c)\n sc.slice!(index)\n sc.insert(index, ' ')\n index = user_guess.index(c)\n user_guess.slice!(index)\n user_guess.insert(index, '_')\n end\n end\n @guess_number += 1\n @game_over = true if @guess_number > 12 || data == \"BBBB\"\n @winner = true if data == \"BBBB\"\n @data_pegs.push(('%-4.4s' % data))\n return data\n end\n end", "title": "" }, { "docid": "e58e7a9f5aed4b965f30cff31ed3d671", "score": "0.6386528", "text": "def guess(guess)\n \tif guess > @answer\n \t\treturn :high\n \telsif guess < @answer\n \t\treturn :low\n \telse\n \t\t@is_solved = true\n \t\treturn :correct\n \tend\n end", "title": "" }, { "docid": "defe39b1157bf82d6c16042fa96e3634", "score": "0.6385756", "text": "def computer_guess_human_code\n feedback = @human.check_this_guess(@ai.code)\n hash = {\n colors: feedback,\n guess: @ai.code,\n game_over: game_over?\n }\n @ai.new_guess(feedback)\n hash\n end", "title": "" }, { "docid": "167dcd80edd793f0f0d78b8b64c13864", "score": "0.63718677", "text": "def rps_game_winner(game)\n\traise WrongNumberOfPlayersError unless game.length == 2\n\thand_space = [\"R\", \"P\", \"S\", \"r\", \"p\", \"s\"]\n\thand1 = game[0][1]\n\thand2 = game[1][1]\n\tif(!(hand_space.include?(hand1)) || !(hand_space.include?(hand2)))\n\t\traise NoSuchStrategyError\n\tend\n\n\tcase hand1\n\twhen \"R\"\n\t\tif(hand2 == (\"R\" || \"r\"))\n\t\t\traise TieError\n\t\telsif(hand2 == (\"P\" || \"p\"))\n\t\t\treturn game[1]\n\t\telse\n\t\t\treturn game[0]\n\t\tend\n\twhen \"P\"\n\t\tif(hand2 == (\"P\" || \"p\"))\n\t\t\traise TieError\n\t\telsif(hand2 == (\"S\" || \"s\"))\n\t\t\treturn game[1]\n\t\telse\n\t\t\treturn game[0]\n\t\tend\n\twhen \"S\"\n\t\tif(hand2 == (\"S\" || \"s\"))\n\t\t\traise TieError\n\t\telsif(hand2 == (\"R\" || \"r\"))\n\t\t\treturn game[1]\n\t\telse\n\t\t\treturn game[0]\n\t\tend\n\twhen \"r\"\n\t\tif(hand2 == (\"R\" || \"r\"))\n\t\t\traise TieError\n\t\telsif(hand2 == (\"P\" || \"p\"))\n\t\t\treturn game[1]\n\t\telse\n\t\t\treturn game[0]\n\t\tend\n\twhen \"p\"\n\t\tif(hand2 == (\"P\" || \"p\"))\n\t\t\traise TieError\n\t\telsif(hand2 == (\"S\" || \"s\"))\n\t\t\treturn game[1]\n\t\telse\n\t\t\treturn game[0]\n\t\tend\n\twhen \"s\"\n\t\tif(hand2 == (\"S\" || \"s\"))\n\t\t\traise TieError\n\t\telsif(hand2 == (\"R\" || \"r\"))\n\t\t\treturn game[1]\n\t\telse\n\t\t\treturn game[0]\n\t\tend\n\tend\n\nend", "title": "" }, { "docid": "4e7048ddb1e073926bc0e59995889486", "score": "0.6369177", "text": "def play\n\t\t#cycles through until 6 wrong guesses or a win\n\t\twhile @number_wrong < 6\n\t\t\tguess = nil\n\t\t\tprint %x{clear}\n\t\t\t#draws out the hangman display\n\t\t\tputs @gameboard.draw(@number_wrong)\n\t\t\tputs \"Wrong guesses: \" + @wrong_guesses.join(\", \") if not @wrong_guesses.empty?\n\t\t\tputs \"\\n\\n #{@display}\\n\\n\\n\"\n\t\t\t#until a valid guess is entered keep asking, checks for duplicate answers too\n\t\t\tuntil guess != nil\n\t\t\t\tprint \"#{@name}, enter a letter to guess or 'save' to save your game: \"\n\t\t\t\tguess = get_guess\n\t\t\t\tif guess !=nil && (@display.include?(guess) || @wrong_guesses.include?(guess))\n\t\t\t\t\tguess = nil\n\t\t\t\t\tputs \"You already guessed that letter!\"\n\t\t\t\tend\n\t\t\tend\n\t\t\tbreak if guess == \"save\"\n\t\t\t#if the guess is in the answer it loops through in case there are multiple of the same letter in the answer\n\t\t\tif @answer.include?(guess)\n\t\t\t\tuntil @answer.include?(guess) == false\n\t\t\t\t\tposition = @answer.index(guess)\n\t\t\t\t\t@display[position] = guess\n\t\t\t\t\t@answer.sub!(guess, \"*\")\n\t\t\t\tend\n\t\t\t#if the guess is wrong it adds it to the wrong guesses bank and adds 1 to the counter\n\t\t\telse\n\t\t\t\t@wrong_guesses << guess\n\t\t\t\t@number_wrong += 1\n\t\t\tend\n\t\t\tbreak if won?\n\t\tend\n\t\t#skips the end game stuff if player chose to save\n\t\tif guess == \"save\"\n\t\t#outputs for a win\n\t\telsif won?\n\t\t\tprint %x{clear}\n\t\t\tputs @gameboard.draw(@number_wrong)\n\t\t\tputs \"Wrong guesses: \" + @wrong_guesses.join(\", \") if not @wrong_guesses.empty?\n\t\t\tputs \"\\n\\n #{@display}\\n\\n\\n\"\n\t\t\tputs \"Congratulations #{@name}, You Win!!\"\n\t\t#outputs for a loss\n\t\telse\n\t\t\tprint %x{clear}\n\t\t\tputs @gameboard.draw(@number_wrong)\n\t\t\tputs \"Wrong guesses: \" + @wrong_guesses.join(\", \") if not @wrong_guesses.empty?\n\t\t\tputs \"\\n\\n #{@display}\\n\\n\\n\"\n\t\t\tputs \"Unfortunately you were unable to guess the word and killed the guy...\"\n\t\t\tputs \"The correct answer is #{@lose}.\"\n\t\tend\n\t\tguess\n\tend", "title": "" }, { "docid": "0592909dc4bbe1aa25a5d60bfffc62ad", "score": "0.6369009", "text": "def run_game(attempt, grid, start_time, end_time)\n # TODO: runs the game and return detailed hash of result\n\n\nmessage = \"\"\ni = 0\n\n\nif palavra_existe(attempt)\n\n if comparar(grid, attempt)\n message = \"well done\"\n score_result = score(attempt,start_time, end_time)\n else\n message = \"not in the grid\"\n score_result = 0\n end\n\nelse\n message = \"not an english word\"\n score_result = 0\n\nend\n\n\n\nresult = Hash.new\n\nresult[:time] = (end_time.to_i - start_time.to_i)\nresult[:translation] = traduzir(attempt)\nresult[:score] = score_result\nresult[:message] = message\n\nreturn result\n\n\nend", "title": "" }, { "docid": "a3e16916dcd06826dfb06b713a77467b", "score": "0.6367505", "text": "def guess\n key = params[:key]\n letter = params[:letter]\n\n # Validate input parameters contains only single english letter\n unless check_guess?(letter)\n render status: 400, json: {error: 'Expected guessing a single english character'}\n return\n end\n\n # Handle missing key\n if key.blank?\n render status: 400, json: {error: 'Game key is missing in the query parameters!'}\n return\n end\n\n # Handle invalid game key\n game = Game.find_by key: key\n unless game\n render status: 400, json: {error: 'Game key is invalid!'}\n return\n end\n\n current = game[:current] # partially guessed word\n answer = game[:answer]\n lives = game[:lives]\n trials = game[:trials]\n\n # Safe check requesting to a finished game\n if lives == 0\n render status: 400, json: {error: 'Game has already ended!'}\n return\n end\n\n # Loop through the word and find matched letters\n matched = false\n current.each_char.with_index { |_, index|\n if current[index] == '_' && answer[index] == letter\n current[index] = letter\n matched = true\n end\n }\n lives -= 1 unless matched\n\n trials = trials + letter\n state = state_of(answer, current, lives)\n game.update(lives: lives, current: current, trials: trials)\n response_data = {\n :key => key,\n :phrase => current,\n :lives => lives,\n :state => state,\n :trials => trials\n }\n response_data[:answer] = answer unless state == 'alive'\n render status: 200, json: response_data\n end", "title": "" }, { "docid": "07ff29d24d98b8bb6b029bafd2dcd8dc", "score": "0.6363652", "text": "def last_guess\n Output.guess(@guess.code, @game_type)\n if @game_type == 'breaker'\n puts \"\\nYou lose :( the secret code was #{Output.color(@secretcode)}\\n\\n\"\n else\n puts \"\\nYou win!! the computer couldn't guess your secret code :#{Output.color(@secretcode)}\\n\\n\"\n end\n @game_over = true\n end", "title": "" }, { "docid": "17e48cb052278a61d36d6419d6c3cb57", "score": "0.63625103", "text": "def get_guess(round, guess_cat = 0)\n\t\t\tgrid[round][guess_cat]\n\t\tend", "title": "" }, { "docid": "23b9a0922c231a244ac44191896ebe2d", "score": "0.6343479", "text": "def guess\n char = game_params[:char]\n @guess_status = process_guess(char)\n message = verbose_message_for(@guess_status)\n respond_to do |format|\n format.html { redirect_to game_path(@game, format: :html), notice: message[:notice] }\n format.json { render :guess, status: message[:status] }\n end\n end", "title": "" }, { "docid": "3ca60fceb7e02a1746bf2ee035a9f377", "score": "0.63398015", "text": "def guess(letter)\n if word_has?(letter)\n \tput_letter_on_board(letter)\n else\n wrong_letter(letter) if !@guesses.include? letter\n end\n end", "title": "" }, { "docid": "f1772b10ed0b52c2ed7f8fbe8456d285", "score": "0.6339482", "text": "def play\n menu\n create_players\n won = false\n 12.times do\n won = @breaker.make_guess\n break if won\n end\n game_over(won)\n end", "title": "" }, { "docid": "dd198b9ae5c6f765dc8ab770a4b0814d", "score": "0.6337054", "text": "def guess\n @guess_str = @guess_str == '' ? 'rrbb' : @s.sample\n unless last_evaluation.nil?\n @s.select! do |code|\n Game.evaluate_guess(@last_guess, code) == last_evaluation\n end\n @last_guess = @guess_str\n end\n @guess_str\n end", "title": "" }, { "docid": "6a54be778be2b90a124a7dbc2a4ed652", "score": "0.63290256", "text": "def computer_guess_turn\n feedback_engine\n computer_change_guess\n puts \"Guess Board: #{@guess_board.state}\"\n end", "title": "" }, { "docid": "45ed6b4bcc796933e814d5d2ff6e9128", "score": "0.6327949", "text": "def checkGuess\n\t\tcorrect = 0\n\t\tposition = 0\n\t\tguess.each_with_index{ |element, index|\n\t\t\tif element == code[index]\n\t\t\t\tcorrect += 1\n\t\t\telsif code.include?(element)\n\t\t\t\tposition += 1\n\t\t\tend\n\t\t}\n\t\tputs \"Correct position \" + correct.to_s\n\t\tputs \"Color in wrong position \" + position.to_s \n\t\t@win = true if correct == 4\n\t\tif !@win \n\t\t\t@turns -= 1\n\t\t\tputs \"There are \" + @turns.to_s + \" turns left.\"\n\t\tend\n\tend", "title": "" }, { "docid": "c14a9f1144df9f0d875b65d43e1c5853", "score": "0.6327326", "text": "def play_game\r\n\t\t#Randomly chooses player to deal cards and then a player to lead\r\n\t\t@players[rand(@players.size)].deal(@deck, @players)\r\n\t\tlead = @players[rand(@players.size)]\r\n\t\t#Start of main game\r\n\t\tfor trick in (1..13) do\r\n\t\t\tputs \"\\n\\nTrick #{trick}: #{lead.name} leads...\\n\\n\"\r\n\t\t\t#Lead player plays first card\r\n\t\t\tfirst_card = lead.hand.pop\r\n\t\t\tlead_suit = first_card.suit\r\n\t\t\tputs \"#{lead.name} has led with #{first_card.rank.card} of #{lead_suit}\"\r\n\t\t\tcards_played = {lead => first_card}\r\n\t\t\t#Other players play their cards\r\n\t\t\ti = @players.index(lead)\r\n\t\t\t3.times do\r\n\t\t\t\ti = i + 1\r\n\t\t\t\tnext_player = @players[i % 4]\r\n\t\t\t\tcard = next_player.play_card(lead_suit)\r\n\t\t\t\tcards_played[next_player] = card\r\n\t\t\t\tputs \"#{next_player.name} has played #{card.rank.card} of #{card.suit}\"\r\n\t\t\tend\r\n\t\t\tputs \"\\n\\n\"\r\n\t\t\t#Works out which player won the trick and assigns winner to lead next trick\r\n\t\t\tmax_rank = first_card.rank\r\n\t\t\tbest_card = first_card\r\n\t\t\tcards_played.values.each do |card|\r\n\t\t\t\tif (card.suit == lead_suit) then\r\n\t\t\t\t\tif (card.rank > max_rank) then\r\n\t\t\t\t\t\tbest_card = card\r\n\t\t\t\t\t\tmax_rank = card.rank\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\t\twinner = cards_played.key(best_card)\r\n\t\t\tputs \"#{winner.name} won the trick with the #{best_card.rank.card} of #{best_card.suit}\"\r\n\t\t\tlead = winner\r\n\t\tend\t\r\n\tend", "title": "" }, { "docid": "eac529c47657b0d3de09c0e1ee4add5b", "score": "0.6325064", "text": "def guess(letter)\n\tif word_has?(letter)\n\t\tput_letter_on_board(letter)\n\telse\n\t wrong_letter(letter) if !@guesses.include? letter\n\tend\n end", "title": "" }, { "docid": "8160cf3a8a67d79f28ca0ee5ba911a3b", "score": "0.6324795", "text": "def take_a_guess\n puts \" \"\n puts \"Enter your letter guess:\"\n valid_answer = false\n while valid_answer == false\n @howbout = gets.chomp.upcase.to_s\n if @howbout == (0..9)\n puts \"No #{@name}, not a number...enter a letter, a letter, stupid!\"\n elsif @howbout.length > 1\n puts \"Uhh, enter just ONE letter #{@name}, mmmmm...O-kay?\"\n else \n valid_answer = true\n end\n end\n @hitcount = 0\n for index in 0...@num_letters\n if @letters[index] == @howbout\n @guesses[index] = @howbout\n @hitcount += 1\n else\n end\n end\n if @hitcount != 0\n puts \"\\n\\n\\n\"\n puts \"Yes, #{@hitcount} matches for #{@howbout}!\"\n else\n puts \"\\n\\n\\n\"\n puts \"No, #{@howbout} is not a match\"\n @wrong_guesses.push(@howbout)\n @fail -= 1\n case @fail\n when 6\n @gallows[2] = @wrong2\n when 5\n @gallows[3] = @wrong31\n when 4\n @gallows[3] = @wrong32\n when 3\n @gallows[3] = @wrong33\n when 2\n @gallows[4] = @wrong4\n when 1\n @gallows[5] = @wrong51\n when 0\n @gallows[5] = @wrong52\n end\n end\n end", "title": "" }, { "docid": "063f709a548fe7a0b51c35935363e618", "score": "0.6319523", "text": "def play\n end_game = false\n until @guesses == 6 || end_game == true\n guess = play_round(@player, @board, @dictionary.word)\n save if guess == 'save'\n update unless guess == 'save' || @dictionary.correct_letter?(guess)\n end_game = check_condition(@dictionary.word.split(''), '_')\n p @guesses\n end\n end", "title": "" }, { "docid": "95ccd5731951b809176c4bc4a5702d5b", "score": "0.631611", "text": "def good_guess?(player_guess)\n @guess_history.push(player_guess)\n nb_found = 0\n @word.split('').each_with_index do |ltr, idx|\n if ltr == player_guess\n @display[idx] = player_guess.upcase\n nb_found += 1\n end\n end\n # found letter + display number of occurrences\n if nb_found > 0\n puts \"Found #{nb_found} #{player_guess} in this word!\"\n return true\n else\n puts \"Wrong guess, keep going!\"\n @misses.push(player_guess)\n return false\n end\n end", "title": "" }, { "docid": "0928512dfd5337ecc8a60b542b4794fa", "score": "0.63145006", "text": "def guess(guess)\n @guess = guess\n if @guess > @answer\n return :high\n elsif @guess < @answer\n return :low\n else\n return :correct\n end\n end", "title": "" }, { "docid": "655a6298ebba297829198aee0e3d67ba", "score": "0.63135386", "text": "def play\n\t\t#is the game over\n\t\tgameOver = false\n\t\t#iterate over the players for each turn\n\t\titerate = 0\n\t\t#iterate over the players when asking for responses\n\t\titerate2 = 0\n\n\t\t#while no one has won\n\t\twhile !gameOver\n\t\t\t#set the active player for this turn\n\t\t\tactivePlayer = @players[iterate]\n\t\t\t#have they been eliminated yet? If not keep going\n\t\t\tif !activePlayer.eliminated?\n\t\t\t\t#get the active players guess\n\t\t\t\ttheGuess = activePlayer.getGuess\n\t\t\t\t#is this guess an accusation?\n\t\t\t\tif theGuess.isAccusation\n\t\t\t\t\t#if so then see if it's correct\n\t\t\t\t\tif correct(theGuess)\n\t\t\t\t\t\t#if it's correct then the active player has won\n\t\t\t\t\t\tgameOver = true\n\t\t\t\t\t\tactivePlayer.win\n\t\t\t\t\telse\n\t\t\t\t\t\t#if not then the active player is eliminated\n\t\t\t\t\t\tactivePlayer.setEliminated\n\t\t\t\t\t\t#someone just got eliminated so see if everyone is out\n\t\t\t\t\t\tif allOut?\n\t\t\t\t\t\t\tgameOver = true\n\t\t\t\t\t\t\tputs \"Everyone is out, no one wins\"\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t#if the guess is not an accusation\n\t\t\t\telse\n\t\t\t\t\t#start the iterator to go over players for their responses\n\t\t\t\t\titerate2 = (iterate+1) % @numPlayers\n\t\t\t\t\t#response is nil if no one can respon\n\t\t\t\t\tresponse = nil\n\n\t\t\t\t\t#while we haven't got back to the asking player\n\t\t\t\t\t#and we haven't gotten a reponse yet\n\t\t\t\t\twhile( !(iterate2==iterate) && response.nil? )\n\t\t\t\t\t\t#ask the next player for their response\n\t\t\t\t\t\tresponse = @players[iterate2].canAnswer(iterate, theGuess)\n\t\t\t\t\t\t#if response is nil then go to the next player\n\t\t\t\t\t\tif response.nil?\n\t\t\t\t\t\t\titerate2 = (iterate2+1) % @numPlayers\t\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\n\t\t\t\t\t#if response is still nil\n\t\t\t\t\tif response.nil?\n\t\t\t\t\t\t#tell the player no one could answer\n\t\t\t\t\t\tactivePlayer.receiveInfo(-1,nil)\n\t\t\t\t\telse\n\t\t\t\t\t\t#otherwise show them the response\n\t\t\t\t\t\tactivePlayer.receiveInfo(iterate2, response)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\t#iterate to the next player\n\t\t\titerate = (iterate+1) % @numPlayers\n\t\tend\n\tend", "title": "" }, { "docid": "7f03a934e450cd71f613e82b66b4f313", "score": "0.6313194", "text": "def guess(guess)\n \t@guess = guess\n \treturn :high if @guess > @answer\n \treturn :low if @guess < @answer\n \treturn :correct if @guess == @answer\n end", "title": "" }, { "docid": "cebca1f8aaaaf60aa268c7bafa0fc47c", "score": "0.6310266", "text": "def results_guess\n if @matches == 4\n puts 'You win! you guessed the correct code and beat the Computer!'\n elsif @i == 11\n puts 'Better luck next time, the Computer wins.'\n end\n end", "title": "" }, { "docid": "062306dcffe7fc60ed444c3f5f3bdbeb", "score": "0.6308962", "text": "def start_game\n @possible_guesses = @all_guesses\n create_human_number\n comp_turn\n end", "title": "" }, { "docid": "7c1bc495224ca1ddfa25d8ae7396ba80", "score": "0.6305739", "text": "def find_player(name)\n # returns the hash of a player, given the name as a string\n player = {}\n # Run expressions for Home and Away teams\n game_hash.each do |location, team_data|\n # set variable to player with matching name. If none, it returns nil\n player = team_data[:players].find { |player_hash| \n player_hash[:player_name] == name }\n \n # if player is not nil, it means we've already found a match and should not run find on the other team\n if player != nil\n return player\n end\n \n end\n player\nend", "title": "" }, { "docid": "4bdaa1da2040420931fa369cad85ba83", "score": "0.63022983", "text": "def game_playing(guess_arr)\n\t\tif @guess_arr == @key\n\t\t\tputs \"You've correctly matched up all colors and positions. Too bad you now have dysentery! Your playing time was #{time_played} and you guessed #{guess_counter} times.\"\n\t\telse\n\t\t\tputs \"@\"*130\n\t\t\tputs \"For the love of Pete that's the wrong combination. Keep at it. Try again... But if you need a hint, just type in (h)int\"\n\t\t\tplay(user_input)\n\t\tend\n\tend", "title": "" } ]
93825a4a77db99dae3be5215134b2698
Finish initializing this object
[ { "docid": "53084b651e2b22cfb847c4cf7f490842", "score": "0.0", "text": "def init_before_save\n self.turn = 1\n self.number = 1\n self.intro = (Intro).all.sample(1).first.name\n end", "title": "" } ]
[ { "docid": "bf8ea5e63f2bc7a5d02fc23a055fdd69", "score": "0.75705355", "text": "def finalize!\n end", "title": "" }, { "docid": "18e90880774cce12790c59daeb7b5b56", "score": "0.7530723", "text": "def finalize\n end", "title": "" }, { "docid": "18e90880774cce12790c59daeb7b5b56", "score": "0.7530723", "text": "def finalize\n end", "title": "" }, { "docid": "e79e462ef27261719a45b79f98470b0e", "score": "0.75243664", "text": "def finalize\n self\n end", "title": "" }, { "docid": "837f2cd12a2d8f2b27627b53c2db5299", "score": "0.7522505", "text": "def initialize_done\n # noop: implement in subclasses\n end", "title": "" }, { "docid": "23df987838bc20d3c97f88ed9ccbb868", "score": "0.72375774", "text": "def finalize\n end", "title": "" }, { "docid": "8e2e2862e3b757f88dc8c13caa403f42", "score": "0.71300834", "text": "def finalize\n end", "title": "" }, { "docid": "26afde75bfcc6a7ddab3f8d23d38b58f", "score": "0.7124072", "text": "def finalize\n\n end", "title": "" }, { "docid": "26afde75bfcc6a7ddab3f8d23d38b58f", "score": "0.7124072", "text": "def finalize\n\n end", "title": "" }, { "docid": "b1d6201b94be470b5b839b4023b2e8dd", "score": "0.70435405", "text": "def finalize\n nil\n end", "title": "" }, { "docid": "b1d6201b94be470b5b839b4023b2e8dd", "score": "0.70435405", "text": "def finalize\n nil\n end", "title": "" }, { "docid": "9fa4e26b96649d8d9ab37b320816e7f3", "score": "0.7005139", "text": "def finalize; end", "title": "" }, { "docid": "c09d6bd4adbc0220f1d06520e9b4ad47", "score": "0.6826101", "text": "def finalize\n @name = Config.get_if_unset(@name, '')\n @handler = Config.get_if_unset(@handler, nil)\n\n self\n end", "title": "" }, { "docid": "2c9ba03bddd08c9978d138468a25139b", "score": "0.6821487", "text": "def finalize\n return self if @finalized\n @finalized = true\n self\n end", "title": "" }, { "docid": "2c9ba03bddd08c9978d138468a25139b", "score": "0.6821487", "text": "def finalize\n return self if @finalized\n @finalized = true\n self\n end", "title": "" }, { "docid": "726051c842f97d99f8190e3f78e848d3", "score": "0.68152547", "text": "def finalized?; end", "title": "" }, { "docid": "1df65d045e0d65f9bf9b98c8cdd94356", "score": "0.67316765", "text": "def finish()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "4c8439db0eda07a0e24e524732fafa74", "score": "0.662349", "text": "def on_initialization_finished()\n end", "title": "" }, { "docid": "1ae8fd180e2e94079735386f6003273f", "score": "0.66052645", "text": "def finalize(options = {})\r\n end", "title": "" }, { "docid": "2ccda909a9d13698297a712ca3cd7dfb", "score": "0.66043806", "text": "def finalize\n return self if @finalized\n Finalizer.call(self)\n @finalized = true\n self\n end", "title": "" }, { "docid": "2ccda909a9d13698297a712ca3cd7dfb", "score": "0.66043806", "text": "def finalize\n return self if @finalized\n Finalizer.call(self)\n @finalized = true\n self\n end", "title": "" }, { "docid": "eca5cf77e496933202ddd53db5f81f89", "score": "0.6601317", "text": "def finalize\n @finalize ||= @results\n end", "title": "" }, { "docid": "c7a523b55493f937a65b1cc7a555d8ab", "score": "0.6561623", "text": "def post_initialize\n end", "title": "" }, { "docid": "1a81945741feb7ee102e6f450c79c051", "score": "0.6533905", "text": "def post_initialize\n nil\n end", "title": "" }, { "docid": "6dd847a2a1d2e63cdfe8bb5b6e1cb5f9", "score": "0.6519269", "text": "def finalize!\n # The access keys default to nil\n @host_folder = nil if @host_folder == UNSET_VALUE\n @guest_folder = nil if @guest_folder == UNSET_VALUE\n @ignore = nil if @ignore == UNSET_VALUE\n @repeat = 1 if @repeat == UNSET_VALUE\n\n # Mark that we finalized\n @__finalized = true\n end", "title": "" }, { "docid": "378e2b4fcf0bbf68688ed12061a1e20f", "score": "0.65137583", "text": "def finalize(success = true)\n end", "title": "" }, { "docid": "47506f7df0a394e8806591852c211885", "score": "0.65124357", "text": "def post_initialize ; end", "title": "" }, { "docid": "47506f7df0a394e8806591852c211885", "score": "0.65124357", "text": "def post_initialize ; end", "title": "" }, { "docid": "3a2bbf6e9411887b92c90fcdfcd61952", "score": "0.6488283", "text": "def after_initialize\n end", "title": "" }, { "docid": "3a2bbf6e9411887b92c90fcdfcd61952", "score": "0.6488283", "text": "def after_initialize\n end", "title": "" }, { "docid": "e6e32f2ed107c2c1cb5fd0a5e6706b76", "score": "0.64865005", "text": "def deinit\n # no-op\n end", "title": "" }, { "docid": "f36a82480f65a380430fed4b01b7ad0e", "score": "0.6476749", "text": "def finalize\n debug ['finalize', self.class.name]\n end", "title": "" }, { "docid": "a8462d8ba5db11602668dec976ac79c6", "score": "0.64610654", "text": "def finalize!\n @create_args = [] if @create_args == UNSET_VALUE\n @name = nil if @name == UNSET_VALUE\n @mac = nil if @mac == UNSET_VALUE\n @memory = 512 if @memory == UNSET_VALUE\n @cpus = 1 if @cpus == UNSET_VALUE\n end", "title": "" }, { "docid": "2d746ca6e15cb3a8525e8ab74c4ac237", "score": "0.6460695", "text": "def after_initialize(*_)\n end", "title": "" }, { "docid": "262d1aa18bcb697211cd9aa6a117edec", "score": "0.64554936", "text": "def post_init\n end", "title": "" }, { "docid": "a29b00b5e77dc3a6de79921acf14bcd4", "score": "0.6452316", "text": "def after_initialize\n nil\n end", "title": "" }, { "docid": "f3824cb1d14175be80c3410ce7c9f0a6", "score": "0.6447155", "text": "def after_initialize\n end", "title": "" }, { "docid": "9e2afb587bcfb59347b8060099c5c0b8", "score": "0.64427674", "text": "def finish\n nil\n end", "title": "" }, { "docid": "17d3c63338b39034da8d54a2c662b5d3", "score": "0.6433428", "text": "def finalize!\n @deps = [] if @deps == UNSET_VALUE\n @local_deps_path = nil if @local_deps_path == UNSET_VALUE\n @bootstrap_branch = nil if @bootstrap_branch == UNSET_VALUE\n\n # Setup bootstrap URL if not set\n if @bootstrap_url == UNSET_VALUE\n @bootstrap_url = \"https://babushka.me/up\"\n @bootstrap_url += \"/#{@bootstrap_branch}\" if @bootstrap_branch\n end\n\n # Set defaults for command-line arguments\n @color = nil if @color == UNSET_VALUE\n @debug = false if @debug == UNSET_VALUE\n @dry_run = false if @dry_run == UNSET_VALUE\n @show_args = false if @show_args == UNSET_VALUE\n @silent = false if @silent == UNSET_VALUE\n @update = true if @update == UNSET_VALUE\n end", "title": "" }, { "docid": "54a77e929ce3b21d5c2caf8cc4c1ae3f", "score": "0.6415958", "text": "def finalize(options = {})\n end", "title": "" }, { "docid": "a7a7f742c9125435d551237aec8f196c", "score": "0.64130783", "text": "def finish\n end", "title": "" }, { "docid": "a7a7f742c9125435d551237aec8f196c", "score": "0.64130783", "text": "def finish\n end", "title": "" }, { "docid": "910935542a05e24cbc4ef9257c801bdc", "score": "0.6407506", "text": "def finalize\n # do nothing\n end", "title": "" }, { "docid": "39b822cf5001c5736ccf64ea9891f8e7", "score": "0.6402479", "text": "def post_initialize; end", "title": "" }, { "docid": "39b822cf5001c5736ccf64ea9891f8e7", "score": "0.6402479", "text": "def post_initialize; end", "title": "" }, { "docid": "6d64249a20333025ec707d5f272ab259", "score": "0.6401668", "text": "def finalize!\n\t\t\t\t@endpoint = nil if @endpoint == UNSET_VALUE\n\t\t\t\t@user_name = nil if @user_name == UNSET_VALUE\n\t\t\t\t@password = nil if @password == UNSET_VALUE\n\t\t\t\t@os_template = nil if @os_template == UNSET_VALUE\n\t\t\tend", "title": "" }, { "docid": "51f8c040504388a71534ab20920d6ec1", "score": "0.6386769", "text": "def after_initialize(&block); end", "title": "" }, { "docid": "a747cf4388fb3d14718cf9dda73c555f", "score": "0.63839537", "text": "def initalize; end", "title": "" }, { "docid": "a747cf4388fb3d14718cf9dda73c555f", "score": "0.63839537", "text": "def initalize; end", "title": "" }, { "docid": "5290fed6abb3d1aa4a92144f54fe399a", "score": "0.6362683", "text": "def finished\n end", "title": "" }, { "docid": "5edac9eb313dd2d82caf4151ca49e7b0", "score": "0.63606125", "text": "def post_init\n end", "title": "" }, { "docid": "d7679020e64c7352a1fbc856c67d1f5b", "score": "0.6357941", "text": "def finalize!\n freeze\n config.finalize!\n end", "title": "" }, { "docid": "d7679020e64c7352a1fbc856c67d1f5b", "score": "0.6357941", "text": "def finalize!\n freeze\n config.finalize!\n end", "title": "" }, { "docid": "bbf7506a14f089d255e04d392c7912c9", "score": "0.6344904", "text": "def finalize!\n super\n\n # Null checks\n @generate_passwd = false if @generate_passwd == UNSET_VALUE\n @generate_group = false if @generate_group == UNSET_VALUE\n @passwd_path = 'C:\\\\Program Files\\\\OpenSSH\\\\etc\\\\passwd' if @passwd_path == UNSET_VALUE || @passwd_path.empty?\n @mkpasswd_path = 'C:\\\\Program Files\\\\OpenSSH\\bin\\\\mkpasswd.exe' if @mkpasswd_path == UNSET_VALUE || @mkpasswd_path.empty?\n @group_path = 'C:\\\\Program Files\\\\OpenSSH\\\\etc\\\\group' if @group_path == UNSET_VALUE || @group_path.empty?\n @mkgroup_path = 'C:\\\\Program Files\\\\OpenSSH\\bin\\\\mkgroup.exe' if @mkgroup_path == UNSET_VALUE || @mkgroup_path.empty?\n end", "title": "" }, { "docid": "6a73660b8ed05f64a62fb4de3fee9bc7", "score": "0.63276124", "text": "def after_initialize ; end", "title": "" }, { "docid": "880bb10522d396b8fee1d3311b50cbbd", "score": "0.6314228", "text": "def finish\n finish_active_flag\n finish_arg_defs\n finish_flag_groups\n finish_special_data\n @finished = true\n self\n end", "title": "" }, { "docid": "a6f92b14e01aea416fe228736d1c9c16", "score": "0.63130176", "text": "def finalize!\n # Default is to auto the DNS proxy\n @auto_nat_dns_proxy = true if @auto_nat_dns_proxy == UNSET_VALUE\n\n if @check_guest_additions == UNSET_VALUE\n @check_guest_additions = true\n end\n\n if @destroy_unused_network_interfaces == UNSET_VALUE\n @destroy_unused_network_interfaces = false\n end\n\n if @functional_vboxsf == UNSET_VALUE\n @functional_vboxsf = true\n end\n\n # Default is to not show a GUI\n @gui = false if @gui == UNSET_VALUE\n\n # Do not create linked clone by default\n @linked_clone = false if @linked_clone == UNSET_VALUE\n @linked_clone_snapshot = nil if @linked_clone_snapshot == UNSET_VALUE\n\n # The default name is just nothing, and we default it\n @name = nil if @name == UNSET_VALUE\n\n @default_nic_type = nil if @default_nic_type == UNSET_VALUE\n end", "title": "" }, { "docid": "da86d253a785a475ecabfe3e7c60f954", "score": "0.63092965", "text": "def finalize!\n # Only finalize once on an instance. Even if finalization fails, we'd\n # be in an indeterminate state and we shouldn't try again.\n return self if @finalized\n @finalized = true\n\n self.send(:init_before_hook) if self.respond_to?(:init_before_hook)\n\n # initialize all required components\n unless comps = self.class.components and comps.any?\n $LOG.warn \"#{name} does not have any required components\"\n return\n end\n\n comps.each do |comp|\n $LOG.debug \"#{name}: #{comp} init\"\n case comp\n when :DB then init_db\n when :SCHEDULER then init_scheduler\n end\n end\n\n return self\n end", "title": "" }, { "docid": "106f59be58a1a7af29ef37a4836356c4", "score": "0.629891", "text": "def finalize!\n define!\n steps.freeze\n @config.freeze\n self\n end", "title": "" }, { "docid": "32eef31314ba47a6708f20a1a2c07161", "score": "0.6296884", "text": "def _finalize__ensure_finalizers_initialized\n _finalize__ensure_data_initialized\n unless @_finalize__finalizers_initialized\n _finalize__initialize_finalizers\n @_finalize__finalizers_initialized = true\n end\n end", "title": "" }, { "docid": "69a99e2f5c792ba4159b5e294a31a6a5", "score": "0.62808913", "text": "def initialize\n clear!\n end", "title": "" }, { "docid": "8b37f5eb52849a7ddd2c964fbc505d4e", "score": "0.6274494", "text": "def finalize\n # Do not stop the container\n end", "title": "" }, { "docid": "c6bf2b4a4fba1a678761ab829e4929bf", "score": "0.62595344", "text": "def _finalize__ensure_data_initialized\n unless @_finalize__data_initialized\n _finalize__initialize_data\n @_finalize__data_initialized = true\n end\n end", "title": "" }, { "docid": "2fa71f67c857eefd16abf835ac1216c5", "score": "0.62585855", "text": "def finish; end", "title": "" }, { "docid": "2fa71f67c857eefd16abf835ac1216c5", "score": "0.62585855", "text": "def finish; end", "title": "" }, { "docid": "2fa71f67c857eefd16abf835ac1216c5", "score": "0.62585855", "text": "def finish; end", "title": "" }, { "docid": "2fa71f67c857eefd16abf835ac1216c5", "score": "0.62585855", "text": "def finish; end", "title": "" }, { "docid": "2fa71f67c857eefd16abf835ac1216c5", "score": "0.62585855", "text": "def finish; end", "title": "" }, { "docid": "2fa71f67c857eefd16abf835ac1216c5", "score": "0.62585855", "text": "def finish; end", "title": "" }, { "docid": "e806f684239aab65146c38b186a51e5e", "score": "0.62581265", "text": "def finish\n #\n end", "title": "" }, { "docid": "9913252c8d7de589924b3a97349098eb", "score": "0.62492806", "text": "def finalize\n close\n end", "title": "" }, { "docid": "bf5227afc94b687d7298cde0db226ff0", "score": "0.624377", "text": "def post_initialize(**_args)\n nil\n end", "title": "" }, { "docid": "6da11b6018e9420a7480010c070c9965", "score": "0.62394655", "text": "def post_init; end", "title": "" }, { "docid": "6da11b6018e9420a7480010c070c9965", "score": "0.62394655", "text": "def post_init; end", "title": "" }, { "docid": "6da11b6018e9420a7480010c070c9965", "score": "0.62394655", "text": "def post_init; end", "title": "" }, { "docid": "a5a04dddb5a8f2ef1228f4c498271e78", "score": "0.6237015", "text": "def complete\n error = complete_with_error\n if error\n self.status = \"error\"\n add(\"Initialisation error: #{error}\", false)\n else\n self.status = \"waiting\"\n add(\"Initialised\", false)\n end\n end", "title": "" }, { "docid": "da608f9bfa763ac3d4978029614ad73e", "score": "0.6236389", "text": "def finish_object\n @finish_object ||= Object.new\n end", "title": "" }, { "docid": "877f738bb8a6633c816202165cea4b7c", "score": "0.62252253", "text": "def post_init()\n @@log.warn \"#{self} post_init done!\"\n end", "title": "" }, { "docid": "6009143f1050beac69d34b1ea5bb0a9f", "score": "0.6214541", "text": "def finalize\n raise \"override the finalize method in your subclass\"\n end", "title": "" }, { "docid": "8216aebe6a78f1233fd37fb760b89622", "score": "0.62126344", "text": "def post_initilize\n nil\n end", "title": "" }, { "docid": "cce7dbcdbf6ead3d6b5b134f00b29161", "score": "0.62099874", "text": "def finalize!\n\t\t\t\t@endpoint = nil if @endpoint == UNSET_VALUE\n\t\t\t\t@selected_node = nil if @endpoint == UNSET_VALUE\n\t\t\t\t@user_name = nil if @user_name == UNSET_VALUE\n\t\t\t\t@password = nil if @password == UNSET_VALUE\n\t\t\t\t@vm_type = nil if @vm_type == UNSET_VALUE\n\t\t\t\t@openvz_template_file = nil if @openvz_template_file == UNSET_VALUE\n\t\t\t\t@openvz_os_template = \"local:vztmpl/#{File.basename @openvz_template_file}\" if @openvz_template_file\n\t\t\t\t@openvz_os_template = nil if @openvz_os_template == UNSET_VALUE\n\t\t\t\t@qemu_os = nil if @qemu_os == UNSET_VALUE\n\t\t\t\t@qemu_iso_file = nil if @qemu_iso_file == UNSET_VALUE\n\t\t\t\t@qemu_iso = \"local:iso/#{File.basename @qemu_iso_file}\" if @qemu_iso_file\n\t\t\t\t@qemu_iso = nil if @qemu_iso == UNSET_VALUE\n\t\t\t\t@qemu_disk_size = nil if @qemu_disk_size == UNSET_VALUE\n\t\t\t\t@qemu_disk_size = convert_disk_size_to_gigabyte @qemu_disk_size if @qemu_disk_size\n @vm_disk_size = convert_disk_size_to_gigabyte @vm_disk_size if @vm_disk_size\n\t\t\tend", "title": "" }, { "docid": "f5b919216efd4f31885939f1f4a8de1e", "score": "0.61998105", "text": "def post_initialize(**kwargs) end", "title": "" }, { "docid": "d6ba50c69e3197301bef60a37112debe", "score": "0.61987996", "text": "def post_initialize(_args = {})\n nil\n end", "title": "" }, { "docid": "2fc9a9460b1ec7b72a43b9fb74cb9930", "score": "0.6196123", "text": "def post_initialize\n end", "title": "" }, { "docid": "2fc9a9460b1ec7b72a43b9fb74cb9930", "score": "0.6196123", "text": "def post_initialize\n end", "title": "" }, { "docid": "2fc9a9460b1ec7b72a43b9fb74cb9930", "score": "0.6196123", "text": "def post_initialize\n end", "title": "" }, { "docid": "5944a040b6150bf92ab7ee5a7a578424", "score": "0.6195036", "text": "def initialize\n\t\treset\n\tend", "title": "" }, { "docid": "fa7e02a0006d37db180afe19cf8026cc", "score": "0.61875457", "text": "def finish\n raise NotImplementedError\n end", "title": "" }, { "docid": "fa7e02a0006d37db180afe19cf8026cc", "score": "0.61875457", "text": "def finish\n raise NotImplementedError\n end", "title": "" }, { "docid": "b6be0f539557c249194c905f589a7f23", "score": "0.618346", "text": "def initialize\n reset\n end", "title": "" }, { "docid": "fd81ddbfe28625db1deec0cfa62b873d", "score": "0.618345", "text": "def initialize\n reset!\n end", "title": "" }, { "docid": "a8e5a29f57aef8c45b8fe6862252245b", "score": "0.61825114", "text": "def finished; end", "title": "" }, { "docid": "c359ea09bb4f98fbfa62597fd5c559e9", "score": "0.6176193", "text": "def finalize!\n data.resize! length\n self\n end", "title": "" }, { "docid": "2e85427b3a16c44b307a0786400a5607", "score": "0.6172919", "text": "def post_initialize\n #\n end", "title": "" }, { "docid": "db70148890bea844a4232465d98a6151", "score": "0.6171904", "text": "def finalize!\n super\n\n # Null checks\n @configuration_file = \"default.ps1\" if @configuration_file == UNSET_VALUE\n @module_path = nil if @module_path == UNSET_VALUE\n @synced_folder_type = nil if @synced_folder_type == UNSET_VALUE\n @temp_dir = nil if @temp_dir == UNSET_VALUE\n @mof_path = nil if @mof_path == UNSET_VALUE\n @configuration_name = File.basename(@configuration_file, File.extname(@configuration_file)) if @configuration_name == UNSET_VALUE\n @manifests_path = File.dirname(@configuration_file) if @manifests_path == UNSET_VALUE\n\n # Can't supply them both!\n if (@configuration_file != nil && @mof_path != nil)\n raise DSCError, :manifest_and_mof_provided\n end\n\n # Set a default temp dir that has an increasing counter so\n # that multiple DSC definitions won't overwrite each other\n if !@temp_dir\n counter = self.class.get_and_update_counter(:dsc_config)\n @temp_dir = \"/tmp/vagrant-dsc-#{counter}\"\n end\n end", "title": "" }, { "docid": "8026e679f8e4b0c222f5d2deee73e9b7", "score": "0.6167506", "text": "def finalize\n IceNine.deep_freeze!(self)\n end", "title": "" }, { "docid": "61086a8e5974f4f79bada179eeae6762", "score": "0.6158522", "text": "def post_initialize(*args)\n end", "title": "" }, { "docid": "1284ad8cfe9dc7e66f41331cef91d1e2", "score": "0.61485577", "text": "def run_finish\n end", "title": "" }, { "docid": "471fb14f9ceeb79e9c5d07f0db17b4a5", "score": "0.6144092", "text": "def initialize\n clear\n end", "title": "" }, { "docid": "471fb14f9ceeb79e9c5d07f0db17b4a5", "score": "0.6144092", "text": "def initialize\n clear\n end", "title": "" }, { "docid": "af65e99e7f287f35cdd3368e890420ce", "score": "0.61414135", "text": "def post_initialize(args); nil; end", "title": "" } ]
7d707720909e98643e3997de93d6e0f5
apis for workorder status 1
[ { "docid": "ee8d0176d0cf909900836cd5dd8de53a", "score": "0.6248158", "text": "def pending_workorders\n @emp_id = params[:employee_id]\n\n @emp_work = EmployeesWorkorder.where([\"employee_id = ? and status = ?\",@emp_id,\"Pending\"])\n @w = @emp_work.all.map{|e| e.workorder_id}\n if @emp_work.present?\n render :status => 200,\n :json => { :success => true,\n \n :data => { :workorders => @emp_work} } else\n render :status => 201,\n :json => { :success => false,\n :info => \"No Data\",\n :data => {} }\n end\nend", "title": "" } ]
[ { "docid": "5ebef10fdb179cffea85a2d0f20eff64", "score": "0.6751241", "text": "def order_status order_id\n path = \"/v1/order/orders/#{order_id}\"\n request_method = 'GET'\n params = { 'order-id' => order_id }\n perform(path, params, request_method)\n end", "title": "" }, { "docid": "5169dd37ae0c98855113ae21dd079954", "score": "0.6427457", "text": "def get_order_status(id)\n @client.raw('get', \"/ecommerce/order-statuses/#{id}\")\n end", "title": "" }, { "docid": "ab208b923fb67b90eb59203f11bb5998", "score": "0.640073", "text": "def get_status\n end", "title": "" }, { "docid": "5e22f7ef171ab1ed81d86ccb763c5a84", "score": "0.63779515", "text": "def order_status_details\n @orders = Order.get_order_status_details(params[:id])\n end", "title": "" }, { "docid": "ed6026e7d12fda2525796cfbffd2ac9b", "score": "0.6341058", "text": "def retrieve_status\n \n end", "title": "" }, { "docid": "758177d94cbfe28d0e33ef3ba4262bfe", "score": "0.6308617", "text": "def get_status(order_id)\n send_request('GetStatus', order_id: order_id)\n end", "title": "" }, { "docid": "1e5b589c1f6a7b768a80057fbb700ba8", "score": "0.6265795", "text": "def show_order_status\n @orders = Order.get_order_status_details(params[:id])\n end", "title": "" }, { "docid": "dcc61db20606ecc84a64a42db4fc8252", "score": "0.62068856", "text": "def status\n\n end", "title": "" }, { "docid": "bb62b6d37a289a0a2a0669741265436f", "score": "0.61894715", "text": "def get_order_status(smp)\n fba_api_key = smp.fba_api_key\n authorization = Base64.encode64(\"#{USER}:#{PASSWORD}\")\n order_status_path = OMS_PATH+\"/order_status/#{self.cart_no}\"\n @message = \"\"\n if fba_api_key.present? && smp.fba_signature.present?\n begin\n contact_person_email = smp.seller.contact_person_email.present? ? smp.seller.contact_person_email : nil\n resp = RestClient.post(order_status_path, {:api_key => fba_api_key, :tracking_number => self.fulflmnt_tracking_no, :version => \"2.0\", :signature=>smp.fba_signature.strip, :email=>contact_person_email.strip}, {:Authorization => authorization})\n resp = JSON.parse(resp)\n # update order status in SF according to FBA status\n if resp[\"response\"] == \"success\"\n if (resp[\"state\"] != self.fulflmnt_state) && (resp[\"state\"] != nil)\n self.update_attributes(:fulflmnt_state => resp[\"state\"])\n Spree::OmsLog.create!(:order_id => self.id, :oms_reference_number => resp[\"reference_id\"], :oms_api_responce => resp[\"response\"], :oms_api_message => resp[\"message\"])\n end\n end\n rescue Exception => e\n @message = e.message\n Spree::OmsLog.create!(:order_id => self.id, :server_error_log => e.message)\n end\n @message = \"Order status updated successfully!\" if @message.empty?\n else\n @message = \"Ooops, API key or signature not mapped\"\n end\n return @message\n end", "title": "" }, { "docid": "a6ecbcf9c6b629433e1a9dcd3af7a328", "score": "0.6186026", "text": "def order_status(status)\n \tstatus.name\n end", "title": "" }, { "docid": "282100fcf1722fcf5894752facfdc099", "score": "0.618393", "text": "def status\n end", "title": "" }, { "docid": "282100fcf1722fcf5894752facfdc099", "score": "0.618393", "text": "def status\n end", "title": "" }, { "docid": "282100fcf1722fcf5894752facfdc099", "score": "0.618393", "text": "def status\n end", "title": "" }, { "docid": "282100fcf1722fcf5894752facfdc099", "score": "0.618393", "text": "def status\n end", "title": "" }, { "docid": "282100fcf1722fcf5894752facfdc099", "score": "0.618393", "text": "def status\n end", "title": "" }, { "docid": "282100fcf1722fcf5894752facfdc099", "score": "0.618393", "text": "def status\n end", "title": "" }, { "docid": "178756a6dadecc102a90004f59648dc6", "score": "0.6180066", "text": "def get_advanced_status(order_id)\n send_request('GetAdvancedStatus', order_id: order_id)\n end", "title": "" }, { "docid": "fed32a5cc3ae2d6c4b148933b9a92f71", "score": "0.6172904", "text": "def api_work_orders\n @work_orders = WorkOrder.order(:order_no)\n render json: @work_orders\n end", "title": "" }, { "docid": "5bf8b7d3e95d2ea7a60f33b960a7ab2d", "score": "0.6172217", "text": "def status(id)\n end", "title": "" }, { "docid": "b41299050f24761d3ef6bcb14f9ad4f4", "score": "0.61551625", "text": "def get_status\n status = Order.where(\"client_name = '#{params[:id]}' or reference = '#{params[:id]}'\")\n render json: {status: 'SUCCESS', message:'Status', data:status},status: :ok\n end", "title": "" }, { "docid": "8bc582c233dbcae1c2c5644724f7bee2", "score": "0.615297", "text": "def set_orderstatus\r\n @orderstatus = Orderstatus.find(params[:id])\r\n end", "title": "" }, { "docid": "03761c9171536eeb6cb0430d91b972d7", "score": "0.61237204", "text": "def update_order\n @project = Project.find(params[:id])\n @status = Status.find(params[:status_id]);\n @status.order = params[:num]\n @status.save\n respond_to do |format|\n if @status.save\n #PrivatePub.publish_to \"/#{Rails.env}/projects/#{@project.id}/tasks/move\", :move => {:type => \"status\", :id => @task.id, :col => @status.id, :ocol=> @old_status_id }.to_json\n format.json { head :no_content }\n else\n format.js { render :js => \"alert('error')\" }\n format.json { head :no_content }\n end\n end\n end", "title": "" }, { "docid": "f69c824a79337024e87edabe92f748f1", "score": "0.6121146", "text": "def set_order_status\n self.order_status_id = 1 # in progress\n end", "title": "" }, { "docid": "6aff662a0e20db5e160c7afafef73faf", "score": "0.6120811", "text": "def status\n code = OrderStatusCode.find(:first, :conditions => [\"id = ?\", self.order_status_code_id])\n code.name\n end", "title": "" }, { "docid": "554c1a6dd6f0d1253e79bf95b42a6be8", "score": "0.61151636", "text": "def status\n end", "title": "" }, { "docid": "9483fcec13f522be52c7f993baf94f35", "score": "0.6110251", "text": "def check_order_status(printer_order)\n end", "title": "" }, { "docid": "2ffac3eabbe6679caf85043331f92cee", "score": "0.60870975", "text": "def p_ost_orderstatus_with_http_info(partner_billing_key, id, order_status_name, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: OrderstatusApi#p_ost_orderstatus ...\"\n end\n \n # verify the required parameter 'partner_billing_key' is set\n fail \"Missing the required parameter 'partner_billing_key' when calling p_ost_orderstatus\" if partner_billing_key.nil?\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling p_ost_orderstatus\" if id.nil?\n \n # verify the required parameter 'order_status_name' is set\n fail \"Missing the required parameter 'order_status_name' when calling p_ost_orderstatus\" if order_status_name.nil?\n \n # resource path\n local_var_path = \"/orderstatus/\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'partnerBillingKey'] = partner_billing_key\n query_params[:'id'] = id\n query_params[:'orderStatusName'] = order_status_name\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'OrderStatusUpdateResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: OrderstatusApi#p_ost_orderstatus\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "31b9285a9e15aa15a12be5e0e716abd4", "score": "0.60802895", "text": "def status_order(id)\n path = '/v1/orders/status'\n\n private_get(path, id: id)\n end", "title": "" }, { "docid": "de2a3c6d78d352660c28f5df5b96b0bd", "score": "0.607545", "text": "def find_order_status\n doc = Hpricot::XML(request.raw_post)\n trans_no = parse_xml(doc/:params/'trans_no')\n status = Sales::CurrentLocationLogic.find_order_status(trans_no)\n render :xml=>\"<workflow_location>#{status}</workflow_location>\"\n end", "title": "" }, { "docid": "c1216aa9b96a1107439dc14bc815b126", "score": "0.6054802", "text": "def status\n\t end", "title": "" }, { "docid": "ae3c11352bdb588f5cd98db97d3df9c9", "score": "0.60540926", "text": "def status; end", "title": "" }, { "docid": "ae3c11352bdb588f5cd98db97d3df9c9", "score": "0.60540926", "text": "def status; end", "title": "" }, { "docid": "ae3c11352bdb588f5cd98db97d3df9c9", "score": "0.60540926", "text": "def status; end", "title": "" }, { "docid": "ae3c11352bdb588f5cd98db97d3df9c9", "score": "0.60540926", "text": "def status; end", "title": "" }, { "docid": "ae3c11352bdb588f5cd98db97d3df9c9", "score": "0.60540926", "text": "def status; end", "title": "" }, { "docid": "ae3c11352bdb588f5cd98db97d3df9c9", "score": "0.60540926", "text": "def status; end", "title": "" }, { "docid": "ae3c11352bdb588f5cd98db97d3df9c9", "score": "0.60540926", "text": "def status; end", "title": "" }, { "docid": "ae3c11352bdb588f5cd98db97d3df9c9", "score": "0.60540926", "text": "def status; end", "title": "" }, { "docid": "ae3c11352bdb588f5cd98db97d3df9c9", "score": "0.60540926", "text": "def status; end", "title": "" }, { "docid": "ae3c11352bdb588f5cd98db97d3df9c9", "score": "0.60540926", "text": "def status; end", "title": "" }, { "docid": "ae3c11352bdb588f5cd98db97d3df9c9", "score": "0.60540926", "text": "def status; end", "title": "" }, { "docid": "ae3c11352bdb588f5cd98db97d3df9c9", "score": "0.60540926", "text": "def status; end", "title": "" }, { "docid": "ae3c11352bdb588f5cd98db97d3df9c9", "score": "0.60540926", "text": "def status; end", "title": "" }, { "docid": "ae3c11352bdb588f5cd98db97d3df9c9", "score": "0.60540926", "text": "def status; end", "title": "" }, { "docid": "ae3c11352bdb588f5cd98db97d3df9c9", "score": "0.60540926", "text": "def status; end", "title": "" }, { "docid": "ae3c11352bdb588f5cd98db97d3df9c9", "score": "0.60540926", "text": "def status; end", "title": "" }, { "docid": "ae3c11352bdb588f5cd98db97d3df9c9", "score": "0.60540926", "text": "def status; end", "title": "" }, { "docid": "ae3c11352bdb588f5cd98db97d3df9c9", "score": "0.60540926", "text": "def status; end", "title": "" }, { "docid": "ae3c11352bdb588f5cd98db97d3df9c9", "score": "0.60540926", "text": "def status; end", "title": "" }, { "docid": "ae3c11352bdb588f5cd98db97d3df9c9", "score": "0.60540926", "text": "def status; end", "title": "" }, { "docid": "ae3c11352bdb588f5cd98db97d3df9c9", "score": "0.60540926", "text": "def status; end", "title": "" }, { "docid": "ae3c11352bdb588f5cd98db97d3df9c9", "score": "0.60540926", "text": "def status; end", "title": "" }, { "docid": "ae3c11352bdb588f5cd98db97d3df9c9", "score": "0.60540926", "text": "def status; end", "title": "" }, { "docid": "ae3c11352bdb588f5cd98db97d3df9c9", "score": "0.60540926", "text": "def status; end", "title": "" }, { "docid": "ae3c11352bdb588f5cd98db97d3df9c9", "score": "0.60540926", "text": "def status; end", "title": "" }, { "docid": "ae3c11352bdb588f5cd98db97d3df9c9", "score": "0.60540926", "text": "def status; end", "title": "" }, { "docid": "ae3c11352bdb588f5cd98db97d3df9c9", "score": "0.6052382", "text": "def status; end", "title": "" }, { "docid": "7c1dccc68e2cdf1e4c5a875db309f4ef", "score": "0.6050446", "text": "def status(params={})\n params[:markets] ||= [ params.delete(:markets) || params.delete(:market) || @param_defaults[:market] ].flatten.compact\n options = @option_defaults.merge action: 'GetServiceStatus'\n doc = @connection.get \"/Orders/#{options[:version]}\", params, options\n doc.xpath('Status').first.text # return the status text\n end", "title": "" }, { "docid": "7c1dccc68e2cdf1e4c5a875db309f4ef", "score": "0.6050446", "text": "def status(params={})\n params[:markets] ||= [ params.delete(:markets) || params.delete(:market) || @param_defaults[:market] ].flatten.compact\n options = @option_defaults.merge action: 'GetServiceStatus'\n doc = @connection.get \"/Orders/#{options[:version]}\", params, options\n doc.xpath('Status').first.text # return the status text\n end", "title": "" }, { "docid": "7c1dccc68e2cdf1e4c5a875db309f4ef", "score": "0.60495055", "text": "def status(params={})\n params[:markets] ||= [ params.delete(:markets) || params.delete(:market) || @param_defaults[:market] ].flatten.compact\n options = @option_defaults.merge action: 'GetServiceStatus'\n doc = @connection.get \"/Orders/#{options[:version]}\", params, options\n doc.xpath('Status').first.text # return the status text\n end", "title": "" }, { "docid": "e961abda15392c4fc0cc5c8ad10f72c5", "score": "0.6046269", "text": "def status_active # could be changed to order_posted\n self.status == 'active' \n end", "title": "" }, { "docid": "4029d84fad510724054abf17e7e9a1b4", "score": "0.6025837", "text": "def update_status\n @order.change_status\n respond_to do |format|\n if @order.save\n format.html {redirect_to orders_path, notice: \"Status change for #{@order.name}'s order\"}\n format.json {render :index, status: :ok, location: @order}\n else\n format.html {redirect_to orders_path}\n format.json {render json: @order.errors, status: :unprocessable_entity}\n end\n end\n end", "title": "" }, { "docid": "e20e16784481e3e2c176dd87b00e56dc", "score": "0.6021827", "text": "def update_order_status\n order_id = params['order_id']\n payment_type = params['payment_type']\n discounted_price = params['discounted_price']\n discount_id = params['discount_id']\n payment_status = payment_type\n get_order = Order.where(\"id=#{order_id}\")\n get_order_detail = OrderDetail.where(\"order_id=#{order_id}\")\n get_order[0].status = payment_status\n get_order[0].order_status = (payment_status == 2 ) ? 0 : 1\n get_order[0].save!\n get_order_detail.each do |order_detail|\n order_detail.status = 1\n order_detail.save!\n end\n render :json=> true\n end", "title": "" }, { "docid": "410ec594a0e756db23335aa7a801204d", "score": "0.6010272", "text": "def status(*) end", "title": "" }, { "docid": "410ec594a0e756db23335aa7a801204d", "score": "0.6010272", "text": "def status(*) end", "title": "" }, { "docid": "1d37c81fdb9a11e23a6ceb8957041dcd", "score": "0.5977366", "text": "def set_order_status\n self.order_status_id = 1\n end", "title": "" }, { "docid": "1d37c81fdb9a11e23a6ceb8957041dcd", "score": "0.5977366", "text": "def set_order_status\n self.order_status_id = 1\n end", "title": "" }, { "docid": "faec9666f54f1644d95f4f120db72307", "score": "0.59747136", "text": "def index\n if current_user.is_a? User \n if current_user.is_performer? \n @workitems = Workitem.where(id: Status.wi_published.map {|x| x.statusable_id} ).order(updated_at: :desc)\n else\n @workitems = Workitem.all.order(updated_at: :desc)\n end\n end\n end", "title": "" }, { "docid": "07d80f403234d20626a6145620ad2f03", "score": "0.5968073", "text": "def confirm_order_status_received(protocol)\n @@webservice = \"AbacosWSPedidos\"\n confirm_service \"status_pedido\", protocol\n end", "title": "" }, { "docid": "07d80f403234d20626a6145620ad2f03", "score": "0.5968073", "text": "def confirm_order_status_received(protocol)\n @@webservice = \"AbacosWSPedidos\"\n confirm_service \"status_pedido\", protocol\n end", "title": "" }, { "docid": "d7e0b022887e3afb22ff8e9e65bfa82a", "score": "0.59619576", "text": "def order_status\n # Default order status\n current_status = 'creating'\n\n current_status = 'in progress' unless orders.any? { |o| o.order_status == 'creating' }\n current_status = 'failed' if orders.all? { |o| o.order_status == 'failed' }\n current_status = 'complete' if orders.all? { |o| %w(closed complete complete_with_errors).include?(o.order_status) }\n\n current_status\n end", "title": "" }, { "docid": "a8116ea1fd33736c7ac52a6597bce8de", "score": "0.594788", "text": "def update\n if params[:order][:status] == 1\n if @order.update(order_params)\n create_task(@order) if check_ask_status_in_order(@order)\n build do\n message 'Редактирование заказа'\n view 'producer/orders/show'\n end\n else\n render json: @order.errors, status: :unprocessable_entity\n end\n end\n end", "title": "" }, { "docid": "111ebc8abb0e0b9599ebad25d0ec231f", "score": "0.594781", "text": "def status\n end", "title": "" }, { "docid": "111ebc8abb0e0b9599ebad25d0ec231f", "score": "0.594781", "text": "def status\n end", "title": "" }, { "docid": "b9767f60203f0d372d54afbfaa55089b", "score": "0.59392273", "text": "def update_status\n if self.status.nil?\n self.status = \"Ordered\"\n end\n end", "title": "" }, { "docid": "0e7e24b26d96ab72bd73003dc8e0918a", "score": "0.5918617", "text": "def worker_status \n job_id = params[:job_id]\n puts \"JOBID #{job_id} \\\\JOBID\"\n status = Sidekiq::Status::get_all job_id\n puts \"STATUS #{status} \\\\STATUS\"\n render json: status\n end", "title": "" }, { "docid": "198c0fa7f07ef55e950ad5ca968c0711", "score": "0.5914988", "text": "def set_order_by_number action, number\n pospal_appid=ENV['POSPAL_APPID']\n pospal_appkey=ENV['POSPAL_APPKEY']\n request_body = {\n 'appId'=> pospal_appid,\n #'orderNo'=> '19032703082989286104'\n 'orderNo'=> number+'104'\n }\n\n #if action=:ship\n uri = URI('https://area24-win.pospal.cn:443/pospal-api2/openapi/v1/orderOpenApi/shipOrder') if action==:ship\n uri = URI('https://area24-win.pospal.cn:443/pospal-api2/openapi/v1/orderOpenApi/completeOrder') if action==:complete\n\n res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|\n req = Net::HTTP::Post.new(uri)\n req['User-Agent']= 'openApi'\n req['Content-Type']= 'application/json; charset=utf-8'\n req['accept-encoding']= 'gzip,deflate'\n req['time-stamp']= Time.now.getutc\n req['data-signature']= Digest::MD5.hexdigest(pospal_appkey + request_body.to_json)\n req.body = request_body.to_json\n http.request(req)\n end\n ap JSON.parse(res.body)\nend", "title": "" }, { "docid": "2ce2485c6d54408f88a24f9508c5f5ef", "score": "0.5914356", "text": "def index\n @orders = Order.all\n\n @orders.each do |order|\n order.define_status\n order.save!\n end\n end", "title": "" }, { "docid": "7c8dae45ff799cd74d783fd6c3a5511e", "score": "0.59100956", "text": "def drip_status(order)\n if order.shipped?\n 'fulfilled'\n elsif order.paid?\n 'paid'\n else\n 'updated'\n end\nend", "title": "" }, { "docid": "c15a772e3adcb6a6ce7fdfd421be1e08", "score": "0.59010816", "text": "def status\n call_action(:status)\n end", "title": "" }, { "docid": "d8f30229b23b1401b6879a43f1388444", "score": "0.5900617", "text": "def delivery_status_part; end", "title": "" }, { "docid": "2a1f30ea1e35285647da9624f4f34953", "score": "0.5888099", "text": "def set_workstatus\n @workstatus = Workstatus.find(params[:id])\n end", "title": "" }, { "docid": "cada996d25b079be29fc782fe8087e9b", "score": "0.5878905", "text": "def open_orders\n private_request 'open_orders'\n end", "title": "" }, { "docid": "0a6e1824b3e66613c9cc535dd09466a8", "score": "0.5877971", "text": "def get_new_order_status\n @order = Spree::Order.find_by_number(params[:order])\n @market_place = @order.market_place if @order.market_place.present?\n @seller = @order.seller\n smp = Spree::SellerMarketPlace.where(\"seller_id=? and market_place_id=? and is_active=?\", @seller.id, @market_place.id, true).try(:first)\n if smp.present?\n @order.get_order_status(smp)\n oms_log = @order.oms_log\n end\n redirect_to admin_order_url(@order), :notice => \"Your Order #{@order.number} into #{@order.fulflmnt_state} state\"\n end", "title": "" }, { "docid": "6eb26d5dcec03aec389ee3ba06014cc7", "score": "0.58743775", "text": "def ordered_order_status\n orders = Order.get_order_status(params)\n render_partial_pagination(\"order_status\", orders, params[:page], :orders)\n end", "title": "" }, { "docid": "b2b0dd2e140b1e487dac9f26881154b2", "score": "0.5866851", "text": "def find_order_status(id)\n orders = Order.find(id)\n item_orders = ItemOrder.where(order_id: id)\n\n if item_orders.all? {|order| order.status == \"fulfilled\"}\n \"packaged\"\n # orders.save\n else\n \"pending\"\n end\n end", "title": "" }, { "docid": "c6e7bc8cdb26ebd4e66cbb2f8bc1e431", "score": "0.58589965", "text": "def set_up_order_statuses\n # Generate built-in order statuses for billing\n unless order_statuses.where(:type => :billing, :name => \"Browsing\").count > 0\n order_statuses.create(:type => :billing, :name => \"Browsing\", :sort_order => 0,:description => \"Customer has added items to his or her cart, but hasn't gone to checkout yet\")\n end\n unless order_statuses.where(:type => :billing, :name => \"Started Checkout\").count > 0\n order_statuses.create(:type => :billing, :name => \"Started Checkout\", :sort_order => 1, :description => \"Customer has taken this order to checkout\")\n end\n unless order_statuses.where(:type => :billing, :name => \"Payment in process\").count > 0\n order_statuses.create(:type => :billing, :name => \"Payment in process\", :sort_order => 2, :description => \"Customer has clicked Pay Now, and the order is currently with the payment processor\")\n end\n unless order_statuses.where(:type => :billing, :name => \"Payment Received\").count > 0\n order_statuses.create(:type => :billing, :name => \"Payment Received\", :sort_order => 3, :description => \"Order has been paid in full\")\n end\n unless order_statuses.where(:type => :billing, :name => \"Partial Payment Received\").count > 0\n order_statuses.create(:type => :billing, :name => \"Partial Payment Received\", :sort_order => 4, :description => \"Some payment has been received, but not full\")\n end\n unless order_statuses.where(:type => :billing, :name => \"Cancelled by Customer\").count > 0\n order_statuses.create(:type => :billing, :name => \"Cancelled by Customer\", :sort_order => 5, :description => \"Customer cancelled order\")\n end\n unless order_statuses.where(:type => :billing, :name => \"Cancelled by Merchant\").count > 0\n order_statuses.create(:type => :billing, :name => \"Cancelled by Merchant\", :sort_order => 6, :description => \"Merchant cancelled order\")\n end\n unless order_statuses.where(:type => :billing, :name => \"Disputed\").count > 0\n order_statuses.create(:type => :billing, :name => \"Disputed\", :sort_order => 7, :description => \"Something's gone wrong\")\n end\n\n # Generate built-in order statuses for billing\n unless order_statuses.where(:type => :shipping, :name => \"Not Shipped Yet\").count > 0\n order_statuses.create(:type => :shipping, :name => \"Not Shipped Yet\", :sort_order => 0, :description => \"Newly-created order\")\n end\n unless order_statuses.where(:type => :shipping, :name => \"Processing\").count > 0\n order_statuses.create(:type => :shipping, :name => \"Processing\", :sort_order => 1, :description => \"Getting ready to ship\")\n end\n unless order_statuses.where(:type => :shipping, :name => \"Shipped\").count > 0\n order_statuses.create(:type => :shipping, :name => \"Shipped\", :sort_order => 2, :description => \"Order has been shipped\")\n end\n unless order_statuses.where(:type => :shipping, :name => \"Will Not Ship\").count > 0\n order_statuses.create(:type => :shipping, :name => \"Will Not Ship\", :sort_order => 3, :description => \"Shipping has been cancelled\")\n end\n\n end", "title": "" }, { "docid": "897c18f7c42436ddb63ac65b275d59bb", "score": "0.5817814", "text": "def create\n @workorder = Workorder.new(params[:workorder])\n @workorder.updated_id = current_user.id\n @workorder.created_id = current_user.id\n @workorder.workflow_state = \"request\"\n # requested by\n @workorder.assigned_by_id = current_user.id \n\n respond_to do |format|\n if @workorder.save\n format.html { redirect_to( root_path, :notice => 'Workorder was successfully created.') }\n format.xml { render :xml => @workorder, :status => :created, :location => @workorder }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @workorder.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fa3a3c6e1cdb8fe2afcee6bd9880750a", "score": "0.58129466", "text": "def initial_order_status\n if order_status == nil\n self.order_status = \"pending\"\n end\n end", "title": "" }, { "docid": "2fc7529c07728714c3f523c62a349523", "score": "0.57993793", "text": "def status\n @order.notification_status = params[\"MessageStatus\"]\n @order.save\n render nothing: true\n end", "title": "" }, { "docid": "6bd487cccf7cd73e8ce848fff744fdbc", "score": "0.57889235", "text": "def query_status(params, path_url = 'payment_requests', class_type = 'STK')\n super\n end", "title": "" }, { "docid": "b1b4cfdfc32ae1a0d48f4dad6b90403f", "score": "0.5786913", "text": "def get_job_status id\n end", "title": "" }, { "docid": "bef14548c73b27c5c69cbd046615aae6", "score": "0.5784678", "text": "def simple_status\n I18n.t \"order.status.#{status}\"\n end", "title": "" }, { "docid": "ee81177e4c35b0b697e396b8a5004bb5", "score": "0.5782654", "text": "def my_status\n get('my/status')\n end", "title": "" }, { "docid": "b54b8de85b57d71cb931a4c0a894d58a", "score": "0.5775238", "text": "def index\n # new or in process\n @order_details = session_user.order_details.item_and_service_orders\n @available_statuses = %w(pending all)\n case params[:status]\n when \"pending\"\n @order_details = @order_details.new_or_inprocess\n when \"all\"\n @order_details = @order_details.purchased\n else\n redirect_to orders_status_path(status: \"pending\")\n return\n end\n @order_details = @order_details. order(\"order_details.created_at DESC\").paginate(page: params[:page])\n end", "title": "" }, { "docid": "585aab72b5731db6ef7bb5a962362133", "score": "0.57720405", "text": "def ot_connection_inspection\n @contracting_request = ContractingRequest.find(params[:id])\n # current_user_id = current_user.id if !current_user.nil?\n\n @work_order = WorkOrder.new( order_no: wo_next_no(@contracting_request.project),\n work_order_type_id: 25,\n work_order_status_id: 1, #WorkOderStatus\n work_order_labor_id: 132,\n work_order_area_id: 4, # TCA\n project_id: @contracting_request.project_id,\n client_id: @contracting_request.client.id, # ¿¿??\n description: \"#{t('activerecord.attributes.contracting_request.number_request')} \" + @contracting_request.request_no,\n organization_id: @contracting_request.project.organization_id,\n charge_account_id: @contracting_request.project.try(:charge_accounts).try(:first).try(:id),\n in_charge_id: 1\n # started_at:, completed_at:, closed_at:, charge_account_id: 1,area_id:, store_id:, created_by: current_user_id, updated_by: current_user_id, remarks:,petitioner:, master_order_id:, reported_at:, approved_at:, certified_at:, posted_at:, location:, pub_record:,\n )\n if @work_order.save(:validate => false)\n @contracting_request.work_order = @work_order\n @contracting_request.status_control\n if @contracting_request.save\n response_hash = { contracting_request: @contracting_request }\n response_hash[:work_order] = @work_order\n response_hash[:work_order_status] = @work_order.work_order_status\n respond_to do |format|\n format.json { render json: response_hash }\n end\n else\n respond_to do |format|\n format.json { render :json => { :errors => @contracting_request.errors.as_json }, :status => 420 }\n end\n end\n else\n respond_to do |format|\n format.json { render :json => { :errors => @work_order.errors.as_json }, :status => 420 }\n end\n end\n end", "title": "" }, { "docid": "a8674a32eb34624cc64e8e03f6392113", "score": "0.5764559", "text": "def update\n if params[:order_id].present?\n @v1_order = V1::Order.find(params[:order_id])\n else\n @v1_status_transition = V1::StatusTransition.find(params[:id])\n @v1_order = @v1_status_transition.order\n end\n case params[:v1_status_transition][:event]\n when \"place\"\n @v1_order.place\n render json: {message: \"Order placed\"}, status: 200\n when \"pay\"\n @v1_order.pay\n render json: {message: \"Order payed\"}, status: 200\n when \"cancel\"\n @v1_order.cancel\n render json: {message: \"Order Canceled\"}, status: 200\n end\n end", "title": "" }, { "docid": "317ccc993f73e3dbc464236e8bd78c34", "score": "0.57636005", "text": "def alter_status(params = {})\n req = WebPay::ShopRequestAlterStatus.create(params)\n raw_response = @client._request(:post, 'shops' + '/' + req.id.to_s + '/' + 'alter_status', req)\n WebPay::ShopResponse.new(raw_response)\n end", "title": "" }, { "docid": "c89d5a92c6bb0ca2f7f6c27077a2c9a0", "score": "0.57520485", "text": "def update\n @order = Order.find(params[:id]) \n if (@order.status == :PENDING)\n @order.status = :FINISHED \n @order.save \n render :json => @order.as_json(:only => [:id])\n end \n end", "title": "" }, { "docid": "925b1a297097f5b5c9573d5473d93073", "score": "0.5746983", "text": "def set_order_status\n @order_status = OrderStatus.find(params[:id])\n end", "title": "" } ]
680ef7697e636ccc75a288ada306dbfa
POST /models POST /models.json
[ { "docid": "1b11698776381fd5dd29096f80d2454f", "score": "0.0", "text": "def create\n @answer = Answer.new(answer_params)\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to model_customer_path(@model, @customer), notice: 'Model was successfully created.' }\n format.json { render :show, status: :created, location: @model }\n else\n format.html { render :new }\n format.json { render json: @model.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "a759ad6cc10168d036cc34fbc49b10f4", "score": "0.64328593", "text": "def create\n @model = @project.models.new(model_params)\n\n respond_to do |format|\n if @model.save\n format.html { redirect_to @model, notice: 'The model was successfully created.' }\n format.json { render :show, status: :created, location: @model }\n else\n format.html { render :new }\n format.json { render json: @model.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "37b368faf5d63ea61ae93380405277b6", "score": "0.62179", "text": "def create\n @model = Model.new(params[:model])\n\n respond_to do |format|\n if @model.save\n format.html { redirect_to @model, notice: 'Model was successfully created.' }\n format.json { render json: @model, status: :created, location: @model }\n else\n format.html { render action: \"new\" }\n format.json { render json: @model.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "37b368faf5d63ea61ae93380405277b6", "score": "0.62179", "text": "def create\n @model = Model.new(params[:model])\n\n respond_to do |format|\n if @model.save\n format.html { redirect_to @model, notice: 'Model was successfully created.' }\n format.json { render json: @model, status: :created, location: @model }\n else\n format.html { render action: \"new\" }\n format.json { render json: @model.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6b6a452a3f0fdd104a93d9630008e8cc", "score": "0.6099504", "text": "def create\n @model = Model.new(model_params)\n\n respond_to do |format|\n if @model.save\n format.html { redirect_to @model, notice: \"Model was successfully created.\" }\n format.json { render :show, status: :created, location: @model }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @model.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "18e4816cde96e328e2349a926f48e3dc", "score": "0.59998065", "text": "def model_params\n params.require(:model).permit(:id, :name, :dataset, :snippet, :image, :description, :accuracy, :algorithm, :organization, :size, :api_key, :endpoint,\n inputs_attributes: [:id, :name, :kind, :order, :_destroy],\n outputs_attributes: [:id, :name, :kind, :order, :default_value, :_destroy])\n end", "title": "" }, { "docid": "6d336d8a8dfa8a99e806c15019c89052", "score": "0.5972606", "text": "def create\n @foo_model = FooModel.new(params[:foo_model])\n\n respond_to do |format|\n if @foo_model.save\n format.html { redirect_to @foo_model, notice: 'Foo model was successfully created.' }\n format.json { render json: @foo_model, status: :created, location: @foo_model }\n else\n format.html { render action: \"new\" }\n format.json { render json: @foo_model.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "80cc17dd01f609835c25ebb0eecd6d7d", "score": "0.5967409", "text": "def create\n @model = Model.new(model_params)\n\n respond_to do |format|\n if @model.save\n format.html { redirect_to @model, notice: 'Model was successfully created.' }\n format.json { render action: 'show', status: :created, location: @model }\n else\n format.html { render action: 'new' }\n format.json { render json: @model.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "26b11b4d3ff4d445bb01502463b7e13b", "score": "0.59200007", "text": "def create\n model = params[:model]\n #NOTE: Pay attention how the data is passed as a hash. This is how locomotive expects it. Not obvious.\n # req.set_form_data('content_entry[name]' => data['name'], 'content_entry[summary]' => data['summary'], 'model' => model)\n form_data = {}\n params[:content_entry].each do |key,val|\n form_data[\"content_entry[#{key}]\"] = val\n end\n #data = params[:content_entry]\n\n uri = URI(\"#{@cms_url}/locomotive/api/content_types/#{model}/entries.json?auth_token=#{APP_CONFIG['locomotive']['auth_token']}\")\n\n req = Net::HTTP::Post.new(uri)\n req.set_form_data(form_data)\n res = Net::HTTP.start(uri.hostname, uri.port) do |http|\n http.request(req)\n end\n case res\n when Net::HTTPSuccess, Net::HTTPRedirection\n render :json => res.body\n else\n # examine response code and generate appropriate error message\n render :json => res.value\n end\n\n end", "title": "" }, { "docid": "6b74e34667fe28cdd1375761127b9c0a", "score": "0.5903291", "text": "def add_bridge_model(body={}, headers=default_headers)\n @logger.info(\"Adding the \\\"#{body['name']}\\\" Bridge Model and Mappings.\")\n post(\"#{@api_url}/models\", body, headers)\n end", "title": "" }, { "docid": "34aca06ddcbbc9323b05573d73bc9b35", "score": "0.5849688", "text": "def train\n training = @prediction.trainedmodels.insert.request_schema.new\n training.id = 'emotion_prediction_id'\n training.storage_data_location = DATA_OBJECT\n result = @client.execute(\n :api_method => @prediction.trainedmodels.insert,\n :headers => {'Content-Type' => 'application/json'},\n :body_object => training\n )\n\n assemble_json_body(result)\n end", "title": "" }, { "docid": "5e1135ddcaa5b9eb2fc2c75519b12830", "score": "0.5846849", "text": "def create\n @model = Model.new(model_params)\n\n respond_to do |format|\n if @model.save\n format.html { redirect_to [:admin, @model], notice: 'Model was successfully created.' }\n format.json { render json: @model, status: :created, location: @model }\n else\n format.html { render action: \"new\" }\n format.json { render json: @model.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5106e3f982dd43b0ee12b7803db0e0bc", "score": "0.5842807", "text": "def create\n @user = current_user\n @model = Model.new(params[:model])\n respond_to do |format|\n if @model.save\n format.html { redirect_to user_model_path(@user, @model), notice: 'model was successfully created.' }\n format.json { render json: @model, status: :created, location: @model }\n else\n format.html { render action: \"new\" }\n format.json { render json: @model.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1a7018e08d570257cf3ee6856b4b7ea0", "score": "0.57999283", "text": "def create\n @auto_model = AutoModel.new(auto_model_params)\n\n respond_to do |format|\n if @auto_model.save\n format.html { redirect_to @auto_model, notice: 'Auto model was successfully created.' }\n format.json { render action: 'show', status: :created, location: @auto_model }\n else\n format.html { render action: 'new' }\n format.json { render json: @auto_model.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0d45aed0525ff65c697aaa46772cb85c", "score": "0.5771048", "text": "def create\n @model = ClientService.new(model_params)\n\n respond_to do |format|\n if @model.save\n format.json { render :show, status: :created, location: @model }\n else\n format.json { render json: @model.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c05c1eb11a0359dad3af8bee85a275c6", "score": "0.57503515", "text": "def create\n @my_model = MyModel.new(params[:my_model])\n \n respond_to do |format|\n if @my_model.save\n format.html { redirect_to @my_model, notice: 'My model was successfully created.' }\n format.json { render json: @my_model, status: :created, location: @my_model }\n else\n format.html { render action: \"new\" }\n format.json { render json: @my_model.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "95f4605618d5f3f150a522e9bb1e8b37", "score": "0.5728697", "text": "def model\r\n\t\t\t@model ||= json['model']\r\n\t\tend", "title": "" }, { "docid": "b1948dc1499676efff13456dc82d04ce", "score": "0.5709755", "text": "def create\n @model_type = ModelType.new(model_type_params)\n @model = Model.friendly.find(params[:model_id])\n respond_to do |format|\n if @model_type.save\n format.html { render :new }\n format.json { render :show, status: :created, location: @model_type }\n else\n format.html { render :new }\n format.json { render json: @model_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1696d5d4d22767f1a79db670670b4d3b", "score": "0.5690869", "text": "def create\n render json: Post.create(params[\"post\"])\n end", "title": "" }, { "docid": "7cfeb3929ee7b509d4ca4146598511d8", "score": "0.5682279", "text": "def create\n\n\t\t\t\t\t# attributes\n\t\t\t\t\tbegin\n\t\t\t\t\t\tattrs = jsonapi_received_attributes\n\t\t\t\t\t\tif attrs\n\t\t\t\t\t\t\tif @jsonapi_record\n\t\t\t\t\t\t\t\t# update\n\t\t\t\t\t\t\t\t@jsonapi_record.update! attrs\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t# create\n\t\t\t\t\t\t\t\t@jsonapi_record = jsonapi_model_class.new attrs\n\t\t\t\t\t\t\t\t@jsonapi_record.save!\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\trescue NameError => e\n\t\t\t\t\t\tjsonapi_render_errors 500, \"Model class not found.\"\n\t\t\t\t\t\treturn\n\t\t\t\t\trescue \n\t\t\t\t\t\tjsonapi_render_errors 500, @jsonapi_record.to_jsonapi_errors_hash\n\t\t\t\t\t\treturn\n\t\t\t\t\tend\n\n\t\t\t\t\t# relationships\n\t\t\t\t\tjsonapi_received_relationships.each do |relationship|\n\t\t\t\t\t\tbegin\n\t\t\t\t\t\t\t\t# to-one\n\t\t\t\t\t\t\t\tif relationship[:definition][:type] == :to_one\n\t\t\t\t\t\t\t\t\t@jsonapi_record.send :\"#{relationship[:definition][:name]}=\", relationship[:params][:data]\n\t\t\t\t\t\t\t\t\tnext\n\t\t\t\t\t\t\t\tend\n\n\t\t\t\t\t\t\t\t# to-many\n\t\t\t\t\t\t\t\t@jsonapi_record.send(relationship[:definition][:name]).send :clear # initialize the relation\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\trelationship[:params][:data].each do |item|\n\t\t\t\t\t\t\t\t\tobject = relationship[:receiver][:class].find_by_id item[:id]\n\t\t\t\t\t\t\t\t\t@jsonapi_record.send(relationship[:definition][:name]).send :<<, object\n\t\t\t\t\t\t\t\tend\n\n\t\t\t\t\t\trescue \n\t\t\t\t\t\t\t# Should not happen\n\t\t\t\t\t\t\tjsonapi_render_errors 500, \"Relationship could not be created.\"\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\n\t\t\t\t\tshow\n\t\t\t\tend", "title": "" }, { "docid": "4d7d33ea5cbcf75e833e1fef6f96db7a", "score": "0.5638503", "text": "def create\n @my_model = MyModel.new(my_model_params)\n\n respond_to do |format|\n if @my_model.save\n format.html { redirect_to @my_model, notice: 'My model was successfully created.' }\n format.json { render :show, status: :created, location: @my_model }\n else\n format.html { render :new }\n format.json { render json: @my_model.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "09fb6b823b8042081f640eebe51cd383", "score": "0.5625969", "text": "def controller_params\n params.require(:controller).permit(:Models)\n end", "title": "" }, { "docid": "469ef6a43e45804466746e472af6349c", "score": "0.55846554", "text": "def save_model_with(json)\n return nil if json.is_a?(Array)\n\n model = build_model_with(json)\n model.try :save\n model\n end", "title": "" }, { "docid": "3abeaf663f908889ac32c0b23e806c2e", "score": "0.55819434", "text": "def create\n @model = Model.new(model_params)\n authorize! :create, @model\n\n respond_to do |format|\n if @model.save\n format.html { redirect_to @model, notice: 'Model was successfully created.' }\n format.json { render :show, status: :created, location: @model }\n else\n format.html { render :new }\n format.json { render json: @model.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3d53d4ff42c634534fc159712f300a45", "score": "0.5571751", "text": "def create\n @model = Model.new(params[:model])\n\n respond_to do |format|\n if @model.save\n format.html { redirect_to(models_path, :notice => t(:model_created)) }\n format.xml { render :xml => @model, :status => :created, :location => @model }\n else\n @title = t :new_model_title\n format.html { render :action => \"new\" }\n format.xml { render :xml => @model.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a4fccd3ab7f2fa75c496339e8a9ea7f5", "score": "0.55671537", "text": "def json_create(resource_params, resource_model)\n resource_obj = resource_model.new(resource_params)\n if resource_obj.save\n return render json: resource_obj, status: :ok\n else\n return render json: resource_obj.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "62bf3f8f31de6215918ef765a622e5e0", "score": "0.55214447", "text": "def model_params\n params.require(:model).permit(:name, :description, :vendor_id)\n end", "title": "" }, { "docid": "f119237cebb17ae1806052ad553229d0", "score": "0.5511617", "text": "def create\n params[:operation][\"inputs\"] = filter_distribution_ids(params[:operation][\"inputs\"])\n @operation = Operation.new(params[:operation])\n @model = Model.find(params[:model_id])\n respond_to do |format|\n if @operation.save\n if @model\n @operation.dependent.models << @model\n format.html { redirect_to user_model_path(@model.user, @model), notice: 'Operation was successfully created.' }\n else\n format.html { redirect_to root_path, notice: 'Operation was successfully created.' }\n end \n else\n format.html { render action: \"new\" }\n format.json { render json: @operation.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b898c2fa65abd666971b2f50a2edd2c2", "score": "0.55071044", "text": "def create\n render json: Company.create(params[\"company\"])\n end", "title": "" }, { "docid": "c79caf0d13e027f49699b894864fb039", "score": "0.5497302", "text": "def create\n @device_model = DeviceModel.new(device_model_params)\n\n respond_to do |format|\n if @device_model.save\n format.html { redirect_to @device_model, notice: 'Device model was successfully created.' }\n format.json { render :show, status: :created, location: @device_model }\n else\n format.html { render :new }\n format.json { render json: @device_model.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d87dc764e3307fbb2d90e3372d139cfb", "score": "0.548886", "text": "def create\n @model = Model.new(params[:model])\n\n respond_to do |format|\n if @model.save\n format.html { redirect_to(admin_models_path, :notice => 'Model was successfully created.') }\n format.xml { render :xml => @model, :status => :created, :location => @model }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @model.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5114066cb36f2eaec091d0d70c62fbf1", "score": "0.5484119", "text": "def create\n \n respond_to do |format| \t \t\n\t \tbegin\t \t\t \t\n\t \t\tmodel = JSON.parse( params[:model] )\n\t \t \n\t \trescue\t \t\n\t \t format.html { render action: \"new\" }\n\t format.json { render json: @record.errors, status: :unprocessable_entity }\n\t \t\n\t \telse\n\t \t\t#@record = Record.where( :email => model[\"email\"] ).first\t \t\t\n\t \t\t\n\t \t\tmodel.delete('authenticity_token')\n\t \t\t\n\t \t\t if @record.nil?\n\t\t \t\t @record = Record.new(model)\n\t\t \t\t @record.save\n\t\t else\n\t\t \tif @record.score < model[\"score\"] || ( @record.score == model[\"score\"] && @record.time > model[\"time\"] )\n\t\t \t\t@record.update_attributes(model)\t\t \t\n\t\t \tend\n\t\t end\n\t\t \n\t\t\tformat.html { redirect_to @record, notice: 'Record was successfully created.' }\n\t\t\tformat.json { render json: @record, status: :created, location: @record }\n\t \t\n\t \tend \n end\n end", "title": "" }, { "docid": "57ddedb0208e0a11189e9fa757a92918", "score": "0.5481438", "text": "def model_params\n params.require(:model).permit(:code, :name, :brand_id, :manufacture_id, :body_type_id, :note)\n end", "title": "" }, { "docid": "8c29ca2b66ab735cecb98e25d6bbd056", "score": "0.5470874", "text": "def create \n if handle_data\n @model = Model.new(params[:model])\n @model.content_blob = ContentBlob.new(:tmp_io_object => @tmp_io_object,:url=>@data_url)\n\n @model.policy.set_attributes_with_sharing params[:sharing], @model.projects\n\n update_annotations @model\n experiment_ids = params[:experiment_ids] || []\n respond_to do |format|\n if @model.save\n # update attributions\n Relationship.create_or_update_attributions(@model, params[:attributions])\n \n # update related publications\n Relationship.create_or_update_attributions(@model, params[:related_publication_ids].collect {|i| [\"Publication\", i.split(\",\").first]}, Relationship::RELATED_TO_PUBLICATION) unless params[:related_publication_ids].nil?\n \n #Add creators\n AssetsCreator.add_or_update_creator_list(@model, params[:creators])\n \n flash[:notice] = 'Model was successfully uploaded and saved.'\n format.html { redirect_to model_path(@model) }\n Experiment.find(experiment_ids).each do |experiment|\n if experiment.can_edit?\n experiment.relate(@model)\n end\n end\n deliver_request_publish_approval params[:sharing], @model\n else\n format.html {\n render :action => \"new\"\n }\n end\n end\n end\n \n end", "title": "" }, { "docid": "59b0962beb045fb52674430173d33cd6", "score": "0.5429453", "text": "def create\n @hello_model = HelloModel.new(hello_model_params)\n\n respond_to do |format|\n if @hello_model.save\n format.html { redirect_to @hello_model, notice: 'Hello model was successfully created.' }\n format.json { render :show, status: :created, location: @hello_model }\n else\n format.html { render :new }\n format.json { render json: @hello_model.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5a8d919f2b8aa3b58cdd94ea1f910e03", "score": "0.5428111", "text": "def create\n @trainmodel = Trainmodel.new(trainmodel_params)\n\n respond_to do |format|\n if @trainmodel.save\n format.html { redirect_to @trainmodel, notice: 'Trainmodel was successfully created.' }\n format.json { render :show, status: :created, location: @trainmodel }\n else\n format.html { render :new }\n format.json { render json: @trainmodel.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "35240d73c6b0a85041d8732dba05f47b", "score": "0.54111534", "text": "def updateModels(json)\n if json.is_a?(Array)\n models = []\n for jsonPart in json\n model = buildModel(jsonPart)\n if model.present?\n model.save\n models << model\n end\n end\n return models\n else\n model = buildModel(json)\n if model.present?\n model.save\n return model\n end\n end\n end", "title": "" }, { "docid": "66dd806d4f2a75e3d3c23c39bce72a90", "score": "0.5400263", "text": "def save\n @model = register_model\n end", "title": "" }, { "docid": "fc9d78416627f8d4dd5c773a6a5b6e33", "score": "0.53861046", "text": "def serialize_model(model, options = {})\n options[:is_collection] = false\n options[:skip_collection_check] = true\n JSONAPI::Serializer.serialize(model, options)\n end", "title": "" }, { "docid": "bdb8f1dd587be301cc880b5d4a11e547", "score": "0.5382099", "text": "def model(options={})\n get_location\n # TODO: validate options\n @params[:model] = FEATURE_DEFAULTS[:model].merge(options)\n @params[:model][:generate] = true\n end", "title": "" }, { "docid": "68e957a9caca96002ccfdb86f8459e83", "score": "0.53741294", "text": "def model_params\n params.require(:model).permit(:brand_id, :creator_id, :name)\n end", "title": "" }, { "docid": "719e876e148a862b570e839c5725b7a8", "score": "0.53736633", "text": "def create\n @test = Test.create!(test_params)\n\n render json: @test\n end", "title": "" }, { "docid": "495ea2bd61ca233b72eb61397deb8d3b", "score": "0.5371085", "text": "def create\n @model_name = ModelName.new(model_name_params)\n\n respond_to do |format|\n if @model_name.save\n format.html { redirect_to @model_name, notice: 'Model name was successfully created.' }\n format.json { render :show, status: :created, location: @model_name }\n else\n format.html { render :new }\n format.json { render json: @model_name.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5a7b884bfcad445f087aeaf921a91835", "score": "0.53694487", "text": "def create\n @vehicle = Vehicle.new(vehicle_params)\n if @vehicle.save\n render json: { status: 'Vehicle created successfully', vehicle: @vehicle }, status: :created\n else\n render json: { errors: @vehicle.errors.full_messages }, status: :bad_request\n end\n end", "title": "" }, { "docid": "3a0bc1f2032117d6cc6f061cabc7c9d4", "score": "0.5367006", "text": "def moip_post\n @nasp_rail = NaspRail.new(params[:nasp_rail])\n\n format.html { redirect_to @nasp_rail, :notice => 'Nova entrada criada com sucesso.' }\n format.json { render :json => @nasp_rail, :status => :created, :location => @nasp_rail }\n end", "title": "" }, { "docid": "e404b10f10d6b58d50c4e51fb30d623e", "score": "0.5366817", "text": "def serialize_model(model, options = {})\n options[:is_collection] = false\n JSONAPI::Serializer.serialize(model, options)\n end", "title": "" }, { "docid": "0fab758b6304f29d1d4501a658f9e7b2", "score": "0.5354569", "text": "def create\n @vehicle_model = @vehicle_brand.vehicle_models.build(vehicle_model_params)\n\n respond_to do |format|\n if @vehicle_model.save\n format.html { redirect_to @vehicle_brand, notice: 'Vehicle model was successfully created.' }\n format.json { render action: 'show', status: :created, location: @vehicle_model }\n else\n format.html { render action: 'new' }\n format.json { render json: @vehicle_model.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bb2a10f157e7cb181ba329a8269b5616", "score": "0.53519577", "text": "def test_send_model_array()\n # Parameters for the API call\n models = APIHelper.json_deserialize(\n '[{\"name\":\"Shahid Khaliq\",\"age\":5147483645,\"address\":\"H # 531, S # 20\",\"'\\\n 'uid\":\"123321\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T14:01:54.'\\\n '9571247Z\",\"salary\":20000,\"department\":\"Software Development\",\"joiningDa'\\\n 'y\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesday\",\"Friday\"],\"boss\":{\"pers'\\\n 'onType\":\"Boss\",\"name\":\"Zeeshan Ejaz\",\"age\":5147483645,\"address\":\"H # 53'\\\n '1, S # 20\",\"uid\":\"123321\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-'\\\n '13T14:01:54.9571247Z\",\"salary\":20000,\"department\":\"Software Development'\\\n '\",\"joiningDay\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesday\",\"Friday\"],\"'\\\n 'dependents\":[{\"name\":\"Future Wife\",\"age\":5147483649,\"address\":\"H # 531,'\\\n ' S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13'\\\n 'T14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"age\":5147483648,\"address\":\"H'\\\n ' # 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"1994-02-13\",\"birthtime\":\"199'\\\n '4-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, 06 Nov 1994 08:49:37 GMT\",'\\\n '\"promotedAt\":1484719381},\"dependents\":[{\"name\":\"Future Wife\",\"age\":5147'\\\n '483649,\"address\":\"H # 531, S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-1'\\\n '3\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"ag'\\\n 'e\":5147483648,\"address\":\"H # 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"19'\\\n '94-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, '\\\n '06 Nov 1994 08:49:37 GMT\"},{\"name\":\"Shahid Khaliq\",\"age\":5147483645,\"ad'\\\n 'dress\":\"H # 531, S # 20\",\"uid\":\"123321\",\"birthday\":\"1994-02-13\",\"birtht'\\\n 'ime\":\"1994-02-13T14:01:54.9571247Z\",\"salary\":20000,\"department\":\"Softwa'\\\n 're Development\",\"joiningDay\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesda'\\\n 'y\",\"Friday\"],\"boss\":{\"personType\":\"Boss\",\"name\":\"Zeeshan Ejaz\",\"age\":51'\\\n '47483645,\"address\":\"H # 531, S # 20\",\"uid\":\"123321\",\"birthday\":\"1994-02'\\\n '-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\",\"salary\":20000,\"departm'\\\n 'ent\":\"Software Development\",\"joiningDay\":\"Saturday\",\"workingDays\":[\"Mon'\\\n 'day\",\"Tuesday\",\"Friday\"],\"dependents\":[{\"name\":\"Future Wife\",\"age\":5147'\\\n '483649,\"address\":\"H # 531, S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-1'\\\n '3\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"ag'\\\n 'e\":5147483648,\"address\":\"H # 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"19'\\\n '94-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, '\\\n '06 Nov 1994 08:49:37 GMT\",\"promotedAt\":1484719381},\"dependents\":[{\"name'\\\n '\":\"Future Wife\",\"age\":5147483649,\"address\":\"H # 531, S # 20\",\"uid\":\"123'\\\n '412\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"'\\\n '},{\"name\":\"Future Kid\",\"age\":5147483648,\"address\":\"H # 531, S # 20\",\"ui'\\\n 'd\":\"312341\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T14:01:54.95'\\\n '71247Z\"}],\"hiredAt\":\"Sun, 06 Nov 1994 08:49:37 GMT\"}]'\n ).map { |element| Employee.from_hash(element) }\n\n # Perform the API call through the SDK function\n result = @controller.send_model_array(models)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n\n # Test whether the captured response is as we expected\n refute_nil(result)\n expected_body = JSON.parse(\n '{\"passed\":true}'\n )\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end", "title": "" }, { "docid": "bb2a10f157e7cb181ba329a8269b5616", "score": "0.53519577", "text": "def test_send_model_array()\n # Parameters for the API call\n models = APIHelper.json_deserialize(\n '[{\"name\":\"Shahid Khaliq\",\"age\":5147483645,\"address\":\"H # 531, S # 20\",\"'\\\n 'uid\":\"123321\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T14:01:54.'\\\n '9571247Z\",\"salary\":20000,\"department\":\"Software Development\",\"joiningDa'\\\n 'y\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesday\",\"Friday\"],\"boss\":{\"pers'\\\n 'onType\":\"Boss\",\"name\":\"Zeeshan Ejaz\",\"age\":5147483645,\"address\":\"H # 53'\\\n '1, S # 20\",\"uid\":\"123321\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-'\\\n '13T14:01:54.9571247Z\",\"salary\":20000,\"department\":\"Software Development'\\\n '\",\"joiningDay\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesday\",\"Friday\"],\"'\\\n 'dependents\":[{\"name\":\"Future Wife\",\"age\":5147483649,\"address\":\"H # 531,'\\\n ' S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13'\\\n 'T14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"age\":5147483648,\"address\":\"H'\\\n ' # 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"1994-02-13\",\"birthtime\":\"199'\\\n '4-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, 06 Nov 1994 08:49:37 GMT\",'\\\n '\"promotedAt\":1484719381},\"dependents\":[{\"name\":\"Future Wife\",\"age\":5147'\\\n '483649,\"address\":\"H # 531, S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-1'\\\n '3\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"ag'\\\n 'e\":5147483648,\"address\":\"H # 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"19'\\\n '94-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, '\\\n '06 Nov 1994 08:49:37 GMT\"},{\"name\":\"Shahid Khaliq\",\"age\":5147483645,\"ad'\\\n 'dress\":\"H # 531, S # 20\",\"uid\":\"123321\",\"birthday\":\"1994-02-13\",\"birtht'\\\n 'ime\":\"1994-02-13T14:01:54.9571247Z\",\"salary\":20000,\"department\":\"Softwa'\\\n 're Development\",\"joiningDay\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesda'\\\n 'y\",\"Friday\"],\"boss\":{\"personType\":\"Boss\",\"name\":\"Zeeshan Ejaz\",\"age\":51'\\\n '47483645,\"address\":\"H # 531, S # 20\",\"uid\":\"123321\",\"birthday\":\"1994-02'\\\n '-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\",\"salary\":20000,\"departm'\\\n 'ent\":\"Software Development\",\"joiningDay\":\"Saturday\",\"workingDays\":[\"Mon'\\\n 'day\",\"Tuesday\",\"Friday\"],\"dependents\":[{\"name\":\"Future Wife\",\"age\":5147'\\\n '483649,\"address\":\"H # 531, S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-1'\\\n '3\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"ag'\\\n 'e\":5147483648,\"address\":\"H # 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"19'\\\n '94-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, '\\\n '06 Nov 1994 08:49:37 GMT\",\"promotedAt\":1484719381},\"dependents\":[{\"name'\\\n '\":\"Future Wife\",\"age\":5147483649,\"address\":\"H # 531, S # 20\",\"uid\":\"123'\\\n '412\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"'\\\n '},{\"name\":\"Future Kid\",\"age\":5147483648,\"address\":\"H # 531, S # 20\",\"ui'\\\n 'd\":\"312341\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T14:01:54.95'\\\n '71247Z\"}],\"hiredAt\":\"Sun, 06 Nov 1994 08:49:37 GMT\"}]'\n ).map { |element| Employee.from_hash(element) }\n\n # Perform the API call through the SDK function\n result = @controller.send_model_array(models)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n\n # Test whether the captured response is as we expected\n refute_nil(result)\n expected_body = JSON.parse(\n '{\"passed\":true}'\n )\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end", "title": "" }, { "docid": "a04f00ddbbc2c72e2de53ec0cbca9c07", "score": "0.53397137", "text": "def make_model_params\n params.require(:make_model).permit(:car_make_id, :model)\n end", "title": "" }, { "docid": "08bc9c62b67cef27b3ec53b33f3ad091", "score": "0.53378785", "text": "def create\n @feature_model = FeatureModel.new(params[:feature_model])\n\n respond_to do |format|\n if @feature_model.save\n format.html { redirect_to @feature_model, :notice => 'Feature model was successfully created.' }\n format.json { render :json => @feature_model, :status => :created, :location => @feature_model }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @feature_model.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9c6e06befa0102178692c385363fe014", "score": "0.53155667", "text": "def create\n res = self.class.post('/', body: attrs)\n res.created?\n end", "title": "" }, { "docid": "d4d9cf5924739dc66c48be8f0df4f8c2", "score": "0.5312509", "text": "def create\n# binding.pry\n# params[:model][:category] = Category.find_by_id(params[:model][:category].to_i)\n @model = Model.new(params[:model])\n respond_to do |format|\n if @model.save\n format.html { redirect_to @model, notice: 'Model was successfully created.' }\n format.json { render json: @model, status: :created, location: @model }\n else\n format.html { render action: \"new\" }\n format.json { render json: @model.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dfc66a4c8a41c6d0ebb1f0d2ff37c8e6", "score": "0.5308608", "text": "def create\n @api_post = Api::Post.new(api_post_params)\n\n if @api_post.save\n render json: @api_post, status: :created, location: @api_post\n else\n render json: @api_post.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "f91cba98a8c51616ccd05281af6a986a", "score": "0.5307349", "text": "def new\n @model = Model.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @model }\n end\n end", "title": "" }, { "docid": "f91cba98a8c51616ccd05281af6a986a", "score": "0.5307349", "text": "def new\n @model = Model.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @model }\n end\n end", "title": "" }, { "docid": "f91cba98a8c51616ccd05281af6a986a", "score": "0.5307349", "text": "def new\n @model = Model.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @model }\n end\n end", "title": "" }, { "docid": "f91cba98a8c51616ccd05281af6a986a", "score": "0.5307349", "text": "def new\n @model = Model.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @model }\n end\n end", "title": "" }, { "docid": "27e617dcd58c9cc554dcae883429e4fc", "score": "0.52947646", "text": "def create\n @model = Model.new(model_params)\n\n respond_to do |format|\n if @model.save\n format.html { redirect_to @model.brand, flash: {success:_(\"Modello creato con successo!\")} }\n format.json { render json: @model, status: :created, location: @model }\n else\n format.html { render \"forms/new_edit\" }\n format.json { render json: @model.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a928eed7f04a175497fb5ddd5d1b0289", "score": "0.5292436", "text": "def model_params\n #params[:model][:model_products] ||= []\n params.require(:model).permit(:make_id, :material_id, :name, :price, :model_products)\n end", "title": "" }, { "docid": "c6461a6a0afdca27b3d13c650b5469a0", "score": "0.5279021", "text": "def model_name_params\n params.require(:model_name).permit(:model_name)\n end", "title": "" }, { "docid": "9a39dc978a432c8df1249d8f6bc47e00", "score": "0.5274398", "text": "def auto_model_params\n params.require(:auto_model).permit(:name, :auto_model_photo, :auto_brand_id)\n end", "title": "" }, { "docid": "ab40a204e814701e5194741f6adf5955", "score": "0.5273365", "text": "def create\n @vehicle_submodel = VehicleSubmodel.new(vehicle_submodel_params)\n\n respond_to do |format|\n if @vehicle_submodel.save\n format.html { redirect_to @vehicle_submodel, notice: 'Vehicle submodel was successfully created.' }\n format.json { render :show, status: :created, location: @vehicle_submodel }\n else\n format.html { render :new }\n format.json { render json: @vehicle_submodel.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "da0ff400324b5dfb9cd9dfaee59e15a1", "score": "0.5270673", "text": "def create\n @model_input = ModelInput.new(model_input_params)\n\n respond_to do |format|\n if @model_input.save\n format.html { redirect_to @model_input, notice: 'Model input was successfully created.' }\n format.json { render :show, status: :created, location: @model_input }\n else\n format.html { render :new }\n format.json { render json: @model_input.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "62129886e9d7c3153a320ae79c52382d", "score": "0.5268867", "text": "def update_models(json)\n if json.is_a?(Array)\n model_ids = []\n for json_part in json\n model = save_model_with(json_part)\n model_ids << \"#{model.id}\".to_i if model.present?\n end\n where(:id).in model_ids\n else\n model = save_model_with(json)\n return nil if model.blank?\n\n find(\"#{model.id}\".to_i)\n end\n end", "title": "" }, { "docid": "fc52d5cf5d0c07752db09062260a140a", "score": "0.5262285", "text": "def test_model_params\n params.require(:test_model).permit(:nickname, :status, :description)\n end", "title": "" }, { "docid": "8923e5e8f4215cd99564d40da60c78b4", "score": "0.5249149", "text": "def model_params\n params.require(:model).permit(:name, :brand_id)\n end", "title": "" }, { "docid": "a79f9cd1c0dcec5c6ead807f3a6364a4", "score": "0.524446", "text": "def create\n @models = self.class.model_class.new(params[:partners])\n\n respond_to do |format|\n if @models.save\n flash[:notice] = 'Model was successfully created.'\n format.html { redirect_to(@models) }\n format.xml { render :xml => @models, :status => :created, :location => @models }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @models.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "23f3a8d184848bc77635dc9d008c6332", "score": "0.5242399", "text": "def create\r\n @sivic_model = SivicModel.new(sivic_model_params)\r\n\r\n respond_to do |format|\r\n if @sivic_model.save\r\n format.html { redirect_to @sivic_model, notice: 'Sivic model was successfully created.' }\r\n format.json { render action: 'show', status: :created, location: @sivic_model }\r\n else\r\n format.html { render action: 'new' }\r\n format.json { render json: @sivic_model.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "title": "" }, { "docid": "2388f6b2f0ea4bb6cf8eb9b8d10c8b38", "score": "0.5239708", "text": "def create \n company = Company.new(company_params)\n if company.save \n render json: CompanySerializer.new(company)\n else\n render json: {error: \"Couldnt be saved\"}\n end\nend", "title": "" }, { "docid": "18155f4529e417d3766d7fc0f767badd", "score": "0.5238833", "text": "def object_to_http_body(model)\n return model if model.nil? || model.is_a?(String)\n local_body = nil\n if model.is_a?(Array)\n local_body = model.map { |m| object_to_hash(m) }\n else\n local_body = object_to_hash(model)\n end\n local_body.to_json\n end", "title": "" }, { "docid": "18155f4529e417d3766d7fc0f767badd", "score": "0.5238833", "text": "def object_to_http_body(model)\n return model if model.nil? || model.is_a?(String)\n local_body = nil\n if model.is_a?(Array)\n local_body = model.map { |m| object_to_hash(m) }\n else\n local_body = object_to_hash(model)\n end\n local_body.to_json\n end", "title": "" }, { "docid": "18155f4529e417d3766d7fc0f767badd", "score": "0.5238833", "text": "def object_to_http_body(model)\n return model if model.nil? || model.is_a?(String)\n local_body = nil\n if model.is_a?(Array)\n local_body = model.map { |m| object_to_hash(m) }\n else\n local_body = object_to_hash(model)\n end\n local_body.to_json\n end", "title": "" }, { "docid": "18155f4529e417d3766d7fc0f767badd", "score": "0.5238833", "text": "def object_to_http_body(model)\n return model if model.nil? || model.is_a?(String)\n local_body = nil\n if model.is_a?(Array)\n local_body = model.map { |m| object_to_hash(m) }\n else\n local_body = object_to_hash(model)\n end\n local_body.to_json\n end", "title": "" }, { "docid": "18155f4529e417d3766d7fc0f767badd", "score": "0.5238833", "text": "def object_to_http_body(model)\n return model if model.nil? || model.is_a?(String)\n local_body = nil\n if model.is_a?(Array)\n local_body = model.map { |m| object_to_hash(m) }\n else\n local_body = object_to_hash(model)\n end\n local_body.to_json\n end", "title": "" }, { "docid": "3a1c8dce1b9a994b698ac2ee3364624f", "score": "0.5238695", "text": "def create\n \n #Rails.logger.debug(\"Hello Server #{session.inspect} current user #{current_user.id}\")\n \n \n @model = Feed.create(params[:feed].merge(:user_id => current_user.id))\n if @model.save\n render :json => @model.to_json\n else\n Rails.logger.debug(\"Hello Server #{@model.errors.full_messages}\")\n render :json => { :errors => @model.errors.full_messages }\n \n \n end\n end", "title": "" }, { "docid": "80da4a45aad3cf5e50a56a2d6af4f4fb", "score": "0.52305156", "text": "def model_params\n params.require(:model).permit(:name, :description, :image, :price)\n end", "title": "" }, { "docid": "7d4f3731c8f3a38c7715aa8b05bd8a4a", "score": "0.522797", "text": "def create\n @post = Post.create(post_params)\n render json: @post, serializer: PostSerializer\n end", "title": "" }, { "docid": "25218db8ea717c69a3a5eda9b4200bb8", "score": "0.5227105", "text": "def create_models\n @name = name.singularize.downcase\n @name_plural = @name.pluralize\n @attributes = attributes\n template(\"./templates/model.erb\", \"./models/#{@name}.rb\")\n end", "title": "" }, { "docid": "96c724b3bebff065dd51364ad2025ff1", "score": "0.5226207", "text": "def create\n @modeltype = Modeltype.new(modeltype_params)\n\n respond_to do |format|\n if @modeltype.save\n format.html { redirect_to @modeltype, notice: 'Modeltype was successfully created.' }\n format.json { render :show, status: :created, location: @modeltype }\n else\n format.html { render :new }\n format.json { render json: @modeltype.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fd92c2f9c43af9150f9f93b2bdcde675", "score": "0.5223149", "text": "def object_to_http_body(model)\n return model if model.nil? || model.is_a?(String)\n local_body = nil\n if model.is_a?(Array)\n local_body = model.map{|m| object_to_hash(m) }\n else\n local_body = object_to_hash(model)\n end\n local_body.to_json\n end", "title": "" }, { "docid": "d4ba872cacd2b27e00e4a3de44a9f5b9", "score": "0.5216852", "text": "def serialize(model)\n end", "title": "" }, { "docid": "af9ab9fe8afae5d495bdd675ce49a0e0", "score": "0.5215225", "text": "def get_models_for_make_id\n render json: vehicle_service.get_models_for_make_id(params[:make_id])\n end", "title": "" }, { "docid": "80aff41ed48a7b411ba10543717380ee", "score": "0.5212491", "text": "def create\n @fakemodel = Fakemodel.new(fakemodel_params)\n\n respond_to do |format|\n if @fakemodel.save\n format.html { redirect_to @fakemodel, notice: 'Fakemodel was successfully created.' }\n format.json { render :show, status: :created, location: @fakemodel }\n else\n format.html { render :new }\n format.json { render json: @fakemodel.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "058bf3f8c7188a3c6235e6c7e1f1dc1e", "score": "0.5209174", "text": "def create\n @model_association = ModelAssociation.new(params[:model_association])\n\n respond_to do |format|\n if @model_association.save\n format.html { redirect_to new_model_association_path(:primary_model_id => @model_association.primary_model_id), notice: 'Model association was successfully created.' }\n format.json { render json: @model_association, status: :created, location: @model_association }\n else\n format.html { render action: \"new\" }\n format.json { render json: @model_association.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0cb22603d84c30bf81c77070c5bdd583", "score": "0.5202451", "text": "def define_restful_api(model)\n get \"/#{model.resource}\" do\n sleep settings.fake_latency if settings.fake_latency > 0\n catch_errors { json model.all }\n end\n\n get \"/#{model.resource}/:id\" do\n sleep settings.fake_latency if settings.fake_latency > 0\n catch_errors do\n result = model.find_by_id(params[:id])\n halt 404 if result.nil?\n json result\n end\n end\n\n post \"/#{model.resource}\" do\n sleep settings.fake_latency if settings.fake_latency > 0\n catch_errors { json model.create(@json_payload) }\n end\n\n patch \"/#{model.resource}/:id\" do\n sleep settings.fake_latency if settings.fake_latency > 0\n catch_errors { json model.update(params[:id], @json_payload) }\n end\n\n delete \"/#{model.resource}/:id\" do\n sleep settings.fake_latency if settings.fake_latency > 0\n catch_errors { model.delete(params[:id]) }\n end\n\n private\n def catch_errors()\n begin\n yield\n rescue Exception => e\n logger.fatal(\"Exception: #{e}\")\n status 500\n json({'error' => e})\n end\n end\nend", "title": "" }, { "docid": "df364739efcc8775e462a911e778124f", "score": "0.5197191", "text": "def create(model={})\n create_new_model(model, :create)\n end", "title": "" }, { "docid": "e49fef71cee19f59e8bf7dedc6d4c380", "score": "0.51933086", "text": "def model_params\n params.require(:model).permit(\n :brand_id,\n :name)\n end", "title": "" }, { "docid": "1ddb6066f377c40385a2f241b50f8cd4", "score": "0.51896095", "text": "def create\n# binding.pry\n# params[:model][:category] = Category.find_by_id(params[:model][:category].to_i)\n @model = Model.new(params[:model])\n respond_to do |format|\n if @model.save\n format.html { redirect_to [:administration, @model], notice: 'Model was successfully created.' }\n format.json { render json: @model, status: :created, location: @model }\n else\n format.html { render action: \"new\" }\n format.json { render json: @model.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8d244c8e93c271a7e92ea1ee63d3dddc", "score": "0.51815337", "text": "def POST; end", "title": "" }, { "docid": "157c1723771596a42a33dca7805b4061", "score": "0.51768047", "text": "def create\n @model = Model.new(params[:model])\n\n respond_to do |format|\n if @model.save\n format.html { redirect_to(@model, :notice => 'Model was successfully created.') }\n format.xml { render :xml => @model, :status => :created, :location => @model }\n format.csv { render :csv => @model, :status => :created, :location => @model }\n format.json { render :json => @model, :status => :created, :location => @model }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @model.errors, :status => :unprocessable_entity }\n format.csv { render :csv => @model.errors, :status => :unprocessable_entity }\n format.json { render :json => @model.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "157c1723771596a42a33dca7805b4061", "score": "0.51768047", "text": "def create\n @model = Model.new(params[:model])\n\n respond_to do |format|\n if @model.save\n format.html { redirect_to(@model, :notice => 'Model was successfully created.') }\n format.xml { render :xml => @model, :status => :created, :location => @model }\n format.csv { render :csv => @model, :status => :created, :location => @model }\n format.json { render :json => @model, :status => :created, :location => @model }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @model.errors, :status => :unprocessable_entity }\n format.csv { render :csv => @model.errors, :status => :unprocessable_entity }\n format.json { render :json => @model.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c3c685af96ea465b29ff458f5d704811", "score": "0.5175881", "text": "def create(params = {})\n wrapped_params = { parcel: params }\n @client.make_request(:post, 'parcels', MODEL_CLASS, wrapped_params)\n end", "title": "" }, { "docid": "db8b8a670205cb1b12c0b06651ad92ba", "score": "0.5175771", "text": "def test_send_model()\n # Parameters for the API call\n model = Employee.from_hash(APIHelper.json_deserialize(\n '{\"name\":\"Shahid Khaliq\",\"age\":5147483645,\"address\":\"H # 531, S # 20\",\"u'\\\n 'id\":\"123321\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9'\\\n '571247Z\",\"salary\":20000,\"department\":\"Software Development\",\"joiningDay'\\\n '\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesday\",\"Friday\"],\"boss\":{\"perso'\\\n 'nType\":\"Boss\",\"name\":\"Zeeshan Ejaz\",\"age\":5147483645,\"address\":\"H # 531'\\\n ', S # 20\",\"uid\":\"123321\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-1'\\\n '3T14:01:54.9571247Z\",\"salary\":20000,\"department\":\"Software Development\"'\\\n ',\"joiningDay\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesday\",\"Friday\"],\"d'\\\n 'ependents\":[{\"name\":\"Future Wife\",\"age\":5147483649,\"address\":\"H # 531, '\\\n 'S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T'\\\n '14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"age\":5147483648,\"address\":\"H '\\\n '# 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994'\\\n '-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, 06 Nov 1994 08:49:37 GMT\",\"'\\\n 'promotedAt\":1484719381},\"dependents\":[{\"name\":\"Future Wife\",\"age\":51474'\\\n '83649,\"address\":\"H # 531, S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-13'\\\n '\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"age'\\\n '\":5147483648,\"address\":\"H # 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"199'\\\n '4-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, 0'\\\n '6 Nov 1994 08:49:37 GMT\"}'\n ))\n\n # Perform the API call through the SDK function\n result = @controller.send_model(model)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n\n # Test whether the captured response is as we expected\n refute_nil(result)\n expected_body = JSON.parse(\n '{\"passed\":true}'\n )\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end", "title": "" }, { "docid": "db8b8a670205cb1b12c0b06651ad92ba", "score": "0.5175771", "text": "def test_send_model()\n # Parameters for the API call\n model = Employee.from_hash(APIHelper.json_deserialize(\n '{\"name\":\"Shahid Khaliq\",\"age\":5147483645,\"address\":\"H # 531, S # 20\",\"u'\\\n 'id\":\"123321\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9'\\\n '571247Z\",\"salary\":20000,\"department\":\"Software Development\",\"joiningDay'\\\n '\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesday\",\"Friday\"],\"boss\":{\"perso'\\\n 'nType\":\"Boss\",\"name\":\"Zeeshan Ejaz\",\"age\":5147483645,\"address\":\"H # 531'\\\n ', S # 20\",\"uid\":\"123321\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-1'\\\n '3T14:01:54.9571247Z\",\"salary\":20000,\"department\":\"Software Development\"'\\\n ',\"joiningDay\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesday\",\"Friday\"],\"d'\\\n 'ependents\":[{\"name\":\"Future Wife\",\"age\":5147483649,\"address\":\"H # 531, '\\\n 'S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T'\\\n '14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"age\":5147483648,\"address\":\"H '\\\n '# 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994'\\\n '-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, 06 Nov 1994 08:49:37 GMT\",\"'\\\n 'promotedAt\":1484719381},\"dependents\":[{\"name\":\"Future Wife\",\"age\":51474'\\\n '83649,\"address\":\"H # 531, S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-13'\\\n '\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"age'\\\n '\":5147483648,\"address\":\"H # 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"199'\\\n '4-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, 0'\\\n '6 Nov 1994 08:49:37 GMT\"}'\n ))\n\n # Perform the API call through the SDK function\n result = @controller.send_model(model)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n\n # Test whether the captured response is as we expected\n refute_nil(result)\n expected_body = JSON.parse(\n '{\"passed\":true}'\n )\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end", "title": "" }, { "docid": "8047b42db62c6e41a28dde569f408a0b", "score": "0.51746434", "text": "def create\n megam_rest.post_appdefn(to_hash)\n end", "title": "" }, { "docid": "b02f82b2084c4e8199ebe0d275c94c09", "score": "0.51733977", "text": "def create \n render json: Tuning.create(tuning_params)\n end", "title": "" }, { "docid": "e6ca1aeea9cf5592b04a83ea0e73dff9", "score": "0.5161111", "text": "def create\n models = params[:product][:models_attributes]\n if !models.nil?\n models.each do |model|\n model[1][:characteristics] = sanitize_attributes(model[1][:characteristics])\n end\n end\n clean_params = product_params\n clean_params[:specifications] = sanitize_data(clean_params[:specifications])\n clean_params[:features] = sanitize_data(clean_params[:features])\n clean_params[:attributes_titles] = sanitize_attributes(clean_params[:attributes_titles])\n\n @product = Product.new(clean_params)\n respond_to do |format|\n if @product.save\n format.html { redirect_to [:admin, @product], notice: 'Product was successfully created.' }\n format.json { render action: 'show', status: :created, location: @product }\n else\n format.html { render action: 'new' }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3897404836fc27d03078a9c1f6b972bf", "score": "0.51610506", "text": "def create\n @saved = @user.saveds.create(saved_params)\n render json: @saved\n end", "title": "" }, { "docid": "59ca9d54af001aac6e6abcc4a079c49f", "score": "0.515888", "text": "def create\n megam_rest.post_node(to_hash)\n end", "title": "" }, { "docid": "638b09a245ef2579889f295a82cac848", "score": "0.5153713", "text": "def create\n # rp - request parameters\n rp = req_params\n\n # сюда будем собирать ошибки при проверке заявки\n errors = {}\n\n model_name(rp, errors)\n aas_names(rp, errors)\n check_human(rp, errors)\n\n if errors.empty?\n export(rp) if PSOFT_DB\n mail(rp)\n render json: { message: format(I18n.t('request.status.ok'), id: rp.id || ' -') }\n else\n render status: :unprocessable_entity, json: errors\n end\n end", "title": "" }, { "docid": "aea23f55d5af3e2481b5edf69adeaeb6", "score": "0.51494676", "text": "def create\n order = Order.create(order_params)\n render json: order\nend", "title": "" } ]
d26492d022572419fef2500ee336440a
GET /crowd_data/new GET /crowd_data/new.json
[ { "docid": "d94405ef3cbf3814868e428c7b692ae5", "score": "0.76349324", "text": "def new\n @crowd_datum = CrowdDatum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @crowd_datum }\n end\n end", "title": "" } ]
[ { "docid": "d89d88dcb488b2acf0e3af27a9893512", "score": "0.70536685", "text": "def new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: ''}\n end\n end", "title": "" }, { "docid": "078673f1e016a5aa84e95947043a779c", "score": "0.7005688", "text": "def new\n @dataset = Dataset.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dataset }\n end\n end", "title": "" }, { "docid": "078673f1e016a5aa84e95947043a779c", "score": "0.7005688", "text": "def new\n @dataset = Dataset.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dataset }\n end\n end", "title": "" }, { "docid": "17d7da60333d97967bcd96628c11fd45", "score": "0.688588", "text": "def new\n json_404\n end", "title": "" }, { "docid": "79e6d9224802cd94f42325a3b52a2dc4", "score": "0.6791513", "text": "def new\n @tdc = Tdc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tdc }\n end\n end", "title": "" }, { "docid": "9196577e5975d343b2c1860bb137c02d", "score": "0.67760336", "text": "def new\n @cdist_object = CdistObject.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cdist_object }\n end\n end", "title": "" }, { "docid": "5da16b2c91298b65822f602999d1754d", "score": "0.6772056", "text": "def new_stories\n get('/newstories.json')\n end", "title": "" }, { "docid": "e0c13db14ae1f914a37a3c5810791e7b", "score": "0.6759272", "text": "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @life_jacket }\n end\n end", "title": "" }, { "docid": "29d69072246a992dd8a3efa26e51937b", "score": "0.6758109", "text": "def new\n\t\tif params[:data].present?\n\t\t\t@data = JSON.parse(Base64.decode64(params[:data]))\n\t\tend\n\t\trender 'new'\n\tend", "title": "" }, { "docid": "7b689672fb051affca32a268fdcb4736", "score": "0.6755342", "text": "def new\n\tuuid = SecureRandom.uuid\n\t@new_url = searches_url + \"/\" + uuid # creates http://localhost/search/123-34552-adsfrjha-234\n\tresponse.set_header(\"Location\", @new_url)\n respond_to do |format|\n format.html { render :new, status: 201 }\n format.json { render :new, status: 201 }\n format.jsonld { render :new, formats: :json, status: 201 }\n end\n\t\n end", "title": "" }, { "docid": "1fe7a0eb754b891d211533173d6ae2a7", "score": "0.67440623", "text": "def new\n\t\n\t\t\n\t\trender json: {}\n\tend", "title": "" }, { "docid": "a6c493809ed60f4ff68cca67b2c41030", "score": "0.6737131", "text": "def new\n @rawdatum = Rawdatum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rawdatum }\n end\n end", "title": "" }, { "docid": "450698cf60b9c4492d259995cf03f320", "score": "0.67290527", "text": "def new\n @datafile = Datafile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @datafile }\n end\n end", "title": "" }, { "docid": "f6fd5e07a1ef6d337b6542ca31974fda", "score": "0.6728532", "text": "def new\n @casestudy = Casestudy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @casestudy }\n end\n end", "title": "" }, { "docid": "d871bce622a0647a7673f223b0ed9429", "score": "0.6710058", "text": "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contestant }\n end\n end", "title": "" }, { "docid": "9ca04eeb2c59673fc3f54652aa21438f", "score": "0.67085683", "text": "def new\n @datum = Datum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @datum }\n end\n end", "title": "" }, { "docid": "7221666d29bc119040157ad6303585cf", "score": "0.6704877", "text": "def new\n @getdatum = Getdatum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @getdatum }\n end\n end", "title": "" }, { "docid": "a9a80045c3cbd2009d18b29ee38b4cc7", "score": "0.6694866", "text": "def new\n @clinic_info = ClinicInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clinic_info }\n end\n end", "title": "" }, { "docid": "0ce0a6e41e1e5f03e03d60fb16879b0c", "score": "0.6692533", "text": "def new\n logger.info \"data_points_contoller.new enter\"\n @data_point = DataPoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @data_point }\n end\n logger.info \"data_points_contoller.new leave\"\n end", "title": "" }, { "docid": "c3ecfbd6a3847f42d57dfc855f51d125", "score": "0.66705775", "text": "def new\n @case_study = CaseStudy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @case_study }\n end\n end", "title": "" }, { "docid": "f4f8a90f4d50280ae3ac02a1153897b1", "score": "0.6668817", "text": "def new\n @crime = Crime.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @crime }\n end\n end", "title": "" }, { "docid": "f4f8a90f4d50280ae3ac02a1153897b1", "score": "0.6668817", "text": "def new\n @crime = Crime.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @crime }\n end\n end", "title": "" }, { "docid": "5371387d199dfb1e82527ec95e4b4634", "score": "0.6665875", "text": "def new\n @ref_datum = RefDatum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ref_datum }\n end\n end", "title": "" }, { "docid": "5978257c56fc38847b718fd939156659", "score": "0.6662478", "text": "def new\n @touched = Touched.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @touched }\n end\n end", "title": "" }, { "docid": "fdfe67f3af0f2152050891de0491f278", "score": "0.6661444", "text": "def new\n @data_doc = DataDoc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @data_doc }\n end\n end", "title": "" }, { "docid": "1715d9ad731c998005a17fc0bb54d447", "score": "0.6661292", "text": "def new\n @cj = Cj.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cj }\n end\n end", "title": "" }, { "docid": "c9d1386c5ece3daf4222c779bf9d71c4", "score": "0.6660285", "text": "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b79d1bd827a703ea288d18dd6d4eac3e", "score": "0.66590446", "text": "def new\n @citation_template = CitationTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @citation_template }\n end\n end", "title": "" }, { "docid": "61e898c38873bca348b1bf7c717a4cd1", "score": "0.66573983", "text": "def new\n @custom_datum = CustomDatum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @custom_datum }\n end\n end", "title": "" }, { "docid": "4ed9c20e7dd64b76549d7058f3390734", "score": "0.6654932", "text": "def new\n @data_set = DataSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @data_set }\n end\n end", "title": "" }, { "docid": "bb9db5c5a3f90d51a17f365d88d3ae92", "score": "0.6654622", "text": "def new\n @template = Template.new(row)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @template }\n end\n end", "title": "" }, { "docid": "112803d434eea10bec048d41277d7416", "score": "0.6642719", "text": "def new\n @crest = Crest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @crest }\n end\n end", "title": "" }, { "docid": "75e0f3f9b25e543932187e4377f692c1", "score": "0.6641311", "text": "def new\n @newtest = Newtest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @newtest }\n end\n end", "title": "" }, { "docid": "9d67bece19ca4be0d3f93382ff07670f", "score": "0.66396505", "text": "def new\n @cloud = Cloud.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cloud }\n end\n end", "title": "" }, { "docid": "3bf0d6de8e04699efc816d72e7678057", "score": "0.66353583", "text": "def new\n @datafield = Datafield.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @datafield }\n end\n end", "title": "" }, { "docid": "9da4ac2dd8d0dbc2eff8d27ca9bb0d5e", "score": "0.6625954", "text": "def new\n @new_recipe = NewRecipe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @new_recipe }\n end\n end", "title": "" }, { "docid": "0d29a32e71b718559d914d2e6fd9ddb6", "score": "0.6624383", "text": "def new\n @coldnight = Coldnight.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @coldnight }\n end\n end", "title": "" }, { "docid": "92a056a81e289297f835d5e7b2a20e2e", "score": "0.66240615", "text": "def new\n @new_table = NewTable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @new_table }\n end\n end", "title": "" }, { "docid": "803f3aabd123696726992054fef0df68", "score": "0.6610356", "text": "def new\n @criterion = Criterion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @criterion }\n end\n end", "title": "" }, { "docid": "803f3aabd123696726992054fef0df68", "score": "0.6610356", "text": "def new\n @criterion = Criterion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @criterion }\n end\n end", "title": "" }, { "docid": "47381711f08e94c96d83609836692304", "score": "0.66077065", "text": "def new\n @scrapping = Scrapping.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scrapping }\n end\n end", "title": "" }, { "docid": "dc61d2bb479dc95a29f054b0419944e2", "score": "0.660281", "text": "def new\n @datapoint = Datapoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @datapoint }\n end\n end", "title": "" }, { "docid": "7e2b16e7909da5a159449f443af1ce85", "score": "0.6600808", "text": "def new\n @cst = Cst.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cst }\n end\n end", "title": "" }, { "docid": "8647ee4413a69f52ea148b2d4fe6051c", "score": "0.6598988", "text": "def new\n @clone = Clone.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clone }\n end\n end", "title": "" }, { "docid": "ebbc4b90a11e9f5696086646726457fb", "score": "0.6595633", "text": "def new\n @cloudpost = Cloudpost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cloudpost }\n end\n end", "title": "" }, { "docid": "25d029d3839ad6c7bd0531c5161cd621", "score": "0.65947694", "text": "def new\n @crisis = Crisis.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @crisis }\n end\n end", "title": "" }, { "docid": "db8abd7ec9f422274b16a8a9052a392f", "score": "0.65875316", "text": "def new\n @cloud_record = CloudRecord.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @cloud_record }\n end\n end", "title": "" }, { "docid": "6608b039eb611b10e27e25dbda37264c", "score": "0.65869725", "text": "def new\n @relapse = Relapse.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @relapse }\n end\n end", "title": "" }, { "docid": "bdccf65d565a9bdcdb2455f60500dc73", "score": "0.6583729", "text": "def new\n @foundry = Foundry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @foundry }\n end\n end", "title": "" }, { "docid": "39f06b48fcd16acdfb8a451223177967", "score": "0.6581765", "text": "def new\r\n @cathedra = Cathedra.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @cathedra }\r\n end\r\n end", "title": "" }, { "docid": "81277fd5ef11ba8be1893fd58b20a156", "score": "0.657586", "text": "def new\n @cloth = Cloth.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cloth }\n end\n end", "title": "" }, { "docid": "3335dc3cd5f9eea87011d52fcb66b4cc", "score": "0.6574612", "text": "def new\n @classifier = Classifier.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @classifier }\n end\n end", "title": "" }, { "docid": "a8bfbcba75ae37ba06d959ed0534785b", "score": "0.65704095", "text": "def new\n @clinic = Clinic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clinic }\n end\n end", "title": "" }, { "docid": "fa4bf289ecebfcaabd2dba595623db5e", "score": "0.6565927", "text": "def new\n @daily_lineup = DailyLineup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @daily_lineup }\n end\n end", "title": "" }, { "docid": "976e33788bcaf5ed66b2df0e80ea7d06", "score": "0.6565273", "text": "def new\n @data_file = DataFile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @data_file }\n end\n end", "title": "" }, { "docid": "574ac08d66fa230a5f759b0530c11a7e", "score": "0.65634596", "text": "def new\n @cdna_observation = CdnaObservation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cdna_observation }\n end\n end", "title": "" }, { "docid": "1eee5d9acd59c3ff34f480b319c30ed7", "score": "0.65631855", "text": "def new\n @yellowpage = Yellowpage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @yellowpage }\n end\n end", "title": "" }, { "docid": "8e069a1555597982c17f4bc51f8695f8", "score": "0.65621483", "text": "def new\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contest }\n end\n end", "title": "" }, { "docid": "8e069a1555597982c17f4bc51f8695f8", "score": "0.65621483", "text": "def new\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contest }\n end\n end", "title": "" }, { "docid": "8e069a1555597982c17f4bc51f8695f8", "score": "0.65621483", "text": "def new\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contest }\n end\n end", "title": "" }, { "docid": "d6da236f20b38908d2309b1ea3f8e921", "score": "0.65580213", "text": "def new\n @dr_visit = DrVisit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dr_visit }\n end\n end", "title": "" }, { "docid": "e13922e5998e7ac5e5bb606f75f24d85", "score": "0.65566635", "text": "def new\n @contest_entry = ContestEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contest_entry }\n end\n end", "title": "" }, { "docid": "142c9843af460205672a84a30fb00da4", "score": "0.6554702", "text": "def new\n @new_category = NewCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_category }\n end\n end", "title": "" }, { "docid": "3610a2188b56dd1218ed787257570814", "score": "0.65539026", "text": "def new\n @contig = Contig.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contig }\n end\n end", "title": "" }, { "docid": "bc9df93e250e934e13bdba64d97ac052", "score": "0.65508884", "text": "def new\n @trailhead = Trailhead.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trailhead }\n end\n end", "title": "" }, { "docid": "a46148684643a95ed8e18b0d6fa1437d", "score": "0.65482754", "text": "def new\n @risk = Risk.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @risk }\n end\n end", "title": "" }, { "docid": "a46148684643a95ed8e18b0d6fa1437d", "score": "0.65482754", "text": "def new\n @risk = Risk.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @risk }\n end\n end", "title": "" }, { "docid": "dc4e47372166f2c4c0cfcbafdfde2732", "score": "0.65441984", "text": "def new\n @health_datum = HealthDatum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @health_datum }\n end\n end", "title": "" }, { "docid": "05f2083f3df75ab7d6e1a9a6110fc11e", "score": "0.6544197", "text": "def new\n @dash = Dash.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dash }\n end\n end", "title": "" }, { "docid": "3c9d4d040419b31d9f69dbdec229a819", "score": "0.65387005", "text": "def new\n @copy = Copy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @copy }\n end\n end", "title": "" }, { "docid": "25f83fa6571c7a38f053ee41cec5d281", "score": "0.653794", "text": "def new\n @cite = Cite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cite }\n end\n end", "title": "" }, { "docid": "a00a3c1ddc45839e4509888c74fe285c", "score": "0.65375406", "text": "def new\n @breakdown = Breakdown.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @breakdown }\n end\n end", "title": "" }, { "docid": "9a26e45456cd35bba275cbbea23ee3fa", "score": "0.65374076", "text": "def new\n @mc_datum = McDatum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mc_datum }\n end\n end", "title": "" }, { "docid": "e1a775e22775c35a906bb69fb64adc01", "score": "0.6535225", "text": "def new\n @collage = Collage.new\n get_all_categories\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @collage }\n end\n end", "title": "" }, { "docid": "274d9b66b347c6cd734b86aae00ca702", "score": "0.65348375", "text": "def new\n @datasource = Datasource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @datasource }\n end\n end", "title": "" }, { "docid": "d881adb4ca57963e1e5f61d8f062416f", "score": "0.65327376", "text": "def new\n @reloud_entry = ReloudEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reloud_entry }\n end\n end", "title": "" }, { "docid": "59c2b317e75badc472a053e7756a386a", "score": "0.65273273", "text": "def new\n @gist = Gist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gist }\n end\n end", "title": "" }, { "docid": "59c2b317e75badc472a053e7756a386a", "score": "0.65273273", "text": "def new\n @gist = Gist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gist }\n end\n end", "title": "" }, { "docid": "01619b4a9596e793ca66d3a70dabc556", "score": "0.65231466", "text": "def new\n @daily_data_vehicle = DailyDataVehicle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @daily_data_vehicle }\n end\n end", "title": "" }, { "docid": "ceee4ba6910af2cfdd5af07ef2195c12", "score": "0.65222526", "text": "def new\n @lt = Lt.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lt }\n end\n end", "title": "" }, { "docid": "c89cd2691715a47136e8471df14968ed", "score": "0.65206075", "text": "def create\n @crowd_datum = CrowdDatum.new(params[:crowd_datum])\n\n respond_to do |format|\n if @crowd_datum.save\n format.html { redirect_to @crowd_datum, notice: 'Crowd datum was successfully created.' }\n format.json { render json: @crowd_datum, status: :created, location: @crowd_datum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @crowd_datum.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e1dd86f35b928fe8130b09238d0d9378", "score": "0.65106964", "text": "def new\n @risk = Risk.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @risk }\n end\n end", "title": "" }, { "docid": "f9b60dbf2ab42e3a44f7dfea1605912c", "score": "0.6509813", "text": "def new\n @rid = Rid.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rid }\n end\n end", "title": "" }, { "docid": "d65fc0d5b6bfc607a5b69fb9f826a14a", "score": "0.6507434", "text": "def new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contest }\n end\n end", "title": "" }, { "docid": "426b398e2b4a2ea5bad261c4c9175842", "score": "0.65071684", "text": "def new\n @cyclist = Cyclist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @cyclist }\n end\n end", "title": "" }, { "docid": "8af4ccc79bd287171359757850ab6996", "score": "0.6504978", "text": "def new\n @mds_file = MdsFile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mds_file }\n end\n end", "title": "" }, { "docid": "b562003ad164d3e1d18607bb706cb8fb", "score": "0.65023655", "text": "def new\n @clinical_history = ClinicalHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clinical_history }\n end\n end", "title": "" }, { "docid": "3cfe3840fab4ab605307f6f1db60397f", "score": "0.6500692", "text": "def new\n @req = Req.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @req }\n end\n end", "title": "" }, { "docid": "649efaa6171381518c3947c22ea70c09", "score": "0.6498245", "text": "def new\n @row = Row.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @row }\n end\n end", "title": "" }, { "docid": "9a882c8c6e94b83e3b72c9651945f194", "score": "0.649529", "text": "def new\n @concentration = Concentration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @concentration }\n end\n end", "title": "" }, { "docid": "17d49392842b802292f9c73f32a5ee12", "score": "0.6494902", "text": "def new\n @data_table = DataTable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @data_table }\n end\n end", "title": "" }, { "docid": "5aa9825068bb7f76847d33ff2c6dacf3", "score": "0.6494651", "text": "def new\n @data_migration = DataMigration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @data_migration }\n end\n end", "title": "" }, { "docid": "8089fd22d8519ae54ea4d4353805da1f", "score": "0.6490788", "text": "def new\n @reference_datum = ReferenceDatum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reference_datum }\n end\n end", "title": "" }, { "docid": "9a6850ba2e6f9fa08e395f35cd4bd0a8", "score": "0.64898306", "text": "def new\n @night_audit = NightAudit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @night_audit }\n end\n end", "title": "" }, { "docid": "ba6bc7de8d6c637fc5e19058adc8b104", "score": "0.6483684", "text": "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @campus }\n end\n end", "title": "" }, { "docid": "723467526d0f62079930b5f75e63d96c", "score": "0.64824486", "text": "def new\n @entry = Entry.new\n\n render json: @entry\n end", "title": "" }, { "docid": "ace64d1963e66c3cbc1ea10129e87f8b", "score": "0.6480195", "text": "def new\n @crawler_source = CrawlerSource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @crawler_source }\n end\n end", "title": "" }, { "docid": "34d1a0b6ab2bc58acf1ac6b2ba2c27c9", "score": "0.64790756", "text": "def new\n @life_jacket_age = LifeJacketAge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @life_jacket_age }\n end\n end", "title": "" }, { "docid": "45ad518baf51ee36261141df5ff4f44c", "score": "0.64790523", "text": "def new\n @cage = Cage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cage }\n end\n end", "title": "" }, { "docid": "e784a452994434aeda60ef889dd05182", "score": "0.64781815", "text": "def new\n @linkage = Linkage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @linkage }\n end\n end", "title": "" } ]
55ce7e9f03fa3854c239a76c746115fc
GET /live_clients GET /live_clients.json
[ { "docid": "3eb68ab2c0f574ec664404d1c343a041", "score": "0.7674752", "text": "def index\n @live_clients = LiveClient.all\n end", "title": "" } ]
[ { "docid": "11367d36e4c90c8a0de89176b3b870a4", "score": "0.75353515", "text": "def index\n @clients = current_user.clients\n render json: @clients\n end", "title": "" }, { "docid": "29fcc7c3bee7428121799f8973e4c715", "score": "0.72217035", "text": "def index\n @clients = Client.all\n render json: @clients\n end", "title": "" }, { "docid": "c7725222cd59e4ba95fb9f8b5349c652", "score": "0.6973935", "text": "def index\n @clients = Client.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clients }\n end\n end", "title": "" }, { "docid": "486a5ce55b2cb20012fd181bbdb86c1f", "score": "0.69176024", "text": "def index\n @clients = Client.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clients }\n end\n\n end", "title": "" }, { "docid": "58537e9fab1dac549536977cfc8c021c", "score": "0.69036573", "text": "def recent\n if current_user.is_admin?\n @clients = Client.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @clients }\n end\n end", "title": "" }, { "docid": "f92523b4652cd4578ec13097b66e6e82", "score": "0.68552893", "text": "def get_clients\n @clients\n end", "title": "" }, { "docid": "f92523b4652cd4578ec13097b66e6e82", "score": "0.68552893", "text": "def get_clients\n @clients\n end", "title": "" }, { "docid": "db3a143079af0eeb243abf05f6918ca9", "score": "0.67845726", "text": "def index\n render json: Client.all\n end", "title": "" }, { "docid": "37b17b6417a2366983ae4c6bd3102899", "score": "0.67206866", "text": "def show\n render json: @client\n end", "title": "" }, { "docid": "4b4a0e2bbce752b46efd315cc60731f8", "score": "0.6707183", "text": "def list_clients(json_payload={})\n conn = @client.get do |req|\n req.url \"/api/v2/client/list?\"\n req.headers[\"Authorization\"] = @token\n req.params = json_payload\n end\n conn.body\n end", "title": "" }, { "docid": "bf1a179fcbd8793256c42537244ebc6d", "score": "0.6705279", "text": "def index\n sanitized_params = parse_params(client_where_params)\n clients = Client.find_all(sanitized_params)\n render json: clients\n end", "title": "" }, { "docid": "a70ff66e977271f114f5214e99479509", "score": "0.66345704", "text": "def index\n @clients = Client.all\n @uuid = params[:uuid]\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clients }\n end\n end", "title": "" }, { "docid": "07edbcd6874bb75fe2bee4602887f26a", "score": "0.66089636", "text": "def index\n clients = request do\n api.request(\n :expects => 200,\n :headers => headers,\n :method => :get,\n :path => \"/oauth/clients\"\n ).body\n end\n styled_header(\"OAuth Clients\")\n styled_array(clients.map { |client|\n [client[\"name\"], client[\"id\"], client[\"redirect_uri\"]]\n })\n end", "title": "" }, { "docid": "9226c89b91420490b183d6f933ae2d16", "score": "0.65792793", "text": "def index \n @clients = ApiClient.all\n end", "title": "" }, { "docid": "52b5954f474ca83692adf7fad3ffb008", "score": "0.657789", "text": "def live\r\n channels = Channel.live\r\n render json: channels\r\n end", "title": "" }, { "docid": "2507a963044b215be2d42de39225a1e4", "score": "0.65596664", "text": "def index\n @clients = Client.all\n end", "title": "" }, { "docid": "2507a963044b215be2d42de39225a1e4", "score": "0.65596664", "text": "def index\n @clients = Client.all\n end", "title": "" }, { "docid": "2507a963044b215be2d42de39225a1e4", "score": "0.65596664", "text": "def index\n @clients = Client.all\n end", "title": "" }, { "docid": "2507a963044b215be2d42de39225a1e4", "score": "0.65596664", "text": "def index\n @clients = Client.all\n end", "title": "" }, { "docid": "2507a963044b215be2d42de39225a1e4", "score": "0.65596664", "text": "def index\n @clients = Client.all\n end", "title": "" }, { "docid": "2507a963044b215be2d42de39225a1e4", "score": "0.65596664", "text": "def index\n @clients = Client.all\n end", "title": "" }, { "docid": "2507a963044b215be2d42de39225a1e4", "score": "0.65596664", "text": "def index\n @clients = Client.all\n end", "title": "" }, { "docid": "2507a963044b215be2d42de39225a1e4", "score": "0.65596664", "text": "def index\n @clients = Client.all\n end", "title": "" }, { "docid": "7f5f4d67ea1f1f15c76b940d99e18d89", "score": "0.65504986", "text": "def details\n response = CreateSend.get \"/clients/#{client_id}.json\", {}\n Hashie::Mash.new(response)\n end", "title": "" }, { "docid": "00fb70284b8cc2d2d66d1d40d0cdc79f", "score": "0.65476245", "text": "def index\n @page_count, @clients = Locomotive::Client.paginated(:page => (params[:page] || 1).to_i)\n display @clients\n end", "title": "" }, { "docid": "365f2f9a43e5cfd835f6fce8b39512c6", "score": "0.64887464", "text": "def index\n @clients = Client.all\n end", "title": "" }, { "docid": "4e876f75e2143a497659974d40ff528e", "score": "0.64638054", "text": "def index\n render json: Client.where(active:true)\n end", "title": "" }, { "docid": "ab49051ebd1606b3cde91d5cb05ae0bf", "score": "0.64241135", "text": "def get_clients\n Client.get(:all).map{|c| c.to_ws}\n end", "title": "" }, { "docid": "dcdc92b151c24ec717e7491494790d88", "score": "0.6423314", "text": "def show\n @client = Client.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client }\n end\n end", "title": "" }, { "docid": "dcdc92b151c24ec717e7491494790d88", "score": "0.6423314", "text": "def show\n @client = Client.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client }\n end\n end", "title": "" }, { "docid": "dcdc92b151c24ec717e7491494790d88", "score": "0.6423314", "text": "def show\n @client = Client.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client }\n end\n end", "title": "" }, { "docid": "dcdc92b151c24ec717e7491494790d88", "score": "0.6423314", "text": "def show\n @client = Client.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client }\n end\n end", "title": "" }, { "docid": "dcdc92b151c24ec717e7491494790d88", "score": "0.6423314", "text": "def show\n @client = Client.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client }\n end\n end", "title": "" }, { "docid": "dcdc92b151c24ec717e7491494790d88", "score": "0.6423314", "text": "def show\n @client = Client.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client }\n end\n end", "title": "" }, { "docid": "dcdc92b151c24ec717e7491494790d88", "score": "0.6423314", "text": "def show\n @client = Client.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client }\n end\n end", "title": "" }, { "docid": "95eaa30b5b261e15207a107650ee6010", "score": "0.63749886", "text": "def show\n @clients = get_clients\n @client = Client.find(params[:id])\n\n respond_to do |format|\n #format.html # show.html.erb\n format.json { render json: @client }\n format.js\n end\n end", "title": "" }, { "docid": "eb8174d200c4f4fcab1924241f42497a", "score": "0.6369174", "text": "def show\r\n @client = Client.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @client }\r\n end\r\n end", "title": "" }, { "docid": "a56d3da2dd2f20d7bc55e0e7b7b21970", "score": "0.6347186", "text": "def index\r\n user = authenticate\r\n if user\r\n clients = Client.where('clientof = ?', user.id)\r\n render json: {clients: clients, message: 'Success', status: :ok}\r\n else\r\n render json: {message: 'Invalid token', status: :unauthorized}\r\n end\r\n end", "title": "" }, { "docid": "3c4da14963e3ab458d02332933495080", "score": "0.63425636", "text": "def index\n @clients = Client.where(params.except(:action, :controller, :format)).to_a # TODO: remove .to_a when Rails to_json bug fixed\n respond_with(@clients)\n end", "title": "" }, { "docid": "3799b3578650bef941524d1a1e083ed2", "score": "0.63403916", "text": "def show\n @client = clients.find(params[:id])\n end", "title": "" }, { "docid": "54e8e8181a98b7bf82664318e04e7df7", "score": "0.630838", "text": "def clients\n response = User_GetClients()\n return [] if response.empty?\n unless response[\"Code\"].to_i != 0\n response[\"Client\"].collect{|c| Client.new(c[\"ClientID\"].to_i, c[\"Name\"])}\n else\n raise response[\"Code\"] + \" - \" + response[\"Message\"]\n end\n end", "title": "" }, { "docid": "08dd348a2ffc989ef0b63fb6601f5045", "score": "0.63071233", "text": "def index\n get_clientes\n end", "title": "" }, { "docid": "b5c1ad443d3e93ba01ce6f7fd665479e", "score": "0.63003504", "text": "def index\n add_breadcrumb(I18n.t('model.list', model: Client.model_name.human))\n\n @clients = Client.all()\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clients }\n end\n end", "title": "" }, { "docid": "3120d4114f1d3ddef044095a5ba4bac3", "score": "0.62969804", "text": "def show\n @clientsOffers = ClientsOffers.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clientsOffers }\n end\n end", "title": "" }, { "docid": "efedcb73310475a0d9dc8771c20859dc", "score": "0.62854505", "text": "def index\n @apps = @client.apps\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @apps }\n end\n end", "title": "" }, { "docid": "a695eb024e0b4cb7fc2ee53954f13c96", "score": "0.62825733", "text": "def index\n @client_infos = ClientInfo.all\n end", "title": "" }, { "docid": "d6aadd40f954b9817c8fbd8ecd6baef2", "score": "0.62629247", "text": "def index\n \n @qa_clients = QaClient.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @qa_clients }\n end\n end", "title": "" }, { "docid": "05db46a5f05e0c85be5d3a3a345bd4a7", "score": "0.6257372", "text": "def client_list\n @clients.each do |item|\n puts \"List of clients:\"\n puts \"----------------------------------------------\"\n puts item.name\n end\n end", "title": "" }, { "docid": "02b3db4fff17e0389e859dc15c741cdc", "score": "0.62545246", "text": "def index\n puts params\n puts params[:filter]\n \n @clients = get_clients \n @client = Client.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clients }\n end\n end", "title": "" }, { "docid": "5f56eeb6fff563883afc64e48e7ad341", "score": "0.623452", "text": "def show\n\t\t@client = Client.find(params[:id])\n\t\tif @client.status != 0\n\t\t\trender :json => @client, status: 200\n\t\telse\n\t\t\trender :json => @client.status, status: 400\n\t\tend\n\tend", "title": "" }, { "docid": "c2ada59e271a14ab7fe6b3f654ec9c3a", "score": "0.623215", "text": "def clients\n @clients = Vendor.find(params[:id]).clients\n end", "title": "" }, { "docid": "3abfdc7c80aa7a60c41a72d9f39ce663", "score": "0.6227892", "text": "def index\n @clients = Client.page(params[:page] || 1).per(10)\n end", "title": "" }, { "docid": "1f259dad152869b0fbb7b3fd0a9cb34d", "score": "0.62228584", "text": "def set_live_client\n @live_client = LiveClient.find(params[:id])\n end", "title": "" }, { "docid": "2edc7867bdfeb1f39d766edd7356658f", "score": "0.62031937", "text": "def index\n @clientes = Cliente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clientes }\n end\n end", "title": "" }, { "docid": "663314c0913ba1163829bfe4567246c6", "score": "0.62003225", "text": "def show\n @blocking_client = BlockingClient.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @blocking_client }\n end\n end", "title": "" }, { "docid": "c08f08851a4c0ff67e672bffd88bc989", "score": "0.6178843", "text": "def show\n client = Client.retrieve_by_id(params[:id])\n\n render json: client, serializer: SingleClientSerializer\n end", "title": "" }, { "docid": "d892be7af47196a85e14070ac7ed0934", "score": "0.6146446", "text": "def index\n @members_clients = MembersClient.all\n end", "title": "" }, { "docid": "5488280423c30af3e684eb000d2e1483", "score": "0.6144043", "text": "def clients_index\n @clients = User.clients\n end", "title": "" }, { "docid": "3d2b793a736a136403682b5dc51036d9", "score": "0.61385095", "text": "def index\n @applicationclients = Applicationclient.all\n end", "title": "" }, { "docid": "912ed42e0a9bc6b51d0f5821a53fde81", "score": "0.61382276", "text": "def all_booking_of_client\n\t\t@bookings = Booking.where(client_id: params[:client_id])\n\t\trender json: @bookings, status: 200\n\tend", "title": "" }, { "docid": "f70b2268843ff54869d40bd6687c824b", "score": "0.6123492", "text": "def show\n id = shift_argument || raise(Heroku::Command::CommandFailed, \"Usage: clients:show [ID]\")\n\n client = request do\n api.request(\n :expects => 200,\n :headers => headers,\n :method => :get,\n :path => \"/oauth/clients/#{CGI.escape(id)}\"\n ).body\n end\n\n if options[:shell]\n puts \"HEROKU_OAUTH_ID=#{client[\"id\"]}\"\n puts \"HEROKU_OAUTH_SECRET=#{client[\"secret\"]}\"\n else\n styled_header(%{Client \"#{client[\"name\"]}\".})\n styled_hash(client)\n end\n end", "title": "" }, { "docid": "2b5c311b4db3ef9296be6a51c4dc4e5f", "score": "0.61083984", "text": "def dashboard\n @clients = current_user.clients\n end", "title": "" }, { "docid": "60e53de7d7c9e0d8ac77c19debf850c4", "score": "0.60855794", "text": "def index\n @clients = Client.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @client }\n end\n end", "title": "" }, { "docid": "94bdf9a2784d48a329728a78213cb9de", "score": "0.6081748", "text": "def index_clients\n @client = Client.all\n end", "title": "" }, { "docid": "cb5b998ed8a358ddc08dd8c1147b727c", "score": "0.60535777", "text": "def index\n @client_releases = ClientRelease.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @client_releases }\n end\n end", "title": "" }, { "docid": "d83679f6ee064696ab178827483a4717", "score": "0.60437715", "text": "def index\n @clients = Client.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @clients }\n end\n end", "title": "" }, { "docid": "25af51f43c7c46e259d658aebf9fe60e", "score": "0.6043318", "text": "def clients\n Harvest::Resources::Client\n end", "title": "" }, { "docid": "53fc7915dc777cc9fef096c39d487cef", "score": "0.60424674", "text": "def clients\n clis = []\n url = prefix + \"listc\"\n users = response(url)\n if users.class == Array #success\n users.each do |u|\n clis << User.new(u[\"id\"], @authid, @subdomain, u)\n end\n return clis\n else #failed\n return users\n end\n end", "title": "" }, { "docid": "35fa030b98b8b5b016093d4b5d2d3322", "score": "0.60401094", "text": "def index\n @conns = current_user.conns\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @conns }\n end\n end", "title": "" }, { "docid": "8a90fadc7431f9037afebfd238d31216", "score": "0.6036594", "text": "def index\n @clients = current_user.is_admin ? Client.all : current_user.clients\n end", "title": "" }, { "docid": "10b34bfc39f08c74c77556066e9fb65b", "score": "0.603441", "text": "def index\n @clientships = current_user.clientships.all \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clientships }\n end\n end", "title": "" }, { "docid": "f0ba1d6ee022b15ee78bb8d4dd6cc489", "score": "0.6012978", "text": "def index\n @campaigns = Campaign.where(:live => true)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @campaigns }\n end\n end", "title": "" }, { "docid": "08828c6d0d75f13419b558b1b2a7b46d", "score": "0.5990316", "text": "def clients\r\n ClientsController.instance\r\n end", "title": "" }, { "docid": "1d179bc700bbb984e930cb87c203513b", "score": "0.5980637", "text": "def show\n @player_client = PlayerClient.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @player_client }\n end\n end", "title": "" }, { "docid": "1bc943ed75d75b3bd427e79d2476e50d", "score": "0.5978827", "text": "def show\n @api_client = ApiClient.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @api_client }\n end\n end", "title": "" }, { "docid": "b48441439b8671418dff39081a8ad555", "score": "0.5978325", "text": "def all_clients\n resp = get CLIENT_API_PATH\n result = process_response(resp)\n return [] if result.empty? # In case response is {}\n result.each.map { |c| Resources::Client.new(c) }\n end", "title": "" }, { "docid": "f307292a88668c3dbcf15b93ab367cc3", "score": "0.5968188", "text": "def find_client\n cliente = get_cliente(params[:id])\n\n respond_to do |format|\n format.json {render json: {client: cliente}}\n end\n end", "title": "" }, { "docid": "fdc8808b9b8dd83ceb14324653aaf92d", "score": "0.59669936", "text": "def show\n @client = Client.find(params[:id])\n @contracts = Contract.where(:client_id => @client.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @client }\n end\n end", "title": "" }, { "docid": "1f2f44a39f539d748247ccc6ed730fd5", "score": "0.59634125", "text": "def clients\n @clients ||= Harvest::API::Clients.new(credentials)\n end", "title": "" }, { "docid": "5c865a0fd19290168d40624e73f34646", "score": "0.59403443", "text": "def show\n @client = Client.find(params[:id])\n if @client.nil?\n @clients = Client.all\n flash.now[:alert] = \"Les détails du client n'ont pas été trouvés\"\n render \"index\"\n end\n respond_to do |format|\n format.html #show.html.erb\n format.xml { render :xml => @client }\n end\n end", "title": "" }, { "docid": "c5455e5d95dc1c42ea13df69a85f7eeb", "score": "0.59243006", "text": "def get_clients_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AuthClientsApi.get_clients ...\"\n end\n # resource path\n local_var_path = \"/auth/clients\"\n\n # query parameters\n query_params = {}\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageResourceClientResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AuthClientsApi#get_clients\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "08e84315c461e500475b90acdb6e7484", "score": "0.59193933", "text": "def index\n add_breadcrumb(I18n.t('model.list', model: Client.model_name.human))\n\n @clients = current_space.clients\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clients_grid }\n end\n end", "title": "" }, { "docid": "9ab089d911b26dc34208f24a488ec172", "score": "0.591558", "text": "def index\n @clients = current_user.account.clients.search(params[:search]).order(sort_column + \" \" + sort_direction).paginate(:per_page => 10, :page => params[:page])\n\n @account = current_user.account\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clients }\n end\n end", "title": "" }, { "docid": "cf79098425393b4969ead92d388d02fc", "score": "0.59133357", "text": "def show\n @client = Client.find(params[:id])\n @uuid = params[:uuid]\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client }\n end\n end", "title": "" }, { "docid": "d524188c7ec561e348adff6526716a4d", "score": "0.59120566", "text": "def show\n @my_studio_client = MyStudio::Client.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @my_studio_client }\n end\n end", "title": "" }, { "docid": "44795f8ec104edb9fc10ea8f0c89374f", "score": "0.59027845", "text": "def info &block\n em_get( \"/clients/#{uuid}\" ) { |response| block.call( response ) }\n end", "title": "" }, { "docid": "9dd6fff6fb33aa5394923f33fca6d422", "score": "0.5894001", "text": "def allclient\n @clients = Client.where(is_client:true)\n end", "title": "" }, { "docid": "b696e56d0ceb3ad9132e3cbcc74d1c0f", "score": "0.5886216", "text": "def new\n session[:current] = 'menu_clients'\n @client = Client.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @client }\n end\n end", "title": "" }, { "docid": "76b6e89b5d9d4e9e8532ec40ed2a3409", "score": "0.5885102", "text": "def create\n @live_client = LiveClient.new(live_client_params)\n\n respond_to do |format|\n if @live_client.save\n format.html { redirect_to @live_client, notice: 'Live client was successfully created.' }\n format.json { render :show, status: :created, location: @live_client }\n else\n format.html { render :new }\n format.json { render json: @live_client.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ea4069d1f0075ac16dc8bbf93b89996c", "score": "0.587849", "text": "def index\n if current_admin.present?\n @clients = Client.all\n @client = Client.new\n\n #Total Visits\n @visits = Visit.all\n @temp = @visits.group_by { |t| t.created_at.beginning_of_month } \n respond_to do |format|\n \t\tformat.html # index.html.erb\n \t\tformat.json { render json: @clients }\n \tend\n else\n redirect_to new_admin_session_path and return\n end \n end", "title": "" }, { "docid": "67c776aef81e5ac817328b7f946c9e05", "score": "0.5871408", "text": "def show\n @qa_client = QaClient.find(params[:id])\n @qa_activities = @qa_client.qa_activities\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @qa_client }\n end\n end", "title": "" }, { "docid": "e7c02ee7029d030e189475cca819723b", "score": "0.58595777", "text": "def index\n @clients = Client.all.order(created_at: :desc)\n end", "title": "" }, { "docid": "c348d695f07af49033144fc6b38ac3af", "score": "0.58583874", "text": "def index\n if is_client_app?\n if params[:user_id].present?\n t = Subscription.arel_table\n s = Subscription.statuses\n @subscriptions = Subscription.where(user_id: params[:user_id]).where(t[:status].eq(s[:authorized]).or(t[:status].eq(s[:paused])))\n else\n @subscriptions = Subscription.all\n end\n\n render json: @subscriptions\n else\n response.headers['X-Total-Count'] = @subscriptions.count.to_s\n @subscriptions = @subscriptions.page(params[:page]) if params[:page].present?\n @subscriptions = @subscriptions.per(params[:per]) if params[:per].present?\n\n _render collection: @subscriptions, flag: params[:flag].try(:to_sym)\n end\n end", "title": "" }, { "docid": "a2658ea16a92d9976e49d84defb22789", "score": "0.5856598", "text": "def servers\n response = self.class.get(\"/#{self.class.account}/clients.xml\")\n response['clients'].map { |client| ScoutScout::Server.new(client) }\n end", "title": "" }, { "docid": "04bd10f0fc8908bb1772aa2aa434a0c9", "score": "0.5855181", "text": "def new\n @client = Client.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @client }\n end\n end", "title": "" }, { "docid": "04bd10f0fc8908bb1772aa2aa434a0c9", "score": "0.5855181", "text": "def new\n @client = Client.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @client }\n end\n end", "title": "" }, { "docid": "04bd10f0fc8908bb1772aa2aa434a0c9", "score": "0.5855181", "text": "def new\n @client = Client.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @client }\n end\n end", "title": "" }, { "docid": "04bd10f0fc8908bb1772aa2aa434a0c9", "score": "0.5855181", "text": "def new\n @client = Client.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @client }\n end\n end", "title": "" }, { "docid": "fde9618e2d618fe6f726ea121a19b8bb", "score": "0.5845205", "text": "def show\n @online_service = OnlineService.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @online_service }\n end\n end", "title": "" }, { "docid": "ceb5acd5f5d613aacf36882db681d94b", "score": "0.58429974", "text": "def show\n client = Client.find(params[:id])\n notifications = Notification.all\n client_notifications = notifications\n .select { |notification| client.companies.include? notification.company }\n render json: client_notifications\n end", "title": "" } ]
6d6da27e335909ce70cc98b71432d422
Delete Metadata Proxy Config API will delete Metadata Proxy Config with ID profileid
[ { "docid": "7eb3193baf4c4aec0bca2e2a051af873", "score": "0.687189", "text": "def delete_metadata_proxy_config(metadata_proxy_id, opts = {})\n delete_metadata_proxy_config_with_http_info(metadata_proxy_id, opts)\n nil\n end", "title": "" } ]
[ { "docid": "3b6b405eef19ad323108301331ed840a", "score": "0.6884308", "text": "def delete_metadata_proxy_config_0(metadata_proxy_id, opts = {})\n delete_metadata_proxy_config_0_with_http_info(metadata_proxy_id, opts)\n nil\n end", "title": "" }, { "docid": "09d8ed2c62cbac8372f603e6a4eb32c6", "score": "0.67026293", "text": "def delete_metadata_proxy_config_with_http_info(metadata_proxy_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesMetadataProxyApi.delete_metadata_proxy_config ...'\n end\n # verify the required parameter 'metadata_proxy_id' is set\n if @api_client.config.client_side_validation && metadata_proxy_id.nil?\n fail ArgumentError, \"Missing the required parameter 'metadata_proxy_id' when calling PolicyNetworkingNetworkServicesMetadataProxyApi.delete_metadata_proxy_config\"\n end\n # resource path\n local_var_path = '/infra/metadata-proxies/{metadata-proxy-id}'.sub('{' + 'metadata-proxy-id' + '}', metadata_proxy_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesMetadataProxyApi#delete_metadata_proxy_config\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "345af88268b1ff92c2c505c69c776cc0", "score": "0.65952677", "text": "def delete_metadata_proxy_config_0_with_http_info(metadata_proxy_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesMetadataProxyApi.delete_metadata_proxy_config_0 ...'\n end\n # verify the required parameter 'metadata_proxy_id' is set\n if @api_client.config.client_side_validation && metadata_proxy_id.nil?\n fail ArgumentError, \"Missing the required parameter 'metadata_proxy_id' when calling PolicyNetworkingNetworkServicesMetadataProxyApi.delete_metadata_proxy_config_0\"\n end\n # resource path\n local_var_path = '/global-infra/metadata-proxies/{metadata-proxy-id}'.sub('{' + 'metadata-proxy-id' + '}', metadata_proxy_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesMetadataProxyApi#delete_metadata_proxy_config_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "8ed967bb906fe86406a56019722d896a", "score": "0.6489744", "text": "def destroy\n @proxy_configuration = ProxyConfiguration.find(params[:id])\n @proxy_configuration.destroy\n\n respond_to do |format|\n format.html { redirect_to proxy_configurations_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7fbc32750c67ccfecae9202de73d2036", "score": "0.64038974", "text": "def delete_profile(service_name, service_profile_id)\n # I'm using raw=true b/c singly api returns the value true which is not a\n # valid JSON value\n post(profiles_path, {:delete => \"#{service_profile_id}@#{service_name.to_s}\"}, raw=true)\n end", "title": "" }, { "docid": "382d50b9facb71ab3bf1fb86a29acd28", "score": "0.61589384", "text": "def remove_profile_image_by_profile_id(profile_id)\n path = \"/d2l/api/lp/#{$lp_ver}/profile/#{profile_id}/image\"\n _delete(path)\nend", "title": "" }, { "docid": "cef7fdac0b52acf2ed68cc5deac042ed", "score": "0.613157", "text": "def delete_profile(id)\r\n # Prepare query url.\r\n _path_url = '/profiles/{id}'\r\n _path_url = APIHelper.append_url_with_template_parameters(\r\n _path_url,\r\n 'id' => id\r\n )\r\n _query_builder = Configuration.get_base_uri\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.delete(\r\n _query_url,\r\n headers: _headers\r\n )\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n Message.from_hash(decoded)\r\n end", "title": "" }, { "docid": "a8987ddd34995dcb746f35f5714c5ec9", "score": "0.6109692", "text": "def metadata_delete(metadata_id)\n params = {\n :id => metadata_id\n }\n call_method('Metadata.Delete', params)\n end", "title": "" }, { "docid": "92d20b6202d752dadb42385dacaf2d19", "score": "0.6098089", "text": "def delete_metadata_proxy_with_http_info(proxy_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ServicesApi.delete_metadata_proxy ...\"\n end\n # verify the required parameter 'proxy_id' is set\n if @api_client.config.client_side_validation && proxy_id.nil?\n fail ArgumentError, \"Missing the required parameter 'proxy_id' when calling ServicesApi.delete_metadata_proxy\"\n end\n # resource path\n local_var_path = \"/md-proxies/{proxy-id}\".sub('{' + 'proxy-id' + '}', proxy_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ServicesApi#delete_metadata_proxy\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "92d20b6202d752dadb42385dacaf2d19", "score": "0.6098089", "text": "def delete_metadata_proxy_with_http_info(proxy_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ServicesApi.delete_metadata_proxy ...\"\n end\n # verify the required parameter 'proxy_id' is set\n if @api_client.config.client_side_validation && proxy_id.nil?\n fail ArgumentError, \"Missing the required parameter 'proxy_id' when calling ServicesApi.delete_metadata_proxy\"\n end\n # resource path\n local_var_path = \"/md-proxies/{proxy-id}\".sub('{' + 'proxy-id' + '}', proxy_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ServicesApi#delete_metadata_proxy\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "dd5c40fddaa22434bf9acc8e0de7a9ba", "score": "0.6096915", "text": "def delete_dhcp_profile_with_http_info(profile_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ServicesApi.delete_dhcp_profile ...\"\n end\n # verify the required parameter 'profile_id' is set\n if @api_client.config.client_side_validation && profile_id.nil?\n fail ArgumentError, \"Missing the required parameter 'profile_id' when calling ServicesApi.delete_dhcp_profile\"\n end\n # resource path\n local_var_path = \"/dhcp/server-profiles/{profile-id}\".sub('{' + 'profile-id' + '}', profile_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ServicesApi#delete_dhcp_profile\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "dd5c40fddaa22434bf9acc8e0de7a9ba", "score": "0.6096915", "text": "def delete_dhcp_profile_with_http_info(profile_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ServicesApi.delete_dhcp_profile ...\"\n end\n # verify the required parameter 'profile_id' is set\n if @api_client.config.client_side_validation && profile_id.nil?\n fail ArgumentError, \"Missing the required parameter 'profile_id' when calling ServicesApi.delete_dhcp_profile\"\n end\n # resource path\n local_var_path = \"/dhcp/server-profiles/{profile-id}\".sub('{' + 'profile-id' + '}', profile_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ServicesApi#delete_dhcp_profile\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "d88beb1170f19b06563164f4e7aadcf8", "score": "0.6089257", "text": "def delete_silo_profile name, id\n using_name = (name and not name.empty?)\n xml = make_xml('SiloProfileDeleteRequest', (using_name ? {'name' => name} : {'silo-profile-id' => id}))\n r = execute xml, '1.2'\n r.success\n end", "title": "" }, { "docid": "aba14faad619bc953e13dbe563c3b7c0", "score": "0.60792834", "text": "def delete_metadata_proxy_with_http_info(proxy_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiServicesMetadataProxyApi.delete_metadata_proxy ...'\n end\n # verify the required parameter 'proxy_id' is set\n if @api_client.config.client_side_validation && proxy_id.nil?\n fail ArgumentError, \"Missing the required parameter 'proxy_id' when calling ManagementPlaneApiServicesMetadataProxyApi.delete_metadata_proxy\"\n end\n # resource path\n local_var_path = '/md-proxies/{proxy-id}'.sub('{' + 'proxy-id' + '}', proxy_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiServicesMetadataProxyApi#delete_metadata_proxy\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "2121cc85c802cdcd45f3fe55bfb76017", "score": "0.6029018", "text": "def delete_metadata_proxy(proxy_id, opts = {})\n delete_metadata_proxy_with_http_info(proxy_id, opts)\n nil\n end", "title": "" }, { "docid": "b0da595a495a63e436bb237643cd840d", "score": "0.6001758", "text": "def delete_dns_security_profile_0_with_http_info(profile_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicySecuritySecurityProfilesDNSSecurityProfilesApi.delete_dns_security_profile_0 ...'\n end\n # verify the required parameter 'profile_id' is set\n if @api_client.config.client_side_validation && profile_id.nil?\n fail ArgumentError, \"Missing the required parameter 'profile_id' when calling PolicySecuritySecurityProfilesDNSSecurityProfilesApi.delete_dns_security_profile_0\"\n end\n # resource path\n local_var_path = '/global-infra/dns-security-profiles/{profile-id}'.sub('{' + 'profile-id' + '}', profile_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'override'] = opts[:'override'] if !opts[:'override'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicySecuritySecurityProfilesDNSSecurityProfilesApi#delete_dns_security_profile_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "616d978a66210748c43f162e20db1c9b", "score": "0.59561515", "text": "def test_test_delete_profile()\r\n # Parameters for the API call\r\n id = '3fa85f64-5717-4562-b3fc-2c963f66afa6'\r\n\r\n # Perform the API call through the SDK function\r\n result = self.class.controller.delete_profile(id)\r\n\r\n # Test response code\r\n assert_equal(@response_catcher.response.status_code, 200)\r\n\r\n # Test headers\r\n expected_headers = {}\r\n expected_headers['content-type'] = 'application/json'\r\n\r\n assert(TestHelper.match_headers(expected_headers, @response_catcher.response.headers))\r\n end", "title": "" }, { "docid": "2f6f57031dbc16815e7efd40f35063d1", "score": "0.5952783", "text": "def destroy\n @config = Config.find(params[:id])\n @config.destroy\n \n respond_to do |format|\n format.html { redirect_to configs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ffa54ebaaa03a69c05f435124620e13c", "score": "0.59527475", "text": "def delete_profile(path)\n _method = :Delete\n _path = path\n _headers = { \"Content-Type\" => \"application/json\" }\n _response = send_request(_path, _method, _headers, nil)\n\n _response.code == 200 ? true : parse_error_response(_response)\n end", "title": "" }, { "docid": "c2c21cb8a3b03cedbb0d475df3b4a02d", "score": "0.5946716", "text": "def delete_metadata_proxy(proxy_id, opts = {})\n delete_metadata_proxy_with_http_info(proxy_id, opts)\n return nil\n end", "title": "" }, { "docid": "c2c21cb8a3b03cedbb0d475df3b4a02d", "score": "0.5946716", "text": "def delete_metadata_proxy(proxy_id, opts = {})\n delete_metadata_proxy_with_http_info(proxy_id, opts)\n return nil\n end", "title": "" }, { "docid": "da164806ab970815adf505b85ea4568c", "score": "0.5944165", "text": "def delete_dhcp_profile_with_http_info(profile_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiServicesDhcpApi.delete_dhcp_profile ...'\n end\n # verify the required parameter 'profile_id' is set\n if @api_client.config.client_side_validation && profile_id.nil?\n fail ArgumentError, \"Missing the required parameter 'profile_id' when calling ManagementPlaneApiServicesDhcpApi.delete_dhcp_profile\"\n end\n # resource path\n local_var_path = '/dhcp/server-profiles/{profile-id}'.sub('{' + 'profile-id' + '}', profile_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiServicesDhcpApi#delete_dhcp_profile\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "f6014de0451f4de36eebb46658ac5b79", "score": "0.59408927", "text": "def delete_component_profile(opts)\n # Find the profile\n id = opts[:query]['id']\n profile = Blob.find_by_id(id)\n if profile.nil? || !profile.component_profile?\n return rest_response(404, :reason => \"Couldn't find a valid component profile with the given ID\")\n end\n\n # Check if profile is used in any component families\n families = PackContributableEntry.find_all_by_contributable_type_and_contributable_id('Blob', profile.id).select do |e|\n e.pack.component_family?\n end\n if families.size == 0\n # Delete profile\n profile.destroy\n\n rest_get_request(profile, opts[:user], opts[:query])\n else\n profile.errors.add_to_base(\"This component profile is used by #{families.size} component families and may not be deleted.\")\n rest_response(400, :object => profile)\n end\nend", "title": "" }, { "docid": "9e7e1bc807f238fa7958c371900d03b2", "score": "0.5936844", "text": "def delete_dns_security_profile_with_http_info(profile_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicySecuritySecurityProfilesDNSSecurityProfilesApi.delete_dns_security_profile ...'\n end\n # verify the required parameter 'profile_id' is set\n if @api_client.config.client_side_validation && profile_id.nil?\n fail ArgumentError, \"Missing the required parameter 'profile_id' when calling PolicySecuritySecurityProfilesDNSSecurityProfilesApi.delete_dns_security_profile\"\n end\n # resource path\n local_var_path = '/infra/dns-security-profiles/{profile-id}'.sub('{' + 'profile-id' + '}', profile_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'override'] = opts[:'override'] if !opts[:'override'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicySecuritySecurityProfilesDNSSecurityProfilesApi#delete_dns_security_profile\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "7fe4370cbc29c2e084c2319828197c3d", "score": "0.5885052", "text": "def destroy\n @profile_addon = ProfileAddon.find(params[:id])\n @profile_addon.destroy\n\n respond_to do |format|\n format.html { redirect_to(profile_addons_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "449b667bf09fea14bddfd952c50c87ec", "score": "0.5854728", "text": "def destroy\n @profile.destroy\n redirect_to admin_cert_profiles_path, notice: 'Profile was successfully destroyed.'\n end", "title": "" }, { "docid": "7181b626d46969e69fa68272fc461a46", "score": "0.58359057", "text": "def delete_silo_profile(silo_profile_id)\n r = execute(make_xml('SiloProfileDeleteRequest', { 'silo-profile-id' => silo_profile_id }), '1.2')\n r.success\n end", "title": "" }, { "docid": "6aeef463763d991155b0991076477468", "score": "0.58232343", "text": "def destroy\n @auth_config = AuthConfig.find(params[:id])\n @auth_config.destroy\n\n respond_to do |format|\n format.html { redirect_to auth_configs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c00957164a11f4554b0fb34d7ca93ec0", "score": "0.57917297", "text": "def delete_app_profile_with_http_info(app_profile_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiAppDiscoveryApi.delete_app_profile ...'\n end\n # verify the required parameter 'app_profile_id' is set\n if @api_client.config.client_side_validation && app_profile_id.nil?\n fail ArgumentError, \"Missing the required parameter 'app_profile_id' when calling ManagementPlaneApiAppDiscoveryApi.delete_app_profile\"\n end\n # resource path\n local_var_path = '/app-discovery/app-profiles/{app-profile-id}'.sub('{' + 'app-profile-id' + '}', app_profile_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'force'] = opts[:'force'] if !opts[:'force'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiAppDiscoveryApi#delete_app_profile\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "4660d36d2ad03491f4b81f2e2cd7df22", "score": "0.57610327", "text": "def delete_ids_profile_0_with_http_info(profile_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicySecurityEastWestSecurityDistributedIdsProfilesApi.delete_ids_profile_0 ...'\n end\n # verify the required parameter 'profile_id' is set\n if @api_client.config.client_side_validation && profile_id.nil?\n fail ArgumentError, \"Missing the required parameter 'profile_id' when calling PolicySecurityEastWestSecurityDistributedIdsProfilesApi.delete_ids_profile_0\"\n end\n # resource path\n local_var_path = '/infra/settings/firewall/security/intrusion-services/profiles/{profile-id}'.sub('{' + 'profile-id' + '}', profile_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicySecurityEastWestSecurityDistributedIdsProfilesApi#delete_ids_profile_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "da71bcc0b318437b10c99892640b4bc3", "score": "0.57343435", "text": "def delete_config_change\n uri = URI.parse(\"#{@endpoint['url']}/config/change\")\n request = Net::HTTP::Delete.new(uri.request_uri)\n request.basic_auth(@endpoint_auth['user'], @endpoint_auth['password'])\n response = @http.request(request)\n end", "title": "" }, { "docid": "b8b48d1c46fa284a616357dff308c923", "score": "0.5712864", "text": "def destroy\n @user_config = UserConfig.find(params[:id])\n @user_config.destroy\n\n respond_to do |format|\n format.html { redirect_to user_configs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6083ea386fcd0418d8f9e6de5ff85862", "score": "0.5705672", "text": "def delete_metadata(appliance_type)\n return unless can_write and appliance_type\n status, response = do_http(server_endpoint + appliance_type.metadata_global_id.to_s, :delete)\n status ? logme(\"Response body: #{response.body}\") : logme_problem\n status\n end", "title": "" }, { "docid": "81b0e2910eef341077f162fe315c195b", "score": "0.5702007", "text": "def destroy\n @data_config = DataConfig.find(params[:id])\n @data_config.destroy\n\n respond_to do |format|\n format.html { redirect_to :back } #data_configs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "17a72e61e49c4027e15c243d8328a7e2", "score": "0.569924", "text": "def delete_metadata(key_name)\n requires :id\n service.delete_metadata(id, key_name)\n true\n end", "title": "" }, { "docid": "cc23418f42a7c21141dd9c4696a6d05a", "score": "0.56872344", "text": "def delete_config_service(service)\n service_enc = URI.encode(service, ENCODE) if service\n uri = URI.parse(\"#{@endpoint['url']}/config/service/#{service_enc}\")\n request = Net::HTTP::Delete.new(uri.path)\n request.basic_auth(@endpoint_auth['user'], @endpoint_auth['password'])\n response = @http.request(request)\n end", "title": "" }, { "docid": "e65d2f957903fb0ee39733cbb8dfe145", "score": "0.56716514", "text": "def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n end", "title": "" }, { "docid": "254768503d6804b8f3517a5fe83ebf96", "score": "0.56683016", "text": "def destroy\n @profile.destroy\n\n respond_with @profile, location: -> { admin_root_path }\n end", "title": "" }, { "docid": "b606c0ca85c5c9b86becddc9f94542b0", "score": "0.56607157", "text": "def destroy\n @config.destroy\n respond_to do |format|\n format.html { redirect_to configs_path, notice: '记录已经删除!' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "055d6fbbba506b05358bb49107ca6f1c", "score": "0.5655363", "text": "def destroy\n @profile.destroy\n end", "title": "" }, { "docid": "055d6fbbba506b05358bb49107ca6f1c", "score": "0.5655363", "text": "def destroy\n @profile.destroy\n end", "title": "" }, { "docid": "5cfb7711520d9e397556b63a68a8bff1", "score": "0.56529194", "text": "def destroy\n @profile.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "5cfb7711520d9e397556b63a68a8bff1", "score": "0.56529194", "text": "def destroy\n @profile.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "5cfb7711520d9e397556b63a68a8bff1", "score": "0.56529194", "text": "def destroy\n @profile.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "5cfb7711520d9e397556b63a68a8bff1", "score": "0.56529194", "text": "def destroy\n @profile.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "02aa5855448c9d1ec0c977b751f645fa", "score": "0.5650286", "text": "def delete_ids_profile_with_http_info(profile_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicySecurityEastWestSecurityDistributedIdsProfilesApi.delete_ids_profile ...'\n end\n # verify the required parameter 'profile_id' is set\n if @api_client.config.client_side_validation && profile_id.nil?\n fail ArgumentError, \"Missing the required parameter 'profile_id' when calling PolicySecurityEastWestSecurityDistributedIdsProfilesApi.delete_ids_profile\"\n end\n # resource path\n local_var_path = '/global-infra/settings/firewall/security/intrusion-services/profiles/{profile-id}'.sub('{' + 'profile-id' + '}', profile_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicySecurityEastWestSecurityDistributedIdsProfilesApi#delete_ids_profile\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "3f0ad6bd7b0e270f0d256113b7bc0929", "score": "0.56471646", "text": "def destroy\n @profile_setting.destroy\n respond_to do |format|\n format.html { redirect_to profile_settings_url, notice: 'Profile setting was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2a2f4a8970aa88cdf1d836aeb5fc5421", "score": "0.56444186", "text": "def delete_bridge_endpoint_profile_with_http_info(bridgeendpointprofile_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: NetworkTransportApi.delete_bridge_endpoint_profile ...\"\n end\n # verify the required parameter 'bridgeendpointprofile_id' is set\n if @api_client.config.client_side_validation && bridgeendpointprofile_id.nil?\n fail ArgumentError, \"Missing the required parameter 'bridgeendpointprofile_id' when calling NetworkTransportApi.delete_bridge_endpoint_profile\"\n end\n # resource path\n local_var_path = \"/bridge-endpoint-profiles/{bridgeendpointprofile-id}\".sub('{' + 'bridgeendpointprofile-id' + '}', bridgeendpointprofile_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: NetworkTransportApi#delete_bridge_endpoint_profile\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "8833ea66c4e8ba2f90b9bb805a4f0b0b", "score": "0.56427646", "text": "def destroy\n @app_config = AppConfig.find(params[:id])\n @app_config.destroy\n\n respond_to do |format|\n format.html { redirect_to app_configs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "337ba305139a20ad09d6dcb5999b9d0c", "score": "0.5637998", "text": "def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to(admins_profiles_path) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "5c95044d053dba169edc0325cdb388f5", "score": "0.56370306", "text": "def netsh_dp(profile_name, nicname=\"Wireless\")\n result= \"删除配置文件\".to_utf8\n rs=`netsh wlan delete profile name=\"#{profile_name}\" interface=\"#{nicname}\"`\n if rs=~/#{result}/\n return true\n else\n puts rs\n return false\n end\n end", "title": "" }, { "docid": "7e30fc289253d942d23f849a40c21f29", "score": "0.5633261", "text": "def destroy\n @configattrib.destroy\n respond_to do |format|\n format.html { redirect_to configattribs_url, notice: 'Configattrib was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1e44b7c161fd1ba8aceed44bcdde3400", "score": "0.5633061", "text": "def delete\n\n profile_name = args.first\n profile = profiles[profile_name]\n\n if profile.blank?\n display \"Please supply the name of the profile you'd like to delete\"\n self.list\n return false\n end\n profiles.delete(profile_name)\n save_profiles(profiles)\n display \"#{profile_name} has been deleted\"\n end", "title": "" }, { "docid": "ab8f2cf6b6bbe20ccbc0de5339981070", "score": "0.56293046", "text": "def destroy\n if @configuration_detail_type.destroy\n head :ok\n end\n end", "title": "" }, { "docid": "082ac7078ce9d147ebb657e0c09b44e3", "score": "0.56257737", "text": "def destroy\n @admin_config = Admin::Config.find(params[:id])\n @admin_config.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_configs_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "88a1a4ef1a2d665d431fe42e6ed8fc2f", "score": "0.5622223", "text": "def delete_relay_proxy_config_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: RelayProxyConfigurationsApi.delete_relay_proxy_config ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling RelayProxyConfigurationsApi.delete_relay_proxy_config\"\n end\n # resource path\n local_var_path = '/account/relay-auto-configs/{id}'.sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['Token']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RelayProxyConfigurationsApi#delete_relay_proxy_config\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "c27b8a260bc8147d367f4dcbd62e5cae", "score": "0.5622149", "text": "def destroy\n @config.destroy\n respond_to do |format|\n format.html { redirect_to configs_url, notice: 'Configuration was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "32850b09125344184492d627e34f233b", "score": "0.56202793", "text": "def destroy\n @config.destroy\n respond_to do |format|\n format.html { head :no_content}\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7108887186b0755633ca7f57fd7078d1", "score": "0.5615186", "text": "def destroy\n\n\t\t @profile = Profile.find(params[:id])\n\t\t @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_path }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c536f9685f9284a332af9d5e55682719", "score": "0.5608204", "text": "def purge_desc_metadata(obj)\n cmd = \"curl -u %{user}:%{password} -X DELETE %{url}/objects/%{pid}/datastreams/descMetadata\"\n if system(cmd % ActiveFedora.config.credentials.merge(pid: obj.pid))\n puts \"Purged #{obj.pid}/descMetadata datastream\"\n else\n raise \"Purge of #{obj.pid}/descMetadata datastream failed\"\n end\nend", "title": "" }, { "docid": "0781d83f21511e5b631f419a5dc20dc5", "score": "0.5606799", "text": "def destroy\n proxy_for(config).delete(resource_path)\n end", "title": "" }, { "docid": "1bb0cea62a72052779cd130a2ced870b", "score": "0.56034356", "text": "def delete_customer_profile(input)\n \tdata = build_request('deleteCustomerProfileRequest') do |xml|\n \t xml.refId input[:ref_id] if input[:ref_id]\n xml.customerProfileId input[:customer_profile_id] if input[:customer_profile_id]\n end \n parse send(data)\n end", "title": "" }, { "docid": "e889102589454c9f7511cfdf69ca007b", "score": "0.55962664", "text": "def delete_bridge_endpoint_profile_with_http_info(bridgeendpointprofile_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiNetworkTransportBridgeEndpointProfilesApi.delete_bridge_endpoint_profile ...'\n end\n # verify the required parameter 'bridgeendpointprofile_id' is set\n if @api_client.config.client_side_validation && bridgeendpointprofile_id.nil?\n fail ArgumentError, \"Missing the required parameter 'bridgeendpointprofile_id' when calling ManagementPlaneApiNetworkTransportBridgeEndpointProfilesApi.delete_bridge_endpoint_profile\"\n end\n # resource path\n local_var_path = '/bridge-endpoint-profiles/{bridgeendpointprofile-id}'.sub('{' + 'bridgeendpointprofile-id' + '}', bridgeendpointprofile_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiNetworkTransportBridgeEndpointProfilesApi#delete_bridge_endpoint_profile\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "e64b130b27815d1a6d82851192a5aaab", "score": "0.5583699", "text": "def destroy\n @profile = UserProfile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_profiles_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a24369ade1e32b3891073e69b7fa2a11", "score": "0.55811864", "text": "def destroy\n @pims_config.destroy\n respond_to do |format|\n format.html { redirect_to pims_configs_url, notice: 'Pims config was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a1df932fc9d96259e62430ab021cd25e", "score": "0.55749387", "text": "def destroy\n authorize! :admin, :site\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "a1df932fc9d96259e62430ab021cd25e", "score": "0.55749387", "text": "def destroy\n authorize! :admin, :site\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "0e0fa7af0450673f61cad0b04935d872", "score": "0.5574601", "text": "def destroy\n @image_config = ImageConfig.find(params[:id])\n @image_config.destroy\n\n respond_to do |format|\n format.html { redirect_to image_configs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d53f3eeb5995e971159499020cfb6289", "score": "0.5569721", "text": "def delete_relationship(id)\n @client.raw('delete', \"/config/relationships/#{id}\")\n end", "title": "" }, { "docid": "92f69e1108ea9e501c75e862a9392513", "score": "0.5562211", "text": "def delete_ip_sec_vpn_tunnel_profile_0_with_http_info(tunnel_profile_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNIPSECIPSECProfilesApi.delete_ip_sec_vpn_tunnel_profile_0 ...'\n end\n # verify the required parameter 'tunnel_profile_id' is set\n if @api_client.config.client_side_validation && tunnel_profile_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tunnel_profile_id' when calling PolicyNetworkingNetworkServicesVPNIPSECIPSECProfilesApi.delete_ip_sec_vpn_tunnel_profile_0\"\n end\n # resource path\n local_var_path = '/global-infra/ipsec-vpn-tunnel-profiles/{tunnel-profile-id}'.sub('{' + 'tunnel-profile-id' + '}', tunnel_profile_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesVPNIPSECIPSECProfilesApi#delete_ip_sec_vpn_tunnel_profile_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "c2aef5da3309aac7b8846db3d4c763ea", "score": "0.5554737", "text": "def destroy\n @config.destroy\n respond_to do |format|\n format.html { redirect_to configs_url, notice: 'Config was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c2aef5da3309aac7b8846db3d4c763ea", "score": "0.5554737", "text": "def destroy\n @config.destroy\n respond_to do |format|\n format.html { redirect_to configs_url, notice: 'Config was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c2aef5da3309aac7b8846db3d4c763ea", "score": "0.5554737", "text": "def destroy\n @config.destroy\n respond_to do |format|\n format.html { redirect_to configs_url, notice: 'Config was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "85d6daa0bdaddcb8dfacf1f0ad7c12ae", "score": "0.5553599", "text": "def destroy\n @device_config = Probe::DeviceConfig.find(params[:id])\n @device_config.destroy\n\n respond_to do |format|\n format.html { redirect_to(device_configs_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "c1f7f05484457e90d67c72dc6d9b391e", "score": "0.55535907", "text": "def delete_profile\n super\n end", "title": "" }, { "docid": "c1f7f05484457e90d67c72dc6d9b391e", "score": "0.55535907", "text": "def delete_profile\n super\n end", "title": "" }, { "docid": "c1f7f05484457e90d67c72dc6d9b391e", "score": "0.55535907", "text": "def delete_profile\n super\n end", "title": "" }, { "docid": "c1f7f05484457e90d67c72dc6d9b391e", "score": "0.55535907", "text": "def delete_profile\n super\n end", "title": "" }, { "docid": "c1f7f05484457e90d67c72dc6d9b391e", "score": "0.55535907", "text": "def delete_profile\n super\n end", "title": "" }, { "docid": "c1f7f05484457e90d67c72dc6d9b391e", "score": "0.55535907", "text": "def delete_profile\n super\n end", "title": "" }, { "docid": "c1f7f05484457e90d67c72dc6d9b391e", "score": "0.55535907", "text": "def delete_profile\n super\n end", "title": "" }, { "docid": "c1f7f05484457e90d67c72dc6d9b391e", "score": "0.55535907", "text": "def delete_profile\n super\n end", "title": "" }, { "docid": "c1f7f05484457e90d67c72dc6d9b391e", "score": "0.55535907", "text": "def delete_profile\n super\n end", "title": "" }, { "docid": "c1f7f05484457e90d67c72dc6d9b391e", "score": "0.55535907", "text": "def delete_profile\n super\n end", "title": "" }, { "docid": "c1f7f05484457e90d67c72dc6d9b391e", "score": "0.55535907", "text": "def delete_profile\n super\n end", "title": "" }, { "docid": "c1f7f05484457e90d67c72dc6d9b391e", "score": "0.55535907", "text": "def delete_profile\n super\n end", "title": "" }, { "docid": "c1f7f05484457e90d67c72dc6d9b391e", "score": "0.55535907", "text": "def delete_profile\n super\n end", "title": "" }, { "docid": "c1f7f05484457e90d67c72dc6d9b391e", "score": "0.55535907", "text": "def delete_profile\n super\n end", "title": "" }, { "docid": "c1f7f05484457e90d67c72dc6d9b391e", "score": "0.55535907", "text": "def delete_profile\n super\n end", "title": "" }, { "docid": "a88b557141f68eb551cb5288ea59899c", "score": "0.55528736", "text": "def destroy\n @testconfig.destroy\n respond_to do |format|\n format.html { redirect_to testconfigs_url, notice: 'Config was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d7cb20061ebc96d3a6225c37d2e69ad8", "score": "0.55459666", "text": "def delete_ip_sec_vpn_tunnel_profile_with_http_info(tunnel_profile_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNIPSECIPSECProfilesApi.delete_ip_sec_vpn_tunnel_profile ...'\n end\n # verify the required parameter 'tunnel_profile_id' is set\n if @api_client.config.client_side_validation && tunnel_profile_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tunnel_profile_id' when calling PolicyNetworkingNetworkServicesVPNIPSECIPSECProfilesApi.delete_ip_sec_vpn_tunnel_profile\"\n end\n # resource path\n local_var_path = '/infra/ipsec-vpn-tunnel-profiles/{tunnel-profile-id}'.sub('{' + 'tunnel-profile-id' + '}', tunnel_profile_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesVPNIPSECIPSECProfilesApi#delete_ip_sec_vpn_tunnel_profile\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "af4156aa611a6cb9fe40110dfdec18ae", "score": "0.55458593", "text": "def delete(id)\n request(:delete, \"/settings/networks/#{id}.json\")\n end", "title": "" }, { "docid": "fd02a28472b18051486988b9a25156ac", "score": "0.55438507", "text": "def netsh_dp(profile_name, nicname=\"wireless\")\n\t\t\t\t\t\tputs \"#{self.to_s}->method_name:#{__method__}\"\n\t\t\t\t\t\tresult= \"删除配置文件\"\n\t\t\t\t\t\trs =`netsh wlan delete profile name=\"#{profile_name}\" interface=\"#{nicname.downcase}\"`\n\t\t\t\t\t\tprint rs\n\t\t\t\t\t\trs = rs.to_utf8\n\t\t\t\t\t\tif rs=~/#{result}/\n\t\t\t\t\t\t\t\treturn true\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tputs rs\n\t\t\t\t\t\t\t\treturn false\n\t\t\t\t\t\tend\n\t\t\t\tend", "title": "" }, { "docid": "667aad4a41c22cd5e9a3b6e0239878f6", "score": "0.5540558", "text": "def destroy\n @config.destroy\n delete_svn_config_file @config\n @recordlog = @config\n respond_to do |format|\n format.html { redirect_to configs_url, notice: \"Config was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d239f7533a33fee04053caa7b345dd76", "score": "0.5532214", "text": "def destroy\n @condo_profile.destroy\n respond_to do |format|\n format.html { redirect_to condo_profiles_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1f32ae605f3d4844143c01729bebc196", "score": "0.5530807", "text": "def destroy\n @id = params[:id]\n @user = current_user\n @profile = @user.profile\n @user_photo = @user.photos.find(@id)\n\n if @profile.image_links['profile_image'] == @id\n @profile.image_links = @profile.image_links.delete(:profile_image)\n @profile.save\n end\n\n @user_photo.image.destroy\n\n\n if @user_photo.destroy\n respond_to do |format|\n format.json { render :json => [:id=>@id], :status => :ok }\n end\n \n else \n respond_to do |format|\n format.json { render :json => @profile.errors, :status => :unprocessable_entity }\n end\n \n end \n \n end", "title": "" }, { "docid": "0f15714fcec1af4ea60c3b06fd6dbd62", "score": "0.55277306", "text": "def destroy\n @profile.update(deleted: true)\n #@profile.user\n #@profile.destroy\n redirect_to new_user_session_path\n end", "title": "" }, { "docid": "2f94232c9a9e09870d52de1f11c6deea", "score": "0.5525023", "text": "def delete_bfd_profile_0(bfd_profile_id, opts = {})\n delete_bfd_profile_0_with_http_info(bfd_profile_id, opts)\n nil\n end", "title": "" }, { "docid": "5779ab98c1b9cce0cd20814297ff6382", "score": "0.5524319", "text": "def delete_customer_profile(options)\n response = gateway.delete_customer_profile(options)\n [response.success?, response]\n end", "title": "" }, { "docid": "42dd75b3f6174d8cd4fb0a7b25cd948b", "score": "0.5521597", "text": "def destroy\n @profile = current_account.profile #.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to(profiles_url) }\n format.xml { head :ok }\n end\n end", "title": "" } ]
a74f975e793b3d8d537368db9068eb99
Updates the contribution's state according to it's actual state within the gateway, based on each gateway's implementation of state_on_gateway.
[ { "docid": "871ee8dab90b2501d97d814e51e2e88f", "score": "0.728692", "text": "def update_state_from_gateway!\n return unless gateway_state = self.state_on_gateway\n if self.state_name != gateway_state\n transition = self.transition_by_state(gateway_state)\n self.send(\"#{transition}!\") if self.send(\"can_#{transition}?\")\n end\n end", "title": "" } ]
[ { "docid": "48b927a1ab33465b470fadd51713b67f", "score": "0.7599669", "text": "def update_state_on_gateway!(state)\n end", "title": "" }, { "docid": "deff5294f8dab12e6747b5e90e85f9c1", "score": "0.616038", "text": "def update_state\n state.update\n end", "title": "" }, { "docid": "2e57bcf4cd2397e3121a042f7e4d6e39", "score": "0.6115796", "text": "def update_state!\n update(state: compute_state)\n end", "title": "" }, { "docid": "43fb671a52082bd4d6921d12ce1a8c94", "score": "0.60962474", "text": "def update\n @state.update\n end", "title": "" }, { "docid": "ad3f36cdfcb8f3ce693449e4f546c0a2", "score": "0.6060094", "text": "def update\r\n @state.update\r\n end", "title": "" }, { "docid": "c94cdd75f8006b330a7bf4021a5b519b", "score": "0.6039138", "text": "def state_on_gateway\n end", "title": "" }, { "docid": "2f4f88ce9b6eea7db8062d8f776815af", "score": "0.60194266", "text": "def update(state)\n changed\n @state = state\n end", "title": "" }, { "docid": "d287b0ebf94a660cf585a7cc0e4eece5", "score": "0.59880185", "text": "def apply_state_changes(obj)\n old = @added_states.clone\n h87sinergia_asc(obj)\n return unless $scene.is_a?(Scene_Battle)\n return if $game_party.sinergy_active?\n return if old == @added_states\n user = $scene.active_battler\n $game_party.sinergic_state += user.sinergic_state\n end", "title": "" }, { "docid": "03f8484c0edf8035337084624888e7c8", "score": "0.5977157", "text": "def update!(order)\n logger.info 'UPDATE! is called' + self.inspect\n old_state = self.state\n new_state = determine_state(order)\n logger.info \"old_state = #{old_state}; new_state = #{new_state}\" + self.inspect\n if old_state != new_state \n update_attribute_without_callbacks \"state\", new_state\n after_ready if new_state == 'ready' and old_state != 'ready'\n after_ship if new_state == 'shipped' and old_state != 'shipped'\n end\n end", "title": "" }, { "docid": "390f6b5864f30e0f57626065ec3d02f8", "score": "0.5904831", "text": "def update!(order)\n old_state = self.state\n new_state = determine_state(order)\n update_attribute_without_callbacks \"state\", determine_state(order)\n after_ship if new_state == 'shipped' and old_state != 'shipped'\n end", "title": "" }, { "docid": "2fe9829d834a2870393f7a4c6eb9f15b", "score": "0.58891773", "text": "def apply_state_changes(obj)\n old = @added_states.clone\n h87sinergia_asc(obj)\n return unless $scene.is_a?(Scene_Battle)\n return if $game_party.sinergy_active?\n return if old == @added_states\n user = $scene.active_battler\n $game_party.add_sinergy(user.sinergic_state)\n end", "title": "" }, { "docid": "855f34015453ebe280726abfd84bf575", "score": "0.5875157", "text": "def update\n\t\t\t# Ideally #update would be a dynamically defined singleton\n\t\t\t# In that singleton method, the appropriate blocks would be\n\t\t\t# called if they had been defined on initialization\n\t\t\tstate = next_state\n\t\t\ttransition_to state\n\t\t\t@active = state\n\t\tend", "title": "" }, { "docid": "7dbe268dd6d4d0b7e4f5b32559dee00d", "score": "0.5862327", "text": "def update\n @state.update if @state.respond_to? :update\n end", "title": "" }, { "docid": "e7c8f0c672573b4b3092d8b27c99d4fd", "score": "0.5774672", "text": "def update_state(cell_state)\n raise NotImplementedError, 'Subclasses must implement #update_state and return modified state Hash'\n end", "title": "" }, { "docid": "f311a96a0322ba39a9c65227baff6b01", "score": "0.57088774", "text": "def update_payment_state\n if round_money(payment_total) < round_money(total)\n self.payment_state = \"balance_due\"\n self.payment_state = \"failed\" if payments.present? and payments.last.state == \"failed\"\n elsif round_money(payment_total) > round_money(total)\n self.payment_state = \"credit_owed\"\n else\n self.payment_state = \"paid\"\n end\n\n if old_payment_state = self.changed_attributes[\"payment_state\"]\n self.state_events.create({\n :previous_state => old_payment_state,\n :next_state => self.payment_state,\n :name => \"payment\",\n :user_id => (User.respond_to?(:current) && User.current && User.current.id) || self.user_id\n })\n end\n end", "title": "" }, { "docid": "d958392d9d60a1813f4863f89e291923", "score": "0.56615955", "text": "def notify_of_state_change\n @current_state.objs.each do |obj|\n\tobj.state_change\n end\n end", "title": "" }, { "docid": "bbfce6e6b6a2cae66bfe0ad735685d87", "score": "0.56435764", "text": "def apply_state_changes(obj)\n plus = obj.plus_state_set # get state change (+)\n minus = obj.minus_state_set # get state change (-)\n for i in plus # state change (+)\n next if state_resist?(i) # is it resisted?\n next if dead? # are they incapacitated?\n next if i == 1 and @immortal # are they immortal?\n if state?(i) # is it already applied?\n @remained_states.push(i) # record unchanged states\n next\n end\n if rand(100) < state_probability(i) # determine probability\n add_state(i) # add state\n @added_states.push(i) # record added states\n end\n end\n for i in minus # state change (-)\n next unless state?(i) # is the state not applied?\n remove_state(i) # remove state\n @removed_states.push(i) # record removed states\n end\n for i in @added_states & @removed_states # if there are any states in \n @added_states.delete(i) # both added and removed\n @removed_states.delete(i) # sections, delete them both\n end\n end", "title": "" }, { "docid": "35c6d66d08b0f323ac387c493bb8d502", "score": "0.5637021", "text": "def apply_state_changes_int(obj)\n plus = obj.plus_state_set(self)\n minus = obj.minus_state_set\n for i in plus \n next if state_resist?(i)\n next if dead?\n next if i == 1 and @immortal\n if state?(i)\n @remained_states.push(i)\n next\n end\n if rand(100) < state_probability(i)\n add_state(i)\n @added_states.push(i)\n end\n end\n for i in minus\n next unless state?(i)\n remove_state(i)\n @removed_states.push(i)\n end\n for i in @added_states & @removed_states\n @added_states.delete(i)\n @removed_states.delete(i)\n end\n end", "title": "" }, { "docid": "d48b213ea50bd654424e46e8f3b82c83", "score": "0.55305773", "text": "def set_link_compensate_inbound_state(opts)\n opts = check_params(opts,[:state])\n super(opts)\n end", "title": "" }, { "docid": "6dc23d80ce38f838e37bb8019cf1cde7", "score": "0.5513144", "text": "def update!\n state = @state.export\n\n logger.debug \"update: state=#{state}\"\n\n @observable.update(state)\n end", "title": "" }, { "docid": "36aff2cd8862293bfcfb17a91a753093", "score": "0.5512211", "text": "def update_shipment_state\n self.shipment_state =\n case line_items.count\n when 0\n nil\n when line_items.shipped.count\n \"shipped\"\n when line_items.pending.count\n \"pending\"\n when line_items.ready.count\n \"ready\"\n else\n \"partial\"\n end\n\n if old_shipment_state = self.changed_attributes[\"shipment_state\"]\n #if shipment_state changed\n self.state_events.create({\n :previous_state => old_shipment_state,\n :next_state => self.shipment_state,\n :name => \"shipment\" ,\n :user_id => (User.respond_to?(:current) && User.current && User.current.id) || self.user_id\n })\n self.has_shipped if shipment_state == \"shipped\"\n end\n\n end", "title": "" }, { "docid": "b195222b5c6e1477cb7708d543f5b875", "score": "0.54712176", "text": "def update_state(new_state)\n @current_state = new_state\n end", "title": "" }, { "docid": "48001dca5e248ec8b0da05bfe64755cd", "score": "0.5464362", "text": "def update_state(name, model)\n case name\n when :logo_request then\n # (0: “Pending Review” 1: “In Review”, 2”:“Declined” or 3:“Accepted)\n model.state = ['pending_review', 'in_review', 'rejected', 'approved'][model.status.to_i]\n when :organization then\n # all organizations in R01_ORGANIZATION were approved\n model.state = 'approved'\n # COP state - 2=Active, 1=Non-communicating, 0=Inactive, 3=Delisted\n model.cop_state = ['delisted','noncommunicating','active','delisted'][model.cop_status.to_i]\n if model.participant == 1 && model.active == 0\n model.cop_state = 'delisted'\n end\n when :communication_on_progress then\n # COP Status (0: “In review”, 1: “Published”, -1: “Rejected”)\n model.state = ['rejected', 'in_review', 'approved'][model.status.to_i + 1]\n end\n end", "title": "" }, { "docid": "ebc3887a45ed550296ff5e00be94477c", "score": "0.5446644", "text": "def update_state\n case state\n when :closed\n # Change state to open if we're over the max error rate.\n if sampler.percent_error > error_threshold_percentage &&\n sampler.data_point_count >= minimum_sample_size\n @state = :open\n @circuit_timeout = next_circuit_timeout\n end\n\n when :open\n if ::Time.now > @circuit_timeout\n @state = :half_open\n @circuit_timeout = nil\n sampler.reset\n end\n\n when :half_open\n if sampler.data_point_count == 0\n # Do nothing, we haven't attempted an execution yet\n elsif sampler.totals[:failures] > 0\n # If we detect any failures after the last execution, we go\n # back to an open state.\n @state = :open\n @circuit_timeout = next_circuit_timeout\n else\n # We must have made a successful request. We can transition\n # back into a closed state.\n @state = :closed\n end\n\n end\n end", "title": "" }, { "docid": "c83f9bceedb31cba3d8206f23150f365", "score": "0.5427896", "text": "def apply_state_changes(obj)\n h87attr_apply_state_changes(obj)\n return unless $game_temp.in_battle\n return unless obj\n is_attack = obj.is_a?(Game_Battler)\n is_ranged = is_attack ? obj.ranged_attack? : obj.ranged?\n if is_attack\n user = obj\n else\n user = $scene.active_battler\n apply_buff_steal(obj, user) if obj.buff_steal\n end\n apply_evasion_triggers(user, is_ranged)\n set_custom_slip_damage_states\n #noinspection RubyResolve\n @added_states & @removed_states.each do |i|\n # se ci sono stati sia nelle\n @added_states.delete(i) # sezioni aggiunti e rimossi\n @removed_states.delete(i) # eliminali entrambi\n end\n end", "title": "" }, { "docid": "874b3c0b0b337ac8a0a6bd9cbf93b37c", "score": "0.5420417", "text": "def update_power_state!\n begin\n self.last_known_power_state = Razor::IPMI.on?(self) ? 'on' : 'off'\n\n # If we have both a desired and known power state...\n unless self.desired_power_state.nil? or self.last_known_power_state.nil?\n # ...and they don't match...\n unless self.desired_power_state == self.last_known_power_state\n # ...toggle our power state to what is desired. This is put into\n # the background because it isn't actually related to our current\n # transaction, and that ensures we do the right thing later.\n self.publish(self.desired_power_state)\n end\n end\n rescue Razor::IPMI::IPMIError\n self.last_known_power_state = nil\n raise\n ensure\n self.save_changes\n end\n end", "title": "" }, { "docid": "e8f3713af0b2bad1e870c2b80bc14a1c", "score": "0.5418947", "text": "def apply_changes(round)\n if value_changed?\n @register.apply_changes\n @centrality.update_centrality(size, round)\n end\n end", "title": "" }, { "docid": "7096e5cfc60af3441f9099a6bcf11c07", "score": "0.5415292", "text": "def update_state(state, dim_amount = nil)\n @state = state\n @dim_level = dim_amount if dim_amount\n\n # call all appropriate blocks\n if (state == :on)\n @on_actions.each {|a| a.call }\n @change_actions.each {|a| a.call(:on)}\n elsif (state == :off)\n @off_actions.each {|a| a.call }\n @change_actions.each { |a| a.call(:off)}\n elsif (state == :dim && is_dimmable?)\n @dim_actions.each {|a| a.call(dim_amount)}\n @change_actions.each {|a| a.call(:dim, dim_amount)}\n end\n end", "title": "" }, { "docid": "fccc64ffd376b0522ea2c9d049978c1b", "score": "0.53998667", "text": "def state_update(new_state)\n peer.state = new_state\n nil\n end", "title": "" }, { "docid": "0ae128e782f8b5181c51a32517791a22", "score": "0.5373367", "text": "def update_bridge!()\n\t\t#checks whether bridge has been updated (added new shifts) since it was created\n\t\tif self.update_needed? and not self.bridge_table.nil?\n\t\t\t#do update algorithm\n\t\t\tprint \"Update Needed?: \"\n\t\t\tputs self.update_needed\n\t\t\tself.\n\t\t\treturn true\n\t\tend\n\t\treturn false\t\t\n\tend", "title": "" }, { "docid": "52f80eba819a64dbf7c5d58e3c55a3da", "score": "0.5368126", "text": "def update_shipment_state\n self.shipment_state =\n case shipments.count\n when 0\n nil\n when shipments.delivered.count\n 'delivered'\n when shipments.shipped.count\n 'shipped'\n when shipments.ready.count\n 'ready'\n when shipments.pending.count\n 'pending'\n else\n 'partial'\n end\n self.shipment_state = 'backorder' if backordered?\n\n if old_shipment_state = self.changed_attributes['shipment_state']\n self.state_events.create({\n :previous_state => old_shipment_state,\n :next_state => self.shipment_state,\n :name => 'shipment',\n :user_id => (Spree::User.respond_to?(:current) && Spree::User.current && Spree::User.current.id) || self.user_id\n })\n end\n end", "title": "" }, { "docid": "fca2506bddae41b938f451a6213f03dc", "score": "0.5336508", "text": "def update_hooks\n update_hook @checkout.state.to_sym\n end", "title": "" }, { "docid": "1c21e91621b71bf97a20eb23f61164cd", "score": "0.5322781", "text": "def update_shipment_state\n self.shipment_state =\n case shipments.count\n when 0\n nil\n when shipments.shipped.count\n \"shipped\"\n when shipments.ready.count\n \"ready\"\n when shipments.pending.count\n \"pending\"\n else\n \"partial\"\n end\n self.shipment_state = \"backorder\" if backordered?\n\n if old_shipment_state = self.changed_attributes[\"shipment_state\"]\n self.state_events.create({\n :previous_state => old_shipment_state,\n :next_state => self.shipment_state,\n :name => \"shipment\" ,\n :user_id => (User.respond_to?(:current) && User.current && User.current.id) || self.user_id\n })\n end\n\n end", "title": "" }, { "docid": "02517bed3c8bf198cfc0aeb0c5c874a3", "score": "0.5316975", "text": "def update_state\n\n # TODO uncomment later\n #if(@layer == 0)\n # update_input_state\n # return\n #end\n\n # Store time step indices\n last_time_step = @network.get_curr_step\n\n # Calculate sum of inputs\n sum = @input_sum_terms.inject(0){|sum,item| sum + item}\n\n # An oscillator\n # a: spring constant\n # b: damping constant\n # sum: sum of external forces (weighted by connection strength)\n\n # Dimension of the ODE system\n dim = 2\n\n # Create solver\n eps_params = [1e-6, 0.0]\n gos = GSL::Odeiv::Solver.alloc(GSL::Odeiv::Step::RKF45, eps_params, $func, dim)\n\n # Set parameters for solving\n a = get_a(last_time_step)\n b = get_b(last_time_step)\n gos.set_params(b, sum, a)\n t = @network.get_current_time \n t1 = t + @network.get_time_step\n h = 1e-6\n\n # Initial conditions vector (values from the last time step)\n x = GSL::Vector[get_x(last_time_step),get_x_prime(last_time_step)]\n\n GSL::ieee_env_setup()\n\n # Apply solver\n while t < t1\n t, h, status = gos.apply(t, t1, h, x)\n break if status != GSL::SUCCESS\n end\n\n # Set new state variables\n set_a(last_time_step+1,a)\n set_b(last_time_step+1,b)\n set_x(last_time_step+1,x[0])\n set_x_prime(last_time_step+1,x[1])\n # set_x_dbl_prime(last_time_step+1,sum-b*x[1]-a*x[0])\n\n @input_sum_terms = []\n end", "title": "" }, { "docid": "3d56ace7ce09457860fb3112c3109486", "score": "0.53139013", "text": "def change_state(state, *args); end", "title": "" }, { "docid": "d5d0807c6d1e34bf57045f2b87ac7111", "score": "0.53130174", "text": "def update_state(request, state)\n source = request.address\n # record last success\n @lastsync[source] = Time.now if state == 'ack'\n elapsed = Time.now - @lasttry[source]\n log request, state, {'elapsed' => elapsed}\n\n return nil\n end", "title": "" }, { "docid": "b5a7b3d9460f61f6d5e0a9925bfd60ee", "score": "0.53063184", "text": "def change_state(next_state)\n\n # Log the state change.\n if state == nil\n @log.debug(\"Setting initial state to #{next_state.class.name}.\") \n else\n @log.debug(\"Changing state from #{state.class.name} to #{next_state.class.name}.\")\n end\n\n # Change the context's state.\n @state = next_state \n \n # The context doesn't handle messages from the server directly. Method calls to the \n # ConnectionListener module get forwarded to the current state object.\n __setobj__(@state)\n \n end", "title": "" }, { "docid": "70287dd48f4b7dc423ed1fde72d99b13", "score": "0.5291376", "text": "def update\n # update pixel movement rate\n update_pixel_rate\n # if charging up\n if charging?\n # decrease charge counter\n @charge.time -= 1\n # if charged up and not trigger type\n if charged? && !charging?(BlizzABS::CHARGETrigger)\n # execute charged action\n case @charge.action\n when BlizzABS::CHARGEAttack then use_attack\n when BlizzABS::CHARGESkill then use_skill($data_skills[@charge.id])\n when BlizzABS::CHARGEItem then use_item($data_items[@charge.id])\n end\n # reset action\n self.reset_action\n end\n end\n # if performing a combo\n if @combo != nil\n # update the combo\n @combo.update\n # dispose if combo has ended\n if @combo.ended\n @new_combo_sprite = false\n @combo = nil\n end\n end\n # call superclass method\n super\n end", "title": "" }, { "docid": "57e1b1a3c5f85030852a0ce12d4c2889", "score": "0.5271495", "text": "def update!(order)\n old_state = state\n new_state = determine_state(order)\n update_columns(\n state: new_state,\n updated_at: Time.current\n )\n after_ship if new_state == 'shipped' && old_state != 'shipped'\n end", "title": "" }, { "docid": "fb6b966bc12a40354601c2e97c1be099", "score": "0.526553", "text": "def change_state(state)\n return if @state == state\n Logger.info \"state changed from #{@state} to #{state}\", caller: caller\n @state = state\n end", "title": "" }, { "docid": "66c5db5ae2f16795a0ce30bee3843156", "score": "0.5258", "text": "def transfered\n self.update_attribute(:state, TRANSFERED)\n end", "title": "" }, { "docid": "5387e4e489cc2459a075f33290e09792", "score": "0.5252353", "text": "def change_state(state)\n return if @state == state\n Logger.info \"state changed from #{@state} to #{state}\", caller: caller\n @state = state\n run_callbacks state\n end", "title": "" }, { "docid": "1ad8544a24a037b331784a9f57da0b66", "score": "0.5240044", "text": "def switch_state state\n @state_buffer = Proc.new do\n\tnotify_of_state_change\n\t@objs2 = []\n\t@current_state = state\n\t@current_state.setup(*@current_state._args)\n\tnotify_of_state_change\n end\n end", "title": "" }, { "docid": "65bf8616ef4651632ccaaee784a2da70", "score": "0.5226226", "text": "def update!\n update_totals\n update_payment_state\n\n # give each of the shipments a chance to update themselves\n shipments.each { |shipment| shipment.update!(self) }#(&:update!)\n update_shipment_state\n update_adjustments\n # update totals a second time in case updated adjustments have an effect on the total\n update_totals\n\n update_attributes_without_callbacks({\n :payment_state => payment_state,\n :shipment_state => shipment_state,\n :item_total => item_total,\n :adjustment_total => adjustment_total,\n :payment_total => payment_total,\n :total => total\n })\n\n #ensure checkout payment always matches order total\n if payment and payment.checkout? and payment.amount != total\n payment.update_attributes_without_callbacks(:amount => total)\n end\n\n update_hooks.each { |hook| self.send hook }\n end", "title": "" }, { "docid": "75e99260e6f15c7408b6a69ab1fe2b59", "score": "0.5217466", "text": "def update\n # Move actual weight toward target weight\n if @weight != @target_weight\n delta = @target_weight - @weight\n weight_increment = 1.0 / @weight_frames\n if delta < weight_increment && delta > -weight_increment\n @weight = @target_weight\n elsif delta < 0\n @weight -= weight_increment\n else\n @weight += weight_increment\n end\n end\n\n return if @weight == 0.0 # TODO: will this break state updates for some animators?\n\n check_graph\n\n # TODO: See if it's possible (or necessary) to cache selected cells\n # until the graph changes in a way that would change the selected\n # cells. Graph identity is not sufficient, because a graph can be\n # modified. The graph version is not sufficient, because the version\n # changes every time a cell moves. The length of the cells is not\n # sufficient, because a cell's name can be changed, causing the\n # selector result to change. So the graph would need to track a\n # coarser version for \"structural\" modifications, in addition to the\n # \"cosmetic\" version it currently tracks.\n @base.voronoi.cells(@selector).each do |cell|\n x, y = cell.point\n\n cell_state = @state[cell.index]\n\n # Reset cell state if the cell's identity changes\n unless cell_state && cell_state[:cell].equal?(cell)\n cell_state = { cell: cell, index: cell.index }\n end\n\n cell_state[:x] = x\n cell_state[:y] = y\n\n cell_state = update_state(cell_state)\n\n @state[cell.index] = cell_state\n\n new_x = cell_state[:x]\n new_y = cell_state[:y]\n\n # FIXME: allow subclasses to override the way weight is applied?\n if @weight == 1.0\n cell.move(new_x, new_y)\n else\n dx = new_x - x\n dy = new_y - y\n\n # This creates a discontinuity in the derivative at 0 and 1, but\n # whatevs, weights outside 0..1 are going to be weird anyway.\n # Smootherstep would be better for extrapolation, but smoothstep\n # looks better when scaling animation weights within 0..1.\n if @weight > 0 && @weight < 1\n w = MB::M.smoothstep(@weight)\n else\n w = @weight\n end\n\n cell.move(\n MB::M.clamp(x + w * dx, @xmin, @xmax),\n MB::M.clamp(y + w * dy, @ymin, @ymax)\n )\n end\n end\n end", "title": "" }, { "docid": "44fcb743d2b694689dcd7c0288f0d778", "score": "0.5201751", "text": "def update_state\n #TODO ? Add the ! @executed part\n #return if @current_state == :closed || ! @executed\n return if @current_state == :closed\n if @nonDaemonHeirsCount == 0\n if @heirs.empty?\n consume(:update_state)\n else\n @daemondCausedCancellation = true if @failure == nil\n cancelHeirs\n end\n end\n end", "title": "" }, { "docid": "dab3819c9a43dd2b4a1c73cd8fa7dcfa", "score": "0.51954186", "text": "def update\n patch = [{add: '/state', value: self.state}]\n attrs = Listings.fire_patch(Listings.listing_url(self.listing_id), patch)\n attrs ? self.class.new(attrs) : self\n end", "title": "" }, { "docid": "8418d9bdaa1e0f010c37e65e3e7ed67a", "score": "0.51909447", "text": "def update_states\n # if battler exists\n if battler != nil\n # check status effect timers\n check_states\n # change status effect timers\n count_states\n # apply additional status effects\n additional_states\n end\n end", "title": "" }, { "docid": "b1cae5ac252c4ca1278902467b9d1815", "score": "0.5184505", "text": "def set_link_compensate_outbound_state(opts)\n opts = check_params(opts,[:state])\n super(opts)\n end", "title": "" }, { "docid": "9dc8602070e5492420078f73b26caf1c", "score": "0.5176898", "text": "def notify_state_changed\n\t\t\t@state_changed_callbacks.each { |callback| callback.call }\n\t\tend", "title": "" }, { "docid": "8263fc8e191d1c8385667a241c8cc92d", "score": "0.5176594", "text": "def update\n # Must firstly update the lastest hand value\n self.calculate_hand_value\n\n # Check statuses\n self.check_can_hit?\n self.check_can_split?\n self.check_is_softhand?\n self.check_is_blackjack?\n end", "title": "" }, { "docid": "f86f852c27b776c0ccd9ca6812e296a1", "score": "0.5165221", "text": "def update_game_state\n king = get_kings.select { |k| k.colour == @turn }[0]\n\n case king.in_check?\n when true\n king_is_alone = @available_pieces.length == 0\n king_can_move = !all_kings_moves(king).empty?\n\n if king_can_move\n return\n elsif king_is_alone\n @checkmate = true\n return\n end\n\n attacker = get_attackers_of_position(king.position, @turn)\n\n unless attacker.length > 1\n attacker = attacker[0]\n return if attacker_can_be_captured_or_blocked?(attacker, king.position)\n end\n\n @checkmate = true\n\n when false\n @stalemate = true if all_kings_moves(king).empty? && all_valid_moves(king).empty?\n end\n end", "title": "" }, { "docid": "346eb527f4158e3bdb720e78eb7502bf", "score": "0.5164412", "text": "def update!(**args)\n @state = args[:state] if args.key?(:state)\n end", "title": "" }, { "docid": "346eb527f4158e3bdb720e78eb7502bf", "score": "0.5164412", "text": "def update!(**args)\n @state = args[:state] if args.key?(:state)\n end", "title": "" }, { "docid": "346eb527f4158e3bdb720e78eb7502bf", "score": "0.5164412", "text": "def update!(**args)\n @state = args[:state] if args.key?(:state)\n end", "title": "" }, { "docid": "346eb527f4158e3bdb720e78eb7502bf", "score": "0.5164412", "text": "def update!(**args)\n @state = args[:state] if args.key?(:state)\n end", "title": "" }, { "docid": "4acbe0dc5caccfd636676090de030150", "score": "0.5147679", "text": "def noticing_changes(&blk)\n reset!\n\n ui.push(to_s) do\n do_validation!\n\n before_state\n before_call if respond_to?(:before_call)\n\n ui.debug \"before_state=#{before_state.inspect}\"\n\n if skip?\n ui.skipped! \"skipping\"\n return\n end\n\n # Here's the core of the target:\n if node.dry_run?\n ui.skipped! \"DRY RUN: skipping action\"\n return\n else\n # riiight here:\n yield\n end\n\n ui.debug \"after_state=#{state.inspect}\"\n\n # If the state's changed, let it be known\n if state_changed?\n changed \n fire!\n ui.ok!\n else\n ui.skipped! \"target didn't change\"\n end\n \n end\n self\n end", "title": "" }, { "docid": "b2e08a0c9944a3e56bec803db7509dd7", "score": "0.51359284", "text": "def call(state)\n instance.driver.update(state)\n rescue ::Kitchen::Pulumi::Error => e\n raise(::Kitchen::ActionFailed, e.message)\n end", "title": "" }, { "docid": "a2f16c06a546e007863cfd9032952f5a", "score": "0.5132012", "text": "def update_logical_switch; end", "title": "" }, { "docid": "eae11cdec0aa4520f782cd63c432b56c", "score": "0.5128726", "text": "def update\n @state.update(valid_params)\n json_response(@state)\n end", "title": "" }, { "docid": "cf71dfeb2c26bfdb6ec01c85fe99ac0b", "score": "0.51257277", "text": "def change_state(context, next_state)\n context.change_state(next_state)\n end", "title": "" }, { "docid": "db1b973c3eaee8e67a98cea7e1ac1e5d", "score": "0.51206493", "text": "def change_state_to(new_state)\n @state = new_state\n\n # Trigger changed on the 'state' method\n @model.trigger_for_methods!('changed', :state, :loaded?)\n end", "title": "" }, { "docid": "17839ced4fc2d1fea3cc68b42f0d2f49", "score": "0.5096915", "text": "def advance_state\n if self.job_complete? && self.can_mark_complete?\n self.mark_complete!\n elsif (saved_change_to_attribute?(:reconveyance_filed) && !!reconveyance_filed) && self.can_file_reconveyance?\n self.file_reconveyance!\n elsif (saved_change_to_attribute?(:docs_delivered_on) && docs_delivered_on.present?) && self.can_deliver_docs?\n self.deliver_docs!\n end\n\tend", "title": "" }, { "docid": "5ea90d5bd9cdaa624d2b1d74c04fbf09", "score": "0.50915277", "text": "def update_state(state_update)\n $logger.debug { \"State: updating state #{state_update}\" }\n changed = false\n\n state_update.each do |file_id,state|\n path, _, _ = file_id.split(':')\n @sync.synchronize do\n fstat = @active_files[path]\n curstate = @state[path]\n $logger.debug { \"State: #{path} curstate=#{curstate}\" }\n $logger.debug { \"State: #{path} active fstat=#{fstat}\" }\n $logger.debug { \"State: #{path} newstate=#{state}\" }\n # Only update the state if this log event is from a currently active log file,\n # or if there is no current state for the path,\n # or if the current state happens to match this event\n if fstat && fstat['dev']==state['dev'] && fstat['ino']==state['ino'] ||\n curstate.nil? ||\n curstate['dev']==state['dev'] && curstate['ino']==state['ino']\n @state[path] = state\n changed = true\n $logger.debug { \"State: updating state #{path} => #{state}\" }\n end\n end\n end\n\n if changed\n begin\n json = @state.to_json\n File.open(@state_file_new, 'w') { |file| file.write(json) }\n File.rename @state_file_new, @state_file\n $logger.info \"saved state=#{json}\"\n rescue OutOfMemoryError\n raise\n rescue Exception=>e\n on_exception e\n end\n end\n end", "title": "" }, { "docid": "e6b1741c2673030ce84ff915f93d3940", "score": "0.50762457", "text": "def change\n\n\t\ttemp_state = @green_light.state\n\t\t@green_light.state = @red_light.state\n\t\t@red_light.state = @yellow_light.state\n\t\t@yellow_light.state = temp_state\n\n\t\tnotify\n\n\tend", "title": "" }, { "docid": "62b88091ad92c06662d06ef1967cdc22", "score": "0.50670236", "text": "def update\n si = Sketchup.active_model.shadow_info\n la_changed = update_parameter('latitude', si['Latitude'])\n lo_changed = update_parameter('longitude', si['Longitude'])\n na_changed = update_parameter('north_angle', si['NorthAngle'])\n nos_changed = update_parameter('number_of_states', $solar_integration.configuration.sun_states)\n ghi_changed = update_parameter('ghi', $solar_integration.configuration.global_horizontal_irradiation)\n\n update_sun_transformation\n # recalculate or load sun states\n sun_states_change = nos_changed or la_changed or lo_changed or na_changed\n if not sun_states_change and not @states\n load_states\n end\n if sun_states_change or not @states\n update_sun_states\n end\n\n # recalculate or load contribution per state\n contrib_change = sun_states_change or ghi_changed\n if not contrib_change and not @contribution_per_state\n @contribution_per_state = get_from_model('contribution_per_state')\n end\n if contrib_change or not @contribution_per_state\n update_contribution_per_state\n end\n end", "title": "" }, { "docid": "19ed5da12c46cc745d5915037c1dcb62", "score": "0.5066477", "text": "def changed(state=true)\n @observer_state = state\n end", "title": "" }, { "docid": "a226164502e1fbc6295badb228670050", "score": "0.50570685", "text": "def update\n respond_to do |format|\n if @gateway.update(gateway_params)\n format.html { redirect_to [@concentrator, @gateway], notice: 'Gateway was successfully updated.' }\n format.json { render :show, status: :ok, location: @gateway }\n else\n format.html { render :edit }\n format.json { render json: @gateway.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1343e99ad47abcbc6dc4591cfadfd6a7", "score": "0.5054134", "text": "def update\n @point_of_interest = PointOfInterest.find(params[:id])\n puts params[:point_of_interest][:state],params[:state], 'musa'\n @point_of_interest.state.motor_running = params[:point_of_interest][:state][:motor_running]\n @point_of_interest.state.windows_up = params[:point_of_interest][:state][:windows_up]\n @point_of_interest.state.car_locked = params[:point_of_interest][:state][:car_locked]\n if @point_of_interest.update(point_of_interest_params) && @point_of_interest.state.save\n puts @point_of_interest.state.motor_running\n head :no_content\n else\n render json: @point_of_interest.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "094c64cd9703bf652774ba574721b84e", "score": "0.50523627", "text": "def state_changed\n\t\tend", "title": "" }, { "docid": "10f50d55885395a5059de1833c804522", "score": "0.5051816", "text": "def update_active_state!\n self.active = contents_any?(approved: true)\n if active_changed?\n self.paper_trail_event = \"active_neuron\"\n save!\n end\n end", "title": "" }, { "docid": "f5a2444b828e61471b04cc9c0bd290e9", "score": "0.5044779", "text": "def state_transitioned\n changed(true)\n notify_observers(self)\n end", "title": "" }, { "docid": "f5a2444b828e61471b04cc9c0bd290e9", "score": "0.5044779", "text": "def state_transitioned\n changed(true)\n notify_observers(self)\n end", "title": "" }, { "docid": "682d40545eafdbde4d7e6bb7faf1c7f9", "score": "0.5026777", "text": "def update\n url = repository_tracking_list_url(:id => @tracking_list,\n :repository_id => @repository)\n if params[:event]\n event = params[:event]\n original_state = @tracking_list.current_state\n\n options = { :tracking_list => @tracking_list }\n options[:urlified_name] = @site_basket.urlified_name if @current_basket.repositories.count < 1\n\n case event\n when 'allocate'\n # allocating means we need to choose shelf location before proceeding\n url = new_trackable_item_shelf_location_url(options)\n @successful = true\n when 'loan'\n # we need to collect information for a new or existing on_loan_organization\n url = new_on_loan_organization_url(options)\n @successful = true\n when 'clear_list'\n @tracking_list.clear_list!\n # we transition back to new in this case, so no change in state\n @successful = true\n else\n # otherwise, send the event as a method\n # to the tracking list\n @tracking_list.send(event + '!')\n @successful = @tracking_list.reload.current_state != original_state\n @state_change_failed = !@successful\n url = repository_tracking_list_url(:id => @tracking_list,\n :repository_id => @repository,\n :download_modal => true)\n end\n else\n # to handle large amount of matches that span paginated pages of results\n # we use ids in session to create tracked_items\n matching_class = session[:matching_class]\n matching_results_ids = session[:matching_results_ids]\n values = matching_results_ids.inject([]) do |value, matching_id|\n value << TrackedItem.new(:trackable_item_type => matching_class,\n :trackable_item_id => matching_id,\n :tracking_list_id => @tracking_list.id)\n value\n end\n\n @successful = TrackedItem.import(values)\n end\n\n if @successful || @state_change_failed\n clear_session_variables_for_list_building\n\n flash[:notice] = t('tracking_lists.update.state_change_failed', :event_transition => params[:event].humanize) if @state_change_failed\n\n redirect_to url\n else\n render :action => 'edit'\n end\n end", "title": "" }, { "docid": "93c39324bd3fd2f975c6dcf9cecf1048", "score": "0.50237024", "text": "def set_state(new_state)\r\n update(state: new_state)\r\n end", "title": "" }, { "docid": "7bfb2f3fcd7d2d4276c3ff465ca64fcc", "score": "0.5018515", "text": "def state_change(job, plugin, environment, state, run_chef = true, options = {})\n job.report_running\n job.set_status(\"Transitioning #{@component}.#{@name} to #{state}...\")\n log.warn {\n \"Component's service state is being changed to #{state}, which is not one of #{COMMON_STATES}\"\n } unless COMMON_STATES.include?(state)\n\n chef_synchronize(chef_environment: environment, force: options[:force]) do\n unless valid_dynamic_service?(plugin)\n job.report_failure(\"#{@component}.#{@name} is not a valid service in #{plugin.name}\")\n return job\n end\n\n component_object = plugin.component(component)\n service_object = component_object.get_service(name)\n group = component_object.group(service_object.service_group)\n nodes = group.nodes(environment)\n nodes = MB::NodeFilter.filter(options[:node_filter], nodes) if options[:node_filter]\n\n if options[:cluster_override]\n set_environment_attribute(job, environment, service_object.service_attribute, state)\n else\n unset_environment_attribute(job, environment, service_object.service_attribute)\n set_node_attributes(job, nodes, service_object.service_attribute, state)\n end\n if run_chef\n node_querier.bulk_chef_run(job, nodes, service_object.service_recipe)\n end\n end\n job.set_status(\"Finished transitioning #{@component}.#{@name} to #{state}!\")\n job.report_success\n job.ticket\n rescue => ex\n job.report_failure(ex)\n ensure\n job.terminate if job && job.alive?\n end", "title": "" }, { "docid": "bb35a0848cd22ea9925b5bf9c0b6c437", "score": "0.50184435", "text": "def handle_state(state)\n logger.debug(\"handle state transition: #{state}\")\n publish_to_all(state: state)\n\n # TODO(snatchev): we should have the build state be the same as the InvocationResponse::State enum\n case state\n when :RUNNING\n current_build.status = :running\n when :FINISHING\n current_build.status = :running\n when :REJECTED\n current_build.status = :ci_problem\n when :FAILED\n current_build.status = :failure\n when :BROKEN\n current_build.status = :failure\n when :SUCCEEDED\n current_build.status = :success\n current_build.description = \"All green\"\n logger.info(\"fastlane run complete\")\n else\n logger.error(\"unknown state #{state}\")\n end\n\n save_build_status!\n end", "title": "" }, { "docid": "3f98e5f875b26bc5adb418e99b994651", "score": "0.50161445", "text": "def state=(state)\n @state = state\n notify\n end", "title": "" }, { "docid": "c535aa0542c710da521109e8966d0f39", "score": "0.50160426", "text": "def process_update_state\n @participant.state = params[:new_state]\n @participant.high_intensity = true if params[:new_state] == \"moved_to_high_intensity_arm\"\n @participant.save!\n flash[:notice] = \"Participant was moved to #{params[:new_state].titleize}.\"\n redirect_to correct_workflow_participant_path(@participant)\n end", "title": "" }, { "docid": "ba81305b130644848ef154887df51116", "score": "0.5015303", "text": "def gcp_ready_state_changed( ready_state, state, reason )\n\n # TODO: screen out unexpected states\n #\n # state_diff will only show what has changed from previous CDS\n state_diff = CloudDeviceState.new(\n printer: PrinterStateSection.new( \n state: state.to_s.upcase,\n )\n )\n\n status_response = Cloudprint.client_connection.post( ::Kinokero.gcp_service + GCP_UPDATE ) do |req|\n req.headers['Authorization'] = gcp_form_auth_token()\n req.body = {\n printerid: @gcp_control[:gcp_printerid],\n semantic_state_diff: state_diff.to_json\n }\n\n log_request( 'device update', req )\n \n end # request do\n\n log_response( 'device update', status_response )\n\n return status_response.body\n\n\n end", "title": "" }, { "docid": "73da3dd0044cddaaf35900cc05dde4bb", "score": "0.50141543", "text": "def update_game_state(state)\n if draw?(state)\n raise 'in draw'\n state.phase = GameState::DRAW\n elsif win?(state)\n raise 'in win'\n state.phase = GameState::WIN\n else\n state.phase = GameState::IN_PROGRESS\n\n state.player_turn = if state.player_turn == GameState::PLAYER_ONE\n GameState::PLAYER_TWO\n else\n GameState::PLAYER_ONE\n end\n end\n end", "title": "" }, { "docid": "d88f932b396eb516da0640b5c2df7640", "score": "0.5013759", "text": "def update_current_state(rule)\r\n @current_state = find_state(rule.target_state)\r\n end", "title": "" }, { "docid": "9d992385408361e778542b389ee5fe8d", "score": "0.5010252", "text": "def update\n\n if params[:state] == \"0\"\n @buy.to_transit!\n elsif params[:state] == \"1\"\n @buy.to_warehouse!\n elsif params[:state] == \"2\"\n @buy.to_home!\n end\n\n respond_to do |format|\n if @buy.update(buy_params)\n format.html { redirect_to @buy, notice: 'Buy was successfully updated.' }\n format.json { render :show, status: :ok, location: @buy }\n else\n format.html { render :edit }\n format.json { render json: @buy.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f05e3c96fa6cb2ba9d744eae25bd636d", "score": "0.5008145", "text": "def update_state(state)\n hash = vagrant_ssh_config\n\n state[:hostname] = hash[\"HostName\"]\n state[:username] = hash[\"User\"]\n state[:ssh_key] = hash[\"IdentityFile\"]\n state[:port] = hash[\"Port\"]\n state[:proxy_command] = hash[\"ProxyCommand\"] if hash[\"ProxyCommand\"]\n end", "title": "" }, { "docid": "95f978b56d372cb3730eae64701dbf27", "score": "0.5005294", "text": "def link_compensate_inbound_state\n super\n end", "title": "" }, { "docid": "323212bdf0fbbe3085fc2994baa470d9", "score": "0.49961343", "text": "def raw_power_state=(new_state)\n return unless new_state\n\n unless raw_power_state == new_state\n self.previous_state = raw_power_state\n self.state_changed_on = Time.now.utc\n super\n self.power_state = calculate_power_state\n end\n new_state\n end", "title": "" }, { "docid": "5a1f1e3a9fd140c7058f8a20d543a74f", "score": "0.49941593", "text": "def dispatch\n __send__ @state\n end", "title": "" }, { "docid": "cf0c50e17568e80dda917ad615668b67", "score": "0.49926978", "text": "def cc_link\n ccs = Cc.all\n ccs.each do |cc|\n state = State.find_by(state_abb: cc.state_abb)\n cc.update_attribute(:state, state)\n end\nend", "title": "" }, { "docid": "7fe0a0dfcd3fbdfe47e4962e722dbb87", "score": "0.4985728", "text": "def setState(state)\r\n\t\t\t\t\t@state = state\r\n\t\t\t\tend", "title": "" }, { "docid": "9dafbfcb0d69e544ea9fc81c6cc202ad", "score": "0.4973593", "text": "def update!\n return unless self.transaction_id.present? && self.event_user.present?\n\n if self.payment_method_id == PaymentMethod::MethodType::WEPAY\n gateway = Payment.wepay_gateway\n response = gateway.call('/checkout', self.payee.wepay_account.token_secret, { checkout_id: self.transaction_id })\n\n if response[\"error\"].present?\n # Handle error\n else\n self.status = response[\"state\"]\n update_status_type\n self.save\n\n if [\"captured\", \"authorized\"].include?(self.status)\n self.event_user.pay!(self, transaction_id: self.transaction_id)\n else\n # Something needs to be done here to handle cancelled and other states\n # self.event_user.unpay!(self)\n end\n end\n elsif self.payment_method_id == PaymentMethod::MethodType::PAYPAL\n gateway = Payment.paypal_gateway\n response = gateway.details_for_payment({ pay_key: self.transaction_id })\n\n if response.error.present?\n # Handle error\n else\n self.status = response.status.downcase\n update_status_type\n self.save\n\n if self.status == \"completed\"\n self.event_user.pay!(self, transaction_id: self.transaction_id)\n else\n # Something needs to be done here to handle cancelled and other states\n # self.event_user.unpay!(self)\n end\n end\n\n elsif self.payment_method_id == PaymentMethod::MethodType::DWOLLA\n # Dwolla will soon be removed\n\n dwolla_user = Dwolla::User.me(self.payer.dwolla_account.token)\n\n begin\n response = dwolla_user.transaction(self.transaction_id)\n\n self.status = response[\"Status\"].downcase\n self.save\n\n if self.status == \"processed\"\n self.event_user.pay!(self, transaction_id: self.transaction_id)\n else\n # Something needs to be done here to handle cancelled and other states\n # self.event_user.unpay!(self)\n end\n rescue Exception => e\n # Handle error\n end\n end\n end", "title": "" }, { "docid": "5f6fd3d65385b2a1794bb834a44d11dd", "score": "0.4967701", "text": "def state=( a_state )\n begin\n a_state = a_state.to_i;\n rescue\n a_state = 0;\n end\n \n self[:state]=a_state;\n \n if ( ([ SOLVED, DEBIT_PENDING, DEBIT_DONE ].include? a_state) && (self.solved_on.nil?) ) \n # request is NOW solved\n self[:solved_on] = Localization::localizer().now();\n if ( self.mt_company_task != nil )\n self.mt_company_task.status = MtCompanyTask::DONE\n self.mt_company_task.save\n end\n elsif ( [ OPEN, IN_PROGRESS ].include?(a_state) && (self.solved_on != nil) )\n # request is not really solved... amend solved date accordingly.\n self[:solved_on] = nil;\n if ( self.mt_company_task != nil )\n self.mt_company_task.status = a_state==OPEN ? MtCompanyTask::ACCEPTED : MtCompanyTask::IN_PROGRESS;\n self.mt_company_task.save\n end\n end\n end", "title": "" }, { "docid": "cc63825b0563a28cd96f6f1c6c195bfc", "score": "0.49538058", "text": "def set_state\n @improvement = Improvement.find(params[:improvement_id])\n @state = @improvement.states.find(params[:id])\n end", "title": "" }, { "docid": "43a391d112a76eb193cc8bfa2a06c1d0", "score": "0.49512175", "text": "def update!\n puts \"Spree::Order#update!\"\n line_items.each { |item| item.copy_price }\n \n update_totals\n update_payment_state\n \n # give each of the shipments a chance to update themselves\n shipments.each { |shipment| shipment.update!(self) }#(&:update!)\n update_shipment_state\n # update_adjustments #TODO commented out to make checkout update work\n # update totals a second time in case updated adjustments have an effect on the total\n\n update_totals\n\n update_attributes_without_callbacks({\n :payment_state => payment_state,\n :shipment_state => shipment_state,\n :item_total => item_total,\n :adjustment_total => adjustment_total,\n :payment_total => payment_total,\n :total => total\n })\n\n #ensure checkout payment always matches order total\n if payment and payment.checkout? and payment.amount != total\n payment.update_attributes_without_callbacks(:amount => total)\n end\n\n line_items.each { |item| item.update!(self) }\n \n @currently_updating = false\n \n update_hooks.each { |hook| self.send hook }\n end", "title": "" }, { "docid": "88a6311f4d9e1bb0fb0894a68469a2f4", "score": "0.49478742", "text": "def changed state = true\n @observer_state = state\n end", "title": "" }, { "docid": "342cff274ce1d029d31764d2283c0142", "score": "0.49440312", "text": "def execute_state_callbacks(state); end", "title": "" }, { "docid": "5b25a9f1dca6d8c6406c78ab6f333377", "score": "0.49324107", "text": "def update_states_for_pair(pair, new_state, last_state)\n\n #Identify whether either side has claimed a beacon...\n red_has_claimed = (new_state[:red].owner == :red) && (last_state[:red].owner != :red)\n green_has_claimed = (new_state[:green].owner == :green) && (last_state[:green].owner != :green)\n\n #Select the new owner according to what's happened in the meantime: \n new_owner = \n #If both teams have claimed the beacon at the same time, pick randomly between them.\n #This should be very rare.\n if red_has_claimed && green_has_claimed\n [:red, :green].sample\n\n #Otherwise, if either of the side has claimed the beacon,\n #they'll become the new owner.\n elsif red_has_claimed\n :red\n elsif green_has_claimed\n :green\n\n #If neither of the sides have claimed the beacon, leave the beacon with its original owner.\n else\n new_state[:red].owner\n end\n\n #If a change has occurred...\n if red_has_claimed or green_has_claimed\n\n #... update the beacons themselves...\n pair[:red].owner = pair[:green].owner = new_owner \n\n #... update the \"first to claim\" statistic, if appropriate...\n @first_to_claim ||= new_owner\n\n #... modify the new state object...\n new_state[:red].owner = new_state[:green].owner = new_owner\n\n #... and log the change.\n log \"A beacon was claimed by the #{new_owner.to_s} team!\" \n\n end\n\n new_state\n \n end", "title": "" }, { "docid": "2b1294fff77ae29c535e405d8c3a4594", "score": "0.49320158", "text": "def change_state\n # Changed state corressponding to action\n changed = {'Accept' => 'accepted', 'Suspend' => 'pending', 'Reject' => 'rejected'}\n params[:state] = @project.status\n @project.update_attributes({:status => changed[params[:commit]]})\n\n end", "title": "" }, { "docid": "c8251fb97b26824ca7d75d00ae06188f", "score": "0.4925224", "text": "def update\n respond_to do |format|\n if @compare_state.update(compare_state_params)\n format.html { redirect_to @compare_state, notice: 'Compare state was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @compare_state.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8a9e6463082f2fbffd38a802cc925383", "score": "0.4916387", "text": "def update\n\n # ADDRESS\n if params[:state] == 'address'\n params[:order][:ship_address_attributes][:user_id] = current_spree_user.id\n current_spree_user.remove_address_current\n if params[:order][:ship_address_attributes][:id].present?\n\n # @order.update_attributes(object_params)\n ship_address = Spree::Address.find(object_params[:ship_address_attributes][:id])\n ship_address.update_attributes(object_params[:ship_address_attributes])\n @order.ship_address = ship_address\n @order.clone_billing_address\n @order.save!\n else\n @order.build_ship_address(params[:order][:ship_address_attributes])\n @order.clone_billing_address\n @order.save!\n end\n\n fire_event('spree.checkout.update')\n @order.next\n redirect_to checkout_state_path(@order.state)\n elsif params[:state] == 'delivery' || params[:state] == 'payment'\n if @order.update_attributes(object_params)\n\n fire_event('spree.checkout.update')\n return if after_update_attributes\n\n unless @order.next\n flash[:error] = Spree.t(:payment_processing_failed)\n redirect_to checkout_state_path(@order.state) and return\n end\n if @order.completed?\n session[:order_id] = nil\n flash.notice = Spree.t(:order_processed_successfully)\n flash[:commerce_tracking] = \"nothing special\"\n redirect_to completion_route\n else\n redirect_to checkout_state_path(@order.state)\n end\n else\n render :edit\n end\n\n end\n\n #if @order.update_attributes(object_params)\n #\n # fire_event('spree.checkout.update')\n # return if after_update_attributes\n #\n # unless @order.next\n # flash[:error] = Spree.t(:payment_processing_failed)\n # redirect_to checkout_state_path(@order.state) and return\n # end\n #\n # if @order.completed?\n # session[:order_id] = nil\n # flash.notice = Spree.t(:order_processed_successfully)\n # flash[:commerce_tracking] = \"nothing special\"\n # redirect_to completion_route\n # else\n # redirect_to checkout_state_path(@order.state)\n # end\n #else\n # render :edit\n #end\n end", "title": "" }, { "docid": "e8f40a471b778ad52b25a9c0734552a7", "score": "0.4915437", "text": "def update_item\n @instance = services.compute.find_server(params[:id]) rescue nil\n @target_state = params[:target_state]\n\n respond_to do |format|\n format.js do\n if @instance and @instance.power_state.to_s!=@target_state\n @instance.task_state||=task_state(@target_state)\n end\n end\n end\n end", "title": "" } ]
cd5521e3a770904871358e56a328c6fe
PATCH/PUT /testimonial_answers/1 PATCH/PUT /testimonial_answers/1.json
[ { "docid": "d8d03b1b1edea38cb089d6b7b2e3aa9b", "score": "0.7520011", "text": "def update\n respond_to do |format|\n if @testimonial_answer.update(testimonial_answer_params)\n format.html { redirect_to @testimonial_answer, notice: 'Testimonial answer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @testimonial_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "438bfed9098190c5614fe4825d35d155", "score": "0.7290032", "text": "def update\n respond_to do |format|\n if @testimonial_question.update(testimonial_question_params)\n format.html { redirect_to @testimonial_question, notice: 'Testimonial question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @testimonial_question.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "37889e61c6800868c8f8942607dd9781", "score": "0.7054998", "text": "def update\n # logger.debug \"IMPORTANT INFO COMING NEXT \"\n # logger.debug params[:answer]\n respond_to do |format|\n if @question.update(question_params)\n manage_answers # insert or update\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "53290e16ccaab59ca2094fe092a73fc8", "score": "0.70219254", "text": "def update\n @test_answer = TestAnswer.find(params[:id])\n\n respond_to do |format|\n if @test_answer.update_attributes(params[:test_answer])\n format.html { redirect_to @test_answer, :notice => 'Test answer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @test_answer.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "971d00f01f715767209fd0988964ed04", "score": "0.6985295", "text": "def update\n @answer = @question.answers.find(params[:id])\n\n respond_to do |format|\n if @answer.update_attributes(params[:answer])\n format.html { redirect_to exam_questions_path(@exam), notice: 'Answer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: exam_questions_path(@exam).errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8d0ff3e66482739a7e55d463aded35ad", "score": "0.6921441", "text": "def update\n @answer = Answer.find(params[:id])\n if @answer\n @answer.update(answer_params)\n # @question = @answer.question\n #from pokdex\n render json: @answer\n # render json: question, include: [:answers]\n else\n render json: answer.errors.full_messages, status: 422\n end\n end", "title": "" }, { "docid": "50572c97f564b0e2fa713be71abda11d", "score": "0.68814635", "text": "def update\n answer = @answer.update(answer_params)\n if answer.save\n render json: answer\n else\n render json: answer.errors, status: 447\n end\n end", "title": "" }, { "docid": "f72fc24931b8d1e97a84ab5f5c833915", "score": "0.6859424", "text": "def update\n if @question\n @answer = @question.answers.find(params[:id])\n end\n\n respond_to do |format|\n if @answer.update_attributes(params[:answer])\n flash[:notice] = t('controller.successfully_updated', :model => t('activerecord.models.answer'))\n format.html { redirect_to question_answer_url(@answer.question, @answer) }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @answer.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a94e688dc70f5c0923da12358040749f", "score": "0.6849012", "text": "def update\n @testimonial = Testimonial.find(params[:id])\n\n respond_to do |format|\n if @testimonial.update_attributes(params[:testimonial])\n format.html { redirect_to @testimonial, notice: 'Testimonial was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @testimonial.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6247e03db3569b7f8ab1f91db463eae9", "score": "0.6843164", "text": "def update\n if @answer.update(answer_params)\n render json: @answer\n else\n render json: { errors: @answer.errors, status: 500, success: false }\n end\n end", "title": "" }, { "docid": "9b2175c1e91394466e1f2d6c773f2139", "score": "0.6839807", "text": "def update\n @question = Question.find(params[:id])\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :ok }\n else\n if params[:question][:answers_attributes]\n format.html { render action: \"show\" }\n else\n format.html { render action: \"edit\" }\n \n end\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "acb5c548f263f2a530c6d76c1ada00c3", "score": "0.6830233", "text": "def update\n @answer = @question.answers.find(params[:id])\n\n respond_to do |format|\n if @answer.update_attributes(params[:answer])\n format.html { redirect_to [@category, @question], notice: 'Answer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e27b5fc8d8c2d5a746b4554be443501f", "score": "0.68205786", "text": "def update\n @answer = Answer.find(params[:id])\n\n if @answer.update(params[:answer])\n head :no_content\n else\n render json: @answer.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "c434bb25b9ae82154d2c9842bf5cae32", "score": "0.6820117", "text": "def update\n respond_to do |format|\n if @test_answer.update(test_answer_params)\n format.html { redirect_to @test_answer, notice: 'Test answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @test_answer }\n else\n format.html { render :edit }\n format.json { render json: @test_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4dc7e6559a2948dbe1041328e1a5883d", "score": "0.68188405", "text": "def update\n if @answer.update(answer_params)\n \trespond_with @question, @answer\n else\n \trespond_using @answer, :edit\n end\n end", "title": "" }, { "docid": "45c1420031bbb92056aa680f798d9df8", "score": "0.67940956", "text": "def update\n respond_to do |format|\n if @api_v1_answer.update(api_v1_answer_params)\n format.html { redirect_to @api_v1_answer, notice: 'Answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_answer }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "674d2814a8067f921c9eef198ae42ad9", "score": "0.67642975", "text": "def update\n answer = Answer.find(params[:id])\n if answer.update(params_answer)\n render json: answer, status: 200\n else\n render json: answer.errors, status: 422\n end\n\n end", "title": "" }, { "docid": "6779b932ee24ef5877524de26d794333", "score": "0.67588824", "text": "def update\n @testimonial = Testimonial.find(params[:id])\n\n respond_to do |format|\n if @testimonial.update_attributes(tesimonial_params)\n format.html { redirect_to @testimonial, notice: 'Testimonial was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @testimonial.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c95463af2f6c2aedca1f16b0f6475ea5", "score": "0.6757651", "text": "def update\n @question = Question.find(params[:id])\n @answersLeft = 4-@question.answers.length\n\n @answersLeft.times do\n answer = @question.answers.build\n end\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to questions_path, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2ae70a890c7d03a4c58f18bc39d1d5bb", "score": "0.67550296", "text": "def update\n respond_to do |format|\n if @example_answer.update(example_answer_params)\n format.html { redirect_to @example_answer, notice: 'Example answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @example_answer }\n else\n format.html { render :edit }\n format.json { render json: @example_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "eb11bb2bbcf378b52da086b61ba3ca56", "score": "0.6753493", "text": "def update\n respond_to do |format|\n format.json {\n # get question & answer id\n question_id = extract_int params, :question_id\n answer_id = extract_int params, :answer_id\n\n # if bad request\n if question_id.nil? || answer_id.nil?\n render :json => reply(false, t(:missing_params))\n\n # if okay\n else\n answer = Answer.where(id: answer_id, question_id: question_id).first\n\n # no such record ?\n if answer.nil?\n render :json => reply(false, t(:no_such_answer))\n # user who is attempting to edit answer isnt author nor admin?\n elsif !is_admin_or_author?(current_user,answer)\n render :json => reply(false, t(:answer_edit_insufficient_privileges))\n # everything is okay?\n else\n answer.content= do_sanitize_qa_content(params[:content]) unless params[:content].nil?\n answer.editor_id= current_user.id\n\n if !answer.valid?\n render :json => reply(false, t(:answer_edit_invalid_new_values))\n else\n if answer.save\n Log.log(\"User #{current_user.username} (UID = #{current_user.id}) edited answer'#{answer.id}' by author with UID = #{answer.author.id}\",request.remote_ip)\n render :json => reply(true, t(:answer_editing_successful))\n else\n render :json => reply(false, t(:answer_editing_failed))\n end\n end\n end\n end\n }\n format.html {\n render :status => :method_not_allowed, :nothing => true\n return\n }\n end\n end", "title": "" }, { "docid": "cffed0a1690e3a55de31eaee99c43d1f", "score": "0.67432135", "text": "def update\n @quick_answer = QuickAnswer.find(params[:id])\n\n respond_to do |format|\n if @quick_answer.update_attributes(params[:quick_answer])\n format.html { redirect_to @quick_answer, notice: 'Quick answer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @quick_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b39620affd8ccb0a5df5b5e5a2943d63", "score": "0.6739147", "text": "def update\n @interview_question = InterviewQuestion.find(params[:id])\n\n respond_to do |format|\n if @interview_question.update_attributes(params[:interview_question])\n format.html { redirect_to @interview_question, notice: 'Interview question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interview_question.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "29f803edfd1aeb5aa4685e743807c6cc", "score": "0.6726437", "text": "def update\n respond_to do |format|\n if @testimonial.update(testimonial_params)\n format.html { redirect_to @testimonial, notice: 'Testimonial was successfully updated.' }\n format.json { render :show, status: :ok, location: @testimonial }\n else\n format.html { render :edit }\n format.json { render json: @testimonial.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "29f803edfd1aeb5aa4685e743807c6cc", "score": "0.6726437", "text": "def update\n respond_to do |format|\n if @testimonial.update(testimonial_params)\n format.html { redirect_to @testimonial, notice: 'Testimonial was successfully updated.' }\n format.json { render :show, status: :ok, location: @testimonial }\n else\n format.html { render :edit }\n format.json { render json: @testimonial.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d5b6d3e802090cd06a0c611147ee55d6", "score": "0.6724347", "text": "def update\n @answer = Answer.find(params[:id])\n\n respond_to do |format|\n if @answer.update_attributes(params[:answer])\n format.html { redirect_to @answer, :notice => 'Answer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @answer.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "29561a0334671dc8cddbe9dd997dc0f6", "score": "0.6721587", "text": "def update\n update_resource @questionnaire, questionnaire_params\n respond_with @questionnaire unless response_body\n end", "title": "" }, { "docid": "f6eb5a28bb3066528357641f14080801", "score": "0.6720601", "text": "def update\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to question_path(@answer.question), notice: 'You edited your answer Successfully.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f6eb5a28bb3066528357641f14080801", "score": "0.6720601", "text": "def update\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to question_path(@answer.question), notice: 'You edited your answer Successfully.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4aac1106ed9af286f1da0804ab60f28e", "score": "0.6714256", "text": "def update\n\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to questions_path, notice: 'Answer was successfully updated.' }\n format.json { render :show, status: :ok, location: questions_path}\n else\n format.html { render :edit }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1c2c11cbcea3f68d2635524381171f35", "score": "0.67074263", "text": "def update\n respond_to do |format|\n @answer = Answer.where(\"user_id = #{@answer.user_id} AND question_id = #{@answer.question_id}\").first\n if @answer.update({\"answer\" => answer_params})\n format.html { redirect_to root_path, notice: 'Answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @answer }\n else\n format.html { render :edit }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e200c2e45d5e06159f21daee27b74aa8", "score": "0.6700888", "text": "def update\n @v1_question = V1::Question.find(params[:id])\n\n if @v1_question.update(question_params)\n render json: @v1_question, status: :ok\n else\n render json: @v1_question.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "c1ef452cf0880281e3c6f9b666202ac9", "score": "0.6693342", "text": "def update\n @question.answerd = true\n\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9182e094332249b095c1edddfe2710bc", "score": "0.6691267", "text": "def update\n @answer = Answer.find(params[:id])\n\n respond_to do |format|\n if @answer.update_attributes(params[:answer])\n format.html { redirect_to @answer, notice: 'Answer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9182e094332249b095c1edddfe2710bc", "score": "0.6691267", "text": "def update\n @answer = Answer.find(params[:id])\n\n respond_to do |format|\n if @answer.update_attributes(params[:answer])\n format.html { redirect_to @answer, notice: 'Answer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9182e094332249b095c1edddfe2710bc", "score": "0.6691267", "text": "def update\n @answer = Answer.find(params[:id])\n\n respond_to do |format|\n if @answer.update_attributes(params[:answer])\n format.html { redirect_to @answer, notice: 'Answer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2140d2c2f4711287210358b52c260622", "score": "0.668784", "text": "def update\n @answer.update(answer_params)\n @question = @answer.question\n end", "title": "" }, { "docid": "38fd8c7e87f479dbfdfce390441c7d35", "score": "0.66845095", "text": "def update\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to @answer, notice: 'Answer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "38fd8c7e87f479dbfdfce390441c7d35", "score": "0.66845095", "text": "def update\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to @answer, notice: 'Answer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b4984fef71a21452b3d2c41272b46854", "score": "0.66752285", "text": "def update\n if @testimonial.update(testimonial_params)\n render :show, status: :ok, location: api_v1_testimonial_url(@testimonial)\n else\n render json: @testimonial.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "dce1eb636f91563df8ef6aa295b6daf4", "score": "0.6669596", "text": "def update\n respond_to do |format|\n if @question.update(question_params)\n # Couldn't use solution from params because the choice isn't saved yet, so it has no id\n # That's why this logic is in here, though it seems real bad\n # Could redirect to a set_solution method in this controller maybe?\n @question.solution_id = @question.choices.first.id\n @question.save\n\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d8f648f64da880d1906d9ab647694e66", "score": "0.66562057", "text": "def update\n respond_to do |format|\n @question.answers.delete_all()\n question_params.delete(:type)\n if @question.update(question_params)\n format.html { redirect_to xmt_test_questions_url, notice: '编辑成功.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "006d70bc15382fe5cac60d4bd707768b", "score": "0.66538864", "text": "def update\n @multiple_choice_answer = MultipleChoiceAnswer.find(params[:id])\n\n respond_to do |format|\n if @multiple_choice_answer.update_attributes(params[:multiple_choice_answer])\n format.html { redirect_to @multiple_choice_answer, notice: 'Multiple choice answer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @multiple_choice_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0a7b3681c94ae1994c34d6c460dbcf4e", "score": "0.66506374", "text": "def update\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to @answer.question, notice: \"回答を更新しました\" }\n format.json { render :show, status: :ok, location: @answer }\n else\n format.html { render :question }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ca570dc0778caff015eb5b909640a36d", "score": "0.66399145", "text": "def update\n @question = Question.find_by(id: params[:id])\n if @question.update(question_params)\n render json: {question: @question}\n else\n render json: {question: \"\"}\n end\n end", "title": "" }, { "docid": "c12336cfccee8abf79dd33bc51c4e268", "score": "0.6628361", "text": "def update\n \n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to @answer, notice: 'Answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @answer }\n else\n format.html { render :edit }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "db89806a924b7b5b18de89141307816c", "score": "0.6627711", "text": "def update\n @entity.answers.destroy_all # uglyyy\n params[:entity][:questions].each do |question, answer|\n @entity.add_answer(question, answer)\n end\n\n respond_to do |format|\n if @entity.update(entity_params)\n format.html { redirect_to @entity, notice: 'Entity was successfully updated.' }\n format.json { render :show, status: :ok, location: @entity }\n else\n format.html { render :edit }\n format.json { render json: @entity.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "91c869739207d6885d2bdb3255c462d3", "score": "0.66270113", "text": "def update\n question = Question.find(params[:idQuestion])\n if question.update(params_question)\n render json: question, status: 200\n else\n render json: question.errors, status: 422\n end\n\n end", "title": "" }, { "docid": "88e046a5d92bbc065dd90bab42adcb09", "score": "0.66261595", "text": "def update\n respond_to do |format|\n if @admin_interview_question.update(admin_interview_question_params)\n format.html { redirect_to (params[:ref] || @admin_interview_question), notice: t('crud.updated_successfully!', name: Admin::InterviewQuestion.model_name.human) }\n format.json { render :show, status: :ok, location: @admin_interview_question }\n else\n format.html { render :edit }\n format.json { render json: @admin_interview_question.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e6db953fe658355b9b7c18a9efda572f", "score": "0.6624523", "text": "def update\n @question_answer = QuestionAnswer.find(params[:id])\n\n respond_to do |format|\n if @question_answer.update_attributes(params[:question_answer])\n format.html { redirect_to @question_answer, notice: 'Question answer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "17a36d07f37b42ca9e1ecdced8e65d39", "score": "0.66218984", "text": "def update\n # if params[:correct_answer] #radio button selection update\n # @answer = Answer.find(params[:correct_answer].to_i)\n # @answer.question.answers.each do |answer|\n # if answer.id == params[:correct_answer].to_i\n # answer.correct = true\n # end\n # answer.correct = false\n # end\n # redirect_to question_path(@answer.question)\n # else #regular update\n if @answer.update(answer_params)\n redirect_to question_path(@answer.question)\n else\n render :edit\n end\n # end\n end", "title": "" }, { "docid": "9d7280c412d8cd0271da29c5e382a9c4", "score": "0.66217285", "text": "def update\n respond_to do |format|\n if @question.answers.update(answer_params)\n\n format.html { redirect_to @answer, notice: 'Answer was successfully updated.' }\n else\n format.html { render :edit, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dd41f0159af5716c640fe80d89fafb75", "score": "0.6619963", "text": "def update\n respond_to do |format|\n if @answer_question.update(answer_question_params)\n format.html { redirect_to @answer_question, notice: 'Answer question was successfully updated.' }\n format.json { render :show, status: :ok, location: @answer_question }\n else\n format.html { render :edit }\n format.json { render json: @answer_question.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4a2b7cee692a6264a4a66c3207c86745", "score": "0.6619433", "text": "def update\n\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to @test, success: 'Answer was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end", "title": "" }, { "docid": "fcb23eb6d731ffc352aed789a8d6dc54", "score": "0.6617771", "text": "def update\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to @answer.question, notice: 'La respuesta fue modificada correctamente.' }\n format.json { render :show, status: :ok, location: @answer }\n else\n format.html { render :edit }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "316827039cc7cfb4643239aa08c7f17b", "score": "0.6607863", "text": "def update\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to @answer, notice: 'Answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @answer }\n else\n format.html { render :edit }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "316827039cc7cfb4643239aa08c7f17b", "score": "0.6607863", "text": "def update\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to @answer, notice: 'Answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @answer }\n else\n format.html { render :edit }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "316827039cc7cfb4643239aa08c7f17b", "score": "0.6607863", "text": "def update\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to @answer, notice: 'Answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @answer }\n else\n format.html { render :edit }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "316827039cc7cfb4643239aa08c7f17b", "score": "0.6607863", "text": "def update\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to @answer, notice: 'Answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @answer }\n else\n format.html { render :edit }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "316827039cc7cfb4643239aa08c7f17b", "score": "0.6607863", "text": "def update\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to @answer, notice: 'Answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @answer }\n else\n format.html { render :edit }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "316827039cc7cfb4643239aa08c7f17b", "score": "0.6607863", "text": "def update\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to @answer, notice: 'Answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @answer }\n else\n format.html { render :edit }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "316827039cc7cfb4643239aa08c7f17b", "score": "0.6607863", "text": "def update\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to @answer, notice: 'Answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @answer }\n else\n format.html { render :edit }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "316827039cc7cfb4643239aa08c7f17b", "score": "0.6607863", "text": "def update\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to @answer, notice: 'Answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @answer }\n else\n format.html { render :edit }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "316827039cc7cfb4643239aa08c7f17b", "score": "0.6607863", "text": "def update\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to @answer, notice: 'Answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @answer }\n else\n format.html { render :edit }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "316827039cc7cfb4643239aa08c7f17b", "score": "0.6607863", "text": "def update\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to @answer, notice: 'Answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @answer }\n else\n format.html { render :edit }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "316827039cc7cfb4643239aa08c7f17b", "score": "0.6607863", "text": "def update\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to @answer, notice: 'Answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @answer }\n else\n format.html { render :edit }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bb32cfe9572217a249ce28699dec6620", "score": "0.66030365", "text": "def update\n @questionnaire_choice = QuestionnaireChoice.find(params[:id])\n\n if @questionnaire_choice.update(questionnaire_choice_params)\n head :no_content\n else\n render json: @questionnaire_choice.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "0eeb86d8888fe3cf7bb6e206cfca6ba9", "score": "0.65982354", "text": "def update\n respond_to do |format|\n if @answer.update(answer_update_params)\n flash[:notice] = t('controller.successfully_updated', model: t('activerecord.models.answer'))\n format.html { redirect_to @answer }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5a2b12b93c7f6e354ff22a67f3ffd9c3", "score": "0.6588236", "text": "def update\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to @answer, notice: \"Answer was successfully updated.\" }\n format.json { render :show, status: :ok, location: @answer }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dd803a8fe5b999eaa26409020424b641", "score": "0.6577681", "text": "def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, :notice => 'Your question has been updated, dummyface!' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @question.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "495e7982f522418f84353abf98c804f9", "score": "0.6573395", "text": "def update\n respond_to do |format|\n if @question.update(question_params)\n format.json { head :no_content }\n else\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3689577a24430243761ab7f7ae4a6492", "score": "0.65724665", "text": "def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to answer_question_path(@question), notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d2839a79d1a71ed09a9e824a4d2b2abb", "score": "0.6567464", "text": "def update\n current_question.update_attributes!(question_params_with_tag)\n render json: current_question, status: :ok\n end", "title": "" }, { "docid": "b38cb6923112dbccb8181289c0def3e2", "score": "0.6555979", "text": "def update\n respond_to do |format|\n if @correct_answer.update(correct_answer_params)\n format.html { redirect_to @correct_answer, notice: 'Correct answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @correct_answer }\n else\n format.html { render :edit }\n format.json { render json: @correct_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6eda86097570e613087c468a4a21bd86", "score": "0.6555118", "text": "def update\n @answer = Answer.find(params[:id])\n params[:answer].delete :question_id\n authorize! :manage, @reaction\n if @answer.update_attributes(params[:answer])\n respond_to do |format|\n format.html do\n if request.xhr?\n render partial: 'answers/answer',\n locals: { answer: @answer },\n layout: false,\n status: :created\n else\n redirect_to @answer.question\n end\n end\n format.json { head :no_content }\n end\n else\n respond_to do |format|\n format.html do\n if request.xhr?\n render json: @answer.errors, status: :unprocessable_entity\n else\n render action: \"edit\", id: @answer\n end\n end\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9492f5b5479008f0517b07d0eb18a214", "score": "0.6555092", "text": "def update\n @question.answer = question_params[:answer]\n @question.answered = true\n respond_to do |format|\n if @question.save\n format.html { redirect_to user_path(@question.user_id), notice: 'Question was successfully answered.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3d0c577df8d1fd0d554ee9d23148bc95", "score": "0.65495694", "text": "def update\n respond_to do |format|\n if @interview_question.update(interview_question_params)\n format.html { redirect_to @interview_question, notice: 'Interview question was successfully updated.' }\n format.json { render :show, status: :ok, location: @interview_question }\n else\n format.html { render :edit }\n format.json { render json: @interview_question.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c5487eefdb7ffd9fd71751174e36c530", "score": "0.6544118", "text": "def update\n @question = Question.find(params[:question_id])\n @reply = @question.replies.find(params[:id])\n\n respond_to do |format|\n if @reply.update_attributes(params[:reply])\n format.html { redirect_to @question, notice: 'Reponse was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @reply.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "54c650f9c13e92708526bf4cb89e5cd9", "score": "0.65423167", "text": "def update\n @text_question = @base_question.text_question.find(params[:id])\n\n respond_to do |format|\n if @text_question.update_attributes(params[:text_question])\n format.html { redirect_to @text_question, notice: 'Text question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @text_question.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f55bf0186f2fb6ecba831258c8c1512d", "score": "0.6538429", "text": "def update\n respond_to do |format|\n if @correct_answer.update(correct_answer_params)\n format.html { redirect_to @correct_answer, notice: \"Correct answer was successfully updated.\" }\n format.json { render :show, status: :ok, location: @correct_answer }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @correct_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fe89831e0d65d4d6b0afb5c901c5127a", "score": "0.653635", "text": "def update\n @answer = @question.answers.find(params[:id])\n\n respond_to do |format|\n if @answer.update_attributes(params[:answer])\n flash[:notice] = 'Answer was successfully updated.'\n format.html { redirect_to(@question) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @answer.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ba687afacdf27a7b5c1bbf4699ad50d7", "score": "0.6535675", "text": "def update\n respond_to do |format|\n if @answerchoice.update(answerchoice_params)\n format.html { redirect_to @answerchoice, notice: 'Answerchoice was successfully updated.' }\n format.json { render :show, status: :ok, location: @answerchoice }\n else\n format.html { render :edit }\n format.json { render json: @answerchoice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9af0e5be752e6a17c6855ebf6888a873", "score": "0.6530356", "text": "def update\n respond_to do |format|\n if @answer.update(:body => answer_params[:body])\n format.html { redirect_to @answer, notice: 'Answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @answer }\n else\n format.html { render :edit }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ff1243c98f4d3ceea866200c9a971e33", "score": "0.6528863", "text": "def update\n respond_to do |format|\n if @ttest_question.update(ttest_question_params)\n format.html { redirect_to @ttest_question, notice: 'Ttest question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ttest_question.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2e9e6b22203a13c98dc9cf5e16afa0aa", "score": "0.65253276", "text": "def update\n @question = Answer.find(params[:id])\n @answers = @question.answers\n @new_question = Answer.new\n @new_answer = Answer.new\n\n respond_to do |format|\n if @new_answer.update_attributes(params[:answer])\n format.html { redirect_to @new_answer, notice: 'Answer was successfully updated.' }\n format.js # update.js.erb\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.js # update.js.erb\n format.json { render json: @new_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2eee95b0e021587d7fd52b418775b9bc", "score": "0.6515691", "text": "def update\n respond_to do |format|\n if @survey.update(survey_params)\n if params[:another_answer]\n Answer.create(:survey_id => @survey.id,:content => \"Other\", :is_other => true)\n end\n if params[:add_answers_action] && params[:add_answers_action] == 'add_answers'\n format.html { redirect_to @survey, notice: 'Survey was successfully updated.' }\n else\n format.html { redirect_to add_answer_survey_path(@survey) }\n end\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a5fded8e0177135e0201eb100f74a78e", "score": "0.6503142", "text": "def update\n respond_to do |format|\n format.json {\n question_id = extract_int params, :question_id\n\n # if bad request\n if question_id.nil?\n render :json => reply(false, t(:missing_params))\n\n # if okay\n else\n question = Question.where(id: question_id).first\n\n # no such record ?\n if question.nil?\n render :json => reply(false, t(:no_such_question))\n # user who is attempting to edit question isnt author nor admin?\n elsif !is_admin_or_author?(current_user,question)\n render :json => reply(false, t(:question_edit_insufficient_privileges))\n # everything is okay?\n else\n question.title= params[:title] unless params[:title].nil?\n question.content= do_sanitize_qa_content(params[:content]) unless params[:content].nil?\n\n # if is admin, enable \"open\" change\n if is_admin? && !params[:open].nil? && !params[:description].nil?\n question.open= params[:open]\n question.status_description= params[:description]\n end\n\n question.editor_id= current_user.id\n\n if !question.valid?\n render :json => reply(false, t(:question_edit_invalid_new_values))\n else\n if question.save\n Log.log(\"User #{current_user.username} (UID = #{current_user.id}) edited question '#{question.id}' by author with UID = #{question.author.id}\",request.remote_ip)\n render :json => reply(true, t(:question_editing_successful))\n else\n render :json => reply(false, t(:question_editing_failed))\n end\n end\n end\n end\n }\n format.html {\n render :status => :method_not_allowed, :nothing => true\n return\n }\n end\n end", "title": "" }, { "docid": "a24a5f02871677407fdbd3d5dca28817", "score": "0.6494747", "text": "def update\r\n @multi_choice_question = MultiChoiceQuestion.find(params[:multi_choice_question_id])\r\n @multi_choice_answer = MultiChoiceAnswer.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @multi_choice_answer.update_attributes(params[:multi_choice_answer])\r\n format.html { redirect_to(@multi_choice_question, :notice => 'Multi choice answer was successfully updated.') }\r\n format.xml { head :ok }\r\n else\r\n format.html { render :action => \"edit\" }\r\n format.xml { render :xml => @multi_choice_answer.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end", "title": "" }, { "docid": "7596ffe8907e58c0af3cdd9f634ef39f", "score": "0.6492714", "text": "def update\n # @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "47b6daf65a5122a4722c4468f2cf7d1e", "score": "0.64912874", "text": "def update\n @answered_question_info = AnsweredQuestionInfo.find(params[:id])\n\n respond_to do |format|\n if @answered_question_info.update_attributes(params[:answered_question_info])\n format.html { redirect_to @answered_question_info, :notice => 'Answered question info was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @answered_question_info.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8e566efe64820e5f1d00407060aa4c53", "score": "0.64886427", "text": "def update\n @answer_item = AnswerItem.find(params[:id])\n\n respond_to do |format|\n if @answer_item.update_attributes(params[:answer_item])\n format.html { redirect_to @answer_item, notice: 'Answer item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @answer_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "182ea8abe1b0320d85357a5269b6d20b", "score": "0.64879525", "text": "def update\n unless params[:questionable_type].present?\n reset_answers if answer_params[:correct] == \"true\"\n @answer.update(answer_params)\n @answer.save\n @answer.image.update(:title => params[:image_title]) if @answer.image.present?\n @answer.crop_and_scale!(params) if params[:image_id].present?\n params[:answer_results].each do |value|\n answer_result = @answer.answer_results.find_or_initialize_by(result_id: value[0])\n answer_result.update(:value => value[1])\n end if params[:answer_results].present?\n end\n respond_to do |format|\n if @answer.save\n format.html\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "73691c879b95c8a736965ed6fd3dc4bf", "score": "0.6485198", "text": "def update\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to overview_users_url, notice: 'Answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @answer }\n else\n format.html { render :edit }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8aa5f5dca3ae0a455fcf4369497e1999", "score": "0.6478232", "text": "def update\n @question = Quiz::Question.find(params[:id])\n\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "501a9c296192754d6b0c846526fece34", "score": "0.6476939", "text": "def update\n @custom_question_answer = CustomQuestionAnswer.find(params[:id])\n\n respond_to do |format|\n if @custom_question_answer.update_attributes(params[:custom_question_answer])\n format.html { redirect_to(@custom_question_answer, :notice => 'Custom question answer was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @custom_question_answer.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d1975fc2b7456af42316d37468e5d60b", "score": "0.64757687", "text": "def update\n @survey = current_user.surveys.find(params[:survey_id])\n @question = @survey.questions.find(params[:id])\n @question.process_answer_choices(params)\n \n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to(survey_question_path(@survey, @question), :notice => 'Question was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "37f76e96b23f5caf6feeafcd259fed0d", "score": "0.64753824", "text": "def update\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to root_path, notice: 'Presentation was successfully updated.' }\n format.json { render :show, status: :ok, location: @answer }\n else\n format.html { render :edit }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "512b188fe7b20958325f0eaa55832de1", "score": "0.64745665", "text": "def update\n respond_to do |format|\n if @has_answers_set.update(has_answers_set_params)\n format.html { redirect_to @has_answers_set, notice: 'Has possible answers set was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @has_answers_set.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cc5c31fdc00a310e8595351928f8d0cb", "score": "0.6471783", "text": "def update\n if @answer.update_attribute(:answer, params[:answer])\n return render json: {message: 'Answer was updated succesfully'}\n else\n return render json: {message: 'Error: Answer was not updated succesfully'}\n end\n end", "title": "" }, { "docid": "0af71cd4bbdee1a7159e1b972c714a49", "score": "0.6471083", "text": "def update\n @my_question = My_question.find(params[:id])\n\n respond_to do |format|\n if @my_question.update_attributes(params[:my_question])\n format.html { redirect_to @my_question, notice: 'my_question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @my_question.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e54269c28a059550cdfb17b71c70a871", "score": "0.646968", "text": "def update\n @survey_answer = SurveyAnswer.find(params[:id])\n\n respond_to do |format|\n if @survey_answer.update_attributes(params[:survey_answer])\n format.html { redirect_to @survey_answer, notice: 'Survey answer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
8187e7a42b4b76e24b2d0cd019977f44
POST /weather_records POST /weather_records.json
[ { "docid": "344b13dfdfd86fa51ce8a2277c4b953f", "score": "0.6904025", "text": "def create\n @weather_record = WeatherRecord.new(weather_record_params)\n\n respond_to do |format|\n if @weather_record.save\n format.html { redirect_to @weather_record, notice: 'Weather record was successfully created.' }\n format.json { render :show, status: :created, location: @weather_record }\n else\n format.html { render :new }\n format.json { render json: @weather_record.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "481220eff7a1ad709510fef8448927a6", "score": "0.6910035", "text": "def create\n @weather_record = WeatherRecord.new(params[:weather_record])\n\n respond_to do |format|\n if @weather_record.save\n format.html { redirect_to @weather_record, notice: 'Weather record was successfully created.' }\n format.json { render json: @weather_record, status: :created, location: @weather_record }\n else\n format.html { render action: \"new\" }\n format.json { render json: @weather_record.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d0e91591387367bb60d2401130fd01bb", "score": "0.62568974", "text": "def index\n @weather_records = WeatherRecord.all\n end", "title": "" }, { "docid": "5096997cc8e16ffbd890a1bc7b88b3f5", "score": "0.6153905", "text": "def create\n create\n @weather = Weather.new(weather_params)\n\n respond_to do |format|\n if @weather.save\n format.html { redirect_to @weather, notice: 'Weather was successfully created.' }\n format.json { render json: @weather, status: :created, location: @weather }\n else\n format.html { render action: \"new\" }\n format.json { render json: @weather.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7ec66854c31683ebdac19c69e0281610", "score": "0.6150477", "text": "def create\n @weather = Weather.new(params[:weather])\n\n respond_to do |format|\n if @weather.save\n format.html { redirect_to @weather, notice: 'Weather was successfully created.' }\n format.json { render json: @weather, status: :created, location: @weather }\n else\n format.html { render action: \"new\" }\n format.json { render json: @weather.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7ec66854c31683ebdac19c69e0281610", "score": "0.6150477", "text": "def create\n @weather = Weather.new(params[:weather])\n\n respond_to do |format|\n if @weather.save\n format.html { redirect_to @weather, notice: 'Weather was successfully created.' }\n format.json { render json: @weather, status: :created, location: @weather }\n else\n format.html { render action: \"new\" }\n format.json { render json: @weather.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3c033bafec4d54002d5d6a633337d99e", "score": "0.61183715", "text": "def postReadings(info, state)\r\n params = {\r\n :device_id => info.deviceId,\r\n :sensor_data => [\r\n {\r\n :type => \"Temperature\",\r\n :value => state.temperature,\r\n :time => Time.now.to_i\r\n },\r\n {\r\n :type => \"Humidity\",\r\n :value => state.humidity,\r\n :time => Time.now.to_i\r\n }\r\n ]\r\n }\r\n res = apiPostJson(\"readings\", params)\r\n if res.status != 201\r\n $LOG.warn(\"Failed to post readings to backend! Status: #{res.status}, Response: #{res.body}\")\r\n end\r\n end", "title": "" }, { "docid": "409b8ad5527e65982b18d1700ab1a834", "score": "0.60852623", "text": "def load(records)\n records.map do |h| \n r = WeatherObservation.first_or_create({:weather_station_id => h[:weather_station_id], :date => h[:date]}, h)\n if (r.id.nil?)\n $stderr.puts(\"failed to save #{r.inspect}, #{r.errors.full_messages}\")\n end\n end\n end", "title": "" }, { "docid": "ff64e8a10d0e74ac6434f50e93b206cc", "score": "0.60703295", "text": "def getWeatherData\n @tempModel = Temp\n current_date = Date.today.strftime \"%Y-%m-%d\"\n \n response = RestClient.get(\"http://api.worldweatheronline.com/premium/v1/past-weather.ashx?key=#{ENV['WEATHER_API_KEY']}&q=30.404251,-97.849442&date=2020-06-05&enddate=#{current_date}&format=json\n \", headers={})\n jsonified_response = JSON.parse(response)\n \n # API response is parsed and inserted into DB by the model method postWeatherData\n @tempModel.postWeatherData(jsonified_response);\n puts current_date\n end", "title": "" }, { "docid": "006b46938314dde6a4ea35db37e6f245", "score": "0.6005618", "text": "def index\n begin\n start_time, end_time = get_start_time_and_end_time(params)\n longitude, latitude = get_longitude_and_latitude(params)\n fields = get_fields(params)\n if longitude and latitude\n q = WeatherLog.nearby(100, longitude, latitude)\n else\n q = WeatherLog.all\n end\n if start_time and end_time\n q = q.where(datetime: start_time..end_time)\n elsif start_time\n q = q.where(\"datetime >= ?\", start_time)\n elsif end_time\n q = q.where(\"datetime <= ?\", end_time)\n end\n\n @weather_logs = q.order(datetime: :asc).limit(2000)\n\n respond_to do |format|\n if fields\n format.json { render json: @weather_logs.as_json(only: fields)}\n else\n format.json { render json: @weather_logs.as_json(only: get_all_valid_fields)}\n end\n end\n rescue Exception => e\n respond_to do |format|\n format.json { render json: {status: \"Invalid Request #{e}\"} }\n end\n end\n end", "title": "" }, { "docid": "2428b314d56edd51eca8fed3a3176394", "score": "0.5999751", "text": "def new\n @weather_record = WeatherRecord.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @weather_record }\n end\n end", "title": "" }, { "docid": "724d8b366fcc56f96e34d8aaaaad69c8", "score": "0.5998614", "text": "def weather_api\n url = URI('https://api.weatherbit.io/v2.0/forecast/daily?city=Santiago&key=a01895cdf39141f9a8a77e66aafbcca2')\n https = Net::HTTP.new(url.host, url.port)\n https.use_ssl = true\n request = Net::HTTP::Get.new(url)\n https.use_ssl = true\n https.verify_mode = OpenSSL::SSL::VERIFY_PEER\n request['cache-control'] = 'no-cache'\n request['Postman-Token'] = 'e29ce4a5-022b-47aa-b42a-bb571635fc04'\n response = https.request(request)\n response = JSON.parse response.read_body\n temp = []\n response['data'].each_with_index do |r, index|\n temp.push(r['high_temp'])\n break if index > 6\n end\n Weather.create(hot_weather: temp.any? { |t| t > 24 })\n end", "title": "" }, { "docid": "c0036a81be31a9e4027485b2fa78734a", "score": "0.59914035", "text": "def daily_forecast(location)\n id = location_id[location.downcase.to_sym]\n puts id\n# Maybe call it weather_update to call at 00:01 every day, needs to iterate over each location\n url = \"http://datapoint.metoffice.gov.uk/public/data/val/wxfcs/all/json/#{id}?res=3hourly&key=0da4e1ea-8681-47bc-a5f9-5ab535ff75f2\"\n resp = Net::HTTP.get_response(URI.parse(url))\n data = resp.body\n result = JSON.parse(data)\n tomorrow = result[\"SiteRep\"][\"DV\"][\"Location\"][\"Period\"][1][\"Rep\"]\n\n @temp_tomorrow=[]\n tomorrow.each do |f|\n @temp_tomorrow << f[\"F\"].to_i\n end\n @cloud_tomorrow=[]\n tomorrow.each do |f|\n @cloud_tomorrow << f[\"V\"].to_i\n end\n @rain_tomorrow=[]\n tomorrow.each do |f|\n @rain_tomorrow << f[\"Pp\"].to_i\n end\n @wind_tomorrow=[]\n tomorrow.each do |f|\n @wind_tomorrow << f[\"S\"].to_i\n end\n\n tomorrow = WeatherData.new \n tomorrow.date = [Date.today.next_day.year, Date.today.next_day.month, Date.today.next_day.day]\n tomorrow.location = location\n tomorrow.temperature = @temp_tomorrow\n tomorrow.rainfall = @rain_tomorrow\n tomorrow.wind = @wind_tomorrow\n tomorrow.cloud = @cloud_tomorrow\n tomorrow.save\nend", "title": "" }, { "docid": "dd73d3f4aa02b37dde427b300aadaad4", "score": "0.5957701", "text": "def create\n @weather_log = WeatherLog.new(weather_log_params)\n\n respond_to do |format|\n if @weather_log.save\n format.html { redirect_to @weather_log, notice: 'Weather log was successfully created.' }\n format.json { render :show, status: :created, location: @weather_log }\n else\n format.html { render :new }\n format.json { render json: @weather_log.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fea1ddc63bf789c092e2f6a622b06ffe", "score": "0.5908823", "text": "def create\n# @weather = Weather.new(weather_params)\n\n\t# Montyレポートの取得\n @parse_weather_data = WeathersHelper::ParseWheatherData.new(\"public/weather_data/daily\")\n @weather_data = @parse_weather_data.main\n\n @weather_data.each do |w|\n w.data.each do |line|\n @weather = Weather.new(\n :area => w.area,\n :date => line[0],\n :ave_temperature => line[1],\n :max_temperature => line[4],\n :min_temperature => line[7],\n :rainfall => line[10],\n :max_rainfall => line[14],\n :day_length => line[18],\n :insolation => line[22],\n :max_snow => line[25],\n :total_snow => line[29],\n :ave_wind_speed => line[33],\n :max_wind_speed => line[36],\n :max_wind_direction => line[38],\n :momentary_wind_speed => line[41],\n :momentary_wind_direction => line[43],\n :most_direction => line[46],\n :ave_stream_pressure => line[49],\n :ave_humidity => line[52],\n :min_himidity => line[55],\n :ave_pressure => line[58],\n :ave_sea_pressure => line[61],\n :min_sea_pressure => line[64],\n :ave_cloud_amount => line[68],\n :outline06_18 => line[71],\n :outline18_06 => line[74]\n )\n @weather.save\n end\n end unless @weather_data.nil?\n\n # Dailyレポートの取得\n @parse_weather_data = WeathersHelper::ParseWheatherData.new(\"public/weather_data/hourly\")\n @weather_data = @parse_weather_data.main\n\n @weather_data.each do |w|\n w.data.each do |line|\n @weather_hours = WeatherHour.new(\n :area => w.area,\n :date => line[0].split[0],\n :t_time => line[0].split[1],\n :date_time => line[0],\n :temperature => line[1],\n :wind_speed => line[4],\n :wind_direction => line[6],\n :railfall => line[9],\n :snow => line[13],\n :day_length => line[21],\n :insolation => line[25],\n :pressure => line[28],\n :sea_pressure => line[31],\n :humidity => line[34],\n :stream_pressure => line[37],\n )\n @weather_hours.save\n end\n end unless @weather_data.nil?\n\n respond_to do |format|\n format.html { redirect_to @weather, notice: 'Weather was successfully created.' }\n format.json { render :show, status: :created, location: @weather }\n=begin\n if @weather.save\n format.html { redirect_to @weather, notice: 'Weather was successfully created.' }\n format.json { render :show, status: :created, location: @weather }\n else\n format.html { render :new, notice: 'Found Same Data' }\n format.json { render json: @weather.errors, status: :unprocessable_entity }\n end\n=end\n end\n end", "title": "" }, { "docid": "4094e79dff5e9f897ec054d466922941", "score": "0.58594924", "text": "def weather\n # empty array dates is still fine, not a reason for 400 (happens for venues without courts)\n render json: {} and return if params.dig(:dates).blank?\n\n forecast = WeatherForecaster.call(venue, [*params.require(:dates)])\n json = forecast.transform_values do |value|\n value ? value.slice(*%w(icon temperature)) : nil\n end\n render json: json\n end", "title": "" }, { "docid": "83bcdc060ba47834f02feba7cf4a7f39", "score": "0.5849104", "text": "def create\n @weather_event = WeatherEvent.new(params[:weather_event])\n\n respond_to do |format|\n if @weather_event.save\n format.html { redirect_to @weather_event, notice: 'Weather event was successfully created.' }\n format.json { render json: @weather_event, status: :created, location: @weather_event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @weather_event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "226e3a0f5e7cd59ae51ce5a594eda911", "score": "0.5780362", "text": "def weather_record_params\n params.fetch(:weather_record, {})\n end", "title": "" }, { "docid": "0872bfce8c7380bfc5720e61b74c9cb2", "score": "0.5765861", "text": "def create\n @meteo_datum = MeteoDatum.new(meteodatum_params)\n @meteo_datum.weather_station_id = params[:weather_station_id]\n\n if @meteo_datum.save\n render json: @meteo_datum, status: :created\n else\n render json: @meteo_datum.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "29d8ebe9263dc5ffe724c619edf34887", "score": "0.5750178", "text": "def add_weather_by_rest(auth,weather_json)\n rest_agent=RestClient::Resource.new(\"http://#{auth[:host]}:#{auth[:port]}/#{auth[:reststr]}/ry/weather\")\n rest_agent.post(weather_json, :content_type=>\"application/json;charset=utf-8\")\n end", "title": "" }, { "docid": "406522bf30a641d73f6be503ccf39211", "score": "0.5737275", "text": "def weather_params\n params.require(:weather).permit(:city_id, :date, :temperature, :type)\n end", "title": "" }, { "docid": "147f6132ced333bd37682d2c4ca4a018", "score": "0.5719424", "text": "def add_24hour_weather_from_moji_by_rest(auth,weatherfilepath)\n jsl=get_24h_moji_json_list(weatherfilepath)\n\tcity={\"province\"=>\"北京\",\"city\"=>\"北京市\",\"district\"=>\"东城区\"}\n jsl.each do |j|\n diqu=JSON.parse(j)\n diqu.each do |k,v|\n if k == \"data\" \n v.each do |dk,dv|\n\t\t if dk == \"city\"\n dv.each do |dkk,dkv|\n if dkk == \"pname\"\n city[\"city\"] = dkv\n\t\t\t\tend #if dkk == \"pname\"\n if dkk == \"name\"\n case dkv\n when \"北京市朝阳区\"\n city[\"district\"] = \"朝阳区\"\n when \"北京市通州区\"\n city[\"district\"] = \"通州区\"\n when \"密云区\"\n city[\"district\"] = \"密云县\"\n when \"延庆区\"\n city[\"district\"] = \"延庆县\"\n else\n city[\"district\"] = dkv\n end #case dkv\n puts city[\"district\"]\n end #if dkk == \"name\"\n\t\t\t end #dv.each do |dkk,dkv|\n end #if dk == \"city\"\n if dk == \"hourly\"\n dv.each do |hourk|\n puts hourk[\"date\"]+\": \"+hourk[\"hour\"]\n tianqi=get_hotcloud_info_from_moji_rest(hourk,city)\n wjson=JSON.generate(tianqi)\n add_weather_by_rest(auth,wjson)\n end #dv.each do |hourk|\n end #if dk == \"hourly\"\n end #v.each do |dk,dv|\n end #if k == \"data\" \n end #diqu.each do |k,v|\n\tend #jsl.each do |j|\n end", "title": "" }, { "docid": "98c90af3909ed635b60371ad84f220dc", "score": "0.5719072", "text": "def create\n @weather_test = WeatherTest.new(weather_test_params)\n\n respond_to do |format|\n if @weather_test.save\n format.html { redirect_to @weather_test, notice: 'Weather test was successfully created.' }\n format.json { render :show, status: :created, location: @weather_test }\n else\n format.html { render :new }\n format.json { render json: @weather_test.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4fccd28d25ca80533b6a2084691170da", "score": "0.5701284", "text": "def add_weather_by_rest(auth,weather_json)\n rest_agent=RestClient::Resource.new(\"http://#{auth[:host]}:#{auth[:port]}/#{auth[:reststr]}/ry/weather\")\n rest_agent.post(weather_json, :content_type=>\"application/json;charset=utf-8\")\n end", "title": "" }, { "docid": "a6c53daddb1b42d59e9b02da55d6e806", "score": "0.5678742", "text": "def create\n @weather_reading = WeatherReading.new(weather_reading_params)\n\n respond_to do |format|\n if @weather_reading.save\n format.html { redirect_to @weather_reading, notice: 'Weather reading was successfully created.' }\n format.json { render :show, status: :created, location: @weather_reading }\n else\n format.html { render :new }\n format.json { render json: @weather_reading.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a3410c8bfbc56b3b004d0c642aeb4ba2", "score": "0.5657178", "text": "def index\n\n require 'net/http'\n require 'json'\n\n @measures = Measure.all.order(\"created_at DESC\")\n weatherData\n\n end", "title": "" }, { "docid": "dd5109373d0b8bb7bb6141a0084451b9", "score": "0.5634748", "text": "def get_weather\n location_id = params[:location_id].to_i\n date = Date.parse(params[:date])\n location = Location.find(location_id)\n current_time = Time.now\n weather_obs_list = Observation.where(location_id: location_id)\n latest_weather = weather_obs_list.last\n\n if (latest_weather.updated_at - current_time).to_i.abs > 30*60\n current_temp = \"Null\"\n else\n current_temp = latest_weather.temperature\n end\n\n current_cond = \"sunny\"\n if latest_weather.rainfall == 0\n current_cond = \"sunny\"\n else\n current_cond = \"raining\"\n end\n\n @hash = {}\n @hash[\"date\"] = date\n @hash[\"current_temp\"] = current_temp\n @hash[\"current_cond\"] = current_cond\n\n measurements = Array.new\n weather_obs_list.each do |weather|\n if weather.timestamp.to_date == date\n measurement_hash = Hash.new\n measurement_hash[\"time\"] = weather.updated_at\n measurement_hash[\"temp\"] = weather.temperature\n measurement_hash[\"precip\"] = weather.rainfall\n measurement_hash[\"wind_direction\"] = weather.wind_dir\n measurement_hash[\"wind_speed\"] = weather.wind_speed\n measurements << measurement_hash\n end\n end\n @hash[\"measurements\"] = measurements\n end", "title": "" }, { "docid": "59c426cb6e54638384198cab82e90da8", "score": "0.56258", "text": "def create\n weather_datum = WeatherDatum.new(weather_datum_params)\n weather_datum.set_sensor_id(request.headers['Authorization'].match(/(Token token=)(.*)/)[2])\n sent = false\n\n if weather_datum.save\n\n if weather_datum.temp > weather_datum.sensor.trigger_temp_max\n\n if Notification.last_notification_status(weather_datum.sensor)\n recipients = []\n notification = Notification.new message: \"Temperature Alert: #{weather_datum.temp}F @ #{weather_datum.location}!\",\n weather_datum_id: weather_datum.id,\n sensor_id: weather_datum.sensor.id,\n contacts: []\n\n Email.all.each do |e|\n e.sensors.each do |id|\n if ( Sensor.find(id).location == weather_datum.location )\n notification.contacts << e.email\n # SensorMailer.temp_email(e.email, l, data.temp, data.humidity).deliver_now\n recipients << e.email\n end\n end\n end\n sent = true\n notification.save!\n\n end\n end\n\n render json: {status: \"Record was created!\", notification: sent}\n else\n render json: {status: \"Record wasn't created!\", errors: weather_datum.errors}\n end\n end", "title": "" }, { "docid": "463f20e31c4c213c6cc985bc0c68be92", "score": "0.5622628", "text": "def index\n @weather_events = WeatherEvent.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @weather_events }\n end\n end", "title": "" }, { "docid": "f138f781f9ddc6d297b15ef0c2f679c4", "score": "0.56208163", "text": "def create\n data = []\n trace_params.each do |p|\n hash = {\n latitude: p[\"latitude\"],\n longitude: p[\"longitude\"]\n }\n data << hash\n end\n\n if Trace.upload_data(data)\n render json: {status: 'OK'}\n else\n render json: @trace.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "9440a27e2cdda19b8ffbd12376c65e58", "score": "0.56148636", "text": "def index\n render json: WeatherDatum.all\n end", "title": "" }, { "docid": "95e98a9cc8d327ac5ea38ee0fc384c62", "score": "0.5586628", "text": "def set_weather_record\n @weather_record = WeatherRecord.find(params[:id])\n end", "title": "" }, { "docid": "8a38961f375815a34c4b2e5aa0112d7f", "score": "0.5579578", "text": "def add_24hour_weather_from_moji_by_rest(auth,weatherfilepath)\n\t\t jsl=get_24h_moji_json_list(weatherfilepath)\n\t\t chengqu=\"\"\n\t\t jsl.each do |j|\n\t\t diqu=JSON.parse(j)\n\t\t diqu.each do |k,v|\n\t\t if k == \"data\" \n v.each do |dk,dv|\n dv.each do |dkk,dkv|\n if dkk == \"name\"\n chengqu = dkv\n\t\t\t\t\t case chengqu\n\t\t\t\t\t when \"北京市朝阳区\"\n\t\t\t\t\t chengqu = \"朝阳区\"\n\t\t\t\t\t when \"北京市通州区\"\n\t\t\t\t\t chengqu = \"通州区\"\n\t\t\t\t\t when \"密云区\"\n\t\t\t\t\t chengqu = \"密云县\"\n\t\t\t\t\t when \"延庆区\"\n\t\t\t\t\t chengqu = \"延庆县\"\n\t\t\t\t\t end\n\t\t\t\t\t \n puts chengqu\n end\n end\n if dk == \"hourly\"\n dv.each do |hourk|\n\t\t\t\t puts hourk[\"date\"]+\": \"+hourk[\"hour\"]\n tianqi=get_hotcloud_info_from_moji_rest(hourk,chengqu)\n\t\t\t\t\t wjson=JSON.generate(tianqi)\n\t\t\t\t\t puts wjson\n add_weather_by_rest(auth,wjson)\n end\n end\n end\n\t\t end\n\t\t end\n\t\t end\n end", "title": "" }, { "docid": "d82309559a771e6a3fdc78cad401bbb7", "score": "0.55491215", "text": "def create\n @nfl_weather = NflWeather.new(nfl_weather_params)\n\n respond_to do |format|\n if @nfl_weather.save\n format.html { redirect_to @nfl_weather, notice: 'Nfl weather was successfully created.' }\n format.json { render :show, status: :created, location: @nfl_weather }\n else\n format.html { render :new }\n format.json { render json: @nfl_weather.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1495e3ed5c757cb916e017ad9a8b6847", "score": "0.5529962", "text": "def create\n @record = Record.new(record_params)\n \n if @record.save\n render json: @record\n else\n render error: {error: \"Unable to create record\"}, status: :400\n end\n end", "title": "" }, { "docid": "93f5cd86276ac82fd4b856b212885a52", "score": "0.549001", "text": "def test_post_sample_traces\n header 'Content-Type', 'application/json'\n\n (0..4).each do |i|\n data = File.read \"sample-traces/#{i}.json\"\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n assert last_response.ok?\n end\n end", "title": "" }, { "docid": "4fcf1cb821b1944756c351846711b26c", "score": "0.5488979", "text": "def weather_params\n params.require(:weather).permit(:time, :week, :location)\n end", "title": "" }, { "docid": "41f4da86c8c549ecb942a1b959bc723a", "score": "0.5486762", "text": "def forecast(city)\n response = RestClient.get \"http://api.openweathermap.org/data/2.5/forecast?q=#{city}&units=metric\"\n if !city\n return\n end\n response_hash = JSON.parse response\n status = response_hash.empty?\n status = !status\n if status\n list = response_hash[\"list\"]\n message = \"City: #{response_hash[\"city\"][\"name\"]}\\n\"\n list.each do |str|\n str_date = str[\"dt_txt\"]#.split(\" \")\n #date = str_date[0]\n #time = str_date[1]\n message += \"Date: #{str_date}\\n\" \n message += \"Temp: #{str[\"main\"][\"temp\"]}\\n\"\n message += \"Max Temp: #{str[\"main\"][\"temp_max\"]}\\n\"\n message += \"Min Temp: #{str[\"main\"][\"temp_min\"]}\\n\"\n end\n else\n message = \"Sorry your request could not be processed please try again\\n\"\n end\n puts message\n message\nend", "title": "" }, { "docid": "2ea137c123f44a6dabe8da128f10c671", "score": "0.5483677", "text": "def index\n weathers = Weather.all\n render json: weathers, status: 200\n end", "title": "" }, { "docid": "37f712831b8760685c2dfe0c34cc547f", "score": "0.54555285", "text": "def set_weather_datum\n render json: WeatherDatum.find(params[:id])\n end", "title": "" }, { "docid": "e96344f06a80544d59d61a9378de8d54", "score": "0.5435767", "text": "def create\n\t\turi = URI.parse(Counter::Application.config.simplyurl)\n\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\t\n\t\trequest = Net::HTTP::Post.new('/offsets.json')\n\t\tputs params\n\t\tputs params.slice(*['custids','acctids','itemids'])\n\t\t\n\t\t# ok, this join stuff is bogus - it encodes properly, but the other side only sees the last element and loses the array type - it's just string\n\t\t# this way, i 'split' it at the other side to recover my array\n\t\t# it should work without the join/split crap, but it doesn't\n\t\trequest.set_form_data({:custids => ( params['custids'] || []).join(','), :acctids => ( params['acctids'] || []).join(','), :itemids => ( params['itemids'] || []).join(','), :amount => params['amount'], :type => params['type']})\n\t\t\n\t\tputs request.body\n\t\t\n\t\tresponse = http.request(request)\n\t\tputs response.body\n\n respond_to do |format|\n format.html { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n format.json { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n end\n end", "title": "" }, { "docid": "38253fdc3dae97aa6e2890908343703a", "score": "0.5429069", "text": "def create\n @weather_item = WeatherItem.new(params[:weather_item])\n\n respond_to do |format|\n if @weather_item.save\n format.html { redirect_to @weather_item, notice: 'Weather item was successfully created.' }\n format.json { render json: @weather_item, status: :created, location: @weather_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @weather_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "34b578827367cf0ef3f835e35d3d3c36", "score": "0.5418124", "text": "def current_weather_data\r\n response = self.get_data\r\n\r\n # next steps: error handling in case the call breaks outright and returns nothing / no error code / a socketerror\r\n return unless response.response.code == \"200\"\r\n\r\n data_points = JSON.parse(response.body)[\"list\"]\r\n weather_hash = {}\r\n\r\n # loop through the data points and then add to a list of points for each individual day\r\n data_points.map { |data_point|\r\n forecast_time = DateTime.strptime(data_point[\"dt\"].to_s,'%s').in_time_zone(\"Central Time (US & Canada)\")\r\n forecast_date = forecast_time.strftime(\"%B %-e\")\r\n weather_hash[forecast_date] = [] if weather_hash[forecast_date].blank?\r\n\r\n temperature = data_point[\"main\"][\"temp\"]\r\n weather_text = data_point[\"weather\"].first[\"description\"]\r\n icon = data_point[\"weather\"].first[\"icon\"]\r\n\r\n weather_hash[forecast_date] << {temperature: temperature, weather: weather_text, icon: icon}\r\n }\r\n\r\n weather_hash.keys.each do |key|\r\n weather_hash[key] = daily_weather(weather_hash[key])\r\n end\r\n\r\n # sometimes the way that the forecast looks out, we end up with extra days' worth of content\r\n # I'd check with the PO to see if we only want to consider full days of weather data\r\n # but for now I'm going to focus on the first five soonest days we have data for, and ignore the bits of day 6 that might creep into the feed\r\n return engagement_data(weather_hash).first(5)\r\n end", "title": "" }, { "docid": "5e2988ed67f87d3486550b3ec65d77f5", "score": "0.5407156", "text": "def weather_datum_params\n params.require(:weather_datum).permit(:temp, :humidity, :location)\n end", "title": "" }, { "docid": "496fdd091091af19652aab202373e88c", "score": "0.5402037", "text": "def populateDatabase\n self.getWeatherData()\n @temps = []\n # Super hacky and kind of a bad practice but its the best I could come up with for the time being\n temps_from_db = Temp.last(1152)\n temps_from_db.each do |record|\n if record.id % 47 == 0\n @temps << record\n end\n end\n render json: @temps\n end", "title": "" }, { "docid": "ef058a5b920220c1cb9b4c934643297f", "score": "0.5394459", "text": "def save_city_weather(api_weather_data, city)\n city_weather_params = {\n :city_id => city.id,\n :temperature => api_weather_data['main']['temp'],\n :temperature_minimum => api_weather_data['main']['temp_min'],\n :temperature_maximum => api_weather_data['main']['temp_max'],\n :pressure_sea_level_default => api_weather_data['main']['pressure'],\n :pressure_seal_level => api_weather_data['main']['sea_level'],\n :pressure_ground_level => api_weather_data['main']['grnd_level'],\n :humidity => api_weather_data['main']['humidity'],\n :cloudiness_percentage => api_weather_data['clouds']['all'],\n :wind_speed => api_weather_data['wind']['speed'],\n :wind_degree => api_weather_data['wind']['deg'],\n :time_of_data_forecasted => api_weather_data['dt_txt'],\n }\n\n if !api_weather_data['snow'].nil? and api_weather_data['snow']['3h'].nil?\n city_weather_params[:snow_volume] = api_weather_data['snow']['3h'];\n end\n\n if !api_weather_data['rain'].nil? and !api_weather_data['rain']['3h']\n city_weather_params[:rain_volume] = api_weather_data['rain']['3h'];\n end\n\n city_weather = CityWeather.new(city_weather_params)\n\n unless city_weather.save\n #proabably duplicate entry\n else\n @saved_weather_rows += 1\n api_weather_data['weather'].each do |weather_condition_data|\n save_city_weather_conditions(weather_condition_data, city_weather)\n end\n\n end\n end", "title": "" }, { "docid": "92556b18e1b90cb84f9b8faed1dbe9c2", "score": "0.5384725", "text": "def weather_params\n # params.require(:weather).permit(:area, :date, :ave_temperature, :max_temperature, :min_temperature, :rainfall, :max_rainfall, :day_length, :insolation, :max_snow, :total_snow, :ave_wind_speed, :max_wind_speed, :max_wind_direction, :momentary_wind_speed, :momentary_wind_direction, :most_direction, :ave_stream_pressure, :ave_humidity, :min_himidity, :ave_pressure, :ave_sea_pressure, :min_sea_pressure, :ave_cloud_amount, :outline06_18, :outline18_06)\n end", "title": "" }, { "docid": "72b182589f9d05c346e38e7ad29c57ba", "score": "0.5372024", "text": "def api_call(lat, lon)\n p url = \"https://api.apixu.com/v1/forecast.json?key=#{ENV['WEATHER_KEY']}&q=#{lat},#{lon}&days=7\"\n JSON.parse(open(url).read)\n end", "title": "" }, { "docid": "13b04d39719f2863793f4ba556a8f82a", "score": "0.5369997", "text": "def create\n @dummy_record = DummyRecord.new(params[:dummy_record])\n\n respond_to do |format|\n if @dummy_record.save\n format.html { redirect_to @dummy_record, :notice => 'Dummy record was successfully created.' }\n format.json { render :json => @dummy_record, :status => :created, :location => @dummy_record }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @dummy_record.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1cad18f87d72c7955640e7cd1923ac7a", "score": "0.53627247", "text": "def create\n @weather_measure = WeatherMeasure.new(weather_measure_params)\n\n respond_to do |format|\n if @weather_measure.save\n format.html { redirect_to @weather_measure, notice: 'Weather measure was successfully created.' }\n format.json { render :show, status: :created, location: @weather_measure }\n else\n format.html { render :new }\n format.json { render json: @weather_measure.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0ba7d7e7c7df6337a5de8e7760eea72a", "score": "0.5357245", "text": "def show\n @weather_record = WeatherRecord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @weather_record }\n end\n end", "title": "" }, { "docid": "b473f0c2df7369494685d3745beba1ef", "score": "0.5343652", "text": "def create\n @daily_record = DailyRecord.new(daily_record_params)\n\n respond_to do |format|\n if @daily_record.save\n format.html { redirect_to @daily_record, notice: 'Daily record was successfully created.' }\n format.json { render :show, status: :created, location: @daily_record }\n else\n format.html { render :new }\n format.json { render json: @daily_record.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "215533c24707452bd4e4bd0306a30818", "score": "0.53298587", "text": "def weather_params\n params.require(:weather).permit(:field_id, :latitude, :longitude, :simulation_final_year, :simulation_initial_year, :station_id, :station_way, :way_id)\n end", "title": "" }, { "docid": "3752710cebe1018bce61fada90676628", "score": "0.53071356", "text": "def weather_log_params\n params.require(:weather_log).permit(:latitude, :longitude, :datatime, :air_temperature)\n end", "title": "" }, { "docid": "70eefa48d727ba067b0aad62c39c4c38", "score": "0.530083", "text": "def create\n @readings = []\n lines = Base64.decode64 params[:file].sub('data:text/csv;base64,','')\n solar_readings = lines.split(\"\\n\").reverse\n solar_readings.each do |reading|\n reading = reading.split(\";\")\n begin\n date = DateTime.strptime(reading[0], '%d/%m/%Y')\n @readings << SolarReading.where(date: date).first_or_create.update(kwh: reading[1])\n rescue ArgumentError => e\n logger.error(e.message)\n end\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @readings, callback: params[:callback] }\n format.xml { render xml: @readings }\n end\n end", "title": "" }, { "docid": "758090aed8dc527a8b0188427b64a355", "score": "0.5297619", "text": "def save_reading()\n\tStation.all.each do |x|\n\t\tstation_id = x.station_id\n\t\tlat = x.lat\n\t\tlong = x.long\n\t\tlat_long = \"#{lat},#{long}\"\n\t\tforecast = JSON.parse(open(\"#{BASE_URL}/#{API_KEY}/#{lat_long}\").read)\n\t\tr = WeatherReading.new\n\t\tr.build_reading(station_id,lat,long,current_date(forecast),current_time(forecast),current_temperature(forecast),current_dew_point(forecast),\n\t\t\tcurrent_wind_direction(forecast),current_wind_speed(forecast),current_rainfall(forecast),\"forecast.io\")\n\t\tr.save\n\tend\n\nend", "title": "" }, { "docid": "518c91648a73c67dff6926bf703722ee", "score": "0.52792645", "text": "def forecast(loc)\n\n url = \"#{@base_url}/#{FORECAST_QUERY}/q/#{loc[0]},#{loc[1]}.json\" \n\n result = JSON.parse(open(url).read)\n\n return nil if result['response']['error'] \n return nil unless result['current_observation']\n\n obs = result['current_observation']\n loc = result['current_observation']['observation_location']\n fc = result['forecast']['simpleforecast']\n\n # puts 'Fetching for ' + obs['station_id']\n \n weather = WeatherStation.find_or_create_by_station_id(obs['station_id'])\n\n location = ObservationLocation.new\n\n location.full = loc['full']\n location.city = loc['city']\n location.state = loc['state']\n location.country = loc['country']\n location.country_iso3166 = loc['country_iso3166']\n location.loc = [loc['latitude'].to_f,loc['longitude'].to_f]\n location.elevation = loc['elevation']\n \n weather.observation_location = location\n\n weather.forecasts.clear\n\n fc['forecastday'].each do |f|\n\n forecast = Forecast.new\n\n date = DateTime.strptime(f['date']['epoch'].to_s,'%s')\n\n forecast.date = date\n forecast.conditions = f['conditions']\n forecast.pop = f['pop']\n forecast.high_c = f['high']['celsius']\n forecast.high_f = f['high']['fahrenheit']\n forecast.low_c = f['low']['celsius']\n forecast.low_f = f['low']['fahrenheit']\n\n forecast.qpf_day_mm = f['qpf_day']['mm']\n forecast.qpf_day_in = f['qpf_day']['in']\n forecast.qpf_allday_mm = f['qpf_allday']['mm']\n forecast.qpf_allday_in = f['qpf_allday']['in']\n forecast.qpf_night_mm = f['qpf_night']['mm']\n forecast.qpf_night_in = f['qpf_night']['in']\n\n forecast.snow_day_mm = f['snow_day']['mm']\n forecast.snow_day_in = f['snow_day']['in']\n forecast.snow_allday_mm = f['snow_allday']['mm']\n forecast.snow_allday_in = f['snow_allday']['in']\n forecast.snow_night_mm = f['snow_night']['mm']\n forecast.snow_night_in = f['snow_night']['in']\n\n forecast.wind_max_kph = f['maxwind']['kph'] \n forecast.wind_max_mph = f['maxwind']['mph'] \n forecast.wind_max_dir = f['maxwind']['dir'] \n forecast.wind_max_degrees = f['maxwind']['degrees'] \n\n forecast.wind_ave_kph = f['avewind']['kph'] \n forecast.wind_ave_mph = f['avewind']['mph'] \n forecast.wind_ave_dir = f['avewind']['dir'] \n forecast.wind_ave_degrees = f['avewind']['degrees'] \n\n forecast.humidity_ave = f['avehumidity']\n forecast.humidity_min = f['minhumidity']\n forecast.humidity_max = f['maxhumidity']\n\n weather.forecasts << forecast\n\n end\n\n weather.observation_time_rfc822 = obs['observation_time_rfc822']\n weather.local_time_rfc822 = obs['local_time_rfc822']\n weather.weather = obs['weather']\n weather.temp_f = obs['temp_f']\n weather.temp_c = obs['temp_c']\n weather.relative_humidity = obs['relative_humidity']\n weather.precip_today_metric = obs['precip_today_metric']\n\n return weather\n\n end", "title": "" }, { "docid": "9c23695d3d510f2a4ee8bad471591689", "score": "0.52721345", "text": "def index\n @traces = Trace.all\n url_string = ''\n data = []\n pdist = 0\n plat = @traces.first.latitude\n plon = @traces.first.longitude\n traces = @traces.pluck(:latitude, :longitude).map { |lat, lon| { latitude: lat, longitude: lon } }\n response = HTTParty.post(\n url_string,\n :body => traces.to_json,\n :headers => { 'Content-Type' => 'application/json' }\n )\n @traces.each_with_index do |t,index|\n data << {\n \"latitude\": t.latitude,\n \"longitude\": t.longitude,\n \"distance\": distance([plat,plon],[t.latitude, t.longitude]) + pdist,\n \"elevation\": response[index]\n }\n pdist += distance([plat,plon],[t.latitude, t.longitude])\n plat = t.latitude\n plon = t.longitude\n end\n render json: data\n end", "title": "" }, { "docid": "f98574eaf83590389cc03855190a062a", "score": "0.5263114", "text": "def index\n @weather_station = WeatherStation.find(params[:weather_station_id])\n @meteo_data = []\n @meteo_data = @weather_station.meteo_datums.order('created_at desc').limit(100) unless @weather_station.blank?\n\n render 'api/v1/meteo_data/index', params: [@weather_station, @meteo_data]\n end", "title": "" }, { "docid": "b4bfd40ecb79f6c2ed6e7b80e8e922d5", "score": "0.5247872", "text": "def get_trafic_data(number_of_records)\n\t\tkeys = {'x-api-key' => @keys[:ss_api_key]}\n\t\turi = URI.parse(\"http://smartstreets.sensetecnic.com/wotkit/api/sensors/42607/data?beforeE=#{number_of_records}\")\n\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\tresponse = http.get(uri.request_uri, keys)\n\t\tjson = parse_api_response(response.body)\n\tend", "title": "" }, { "docid": "4976fcf1427457819182a9c35b1c5202", "score": "0.5231171", "text": "def post_data(body)\r\n raise ConfigError, 'no json_records' if body.empty?\r\n # Create REST request header\r\n header = get_header(body.bytesize)\r\n # Post REST request \r\n response = RestClient.post(@uri, body, header)\r\n\r\n return response\r\n end", "title": "" }, { "docid": "aacd80ef1b99f894abe11adad2ac9ca8", "score": "0.5207518", "text": "def get_weather\n weather_forecast = WeatherForecast.new(params[:location_id])\n response = weather_forecast.city_weather\n puts body = JSON.parse(response.body)\n \t@city = body['city']['name']\n \t@main_temperature_parameters = body['list'][0]['main']\n \trespond_to do |format|\n format.js\n format.json { render json: @main_temperature_parameters }\n \tend\n end", "title": "" }, { "docid": "80f744fbe42c4ec0c5ad2a3fe412f187", "score": "0.52057195", "text": "def city_events(city)\n response = RestClient.get('https://app.ticketmaster.com/discovery/v2/events.json?city=' + city + '&apikey=' + $ticket_master_api_key)\n jason_response = JSON.parse(response)\nend", "title": "" }, { "docid": "ff8236ce036088219e1113a819c67016", "score": "0.51991004", "text": "def create\n data = \"date,r,s\\r\\n\"+params[:data]\n csv = CSV.new(data, :headers => true, :header_converters => :symbol, :converters => :all)\n\n h = csv.to_a.map {|row| row.to_hash }\n\n h.each do |e|\n t = Traffic.find_by date:e[:date]\n if t!=nil \n t.delete \n end\n Traffic.create(e)\n end\n\n @traffics = Traffic.all\n render \"index\"\n end", "title": "" }, { "docid": "4725e14848f6ffba1a331fc091057521", "score": "0.519896", "text": "def post\n Typhoeus.post(@url,\n body: @results_hash.to_json,\n headers: { 'Content-Type' => 'application/json' })\n end", "title": "" }, { "docid": "8b7b1fc93daca7f0346b52c49f0f1b7f", "score": "0.5190458", "text": "def update_from_darksky(historical_dates=[Date.today-1], forecast=true)\n darksky_secret = ApiKey.where(:service => 'Darksky').first.key\n hydra = Typhoeus::Hydra.new\n requests = Hash.new\n forecast_request = nil\n\n logger.debug(\"Updating Station #{name} for dates: #{historical_dates}\")\n \n # Construct the HTTP requests to Darksky: one for each of the past days we care about, and one for today to get the forecast\n historical_dates.each do |d|\n endpoint = \"https://api.darksky.net/forecast/#{darksky_secret}/#{self.latitude},#{self.longitude},#{d.to_time.to_i}\"\n request = Typhoeus::Request.new(endpoint) \n hydra.queue(request)\n requests[d] = request\n end\n forecast_request = Typhoeus::Request.new(\"https://api.darksky.net/forecast/#{darksky_secret}/#{self.latitude},#{self.longitude}\")\n hydra.queue(forecast_request) if forecast\n\n # Run the whole lot of them!\n hydra.run\n\n # Parse out the observed precipitation from the historical queries\n reports = []\n requests.each_pair do |d, request|\n if request.response.timed_out?\n logger.error \"Request to Darksky timed out: #{request}\"\n next\n end\n if request.response.nil?\n logger.error \"No response from Darksky for request #{request}\"\n next\n end\n if request.response.code != 200\n logger.error \"Unable to fetch weather data from #{request.base_url}: #{request.response.code} #{request.response.status_message}\"\n next\n end\n\n # With error trapping done, let's parse the body and update the db with the report data.\n data = JSON.load(request.response.body)\n data['daily']['data'].each do |report|\n logger.debug(report)\n d = Time.at(report['time']).to_date\n datestamp = \"#{d.year}#{d.month.to_s.rjust(2,'0')}#{d.day.to_s.rjust(2,'0')}\"\n logger.debug(\"Using timestamp #{datestamp}\")\n # We want to update an existing row in place if we've previously computed one\n r = weather_reports.find_or_create_by(\n :latitude => self.latitude,\n :longitude => self.longitude,\n :date => datestamp,\n )\n \n \n # TODO: multiply by the actual number of hours in the time period.\n precip = report['precipIntensity'] # This is in inches per hour\n logger.debug(\"Extracted precipitation report: #{precip} from report #{report}\")\n r.precip = precip * 24.0\n logger.debug(\"Constructed WeatherReport: #{r}\")\n logger.debug(\"Coordinates: #{r.latitude},#{r.longitude}\")\n logger.debug(\"Datestamp: #{r.date}\")\n logger.debug(\"Recorded Precip: #{r.precip}\")\n \n r.save\n reports.push(r)\n end\n end\n\n # Add the forecast data as well\n forecasts = []\n if forecast\n logger.info(\"Parsing forecasts for station #{self}\")\n logger.debug(\"Got response: #{forecast_request.response}\")\n if forecast_request.response.timed_out?\n logger.error \"Request to Darksky timed out: #{forecast_request}\"\n return\n end\n if forecast_request.response.nil?\n logger.error \"No response from Darksky for request #{forecast_request}\"\n return\n end\n if forecast_request.response.code != 200\n logger.error \"Unable to fetch weather data from #{forecast_request.base_url}: #{forecast_request.response.code} #{forecast_request.response.message}\"\n return\n end\n\n logger.debug(\"Successful response from Darksky\")\n data = JSON.load(forecast_request.response.body)\n data['daily']['data'].each do |report|\n logger.debug(report)\n d = Time.at(report['time']).to_date\n datestamp = \"#{d.year}#{d.month.to_s.rjust(2,'0')}#{d.day.to_s.rjust(2,'0')}\"\n r = weather_reports.find_or_create_by(\n :latitude => self.latitude,\n :longitude => self.longitude,\n :date => datestamp,\n )\n r.precip = report['precipIntensity'] * 24.0 # The Darksky report gives us inches per hour\n\n logger.debug(\"Created forecast object: #{r}\")\n r.save\n forecasts.push(r)\n end\n end\n\n # TODO: add a column that we can record when this update was last run, for display on the webpage.\n {:reports => reports, :forecasts => forecasts}\n end", "title": "" }, { "docid": "5eb5c0e39c60af2419bfa1ce5b90038b", "score": "0.5190444", "text": "def push_new_record(record)\n handle_couch_response do\n RestClient.post(local_couch_database_url, record, content_type: :json)\n end\n end", "title": "" }, { "docid": "6cfed7fa0cf579bb87abae7a077b650e", "score": "0.51855016", "text": "def new\n @weather = Weather.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @weather }\n end\n end", "title": "" }, { "docid": "6e609626441a5f719f8eb9a9c2d1c035", "score": "0.51835555", "text": "def create\n @temperature_sensor = TemperatureSensor.new(params[:temperature_sensor])\n\n respond_to do |format|\n if @temperature_sensor.save\n format.html { redirect_to @temperature_sensor, :notice => 'Temperature sensor was successfully created.' }\n format.json { render :json => @temperature_sensor, :status => :created, :location => @temperature_sensor }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @temperature_sensor.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8a2c53bdc2cd947eb1fb6d696e955d55", "score": "0.51811254", "text": "def weather_params\n params.require(:weather).permit(:city, :country)\n end", "title": "" }, { "docid": "9772916ba5debd2834c2c90b34943a23", "score": "0.5162935", "text": "def new\n @weather_event = WeatherEvent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @weather_event }\n end\n end", "title": "" }, { "docid": "e22a5ccd217221909e1cd0618a9b224f", "score": "0.5161135", "text": "def fetch_weather\n\t response = HTTParty.get(\"http://api.wunderground.com/api/cdb75d07a23ad227/#{date}/q/#{location}/#{cityfixed}.xml\")\n\t parse_response(response)\n\tend", "title": "" }, { "docid": "62af9a0435471ae417c6ec29eeb4205e", "score": "0.51604414", "text": "def entries\n uri = URI(BASE_URL + ENTRIES_ENDPOINT + days_query)\n\n make_request(uri)\n end", "title": "" }, { "docid": "7e5800021088cca39ea767ecfa5fc640", "score": "0.5159924", "text": "def create\n @wind = Wind.new(wind_params)\n\n respond_to do |format|\n if @wind.save\n format.html { redirect_to @wind, notice: 'Wind was successfully created.' }\n format.json { render :show, status: :created, location: @wind }\n else\n format.html { render :new }\n format.json { render json: @wind.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5d20cb6497bd84c6a6accd2e420cc918", "score": "0.515486", "text": "def index\n @limit = params[:limit] || DEFAULT_MAX_RECORDS\n @offset = params[:offset] || 0\n @weather_measures = WeatherMeasure.all.order('created_at desc').limit(@limit).offset(@offset)\n @temperature_chart_data = @weather_measures.pluck(:created_at, :temperature).to_h \n @all_records_count = WeatherMeasure.all.count\n end", "title": "" }, { "docid": "ee30c66887b617cbc639a91b712f1f35", "score": "0.51546675", "text": "def new\n @weather = Weather.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @weather }\n end\n end", "title": "" }, { "docid": "ee30c66887b617cbc639a91b712f1f35", "score": "0.51546675", "text": "def new\n @weather = Weather.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @weather }\n end\n end", "title": "" }, { "docid": "40a5490ddb587df0be88873ae35be4df", "score": "0.51513606", "text": "def create\n # to support array meta from iOS\n if params[:record][:meta].is_a? Array\n params[:record][:meta] = params[:record][:meta].join(\",\")\n end\n\n @record = current_patient.records.new(params[:record])\n\n @record.actual_pill_time_at = Time.zone.parse(params[:record][:actual_pill_time_at])\n\n\n respond_to do |format|\n if @record.save\n if @record.is_android_phone\n @record.swapUVAttribute\n end\n # if Rails.env == 'production'\n # @record.delay.post_processing\n # else\n # @record.post_processing\n # end\n format.json { render json: @record,\n status: :created,\n location: [current_patient, @record] }\n\n format.html { redirect_to [current_patient, @record],\n notice: 'Record was successfully created.' }\n else\n puts @record.errors\n format.json { render json: @record.errors, status: :unprocessable_entity }\n format.html { render action: 'new' }\n end\n end\n end", "title": "" }, { "docid": "af882fd2515917abbe8713e89de656a0", "score": "0.5143158", "text": "def weather_params\n params.require(:weather).permit(:city)\n end", "title": "" }, { "docid": "f85fbd8e467c7bc098404bddb04a3ed4", "score": "0.5130277", "text": "def index\n @search_logs = SearchLog.all\n require \"net/http\"\n require \"json\"\n require \"date\"\n @date = Date.today\n @year = params[:year] || @date.year\n year = @year.to_s \n @month = params[:month] || @date.month\n month = @month.to_s \n @day = params[:day] || @date.day\n dayy = @day.to_s \n @dateString = year + \"-\" + month + \"-\" + dayy \n currentDate = @date.to_s\n @zipCode = params[:q] || 20002\n zipCodeString = @zipCode.to_s\n @url = \"https://www.airnowapi.org/aq/forecast/zipCode/?format=application/json&zipCode=\"+ zipCodeString +\"&date=\"+ @dateString +\"&distance=25&API_KEY=E4115853-8D5F-498D-9233-69D2B8C7B6FC\"\n @uri = URI(@url)\n @response = Net::HTTP.get(@uri)\n @output = JSON.parse(@response)\n end", "title": "" }, { "docid": "d25c269275018d1bfa9d6da157f19ab9", "score": "0.51179117", "text": "def destroy\n @weather_record.destroy\n respond_to do |format|\n format.html { redirect_to weather_records_url, notice: 'Weather record was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ea6cfb8c71e9cc111c0d5c4f069e8781", "score": "0.510246", "text": "def scrape_fio_data\n\t# Get all the weather stations\n\tweather_stations = WeatherStation.all\n\t# For each of these weather stations get the forecast\n\tfor weather_station in weather_stations\n\t\tlat_lon = \"#{weather_station.lat},#{weather_station.lon}\"\n\t\tforecast = JSON.parse(open(\"#{BASE_URL}/#{API_KEY}/#{lat_lon}#{UNITS}\").read)\n\t\t# Parse the data which is required\n\t\ttemperature = forecast['currently']['temperature']\n\t\tdew_point = forecast['currently']['dewPoint']\n\t\twind_spd = forecast['currently']['windSpeed']\n\t\twind_dir = forecast['currently']['windBearing']\n\t\train = forecast['currently']['precipIntensity']\n\t\tpersist_data weather_station.name, SOURCEFIO, temperature, dew_point, wind_spd, wind_dir, rain\n\tend\nend", "title": "" }, { "docid": "5620c06f63b4e6ae74cce63d3179501b", "score": "0.51017064", "text": "def get_weather\n\t if params[:city] && params[:date]\n\t @weather = WeatherForecast.get_weather(params[:date], params[:city])\n\t else\n\t \t# if the parameters are not defined, a default result is return\n\t \t@weather = WeatherForecast.get_weather(\"20170101\", \"Paris\")\n\t end\n\t # render 'application/test'\n\t render json: @weather\n\tend", "title": "" }, { "docid": "471f58ac91a580fd4a418cae57695808", "score": "0.5100696", "text": "def add_weather day\n @weather.push day\n end", "title": "" }, { "docid": "5ffc601155e2bb38ae4720f74ea1f05c", "score": "0.5094167", "text": "def weather_hourly(city, state)\n request = \"http://api.wunderground.com/api/747e267558954ba9/hourly/q/#{state}/#{city}.json\"\n hourly = HTTParty.get(request)\n hourly[\"hourly_forecast\"].each do |hour| \n puts \"#{hour[\"FCTTIME\"][\"civil\"]}: #{hour[\"temp\"][\"english\"]}F\"\n end\nend", "title": "" }, { "docid": "e8d4c85031966d90dd117096c1e4c651", "score": "0.50790626", "text": "def destroy\n @weather_record = WeatherRecord.find(params[:id])\n @weather_record.destroy\n\n respond_to do |format|\n format.html { redirect_to weather_records_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "265af6a179f2551d9590abc6de36327d", "score": "0.5076664", "text": "def updateRecords\n @temps = []\n # Super hacky and kind of a bad practice but its the best I could come up with for the time being\n temps_from_db = Temp.last(1152)\n temps_from_db.each do |record|\n if record.id % 47 == 0\n @temps << record\n end\n end\n\n render json: @temps\n end", "title": "" }, { "docid": "3972b78ceebf7718d951985dd4a39f17", "score": "0.5076299", "text": "def weather_test_params\n params.require(:weather_test).permit(:date_a)\n end", "title": "" }, { "docid": "0fa51d798dcfa81fdf700604c9b2968d", "score": "0.5074559", "text": "def create\n @weather_location = WeatherLocation.new(params[:weather_location])\n\n respond_to do |format|\n if @weather_location.save\n flash[:notice] = 'WeatherLocation was successfully created.'\n format.html { redirect_to(@weather_location) }\n format.xml { render :xml => @weather_location, :status => :created, :location => @weather_location }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @weather_location.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e831eed9b1027900f14f203b4723461a", "score": "0.50743043", "text": "def index\n if params[:q]\n url = \"http://api.worldweatheronline.com/premium/v1/tz.ashx?q=#{params[:q]}&format=json&key=2c46659bd90a41a0bcf132257162410\"\n @json = ActiveSupport::JSON.decode(open(url).read)\n else\n end\n end", "title": "" }, { "docid": "a463e7e9bdfeb07e419b2b95fb412aab", "score": "0.5064194", "text": "def postEntityOpening_times( entity_id, monday, tuesday, wednesday, thursday, friday, saturday, sunday, closed, closed_public_holidays)\n params = Hash.new\n params['entity_id'] = entity_id\n params['monday'] = monday\n params['tuesday'] = tuesday\n params['wednesday'] = wednesday\n params['thursday'] = thursday\n params['friday'] = friday\n params['saturday'] = saturday\n params['sunday'] = sunday\n params['closed'] = closed\n params['closed_public_holidays'] = closed_public_holidays\n return doCurl(\"post\",\"/entity/opening_times\",params)\n end", "title": "" }, { "docid": "35656fa06611e03d630539134e003e55", "score": "0.5059527", "text": "def create\n data = reload(get_series('foods'), str(Date.strptime(params[:food].values.join(\"-\"))))\n saved = false\n get_series('foods').each do |s|\n #puts \"Updating series=#{s}\"\n data[s].each do |day|\n @food = for_date(day['dateTime'])\n @food.send(s.rpartition('/')[2] + '=', day['value'])\n\n # update from collection too\n logged_food = reload_range(['foods/log'], day['dateTime'], nil)\n # TODO refactor this into a lood instead of separate IFs\n if logged_food['summary']['carbs'].nil?\n @food.carbs = 0\n else\n @food.carbs = logged_food['summary']['carbs'].floor\n end\n if logged_food['summary']['protein'].nil?\n @food.protein = 0\n else\n @food.protein = logged_food['summary']['protein'].floor\n end\n if logged_food['summary']['fat'].nil?\n @food.fat = 0\n else\n @food.fat = logged_food['summary']['fat'].floor\n end\n if logged_food['summary']['fiber'].nil?\n @food.fiber = 0\n else\n @food.fiber = logged_food['summary']['fiber'].floor\n end\n if @food.caloriesIn.nil?\n @food.caloriesIn = 0\n end\n if @food.water.nil?\n @food.water = 0\n end\n\n saved = @food.save\n if not saved\n flash[:error] = @food.errors\n end\n end\n end\n\n respond_to do |format|\n flash[:success] = 'Food was successfully created.'\n format.html { redirect_to @food }\n format.json { render json: @food, status: :created, location: @food }\n end\n end", "title": "" }, { "docid": "82f5379d647a5fc5b6bd08dffff95acf", "score": "0.50552374", "text": "def request_weather\n unless @theButton\n add_the_button\n end\n # Use our Geocoder to get lat lon\n get_location_info(@input_field.text)\n\n # Our request url, you are going to need a forcase IO api key,\n url_string = \"https://api.forecast.io/forecast/#{ENV['FORCAST_IO_TOKEN']}/#{@lat},#{@lon}\"\n\n # Send the request and encode it for us `app/lib/url_request.rb`\n url_response = UrlRequest.send_request(url_string)\n\n # Decode the request and parse it as JSON `app/lib/json_parser.rb`\n json_data = JsonParser.decode(url_response)\n\n # Now you can use the JSON!\n load_weather(json_data)\n end", "title": "" }, { "docid": "8290f93a0dd19408a4cd2d6967aed865", "score": "0.50527126", "text": "def create\n @records_location = RecordsLocation.new(params[:records_location])\n\n respond_to do |format|\n if @records_location.save\n format.html { redirect_to @records_location, notice: 'Records location was successfully created.' }\n format.json { render json: @records_location, status: :created, location: @records_location }\n else\n format.html { render action: \"new\" }\n format.json { render json: @records_location.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fd306e4b69e059024995cfc94ddb0eac", "score": "0.50487155", "text": "def create\n @record = Record.new(params[:record])\n record_set = RecordSet.find_by_id(params[:record][:record_set_id])\n @record.patient_id = record_set.patient_id\n\n respond_to do |format|\n if @record.save\n format.json { render :json => [ @record.to_jq_record ].to_json }\n format.html { render :json => [ @record.to_jq_record ].to_json }\n else\n format.json { render :json => [ @record.to_jq_record.merge({ :error => \"custom_failure\" }) ].to_json }\n end\n end\n end", "title": "" }, { "docid": "b39aae56bc33f5316a99ba026fee08e7", "score": "0.5031459", "text": "def create\n @trace = Trace.new\n if @trace.save\n @trace.import_points(points_data)\n status = :created\n else\n status = :bad_request\n end\n\n render json: @trace, status: status\n end", "title": "" }, { "docid": "45fc22b0dd236588209596e0ca25f7c9", "score": "0.50283986", "text": "def create\n @mood_datum = MoodDatum.new(mood_datum_params)\n \n respond_to do |format|\n if @mood_datum.save \n params['significant_events'].each do |key,value| \n PatientSignificantEvent.create(:patient_id =>@mood_datum.user_id ,:doctor_id => @mood_datum.doctor_id ,:mood_data_id =>@mood_datum.id ,:comments => value )\n end \n format.html { redirect_to new_mood_datum_path(:patient => current_user.id), notice: 'Mood datum was successfully created.' }\n format.json { render action: 'show', status: :created, location: @mood_datum }\n else\n format.html { render action: 'new' }\n format.json { render json: @mood_datum.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "39826e00df69e72b00b383b59ef01b59", "score": "0.5017251", "text": "def update\n respond_to do |format|\n if @weather_record.update(weather_record_params)\n format.html { redirect_to @weather_record, notice: 'Weather record was successfully updated.' }\n format.json { render :show, status: :ok, location: @weather_record }\n else\n format.html { render :edit }\n format.json { render json: @weather_record.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8379cc760f610a3c720514fd310d7bb2", "score": "0.50124866", "text": "def create\n @city_measurement = CityMeasurement.new(params[:city_measurement])\n\n respond_to do |format|\n if @city_measurement.save\n format.html { redirect_to @city_measurement, notice: 'City measurement was successfully created.' }\n format.json { render json: @city_measurement, status: :created, location: @city_measurement }\n else\n format.html { render action: \"new\" }\n format.json { render json: @city_measurement.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b40bb23d2b38b458780e3935a995c27f", "score": "0.501116", "text": "def create\n @temperature_log = TemperatureLog.new(temperature_log_params)\n\n respond_to do |format|\n if @temperature_log.save\n format.html { redirect_to @temperature_log, notice: 'Temperature log was successfully created.' }\n format.json { render :show, status: :created, location: @temperature_log }\n else\n format.html { render :new }\n format.json { render json: @temperature_log.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "967b73d33f621ab44a60415eeacfb798", "score": "0.50024897", "text": "def create\n @time_record = TimeRecord.new(params[:time_record])\n @time_record.value = (@time_record.ended_at - @time_record.started_at) / 1.hour\n @time_record.recorded_on = @time_record.started_at.to_date\n\n respond_to do |format|\n if @time_record.save\n format.html { redirect_to time_records_path, notice: 'Time record was successfully created.' }\n format.json { render json: @time_record.to_json, status: :created, location: @time_record }\n else\n format.html { render action: \"new\" }\n format.json { render json: @time_record.errors.full_messages, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "bc19873dc8b53d82ca6a7a824fb26a91", "score": "0.0", "text": "def castle_params\n params.require(:castle).permit(:name, :kingdom_id, stocks_attributes: [:qte, :ressource_id, :id, :_destroy], garrisons_attributes: [:qte, :soldier_type_id, :id, :_destroy], tile_attributes: [:x, :y, :id, :_destroy])\n end", "title": "" } ]
[ { "docid": "e164094e79744552ae1c53246ce8a56c", "score": "0.69792545", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6781151", "text": "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "title": "" }, { "docid": "1677b416ad07c203256985063859691b", "score": "0.67419964", "text": "def allow_params_authentication!; end", "title": "" }, { "docid": "c1f317213d917a1e3cfa584197f82e6c", "score": "0.674013", "text": "def allowed_params\n ALLOWED_PARAMS\n end", "title": "" }, { "docid": "547b7ab7c31effd8dcf394d3d38974ff", "score": "0.6734356", "text": "def default_param_whitelist\n [\"mode\"]\n end", "title": "" }, { "docid": "a91e9bf1896870368befe529c0e977e2", "score": "0.6591046", "text": "def param_whitelist\n [:role, :title]\n end", "title": "" }, { "docid": "b32229655ba2c32ebe754084ef912a1a", "score": "0.6502396", "text": "def expected_permitted_parameter_names; end", "title": "" }, { "docid": "3a9a65d2bba924ee9b0f67cb77596482", "score": "0.6496313", "text": "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "title": "" }, { "docid": "068f8502695b7c7f6d382f8470180ede", "score": "0.6480641", "text": "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "title": "" }, { "docid": "e291b3969196368dd4f7080a354ebb08", "score": "0.6477825", "text": "def permitir_parametros\n \t\tparams.permit!\n \tend", "title": "" }, { "docid": "c04a150a23595af2a3d515d0dfc34fdd", "score": "0.64565", "text": "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "title": "" }, { "docid": "9a2a1af8f52169bd818b039ef030f513", "score": "0.6438387", "text": "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "title": "" }, { "docid": "c5f294dd85260b1f3431a1fbbc1fb214", "score": "0.63791263", "text": "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "title": "" }, { "docid": "631f07548a1913ef9e20ecf7007800e5", "score": "0.63740575", "text": "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "title": "" }, { "docid": "9735bbaa391eab421b71a4c1436d109e", "score": "0.6364131", "text": "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "title": "" }, { "docid": "12fa2760f5d16a1c46a00ddb41e4bce2", "score": "0.63192815", "text": "def param_whitelist\n [:rating, :review]\n end", "title": "" }, { "docid": "f12336a181f3c43ac8239e5d0a59b5b4", "score": "0.62991166", "text": "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "title": "" }, { "docid": "c25a1ea70011796c8fcd4927846f7a04", "score": "0.62978333", "text": "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "title": "" }, { "docid": "822c743e15dd9236d965d12beef67e0c", "score": "0.6292148", "text": "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "title": "" }, { "docid": "7f0fd756d3ff6be4725a2c0449076c58", "score": "0.6290449", "text": "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "title": "" }, { "docid": "9d23b31178b8be81fe8f1d20c154336f", "score": "0.6290076", "text": "def valid_params_request?; end", "title": "" }, { "docid": "533f1ba4c3ab55e79ed9b259f67a70fb", "score": "0.62894756", "text": "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "title": "" }, { "docid": "5f16bb22cb90bcfdf354975d17e4e329", "score": "0.6283177", "text": "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "title": "" }, { "docid": "1dfca9e0e667b83a9e2312940f7dc40c", "score": "0.6242471", "text": "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "title": "" }, { "docid": "a44360e98883e4787a9591c602282c4b", "score": "0.62382483", "text": "def allowed_params\n params.require(:allowed).permit(:email)\n end", "title": "" }, { "docid": "4fc36c3400f3d5ca3ad7dc2ed185f213", "score": "0.6217549", "text": "def permitted_params\n []\n end", "title": "" }, { "docid": "7a218670e6f6c68ab2283e84c2de7ba8", "score": "0.6214457", "text": "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "title": "" }, { "docid": "b074031c75c664c39575ac306e13028f", "score": "0.6209053", "text": "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "title": "" }, { "docid": "0cb77c561c62c78c958664a36507a7c9", "score": "0.6193042", "text": "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "title": "" }, { "docid": "9892d8126849ccccec9c8726d75ff173", "score": "0.6177802", "text": "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "title": "" }, { "docid": "e3089e0811fa34ce509d69d488c75306", "score": "0.6174604", "text": "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "title": "" }, { "docid": "7b7196fbaee9e8777af48e4efcaca764", "score": "0.61714715", "text": "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "title": "" }, { "docid": "9d589006a5ea3bb58e5649f404ab60fb", "score": "0.6161512", "text": "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "title": "" }, { "docid": "d578c7096a9ab2d0edfc431732f63e7f", "score": "0.6151757", "text": "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "title": "" }, { "docid": "38a9fb6bd1d9ae5933b748c181928a6b", "score": "0.6150663", "text": "def safe_params\n params.require(:user).permit(:name)\n end", "title": "" }, { "docid": "7a6fbcc670a51834f69842348595cc79", "score": "0.61461", "text": "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "title": "" }, { "docid": "fe4025b0dd554f11ce9a4c7a40059912", "score": "0.61213595", "text": "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.611406", "text": "def check_params; true; end", "title": "" }, { "docid": "60ccf77b296ed68c1cb5cb262bacf874", "score": "0.6106206", "text": "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "3c8ffd5ef92e817f2779a9c56c9fc0e9", "score": "0.6105114", "text": "def quote_params\n params.permit!\n end", "title": "" }, { "docid": "86b2d48cb84654e19b91d9d3cbc2ff80", "score": "0.6089039", "text": "def valid_params?; end", "title": "" }, { "docid": "34d018968dad9fa791c1df1b3aaeccd1", "score": "0.6081015", "text": "def paramunold_params\n params.require(:paramunold).permit!\n end", "title": "" }, { "docid": "6d41ae38c20b78a3c0714db143b6c868", "score": "0.6071004", "text": "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "title": "" }, { "docid": "c436017f4e8bd819f3d933587dfa070a", "score": "0.60620916", "text": "def filtered_parameters; end", "title": "" }, { "docid": "49052f91dd936c0acf416f1b9e46cf8b", "score": "0.6019971", "text": "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "title": "" }, { "docid": "5eaf08f3ad47cc781c4c1a5453555b9c", "score": "0.601788", "text": "def filtering_params\n params.permit(:email, :name)\n end", "title": "" }, { "docid": "5ee931ad3419145387a2dc5a284c6fb6", "score": "0.6011056", "text": "def check_params\n true\n end", "title": "" }, { "docid": "3b17d5ad24c17e9a4c352d954737665d", "score": "0.6010898", "text": "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "title": "" }, { "docid": "45b8b091f448e1e15f62ce90b681e1b4", "score": "0.6005122", "text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "title": "" }, { "docid": "45b8b091f448e1e15f62ce90b681e1b4", "score": "0.6005122", "text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "title": "" }, { "docid": "74c092f6d50c271d51256cf52450605f", "score": "0.6001556", "text": "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "title": "" }, { "docid": "75415bb78d3a2b57d539f03a4afeaefc", "score": "0.6001049", "text": "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "title": "" }, { "docid": "bb32aa218785dcd548537db61ecc61de", "score": "0.59943926", "text": "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "title": "" }, { "docid": "65fa57add93316c7c8c6d8a0b4083d0e", "score": "0.5992201", "text": "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "title": "" }, { "docid": "865a5fdd77ce5687a127e85fc77cd0e7", "score": "0.59909594", "text": "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "title": "" }, { "docid": "ec609e2fe8d3137398f874bf5ef5dd01", "score": "0.5990628", "text": "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "title": "" }, { "docid": "423b4bad23126b332e80a303c3518a1e", "score": "0.5980841", "text": "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "title": "" }, { "docid": "48e86c5f3ec8a8981d8293506350accc", "score": "0.59669393", "text": "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "title": "" }, { "docid": "9f774a9b74e6cafa3dd7fcc914400b24", "score": "0.59589154", "text": "def active_code_params\n params[:active_code].permit\n end", "title": "" }, { "docid": "a573514ae008b7c355d2b7c7f391e4ee", "score": "0.5958826", "text": "def filtering_params\n params.permit(:email)\n end", "title": "" }, { "docid": "2202d6d61570af89552803ad144e1fe7", "score": "0.5957911", "text": "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "title": "" }, { "docid": "8b571e320cf4baff8f6abe62e4143b73", "score": "0.5957385", "text": "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "title": "" }, { "docid": "d493d59391b220488fdc1f30bd1be261", "score": "0.5953072", "text": "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "title": "" }, { "docid": "f18c8e1c95a8a21ba8cd6fbc6d4d524a", "score": "0.59526145", "text": "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "title": "" }, { "docid": "4e6017dd56aab21951f75b1ff822e78a", "score": "0.5943361", "text": "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "title": "" }, { "docid": "67fe19aa3f1169678aa999df9f0f7e95", "score": "0.59386164", "text": "def list_params\n params.permit(:name)\n end", "title": "" }, { "docid": "bd826c318f811361676f5282a9256071", "score": "0.59375334", "text": "def filter_parameters; end", "title": "" }, { "docid": "bd826c318f811361676f5282a9256071", "score": "0.59375334", "text": "def filter_parameters; end", "title": "" }, { "docid": "5060615f2c808bab2d45f4d281987903", "score": "0.5933856", "text": "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "title": "" }, { "docid": "7fa620eeb32e576da67f175eea6e6fa0", "score": "0.59292704", "text": "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "title": "" }, { "docid": "d9483565c400cd4cb1096081599a7afc", "score": "0.59254247", "text": "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "title": "" }, { "docid": "f7c6dad942d4865bdd100b495b938f50", "score": "0.5924164", "text": "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "title": "" }, { "docid": "70fa55746056e81854d70a51e822de66", "score": "0.59167904", "text": "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "title": "" }, { "docid": "3683f6af8fc4e6b9de7dc0c83f88b6aa", "score": "0.59088355", "text": "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "title": "" }, { "docid": "3eef50b797f6aa8c4def3969457f45dd", "score": "0.5907542", "text": "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "title": "" }, { "docid": "753b67fc94e3cd8d6ff2024ce39dce9f", "score": "0.59064597", "text": "def url_whitelist; end", "title": "" }, { "docid": "f9f0da97f7ea58e1ee2a5600b2b79c8c", "score": "0.5906243", "text": "def admin_social_network_params\n params.require(:social_network).permit!\n end", "title": "" }, { "docid": "5bdab99069d741cb3414bbd47400babb", "score": "0.5898226", "text": "def filter_params\n params.require(:filters).permit(:letters)\n end", "title": "" }, { "docid": "7c5ee86a81b391c12dc28a6fe333c0a8", "score": "0.589687", "text": "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "title": "" }, { "docid": "de77f0ab5c853b95989bc97c90c68f68", "score": "0.5896091", "text": "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "title": "" }, { "docid": "29d030b36f50179adf03254f7954c362", "score": "0.5894501", "text": "def sensitive_params=(params)\n @sensitive_params = params\n end", "title": "" }, { "docid": "bf321f5f57841bb0f8c872ef765f491f", "score": "0.5894289", "text": "def permit_request_params\n params.permit(:address)\n end", "title": "" }, { "docid": "5186021506f83eb2f6e244d943b19970", "score": "0.5891739", "text": "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "title": "" }, { "docid": "b85a12ab41643078cb8da859e342acd5", "score": "0.58860534", "text": "def secure_params\n params.require(:location).permit(:name)\n end", "title": "" }, { "docid": "46e104db6a3ac3601fe5904e4d5c425c", "score": "0.5882406", "text": "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "title": "" }, { "docid": "abca6170eec412a7337563085a3a4af2", "score": "0.587974", "text": "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "title": "" }, { "docid": "26a35c2ace1a305199189db9e03329f1", "score": "0.58738774", "text": "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "title": "" }, { "docid": "de49fd084b37115524e08d6e4caf562d", "score": "0.5869024", "text": "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "title": "" }, { "docid": "7b7ecfcd484357c3ae3897515fd2931d", "score": "0.58679986", "text": "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "title": "" }, { "docid": "0016f219c5d958f9b730e0824eca9c4a", "score": "0.5867561", "text": "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "title": "" }, { "docid": "8aa9e548d99691623d72891f5acc5cdb", "score": "0.5865932", "text": "def url_params\n params[:url].permit(:full)\n end", "title": "" }, { "docid": "c6a8b768bfdeb3cd9ea388cd41acf2c3", "score": "0.5864461", "text": "def backend_user_params\n params.permit!\n end", "title": "" }, { "docid": "be95d72f5776c94cb1a4109682b7b224", "score": "0.58639693", "text": "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "title": "" }, { "docid": "967c637f06ec2ba8f24e84f6a19f3cf5", "score": "0.58617616", "text": "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "title": "" }, { "docid": "e4a29797f9bdada732853b2ce3c1d12a", "score": "0.5861436", "text": "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "title": "" }, { "docid": "d14f33ed4a16a55600c556743366c501", "score": "0.5860451", "text": "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "title": "" }, { "docid": "46cb58d8f18fe71db8662f81ed404ed8", "score": "0.58602303", "text": "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "title": "" }, { "docid": "7e9a6d6c90f9973c93c26bcfc373a1b3", "score": "0.5854586", "text": "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "title": "" }, { "docid": "ad61e41ab347cd815d8a7964a4ed7947", "score": "0.58537364", "text": "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "title": "" }, { "docid": "8894a3d0d0ad5122c85b0bf4ce4080a6", "score": "0.5850427", "text": "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "title": "" }, { "docid": "53d84ad5aa2c5124fa307752101aced3", "score": "0.5850199", "text": "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end", "title": "" } ]
d2329cff1b05c6e443ce6eed108d06b0
Write a method that takes an Array, and returns a new Array with the elements of the original list in reverse order. Do not modify the original list. the only difference is that a new array is allowed! much easier
[ { "docid": "0ce8b8b60ae0202d075470bbfc526b60", "score": "0.7959489", "text": "def reverse(arr)\n\nnew_arr = []\n\n arr.each do |element|\n new_arr.unshift(element)\n end\n new_arr\n\nend", "title": "" } ]
[ { "docid": "6099aa9232219b789b6355da476705af", "score": "0.8596462", "text": "def reverse_array(array_new)\n array_new.reverse \n end", "title": "" }, { "docid": "299f6ab0d49c96cc3e4285a4a650a609", "score": "0.8587202", "text": "def reverse_array(array)\n array.reverse!\n array\nend", "title": "" }, { "docid": "7b0f7651d03d44b72619d83bbd2741ba", "score": "0.8587087", "text": "def reverse_array (array) \n return array.reverse\nend", "title": "" }, { "docid": "6bbb2ff99011dc819e72bdf4ea814607", "score": "0.85703766", "text": "def reverse_array(array)\n array.reverse\nend", "title": "" }, { "docid": "0e25ab962c3fef96ec9f9f623aa0c50a", "score": "0.85571307", "text": "def reverse_array(array)\n array.reverse \nend", "title": "" }, { "docid": "1ba6d76294b50766d984f1bcdab8af6e", "score": "0.8543709", "text": "def reverse_array(array)\n array.reverse\nend", "title": "" }, { "docid": "1ba6d76294b50766d984f1bcdab8af6e", "score": "0.8543709", "text": "def reverse_array(array)\n array.reverse\nend", "title": "" }, { "docid": "1ba6d76294b50766d984f1bcdab8af6e", "score": "0.8543709", "text": "def reverse_array(array)\n array.reverse\nend", "title": "" }, { "docid": "1ba6d76294b50766d984f1bcdab8af6e", "score": "0.8543709", "text": "def reverse_array(array)\n array.reverse\nend", "title": "" }, { "docid": "1ba6d76294b50766d984f1bcdab8af6e", "score": "0.8543709", "text": "def reverse_array(array)\n array.reverse\nend", "title": "" }, { "docid": "1ba6d76294b50766d984f1bcdab8af6e", "score": "0.8543709", "text": "def reverse_array(array)\n array.reverse\nend", "title": "" }, { "docid": "1ba6d76294b50766d984f1bcdab8af6e", "score": "0.8543709", "text": "def reverse_array(array)\n array.reverse\nend", "title": "" }, { "docid": "1ba6d76294b50766d984f1bcdab8af6e", "score": "0.8543709", "text": "def reverse_array(array)\n array.reverse\nend", "title": "" }, { "docid": "1ba6d76294b50766d984f1bcdab8af6e", "score": "0.8543709", "text": "def reverse_array(array)\n array.reverse\nend", "title": "" }, { "docid": "1ba6d76294b50766d984f1bcdab8af6e", "score": "0.8543709", "text": "def reverse_array(array)\n array.reverse\nend", "title": "" }, { "docid": "1ba6d76294b50766d984f1bcdab8af6e", "score": "0.8543709", "text": "def reverse_array(array)\n array.reverse\nend", "title": "" }, { "docid": "1ba6d76294b50766d984f1bcdab8af6e", "score": "0.8543709", "text": "def reverse_array(array)\n array.reverse\nend", "title": "" }, { "docid": "1ba6d76294b50766d984f1bcdab8af6e", "score": "0.8543709", "text": "def reverse_array(array)\n array.reverse\nend", "title": "" }, { "docid": "1ba6d76294b50766d984f1bcdab8af6e", "score": "0.8543709", "text": "def reverse_array(array)\n array.reverse\nend", "title": "" }, { "docid": "1ba6d76294b50766d984f1bcdab8af6e", "score": "0.8543709", "text": "def reverse_array(array)\n array.reverse\nend", "title": "" }, { "docid": "1ba6d76294b50766d984f1bcdab8af6e", "score": "0.8543709", "text": "def reverse_array(array)\n array.reverse\nend", "title": "" }, { "docid": "1ba6d76294b50766d984f1bcdab8af6e", "score": "0.8543709", "text": "def reverse_array(array)\n array.reverse\nend", "title": "" }, { "docid": "1ba6d76294b50766d984f1bcdab8af6e", "score": "0.8543709", "text": "def reverse_array(array)\n array.reverse\nend", "title": "" }, { "docid": "1ba6d76294b50766d984f1bcdab8af6e", "score": "0.8543709", "text": "def reverse_array(array)\n array.reverse\nend", "title": "" }, { "docid": "1ba6d76294b50766d984f1bcdab8af6e", "score": "0.8543709", "text": "def reverse_array(array)\n array.reverse\nend", "title": "" }, { "docid": "1ba6d76294b50766d984f1bcdab8af6e", "score": "0.8543709", "text": "def reverse_array(array)\n array.reverse\nend", "title": "" }, { "docid": "81c272f6bba503fffb641caeb610a226", "score": "0.85299224", "text": "def reverse(array)\n result_array = []\n array.reverse_each { |element| result_array << element }\n result_array\nend", "title": "" }, { "docid": "81c272f6bba503fffb641caeb610a226", "score": "0.85299224", "text": "def reverse(array)\n result_array = []\n array.reverse_each { |element| result_array << element }\n result_array\nend", "title": "" }, { "docid": "1a24bd0ed54e694e8417e576c502b5d4", "score": "0.8513421", "text": "def reverse_array(array)\n array.reverse!\nend", "title": "" }, { "docid": "1a24bd0ed54e694e8417e576c502b5d4", "score": "0.8513421", "text": "def reverse_array(array)\n array.reverse!\nend", "title": "" }, { "docid": "9fb138ea29a976dd327d0aa25f774f96", "score": "0.8488905", "text": "def my_reverse(arr)\n new_array = arr.reverse\n return new_array\n end", "title": "" }, { "docid": "21ebf18adbd4d75f0d5d3927ad00d935", "score": "0.84828603", "text": "def reverse(array)\n new_array = []\n \n array.reverse_each { |element| new_array << element }\n \n new_array\nend", "title": "" }, { "docid": "1dbcce6543881c40049b67f6dc6b5fcc", "score": "0.847769", "text": "def reverse_array(array)\narray.reverse\nend", "title": "" }, { "docid": "1dbcce6543881c40049b67f6dc6b5fcc", "score": "0.847769", "text": "def reverse_array(array)\narray.reverse\nend", "title": "" }, { "docid": "1dbcce6543881c40049b67f6dc6b5fcc", "score": "0.847769", "text": "def reverse_array(array)\narray.reverse\nend", "title": "" }, { "docid": "5a1dd1510aa1db4dabeb264810fc3f26", "score": "0.8441787", "text": "def reverse_array(array)\n\tarray.reverse\nend", "title": "" }, { "docid": "21804ea58edb5017742bf7ca705704ac", "score": "0.8433351", "text": "def reverse_array(arr)\n arr.reverse\nend", "title": "" }, { "docid": "b271f8de614edbb126b72b9aed2b903b", "score": "0.83906144", "text": "def reverse_array(arry)\n arry.reverse\n\nend", "title": "" }, { "docid": "d3cadcd445309dc5651ba055ca62e0d1", "score": "0.83164716", "text": "def reverse_array(a)\n a.reverse{|b| b}\nend", "title": "" }, { "docid": "ef91a54fd871de193fb6a0ad05ce9c93", "score": "0.82991695", "text": "def reverse_array(arr_rev)\n arr_rev.reverse\nend", "title": "" }, { "docid": "bc53795111cfcf7f9fa2a18cac601843", "score": "0.8290201", "text": "def reverse_array(array)\n flipped = []\n array.each{ |el| flipped.unshift(el) }\n flipped\nend", "title": "" }, { "docid": "e0f055a7c1f416dfe54df64c41dfec5b", "score": "0.8278639", "text": "def reverse!(old_array)\n new_array = []\n while old_array.length > 0\n new_array << old_array.pop\n end\n while new_array.length > 0\n old_array << new_array.shift\n end\n old_array\nend", "title": "" }, { "docid": "f97bea05285205b348a4ad727eca0043", "score": "0.82720673", "text": "def reverse_every_element_in_array(array)\n new_array = Array.new\n array.each {|element|\n new_array << element.reverse\n } \n new_array\nend", "title": "" }, { "docid": "07a91019b350e00d09f2d3f6fd245420", "score": "0.826382", "text": "def reverse(array)\n results = []\n array.reverse_each{ |x| results << x }\n results\nend", "title": "" }, { "docid": "042bbc07ecbff6b8dfdf375cfbb1ff9c", "score": "0.8246445", "text": "def using_reverse(array)\n reversed_array=array.reverse\nend", "title": "" }, { "docid": "33dfaee04ec9d238e6e2d70fb34cc986", "score": "0.82356983", "text": "def reverse(array)\r\n new_array = []\r\narray.reverse_each do |element|\r\n new_array << element\r\nend\r\nnew_array\r\nend", "title": "" }, { "docid": "0e35bd4b94c85d1556eebb6d8ea5f8dd", "score": "0.82315165", "text": "def reverse!(array)\n copy = array.clone\n index = -1\n\n copy.each do |element|\n array[index] = element\n index -= 1\n end\n\n array\nend", "title": "" }, { "docid": "6ef83f5c1167722a4163b4fe0043bff5", "score": "0.81918013", "text": "def reverse!(list)\n reverse_list = Array.new(list)\n (reverse_list.size - 1).downto(0).each { |index| list[index] = reverse_list[index]}\n list\nend", "title": "" }, { "docid": "64f934e2c6d83de92e6214da723c8b51", "score": "0.81859106", "text": "def using_reverse(array)\n array.reverse \nend", "title": "" }, { "docid": "93c8132ff04e04b356730cde36171052", "score": "0.8178877", "text": "def using_reverse(array)\narray.reverse\nend", "title": "" }, { "docid": "93c8132ff04e04b356730cde36171052", "score": "0.8178877", "text": "def using_reverse(array)\narray.reverse\nend", "title": "" }, { "docid": "dab7e06a300f8099f903ab90b6297aa5", "score": "0.8162145", "text": "def reverse(a)\n new = []\n (0...a.size).each { |i| new << a[a.size - i - 1] }\n new\nend", "title": "" }, { "docid": "c1a7e8bc7d223cbcda7c0007ac43799f", "score": "0.8160953", "text": "def reverse_array(array)\n new_array = []\n index = -1\n while index * (-1) <= array.length\n new_array << array[index]\n index -= 1\n end\n new_array\nend", "title": "" }, { "docid": "1d346d6a5841ba1b03105856a81ef8d1", "score": "0.81510645", "text": "def reverse(array)\n result_array = []\n array.each { |element| result_array.unshift(element) }\n result_array\nend", "title": "" }, { "docid": "4190b594ff70a987e189ecbd46148648", "score": "0.8147653", "text": "def using_reverse(array)\n array.reverse\nend", "title": "" }, { "docid": "4190b594ff70a987e189ecbd46148648", "score": "0.8147653", "text": "def using_reverse(array)\n array.reverse\nend", "title": "" }, { "docid": "8ce12626022964e34373ee3d129b1467", "score": "0.8134641", "text": "def reverse!(array)\n copy_array = array.dup\n array.map! { |_| copy_array.pop }\nend", "title": "" }, { "docid": "8cc01f1edab80b73e4d75d8052b3a5dd", "score": "0.8100582", "text": "def reverse(array)\n result = []\n array.each do |item|\n result.prepend(item)\n end\n result\nend", "title": "" }, { "docid": "ac4bca906e2e3b6a53236e25c9c610d9", "score": "0.8090755", "text": "def reverse!(arr)\n copy = []\n cp_index = arr.size-1\n (0...arr.size).each do |arr_index|\n copy[arr_index] = arr[cp_index]\n cp_index -= 1\n end\n copy.each_with_index do |el, index|\n arr[index] = el\n end\n arr\nend", "title": "" }, { "docid": "22518ccb8c2b7b3ca23860b2b0060fe9", "score": "0.8089212", "text": "def my_reverse(arr)\n result = []\n for i in (0..arr.length-1).reverse_each #maybe this is cheating?\n result << arr[i]\n end\n result\nend", "title": "" }, { "docid": "183577aede14e9e3ffb0fb19768ab5f1", "score": "0.8088383", "text": "def reverse_list list\n new_array = []\n x = list.length - 1\n while x >= 0\n new_array.push(list[x])\n x -= 1\n end\n new_array\nend", "title": "" }, { "docid": "de1bf7d2661cbdf57714854534f189e4", "score": "0.80756485", "text": "def reverse(arr)\n new_arr = []\n arr.each do |element|\n new_arr.prepend(element)\n end\n new_arr\nend", "title": "" }, { "docid": "c92dac76a46d72f4850f8138bba18617", "score": "0.806837", "text": "def reverse_array(array)\n reversed_array = []\n array.each {|e| reversed_array.unshift(e)}\n reversed_array\n\n #could just use #reverse but don't think that's what the lab was asking for\n # reversed_array = array.reverse\nend", "title": "" }, { "docid": "2afa7bf251487774c22f1e18bc2f2b19", "score": "0.8062822", "text": "def reverse_array(i)\r\n i.reverse!\r\nend", "title": "" }, { "docid": "aaf4017b58e1bc8225b35b6513036578", "score": "0.8060619", "text": "def reverse(array)\n reversed_array = []\n array.each { |item| reversed_array.unshift(item) }\n reversed_array\nend", "title": "" }, { "docid": "008be5c7bad5ae13d58bd4c903f86a3b", "score": "0.8044462", "text": "def reverse_array(array)\n reversed_arr = []\n (array.size - 1).downto(0) do |index|\n reversed_arr << array[index]\n end\n\n reversed_arr\nend", "title": "" }, { "docid": "6a13bd547c1d2ad17cf25bfe54e463f9", "score": "0.80351835", "text": "def reverse_every_element_in_array(array)\n array.map(&:reverse)\nend", "title": "" }, { "docid": "aa1ace77c4a41167f40b52c4c6fd8840", "score": "0.8034118", "text": "def reverse!(arr)\n arr_orignal = arr.map{ |element| element }\n index = 0\n loop do\n break if index == arr.size\n arr[index] = arr_orignal[-(index+1)]\n index +=1\n end\n arr\nend", "title": "" }, { "docid": "4cf032360d6ff1cbd8d9b3769d0eb82e", "score": "0.80150384", "text": "def my_reverse(arr)\n\tarr.reverse\nend", "title": "" }, { "docid": "fd07326212039aa57e2c4e053dd15c5c", "score": "0.80093485", "text": "def reverse(list)\n source_list = list.dup\n new_arr = []\n count = list.size\n until count\n new_arr << source_list[count - 1]\n count -= 1\n end\n new_arr\nend", "title": "" }, { "docid": "c1c0141b18be4b3ba611d2f4421f138b", "score": "0.80062944", "text": "def my_reverse\n new_arr = []\n i = self.length-1\n while i >= 0\n new_arr << self[i]\n i -= 1\n end\n new_arr\n end", "title": "" }, { "docid": "b04af82fa22b715f69a5d83853da839f", "score": "0.80040854", "text": "def reverse_array(integers)\n integers.reverse \nend", "title": "" }, { "docid": "6e452ec90ab63fd248bb6f2e29a43443", "score": "0.8002139", "text": "def reverse_array(array_i)\n array_i = array_i.reverse\nend", "title": "" }, { "docid": "2f87bfcd735f2f3e706adca14357fdfb", "score": "0.8001275", "text": "def reverse(arr)\n output = []\n arr.reverse_each {|x| output.push x}\n output\nend", "title": "" }, { "docid": "344ac9d374625178af09bdf555f6006c", "score": "0.7992387", "text": "def reverse!(arr)\n values = arr.dup\n arr.each.with_index do |_, index|\n arr[index] = values[-index - 1]\n end\nend", "title": "" }, { "docid": "2f4f0dfa2913efe2c743ac7321a3076b", "score": "0.7988434", "text": "def reverse_array(array_int)\n array_int.reverse!\nend", "title": "" }, { "docid": "19a9387ecde4ceff9d41d98f4e03738b", "score": "0.7987101", "text": "def reverse_array(int_array)\n int_array.reverse\nend", "title": "" }, { "docid": "b0492b0c3eeeaa0905ac057e18097b73", "score": "0.7985259", "text": "def reverse!(array)\n reversed_array = []\n array.size.times { reversed_array << array.pop }\n reversed_array.size.times { array << reversed_array.shift }\n array\nend", "title": "" }, { "docid": "4dc2d6335393f604b097140f1c968b90", "score": "0.7981168", "text": "def reverse_arr(arr)\n return_arr = []\n arr.each do |item|\n return_arr.unshift(item)\n end \n return_arr\nend", "title": "" }, { "docid": "d54258fbef61a1a57441216804d5fdce", "score": "0.7980942", "text": "def reverse(array)\n new_array = []\n array.length.times do \n new_array << array.pop\n end\n new_array\nend", "title": "" }, { "docid": "11345de4546003e1f601f643c9b3f13b", "score": "0.7979026", "text": "def reverse_array(array)\n return nil if array.class != Array\n local_stack = Stack.new()\n array.each do |element|\n local_stack.push(element)\n end\n array.size.times do |i|\n array[i] = local_stack.pop()\n end\n array\nend", "title": "" }, { "docid": "7029b1e3f0464ca3c6e0eb817feeb9ef", "score": "0.7976806", "text": "def reverse_array(integers)\n integers.reverse\nend", "title": "" }, { "docid": "c995b9f8b4146c49d50baf88da52e69d", "score": "0.796737", "text": "def my_reverse(arr)\n arr.reverse\nend", "title": "" }, { "docid": "0c5206134bb7287f723bbbb81b704cca", "score": "0.7950068", "text": "def reverse_array(arr)\n new_arr = []\n arr.length.times do |i|\n new_arr = new_arr.unshift(arr[i])\n end\n new_arr\nend", "title": "" }, { "docid": "51ad5b637dce466ae3a5b26a9f7bafb2", "score": "0.79491377", "text": "def reverse_every_element_in_array(array)\n array.map!{|element|element.reverse}\nend", "title": "" }, { "docid": "d19882dc0dd4f022145ddeb288357119", "score": "0.79394567", "text": "def reverse!(array)\n iteration = array.length / 2\n iteration.times do |index|\n array[index], array[-index - 1] = array[-index - 1], array[index]\n end\n array\nend", "title": "" }, { "docid": "13a4aa1619b5ec47e8e48a44411374e5", "score": "0.7936569", "text": "def reverse(array)\n new_array = []\n array.reverse.each do |outer|\n new_inner = []\n outer.reverse.each do |inner|\n new_inner << inner\n end\n new_array << new_inner\n end\n return new_array\nend", "title": "" }, { "docid": "780ecf7d4d37c933f4f4dc45b4945c29", "score": "0.7936279", "text": "def reverse_array(array)\n reversed = []\n while array != []\n reversed << array.last\n array = array[0..-2]\n end\n reversed\nend", "title": "" }, { "docid": "5d5f942b858ed8525f786421af5131e3", "score": "0.7933525", "text": "def reverse(arr)\n new_arr = []\n arr.each { |elem| new_arr.unshift(elem) }\n new_arr\nend", "title": "" }, { "docid": "a7004fd8420990ac1ae86f9c3c1ef5b6", "score": "0.7911571", "text": "def my_reverse(arr)\n new_arr = []\n arr.each { |ele| new_arr.unshift(ele) }\n new_arr\nend", "title": "" }, { "docid": "f79e49a76d65882652f21168b7e309db", "score": "0.7901234", "text": "def reverse_array(array)\n output = []\n (array.length).times do |_|\n output << array.pop \n end\n output\nend", "title": "" }, { "docid": "0676ecbf9c59611358726433a6e3a146", "score": "0.78983665", "text": "def reverse(array)\n new_array = array.dup\n counter, finish, max = 0, -1, (array.length)\n while counter < max\n new_array[finish] = array[counter]\n counter += 1\n finish -= 1\n end\n new_array\nend", "title": "" }, { "docid": "db482fd73809549d6e6480f45b20160e", "score": "0.7898297", "text": "def reverse_each(array)\n new_array = []\n array.each do |el|\n new_array.push(el.reverse)\n end\n return new_array\nend", "title": "" }, { "docid": "059f67f959d42e3b81b36fd79961b02e", "score": "0.78982234", "text": "def my_reverse(arr)\n arr.reverse\nend", "title": "" }, { "docid": "059f67f959d42e3b81b36fd79961b02e", "score": "0.78982234", "text": "def my_reverse(arr)\n arr.reverse\nend", "title": "" }, { "docid": "059f67f959d42e3b81b36fd79961b02e", "score": "0.78982234", "text": "def my_reverse(arr)\n arr.reverse\nend", "title": "" }, { "docid": "3fa8ae1a46d0090007b53845e9d4553c", "score": "0.7885146", "text": "def my_reverse(arr)\n len = arr.length - 1\n new_arr = []\n while len >= 0\n new_arr << arr[len]\n len -= 1\n end\n new_arr\nend", "title": "" }, { "docid": "e4dec46c7b7eaf0ae978c8db9177dc6d", "score": "0.7881897", "text": "def reverse(array)\n start = 0\n last = array.length - 1\n\n while start <= last do\n array[start], array[last] = array[last], array[start]\n start += 1\n last -= 1\n end\n\n return array\nend", "title": "" }, { "docid": "eced9416dca8c02b631060d7a97eafea", "score": "0.7877449", "text": "def my_reverse(arr)\n idx = arr.length - 1\n rev = []\n while idx >= 0\n rev.push(arr[idx])\n idx -= 1\n end\n rev\nend", "title": "" }, { "docid": "b77f05f939164bde7324ccba53a9a241", "score": "0.7874096", "text": "def reverse_array(array)\nreversed_array = []\nindex = array.length - 1\n while index >= 0\n reversed_array.push(array[index])\n index -= 1\n end\nreversed_array\nend", "title": "" } ]
880fb94924c04f78b134069a2bc5d6ce
Apply the new autoprefix and autodsid extraction mechanism.
[ { "docid": "3e8e49be4700ba6e52895f96c9064168", "score": "0.0", "text": "def refresh_form #:nodoc:\n params = self.params\n\n prefpat = params[:prefix_auto_comp] || \"\"\n dsidpat = params[:dsid_auto_comp] || \"\"\n return \"\" if prefpat.blank? && dsidpat.blank? # nothing to do\n\n file_args = params[:file_args] || {}\n file_args.values.each do |struct|\n t1_name = struct[:t1_name]\n next if t1_name.blank?\n comps_array = t1_name.split(/([a-zA-Z0-9]+)/)\n comps = {} # From \"abc_def\" will make { \"0\" => 'abc', \"1\" => 'def' ... }\n 1.step(comps_array.size,2) { |i| comps[((i-1)/2+1).to_s] = comps_array[i] }\n struct[:prefix] = prefpat.present? ? prefpat.pattern_substitute(comps) : \"\"\n struct[:dsid] = dsidpat.pattern_substitute(comps) if dsidpat.present?\n end\n \"\"\n end", "title": "" } ]
[ { "docid": "789319fb69e500578ef11c423ab628ad", "score": "0.56563026", "text": "def run(content, params={})\n require \"autoprefixer-rails\"\n AutoprefixerRails.process(content, from: @item[:filename]).css\n end", "title": "" }, { "docid": "d18925812200e29173b685745af85c31", "score": "0.5534744", "text": "def copy_autoprefixer\n copy_file '../autoprefixer.yml', 'config/autoprefixer.yml', force: true\n end", "title": "" }, { "docid": "98272cae7d63f536584af420e2a424b2", "score": "0.5154372", "text": "def auto_complete_css\n auto_complete_skip_style ? '' : AUTO_COMPLETE_CSS\n end", "title": "" }, { "docid": "31821edc724bedbf0ee5f5b27df14852", "score": "0.49479347", "text": "def prefixes; end", "title": "" }, { "docid": "c20353612afd4a18071bb36327253782", "score": "0.4940339", "text": "def info\n runtime.call(\"autoprefixer.info\", params_with_browsers)\n end", "title": "" }, { "docid": "e9a209128e2070269066b5b20829a01c", "score": "0.4896057", "text": "def _prefixes\n @_prefixes ||= super + ['catalog']\n end", "title": "" }, { "docid": "cbf1197390184e70a9d02e8337116af9", "score": "0.4891018", "text": "def _prefixes\n @_prefixes ||= super + ['catalog']\n end", "title": "" }, { "docid": "e05bc9b8df05548644fe0a9b52d2a539", "score": "0.4887934", "text": "def prefix_css_selectors(prefix = \"_\")\n DOM.walk(doc) do |node|\n for attr_key in %w(id name class)\n if attr_val = node.attributes[attr_key]\n node[attr_key] = \"#{prefix}#{attr_val.to_s}\"\n end\n end\n end\n end", "title": "" }, { "docid": "e8063c4aeeed0d2811d2f7d9af871627", "score": "0.48872608", "text": "def _prefixes\n @_prefixes ||= super + ['catalog']\n end", "title": "" }, { "docid": "a79f4889169e7f72455c2e2ea198f46a", "score": "0.48262626", "text": "def _prefixes\n @_prefixes ||= super + ['hyrax/base']\n end", "title": "" }, { "docid": "a79f4889169e7f72455c2e2ea198f46a", "score": "0.48262626", "text": "def _prefixes\n @_prefixes ||= super + ['hyrax/base']\n end", "title": "" }, { "docid": "a79f4889169e7f72455c2e2ea198f46a", "score": "0.48262626", "text": "def _prefixes\n @_prefixes ||= super + ['hyrax/base']\n end", "title": "" }, { "docid": "22fe0e7fb897d0729e4067da56215105", "score": "0.4779643", "text": "def _prefixes\n @_prefixes ||= super + ['catalog', 'hyrax/base']\n end", "title": "" }, { "docid": "22fe0e7fb897d0729e4067da56215105", "score": "0.4779643", "text": "def _prefixes\n @_prefixes ||= super + ['catalog', 'hyrax/base']\n end", "title": "" }, { "docid": "7eb7b72d20c0e666625abb23f2aeef49", "score": "0.4762136", "text": "def write_unmergable_css_rules(doc, unmergable_rules)\n styles = ''\n unmergable_rules.each_selector(:all, :force_important => true) do |selector, declarations, specificity|\n styles += \"#{selector} { #{declarations} }\\n\"\n end \n unless styles.empty?\n style_tag = \"\\n<style type=\\\"text/css\\\">\\n#{styles}</style>\\n\"\n doc.search(\"head\").append(style_tag)\n end\n doc\n end", "title": "" }, { "docid": "0e98a0084f1b34cd213d0fa9667e834b", "score": "0.47338468", "text": "def prefix(args)\n if args[:css]\n css = args[:css]\n elsif args[:document]\n doc = Nokogiri::HTML::DocumentFragment.parse(args[:document])\n style = (doc/\"style\").first\n return doc.to_s if style.nil?\n css = style.inner_html\n end\n \n prefix = args[:prefix].to_s\n \n new_styles = []\n raw_styles(css, true).each do |raw_style|\n selector, rule = parse(raw_style)\n new_styles << \"#{prefix} #{selector} { #{rule} }\"\n end\n new_styles = new_styles.join(\"\\n\")\n return new_styles if !style\n \n style.inner_html = new_styles\n doc.to_s\n end", "title": "" }, { "docid": "836fb876378e582218be52027142e668", "score": "0.4687101", "text": "def _prefixes\n @_prefixes ||= super + ['catalog', 'curation_concern/base']\n end", "title": "" }, { "docid": "b7493ac2677167774272e664ee33235b", "score": "0.46870264", "text": "def prefixes\n _prefixes = ['']\n\n # In development mode, include all prefixes for maximum compatibility.\n _prefixes += %w(-moz- -ms- -o-) if development?\n\n # Always include webkit for targeting mobile devices.\n _prefixes << '-webkit-'\n\n _prefixes\n end", "title": "" }, { "docid": "52ae705d49eb819caddd4426cf2bb73d", "score": "0.4686171", "text": "def _prefixes\n @_prefixes ||= super + ['catalog', 'curation_concern/base']\n end", "title": "" }, { "docid": "147ab3e72c0de7a92f6d9714e13db1d4", "score": "0.46585026", "text": "def register(assets, &block)\n assets.register_postprocessor('text/css', :autoprefixer, &block)\n end", "title": "" }, { "docid": "1a6a6ddfe04f40915b10c69e32155260", "score": "0.46065354", "text": "def auto_orient\n chain! { |builder| builder.autorot }\n end", "title": "" }, { "docid": "ccd2119fa0246a4b8372de3c018dc2de", "score": "0.46035448", "text": "def _prefixes\n @_prefixes ||= super + ['books']\n end", "title": "" }, { "docid": "b86ee20adcb4b23656e4e07f7ec83bde", "score": "0.45963535", "text": "def reset_identifier_mangling\n @quote_identifiers = @opts.fetch(:quote_identifiers){(qi = Database.quote_identifiers).nil? ? quote_identifiers_default : qi}\n @identifier_input_method = @opts.fetch(:identifier_input_method){(iim = Database.identifier_input_method).nil? ? identifier_input_method_default : (iim if iim)}\n @identifier_output_method = @opts.fetch(:identifier_output_method){(iom = Database.identifier_output_method).nil? ? identifier_output_method_default : (iom if iom)}\n reset_default_dataset\n end", "title": "" }, { "docid": "61745f0ead0d6ca951f3f5f3d82804a5", "score": "0.45882696", "text": "def load_prefix_file!\n @prefixes = {}\n File.open(\"#{File.dirname(__FILE__)}/../../mac-prefixes.txt\", 'r').each_line do |line|\n line.strip!\n next if line.empty? || line.start_with?('#', '//')\n oui, organization = line.split(' ', 2)\n @prefixes[oui.to_sym] = organization\n end\n end", "title": "" }, { "docid": "82df65a43ed8702a29c20ae541da75b3", "score": "0.45807543", "text": "def _prefixes\n @_prefixes ||= super + ['books']\n end", "title": "" }, { "docid": "f3036f466fc785e1a35dc3760c0f84f3", "score": "0.45764473", "text": "def install\n etc.install \"etc/autopac.ini\" => \"autopac.ini\"\n sbin.install \"sbin/autopac.py\" => \"autopac\"\n end", "title": "" }, { "docid": "4b48bfbcbc67f0fcffafb5f4691e43b2", "score": "0.45573455", "text": "def autorun\n @autorun = true unless defined? @autorun\n @autorun\n end", "title": "" }, { "docid": "709ff4710e5837f3c20053821d063932", "score": "0.4549248", "text": "def _postprocess_css(opts)\n if opts[:sprited]\n ret = postprocess_css_sprited(opts)\n else\n ret = postprocess_css_dataurl(opts)\n end\n\n ret = _strip_slice_class_names(ret)\n end", "title": "" }, { "docid": "800bb67e6dcb8ced1ccdcf6d5d2430dc", "score": "0.45119852", "text": "def prefixes!\n unless defined?(@prefixes)\n ShortPrefixes.new.call(cdfa, :short_prefix)\n @prefixes = true\n end\n end", "title": "" }, { "docid": "7c2fb228af72f1769ef348c0c6664840", "score": "0.45105717", "text": "def postprocess(document)\n \n document.gsub!(/^\\<\\!\\-\\-include /, \"<!--\") # fix the start of the include markers\n document.gsub!(/ include\\-\\-\\>/, \"-->\") # fix the end of the include markets\n document.gsub!(/\\$\\{/, \"&#36;{\") # fix the end of the include markets \n $footnoteDefs.each_pair { |ref, fndef| document.gsub!(/#{ref}/,fndef) } # Loop through the footnote refs replace with popover text\n document.gsub!(/<p>\\{\\{\\s*\\$abbreviations\\s*\\}\\}\\s<\\/p>/, \"<dl>\" + $abbrList.sort.map { |s| \"#{s}\" }.join(' ') + \"</dl>\" ) \n # output the list of abbreviations\n document.gsub!(/<p>\\{\\{\\s*\\$definitions\\s*\\}\\}\\s<\\/p>/, \"<dl>\" + $defList.sort.map { |s| \"#{s}\" }.join(' ') + \"</dl>\" ) \n # output the list of definitions\n document.gsub!(/<p>\\{\\{\\s*\\$terms\\s*\\}\\}\\s<\\/p>/, \"<dl>\" + ($abbrList+$defList).sort.map { |s| \"#{s}\" }.join(' ') + \"</dl>\" ) \n # output the list of definitions\n document.gsub!(/<p>\\{\\{\\s*\\$footnotes\\s*\\}\\}\\s<\\/p>/, $footnoteDiv ) # output the list of footnotes\n return document\n end", "title": "" }, { "docid": "6cde0c4afccea5916db31f50c381242e", "score": "0.45057404", "text": "def auto_id\n\t\t# ...but only if a toc entry might reference one, or requested.\n\t\tif @meta['auto-id'].as_boolean || @meta.toc.as_list.any?{ |toc| !toc['#'] }\n\t\t\t@nokodoc.css( AUTO_ID_ELEMENTS ).each do |node|\n\t\t\t\tnext if node.has_attribute?('id')\n\t\t\t\t# Strip off the unwanted leading '#'\n\t\t\t\tnode['id'] = DocuBot.id_from_text(node.inner_text)[1..-1]\n\t\t\tend\n\t\t\tdirty_doc\n\t\tend\n\tend", "title": "" }, { "docid": "7275d4b369173a0da66f9ed09c82ee13", "score": "0.4462724", "text": "def setup\n AutoStripAttributes::Config.setup do\n set_filter(downcase: false) do |value|\n value.downcase if value.respond_to?(:downcase)\n end\n end\n end", "title": "" }, { "docid": "336b2939dc5ed2640c5a0f51753a112b", "score": "0.44625598", "text": "def expand_aut_num(query)\n return if query.protocols.empty?\n\n result = cache(query.object, query.sources) {\n begin\n command = expand_aut_num_command(query.object)\n execute(command)\n rescue\n raise \"'#{command}' failed on '#{@fqdn}' (#{$!.message}).\"\n end\n }\n\n query.protocols.each do |protocol|\n query.add_prefix_result parse_prefixes_from_aut_num(result, protocol), query.object, protocol\n end\n end", "title": "" }, { "docid": "abfb1f0cadfb8e21990683df5f7a2eb9", "score": "0.44565114", "text": "def install_stylesheet\n # FIXME: Implement\n end", "title": "" }, { "docid": "3720aec2d22179e60bd61873897a11c1", "score": "0.44442934", "text": "def import_extra_scss\n gen2.morecss.map do |selector, rules|\n rules_str = rules.map do |name, value| \"#{name}: #{value};\" end.join\n \"#{selector}{#{rules_str}}\"\n end.\n join\n end", "title": "" }, { "docid": "936db46edd5c166de1267801eba82364", "score": "0.44266966", "text": "def add_modern_aliases\n add_alias \"Win7 Safari3\",\n \"Mozilla/5.0 (Windows; U; Windows NT 6.1; da) AppleWebKit/522.15.5 (KHTML, like Gecko) Version/3.0.3 Safari/522.15.5\"\n add_alias \"WinXP Safari3\", \"Mozilla/5.0 (Windows; U; Windows NT 5.1; id) AppleWebKit/522.11.3 (KHTML, like Gecko) Version/3.0 Safari/522.11.3\"\n add_alias \"Mac Safari4\", \"Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_1; zh-CN) AppleWebKit/530.19.2 (KHTML, like Gecko) Version/4.0.2 Safari/530.19\"\n end", "title": "" }, { "docid": "6a01e267ba4a250ef7b55010f4a77eaa", "score": "0.44023734", "text": "def parse_prefixes\n prefixes_arr = @connection.support(\"PREFIX\", \"(ov)@+\")[1..-1].split(\")\")\n\n @prefixes = {}\n\n prefixes_arr[0].each_char.each_with_index do |c, i|\n @prefixes[prefixes_arr[1][i]] = c\n end\n end", "title": "" }, { "docid": "6a01e267ba4a250ef7b55010f4a77eaa", "score": "0.44023734", "text": "def parse_prefixes\n prefixes_arr = @connection.support(\"PREFIX\", \"(ov)@+\")[1..-1].split(\")\")\n\n @prefixes = {}\n\n prefixes_arr[0].each_char.each_with_index do |c, i|\n @prefixes[prefixes_arr[1][i]] = c\n end\n end", "title": "" }, { "docid": "56e725bc6ab6ce648026f7c4465f3180", "score": "0.4395974", "text": "def process(css, opts = {})\n opts = convert_options(opts)\n\n plugin_opts = params_with_browsers(opts[:from]).merge(opts)\n process_opts = {\n from: plugin_opts.delete(:from),\n to: plugin_opts.delete(:to),\n map: plugin_opts.delete(:map)\n }\n\n begin\n result = runtime.call(\"autoprefixer.process\", css, process_opts, plugin_opts)\n rescue ExecJS::ProgramError => e\n contry_error = \"BrowserslistError: \" \\\n \"Country statistics are not supported \" \\\n \"in client-side build of Browserslist\"\n if e.message == contry_error\n raise \"Country statistics is not supported in AutoprefixerRails. \" \\\n \"Use Autoprefixer with webpack or other Node.js builder.\"\n else\n raise e\n end\n end\n\n Result.new(result[\"css\"], result[\"map\"], result[\"warnings\"])\n end", "title": "" }, { "docid": "c41a6857bba89c7f4b068c054afe199f", "score": "0.4378178", "text": "def write(key, declarations, autoprefix = false)\n if declarations.present?\n value = declarations.map { |declaration|\n property, rule = declaration\n property && rule && \"#{property}: #{rule};\"\n }.compact.join ' '\n r.inline_styles[key] = if autoprefix\n AutoprefixerRails.process(value).css\n else\n value\n end\n else\n r.inline_styles.delete(key)\n end\n end", "title": "" }, { "docid": "d4f0c1572e0d304371db2f4ddbf5abd2", "score": "0.43704718", "text": "def autocomplete_prefixes\n [\"autocomplete_#{self.class.name.downcase}\"]\n end", "title": "" }, { "docid": "1ce81d038c89d8093a4be08f00729799", "score": "0.43587738", "text": "def inject_css\n insert_into_file \"app/assets/stylesheets/application.css\", :after => '*= require_tree .' do\n \"\\n *= require hydra_ezid\"\n end\n end", "title": "" }, { "docid": "9a8111d7e4043c648029f689959174f1", "score": "0.43573445", "text": "def merge_prefixed!(obj, prefix = 'ramaze_')\n opts = {}\n obj.each do |key, value|\n next unless key =~ /^#{prefix}(.*)/i\n opts[$1.downcase] = value\n end\n merge! opts\n end", "title": "" }, { "docid": "0086dff723d7b251053eb635eb7b5ccf", "score": "0.43503308", "text": "def autorun; end", "title": "" }, { "docid": "0b0f21d3438c0098b1e42f6e6c8c069b", "score": "0.4331791", "text": "def delete_prefixed(prefix); end", "title": "" }, { "docid": "f408f0e85623a9ed7f8af62fbd8239ec", "score": "0.43269572", "text": "def update_prefixes_removal\n @prefixes_removal = removed_prefixes.to_a\n .sort_by(&:length)\n .reverse\n end", "title": "" }, { "docid": "0883f310d5073b8d72d516190d0d4c85", "score": "0.4307395", "text": "def initialize\n $custom_stylesheet1 = ''\n end", "title": "" }, { "docid": "e14fcc58dcc03356d412d45b7af54572", "score": "0.43035477", "text": "def set_prefix\n if self.prefix.nil? && self.title.present?\n self.prefix = self.title.to_s.gsub(/\\W/, '').downcase\n end\n end", "title": "" }, { "docid": "5052db85b6a7df243a42a6b24e2bdbcc", "score": "0.427889", "text": "def enable_css_extraction\n return nil if options[:skip_javascript]\n\n replace_string_in_file('config/webpacker.yml', \"[\\s]?extract_css[\\:][\\s]?false[\\s]?\", ' extract_css: true') unless options[:skip_javascript]\n end", "title": "" }, { "docid": "5f58b1e8c9024ca4afab9750c19b1827", "score": "0.42751077", "text": "def preprocess\n # Load defined prefixes\n (@options[:prefixes] || {}).each_pair do |k, v|\n @uri_to_prefix[v.to_s] = k\n end\n @options[:prefixes] = {} # Will define actual used when matched\n\n prefix(:rdf, RDF.to_uri)\n @uri_to_prefix[RDF.to_uri.to_s] = :rdf\n if base_uri || @options[:lang]\n prefix(:xml, RDF::XML)\n @uri_to_prefix[RDF::XML.to_s] = :xml\n end\n\n if @options[:default_namespace]\n @uri_to_prefix[@options[:default_namespace]] = nil\n prefix(nil, @options[:default_namespace])\n end\n\n # Process each statement to establish QNames and Terms\n @graph.each {|statement| preprocess_statement(statement)}\n end", "title": "" }, { "docid": "41b5573f900b108ba932153e2341562c", "score": "0.42599943", "text": "def auto_include!\n if mixins = @@class_mixins[name]\n mixins.each do |name, aliases| \n include name.constantize\n aliases.each { |args| alias_chain *args }\n end\n end\n end", "title": "" }, { "docid": "416ae1d97b0be32771dce14e501d2f71", "score": "0.42568648", "text": "def clear_sequence_setup(rep_prefix, table_name)\n parts = table_name.split('.')\n\n if parts.length==1\n select = \"select * from syscat.colidentattributes where tabname='#{table_name}'\"\n else\n select = \"select * from syscat.colidentattributes where tabschema='#{parts[0]}' and tabname='#{parts[1]}'\"\n end\n\n select_all(select).each do |row|\n execute(\"ALTER TABLE #{table_name} ALTER COLUMN #{row['colname']} SET INCREMENT BY 1\")\n end\n end", "title": "" }, { "docid": "cff814ce008f9fc03b80a70f6e646fce", "score": "0.42565158", "text": "def autofinish; end", "title": "" }, { "docid": "2f30cbd2cb2247c682fe90d875114b2d", "score": "0.42421407", "text": "def countly_post_install(installer)\n installer.pods_project.targets.each do |target|\n if target.name == \"Countly\"\n target.build_configurations.each do |config|\n config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)', 'COUNTLY_EXCLUDE_IDFA=1']\n end\n end\n end\nend", "title": "" }, { "docid": "43687a479fc045a94900d90217837b0e", "score": "0.42368346", "text": "def use_legacy_autoloader=(_arg0); end", "title": "" }, { "docid": "19f1222e41e3d3f379c45a0c6c4d39ec", "score": "0.42229086", "text": "def merge_directives(target, dirs); end", "title": "" }, { "docid": "f8dc362014983ab9902dba8e7aaa00a7", "score": "0.42209458", "text": "def prepend!(prefix); end", "title": "" }, { "docid": "e2934d3891f7e8b16abf65df3b2111b2", "score": "0.42183158", "text": "def _perform(environment)\n return DirectiveNode.new(\"@import url(#{full_filename})\") if full_filename =~ /\\.css$/\n super\n end", "title": "" }, { "docid": "725ae119a6d65c70381c7478ab0b76f4", "score": "0.42123118", "text": "def autoloads; end", "title": "" }, { "docid": "23e6019ae01fcbe937798e5c4292f27b", "score": "0.4211355", "text": "def preprocess(document)\n $footnoteDefs = {} \n $footnoteDiv = \"\" \n $abbrList = [] \n $defList = [] \n add_def(add_abbr(get_includes (document)))\n end", "title": "" }, { "docid": "93580b655fe67d59bf854148e135bef3", "score": "0.4201928", "text": "def drop_prefix(name, prefix, separator)\n string = name.to_s\n affix = \"#{prefix}#{separator}\"\n first = string.start_with?(affix) ? affix.length : 0\n\n string[first..-1]\n end", "title": "" }, { "docid": "f24e58bcd998f2ac3bc05fb2316bdb66", "score": "0.41983402", "text": "def find_section_id_attributes(lines, result)\n Giblish.process_header_lines(lines) do |line|\n m = /^:idprefix:(.*)$/.match(line)\n n = /^:idseparator:(.*)$/.match(line)\n result[:id_prefix] = m[1].strip if m && !result[:id_prefix]\n result[:id_separator] = n[1].strip if n && !result[:id_separator]\n end\n result\n end", "title": "" }, { "docid": "310dff47d19912bcd664c4b9408e024c", "score": "0.41976073", "text": "def update_pod_xcconfig_for_mangling!(pod_xcconfig_path)\n mangle_xcconfig_include = \"#include \\\"#{@context.xcconfig_path}\\\"\\n\"\n\n gcc_preprocessor_defs = File.readlines(pod_xcconfig_path).select { |line| line =~ /GCC_PREPROCESSOR_DEFINITIONS/ }.first\n gcc_preprocessor_defs.strip!\n\n xcconfig_contents = File.read(pod_xcconfig_path)\n # import the mangling config\n new_xcconfig_contents = mangle_xcconfig_include + xcconfig_contents\n # update GCC_PREPROCESSOR_DEFINITIONS to include mangling\n new_xcconfig_contents.sub!(gcc_preprocessor_defs, gcc_preprocessor_defs + \" $(#{MANGLING_DEFINES_XCCONFIG_KEY})\")\n File.open(pod_xcconfig_path, 'w') { |pod_xcconfig| pod_xcconfig.write(new_xcconfig_contents) }\n end", "title": "" }, { "docid": "ec487f192521d3473a8766ccfa1e1047", "score": "0.41853383", "text": "def add_id_prefix(attr_name, &block)\n @id_prefix_extractor =\n case attr_name\n when Symbol\n DataExtractor::AttributeExtractor.new(attr_name)\n when String\n DataExtractor::Constant.new(attr_name)\n when nil\n DataExtractor::BlockExtractor.new(&block) if block_given?\n else\n raise ArgumentError,\n \"The ID prefix has to be either a Symbol, a String or a Proc\"\n end\n end", "title": "" }, { "docid": "5fa038cacfab9323c3cbfd5a75ee1c68", "score": "0.4179654", "text": "def deprefix(str); end", "title": "" }, { "docid": "fd073c6d8d0a6f8cc0eb68383056dbff", "score": "0.41751358", "text": "def get_prefixed_styles prefix\n\n _styles = {}\n\n @styles.each_pair do |key, val|\n key = \"#{prefix}#{key}\".to_sym if Inkcite::Renderer::Style.needs_prefixing?(key)\n _styles[key] = val\n end\n\n _styles\n end", "title": "" }, { "docid": "82cbcc9d60a7c0f787df16e8bdd54593", "score": "0.41625118", "text": "def strip_table_name_affixes(table_name)\n regexp = /\\A#{Regexp.quote(Base.table_name_prefix || \"\")}(.*)#{Regexp.quote(Base.table_name_suffix || \"\")}\\Z/m\n return nil unless table_name =~ regexp\n $1\n end", "title": "" }, { "docid": "1c4818ef58a9f1d4110df8006029c6fc", "score": "0.4142773", "text": "def preprocess\n # Load defined prefixes\n (@options[:prefixes] || {}).each_pair do |k, v|\n @uri_to_prefix[v.to_s] = k\n end\n\n prefix(nil, @options[:default_namespace]) if @options[:default_namespace]\n\n case\n when @options[:stream]\n else\n @options[:prefixes] = {} # Will define actual used when matched\n\n @graph.each {|statement| preprocess_statement(statement)}\n end\n end", "title": "" }, { "docid": "2ae4aed73f83db6fdc7ef0254d818586", "score": "0.4131976", "text": "def separate_prefixes=(flag)\n set('separate_prefixes', flag, true)\n end", "title": "" }, { "docid": "2e4e70e716f12a66d8f85ab49c31f5d1", "score": "0.41317293", "text": "def add_prefix_result(prefixes, autnum, protocol)\n result = root.result\n\n result[protocol] ||= {}\n result[protocol][autnum] ||= []\n result[protocol][autnum].push *Array(prefixes)\n end", "title": "" }, { "docid": "2a8ed42018a81cc1cbd7218e87f1ca69", "score": "0.41300115", "text": "def to_inline_css\n doc = @doc\n unmergable_rules = CssParser::Parser.new\n \n # Give all styles already in style attributes a specificity of 1000 \n # per http://www.w3.org/TR/CSS21/cascade.html#specificity\n doc.search(\"*[@style]\").each do |el| \n el['style'] = '[SPEC=1000[' + el.attributes['style'] + ']]'\n end\n\n # Iterate through the rules and merge them into the HTML\n @css_parser.each_selector(:all) do |selector, declaration, specificity|\n # TOM ADDED: absolutize the urls inside declarations\n declaration.sub!(URL_RE) do \n \"url('#{self.class.resolve_link($1, @options[:base_url])}')\"\n end\n \n # Save un-mergable rules separately\n selector.gsub!(/:link([\\s]|$)+/i, '')\n\n # Convert element names to lower case\n selector.gsub!(/([\\s]|^)([\\w]+)/) {|m| $1.to_s + $2.to_s.downcase }\n\n if selector =~ RE_UNMERGABLE_SELECTORS\n unmergable_rules.add_rule_set!(RuleSet.new(selector, declaration))\n else\n \n doc.search(selector) do |el|\n if el.elem?\n # Add a style attribute or append to the existing one \n block = \"[SPEC=#{specificity}[#{declaration}]]\"\n el['style'] = (el.attributes['style'] ||= '') + ' ' + block\n end\n end\n end\n end\n\n # Read <style> attributes and perform folding\n doc.search(\"*[@style]\").each do |el|\n style = el.attributes['style'].to_s\n \n declarations = []\n\n style.scan(/\\[SPEC\\=([\\d]+)\\[(.[^\\]\\]]*)\\]\\]/).each do |declaration|\n rs = RuleSet.new(nil, declaration[1].to_s, declaration[0].to_i)\n declarations << rs\n end\n\n # Perform style folding and save\n merged = CssParser.merge(declarations)\n\n el['style'] = Premailer.escape_string(merged.declarations_to_s)\n end\n\n doc = write_unmergable_css_rules(doc, unmergable_rules)\n \n #doc = add_body_imposter(doc)\n \n doc.to_html\n end", "title": "" }, { "docid": "87a1dfd86781bd189050ebca4455ae0d", "score": "0.41144118", "text": "def separate_prefixes=(flag)\n set(\"separate_prefixes\", flag, true)\n end", "title": "" }, { "docid": "32ff06c105ab53137e145e07e6946bb2", "score": "0.4104269", "text": "def user_prefix_modes\n isupport[\"PREFIX\"].keys\n end", "title": "" }, { "docid": "ee356b3ccb338363c4ba8b3791cce6ee", "score": "0.40990993", "text": "def prefix_source; end", "title": "" }, { "docid": "297f71a4601866e39fa284b1c2d4cb8c", "score": "0.4098771", "text": "def set_prefix(prefix)\n self.elements.each do |element|\n if element.respond_to?(:elements) && element.name\n element.set_prefix(\"#{prefix}[#{element.name}]\")\n end\n if element.attributes[:name]\n element.attributes[:name] = begin\n \"#{prefix}[#{element.attributes[:name]}]\"\n end\n end\n end\n end", "title": "" }, { "docid": "706681007fadb488015609934d3b3281", "score": "0.40955785", "text": "def user_prefixes\n isupport[\"PREFIX\"].values\n end", "title": "" }, { "docid": "fa04e0aafa7866116c88bc875aa82319", "score": "0.40939596", "text": "def prefix=(prefix) @prefix = prefix end", "title": "" }, { "docid": "728a346b2746adf31c441ccc84d6d547", "score": "0.40920216", "text": "def update_prefix_suggestion!\n\n suggested_prefix ||= serial\n suggestion = \"\"\n serial.split(//).each_with_index do |a, i|\t\t \n break if !suggested_prefix[i] || a != suggested_prefix[i]\n suggestion << a\n end\n self.suggested_prefix = suggestion\n self.save\n\n end", "title": "" }, { "docid": "ef57adb66fb7cb867b3660e64eab7bdc", "score": "0.4090145", "text": "def user_prefixes\n isupport['PREFIX'].values\n end", "title": "" }, { "docid": "63c0e97d05077afcf236fa55246376d9", "score": "0.40866503", "text": "def set_prefix\n prefix_array = Artist.split_name_prefix(name)\n \n #if we had a match, split the artist into prefix plus name\n if !prefix_array[0].blank?\n write_attribute(:prefix, prefix_array[0])\n write_attribute(:name, prefix_array[1])\n end\n end", "title": "" }, { "docid": "865d58d2ff4e909bbd7b544ee2ded162", "score": "0.40850094", "text": "def user_prefix_modes\n isupport['PREFIX'].keys\n end", "title": "" }, { "docid": "360ac64cbff30b61558cb185a69dc28a", "score": "0.40835893", "text": "def apply_prefix(name)\n name\n end", "title": "" }, { "docid": "149499ed65b9285b15c3f05f01a56761", "score": "0.40786338", "text": "def pre_format_css\n\n\t\tcss = @raw_css\n\n\t\t#Removes comments\n\t\tcss.gsub!(/\\/\\*[^\\*]*\\*+([^\\/\\*][^\\*]*\\*+)*\\//m, \"\")\n\t\tcss.gsub!(/\\n|\\t/, \"\")\n\n\t\t#Splits at each }\n\t\tcss = css.scan(/[^}]*}/)\n\n\t\t\t# check for media query formating \n\t\t\t# adds } to the previous line\n\t\tfor i in 0..css.length \n\t\t\tif css[i] == \"}\"\n\t\t\t\tcss.delete_at(i)\n\t\t\t\tcss[i-1] << \"}\"\n\t\t\tend\n\t\tend\n\n\t\t#multiple formatting conditions handled here\n\t\tcss.each_with_index{ |c,i|\n\n\t\t\t#check for single at-rule formatting\n\t\t\tif get_rule_type(c) == \"single\"\n\t\t\t\tcss.delete_at(i)\n\t\t\t\tc = c.split(\";\")\n\t\t\t\tc.each_with_index{|n, k| \n\t\t\t\t\tif (get_rule_type(n) == \"single\")\n\t\t\t\t\t\tn << \";\"\n\t\t\t\t\tend\n\t\t\t\t\tcss.insert(i+k,n)\n\t\t\t\t}\n\t\t\tend\n\t\t\t#checks for missing final ;\n\t\t\t# elsif get_rule_type(c) == \"selector\"\n\t\t\t#kind of brute forces it, could be done better\n\t\t\tif c[-2..-1] == \"}}\"\n\t\t\t\tif c[-3] != \";\"\n\t\t\t\t\tc.insert(-3, \";\")\n\t\t\t\tend\n\t\t\telsif c[-1] == \"}\"\n\t\t\t\tif c[-2] != \";\"\n\t\t\t\t\tc.insert(-2, \";\")\n\t\t\t\tend\n\t\t\tend\n\n\t\t}\n\t\t@formatted_css = css\n\t\treturn @formatted_css\n\tend", "title": "" }, { "docid": "36930250c074aaf46edb9e8ee2440b54", "score": "0.40739405", "text": "def parse_selectors!(selectors) # :nodoc:\n @selectors = selectors.split(',').map { |s| s.strip }\n end", "title": "" }, { "docid": "51204d026abe7810ac0df379cefff589", "score": "0.4072869", "text": "def use_legacy_autoloader; end", "title": "" }, { "docid": "7b31d872ce79de70b59e0aa4c595968f", "score": "0.40724", "text": "def alias_processing\n self.alias = Russian.translit(self.alias.strip.gsub(' ', '_').gsub(/[\\W\\d]/, '')).downcase\n end", "title": "" }, { "docid": "16dddc4d16423e0bf6b8ae4fd4860368", "score": "0.40615854", "text": "def _prefixes\n if admin_set?\n @_prefixes ||= super + ['hyrax/admin/admin_sets']\n elsif collection?\n @_prefixes ||= super + ['hyrax/dashboard/collections']\n end\n end", "title": "" }, { "docid": "5131b3a9a4ab65d721ae1cb4b3960953", "score": "0.40518042", "text": "def caseadilla_config_stylesheet_includes\n %w[caseadilla/caseadilla caseadilla/custom]\n end", "title": "" }, { "docid": "220bf9a2c5e7c5fd4e2a7b9528d1bfe7", "score": "0.4051279", "text": "def autofinish=(_arg0); end", "title": "" }, { "docid": "4a7d00f6f75060706357a53e91e63559", "score": "0.40437457", "text": "def autoconf\n autoconf = \"#{@resource[:homebrew_path]}/bin/autoconf\"\n\n # We need an old version of autoconf for PHP 5.3...\n autoconf << \"213\" if @resource[:php_version].match(/5\\.3\\../)\n\n autoconf\n end", "title": "" }, { "docid": "4a7d00f6f75060706357a53e91e63559", "score": "0.40437457", "text": "def autoconf\n autoconf = \"#{@resource[:homebrew_path]}/bin/autoconf\"\n\n # We need an old version of autoconf for PHP 5.3...\n autoconf << \"213\" if @resource[:php_version].match(/5\\.3\\../)\n\n autoconf\n end", "title": "" }, { "docid": "4ac8150f4fe4e803c6e6edd1954d2bc5", "score": "0.40374136", "text": "def create_rdoc_preprocess\n raise(NotImplementedError, \"This method must be overwritten for whichever version of RDoc this parser is working with\")\n end", "title": "" }, { "docid": "f3bf99d5719c032a894008899f11be70", "score": "0.40228975", "text": "def merge_partial_styles(partials)\n styles = self.xml.root.elements['office:automatic-styles']\n if styles\n partials.each do |partial|\n partial.styles.each_element do |e|\n styles << e\n end\n end\n end\n end", "title": "" }, { "docid": "5a30636af065cfb453c911b593f2aeae", "score": "0.4013616", "text": "def quotePrefix; end", "title": "" }, { "docid": "6c267c443cd760a5d27c2ae1703ee0a4", "score": "0.4013582", "text": "def prefixes\n ns = []\n each_attribute do |attribute|\n ns << attribute.name if attribute.prefix == 'xmlns'\n end\n if @element.document and @element.document.doctype\n expn = @element.expanded_name\n expn = @element.document.doctype.name if expn.size == 0\n @element.document.doctype.attributes_of(expn).each {\n |attribute|\n ns << attribute.name if attribute.prefix == 'xmlns'\n }\n end\n ns\n end", "title": "" }, { "docid": "6c267c443cd760a5d27c2ae1703ee0a4", "score": "0.4013582", "text": "def prefixes\n ns = []\n each_attribute do |attribute|\n ns << attribute.name if attribute.prefix == 'xmlns'\n end\n if @element.document and @element.document.doctype\n expn = @element.expanded_name\n expn = @element.document.doctype.name if expn.size == 0\n @element.document.doctype.attributes_of(expn).each {\n |attribute|\n ns << attribute.name if attribute.prefix == 'xmlns'\n }\n end\n ns\n end", "title": "" }, { "docid": "08bf6204605614273280d5a3fccd2aa9", "score": "0.401075", "text": "def prefix(value)\n merge(aiprefix: value.to_s)\n end", "title": "" }, { "docid": "695cd058c092d6771dcbf2c36ff3f8d7", "score": "0.40047055", "text": "def printAutoStyles()\n printStyles(@auto_styles,\" \")\n end", "title": "" }, { "docid": "027bae5e6f780b2f70d19de8bbac8697", "score": "0.4003894", "text": "def ip4_auto!\n self.ip4 = {IPV4_METHOD => IPV4_METHOD_AUTO}\n end", "title": "" }, { "docid": "4648ad6d2cfb42b557c8b80ddc0319ce", "score": "0.4003712", "text": "def prescan(strip_dsl)\n @strip_dsl = strip_dsl\n @parse_mode=\"prescan\"\n parse(@param_default_values)\n @parse_mode=\"parse\"\n @strip_dsl=false\n end", "title": "" }, { "docid": "111840c55c9b883f905c61fe088d46d2", "score": "0.3996585", "text": "def prefix(prefix)\n new(map { |attr| attr.prefixed(prefix) })\n end", "title": "" } ]
adee5ef44f126436072ec5b3ab0051d5
params to create group, append current logined user id as creator and append self group tag to false
[ { "docid": "5075f9909127f17327b390c43e40d44a", "score": "0.6650494", "text": "def group_params\n params.require(:group).permit(:name, :description).merge(creator: current_user.id, self: false)\n end", "title": "" } ]
[ { "docid": "7e57142322cee2f05597e685f532dae7", "score": "0.7118808", "text": "def create\n\n @user = User.new(user_params)\n if @user.save\n # adding a self group\n name = 'Me (' + params[:user][:username] + ')'\n @user.groups.create(name: name, description: 'Assign task/bills to the Me group, if those task/bills are for yourself', \n creator: @user.id, self: true)\n token = view_context.sign_in @user\n render :json => {:token => token}, :status => 200\n else\n render :json => @user.errors.full_messages, :status => 400\n end\n end", "title": "" }, { "docid": "55300897e56d2b9be70f5dffc13d3fde", "score": "0.7046726", "text": "def group_create(params = {})\n authorizable_id = search_hash!(params, :authorizable_id, :authorizableId, :authoriziableid, :id, :group_id)\n given_name = search_hash!(params, :given_name, :givenName, :givenname, :name, :group_name)\n about_me = search_hash!(params, :about_me, :description)\n\n data = { 'createGroup' => 1 }\n data['authorizableId'] = authorizable_id\n data['./profile/givenName'] = given_name\n data['./profile/aboutMe'] = about_me\n\n http_post_form('libs/granite/security/post/authorizables.html', data)\n return true if response.code == '201'\n false\n end", "title": "" }, { "docid": "a7734570143df54ed4e3e76d6f6ab70d", "score": "0.694817", "text": "def create\n\n @user = User.new(user_params)\n if @user.save\n # adding a self group\n @user.groups.create(name: 'Me', description: 'Assign task/bills to the Me group, if those task/bills are for yourself', \n creator: @user.id, self: true)\n\n token = view_context.sign_in @user\n render :json => {:token => token}, :status => 200\n else\n render :json => {:errors => @user.errors.full_messages}, :status => 400\n end\n end", "title": "" }, { "docid": "20e3b163ee7ac73b165ece89ad4b13c4", "score": "0.6812704", "text": "def create\n Group.transaction do\n if self.group.save\n self.add_creator_as_group_admin\n self.add_creator_in_users_unit\n end\n end\n end", "title": "" }, { "docid": "fe9b35d3e81d3e7c9a802da2423b0eee", "score": "0.6772007", "text": "def create(group, container)\n # If the caller has already set an id, trust it.\n group.assign_id!(new_uuid) unless group.id\n group.assign_org_id!(@org_id)\n group.update_timestamps!\n group.last_updated_by!(requester_authz_id)\n\n validate_before_create!(group)\n\n unless group.authz_id\n group.create_authz_object_as(requester_authz_id)\n if container\n container_authz_doc = container.authz_object_as(container.requester_id)\n group.authz_object_as(requester_authz_id).apply_parent_acl(container_authz_doc)\n end\n end\n\n user_side_create(group)\n\n group.persisted!\n group\n end", "title": "" }, { "docid": "92a62db9947ae39e2d5d132d822471e0", "score": "0.67285746", "text": "def create\n ::Domain::Person::Group::Command::CreateCommand.call(\n name: person_group_params[:name],\n accessible_user_id_param: current_access_user_id_param,\n parent_group_id_param: person_group_params[:parent_group_id_param]\n )\n\n redirect_to debug_person_groups_path, notice: 'Group was successfully created.'\n end", "title": "" }, { "docid": "33849e5401b4a8c2d4da976c03fe7af4", "score": "0.670901", "text": "def create_user\n group r.group do\n action :create\n end\n user r.user do\n supports manage_home: true\n home \"/home/#{r.user}\"\n gid r.group\n action :create\n end\n end", "title": "" }, { "docid": "9e59c5343a9f98acd7f36eca948192c7", "score": "0.67085505", "text": "def create\n @group = Group.new(group_params)\n @group.id_created = current_user.id if current_user\n respond_to do |format|\n if @group.save\n @group.users << current_user\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "62cff4bda896efcab0efb1cbd6b14b9a", "score": "0.6624151", "text": "def create\n @group = Group.new(params[:group])\n @current_user = current_user\n if @group.save\n @groupuser = GroupUser.new(:group_id => @group.id, :user_id => @current_user.id )\n @groupuser.isCreator = 'true'\n @groupuser.save\n flash[:notice] = \"تم انشاء المجتمع بنجاح\"\n redirect_to :action => 'show', :id => @group.id\n else\n render ('new')\n end\n end", "title": "" }, { "docid": "bd24bd08ff39a054de300d74c143573f", "score": "0.6623839", "text": "def create_allowed_user_group\n group new_resource.allowed_user_group do\n action :create\n append true\n members new_resource.allowed_users\n end\n end", "title": "" }, { "docid": "3669fe250b73446c8f3e3b9aed016c63", "score": "0.66130346", "text": "def create_personal_group\n pgroup = Group.create(:name => self.email, :personal => true)\n pgroup.users << self\n end", "title": "" }, { "docid": "234188ab25cb4ebc99e80d50e6608739", "score": "0.66042745", "text": "def create_membership_for_creator_or_group!\n membership = Membership.new(\n basic_resource_producer_id: producer.id,\n role: Membership::ROLES[:admin]\n )\n if group\n membership.group = group\n else\n membership.user = creator\n end\n membership.save!\n\n side_effects << membership\n end", "title": "" }, { "docid": "b8c3910690a45090e5d4bfbf4e9e6521", "score": "0.6559878", "text": "def create\n user = User.find(session[:user_id])\n\n # If the user has already in some group, then redirects to his admin page with warning.\n # Otherwise, the group is created and the user is set to be the manager of the group.\n if user.group\n redirect_to admin_url, :notice => \"You are already in group #{user.group.name}\"\n return\n end\n\n # Makes the group creator the default manager of the group.\n @group = Group.new(params[:group])\n user.group = @group\n user.role = 'MANAGER'\n user.save\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e8f7c73a96069d134f9eab90a5091b92", "score": "0.65396535", "text": "def create\n logger.info('call the create ation')\n\n @group = Group.new(params[:group])\n @group.creator_id=current_user.user_id\n\n get_groups\n respond_to do |format|\n if @group.save\n format.html { redirect_to group_follows_url(@group.id) }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"index\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d38ec223fce6011edee1c33ea08cf327", "score": "0.6536798", "text": "def create\n @group = current_user.mygroups.new(group_params)\n\n respond_to do |format|\n if @group.save\n current_user.groups << @group\n\n # Added as part of activity feed\n @group.create_activity :create, owner: current_user\n \n format.html { redirect_to group_path(@group), notice: 'Group was successfully created.' }\n format.json { render action: 'show', status: :created, location: group_path(@group) }\n else\n format.html { render action: 'new' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "34aa235762d77b9f42a10eab867f5a9e", "score": "0.6502184", "text": "def create_full_group(creator, groupname, title = '', description = '')\n @sling.switch_user(creator)\n\n group = Group.new(groupname)\n\n params = {\"data\" => JSON.generate({\n \"id\" => groupname,\n \"title\" => title,\n \"description\" => description,\n \"joinability\" => \"yes\",\n \"visibility\" => \"public\",\n \"tags\" => [\"test-tag1\", \"test-tag2\"],\n \"worldTemplate\" => \"/var/templates/worlds/group/simple-group\",\n \"_charset_\" => \"utf-8\",\n \"usersToAdd\" => [{\n \"userid\" => creator.name,\n \"name\" => creator.name,\n \"firstname\" => creator.firstName,\n \"role\" => \"manager\",\n \"roleString\" => \"Manager\",\n \"creator\" => \"true\"\n }]\n })}\n\n result = @sling.execute_post(@sling.url_for($GROUP_WORLD_URI), params)\n @sling.switch_user(User.admin_user)\n if (result.code.to_i > 299)\n @log.error result.body\n return nil\n end\n\n # return the group that was created in create_target_group\n return group\n end", "title": "" }, { "docid": "12be72f0c66e0d5dde93866fc55d4eb2", "score": "0.6498047", "text": "def create_new_group(group_info)\n description = {\n :owner => group_info[:owner],\n :desc => group_info[:desc]\n }\n json = {\n :method => \"group_add\",\n :params => [ [], {\n :cn => group_info[:group_name],\n :description => description.to_s\n } ]\n }\n\n begin\n resp = _ipa_json_rpc json\n rescue\n return false \n end\n\n Rails.logger.debug \"create_new_group() => \" + resp.to_s + \" ==> \" + resp['result']['completed'].to_s\n if resp['result']['completed'] != 0\n # Add owner\n add_user group_info[:owner], group_info[:group_name]\n true\n else\n false\n end\n end", "title": "" }, { "docid": "fa4a57ac2469146998fd682f2f851ed6", "score": "0.647647", "text": "def create\n @group = Group.new(params[:group])\n @group.owner = current_user\n\n respond_to do |format|\n if @group.save\n # We make the owner part of the group\n GroupsUser.create(:user => current_user, :group => @group)\n \n format.html { redirect_to(invite_group_path(@group)) }\n format.xml { render :xml => @group, :status => :created, :location => @group }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "800218306402deb5ec5d4d700dd3e356", "score": "0.6451456", "text": "def make_owner\n # Make membership to own group setting user as owner\n self.memberships.create(:role => \"owner\", :user_id => self.user_id, :state => \"approved\")\n end", "title": "" }, { "docid": "d83d6a0e0319ff0353be90d02372895d", "score": "0.64494956", "text": "def create\n @group = Group.new(params[:group])\n @group.owner = current_user\n\n respond_to do |format|\n if @group.save\n # We make the owner part of the group\n GroupsUser.create(:user => current_user, :group => @group)\n \n format.html { redirect_to(invite_group_path(@group), :notice => 'Group was successfully created.') }\n format.xml { render :xml => @group, :status => :created, :location => @group }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "25dfae194bf064f2e37113d720b09191", "score": "0.64488757", "text": "def create\n if(user_type == 4)\n @group = Group.new(group_params)\n else\n @group = Core.find(current_user).groups.build(core_group_params)\n end\n respond_to do |format|\n if @group.save\n SystemLog.create(description: \"Criou um novo grupo chamado #{@group.name} para o núcleo #{@group.core.name}\", author: name_and_type_of_logged_user)\n format.html { redirect_to @group, notice: 'Grupo criado com sucesso.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "88481c75ecd8b817f55c39cfd1fd11de", "score": "0.64390355", "text": "def create_groupchat(me)\n group = me.group_chats.where(name: params[\"group_name\"]).take\n if group\n flash[:notice] = \"Unable to create group. #{params[\"group_name\"]} already exists.\"\n else\n group = GroupChat.create(name: params[\"group_name\"])\n group.users << me\n params[\"members\"].each do |member|\n new_member = User.find(member)\n group.users << new_member\n end #do\n end #if/else\n end", "title": "" }, { "docid": "5ca77d6bde13d44c93560da380c421b7", "score": "0.64325434", "text": "def create\n\n # on crée le work_group avec les parametres du form\n @group_work_group = Group::WorkGroup.new(group_work_group_params)\n @group_work_group.user = current_user\n\n respond_to do |format|\n if @group_work_group.save && create_activity(:create, trackable: @group_work_group, owner: current_user)\n\n # On ajoute le créateur en tant que ADMIN\n @group_work_group.add_members(current_user, role: Group::Roles::ADMIN)\n\n format.html { redirect_to @group_work_group, notice: t('group.work_groups.new.forms.success') }\n format.json { render json: @group_work_group, status: :created, location: @group_work_group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group_work_group.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b56a29272e0c18328539924f8cdff44f", "score": "0.64299494", "text": "def create\n @group = Group.new(params[:group])\n @group.owner = @current_user.id\n\n respond_to do |format|\n if @group.save\n flash[:class] = \"alert alert-success\"\n @group.users << @current_user\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n# format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n# format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5d8cb8ea843deb36874a40b92cdf401d", "score": "0.6429463", "text": "def creator?(group)\r\n id == group.creator_id\r\n end", "title": "" }, { "docid": "aeed7aa9f40dbbbe4a03f775e7dd183e", "score": "0.64254797", "text": "def create\n # byebug\n #group doesn't exist, for the future it \n #would be cool to check if group exists\n new_group_id = UserGroup.last.group_id + 1\n # byebug\n user_group_params[0].each do |user|\n new_group = UserGroup.new(user_id: user, group_id: new_group_id)\n if !new_group.save\n return render json: {status: \"error\", new_group_creation: \"failure\"}\n end\n end\n return render json: {status: \"success\"}\n end", "title": "" }, { "docid": "f33f36f7a88e25e843b40d98b8b66192", "score": "0.64061207", "text": "def create\n group = current_user.groups.build(group_params)\n if group.save\n # link membership association between new group and creator\n group.users << current_user\n\n # for each members in paramter, add to group\n merror = \"\"\n if(params.has_key?(:add))\n members = params[:add][:members]\n members.each do |id|\n if(User.exists?(id) && id != current_user.id.to_s)\n\t group.users << User.find(id)\n puts \"id \" + id + \"exists!\"\n else\n\t merror << \" \" + id << \" \"\n end\n end\n end\n\n # if one of the user is not found shows who (merror) and status 206 otherwise 200\n if (merror.empty?)\n render :json => group.to_json(:include => [:users => {:except => [:created_at, :updated_at, \n\t\t\t:password_digest, :remember_token]}]), :status => 200\n else\n render :json => group.to_json(:include => [:users => {:except => [:created_at, :updated_at, \n\t\t\t:password_digest, :remember_token]}], :memberError => merror), :status => 206\n end\n else\n render :json => {:errors => group.errors.full_messages}, :status => 400\n end\n end", "title": "" }, { "docid": "b3887caaa3b057a4d35246a42a47ce0a", "score": "0.6379229", "text": "def create_group\n params[:new_members] = params[:participants]\n params[:new_admins] = params[:admin_ids]\n conversation = current_user.conversations.new(group_params)\n if conversation.save\n render_conversation(conversation)\n else\n render_error_model(conversation)\n end\n end", "title": "" }, { "docid": "1b02d4a3790b47c965940d597958e59b", "score": "0.63707274", "text": "def create\n @group = Group.new\n @group.safe_update(%w[name legend description default_tags subdomain logo forum\n custom_favicon language theme custom_css wysiwyg_editor], params[:group])\n\n @group.safe_update(%w[isolate domain private], params[:group]) if current_user.admin?\n\n @group.owner = current_user\n @group.state = \"active\"\n\n @group.widgets << TagCloudWidget.new\n @group.widgets << TopUsersWidget.new\n @group.widgets << BadgesWidget.new\n\n respond_to do |format|\n if @group.save\n @group.add_member(current_user, \"owner\")\n flash[:notice] = I18n.t(\"groups.create.flash_notice\")\n format.html { redirect_to(domain_url(:custom => @group.domain, :controller => \"admin/manage\", :action => \"properties\")) }\n format.json { render :json => @group.to_json, :status => :created, :location => @group }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @group.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6ee739c9cff435162948322184e3b33d", "score": "0.6347", "text": "def create\n @group = Group.new(params[:group])\n @group.owner = current_user\n\n respond_to do |format|\n if @group.save\n @group.users << @group.owner\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "39d72594f266e9cc0d18cf6ddffb1bb0", "score": "0.6343738", "text": "def create\n @group = Group.new(group_params)\n if @group.save\n if !params[:selected_leaders].blank?\n @users = User.find(params[:selected_leaders].split(\",\"))\n if !@users.include?(current_user)\n @group.add_user(current_user, make_leader = true)\n end\n @users.each do |user|\n @group.add_user(user, make_leader = true)\n end\n else # remember to always add current user as leader\n @group.add_user(current_user, make_leader = true)\n end\n redirect_to @group, notice: \"Group was successfully created.\"\n else\n @neighborhoods = Group.neighborhoods.keys\n redirect_to action: \"new\", group_param: group_params\n end\n end", "title": "" }, { "docid": "407da481a17e872eb1be16cc3a7d0560", "score": "0.63389254", "text": "def create\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n # Save creator (the user who created the group) as admin\n @group.memberships.create([ \n { profile_id: current_user.id, accepted_on: Time.current, g_admin: true }\n ])\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "82c183bb2f9ca9b7531cbb20d706a65b", "score": "0.63222486", "text": "def create\n @group = Group.new(params[:group])\n # set current user to group leader (necessary if manipulated)\n @group.leader = current_user\n\n respond_to do |format|\n if @group.save && GroupsUser.create(group_id: @group.id, user_id: current_user.id, status: 1)\n format.html { redirect_to root_path, notice: 'Group successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "91e838d26f355d4715c655485eeb8377", "score": "0.63057446", "text": "def create\n\t\t\n\t\t@group = Group.new(group_params)\n\t\t\n\t\t@group.users << current_user\n\t\t@group.leaders = [current_user.id.to_s]\n\t\t#The created group email should be \"group-name + group-id\", this will prevent people making groups of the same name\n\t\t# with matching emails. Also this makes it so we don't have to return a \"this group already exists\" error, which would\n\t\t# allow people to infer the name of groups on the system\n\t\t#We must save first to get an id generated however\n\t\tputs \"DEBUG===============\"\n\t\tgname = @group.group_name.gsub(/\\s/, \"\")\n\t\tputs gname\n\t\tputs \"====================\"\n\t\tif gname =~ /^[a-zA-Z0-9]+$/\n\t\t\t@group.save\n\t\t\t\n\t\t\t@group.email = gname + \"+\" + @group.id + $Domain\n\t\t\tputs \"DEBUG======2========\"\n\t\t\tputs @group.email\n\t\t\tputs \"====================\"\n\t\t\t# Passphrase for pgp keys is bull-s*** right now, may change later\n\t\t\tKeyGenerator::generatePGPkeyGPGme(@group.group_name, @group.email, \"asldkfjlksdjf\")\n\n\t\t\tcurrent_user.save\n\n\t\t\t\n\t\t\trespond_to do |format|\n\t\t\t\tif @group.save\n\t\t\t\t\tformat.html { redirect_to @group, notice: 'Group was successfully created.' }\n\t\t\t\t\tformat.json { render :show, status: :created, location: @group }\n\t\t\t\telse\n\t\t\t\t\tformat.html { render :new }\n\t\t\t\t\tformat.json { render json: @group.errors, status: :unprocessable_entity }\n\t\t\t\tend\n\t\t\tend\n\t\telse\n\t\t\trespond_to do |format|\n\t\t\t\tformat.html { redirect_to root_url, notice: 'Group was NOT created. Group name must be alpha-numeric characters.'}\n\t\t\tend\n\t\tend\n\n\tend", "title": "" }, { "docid": "61ad4abb07ff5b4b4062cebb79012d0e", "score": "0.63051826", "text": "def create\n #@current_user = session[:user]\n @group = Group.new(params[:group])\n respond_to do |format|\n if @group.save\n @group.add_editor @current_user\n gh = GroupPermissionsHistory.new(:user_id => @current_user.id, :group_id => @group.id, :editor_id => @current_user.id, :role => 2, :action => 1)\n gh.save\n flash[:notice] = t(\"controller.notices.group_created\")\n format.html { redirect_to edit_group_path(@group) }\n format.xml { render :xml => @group, :status => :created, :location => @group }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f05ca61971de58c5128546305a6e393f", "score": "0.62992847", "text": "def create\n @usergroup = Usergroup.new(usergroup_params)\n @usergroup.owner_id = @current_owner.id\n\n respond_to do |format|\n if @usergroup.save\n format.html { redirect_to @usergroup, notice: 'Группа успешно создана.' }\n format.json { render :show, status: :created, location: @usergroup }\n else\n format.html { render :new }\n format.json { render json: @usergroup.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d7c8186aa9b6408d11e6fca39ce69bde", "score": "0.62951434", "text": "def create_group(**data)\n return if data[:name].nil? # Breaks things in SSO!\n\n create_object(type: 'Group', data: data)\n end", "title": "" }, { "docid": "38eacf7eba9c83feaaab5eea67cdca4e", "score": "0.6285821", "text": "def create\n group = params.require(:group).permit(:name, :lat, :lng)\n new_group = Group.create(group)\n GroupUser.create(group_id: new_group.id, user_id: @current_user.id, is_owner: true)\n flash[:success] = \"You're Group has been created!\"\n redirect_to root_path\n end", "title": "" }, { "docid": "4b01718b7dd4849230d7ff91914c08ef", "score": "0.6278996", "text": "def create_mod\n if params[:groupName] != nil && params[:password] != nil && params[:subId] != nil && params[:userId] != nil\n @group.groupName = params[:groupName]\n @group.password = params[:password]\n @group.subId = params[:subId].to_i\n @group.userId = params[:userId].to_i\n\n group_json = @group.to_h.to_json\n\n url = @httpIp+'/pet.com/api/group/createGroup'\n uri = URI(url)\n res = Net::HTTP.post(uri, group_json, \"Content-Type\" => \"application/json\")\n puts res.body\n flash[:notice] = \"successfully created\"\n redirect_to groups_path\n\n end\n end", "title": "" }, { "docid": "80cdbc88510924814479f6cf757505ce", "score": "0.6256402", "text": "def create\n if(current_user)\n if(group_params[:name])\n @group = Group.new(group_params)\n @group.user_id= current_user.id\n \n respond_to do |format|\n if @group.save\n @notify = Notification.new\n @notify.user_id= current_user.id\n @notify.content = 'has created group named \"'+@group.name+'\"'\n @notify.url = \"/groups/\"+@group.id.to_s\n @notify.save\n format.html { redirect_to '/groups/' , notice: 'Group was successfully created, add new members now.' }\n # format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n else\n flash[:notice] = 'Group name is requierd.'\n redirect_to '/groups/new'\n\n end\n\n else\n redirect_to \"/users/sign_in\"\n end\n end", "title": "" }, { "docid": "0aa7e1218a7d4f0d1efe3e9202324524", "score": "0.6227733", "text": "def make_wrapped_group\n group = Group.create_wrapped_user(self.id)\n group_id = group.id\n # direct write the my_group_id\n base_cmd = \"INSERT INTO #{User.quoted_table_name}(id, my_group_id) VALUES \"\n end_cmd = \"ON DUPLICATE KEY UPDATE my_group_id = VALUES(my_group_id)\"\n rows = [[self.id, group_id]]\n RawDB.fast_insert(User.connection, rows, base_cmd, end_cmd)\n self.my_group_id = group_id\n end", "title": "" }, { "docid": "e315f3a317e6d4523f46b6b2582c00e5", "score": "0.62271434", "text": "def create\n @group = Group.find(params[:group])\n if params[:create_mod] == \"false\"\n @group_user = GroupUser.new(user_id: params[:id], group_id: params[:group], accepted: true, is_mod: true)\n else\n params[:accepted] == \"true\" ? accepted = true : accepted = false\n @group_user = GroupUser.new(user_id: params[:id], group_id: params[:group], accepted: accepted)\n end\n respond_to do |format|\n if @group_user.save && params[:accepted] == \"true\"\n format.html { redirect_to @group, notice: 'Successfully joined group' }\n format.json { render :show, status: :created, location: @group_user }\n elsif @group_user.save && params[:accepted] == \"false\"\n format.html { redirect_to @group, notice: 'Successfully requested to joined group' }\n format.json { render :show, status: :created, location: @group_user }\n else\n format.html { render :new }\n format.json { render json: @group_user.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8d937dad9869dd58c3d436e9902f4426", "score": "0.622657", "text": "def create\n unless params[:group][:user_id].to_i == @current_user.id\n return render json: { message: 'You are not permitted to perform this operation.' }, status: :forbidden\n end\n @group = Group.new(group_params)\n if @group.save\n render json: @group, status: :created, location: @group\n else\n render json: @group.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "928124c82749c6a3a4664dd0488d166f", "score": "0.6224356", "text": "def create\n # initialize the group variable\n @group = Group.new\n\n @group.name = group_params[:name]\n \n @group.description = group_params[:description]\n\n # image? not sure how we will do this one\n @group.image = group_params[:image]\n\n # date created and updated will be now\n @group.datetime_created = Date.today.to_datetime\n @group.datetime_updated = Date.today.to_datetime\n\n # for new groups, the creator and editor is the person who is signed in\n @group.who_created_id = session[:user_id]\n @group.who_updated_id = session[:user_id]\n\n # Send to location to get the based_in_id\n # locationId = Location.getLocationId(group_params[:city],group_params[:state])\n # if(locationId)\n # @group.based_in_id = locationId\n # else\n # @group.based_in_id = Location.createByCityState(group_params[:city],group_params[:state])\n # end\n \n #Take list and add them as members\n memberParams = params[:group][:members]\n if(memberParams != nil)\n memberParams = memberParams.split(\",\")\n end\n # membersParam = group_params[:members].split(\",\")\n\n respond_to do |format|\n if @group.save\n \n # Needed to do the save in here because I needed to group ID\n memberParams.each do |x| \n member = Member.new\n member.user_id = x\n member.group_id = @group.id\n member.save\n end \n \n format.html { redirect_to groups_url, notice: 'Group was successfully created.' }\n format.json { render :index, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c8ccc0580093edd3ab2e3b74d2232cfe", "score": "0.62184966", "text": "def create!\n cmd = \"groupadd -f -g #{self.gid} g#{self.app_guid[0..7]}\"\n out,err,ret = shellCmd(cmd)\n unless ret == 0\n raise UserCreationException.new(\"Unable to create group for user. Error: #{err}\")\n end\n \n uid_str = \"\"\n FileUtils.mkdir_p self.basedir\n cmd = \"useradd --base-dir #{self.basedir} -u #{self.uid} -g #{self.gid} -m #{self.name} --comment \\\"#{@app_guid}\\\"\"\n out,err,ret = shellCmd(cmd)\n if ret == 0\n self.homedir = \"#{self.basedir}/#{self.name}\"\n else\n raise UserCreationException.new(\"Unable to create user. Error: #{err}\")\n end\n end", "title": "" }, { "docid": "decfb74ef7c16e620eb82414788866a3", "score": "0.621729", "text": "def create\n @group = Group.new(params[:group])\n user = User.find_by_id(current_user.id)\n \n # グループメンバーを保存\n @group.members = [current_user.id]\n\n respond_to do |format|\n if @group.save\n user.currentgroupid = @group.id\n user.save\n format.html { redirect_to :controller =>\"accounts\", :action => \"index\"}\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3eac39c790bb0d971af86210d31a50eb", "score": "0.62172097", "text": "def create\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n \tGroupsUsers.create(:group_id => @group.id, :user_id => current_user.id,:is_admin=>'true',:is_approved=>'true',:added_by_id=>current_user.id)\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "08ab5698a4400be9d1ae6720d5acd499", "score": "0.6215319", "text": "def create\n @group = Group.new(params[:group])\n @group.user_id = self.current_user\n\t\trespond_to do |format|\n if @group.save\n format.html { redirect_to(groups_path, :notice => 'Group was successfully created.') }\n format.xml { render :xml => @group, :status => :created, :location => @group }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "44754b7342985aebd424c67ec6931005", "score": "0.6198633", "text": "def create_discussion_group\n @other_user=@login_user\n @discussion_groups = @login_user.discussion_groups\n @discussion_group = DiscussionGroup.new(:name => params[:discussion_group][:name], :user_id => @login_user.id, :description => params[:discussion_group][:description], :is_public => params[:discussion_group][:is_public])\n @notice = @discussion_group.save ? \"Group created successfully.\": activerecord_error_list(@discussion_group.errors)\n group_user = DiscussionGroupUser.create(:user_id=>@login_user.id,:discussion_group_id=>@discussion_group.id,:is_member=>true) if @discussion_group.save\n\n respond_to do |format|\n format.js\n end\n end", "title": "" }, { "docid": "49e111beda22b31ccd291b62a861ec83", "score": "0.61971974", "text": "def create\n # Leave the group if he is currently in a group!\n # When he creates, he also joins!\n if request.post?\n @group = Group.new(params[:group])\n begin\n @group.save!\n @user.group = @group\n render :xml => @group, :status => :created #returns 201 if it was created\n rescue Exception => ex\n render_error(\"Could not create new group!\", ex)\n end\n else\n render_error(\"Request type not supported. Expected POST.\", nil)\n end\n end", "title": "" }, { "docid": "f47c4660f1500a4986bcb3610d282fff", "score": "0.6193146", "text": "def create\n @group = Group.new(params[:group])\n @group.owner = current_user\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to(@group, :notice => 'Group was successfully created.') }\n format.xml { render :xml => @group, :status => :created, :location => @group }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8791cf8c9fd3d93fe7e2281d07ba7aa1", "score": "0.61865056", "text": "def create\n @group = Group.new(params[:group])\n # add the currently signed in user to the group\n\n\n respond_to do |format|\n if @group.save\n # automatically add the current user to the group\n current_member = GroupMember.new(:user_id => current_user, :group_id => @group.id)\n current_member.save\n format.html { redirect_to(@group, :notice => 'Group was successfully created.') }\n format.xml { render :xml => @group, :status => :created, :location => @group }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "671a9ae1518fab596e7d67b4c68a53a8", "score": "0.61747766", "text": "def create\n ::Domain::Person::Command::CreateCommand.call(\n disp_name: person_params[:name][:disp_name],\n first_name: person_params[:name][:first_name],\n last_name: person_params[:name][:last_name],\n middle_name: person_params[:name][:middle_name],\n kana: person_params[:name][:kana],\n birth_sex_code: person_params[:sex][:birth_sex_code],\n desired_sex_code: person_params[:sex][:desired_sex_code],\n birth_year: person_params[:birthdate][:year],\n birth_month: person_params[:birthdate][:month],\n birth_date: person_params[:birthdate][:date],\n belonging_person_group_id_param: person_params[:person_group].fetch(:id_param, nil),\n accessible_user_id_param: current_access_user_id_param,\n )\n redirect_to debug_people_path, notice: 'Group was successfully created.'\n end", "title": "" }, { "docid": "92eef20de05dc890b8c766b5fc488b05", "score": "0.6169223", "text": "def createGroup\n post :createGroup\n end", "title": "" }, { "docid": "e8ffd432454c10c3f76d77b330f44601", "score": "0.61545074", "text": "def create!\n ::ActiveRecord::Base.transaction do\n producer.email = creator.email unless producer.email? && group\n\n if producer.save\n create_membership_for_creator_or_group!\n end\n end\n\n producer\n end", "title": "" }, { "docid": "896be50155c25bf0430f9d27df4c0bcd", "score": "0.6135204", "text": "def create\n #@current_user = session[:user]\n @group = Group.new(params[:group])\n respond_to do |format|\n if @group.save\n @group.add_editor @current_user\n flash[:notice] = t(:group_created)\n format.html { redirect_to edit_group_path(@group) }\n format.xml { render :xml => @group, :status => :created, :location => @group }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3c0f8184d4cd5367ab58b763ce36a768", "score": "0.61343175", "text": "def create_node_group\n if @options[:an] && @options[:env]\n if @options[:pgn]\n @options[:pgn] = get_group_id_by_name(@options[:pgn].strip)\n else\n @options[:pgn] = get_group_id_by_name('default')\n end\n \n group_id = get_group_id\n \n group = Hash.new\n \n group['id'] = group_id unless group_id.nil?\n group['name'] = @options[:an]\n group['parent'] = @options[:pgn]\n group['environment'] = @options[:env].strip\n group['environment_trumps'] = @options[:override]\n group['classes'] = Hash.new\n \n begin\n @puppetclassify.groups.create_group(group)\n rescue Exception => e\n puts e.message\n puts e.backtrace\n end\n else\n raise OptionParser::MissingArgument\n end\n end", "title": "" }, { "docid": "50d1fa158a54fb064e329e92583738f4", "score": "0.61294985", "text": "def create\n @group = @groupable.groups.new(group_params)\n @group.owner = current_user\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to [@groupable, :groups], notice: 'Group was successfully created.' }\n format.json { render action: 'show', status: :created, location: @group }\n else\n format.html { render action: 'new' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fe3d48793bdb9fe378a56f6b488309a4", "score": "0.6123448", "text": "def create_params\n params.require(:group).permit(:name, :password).merge(user_ids: current_user.id)\n end", "title": "" }, { "docid": "0c8f6a93550e1e9253904e1b4437a166", "score": "0.6120527", "text": "def create\n @group = Group.new(title: params[:group][:title], description: params[:group][:description])\n @members = params[:group][:members]\n\n @group.add(current_user)\n for member in @members\n if (member != \"\")\n @group.add(User.where(:username => member).first)\n end\n end\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bd8c683d4093cdd3ca05b5fb4badf40f", "score": "0.6117578", "text": "def create\n @group = Group.new(group_params)\n @group.users = [User.where(:seq_id => params['user_id'].to_i).first]\n if @group.save\n render json: {message: \"Added Successfully!\"}, status: :ok\n else\n render json: {message: \"Some issue!\"}, status: 400\n end\n end", "title": "" }, { "docid": "0d9599fd7b42ecdbab7eb022c85929a0", "score": "0.6111555", "text": "def create\n authorize! :admin, :site\n\n @group = Group.new(params[:group])\n @group.status = Constant::Approving\n @group.boss_id = current_user.id\n\n respond_to do |format|\n if @group.save\n @group.admin_circle.add(current_user)\n @group.member_circle.add(current_user)\n format.html { redirect_to :action => 'edit', :id => @group.id, :q => 1 }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "889823289b1bdf38107e2675f0fde8e2", "score": "0.6098416", "text": "def create\n parent = Object.const_get(session[:group_type]).find(params[:id])\n begin\n Group.check_for_existing(parent, params[:group][:name], session[:group_type])\n @group = Object.const_get('Group').create(name: params[:group][:name], parent_id: parent.id)\n GroupNode.create(parent_id: parent.id, node_object_id: @group.id)\n undo_link(\"The group \\\"#{@group.name}\\\" has been successfully created.\")\n redirect_to action: 'list', id: parent.id\n rescue GroupExistsError\n flash[:error] = $ERROR_INFO\n redirect_to action: 'new', id: parent.id\n end\n end", "title": "" }, { "docid": "e35e26e8242c7ccbc2dd3feb5da56fe2", "score": "0.60974354", "text": "def create_group(group_name, users_name)\n # can create only non-existed group\n if not Group.exists?(name: group_name)\n group = Group.create(name: group_name)\n users_name = users_name.split(\",\")\n users_name.each do |name|\n add_user(group_name, name)\n end\n end \n # render :json =>{ \"group_info\" => \"group\", \"users_info\" => group.users }\n end", "title": "" }, { "docid": "717514463a77b3e5214cd04d3de68c5e", "score": "0.609552", "text": "def create\n @group = Group.new(params[:group])\n\t\t@group.owner_id = current_user.profile.id\n\n respond_to do |format|\n if @group.save\n flash[:notice] = 'Group was successfully created.'\n format.html { redirect_to(@group) }\n format.xml { render :xml => @group, :status => :created, :location => @group }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7fb14fdb538cf834baa92c5a18358fd7", "score": "0.60952675", "text": "def add_group(user)\n \"group groupname=#{user.group}\"\n end", "title": "" }, { "docid": "2c9b3d90668b1366a94fdfe6711064cc", "score": "0.6091237", "text": "def create_group(group_info)\n members, api_path, api_calls = group_info[:members], group_info[:api_path], group_info[:api_calls]\n @groups << {members: members, api_path: api_path, api_calls: []}\n end", "title": "" }, { "docid": "919ad6fb6e6df0e046ac7cb9facab9c2", "score": "0.609061", "text": "def create\n @user=current_user\n @group = @user.groups.new({:name => params[:name], :user_id => params[:user_id]})\n respond_to do |format|\n if @group.save\n format.json { render json: Group.last.to_json }\n else\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fcd390abd28009247959aafc326003f4", "score": "0.6089891", "text": "def create(name)\n if all.include?(name)\n return false\n else\n result = Confluence.conn.addGroup(name)\n Confluence.logger.debug(\"Created group: #{name}\")\n end\n result\n end", "title": "" }, { "docid": "d34bc54c66662a631a2574ca73ee004e", "score": "0.6081579", "text": "def new\n if params[:name].present? && params[:type].present? && params[:description].present? \n newGroup = Group.create(:name => params[:name], :type_of_group => params[:type], :description => params[:description], :owner_id => session[:user_id], :number_of_members => 1)\n if newGroup\n newGroup.users << User.find(session[:user_id])\n redirect_to(:action => 'index')\n end\n else\n\n end\n end", "title": "" }, { "docid": "197944da1826326c44feb9532fd934db", "score": "0.6079532", "text": "def create( params )\n params.delete( :id ) # Prevent overwriting ID\n Group.new( params ).save\n end", "title": "" }, { "docid": "c6255bf719ca75fd20142c57fed0fbea", "score": "0.60749835", "text": "def create_group(name, member_of = [\"ALL\"], members = []) \n @group.create_new(name, member_of, members) \n rescue => e\n raise e\n end", "title": "" }, { "docid": "61b931772de9e7c8f226d414fe245258", "score": "0.60669935", "text": "def create_group(group_name,group_uuid,classes = {},rule_term,parent_group)\n load_classifier\n @classifier.update_classes.update\n groups = @classifier.groups\n current_group = groups.get_groups.select { |group| group['name'] == group_name}\n if current_group.empty?\n cputs \"Creating #{group_name} group in classifier\"\n groups.create_group({\n 'name' => group_name,\n 'id' => group_uuid,\n 'classes' => classes,\n 'parent' => groups.get_group_id(\"#{parent_group}\"),\n 'rule' => rule_term\n })\n else\n cputs \"NODE GROUP #{group_name} ALREADY EXISTS!!! Skipping\"\n end\nend", "title": "" }, { "docid": "9ed393bbeede913520d770fb62ab6536", "score": "0.60622567", "text": "def create\n\n @group = Group.new(group_params)\n @group.users << current_user\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5423d71d2366570f05742d9887a680c2", "score": "0.60473865", "text": "def create\n @group = Group.new(:owner_id => current_user.id)\n authorize! :create, @group\n\n respond_to do |format|\n if @group.update_attributes(permitted_params)\n format.html { redirect_to(@group, :notice => 'Group was successfully created.') }\n format.xml { render :xml => @group, :status => :created, :location => @group }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2917b7f56a4c0adaa658439153c42c89", "score": "0.60455036", "text": "def create\n group = current_user.my_user_groups.new(group_params)\n if group.save\n render json: group.to_json\n else\n render_error_model(group)\n end\n end", "title": "" }, { "docid": "febca6944e2f805ad2c0180455115583", "score": "0.6042118", "text": "def create_group(name, description, visible, owner_id=nil)\n url = \"/groups/#{name}\"\n body = {\n description: description,\n visible_to_all: visible,\n }\n body[:owner_id] = owner_id unless owner_id.nil? || owner_id.empty?\n put(url, body)\n end", "title": "" }, { "docid": "9b9e3640a248e3a9474c49daffc8c111", "score": "0.6032654", "text": "def create\r\n #@current_user = session[:user]\r\n @group = Group.new(params[:group])\r\n respond_to do |format|\r\n if @group.save\r\n @group.add_editor @current_user\r\n flash[:notice] = t(:group_created)\r\n format.html { redirect_to edit_group_path(@group) }\r\n format.xml { render :xml => @group, :status => :created, :location => @group }\r\n else\r\n format.html { render :action => \"new\" }\r\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end", "title": "" }, { "docid": "23c4118ca5943e76b3ab7cf7b18e5172", "score": "0.60320485", "text": "def create\n require_privilege(Alberich::Privilege::CREATE, User)\n @user_group = UserGroup.new(params[:user_group])\n\n respond_to do |format|\n if @user_group.save\n format.html { redirect_to @user_group, notice: 'User group was successfully created.' }\n format.json { render json: @user_group, status: :created, location: @user_group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_group.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1a6f3d49bed4ae2b5226e67b388652e7", "score": "0.60281146", "text": "def create\n @group = Group.new(@group_params)\n @group.default_group = false\n\n if @group.save\n @group.users << current_user\n process_add_member unless @member_to_add.blank?\n redirect_to @group, notice: 'Group was successfully created.'\n # respond_to do |format|\n # format.html { redirect_to @group, notice: 'Group was successfully created.' }\n # format.json { render action: 'show', status: :created, location: @group }\n # end\n else\n render action: 'new'\n # respond_to do |format|\n # format.html { render action: 'new' }\n # format.json { render json: @group.errors, status: :unprocessable_entity }\n # end\n end\n end", "title": "" }, { "docid": "1ffc23e53e01fa502b783750f3b9a1a6", "score": "0.6024436", "text": "def create_groups\n count = 0\n while count < @num_groups\n\tgroup_name = \"#{TEST_GROUP_PREFIX}-#{count.to_s}\"\n\t#def create_group_complete(groupname, manager, title = nil)\n\tgroup = @full_group_creator.create_group group_name, \"Test Group #{count.to_s}\"\n\tif(group)\n\t @log.info \"created group: #{group.name}\"\n\t @file_log.info \"created group: #{group.name}\"\t \n\telse\n\t @log.info(\"group #{group_name} not created, may already exist?\")\n\t @file_log.info(\"group #{group_name} not created, may already exist?\")\t \n\t group = Group.new group_name\n\tend\n\t@groups << group\n\tcount = count + 1\n\t# add manager after group creation, doesn't appear to work on same post\n\tmanager_id = @user_ids[rand(@user_ids.length)]\n\tmanager_id = manager_id.split(\",\")[0]\n\tresult = add_group_manager group_name, manager_id\n\t@log.info \"result: #{result.inspect} from adding manager: #{manager_id} to group: #{group.name}\"\n\tif (result.code.to_i > 299)\n\t @log.warn \"error adding manager: #{manager_id} to group: #{group.name}\"\n\t @file_log.warn \"error adding manager: #{manager_id} to group: #{group.name}\"\t \n\t else\n\t @log.info \"added manager: #{manager_id} to group: #{group.name}\"\n\t @file_log.info \"added manager: #{manager_id} to group: #{group.name}\"\n\t end\n end\n end", "title": "" }, { "docid": "d1c110ce5c328fcac0a6311763ad257f", "score": "0.60218346", "text": "def create_group(group)\n return group.save_with_admin(self);\n end", "title": "" }, { "docid": "c45bcebc236517f0f158db36c640eda7", "score": "0.6017491", "text": "def create_group(group_name,group_uuid,classes = {},rule_term,parent_group)\n load_classifier\n groups = @classifier.groups\n @classifier.update_classes.update\n current_group = groups.get_groups.select { |group| group['name'] == group_name}\n if current_group.empty?\n cputs \"Creating #{group_name} group in classifier\"\n groups.create_group({\n 'name' => group_name,\n 'id' => group_uuid,\n 'classes' => classes,\n 'parent' => groups.get_group_id(\"#{parent_group}\"),\n 'rule' => rule_term\n })\n else\n cputs \"NODE GROUP #{group_name} ALREADY EXISTS!!! Skipping\"\n end\nend", "title": "" }, { "docid": "e28afc54d8e4562b5ffab2cf89c4342b", "score": "0.6016663", "text": "def new\n\t # set current user to group leader (necessary for form)\n @group = Group.new\n @group.leader = current_user\n @group.users.push current_user\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end", "title": "" }, { "docid": "193328f08cb10e5889232bd5dff958b9", "score": "0.6016003", "text": "def create\n @group = Group.new_by_user(current_user, group_params)\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "df0524f028cb2e8578e45d471d7b7bfa", "score": "0.60155535", "text": "def create\n @group = Group.new(params[:group])\n @group.users << (current_user) if @group\n respond_to do |format|\n if @group.save \n format.html { redirect_to profile_path, notice: \"Group '#{@group.name}' was successfully created.\" }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a4fcc9d5c8cc18c3de9f76e109b56350", "score": "0.60127944", "text": "def create\n @group = Group.new(params[:group])\n @group.add_admin current_user\n respond_to do |format|\n if @group.save\n flash[:notice] = 'Group was successfully created.'\n format.html { redirect_to(@group) }\n format.xml { render :xml => @group, :status => :created, :location => @group }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "186cef67bc352e67a8f98750141f8808", "score": "0.6010977", "text": "def create\n @group = Group.new(group_params)\n current_user.groups << @group\n\n respond_to do |format|\n if @group.save && current_user.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render action: 'show', status: :created, location: @group }\n else\n format.html { render action: 'new' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "175025e44a5ccde8ebb2828325cd2655", "score": "0.60105836", "text": "def create\n if current_user == nil\n redirect_to :controller => :home, :action => :index\n return\n end\n\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n format.html { render 'groups/_group_table_row.html.erb', :layout => false}\n format.json { render json: @group, status: :created, location: @group }\n current_user.add_access(@group)\n @group.set_editor(current_user)\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b166116a81332731545ad9f7894820fc", "score": "0.6009641", "text": "def create_user_group(group_name)\n path = self.api_root + \"/api/groups/#{group_name}\"\n process_firecloud_request(:post, path)\n end", "title": "" }, { "docid": "1c849347da6582ff22d89dd83518e3b0", "score": "0.6007721", "text": "def create\n group = Group.new(group_params)\n\n if Group.find_by(name: group.name).present?\n redirect_to groups_path, notice: \"That group name has already been taken.\"\n else\n group.save\n # usergroup 먼저 save 불가, group만 생성하고 usergroup은 생성되지 못하는 상황은 어떻게 해야할까\n\n usergroup = UserGroup.new\n usergroup.user_id = current_user.id\n usergroup.group_id = group.id\n usergroup.state = \"active\"\n usergroup.save\n\n current_user.add_role :group_manager, group\n current_user.add_role :group_member, group\n\n redirect_to group, notice: \"Group was successfully created.\"\n end\n end", "title": "" }, { "docid": "94d03252b8c9dad8d15bc9e6e039ccbc", "score": "0.6003905", "text": "def created_by(current_user)\n current_user.id == creator ? \"me\" : users.find(creator)\n end", "title": "" }, { "docid": "6a9168cd84d8f70dab65d7f5d15d9b7d", "score": "0.6002201", "text": "def create\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n @group.add(current_user, as: 'admin')\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render :index, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7f3953d929f7f43980a272b9dd2527eb", "score": "0.5996936", "text": "def create_user\n run('groupadd', nil_user)\n run('useradd', '-g', nil_user, '-m', '-s /bin/bash', nil_user)\n end", "title": "" }, { "docid": "0a88dc534be7df3a71b93f842b2c555d", "score": "0.59872586", "text": "def create\n @group = Group.new(group_params)\n @group.admin_id = current_user.id\n if @group.save\n flash[:notice] = 'Let\\'s invite some users!'\n redirect_to group_path(@group)\n else\n flash[:error] = 'An error occurred!'\n render :new\n end\n end", "title": "" }, { "docid": "6951a7149d2346ced619eef373fb6c4d", "score": "0.5986394", "text": "def add_group_to_existing_create\n capture_token_from_params\n if @token\n recipient = Invite.find_by(token: @token).recipient\n group = Invite.find_by(token: @token).group\n recipient.groups << group\n flash[:success] = \"You have successfully added #{group.title} to your account. Please log in to view.\"\n redirect_to login_path\n else\n flash[:danger] = \"You do not have permission to join this group. Please contact the administrator.\"\n redirect_to groups_path\n end\n end", "title": "" }, { "docid": "d67e35e089e0a3d121fe1fc86cfa3425", "score": "0.5983364", "text": "def make_group(**attributes, &block)\n obj = new_group(**attributes, &block)\n _write(obj)\n obj\n end", "title": "" }, { "docid": "38aa23bc796d70fa01e8e3db60144788", "score": "0.5974445", "text": "def create\n @user = User.find(current_user)\n @group = current_user.groups.build(params[:group])\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ad5e9f8d12c9f83f0d44e5d77e827547", "score": "0.59715474", "text": "def create\n @group = Group.new(group_params)\n @group.user_id = current_user.id #store the information of the user who created this group/project\n\n respond_to do |format|\n if @group.save\n Log.create! description: \"<b>#{current_user.email} </b> created project <b>#{@group.name} </b> at #{@group.created_at.strftime '%d-%m-%Y %H:%M:%S'}\",\n role_id: current_user.roles.ids.first\n\n\n ug = UserGroup.create! user_id: @group.upload_user.id, group_id: @group.id\n Log.create! description: \"<b>#{current_user.email} </b> added user <b>#{@group.upload_user.email} </b> to group <b>#{@group.name} </b> at #{ug.created_at.strftime '%d-%m-%Y %H:%M:%S'}\",\n role_id: current_user.roles.ids.first\n\n # => notify to the upload user about their assignment to this group (mail and sms)\n\n UserNotifierMailer.delay(queue: \"upload user added to project\").added_to_project(@group.upload_user, @group)\n # => send sms after adding user to the project\n if @group.upload_user.mobile\n send_sms(@group.upload_user.mobile, \"#{@group.upload_user.roles.last.name}, You have been added to project - #{@group.name}\")\n end\n\n format.html { redirect_to admin_groups_path, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
40e70bdc809e40e45c3359fdbc83ffc8
Closes connection if it is active
[ { "docid": "41db9a2276bb5734911882e1a89e5d3e", "score": "0.0", "text": "def teardown\n logger.debug \"Connection teardown\"\n @connection.finished? or disconnect\n not @connection.finished?\n end", "title": "" } ]
[ { "docid": "776ee5a7c18e2a60ef65c97d5e542a5e", "score": "0.7967537", "text": "def close_connection\n @connection.finish if connected?\n end", "title": "" }, { "docid": "c084455d33be63bf4a5bb7b328a7152d", "score": "0.7898774", "text": "def close\n @active.value = false\n close_connections\n end", "title": "" }, { "docid": "f644802a95e3fa022f70a2fe13aa9cf3", "score": "0.7869112", "text": "def close\n @lock.synchronize { @connection.close }\n true\n end", "title": "" }, { "docid": "f1b4c599db4f163146da6bf82d4b4d67", "score": "0.7863966", "text": "def close\n @connection.disconnect\n @running = false \n end", "title": "" }, { "docid": "c00e83c54a267e873ca09fb3a3831eed", "score": "0.78326666", "text": "def close\n @connection.disconnect\n @running = false\n end", "title": "" }, { "docid": "927800a0b74eabeb526471707e30cfb2", "score": "0.77417916", "text": "def close_connection\n @connection.close_connection if @connection\n end", "title": "" }, { "docid": "cc54194a2ba42c53a761ee4ea48922c1", "score": "0.77267003", "text": "def close_connection\n @connection and @connection.close\n @connection = nil\n end", "title": "" }, { "docid": "ba3c3002cba795ed33351951a5b7c01e", "score": "0.7621265", "text": "def close()\n @conn.close\n @conn = false\n return true\n end", "title": "" }, { "docid": "80200771857fced0509f9431bd587f1a", "score": "0.7620233", "text": "def close_connection\n if connected?\n get.connect.close.call\n else\n return false\n end\n rescue Smartfocus::Exception => e\n ensure\n invalidate_token!\n not connected?\n end", "title": "" }, { "docid": "0084dc57dedf0eb4f2c2db3a79a6d4e0", "score": "0.7572534", "text": "def close\n @mutex.synchronize { @conn.close }\n end", "title": "" }, { "docid": "0084dc57dedf0eb4f2c2db3a79a6d4e0", "score": "0.7572534", "text": "def close\n @mutex.synchronize { @conn.close }\n end", "title": "" }, { "docid": "ea38e3f61668dd4826df3f96b6bb96ad", "score": "0.7568292", "text": "def close!\n close_connection\n end", "title": "" }, { "docid": "62bc949a88a25b5471266049ca463483", "score": "0.75538814", "text": "def close\r\n @mutex.synchronize do\r\n @conn.close\r\n end\r\n end", "title": "" }, { "docid": "a9f15dfe72d59d054b32519ef9173bc7", "score": "0.7497622", "text": "def close_connection\n @conn.close()\n end", "title": "" }, { "docid": "a9f15dfe72d59d054b32519ef9173bc7", "score": "0.7497622", "text": "def close_connection\n @conn.close()\n end", "title": "" }, { "docid": "63c0c74ba5753486f368f1725a00c63f", "score": "0.74841124", "text": "def close\n close_connection(CLOSED, true)\n end", "title": "" }, { "docid": "1a3f3dbcac604181ba939cbcf51e24a4", "score": "0.74818", "text": "def disconnect!\n super\n @active = false\n @connection.close rescue nil\n end", "title": "" }, { "docid": "1a3f3dbcac604181ba939cbcf51e24a4", "score": "0.74818", "text": "def disconnect!\n super\n @active = false\n @connection.close rescue nil\n end", "title": "" }, { "docid": "48a0e31ad19ee3c325f1d5870963ec5a", "score": "0.74585783", "text": "def close!\n\n\t if connected?\n\t\t@connection.close\n\t\t@connected = false\n\t end\n\t return nil\n\n\tend", "title": "" }, { "docid": "d719226d40682d2792c4479e85793882", "score": "0.7412377", "text": "def close_connection\n @stream.close_connection if @stream\n end", "title": "" }, { "docid": "79c14d28a468f210cb65ec8b55545d23", "score": "0.740945", "text": "def close\n conn.disconnect\n end", "title": "" }, { "docid": "d6d9197928e7dcb3209a1ea3bf4ff684", "score": "0.7409139", "text": "def close\n\t\tbegin\n\t\t\t@connOpen = false\n\t\t\t@sock.close\n\t\trescue\n\t\tend\n\tend", "title": "" }, { "docid": "46e453b2aab20db59d16ef466203ff5a", "score": "0.74012476", "text": "def close\n close_connection_result = @connection.close\n reset_instance\n\n @connection_closed = true\n\n close_connection_result\n end", "title": "" }, { "docid": "6d567e2544355623bd59a98610802e61", "score": "0.7378724", "text": "def close\n return false unless @connection\n @session.close if @session\n @connection.close\n @connection = nil\n return true\n end", "title": "" }, { "docid": "60de1e8c7edcfcc623f99f2e833d8d6f", "score": "0.73714703", "text": "def closeConnection\n begin\n @connection.close\n rescue Exception\n end\n \tend", "title": "" }, { "docid": "559e8a868171b25eb8b81f12557622d0", "score": "0.7366628", "text": "def close_connections\n true\n end", "title": "" }, { "docid": "559e8a868171b25eb8b81f12557622d0", "score": "0.7366628", "text": "def close_connections\n true\n end", "title": "" }, { "docid": "d5321599981db72bd7a7daad7fc8a78d", "score": "0.7349293", "text": "def close\n @connection.close\n @connection = nil\n end", "title": "" }, { "docid": "6f7075281165ed284e6a528e8510db23", "score": "0.7348692", "text": "def close\n connection.close\n ensure\n @connection = nil\n end", "title": "" }, { "docid": "d627c53d1ee3ee32b15c8cdfa7807bd5", "score": "0.73461556", "text": "def connection_closed\n self.connection = nil\n end", "title": "" }, { "docid": "012f62ca46df8ac828b86deb3fc95bc6", "score": "0.7307284", "text": "def close_connection_after_writing\n @close_flag = true\n nil\n end", "title": "" }, { "docid": "4bbe24a03d788d3222f0245a5e9ae214", "score": "0.7304643", "text": "def close\n @connection.Close\n end", "title": "" }, { "docid": "532303920a2702cb82e83211e7f77cfb", "score": "0.7302408", "text": "def close\r\n @connection.Close\r\n end", "title": "" }, { "docid": "8f5cdd6238a053ca897ae9ef02122503", "score": "0.73009604", "text": "def close\n if @connection\n @connection.close\n @connection = nil\n end\n end", "title": "" }, { "docid": "0f83c652460709787292a17c1b7a0d6c", "score": "0.72919565", "text": "def close\n connection.close\n @connection = nil\n end", "title": "" }, { "docid": "ef1230d8efb8fbba58b7bbda3e989d22", "score": "0.7278515", "text": "def close\n @connection.close()\n end", "title": "" }, { "docid": "c235c536dc1cef02d37c0c9b077a504a", "score": "0.7262816", "text": "def close_connection\n @connection.close!\n end", "title": "" }, { "docid": "748abbf9ffec2f86dcd4ee5c23a70aa9", "score": "0.72589815", "text": "def close\n\t\t\t@connection.disconnect\n\t\tend", "title": "" }, { "docid": "8a5ea6c9a8c03110e9b47ae018eef411", "score": "0.72539365", "text": "def close\n\t\tif (self.conn)\n\t\t\tself.conn.shutdown\n\t\t\tself.conn.close\n\t\tend\n\n\t\tself.conn = nil\n\tend", "title": "" }, { "docid": "d5ef78da9475970bda853b335d38065e", "score": "0.7246657", "text": "def close_connection\n @connection.reset\n end", "title": "" }, { "docid": "47a92121b6a4ab7a09c6f5672d134aea", "score": "0.72181386", "text": "def close\n @conn.close\n @conn = nil\n end", "title": "" }, { "docid": "88df9abc7b77e19aa3fcc3404b62f0b2", "score": "0.7187284", "text": "def close\n @connection.close\n end", "title": "" }, { "docid": "88df9abc7b77e19aa3fcc3404b62f0b2", "score": "0.7187284", "text": "def close\n @connection.close\n end", "title": "" }, { "docid": "3ca06a1f2161afd93b161d06720d4e10", "score": "0.7165781", "text": "def close\r\n @@con.unbind()\r\n @@my.close\r\n end", "title": "" }, { "docid": "c7843332aa937ea0ac09a24368e5d5b3", "score": "0.71626925", "text": "def close\n @conn.close\n end", "title": "" }, { "docid": "c7843332aa937ea0ac09a24368e5d5b3", "score": "0.71626925", "text": "def close\n @conn.close\n end", "title": "" }, { "docid": "c7843332aa937ea0ac09a24368e5d5b3", "score": "0.71626925", "text": "def close\n @conn.close\n end", "title": "" }, { "docid": "9182c2fc916133f25091b685a69f67eb", "score": "0.715807", "text": "def close\t\n\t\t#puts \"Closing connection\"\n\t\t@connection.close\n\tend", "title": "" }, { "docid": "198abb194d3e48b999af7451d932c1c6", "score": "0.7145579", "text": "def close\r\n\t\t@connection.Close\r\n\tend", "title": "" }, { "docid": "0f9f33572ebfaa04f645e83b2b036e08", "score": "0.71383494", "text": "def stop\n connection.close if connection\n end", "title": "" }, { "docid": "ad31d891f3f4f0fdd5df2501e15b1bc4", "score": "0.71311766", "text": "def close_conn\n \t@conn.close\n end", "title": "" }, { "docid": "a6e3ccb0db5f7cbe2322e82ada7ed526", "score": "0.71193695", "text": "def close_connection\n @connection.expunge\n @connection.logout\n begin\n @connection.disconnect unless @connection.disconnected?\n rescue\n Rails.logger.info(\"Fetcher: Remote closed connection before I could disconnect.\")\n end\n end", "title": "" }, { "docid": "a6e3ccb0db5f7cbe2322e82ada7ed526", "score": "0.71193695", "text": "def close_connection\n @connection.expunge\n @connection.logout\n begin\n @connection.disconnect unless @connection.disconnected?\n rescue\n Rails.logger.info(\"Fetcher: Remote closed connection before I could disconnect.\")\n end\n end", "title": "" }, { "docid": "7f97875e9c1a66bd2fe59799bf1c8a9a", "score": "0.71163785", "text": "def close\n self._update_condition\n Cproton.pn_connection_close(@impl)\n end", "title": "" }, { "docid": "3fb5e84f10d04954d440373bdb87fdf6", "score": "0.7110248", "text": "def close_connection\n if defined?(@socket) && @socket.is_a?(OpenSSL::SSL::SSLSocket)\n @socket.close\n @socket = nil\n end\n\n if defined?(@tcpserver) && @tcpserver.is_a?(TCPSocket)\n @tcpserver.close\n @tcpserver = nil\n end\n\n return true if @tcpserver.nil? && @socket.nil?\n end", "title": "" }, { "docid": "338de7557d25e9062849863d0b568fca", "score": "0.7100294", "text": "def close\n @conn.close\n release_all_channels\n self\n end", "title": "" }, { "docid": "f98c645f0e1ae91b68fa7001da53ccb5", "score": "0.7099393", "text": "def close\n @socket.close if connected?\n end", "title": "" }, { "docid": "4df0f661863642359eb4cdabe4db42ed", "score": "0.709823", "text": "def close_existing_connection\n while @connections.length >= @max_connections\n @connections.each{|n,r|\n @connections.delete(n)\n begin\n r.client.disconnect\n rescue\n end\n break\n }\n end\n end", "title": "" }, { "docid": "e6c23020f27949d9861f48d29089f9a5", "score": "0.7095487", "text": "def close\n @unbound = true\n EM.next_tick(method(:close_connection_after_writing))\n event(:connection_close, :signature => @signature, :msec => msec)\n end", "title": "" }, { "docid": "4770514128389c15d0cbaf1f1d5faef1", "score": "0.708924", "text": "def close\n\t\t@connection.Close\n\tend", "title": "" }, { "docid": "7505e3caf822d852d65554dd5586bffb", "score": "0.7084555", "text": "def closed?()\n @connection.closed?()\n end", "title": "" }, { "docid": "7c3b78951185cf35c5714e963919c58c", "score": "0.7076991", "text": "def close_connection\n return false if @transport == :udp\n @connection.close\n true\n end", "title": "" }, { "docid": "45e43ba9aa99faa2d1861a0af70db1ca", "score": "0.7064533", "text": "def close\n @connection.close\n nil\n end", "title": "" }, { "docid": "67681ff69ca61af945588438e7f5b3f1", "score": "0.7060418", "text": "def close\n @session.close if @session\n ensure\n @socket.close if @socket\n end", "title": "" }, { "docid": "b8075b3531e5af5f473c07895d5d07a1", "score": "0.70414186", "text": "def close\n sleep(1)\n unless !@receiver.adm.avlconn\n Thread.list.each{|t| t.join if (t[:type]=='r' or t[:type]=='sp') }\n @receiver.adm.get_connections.each{|conn|\n conn[1].close\n }\n end\n end", "title": "" }, { "docid": "c77ae9c9b1e137a11508a26bfba0c3c0", "score": "0.70390624", "text": "def close\n return nil unless is_connected?\n socket_puts(\"close\")\n @socket = nil\n end", "title": "" }, { "docid": "477bf03e09839cbae20055b1baf7851f", "score": "0.70367867", "text": "def close\n busterminate(@id_connection)\n end", "title": "" }, { "docid": "fb1ec78d13bf52b6d8c43271bd4e208a", "score": "0.7019855", "text": "def disconnect\n @conn.close\n end", "title": "" }, { "docid": "fb1ec78d13bf52b6d8c43271bd4e208a", "score": "0.7019855", "text": "def disconnect\n @conn.close\n end", "title": "" }, { "docid": "fb1ec78d13bf52b6d8c43271bd4e208a", "score": "0.7019855", "text": "def disconnect\n @conn.close\n end", "title": "" }, { "docid": "fb1ec78d13bf52b6d8c43271bd4e208a", "score": "0.7019855", "text": "def disconnect\n @conn.close\n end", "title": "" }, { "docid": "fb1ec78d13bf52b6d8c43271bd4e208a", "score": "0.7019855", "text": "def disconnect\n @conn.close\n end", "title": "" }, { "docid": "fb1ec78d13bf52b6d8c43271bd4e208a", "score": "0.7019855", "text": "def disconnect\n @conn.close\n end", "title": "" }, { "docid": "fb1ec78d13bf52b6d8c43271bd4e208a", "score": "0.7019468", "text": "def disconnect\n @conn.close\n end", "title": "" }, { "docid": "72ff214e41f504ea574066682e4fb9bf", "score": "0.7018017", "text": "def close_connection\n return if (@closed)\n\n unless (@timed_out)\n send_callback(:on_disconnect)\n end\n\n debug_notification(:closed, \"Connection closed\")\n \n super\n\n @connected = false\n @closed = true\n @timeout_at = nil\n @interpreter = nil\n end", "title": "" }, { "docid": "4f4e250e2dcbfdfe780867c73bb6c64d", "score": "0.70141023", "text": "def disconnect!\n @connection.close rescue nil\n end", "title": "" }, { "docid": "bbf0f2f4602b0fece3f05c691ccab146", "score": "0.70116526", "text": "def shutdown\n @active = false\n client.close_connection\n end", "title": "" }, { "docid": "b5edae5c4ff19a5e6808fe8d357e9f51", "score": "0.70112586", "text": "def closed?\n @connection.closed?\n end", "title": "" }, { "docid": "3efc1f01f2bba6905260c80ea1f4a05b", "score": "0.70085794", "text": "def close_connection\n return if (@closed)\n\n unless (@timed_out)\n send_callback(:on_disconnect)\n end\n\n debug_notification(:closed, \"Connection closed\")\n\n super\n\n @connected = false\n @closed = true\n @timeout_at = nil\n @interpreter = nil\n end", "title": "" }, { "docid": "22f4035c0c0bcba6a8ef79ad02da1a84", "score": "0.70081675", "text": "def close(timeout=2)\n \t@connection.close(timeout)\n end", "title": "" }, { "docid": "a55528b9bca753fad01b53b998f6ffb8", "score": "0.70060545", "text": "def destroy_connection\r\n begin\r\n @sock.close if @sock\r\n rescue\r\n nil\r\n ensure\r\n @connected=false\r\n end\r\n end", "title": "" }, { "docid": "3722e7c5ce4017246af29f080625bffe", "score": "0.7005922", "text": "def disconnect\n connection{ |conn| conn.disconnect }\n true\n end", "title": "" }, { "docid": "47b803c660b24dff17dd634802aeaad8", "score": "0.7002615", "text": "def close\n @ready_state = CLOSED\n @conn.close('requested') if @conn\n end", "title": "" }, { "docid": "47b803c660b24dff17dd634802aeaad8", "score": "0.7002615", "text": "def close\n @ready_state = CLOSED\n @conn.close('requested') if @conn\n end", "title": "" }, { "docid": "f3f5a6cfff6f7fff53c48f33bac6a09f", "score": "0.6999991", "text": "def disconnect!\n raw_connection.close\n end", "title": "" }, { "docid": "7ec9f1d285101258e131001b7a72f5f9", "score": "0.6987444", "text": "def close\n @ruby_socket = nil\n \n Util.error_check \"closing the connection to #{@options[:host]}\",\n FFI.mosquitto_disconnect(ptr)\n \n self\n rescue Mosq::FFI::Error::NoConn\n self\n end", "title": "" }, { "docid": "589e6199eb5b58b3b77584fbdf962d80", "score": "0.6984001", "text": "def close\n begin\n close_session\n rescue => e\n STDERR.puts \"Failed to send or receive close-session: #{e}\"\n ensure\n @connection.close\n end\n end", "title": "" }, { "docid": "439c36d969b2f853e5f62cd1e51e90d5", "score": "0.69630617", "text": "def close_connection\r\n @RedisHandle.close_connection()\r\n @HbaseHandle.close_connection()\r\nend", "title": "" }, { "docid": "7505e47bb2e565898187454051a4f71e", "score": "0.69616175", "text": "def disconnect\n if connected?\n request({:request_type => :close}) \n @connection.close_connection_after_writing\n timer = EM::PeriodicTimer.new(0.1) do\n unless connected?\n timer.cancel\n @connection_open = false\n end\n end\n elsif connection_open?\n @connection.close_connection\n @connection_open = false\n else\n raise \"Not connected.\"\n end\n end", "title": "" }, { "docid": "3407f1482b700f934dd5e091da676d4e", "score": "0.69592726", "text": "def terminate\n if(connection)\n connection.close\n end\n end", "title": "" }, { "docid": "5b81b65a4559f05793ed064471f4dc00", "score": "0.69587636", "text": "def close\n while @connections.any?\n conn = @connections.pop\n conn.close\n end\n end", "title": "" }, { "docid": "b8a160b5b87d60f6f4732074a7c5e243", "score": "0.6950484", "text": "def close\n\t\t\t\tif @connection\n\t\t\t\t\t@pool.release(@connection)\n\t\t\t\t\t@connection = nil\n\t\t\t\tend\n\t\t\tend", "title": "" }, { "docid": "2b8069571b04534b575a7def7548183a", "score": "0.69465876", "text": "def close_connection!\n @ws && @ws.close\n end", "title": "" }, { "docid": "49ea1d8e662b8959d29dd97126437ded", "score": "0.6937551", "text": "def close\r\n if @db.connection.active? && @db.connection\r\n @db.connection.close\r\n end\r\n end", "title": "" }, { "docid": "e1dfdb5a8acd0627fe7e9744f54f916d", "score": "0.6930728", "text": "def closed?\n @conn.nil?\n end", "title": "" }, { "docid": "5a82b6a2170e4b8946f709ee2adaffbd", "score": "0.6928955", "text": "def closed?\n connection.closed?\n end", "title": "" }, { "docid": "c912433828bc5b9322dc9a1a4f100aa1", "score": "0.69234407", "text": "def release\n begin\n @connection.on_connection_exception do\n #Do nothing...we are shutting down\n end\n @connection.send(Jabber::Protocol::Presence.gen_unavailable(id))\n @connection.send(Jabber::Protocol.gen_close_stream)\n rescue\n #ignore error\n end\n begin\n @connection.close\n rescue\n #ignore error\n end\n end", "title": "" }, { "docid": "a09b663ee89246de9142346e6bc39fb7", "score": "0.6920863", "text": "def close(allow_reconnect = false)\n if @connection\n # Disable reconnects if specified\n reconnect = @reconnect\n @reconnect = reconnect && allow_reconnect\n\n # Clean up timers / connections\n @keepalive_timer.cancel if @keepalive_timer\n @keepalive_timer = nil\n @connection.close\n\n # Revert change to reconnect config once the final signal is received\n wait do |&resume|\n on(:session_ended, :once => true) { resume.call }\n end\n @reconnect = reconnect\n end\n \n true\n end", "title": "" }, { "docid": "22f71b458ea8119506ed799cfdcb9616", "score": "0.69063795", "text": "def handle_close\n @connected = false\n publish(:disconnected)\n unsubscribe_all\n log.info \"(#{self.object_id}) Connection '#{@host}(#{@addr})' closing\"\n @server.unregister(self)\n# @sock.shutdown # odd errors thrown with this\n @sock.close\n rescue Exception\n log.error \"(#{self.object_id}) Connection#handle_close closing\"\n log.error $!\n end", "title": "" }, { "docid": "c8d6bed22335b886593abb86efcebbe4", "score": "0.6895974", "text": "def close(try = true)\n # If they're online, make sure to broadcast that they're not anymore.\n if try and @resource and @resource.available?\n elem = REXML::Element.new('presence')\n elem.add_attribute('type', 'unavailable')\n\n presence_unavailable(elem)\n end\n\n # Undo some refereces so GC works.\n if @resource\n @resource.user.delete_resource(@resource)\n @resouce = nil\n end\n\n $log.c2s.info \"#{@host} -> TCP connection closed\"\n super(try)\n end", "title": "" }, { "docid": "001493f0f3a3453d6ea5e8ccf17f541a", "score": "0.68937236", "text": "def close()\n \t\tprint(\"\\r\\nClosing the connection. Bye!\")\n \t\t@client.close unless @client.closed?\n\tend", "title": "" } ]
5f743864315704fb9e397cffbc7afa4a
Normalize urls, allowing you to use "google.com" instead of "
[ { "docid": "304cb869985e53b533cba52934aa5f5b", "score": "0.79572046", "text": "def normalize_url url\n unless url.match(/https?:\\/\\//)\n url = \"http://#{url}\"\n end\n\n url\n end", "title": "" } ]
[ { "docid": "40b26bbfac2d6a431c9d6bbc7db4361b", "score": "0.8307119", "text": "def normalize_url(url); end", "title": "" }, { "docid": "94f8f3b4f56f349a6f5902348d3476eb", "score": "0.8004657", "text": "def clean_url\n url = self.original_url\n url = url.gsub(' ', '')\n url = url.strip\n if url !~ REGEX_PROTOCOL\n url = \"http://#{url}\"\n end\n begin\n self.original_url = URI.parse(url).normalize.to_s\n rescue URI::InvalidURIError\n # handle urls that cannot be parsed\n self.original_url = url\n end\n end", "title": "" }, { "docid": "60714d1f9272ee991b3b0f88b2a66cc6", "score": "0.7693336", "text": "def sanitize_url(url)\n # URL matches 'www'\n if url =~ /w{3}/\n sterilize url.split(/\\./)[1]\n # URL does not match 'www'\n else\n first_parts = url.split(/\\./)[0..1]\n scheme_eliminated = first_parts.map {|part| part.gsub(/[a-zA-Z]+\\W+/, '')}.join(' ')\n sterilize(scheme_eliminated) \n end\n end", "title": "" }, { "docid": "b833ba35b0e4bef27aeb6621f45f640e", "score": "0.76460826", "text": "def normalize_url(url)\n Addressable::URI.parse(url).normalize.to_s\n end", "title": "" }, { "docid": "1757d37314d84fc9079605003d8be765", "score": "0.760785", "text": "def clean_url url\n return url if url.nil?\n url.gsub('%2F', '/').gsub(/^\\/+/, '').gsub('//', '/')\n end", "title": "" }, { "docid": "86acec6d1e87c3dde4b7698d629feb29", "score": "0.7571207", "text": "def normalize_url(url)\n\t\tbegin\n\t\t\turl.strip!\n\t\t\t# Converting the scheme and host to lower case in the process, i.e. 'HTTP://www.Example.com/' => 'http://www.example.com/' \n\t\t\t# Normalize the base\n\t\t\tbase=url_2_site(url) \n\t\t\t# Case#1, remove the trailing dot after the hostname, i.e, 'http://www.yahoo.com./' => 'http://www.yahoo.com/'\n\t\t\tbase=base.sub(/\\.\\/$/,'/')\n\t\t\t# Normalize the relative path, case#1\n\t\t\t# retrieve the file path and remove the first '/' or '.', \n\t\t\t# i.e. 'http://www.example.com/mypath' or 'http://www.example.com/./mypath' => 'mypath'\n\t\t\tpath=url_2_path(url).sub(/^(\\/|\\.)*/,'')\n\t\t\t# Normalize the relative path, case#2\n\t\t\t# Replace dot-segments. \"/../\" and \"/./\" with \"/\", i.e. 'http://www.example.com/../a/b/../c/./d.html\" => 'http://www.example.com/a/c/d.html'\n\t\t\tpath=path.gsub(/\\/\\.{1,2}\\//,'/')\n\t\t\tif path.nil?\n\t\t\t\treturn base\n\t\t\telse\n\t\t\t\treturn base+path\n\t\t\tend\n\t\trescue => ee\n\t\t\tputs \"Exception on method #{__method__} for #{url}: #{ee}\" if @verbose\n\t\t\treturn url\n\t\tend\n\tend", "title": "" }, { "docid": "e4d6a51a2d9a90bc117ede67bd40497c", "score": "0.75587857", "text": "def cleanup_urls\n self.url = self.url.to_s.downcase\n end", "title": "" }, { "docid": "6ae2916197e4bb7893c4782939f2c708", "score": "0.75575215", "text": "def sanitize_url(str); end", "title": "" }, { "docid": "23e4bf14f71d044890d15352d1cee702", "score": "0.7515783", "text": "def sanitize_url(url)\n url.gsub(%r{^https?://}, '').split('/').map {|u| CGI.escape(u) }.join('/')\n end", "title": "" }, { "docid": "fcec66676fc34b0fc90d48a2b7ef3a09", "score": "0.74432784", "text": "def sanitize\n self.original_url.strip!\n self.sanitize_url = self.original_url.downcase.gsub(/(https?:\\/\\/)|(www\\.)/, \"\")\n self.sanitize_url = \"http://#{self.sanitize_url}\"\n end", "title": "" }, { "docid": "0ce2e3e19282f3ff33e235895b136714", "score": "0.7439922", "text": "def nice_url\n\t\t# i want to take thr url and remove http:// and www.\n\t\t# gsub is global subsitution\n\t\turl.gsub(\"http://\", \"\").gsub(\"www.\", \"\")\n\tend", "title": "" }, { "docid": "303270059a65896c1e10580ba8f487a1", "score": "0.73846674", "text": "def sanitise(url)\n if url and m = url.match(/(\\w+)(:\\/*)([\\w\\.\\-].*)(\\/?.*)?/)\n clean_url = m.captures[0].downcase + m.captures[1] + m.captures[2].downcase\n if m.captures[3]\n clean_url << m.captures[3]\n end\n else\n return nil\n end\n end", "title": "" }, { "docid": "5c99e7b19147fd0d61e40984a7067c09", "score": "0.73630375", "text": "def clean_url(url)\n begin\n url = Addressable::URI.escape(url)\n url = \"http://#{url}\" if Addressable::URI.parse(url).scheme.nil?\n uri = URI(url)\n host = uri.host.downcase\n\n if host.start_with?('www.')\n host = host[4..-1]\n end\n\n host + uri.path.downcase\n rescue\n logger.debug \"Bad URL encountered in clean_url\"\n url\n end\n end", "title": "" }, { "docid": "37c44f2d6b0f6820a77c18f65d23b70d", "score": "0.732877", "text": "def normalize\n Wgit::Url.new(@uri.normalize.to_s)\n end", "title": "" }, { "docid": "2233a96fb4d7074440c8291e93537358", "score": "0.7247534", "text": "def urlify(url)\n p url.tr(' ', '%20')\n url.gsub!(/ /, '')\nend", "title": "" }, { "docid": "92477b84b0c655eb6f737b84cd7f848d", "score": "0.7242016", "text": "def normalize_url\n return if self.url.blank?\n normalized = self.url.normalize\n if normalized.blank?\n self.errors.add(:url, \"is invalid\")\n return false\n elsif normalized.match(\"archiveofourown.org/users\")\n self.errors.add(:url, \"cannot be ao3 user\")\n return false\n elsif normalized.match(\"(.*)/collections/(.*)/works/(.*)\")\n normalized = $1 + \"/works/\" + $3\n elsif normalized.match(\"archiveofourown.org/collections\")\n self.errors.add(:url, \"cannot be an ao3 collection\")\n return false\n end\n self.url = normalized\n end", "title": "" }, { "docid": "8c1a7b994f12ff5366f41e21dc806093", "score": "0.7208275", "text": "def fix_urls\n return unless self.url\n self.url.gsub!(/^(.*)/, 'http://\\1') unless self.url =~ %r{^http://} or self.url.empty?\n end", "title": "" }, { "docid": "dfce06d276a0ca8c39eb73b387737fa4", "score": "0.7178209", "text": "def normalize_path(url); end", "title": "" }, { "docid": "dfce06d276a0ca8c39eb73b387737fa4", "score": "0.7178209", "text": "def normalize_path(url); end", "title": "" }, { "docid": "3b8942fdade13ce1274606e46971ccf5", "score": "0.713333", "text": "def normalize_uri uri\n (uri =~ /^https?:/) ? uri : \"http://#{uri}\"\n end", "title": "" }, { "docid": "35bfdd70543123f985cdb53f9d3cf5cd", "score": "0.71015954", "text": "def sanitize_url(url)\n return url if url.include?(\"https://\") || url.include?(\"http://\")\n url.prepend(\"http://\")\n end", "title": "" }, { "docid": "3de921e7f020222b084ed82cbb10ebb1", "score": "0.7095569", "text": "def normalise\n Wgit::Url.new(@uri.normalize.to_s)\n end", "title": "" }, { "docid": "76b9a437dbf510f0ee267d3e5c50a0a1", "score": "0.70816654", "text": "def clean_url(href)\n # TODO: A better way would be to split by / then take the last section, strip off the anchor then cgi escape\n URI.unescape(href.strip).gsub(\" \", \"%20\")\n end", "title": "" }, { "docid": "0d94dee85a3dc149b44929eca109c5bf", "score": "0.70779276", "text": "def sanitize( message )\n urls = URI.extract(message)\n\n # Return early no URLs are foudnd.\n return message if urls.length.zero?\n\n urls.each do |url|\n next if URI.parse(url).class != URI::HTTP # Ignore URI::General etc\n\n host = URI.parse(url).host\n host = host.start_with?('www.') ? host[4..-1] : host\n message = message.gsub(url, host)\n end\n\n message\n end", "title": "" }, { "docid": "bde7fd9ad73a37841882b27ebf2b1799", "score": "0.7075201", "text": "def normalize_url(url)\n return nil if url.nil?\n begin\n uri = Addressable::URI.heuristic_parse(url)\n uri.host.present? && /^http(s)?$/.match(uri.scheme) ? uri.to_s : nil\n rescue\n nil\n end\n end", "title": "" }, { "docid": "d239879498d964fefa54a0876ae65bbf", "score": "0.7028653", "text": "def pretty_url\n Iconv.iconv(\"ASCII//IGNORE//TRANSLIT\", \"UTF-8\", self).join.sanitize\n rescue\n self.sanitize\n end", "title": "" }, { "docid": "bef970274ce53496267ff27f9909f56d", "score": "0.7026914", "text": "def clean_url\n self.url = self.title.clone if self.url.blank?\n \n self.url.downcase!\n self.url = self.url.gsub(/[^[:alnum:]]/,'-').gsub(/-{2,}/,'-')\n self.url = self.url.gsub(/^[-]/,'').gsub(/[-]$/,'')\n self.url.strip!\n\n return true\n \tend", "title": "" }, { "docid": "f982a9b37d1dcc7617831617f4ae7925", "score": "0.7016978", "text": "def sanatize_url(url)\n uri = URI.parse(url);\n cleaned_url = \"https://\" + uri.host + uri.path\n end", "title": "" }, { "docid": "693be8ef84c34a0dc7d51ae152ebc939", "score": "0.7007752", "text": "def normalize_uri(uri)\n (uri =~ /^(https?|ftp|file):/) ? uri : \"http://#{uri}\"\n end", "title": "" }, { "docid": "d9c60a6111a0dc7089e1c15ace238717", "score": "0.70012504", "text": "def normalize_uri(uri)\n (uri =~ /^(https?|ftp|file):/) ? uri : \"http://#{uri}\"\n end", "title": "" }, { "docid": "a82f7a31205379ee07f630270cf9d2bc", "score": "0.699568", "text": "def fix_url\n self.url = UrlNormalizer.normalize_entry_url self.url, self\n end", "title": "" }, { "docid": "71cce095b699e4e8df8672fcb668c43b", "score": "0.6986851", "text": "def normalize!\n u = normalize\n @url = URI.parse(u)\n self\n end", "title": "" }, { "docid": "09e97517ec20e6b4373267ceb72dc791", "score": "0.69589806", "text": "def clean(url)\n url\n end", "title": "" }, { "docid": "d9f98ed9391f8cef3adf182a6241309a", "score": "0.69561285", "text": "def format_url(url)\n url.gsub(%r{^(https?:\\/\\/)}, '')\n end", "title": "" }, { "docid": "3fc583c983f18ed4f99d01b01af72ce7", "score": "0.69454825", "text": "def uri_normalize(uri)\n \treturn 'http://' + uri unless uri =~ /http:\\/\\//\n \turi\n\tend", "title": "" }, { "docid": "3fc583c983f18ed4f99d01b01af72ce7", "score": "0.69454825", "text": "def uri_normalize(uri)\n \treturn 'http://' + uri unless uri =~ /http:\\/\\//\n \turi\n\tend", "title": "" }, { "docid": "8686bb462e2cf00e06af1fa3301ffb62", "score": "0.6940371", "text": "def normalize_query url\n url = PostRank::URI.normalize(url) rescue nil\n return if url.blank?\n return if url.host.blank? || (! HOST_WHITELIST.include?(url.host))\n return unless (url.scheme == 'http')\n url\n end", "title": "" }, { "docid": "8686bb462e2cf00e06af1fa3301ffb62", "score": "0.6940371", "text": "def normalize_query url\n url = PostRank::URI.normalize(url) rescue nil\n return if url.blank?\n return if url.host.blank? || (! HOST_WHITELIST.include?(url.host))\n return unless (url.scheme == 'http')\n url\n end", "title": "" }, { "docid": "8abb08432d258796a2bd6ec7f7ef902f", "score": "0.6908494", "text": "def sanitize_url(value)\n value = sanitize_string(value)\n value = value.sub('./', '') if value.start_with?('./')\n value\n end", "title": "" }, { "docid": "720f4ab3cabbb79930a8308a7c0d6021", "score": "0.68512654", "text": "def unrelativize_url(url)\n url =~ /^\\/\\// ? \"#{scheme}://#{url[2..-1]}\" : url\n end", "title": "" }, { "docid": "720f4ab3cabbb79930a8308a7c0d6021", "score": "0.68512654", "text": "def unrelativize_url(url)\n url =~ /^\\/\\// ? \"#{scheme}://#{url[2..-1]}\" : url\n end", "title": "" }, { "docid": "9aacaf4c2ed1394be431e3a080efe5d8", "score": "0.6850925", "text": "def clean_url\n #use try instead for nil?\n unless self.url.nil?\n parsed_url = URI.parse(self.url).host.sub(/\\Awww\\./, '')\n else\n nil\n end\n end", "title": "" }, { "docid": "f244c36a062be0aa3fc9dfb15093fbe6", "score": "0.68473464", "text": "def normalize_uri\r\n self.link = Addressable::URI.heuristic_parse(self.link).normalize!.to_s if self.link\r\n end", "title": "" }, { "docid": "5306825bf39fedae5df9b2364788d739", "score": "0.6827361", "text": "def facebook_path_scrub(url)\n return url.gsub('facebook/', '').gsub('/facebook', '')\n end", "title": "" }, { "docid": "aa6165af83f38b6f5fab7d1eb143296c", "score": "0.68181056", "text": "def clean_from_i18n(url)\n parts = url.split('/').select { |p| p && p.size > 0 }\n parts.shift if langs.map(&:to_s).include?(parts[0])\n parts.join('/')\n end", "title": "" }, { "docid": "8a1627701303e2cf170aba545b073138", "score": "0.6804455", "text": "def clean_from_i18n(url)\n parts = url.split('/').select { |p| p && p.size > 0 }\n parts.shift if langs.map(&:to_s).include?(parts[0])\n\n parts.join('/')\n end", "title": "" }, { "docid": "9ce288b74900897aef1bd1f1f83b7149", "score": "0.67785805", "text": "def URLify(string)\n string.strip.gsub(\" \", \"%20\")\nend", "title": "" }, { "docid": "a3b67363988c1c2411f9cf1dc7e6e31c", "score": "0.6776779", "text": "def parse_url(text)\n text.downcase\n end", "title": "" }, { "docid": "9b4581124cb5a549b410377abe40e4de", "score": "0.675936", "text": "def urlify(str)\n return str if str.split(' ').length == 1\n str.strip.gsub(/\\s/, '%20')\nend", "title": "" }, { "docid": "7f3752cdc2ae0459ac867b48ce4e149a", "score": "0.671179", "text": "def clean_url!\n remove_urchin\n case uri.host\n when 'www.youtube.com'\n self.url = \"#{uri.scheme}://#{uri.host}/watch?v=#{self.params['v'][0]}\"\n when 'boingboing.net'\n self.url = \"#{uri.scheme}://#{uri.host}#{uri.path}\"\n end\n end", "title": "" }, { "docid": "7b1ca9b6293ae21e7e822bf3d828b055", "score": "0.6704505", "text": "def strip_http(url = '')\n return url.gsub('http://', '')\n end", "title": "" }, { "docid": "45df862c8a4e7ac59035c9dd9b428261", "score": "0.6686772", "text": "def normalize_base_uri(url) #:nodoc:\n use_ssl = (url =~ /^https/) || url.include?(':443')\n url.chop! if url.ends_with?('/')\n url.gsub!(/^https?:\\/\\//i, '')\n \"http#{'s' if use_ssl}://#{url}\"\n end", "title": "" }, { "docid": "eefb0c6c2864f89e561bf79543b93e78", "score": "0.66635054", "text": "def strip_url(url)\n url.sub!(/https\\:\\/\\//, '') if url.include? \"https://\"\n url.sub!(/http\\:\\/\\//, '') if url.include? \"http://\"\n return url\n end", "title": "" }, { "docid": "f2a5e84973baebb68b7a9105673e1dfc", "score": "0.6659361", "text": "def correct_uri( url )\n uri = URI( url )\n if uri.scheme == 'http'\n case\n when uri.host.match( 'github.com' )\n # remove possible subdomain like 'wiki.github.com'\n uri = URI \"https://github.com#{uri.path}\"\n when uri.host.match( 'bitbucket.org' )\n uri = URI \"https://#{uri.host}#{uri.path}\"\n end\n end\n\n uri\n end", "title": "" }, { "docid": "ec18c85f162c22cff788cf81b0b9e2a5", "score": "0.6653746", "text": "def ensure_url(str)\n if str.respond_to?(:scheme)\n str\n else\n str = str.to_s\n str.gsub! /\\s/, ''\n str.gsub! /(\\#|\\?).*/, ''\n Addressable::URI.parse str\n end\n end", "title": "" }, { "docid": "eac58596f3bc042ab3284e89f9f80797", "score": "0.66537154", "text": "def sanitize\n \tself.original_url.strip!\n \tself.sanitize_url = self.original_url.downcase.gsub(/(https?:\\/\\/)|(www\\.)/, \"\")\n \tself.sanitize_url = \"http://#{self.sanitize_url}\"\n\n \n start = 8\n final = self.sanitize_url.length\n\n while start <= final do\n sanitize_url[start] == ' ' ? sanitize_url[start] = '-' : sanitize_url[start] = sanitize_url[start] #change spaces for '-'\n break if sanitize_url[start] == '/' #break if '/' is found\n start +=1\n end\n\n self.sanitize_url = sanitize_url[0..start] #cut the string for creating the shortened_url\n self.short_url = sanitize_url + short_url #save the final shortened_url on the short_url's field\n end", "title": "" }, { "docid": "d172f9fa9eefde82405c434e1d1b56db", "score": "0.6646509", "text": "def format_url\n self.url.chomp\n if self.url.match(\"https://\") || self.url.match(\"http://\")\n else self.url = \"http://\" + url\n end\n self.url\n end", "title": "" }, { "docid": "16a5d2937ebcfdd204e92858d2df9f87", "score": "0.66038996", "text": "def urify(url)\n url = url.to_s.downcase\n if %r(^https://) !~ url\n url = 'https://' + url\n end\n URI.parse(url) + '/'\n end", "title": "" }, { "docid": "3bb0d97820df7556753e1e9ea24cfe40", "score": "0.6596683", "text": "def normalized_permalink_url\n @normalized_permalink_url ||= Addressable::URI.parse(permalink_url).normalize\n end", "title": "" }, { "docid": "8f50de52919bab0721644b559cbfa761", "score": "0.6589262", "text": "def normalize_url(value)\n svalue = value.to_s\n pref = @req.api_prefix\n suffix = @req.api_suffix\n svalue.match(pref) ? svalue : \"#{pref}/#{svalue}#{suffix}\"\n end", "title": "" }, { "docid": "7f0a5d5a873b1b3c1901c5363f6b0dbd", "score": "0.6583227", "text": "def uri_normalizer; end", "title": "" }, { "docid": "e210cff3bd7ffcba2275ae42f43015c8", "score": "0.6572619", "text": "def clean_url\n return # Not yet implemented\n end", "title": "" }, { "docid": "aa6df7b832bdf44d3a9c1d4fe22cff10", "score": "0.6556448", "text": "def converturl url\n return nil unless url\n newurl = url.sub('/wiki/','').downcase().sub('_(film)','').sub(/([12][8901].._film)/,'')\n newurl = URI.decode(newurl)\n # accept only alphanum and %\n newurl.gsub!(/[^0-9a-z%]/i,'')\n return newurl\nend", "title": "" }, { "docid": "fcbc9b4982e06d1197a4f3d396482c5b", "score": "0.6554314", "text": "def normalize_github_url\n return if self.github_url.blank?\n\n url = self.github_url || \"\"\n url.gsub!(/(https?:\\/\\/)?(www\\.)?github\\.com\\//, \"\")\n self.github_url = \"https://github.com/#{url}\"\n true\n end", "title": "" }, { "docid": "b624344ecbf201f6c19cf4ecb058b7ff", "score": "0.6550949", "text": "def clean_url\n str = self\n str = str.remove_enters\n str = str.remove_tabs\n str\n end", "title": "" }, { "docid": "91b446094ac9299c20857b1c8439cedb", "score": "0.6545593", "text": "def slashless_url(url)\n url.chomp('/')\n end", "title": "" }, { "docid": "29d8e711dd8e424c3c1f55eae7c72656", "score": "0.6536109", "text": "def sanitize(url)\n\t\t\tURI.encode url.strip.gsub('[', '%5B').gsub(']', '%5D')\n\t\tend", "title": "" }, { "docid": "371c5c44c9c26da43133f5891d0ac089", "score": "0.6533823", "text": "def short_url\n return nil if url.nil?\n url.gsub(\"http://\",\"\").gsub(\"www.\", \"\")\n end", "title": "" }, { "docid": "626172b4a503133096788c71f7dfc186", "score": "0.65313125", "text": "def strip_http(url)\n \n # remove scheme\n if url.start_with?('http://')\n dest_url = url[7..-1]\n elsif url.start_with?('https://')\n dest_url = url[8..-1]\n else \n dest_url = url\n end\n\n # remove trailing \"meaningless\" characters\n if dest_url.end_with?('/')\n dest_url = dest_url[0..-2]\n end\n\n if dest_url.end_with?('#')\n dest_url = dest_url[0..-2]\n end\n\n return dest_url\n end", "title": "" }, { "docid": "c4e63c3023e95e2291cd13541222cefe", "score": "0.65243554", "text": "def polish!(url)\n url.replace \"http://#{url}\"\n end", "title": "" }, { "docid": "2e27c176a80b9fa5476117a68ac886f9", "score": "0.65238243", "text": "def strip_url(tweet)\n regex = 'https://'\n current = tweet.rpartition(regex)\n\n while current.include? regex\n current = current.first.rpartition(regex)\n end\n current.last\n end", "title": "" }, { "docid": "b8c7334602ffa2ed00e5d4139af37b2f", "score": "0.6521571", "text": "def site_sanitized\n if site.nil?\n return nil\n else\n if site.starts_with?('http://') || site.starts_with?('https://')\n return site\n else\n return 'http://' + site\n end\n end\n \n end", "title": "" }, { "docid": "f0f52e889e66dced822a7b2d9ea6b053", "score": "0.65194046", "text": "def tokenize_urls!\n @raw.gsub!(%r{http[\\w\\-\\#:/_.?&=]+}) do |url|\n maybe_parse_url(url) do |uri|\n path = uri.path.tap { |str| str.tr!('/_\\-', ' ') }\n query = uri.query.tap { |str| str&.tr!('?=&#_\\-', ' ') }\n fragment = uri.fragment.tap { |str| str&.tr!('#_/\\-', ' ') }\n\n \"#{uri.scheme} #{uri.host} #{path} #{query} #{fragment}\"\n end\n end\n end", "title": "" }, { "docid": "ff7ce6b94bdc3e94bd3c073e45a51678", "score": "0.6507716", "text": "def urlify(string)\n string.strip.gsub(/ /, '%20')\n end", "title": "" }, { "docid": "0823bb3c370e1032f8085c972e79dbbf", "score": "0.6500949", "text": "def normalize_uri(*strs)\n new_str = strs * \"/\"\n\n new_str = new_str.gsub!(\"//\", \"/\") while new_str.index(\"//\")\n\n # Makes sure there's a starting slash\n unless new_str[0,1] == '/'\n new_str = '/' + new_str\n end\n\n new_str\n end", "title": "" }, { "docid": "7dfc95b2289b87e4131305765ae2c267", "score": "0.64980876", "text": "def fixup_url\n unless @view.app.url.starts_with?('http')\n unless @view.app.url.starts_with?('www')\n @view.app.url = 'www.' << @view.app.url\n end\n @view.app.url = 'http://' << @view.app.url\n end\n @view.app.url\n end", "title": "" }, { "docid": "2eeb92fc4a422fd66e9edb20bc810a7e", "score": "0.6476694", "text": "def URLify(str)\n words = str.split(\" \")\n words.join(\"%20\")\nend", "title": "" }, { "docid": "97dcf7f7e3da145ad468c8d11eae9f74", "score": "0.64689285", "text": "def urlify(string)\n string.downcase.split.join(\"-\")\nend", "title": "" }, { "docid": "2bbbd09dad94509c7f5dc9ba32a9329d", "score": "0.6464132", "text": "def urlify(string)\n string.downcase.split.join(\"-\")\nend", "title": "" }, { "docid": "2b8ea1935faadbd69a32b9f38bcdfad6", "score": "0.64634", "text": "def relative_url(url)\n url.gsub(%r{\\Ahttp://[^/]*}, '')\n end", "title": "" }, { "docid": "8b433245b1289c8f8c1bd87d0c5cbeaf", "score": "0.64581317", "text": "def URLify(string)\n string.chomp.split(' ').join('%20')\nend", "title": "" }, { "docid": "40a233d4a7afa09e9c19c1f070fb5596", "score": "0.64489245", "text": "def urlify(input)\n input.gsub(' ', '%20')\nend", "title": "" }, { "docid": "7a7cdddea40d2b68459d294dc24f2d8b", "score": "0.6423956", "text": "def normalize_uri(*strs)\n new_str = strs * '/'\n new_str = new_str.gsub!('//', '/') while new_str.index('//')\n new_str\n end", "title": "" }, { "docid": "506b39499c3625a8fc21db63d6e3ce06", "score": "0.6423754", "text": "def shorthand_url(input)\n input.gsub /(https?:\\/\\/)(\\S+)/ do\n $2\n end\n end", "title": "" }, { "docid": "506b39499c3625a8fc21db63d6e3ce06", "score": "0.6423754", "text": "def shorthand_url(input)\n input.gsub /(https?:\\/\\/)(\\S+)/ do\n $2\n end\n end", "title": "" }, { "docid": "64c5098e2919ffe2f01c26ee30388dc7", "score": "0.64188135", "text": "def absolutify_url(uri)\n if uri =~ /^\\w*\\:/i\n normalize_url(uri)\n else\n Addressable::URI.join(@url, uri).normalize.to_s\n end\n rescue URI::InvalidURIError, Addressable::URI::InvalidURIError => e\n add_fatal_error \"Link parsing exception: #{e.message}\" and nil\n end", "title": "" }, { "docid": "e6069b6789ceed77d4c4d84ef2d66edc", "score": "0.6417437", "text": "def fix_url\n\t if self.url and not self.url.match(/^(http|https):\\/\\/.*/)\n\t self.url = 'http://' + self.url\n end\n\tend", "title": "" }, { "docid": "306e8c3a060e9d309c188ccdd63ea845", "score": "0.6411932", "text": "def localize_url(url)\n url.gsub(APP_CONFIG['api_base'], \"#{request.protocol}#{request.host_with_port}/entities\") unless url.nil?\n end", "title": "" }, { "docid": "ad20b7903ae157fd48497e38146c0228", "score": "0.64116186", "text": "def urlify(string)\r\n string.downcase.split.join('-')\r\nend", "title": "" }, { "docid": "6838d0d523f3a96db2399d6855e0d5d0", "score": "0.64064234", "text": "def clean\n @url = @url.gsub(/\\s/, '+')\n @url = @url.gsub(/\\+{2,}/, '+')\n end", "title": "" }, { "docid": "c8acea1918f5ea3d567c690ef98bbc2a", "score": "0.64039916", "text": "def cleanup_url(story)\n url = story.url\n domain = NetHelpers.get_url_domain(url)\n url.gsub!(/&?utm_(campaign|source|medium|content)=[^&]*/, '') # get rid of google analytics tracking\n url.gsub!(/\\?$/,'')\n\n if (!@@domains_with_default_fixup_rule.grep(domain).empty?)\n url.gsub!(/\\?.*/, \"\")\n elsif (fixup_rule = @@url_fixup_rules[domain])\n url.gsub!(/#{fixup_rule[:regexp]}/, \"#{fixup_rule[:repl]}\")\n return { :url_changed => true, :reset_title => fixup_rule[:reset_title] } if fixup_rule[:url_changed] \n elsif (url_extraction_rule = @@url_extraction_rules[domain])\n story.url, story.body = NetHelpers.fetch_content(story.url) if story.body.nil? || story.body.empty?\n if story.body =~ url_extraction_rule\n story.url = $1\n return { :url_changed => true, :reset_title => true }\n end\n end\n nil\n end", "title": "" }, { "docid": "d431e47a1452c459091a56674e61610a", "score": "0.63991493", "text": "def normalize_scheme(scheme)\n return \"http\" unless scheme\n scheme.to_s[/^\\w+/]\n end", "title": "" }, { "docid": "59e914e5a45773245729ed41164d327d", "score": "0.6389553", "text": "def urlify(txt=\"Patricia is cool\")\n txt.split.join('%20')\nend", "title": "" }, { "docid": "4772ecd8a9e8cc42360392b2d3d6cf99", "score": "0.6387284", "text": "def normalize_url(path)\n @known_pairs ||= {}\n @public_directories_regex ||= Regexp.new(Bones.public_directories.join('|'))\n \n if v = @known_pairs[path]\n return v\n else\n value = case\n when path =~ /^(\\w{3,}:\\/\\/|mailto)/\n # don't do anything to this type of URL\n return path\n when path =~ @public_directories_regex\n path\n when File.directory?('pages' / path)\n path\n else\n # don't add .html if there's already an extension\n path =~ /\\..+/ ? path : path + '.html'\n end\n \n @known_pairs[path] = options.base / value\n end \n end", "title": "" }, { "docid": "d137636894ed18f91004ec37d0379a1f", "score": "0.6387031", "text": "def parse_url_host\n url = self.url.gsub(/^https?\\:\\/\\//, '')\n url = url.gsub(/www\\./, '') unless (url.match(/www\\./).blank? && url.gsub(/www\\./, '').match(/[A-Za-z]/))\n self.url = \"https://\" + url\n end", "title": "" }, { "docid": "ccdf67c52d338c38c2fe5e0ac3419dfa", "score": "0.6373939", "text": "def urlify(string)\n string.downcase.split.join('-')\nend", "title": "" }, { "docid": "aadd159aab75084a3ee9b0c5e8640b6d", "score": "0.6364809", "text": "def do_url (name)\n name.to_s.downcase.gsub(' ', '_')\n end", "title": "" }, { "docid": "ac775c64950b3a58063755379e6c450f", "score": "0.63622123", "text": "def canonicalize(url)\n return Canonicalize::canonicalize(url)\n end", "title": "" }, { "docid": "dc1edeb2b61ef06ba50290092ee3018f", "score": "0.63610977", "text": "def domain_name(url)\n #url.gsub(/http:|https:|www.|\\/\\/|.com.*/,'')\n url.gsub(/http:|https:|www.|\\/\\//,'').split('.').first\nend", "title": "" }, { "docid": "94c19924edac98e865a787478217665a", "score": "0.63520855", "text": "def normalize_base_uri(str) #:nodoc:\n str =~ /^https?:\\/\\// ? str : \"http#{'s' if str.include?(':443')}://#{str}\"\n end", "title": "" } ]
03fb4796fc68e9328c1d82321152fe58
Permite que se escolha o layout conforme a action chamada
[ { "docid": "a968fc3d9e4866e4ea3d573a79fe6cf6", "score": "0.0", "text": "def get_layout\n case action_name\n when \"index\", \"hero\", \"fluid\", \"starter_template\"\n \"application\"\n else\n \"application\"\n end\n end", "title": "" } ]
[ { "docid": "dcf95c552669536111d95309d8f4aafd", "score": "0.79892313", "text": "def layout_actions\n \n end", "title": "" }, { "docid": "b5b44f3d3154fff27ca28652cb6689bb", "score": "0.72754747", "text": "def action_has_layout?\n false\n end", "title": "" }, { "docid": "0289119dc6dd140dc10ed009cdda5534", "score": "0.7212457", "text": "def layout_check(action = action_name, controller = controller_name)\n if params[:layout] == \"false\"\n render :controller => controller, :action => action, :layout => false\n end\n end", "title": "" }, { "docid": "50944b9cdfe0d88a03c6847cfcbc510c", "score": "0.69220984", "text": "def layout_check(action = action_name, controller = controller_name)\n if params[:layout] == \"false\"\n render controller: controller, action: action, layout: false\n end\n end", "title": "" }, { "docid": "f5c129181c7e2fcb8eceac23f694b2e0", "score": "0.6798825", "text": "def action_has_layout?\n @_action_has_layout\n end", "title": "" }, { "docid": "d1a495b0ea6ccf89a9bf14579a32e806", "score": "0.66755193", "text": "def configure_layout\n ( ['index','show'].include? action_name ) ? 'shop' : 'admin' \n end", "title": "" }, { "docid": "d3f32858d8b635fafcf959705cdd913c", "score": "0.6619272", "text": "def x\n render layout: \"layout2\" #Render, solo afectara a la página X#\n end", "title": "" }, { "docid": "4271eeb901be79eb571e6166fbb2d225", "score": "0.6610029", "text": "def user_change_layout\n #~ if action_name == \"welcome\" || action_name == \"dashboard\" || action_name == \"comm_display\" || action_name == \"multifamily_display\" || action_name == \"dashboard_commercial\"\n if action_name == \"welcome\" || action_name == \"dashboard\" || action_name ==\"comm_display\" || action_name ==\"multifamily_display\" || action_name ==\"dashboard_commercial\" || action_name ==\"dashboard_commercial_leases\" || action_name ==\"notify_admin\"\n 'user'\n elsif action_name == \"set_password\" || action_name == \"verify_password\"\n 'user_login'\n elsif !( action_name ==\"welcome\" || action_name == \"index\" || action_name ==\"new\" || action_name == \"create\" || action_name == \"dashboard\" || action_name == \"set_password\" || action_name == \"verify_password\" || action_name ==\"new_real_portfolio\")\n 'users'\n end\n end", "title": "" }, { "docid": "9747a08c328cf718569f14705b489e2a", "score": "0.6603879", "text": "def layout_action(path)\n if path = @stasis.controller._resolve(path)\n @stasis.action._layout = path\n end\n end", "title": "" }, { "docid": "27191aa78e3d631c37356fd4d3bc4e67", "score": "0.66012245", "text": "def choose_layout\n case action_name\n when \"index\" then \"search\"\n when \"new\" then \"login\"\n else \"\"\n end\n end", "title": "" }, { "docid": "31e3c591a9d3a1aafdd145b4428711be", "score": "0.6547279", "text": "def layout()\n end", "title": "" }, { "docid": "7b7fc3791d942566d8bfd1c3d92663f6", "score": "0.6539939", "text": "def determine_layout\n ['show'].include?(action_name) ? 'application' : nil \n end", "title": "" }, { "docid": "44026aac6459176b658a46a26482e867", "score": "0.65174", "text": "def update_layout; end", "title": "" }, { "docid": "58150a1df7ea727af124fde42efd3db3", "score": "0.64843976", "text": "def choose_layout\n return 'admin' if action_name =='index' \n # return 'users' if action_name==\"new\" || action_name==\"edit\"\n return 'public' if action_name==\"download_spec\" ||action_name==\"download_setup\"\n return \"usercenter\" if action_name==\"center\"\n return 'users'\n end", "title": "" }, { "docid": "0a518dc29c616083597a23b35cee1d38", "score": "0.6476434", "text": "def after_edit\n\t\t\t\trespond_to do |format|\n\t\t\t\t\tformat.html { render layout: \"admin/#{@template_view}/application\" }\n\t\t\t\tend\n\t\t\tend", "title": "" }, { "docid": "e373388b4f6378e7ab6c61db781aac32", "score": "0.6458143", "text": "def coming_soon\n render layout: \"admin\"\n end", "title": "" }, { "docid": "2ed3ae4f87235340975660c93d655d77", "score": "0.64348686", "text": "def determine_layout\n action_name == 'create' ? 'application' : 'dashboard'\n end", "title": "" }, { "docid": "5b85baeb9584167ad6cec78630cc1957", "score": "0.64074", "text": "def set_layout\n if params[:form] == \"insert\"\n self.class.layout \"image\"\n else\n self.class.layout \"dashboard\"\n end\n \n \n end", "title": "" }, { "docid": "06868c4049770ca18abbc45e2164d65e", "score": "0.6359222", "text": "def layout_selection\n case params[:action]\n when \"new\",\"create\"\n return \"login_layout\"\n else\n return \"application\"\n end\n end", "title": "" }, { "docid": "5c8ddc27434e301b8cb8185dfda43cdf", "score": "0.6331971", "text": "def choose_layout \n if [ 'signup', 'login', 'dashboard' ].include? action_name\n 'betatrek'\n else\n 'application'\n end\n end", "title": "" }, { "docid": "e249e7193d07a07c79468da66d3f54b0", "score": "0.63232625", "text": "def choose_layout\n\t\tif action_name == 'show' || action_name == 'search' || action_name == 'visual_edit'\n\t\t\treturn :content\n\t\telse\n\t\t\treturn :admin\n\t\tend\n\tend", "title": "" }, { "docid": "254573efc4b5ce3d31a198f3b0fca80c", "score": "0.6293447", "text": "def fb_using_action\n\t\trender layout: false\n\tend", "title": "" }, { "docid": "3937f86c5a909a8d5cce5ad60fbe10af", "score": "0.62684536", "text": "def select_layout\n return 'main_layout' if action_name == 'fullview'\n\n is_mobile_or_tablet? ? false : \"view_popup\"\n end", "title": "" }, { "docid": "4b6c865992326b9befadc490155d043d", "score": "0.6188689", "text": "def _conditional_layout?\n return unless super\n\n conditions = _layout_conditions\n\n if only = conditions[:only]\n only.include?(action_name)\n elsif except = conditions[:except]\n !except.include?(action_name)\n else\n true\n end\n end", "title": "" }, { "docid": "6e7a08fb502c0f9eaa7919403626dccd", "score": "0.6182138", "text": "def choose_layout\n # this for making the avatar upload work with iframe\n [\"profile_overview_avatar_in_place\"].include?(action_name) ? false : super\n end", "title": "" }, { "docid": "34e10addb62fec16eeeef8b46b8b304d", "score": "0.6173295", "text": "def form_layout?\n form_actions_for('organisations') ||\n form_actions_for('customers') ||\n (params[:controller] == 'organisations' &&\n (params[:action] == 'new_customer' || params[:action] == 'create_new_customer'))\n end", "title": "" }, { "docid": "05bb90c333b5e2ada8aeb871492e1de3", "score": "0.6153421", "text": "def layout_page\n raise\n end", "title": "" }, { "docid": "74a63bfd550d41654fb51e2c0543037c", "score": "0.61504346", "text": "def _layout; end", "title": "" }, { "docid": "6510ad7558eeabc4b6d5848feacbdeec", "score": "0.6140844", "text": "def show\n\n render :layout => (params[:nolayout]) ? false : true \n\n end", "title": "" }, { "docid": "74b4994fff2e6be67ad155b47ce5130f", "score": "0.6121972", "text": "def choose_layout\n return 'login' if action_name == 'login'\n 'application'\n \n end", "title": "" }, { "docid": "688eafd505bd16a690b3c5413f1c95fd", "score": "0.60986865", "text": "def bookingcom_update\n render :layout => 'admin/layouts/no_left_menu'\n end", "title": "" }, { "docid": "3798ad4c4777ff911b87c83c61594ac5", "score": "0.6096002", "text": "def maintenance\n render action: \"maintenance\", layout: false\n end", "title": "" }, { "docid": "3798ad4c4777ff911b87c83c61594ac5", "score": "0.6096002", "text": "def maintenance\n render action: \"maintenance\", layout: false\n end", "title": "" }, { "docid": "bd11f2879ed761904e1c067af0762cbe", "score": "0.6086791", "text": "def maintenance\n render layout: 'basic'\n end", "title": "" }, { "docid": "679230aa3a83f0d4b4395f181592eee3", "score": "0.60834867", "text": "def layout_edit\n @oldlayout = Content.find_by(\"type_of_content = ? AND active = ?\", \"layout\", true)\n if @oldlayout\n @oldlayout.active = false\n if @oldlayout.save\n else\n end\n end\n\n @layout = Content.new(layout_params)\n @layout.active = true\n @layout.type_of_content = \"layout\"\n\n if @layout.save\n redirect_to :back\n else\n redirect_to '/admin/content'\n end\n\n end", "title": "" }, { "docid": "49189f3201618243469b29eee91ebd39", "score": "0.60824096", "text": "def dashboard_4\n render :layout => \"layout_2\"\n end", "title": "" }, { "docid": "d8b739bc07764e43cb268dfb7053a5ab", "score": "0.60693765", "text": "def set_layout \n if @current_user.admin?\n render :layout => 'admin'\n else\n render :layout => 'application'\n end\n end", "title": "" }, { "docid": "282c5a1b3a2f859a87ac863d3ed17eee", "score": "0.6060506", "text": "def edit\n render layout: 'centered'\n end", "title": "" }, { "docid": "28248087c671d0bde6062d2acb8f86a5", "score": "0.6045185", "text": "def index\n render :action => 'index', :layout => 'admin'\n end", "title": "" }, { "docid": "f0080f08f2090981a990ba64ea4a3ffe", "score": "0.60440946", "text": "def resolve_layout\n\t case action_name\n\t when 'index'\n\t \t'blank'\n\t else\n\t 'application'\n\t end\n\t end", "title": "" }, { "docid": "cb9f0ed709ba78d914259f3721e3e360", "score": "0.60352576", "text": "def use_popup_layout\n @@popup_actions.include?(action_name)\n end", "title": "" }, { "docid": "7e08018dcf74e0cad2d15b58157ef356", "score": "0.60277724", "text": "def edit(*args)\n\t\t layout.edit(*args)[0]\n\t end", "title": "" }, { "docid": "a4e49b22452c505278a6fbd2b103f466", "score": "0.60271347", "text": "def contribute\n \trender layout: \"developer_home_template\"\n end", "title": "" }, { "docid": "53f66be77bcb183f2edc5f0c36142c29", "score": "0.60176635", "text": "def dashboard_4\n render :layout => \"layout_2\"\n end", "title": "" }, { "docid": "2156888a012f4ecc6a4df0f3bfe2c0f4", "score": "0.60140413", "text": "def choose_layout\n if (action_name == \"new\" || action_name == \"show\") && @run.embedded?\n \"taverna_player/embedded\"\n else\n ApplicationController.new.send(:_layout).virtual_path\n end\n end", "title": "" }, { "docid": "c0ea03283748c2bff2cd1e90eb65151f", "score": "0.59977084", "text": "def choose_layout\n if params[:action] == 'edit' or params[:action] =='update' or params[:action] =='change_password'\n 'users/default'\n else\n 'public/default'\n end\n end", "title": "" }, { "docid": "ba8f9a614f5c974c36f64dd84f0ddc44", "score": "0.5991399", "text": "def show\n @layout = \"application\"\n end", "title": "" }, { "docid": "1fe8d1aa3ea67cdb831fb16f2186b200", "score": "0.59727114", "text": "def simple_layout?\n render :layout => 'simple' if params[:simple_layout]\n end", "title": "" }, { "docid": "f1eeb9b219c3c1f68d9749312331768c", "score": "0.5965292", "text": "def edit\n render layout: false\n end", "title": "" }, { "docid": "6afef982c42420348c7ed0d3a8ae82f9", "score": "0.59636706", "text": "def layout\n nil\n end", "title": "" }, { "docid": "4ce596d73ba86570e52b2807d7193ced", "score": "0.59509", "text": "def new \n # config de layout \n @layout = Array.new \n @layout[0] = \"funcionario\" \n @layout[1] = \"Novo Funcionário\" \n @layout[2] = \"slogan\" \n @layout[3] = \"Cadastro de novo funcionario\" \n @layout[4] = \"\"\n @layout[5] = \"/adm/usuarios/search\" #busca_url\n\n @adm_usuario = Adm::Usuario.new\n @areas = Area.all\n @permissao_item = PermissaoItem.order(\"cod_acesso ASC\").all\n \n respond_to do |format| \n format.html # new.html.erb \n format.xml { render :xml => @adm_usuario }\n end \n end", "title": "" }, { "docid": "3ddd5655dbc015959c544139ade80685", "score": "0.5929043", "text": "def resolve_layout\n case action_name\n when \"please_activate\"\n \"short_message\"\n when \"forgot_password_email\"\n \"short_message\"\n when \"reset_password_email\"\n \"short_message\"\n else\n \"login\"\n end\n end", "title": "" }, { "docid": "a361c47c4d17751bb88faf6972d0292b", "score": "0.59249985", "text": "def action_view\n end", "title": "" }, { "docid": "4501a9a5fbc7b5d64ad0b64e49a2e9c9", "score": "0.5922679", "text": "def set_layout\n case action_name\n when 'badbrowser'\n 'badbrowser'\n when 'main'\n 'main'\n else\n 'application'\n end\n end", "title": "" }, { "docid": "63c6dfc1f0e9b15b60ecabfa49f86cda", "score": "0.5915607", "text": "def home\n\t\trender layout: false\n\tend", "title": "" }, { "docid": "4eb5ee317296368cd4a5834f612892d7", "score": "0.5906485", "text": "def show\n render action: \"show\", layout: \"admin\"\n end", "title": "" }, { "docid": "3fc2df509b422b6146a1915077ef9d46", "score": "0.58953625", "text": "def sub_layout\n 'empty'\n end", "title": "" }, { "docid": "37af34da99b22da6f3881af362a0a15e", "score": "0.58746195", "text": "def define_layout\n if self.is_a?(Devise::SessionsController) || self.is_a?(Devise::PasswordsController) || (self.is_a?(Devise::RegistrationsController) && (self.action_name == 'new' || self.action_name == 'create') )\n \"simple\"\n else\n \"application\"\n end\n end", "title": "" }, { "docid": "45a67a17e3826a80850f642cf1ff6fc9", "score": "0.5873144", "text": "def modul_a_1\n render layout: 'narrow1'\n end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5869256", "text": "def actions; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5869256", "text": "def actions; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5869256", "text": "def actions; end", "title": "" }, { "docid": "84e948439a68ce90e1abf1fb40ff4bbb", "score": "0.58628017", "text": "def request_home\n render layout: 'general_view'\nend", "title": "" }, { "docid": "1c3efbbc2958848e25bf7088a95f09bb", "score": "0.584725", "text": "def company\n render 'company', layout: 'homeEmpresa'\n end", "title": "" }, { "docid": "b5dcd6c7cabaee3a622b39774bf2dead", "score": "0.58462745", "text": "def edit_by_employee\n render :layout => false\n end", "title": "" }, { "docid": "70c21d7df0212762def10131234f4a3d", "score": "0.5829097", "text": "def contacto\n render :layout => \"contacto\" \n end", "title": "" }, { "docid": "1eab42754c40ed2bc30f52027ab41dc9", "score": "0.58255225", "text": "def view(page, *)\n rails_render(action: page.tr(\"-\", \"_\"), layout: true) ||\n rails_render(html: super.html_safe, layout: true)\n end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.5821349", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.5821349", "text": "def action; end", "title": "" }, { "docid": "fc33da0c8a77b507b9696c89e1425bef", "score": "0.5818829", "text": "def layout_setup\n\t\t@tab = :login\n\tend", "title": "" }, { "docid": "0e1590cab401248303cb6a61ced9e81c", "score": "0.58083314", "text": "def edit\n @lifecycle_phase = LifecyclePhase.find(params[:id])\n respond_to do |format|\n if(params[:no_layout] == \"true\")\n @no_layout = true\n format.html { render :layout => false}\n else\n format.html # show.html.erb\n end\n end\n end", "title": "" }, { "docid": "fdb4b73a4babe715d94c5c376e8e1ffc", "score": "0.58031875", "text": "def remove_layout_for_action(action)\n self.class_variable_get(\"@@widgets_list\") << action.to_sym\n self.layout :false, :only => self.class_variable_get(\"@@widgets_list\")\n end", "title": "" }, { "docid": "957101d624a55d93eb1c42c0b8edfc5d", "score": "0.5802287", "text": "def adjust_action\n if params[:action] == 'index' and @section.try(:single_article_mode)\n # ... but only if there is one published article\n unless @section.articles.blank? || (@section.articles.first.draft? && !has_permission?('update', 'section'))\n @action_name = @_params[:action] = request.parameters['action'] = 'show'\n end\n end\n end", "title": "" }, { "docid": "cb0a87ecc0b6db2d911e634607e33831", "score": "0.5798975", "text": "def show\n #self.class.layout(@page.layout_name || 'application')\n end", "title": "" }, { "docid": "761b797addc4c204283aec6e14a351ac", "score": "0.57954323", "text": "def edit\n render :layout=>\"new/application\"\n end", "title": "" }, { "docid": "cce5b9b6ad7725b3256ec651409dba55", "score": "0.579115", "text": "def appraisal\n render layout: false\n end", "title": "" }, { "docid": "5c36ec20fb7359a7fc231f7c3b18dae5", "score": "0.5778417", "text": "def show\n render :layout => 'layout_exp'\n end", "title": "" }, { "docid": "70b78a6031b9533d2f1501f93f4a1596", "score": "0.5774156", "text": "def action?\n not render?\n end", "title": "" }, { "docid": "90df65334e9f9584901eec96be4ad64d", "score": "0.57682043", "text": "def kiosk\n render layout: 'compact'\n end", "title": "" }, { "docid": "7898987f76affe14cea98854b2e18167", "score": "0.5767741", "text": "def new\n render :layout => 'admin'\n end", "title": "" }, { "docid": "7cdb9a33c6668488b2ce6087f69380ef", "score": "0.5767175", "text": "def contact\n render layout: false\n end", "title": "" }, { "docid": "c66b24c6de0bb6f951b2167b1e658941", "score": "0.5765687", "text": "def action_run\n # This space left intentionally blank.\n end", "title": "" }, { "docid": "7764a396a68f0d13953287d9c46d4032", "score": "0.5754164", "text": "def show\n# render layout:false\n end", "title": "" }, { "docid": "2bfbd21af4eb814809b054ad5892c50a", "score": "0.57529235", "text": "def family\n render layout: false\n end", "title": "" }, { "docid": "3053d8e6b52a85417cb66dd6d62039c3", "score": "0.57503814", "text": "def show\r\n render :layout => 'admin/layouts/application'\r\n end", "title": "" }, { "docid": "8957187ffe4574fdb30929b3741dee2d", "score": "0.5747546", "text": "def show\n #render :layout => false\n end", "title": "" }, { "docid": "67d01c1b5775a36a3ae8885a934726c9", "score": "0.5745923", "text": "def help\n render :partial => \"help\", :layout => false\n end", "title": "" }, { "docid": "4d052e7d378687925aa817b1845148c8", "score": "0.5744813", "text": "def show\n render :action => 'show', :layout => false\n end", "title": "" }, { "docid": "4d052e7d378687925aa817b1845148c8", "score": "0.5744813", "text": "def show\n render :action => 'show', :layout => false\n end", "title": "" }, { "docid": "143b678f3c32b5d7fef8241edb771669", "score": "0.57419395", "text": "def resolve_layout\n case action_name\n when 'index'\n 'dashboard'\n else\n 'application'\n end\n end", "title": "" }, { "docid": "a80b33627067efa06c6204bee0f5890e", "score": "0.5739611", "text": "def actions\n\n end", "title": "" }, { "docid": "6ee18eaf13bbea681c1c975310b70daa", "score": "0.5736607", "text": "def add_flag\n\t\trender layout: false\n\tend", "title": "" }, { "docid": "ba1917884009c4c493274be804175c27", "score": "0.57349926", "text": "def resolve_layout\n if action_name == \"about\"\n \"application\"\n end\n end", "title": "" }, { "docid": "99b280f0ac8f6173272a4ecbe7172d62", "score": "0.5732941", "text": "def show\n render layout: 'admin_view'\n end", "title": "" }, { "docid": "753819ad12a8372e5eba826da8ebb044", "score": "0.5730707", "text": "def edit_modal\n render 'edit', :layout => nil\n end", "title": "" }, { "docid": "4f703681d1a19fb59ada7d5f3cc94edb", "score": "0.57280135", "text": "def default_render\n render :action => default_action and return if\n %w(edit new).include? controller.action_name\n super\n end", "title": "" }, { "docid": "c327dc1d09722c97aaec9f8485c8e48e", "score": "0.57204", "text": "def give_da_layout \n\t\tif params[:action] == 'forgot_password' || params[:action] == 'reset_password'\n\t\t\tif logged_in?\n\t\t\t\treturn get_current_layout\n\t\t\telse\n\t\t\t\treturn 'login'\n\t\t\tend\n\t\telse\n\t\t\treturn get_current_layout\n\t\tend\n\tend", "title": "" }, { "docid": "c327dc1d09722c97aaec9f8485c8e48e", "score": "0.57204", "text": "def give_da_layout \n\t\tif params[:action] == 'forgot_password' || params[:action] == 'reset_password'\n\t\t\tif logged_in?\n\t\t\t\treturn get_current_layout\n\t\t\telse\n\t\t\t\treturn 'login'\n\t\t\tend\n\t\telse\n\t\t\treturn get_current_layout\n\t\tend\n\tend", "title": "" }, { "docid": "407c662093369bf28e76f056ca5ae202", "score": "0.57190067", "text": "def show\n # @open_or_edit=\"open\"\n render \"/website_layouts/\" + @template.template_name + \"/index.html\", :layout => \"layout_themes\"\n end", "title": "" }, { "docid": "4e1d7cbf656487587936d78a00fae389", "score": "0.5718342", "text": "def choose_layout\n 'users/login'\n end", "title": "" }, { "docid": "ad997b2137d7ce2e53934ace1bcca5ca", "score": "0.57162786", "text": "def show\n render :layout => false\n end", "title": "" } ]
a4f4118b597184e73b705a860b1d698f
Returns the sum of the first n prime numbers ==== Attributes +n+ How many primes will be generated and summed. ==== Examples Sum the first 1000 prime numbers increment the action_count by 1 sum_of_primes(1000) => 3_682_913
[ { "docid": "d700a95cbb6814fe5cfd362b3293f593", "score": "0.82358795", "text": "def sum_of_primes(n)\n Prime.first(n).inject(0, :+)\nend", "title": "" } ]
[ { "docid": "b88f0abd01813c8cec30628f66e6b02d", "score": "0.78341544", "text": "def sum_prime(n)\n\ti = 0\n\tp = 1\n\tsum = 0\n#\tprimes = []\n\n\tuntil p == n\n\t\tp += 1\n\t\tif is_prime?(p)\n#\t\t\tprimes << p\n\t\t\tsum += p\n\t\t\ti += 1\n\t\tend\n\tend\n\n\treturn sum\n\t#return primes.reduce(:+)\nend", "title": "" }, { "docid": "b3bb5fc4a6165f89e7c9fae346c726ff", "score": "0.7771278", "text": "def sum_of_primes(n)\n prime_array = []\n (2..n).each do |i|\n next unless prime_number?(i)\n prime_array << i\n end\n prime_array.inject(:+)\nend", "title": "" }, { "docid": "f111cbb5b77824c2c8a3c1d084da8ff4", "score": "0.77625704", "text": "def sum_of_all_primes(n)\n sum = 0\n (1..n).each do |x|\n if prime? x\n sum += x\n end \n end \n sum\n end", "title": "" }, { "docid": "b57afe8756ab8ce9f4f78e6d28d05dfe", "score": "0.7694965", "text": "def sum_n_primes(n)\n primes = []\n i = 2\n while primes.size < n\n primes << i if prime?(i)\n i += 1\n end\n primes.sum\nend", "title": "" }, { "docid": "08c167720e388c452610e2ccb5aec0bf", "score": "0.7650972", "text": "def sum_n_primes(n)\n return 0 if n == 0\n sum = 0\n primes = []\n i = 2\n until primes.length == n\n #\n if prime?(i)\n sum += i\n primes << i #corrected primes counting. was adding i each time before\n end\n i += 1\n end\n sum\nend", "title": "" }, { "docid": "e11dfb4018ac61963eb65cc8dcdb12db", "score": "0.74597657", "text": "def sum_of_primes_below(n)\n sum = 0\n require 'prime'\n Prime.each(n) do |prime|\n sum += prime\n end\n\n sum\nend", "title": "" }, { "docid": "02c0bd8dbc4f79513bec4beebdc1afba", "score": "0.7280681", "text": "def summation_of_primes(n)\n sum, flags = 2, []\n\n 0.upto(n / 2) { flags.push(false, true) }\n\n i = 3\n until i * i > n\n (i * i).step(n, i) { |k| flags[k] = false } if flags[i] == true\n i += 1\n end\n\n 3.upto(n) { |j| sum += j if flags[j] == true }\n\n sum\nend", "title": "" }, { "docid": "19ee76aeff55770a16ec0535c2950d04", "score": "0.7144421", "text": "def prime_sum(limit)\n Prime.each(limit).inject :+\n end", "title": "" }, { "docid": "a544d90cb5d9ae520380f44a8f59046a", "score": "0.7114627", "text": "def sum_prime(num)\n sum_prime = 0\n prime_list = sieves_primes(num)\n prime_list.each do |p|\n sum_prime += p\n end\n puts \"The sum of prime numbers below #{num} is #{sum_prime}\"\nend", "title": "" }, { "docid": "626309eeda4ad088c7df2d25876eb576", "score": "0.7041146", "text": "def primesum(n)\n sum = 5\n i = 1\n until (6*i + 1 > n) do\n sum += (6*i + 1) if (6*i + 1).prime?\n sum += (6*i - 1) if (6*i - 1).prime?\n i += 1\n end\n sum\nend", "title": "" }, { "docid": "2e749654c98c096091b46dff5c55684b", "score": "0.7026674", "text": "def prime_sum(n)\n sum = 0\n\n # when using the wrapper, the tracer is available through OpenTracing.global_tracer\n # to do more granular instrumentation\n OpenTracing.global_tracer.start_active_span(\"calculate_sum\") do |scope|\n primes = sieve(n)\n sum = primes.reduce( :+ )\n scope.span.set_tag(\"sum\", sum)\n end\n sum\nend", "title": "" }, { "docid": "35f9a2f7437c5d90ba4a72e736df3a68", "score": "0.6988928", "text": "def primes_sum\n primeArr = []\n num = 2\n while num < 2000000\n if is_prime num\n primeArr << num\n end\n num += 1\n end\n primeArr.reduce(:+)\nend", "title": "" }, { "docid": "0a86b757a2a57105b2cdcd425a497704", "score": "0.69323504", "text": "def summation_of_primes(limit)\n primes = [2]\n accum = 3\n\n while primes[primes.length - 1] < limit\n\n if primes.all?{|ele| accum % ele != 0}\n primes << accum\n end\n accum += 2\n\n end\n primes.pop\n # p primes\n sum = primes.reduce(:+)\n sum\nend", "title": "" }, { "docid": "f0dc77e6efc2ddb4b1da06355e9585f6", "score": "0.69298756", "text": "def sum_of_all_primes(limit)\n list_of_all_numbers = (2..limit).to_a #create a list of numbers from 2 to limit\n primes = get_primes(list_of_all_numbers)\n\n puts \"Primes #{primes}\"\n puts \"Sum of all primes #{primes.sum}\"\nend", "title": "" }, { "docid": "2a96e096960c76349c1ebd24c80ff8da", "score": "0.6918909", "text": "def sumPrimes\n i = 1999999\n sum = 2\n \n # note that this code will never count 2 as prime simply because it never tests 2. \n # For eficiency, it skips all evens, inadvertently skips 2. \n # make a better fix later. for now, initialize sum to 2. \n # was written in reverse order to check if 2 was counted as prime\n while i > 0\n if isPrime(i)\n puts i \n sum += i\n end\n i -= 2\n end\n \n return sum\n \nend", "title": "" }, { "docid": "c7c93f1b898e670acc6ce0e43600de6d", "score": "0.68963486", "text": "def sum_of_primes(limit)\n answer = 0\n\n Prime.each(limit) do |i|\n answer += i\n end\n puts answer\nend", "title": "" }, { "docid": "bf683872a7b1f43360d5cd76c473a391", "score": "0.6817933", "text": "def getSumPrime()\n def isPrime(n)\n return false if n <= 1\n 2.upto(Math.sqrt(n).to_i) do |x|\n return false if n%x == 0\n end\n true\n end\n\n sum=0\n (2..2000000).each { |x| sum=sum+x if isPrime(x) }\n puts sum\nend", "title": "" }, { "docid": "bad4edc609b31f65d08fdfd9e1ce5aaf", "score": "0.67125714", "text": "def summation_of_primes(num)\n\n\tsum = 2 # sum of all the primes\n\tctr = 3 # current number counter, increase by 1 for each loop through the while clause\n\n\twhile ctr < num\n\t\tis_prime = true\n\t\tfor i in 2..(ctr-1)\n\t\t\t# puts \"CTR: #{ctr}\"\n\t\t\t# puts \"I: #{i}\"\n\t\t\tis_prime = false if ctr % i == 0\n\t\tend\n\t\tif is_prime\n\t\t\tsum += ctr\n\t\t\t# puts \"The current sum is #{sum}\"\n\t\tend\n\t\tctr += 1\n\tend\t\n\n\t\"The sum is #{sum}\"\n\nend", "title": "" }, { "docid": "b13ae4ebcb5ec25a91ab12d983de36af", "score": "0.6702227", "text": "def count_primes(n)\n return 0 if n == 0 || n == 1 || n == 2 \n \n count = 0\n \n (2..n - 1).each do |num| \n count += 1 if is_prime(num)\n end\n \n count\nend", "title": "" }, { "docid": "c19a2c20b37213caed0f22c10c4d4764", "score": "0.661679", "text": "def add_primes_upto(max)\n primes = [2, 3]\n primes_index = 1\n sum = 2 + 3\n\n 5.step(max, 2).each do|current_number|\n val_is_prime = true\n primes.each do|prime|\n if prime > Math.sqrt(current_number).to_i\n break\n elsif current_number % prime == 0 then\n val_is_prime = false\n break\n end\n end\n if val_is_prime && current_number < max then\n primes_index = primes_index + 1\n primes[primes_index] = current_number\n sum = sum + current_number\n end\n end\n return sum\nend", "title": "" }, { "docid": "3bf73d6cb732fd6387e4b88fd4a1b6a9", "score": "0.6615789", "text": "def sum_primes max_number\n sum = 2\n (3..max_number).each do |test_num|\n next if test_num.even?\n prime = true\n # sqrttest = test_num**0.5\n (2..Math.sqrt(test_num)).each do |factor|\n prime = false if (test_num % factor == 0)\n break unless prime\n end\n sum += test_num if prime\n #puts test_num if prime\n end\n return sum\nend", "title": "" }, { "docid": "25306ca276f9b41f11d9528d20db63a4", "score": "0.6613551", "text": "def prime_summation(n)\n num_arr = Array.new(n, 0)\n for i in (2..n) do\n # check if already hasn't been marked\n if i != 1\n num_squared = i**2\n for j in(num_squared..n) do\n num_arr[j] = 1 if j % i == 0\n end\n else\n next\n end\n end\n # instead of summing by index, we could initialize the array with the numbers\n # from 0 to n. Currently we are initialzing with 0.\n sum = 0\n for k in (2..(num_arr.length)) do\n if(num_arr[k] == 0)\n sum += k\n end\n end\n sum\nend", "title": "" }, { "docid": "219751e4f9db1a7744f8ba67f020be8e", "score": "0.66131914", "text": "def summation_of_primes_2(max)\n sieve = Array.new(max, true)\n sieve[0] = sieve[1] = false # 0 and 1 aren't primes\n sum = 0\n\n p = 2\n while p < sieve.size\n # Mark all composites off\n k = 1\n while k * p < max\n sieve[k * p] = false\n k += 1\n end\n\n sum += p\n\n # Find next prime\n while !sieve[p] and p < sieve.size\n p += 1\n end\n end\n\n sum\nend", "title": "" }, { "docid": "bb2f98d1871c44adc8138e7d4baac890", "score": "0.6575598", "text": "def sum_primes(upper_bound)\r\n Prime.each(upper_bound).inject(:+)\r\nend", "title": "" }, { "docid": "549ac5140ab25950ad847bb00df859b7", "score": "0.65655106", "text": "def problem10()\n\tsum = 0; Prime.each(2000000) {|i| sum += i}; return sum\nend", "title": "" }, { "docid": "cfcb05d042dd6dc7994048639df41250", "score": "0.6548711", "text": "def p10\n\tprimes = []\n\tPrime.each do |prime|\n\t\tbreak if prime >= 2000000\n\t\tprimes << prime\n\tend\n\t# puts primes\n\tprimes.reduce(:+)\nend", "title": "" }, { "docid": "ef2d07cc1aabef85753ef65cec2f39d3", "score": "0.65265983", "text": "def sum_of_primes(upper_bound)\n Prime.each(upper_bound).reduce(:+)\nend", "title": "" }, { "docid": "88c392816c5d276ac038de506584f342", "score": "0.64701474", "text": "def summation(max)\n\tsum = 0\n\tcounter = 2\n\twhile counter < max\n\t\tp \"counter is #{counter}\"\n\t\tif isprime?(counter)\n\t\t\tsum += counter\n\t\tend\n\t\tcounter += 1\n\tend\n\treturn sum\nend", "title": "" }, { "docid": "f07257d964c16f7c26c6cc7a7ae0af37", "score": "0.64496964", "text": "def prime(nth_prime)\n n = 0\n prime = 1\n primes = []\n while( n < nth_prime )\n prime += 1\n prime_found = true\n # refactor to use a helper\n (2..( prime-1 ) ).each do |num|\n prime_found = false if prime % num == 0\n break unless prime_found\n end\n if prime_found\n primes << prime\n n+=1\n end\n end\n primes.reduce(:+)\nend", "title": "" }, { "docid": "f7bd8cde2be19ac3b25ce61736f705da", "score": "0.6411005", "text": "def sum_primes(num)\n nums = Hash.new{true}\n\n (2...num**(0.5)).each do |x|\n if nums[x]\n i = x\n while x*i < num\n nums[x*i] = false\n i += 1\n end\n end\n end\n \n sum = 0\n (2...num).each { |x| sum += x if nums[x] }\n sum\nend", "title": "" }, { "docid": "53ceb72e95e3ba754f695b6aee1afd38", "score": "0.6410559", "text": "def nth_prime(n)\n count = 2\n prime_count = 0\n prime = 2\n while prime_count < n\n if prime? count \n prime = count\n prime_count += 1\n end\n count += 1\n end\n prime\n end", "title": "" }, { "docid": "9695e20c7c48ff6d967dc5fd544c33f0", "score": "0.63677853", "text": "def primes(n)\nend", "title": "" }, { "docid": "10586bf54f408194268646f26aeedf6a", "score": "0.6342344", "text": "def num_primorial(n)\n return 2 if n == 1\n arr = [2]\n current = 3\n loop do \n if is_prime(current)\n arr << current\n end\n break if arr.length == n\n current += 2\n end\n arr.reduce(:*)\nend", "title": "" }, { "docid": "7d47ad09637d72ebd98d8a6a90871bc8", "score": "0.6319695", "text": "def count(n)\n sum = 1\n n.prime_division.each do |x|\n sum *= (x[1] + 1)\n end\n sum\n end", "title": "" }, { "docid": "89655ea584f4a81139a4b6648e1ca75b", "score": "0.63095784", "text": "def sum_primes_below(target)\n prime_sum = 0\n (2..target).each do |i|\n if is_prime?(i)\n prime_sum += i\n end\n end\n\n prime_sum\nend", "title": "" }, { "docid": "10158c48315d7a0c71038601c9132e0b", "score": "0.63023895", "text": "def sieve(n)\n primes = nil\n\n OpenTracing.global_tracer.start_active_span(\"sieve\") do |scope|\n # don't really want the first two, but matching index to value makes it easier\n primes = [*0..n]\n primes[0] = nil\n primes[1] = nil\n\n for x in primes do\n next if x.nil? # already marked as composite, skip to the next one\n\n # find all the composites from this number and make them nil\n (2*x..n).step(x) do |c|\n primes[c] = nil\n end\n end\n\n # remove the nils from the array\n primes = primes.compact\n\n # tag the number of primes found\n scope.span.set_tag(\"primes.count\", primes.count)\n end\n\n primes\nend", "title": "" }, { "docid": "e1ff6372a81f22e263c11c5357fa840d", "score": "0.62959075", "text": "def sum_primes(prime)\n sum_prime = [0]\n (1..prime.length).each do |i|\n sum_prime << prime[i-1] + sum_prime[i-1]\n end\n sum_prime\nend", "title": "" }, { "docid": "88fae916de4624ea1d76303d48374487", "score": "0.62957406", "text": "def count_primes(n)\n mark = [false] * (n + 1)\n counter = 0\n for i in 2...n\n next if mark[i] == true\n counter += 1\n (i * i).step n, i do |j| mark[j] = true end\n end\n counter\nend", "title": "" }, { "docid": "943b62e3403653f0584085e9bce0abfc", "score": "0.62776786", "text": "def count_primes(n)\n primes = (0..n).to_a\n primes[0] = nil\n primes[1] = nil\n\n primes.each do |current_num|\n next if current_num == nil\n break if current_num > Math.sqrt(n)\n (current_num**2).step(n, current_num) { |interval| primes[interval] = nil }\n end\n\n primes.compact.take_while { |num| num < n }.size\nend", "title": "" }, { "docid": "b084eedd698ae37029976ad61edeb005", "score": "0.62685335", "text": "def nth_prime(n)\n\nend", "title": "" }, { "docid": "0436822f2945b03aebd812da8706683b", "score": "0.6261651", "text": "def problem_ten\n Prime.instance.each(2_000_000).reduce(&:+)\n end", "title": "" }, { "docid": "382443a795ad243b210f9619495f4ba8", "score": "0.6256614", "text": "def get_nth_prime(n)\n\t\tunless n > 0 \n\t\t\traise 'Expected a positive integer'\n\t\tend\n\n\t\treturn @primes[n - 1] if @primes[n - 1]\n\t\t \n\t\t# Only check the odd numbers\n\t\ttemp = @primes.last + 2\n\t\t \n\t\twhile @primes.size < n\n\t\t\t@primes.push temp if is_prime?(temp)\n\t\t\ttemp += 2\n\t\t end\n\t\t\n\t\treturn @primes.last\n\tend", "title": "" }, { "docid": "07480fcadb946928c1984bc7d02d06cd", "score": "0.62517655", "text": "def first_n_primes(n)\n\t return \"n must be an integer.\" unless n.is_a? Integer\n\t return \"n must be greater than 0.\" if (n<=0)\n\n prime_array||=[]\n\tprime = Prime.new\n\tn.times {prime_array << prime.next } \n\tprime_array\nend", "title": "" }, { "docid": "d8ec01d41d8bc1303844934cc6ba4f62", "score": "0.62369955", "text": "def solution_1\n starting_time = Time.now\n\n total = 0\n\n all_primes(MAX_NUM).each { |prime| total += prime }\n\n p \"Sum of first #{MAX_NUM} primes: #{total}\"\n p \"In #{Time.now - starting_time} seconds\"\nend", "title": "" }, { "docid": "43410016d3c04fb3fd5cf1dbdc8fd3a4", "score": "0.6225882", "text": "def ten\n acc = 0\n (find_primes_below 2000000).each do |i|\n acc = acc + i\n end\n return acc \nend", "title": "" }, { "docid": "f51948424b5efe6288992d3e6f3ec215", "score": "0.6193011", "text": "def first_n_primes(n)\n\n return \"n must be an integer.\" unless n.is_a? Integer\n return \"n must be greater than 0.\" if n <= 0\n \n prime_array ||= []\n \n prime = Prime.new\n n.times {\n prime_array << prime.next \n }\n prime_array\nend", "title": "" }, { "docid": "fb6547419094dddfa6c4e9733cc51353", "score": "0.617442", "text": "def first_n_primes(n)\n\n \"n must be an integer.\" unless n.is_a? Integer\n\n \"n must be greater than 0.\" if n <= 0\n \n prime_array ||= []\n \n prime = Prime.new\n n.times { prime_array << prime.next }\nend", "title": "" }, { "docid": "5666ab1860b988b5db5863b7d2fa7e2c", "score": "0.6158923", "text": "def count_primes_fast(n)\n is_prime = [false, false]\n (2...n).each do |x|\n is_prime[x] = true;\n end\n\n tail = Math.sqrt(n).ceil\n for i in 2..tail\n next if !is_prime[i]\n (i*i...n).step(i) do |j|\n is_prime[j] = false\n end\n end\n\n count = 0\n for k in 0...n\n count += 1 if is_prime[k]\n end\n count\nend", "title": "" }, { "docid": "d16756ab5c3727d774b9abfaedad23f8", "score": "0.614789", "text": "def primes\n\t\t# primes = []\n\t\t# primes << 2\n\t\tprimes = [2] # combined previous two lines\n\t\tx = 3\n\n\t\tloop do\n\t\t\tbreak if primes.length == @n_primes # End loop when desired number has been calculated\n\t\t# while primes.length < @n_primes # Alternative 1 to loop do, break\n\t\t# until primes.length == @n_primes # Alternative 2 to loop do, break\n\t\t\ty = 3\n\t\t\ty += 2 until x % y == 0 # Loop to test if x is divisible by any odd number below it, y\n\t\t\tprimes << x if x == y # If the (odd) number was not divisible by any (odd) below itself, it is a prime\n\t\t\tx += 2\n\t\tend\n\n\t\treturn primes\n\tend", "title": "" }, { "docid": "2ceac132e63ab1f849c1aed9099b55ee", "score": "0.6121051", "text": "def compute_primes\n nums = (@max_checked..@max_checked * 2).map { |x| x.odd? ? x : nil }.to_a\n 1.upto(@primes.index { |p| p * p > @max_checked * 2 }) do |i|\n start_idx = -@max_checked % @primes[i] # prime[i]'s 1st multiple's index\n\n (start_idx..nums.size).step(@primes[i]) { |x| nums[x] = nil }\n end\n @max_checked *= 2\n @primes += nums.compact\n end", "title": "" }, { "docid": "4ee34950700e56284334186d71e877f6", "score": "0.6107678", "text": "def prime(n)\n\tif $primes[n] then\n\t\t$primes[n]\n\telse\n while n - $primes.length > 100\n prime (n + $primes.length) / 2\n end\n\t\tc = prime(n-1) + 2\n\t\ti = 1\n\t\twhile $primes[i]**2 <= c\n\t\t\tif c % $primes[i] == 0\n\t\t\t\tc += 2\n\t\t\t\ti = 1\n\t\t\telse\n\t\t\t\ti += 1\n\t\t\tend\n\t\tend\n\t\t$primes[n] = c\n\tend\nend", "title": "" }, { "docid": "6c4329cc2ccdaf653e2b805f733333ad", "score": "0.61001605", "text": "def total_consecutive_primes(number)\n\treturn -1 if !is_prime(number)\n\tleft = 0\n\tright = 0\n\tsum = $primes[0]\n\twhile true\n\t\tbreak if right == $primes.size - 1 and sum < number\n\t\tif sum < number\n\t\t\tright+=1\n\t\t\tsum += $primes[right]\n\t\tend\n\t\tif sum > number\n\t\t\tsum -= $primes[left]\n\t\t\tleft += 1\n\t\tend\n\t\tbreak if right == $primes.size and sum < number\n\t\tbreak if sum == number\n\tend\n\treturn right - left + 1 if sum == number\n\treturn -1\nend", "title": "" }, { "docid": "def489fd484d38eee5224e0d9d2090c2", "score": "0.6097623", "text": "def next_prime\n if !@primes.include?(FIRST_PRIME)\n @primes << FIRST_PRIME\n return FIRST_PRIME\n end\n\n # if not met the sieve only contains prime numbers\n # so we do not need to filter any further\n if @p < Math.sqrt(@max)\n # remove any multiples of p from the sieve\n @sieve = @sieve.select {|n| n % @p != 0 }\n end\n # increment p to the next value in the sieve\n @p = @sieve.shift\n @primes << @p\n return @p\n end", "title": "" }, { "docid": "0c0d9f2dbc6e71502461c30c3aa08921", "score": "0.6088737", "text": "def nth_prime(num)\n prime_count = 1\n n = 2\n\n while prime_count < num\n prime_count += 1 if prime_number?(n)\n n += 1\n end\n\n n - 1\nend", "title": "" }, { "docid": "888bc9330c49783ac431e93df3683ab1", "score": "0.60826504", "text": "def sum(n)\n end", "title": "" }, { "docid": "7c92d9d11590301b31f1796489137b9f", "score": "0.6082572", "text": "def nthPrime(nth)\n # TODO\nend", "title": "" }, { "docid": "023c2b6dd56d7224cc981f42c1d408d6", "score": "0.60787064", "text": "def prime(n)\n return 2 if n == 1\n return 3 if n == 2\n primes = [2,3]\n (3..n).each do \n last = primes.last\n a = last + 2\n prime = false\n while prime == false\n prime = true\n primes.each do |p|\n if a % p == 0\n a = a + 1\n prime = false\n break\n end\n end\n end\n primes << a\n end\n primes.last\n end", "title": "" }, { "docid": "e62d5f95a0f62e3c1a5380214ebada63", "score": "0.6078654", "text": "def run\n puts sum_of_primes_below(10)\n #=> 17\n\n puts sum_of_primes_below(2_000_000)\n #=> ??\nend", "title": "" }, { "docid": "cdf5efc1ea0a5b901e1406760f6a4beb", "score": "0.6068715", "text": "def findingPrime(n, prime)\n\tprime_counter = 0\n\tindex = 0\n\n\tuntil n < prime**index\n\t\tindex += 1 \n\t\tprime_counter += (n / (prime**index))\n\tend\n\n\tputs \"The #{prime} factor appears #{prime_counter} time(s) in the result of #{n}!\"\nend", "title": "" }, { "docid": "dcf66cc50185e30343cfe9f6c6681760", "score": "0.6067181", "text": "def next_prime(n=1)\n apply(n, &:get_next_prime)\n end", "title": "" }, { "docid": "b944b4f67139ae6078aab537417c425b", "score": "0.60537404", "text": "def [](n)\n # TODO: handle negative +n+ properly\n succ until n < @primes.size\n @primes[n]\n end", "title": "" }, { "docid": "99edba7a97e8782dfc9f0e3fcb33bed3", "score": "0.6053283", "text": "def first_even_numbers_sum(n)\n return 2 if n == 1\n 2 * n + first_even_numbers_sum(n-1)\n end", "title": "" }, { "docid": "3f50ec263f40d9d8a6db968cf6103b2c", "score": "0.60451317", "text": "def getNextPrime n\n if n % 2 == 0\n i = n + 1\n else\n i = n + 2\n end\n \n while ! isPrimePrime(i) \n # no multiples of 2 are prime, and we are starting on an odd number\n i += 2\n end\n \n return i\nend", "title": "" }, { "docid": "cc513e35102b7edb2425221ff113ab37", "score": "0.6039801", "text": "def calculate(number)\n sieve_limit = upper_limit_for(number)\n primes = sieve_upto sieve_limit\n primes[0..number-1]\n end", "title": "" }, { "docid": "c0c1814b8bdde661d6356c3554ed7dbd", "score": "0.6028949", "text": "def primes_up_to(n)\n raise \"Need an integer >= 2 to find primes\" unless n.is_a?(Integer) && n >= 2\n primes = (0..n).to_a\n primes[0..1] = [nil, nil]\n p = 2\n while true do\n (p .. n/p).each do |i|\n primes[i*p] = nil\n end\n break unless p = primes.index { |x| !x.nil? && x > p }\n end\n primes.compact!\n end", "title": "" }, { "docid": "bc110df09a1af4b9cfef8ed209be2a75", "score": "0.6025157", "text": "def nth_prime(n)\n primes = []\n\tint = 2\n\tuntil primes.length == n\n if int <= 3\n primes << int\n else\n primes << int if (2..Math.sqrt(int)).all? { |x| int % x != 0 }\n end\n if int < 3\n int += 1\n else\n int += 2\n end\n end\n puts \"Prime number #{n} is #{primes.last}\"\nend", "title": "" }, { "docid": "370c6ac359b0b49cfdacc85b1a2ce77f", "score": "0.6021448", "text": "def get_primes(n)\n primes = [2]\n pp = 0\n i = 3\n while pp < n do\n if i%2 != 0\n counter = 0\n prime = 1\n while counter < primes.length do\n if (i%primes[counter] == 0)\n prime = 0\n break;\n end\n counter += 1\n end\n if prime == 1\n primes.push(i)\n pp +=1\n end\n end\n i+=1\n end\n return primes[n-1]\nend", "title": "" }, { "docid": "3a9783b86a4f5d01f3e4f051fd692402", "score": "0.60018224", "text": "def nth_prime(n)\n primes = []\n x = 2\n while primes.size < n\n primes << x if (2..Math.sqrt(x)).all? {|i| x % i != 0 }\n x += 1\n end\n primes\nend", "title": "" }, { "docid": "846f212e395eadbd4d2d60c1510a39d4", "score": "0.5987483", "text": "def prime_n (n)\n\ti = 0\n\tj = 1\n\twhile i != n\n\t\tif is_prime?j\n\t\t\ti+=1\n\t\t\tj+=1\n\t\telsif \n\t\t\tj+=1\n\t\tend\n\tend\n\treturn j-1\nend", "title": "" }, { "docid": "a854efb2baf2417878b7995fb86c2535", "score": "0.59844035", "text": "def prime_number(n)\n count = 0\n prime = 2\n while count < n\n if is_prime?(prime) == true\n count += 1\n end\n prime += 1\n end\n\n return (prime-1)\n\nend", "title": "" }, { "docid": "c9bc629eea7b62ac84f763fde223a873", "score": "0.59840703", "text": "def prime_numbers\n # start with the first prime number\n primes = [2]\n # find the rest of the prime numbers\n (2..1000).each do |i|\n add_next_prime_number(primes)\n end\n return primes\nend", "title": "" }, { "docid": "57cdbdda634c4da9115cc93df78e4515", "score": "0.5969144", "text": "def nth_prime(n)\n number = 1\n counter = 0\n until counter == n\n if is_prime?(number) == true\n counter += 1\n end\n number += 1\n end\n return number - 1\nend", "title": "" }, { "docid": "2b0944bb251de392778f9d5da4d6d320", "score": "0.59664756", "text": "def sieve(nth_prime)\n primes = [2]\n num = 2\n while primes.length <= nth_prime do\n primes << num if !primes.any? {|prime| num % prime == 0}\n num +=1\n end\n return primes[primes.length-2] # -2 because we don't put 1 (because every number is divisble by 1) and index is from 0 to x thus -2\nend", "title": "" }, { "docid": "c3560abc385c36a97899d046306fc61b", "score": "0.5966042", "text": "def sumOf(n)\n i = 0\n multiples = []\n while i < n do\n if i % 3 == 0 || i % 5 == 0\n multiples.push(i)\n end\n i += 1\n end\n multiples.inspect\n multiples.reduce(:+)\nend", "title": "" }, { "docid": "a437796512d255d80fb8d20ace8e8a4a", "score": "0.59603345", "text": "def nth_prime(n)\n nums = (0..10000).to_a\n result = []\n\n nums.each do |i| \n if prime?(i) == true\n result.push(i)\n end\n end\n\n\n return result[n]\nend", "title": "" }, { "docid": "dedbfba6079e386e0ccf1b2dd7b58a46", "score": "0.5959745", "text": "def primes(n) \n max = Math::sqrt(n).truncate\n (2..max).each {|val|\n if n % val == 0 then\n p val\n primes(n/val)\n return\n elsif val == max then\n p n\n return\n end\n }\nend", "title": "" }, { "docid": "e753782c04967cdec5e9d6f6cf51bb83", "score": "0.5948313", "text": "def primes_under(n)\n candidates = (3..n).step(2).to_a\n primes = [2]\n\n until primes.last > n ** 0.5\n primes << candidates.shift\n candidates.reject! {|candidate| candidate % primes[-1] == 0}\n end\n\n primes + candidates\nend", "title": "" }, { "docid": "ffaff0999768f07b44f0ed891e48a5d2", "score": "0.59433144", "text": "def find_prime\n x = 2\n while @prime_numbers.count < @total\n @prime_numbers << x if prime?(x)\n x += 1\n end\n end", "title": "" }, { "docid": "25ea688ca15dcccd42e32684e2c7da4d", "score": "0.5940332", "text": "def nst_prime(n)\n\ti , count = 1, 0\n\tloop do\n\t\ti += 1\n\t\tcount += 1 if is_prime?(i)\n\t\tcount == n and return i\n\tend\nend", "title": "" }, { "docid": "8eb6ac5bf70bb2a637c5ac4d3bef56d5", "score": "0.5936022", "text": "def solution_3(num)\n starting_time = Time.now\n\n # actual sieve of eratosthenes\n potential_primes = (2..num).to_a\n potential_primes.each_with_index do |val, index|\n if val\n index += val\n while index < num\n potential_primes[index] = nil\n index += val\n end\n else\n next\n end\n end\n\n primes = potential_primes.compact\n\n p \"Sum of first #{num} primes: #{primes.reduce(:+)}\"\n\n p \"In #{Time.now - starting_time} seconds\"\nend", "title": "" }, { "docid": "57cfa8301a5748e7dd9942fa02886262", "score": "0.59308803", "text": "def test2(limit)\n\ttotal = 0\n\t2.upto(limit) do |x|\n\t\tif isPrime(x) then total += x end\n\tend\n\ttotal \nend", "title": "" }, { "docid": "5b102aa67a5fa6a3798cfb748c576775", "score": "0.59214115", "text": "def first_n_primes(n)\n\n #unless n.is_a? Integer\n # return \"n must be an integer.\"\n #end\n return \"n must be an integer.\" unless n.is_a? Integer\n\n #if n <= 0\n # return \"n must be greater than 0.\"\n #end\n return \"n must be greater than 0.\" if n <= 0\n \n #prime_array = [] if prime_array.nil?\n prime_array ||= []\n \n prime = Prime.new\n #for num in (1..n)\n # prime_array.push(prime.next)\n #end\n # n.times { prime_array.push(prime.next) }\n n.times { prime_array << prime.next }\n \n #return prime_array\n prime_array # implicit return!\n\nend", "title": "" }, { "docid": "fc208a746a0c88d55e7d7cb5846cec20", "score": "0.5920022", "text": "def nth_prime(n)\n i = 0\n num = 1\n if n == 0\n return nil\n end\n while i < n\n num += 1\n i += 1 if is_prime?(num)\n\n end\n num\nend", "title": "" }, { "docid": "b25843bc68d975882003dbbc11fafab3", "score": "0.5914042", "text": "def find_nth_prime(n)\n\ti = 2\n\tnth_prime = 0\n\n\twhile nth_prime < n\n\t\tcounter = 0\n\t\t(2..i).each do |num|\n\t\t\tif i % num == 0\n\t\t\t\tcounter += 1\n\t\t\tend\n\t\tend\n\t\tif counter < 2\n\t\t\tnth_prime += 1\n\t\tend\n\t\ti += 1\n\tend\n\ti - 1\nend", "title": "" }, { "docid": "3a2496e39740f689022bb5e260415351", "score": "0.59136534", "text": "def get_n_primes(n)\n return [] if n < 1\n primes = [2]\n candidate = 3\n\n while primes.length < n\n is_prime = true # default assume the number is prime\n primes.each do |prime|\n if candidate % prime == 0\n is_prime = false\n break\n end\n\n break if prime >= Math.sqrt(candidate)\n end\n\n primes << candidate if is_prime\n candidate += 2\n end\n\n primes\nend", "title": "" }, { "docid": "0cfddbbb650d1e2a368360a1e5ba6421", "score": "0.58996105", "text": "def nth_prime(n)\n return Primes.primes(n)[-1]\nend", "title": "" }, { "docid": "b6f53b237f592e98b8fb950b40815502", "score": "0.5894664", "text": "def find_primes(n)\n # use the Sieve of Eratosthenes method\n # http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes\n\n # 1. \"create a list of consecutive integers from 2 to n\"\n # an empty hash will do\n sieve = {}\n\n # 2. \"initially, let p equal 2, the first prime number\"\n p = 2\n\n while true\n # 3. \"starting from p, count up in increments of p and mark each of these numbers \n # greater than p itself in the list.\"\n # optimization: can start from p*p\n i = p * p\n while i <= n\n sieve[i] = true\n i += p\n end\n\n # 4. \"find the number greater than p in the list that is not marked. if there was no such\n # number, stop. otherwise, let p now equal this number (which is the next prime) and repeat\n # from step 3.\"\n old_p = p\n new_p = nil\n for i in (old_p + 1)..n\n if not sieve[i]\n new_p = i\n break\n end\n end\n if not new_p\n break\n end\n p = new_p\n end\n\n # everything not marked is prime.\n primes = []\n for i in 2..n\n if not sieve[i]\n primes.push(i)\n end\n end\n\n primes\nend", "title": "" }, { "docid": "2e5ad1b8bc22c86950b743430eeb5d3f", "score": "0.5892669", "text": "def compute_sum(number)\n (1..number).inject(:+)\nend", "title": "" }, { "docid": "c2d7e8c15ae23c713b9065b703fc7642", "score": "0.5891838", "text": "def first_n_primes(n)\n return \"n must be an integer.\" unless n.is_a? Integer\n return \"n must be greater than 0.\" if n <= 0\n return Prime.first n\nend", "title": "" }, { "docid": "ef7df15085e4ef7983e688d4fb0d5dd7", "score": "0.5887657", "text": "def first_n_primes(n)\n return \"n must be an integer.\" unless n.is_a? Integer\n return \"n must be greater than 0.\" unless n > 0\n return Prime.first n\nend", "title": "" }, { "docid": "763765a05a9e8d694f6f8ee458ba25a5", "score": "0.58627677", "text": "def first_n_primes(n)\n return \"n must be an integer.\" unless n.is_a? Integer\n return \"n must be greater than 0.\" if n <= 0\n Prime.first n\nend", "title": "" }, { "docid": "763765a05a9e8d694f6f8ee458ba25a5", "score": "0.58627677", "text": "def first_n_primes(n)\n return \"n must be an integer.\" unless n.is_a? Integer\n return \"n must be greater than 0.\" if n <= 0\n Prime.first n\nend", "title": "" }, { "docid": "fb69ff2726f3811d4646487462d27837", "score": "0.5861984", "text": "def n_prime_factors(number)\n detected_primes = n_detected_prime_fatores(number)\n\n start_factor = @primes.last ? @primes.last + 1 : 2\n not_detected_primes = n_not_detected_prime_factors(start_factor, number)\n detected_primes + not_detected_primes\n end", "title": "" }, { "docid": "1ece80dffb594ff910ab15a418832401", "score": "0.58618706", "text": "def compute_sum(number)\n (1..number).reduce(:+)\nend", "title": "" }, { "docid": "6983ec63a858fca2dfece2ec2ba97f74", "score": "0.58566624", "text": "def sum_prime(array)\n array.select { |item| is_prime(item)}.reduce(:+)\nend", "title": "" }, { "docid": "0358b689d8f426bee37d7739c623138c", "score": "0.58501333", "text": "def sum_to(n)\n (1..n).reduce(0) do |sum, value|\n sum + value\n end\nend", "title": "" }, { "docid": "b92788e6ab6351ca15610aa88dfc8580", "score": "0.5847407", "text": "def sum_integers_up_to(n)\n (n * ( n + 1 ) ) / 2\nend", "title": "" }, { "docid": "14f9d4dd8edf6b54bb798f5c6d8ab1b5", "score": "0.58413917", "text": "def p7\n\tprimes = [2]\n\t(1...10001).each do\n\t\tprime = next_prime(primes[-1])\n\t\tprimes << prime\n\tend\n\tprimes[-1]\nend", "title": "" }, { "docid": "d645ef83e2c9ef3d774111450ffec569", "score": "0.5823591", "text": "def eratosthenes_sieve(nth_prime)\n top = nth_prime * 10\n # this is really kludgy, you might have to increase 10 if you want\n # nth primes above 10k. It seems to work fine for all numbers under\n # 10k. I need to read up on prime number theory to find out when this fails.\n sieve = []\n (2..top).each { |i| sieve[i] = i }\n for i in 2 .. Math.sqrt(top)\n next unless sieve[i]\n (i*i).step(top, i) do |j|\n sieve[j] = nil\n end\n end\n sieve.compact[nth_prime]\nend", "title": "" }, { "docid": "db00dcf01a765c70c61365f3fdb308a3", "score": "0.5817042", "text": "def first_even_numbers_sum(n)\n\nend", "title": "" } ]
3a0ff1eb9f246b478221b3f9e779b67e
Config[] returns the value matching the specified environment variable name.
[ { "docid": "06e52d3aadc7fc04e872821e05f8e057", "score": "0.0", "text": "def test_brackets\n set_env('VALUE', 'value')\n assert_equal(Config[:value], 'value')\n assert_equal(Config['VALUE'], 'value')\n end", "title": "" } ]
[ { "docid": "f2746c9620115bd78f99397c357fc4eb", "score": "0.66816145", "text": "def [](name)\n @configs[name]\n end", "title": "" }, { "docid": "f2746c9620115bd78f99397c357fc4eb", "score": "0.66816145", "text": "def [](name)\n @configs[name]\n end", "title": "" }, { "docid": "f0157d2c9642b91e9fc12f9cd223f026", "score": "0.6483778", "text": "def config\n system_config.send(service_name.to_sym) || []\n end", "title": "" }, { "docid": "58dc7778462bc9a5569d196211f3d128", "score": "0.64567196", "text": "def config_list(regex)\n\t\tcmd = \"git config -f #{@config_file} \" +\n\t\t \"--get-regexp 'environment.#{@env}.#{regex}'\"\n\n\t\tbegin\n\t\t\t@command.\n\t\t\t run_command_stdout(cmd).\n\t\t\t split(\"\\n\").\n\t\t\t map { |l| l.split(/\\s+/, 2) }.\n\t\t\t map { |item|\t[item[0].gsub(\"environment.#{@env}.\", ''), item[1]] }\n\t\trescue Giddyup::CommandWrapper::CommandFailed => e\n\t\t\tif e.status.exitstatus == 1\n\t\t\t\t# \"Nothing found\", OK then\n\t\t\t\treturn []\n\t\t\telse\n\t\t\t\traise RuntimeError,\n\t\t\t\t \"Failed to get config list environment.#{@env}.#{regex}\"\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "e0bb3911d3dc9f605020bc0150eac2d2", "score": "0.63640964", "text": "def names\n envs.map { |config| config.name }\n end", "title": "" }, { "docid": "3ef79f669469e1754e3697159e255726", "score": "0.63044864", "text": "def [] key\n @config[key.to_s]\n end", "title": "" }, { "docid": "422da34d31e25fe0dfa863144294ed4b", "score": "0.6303881", "text": "def get_config(config_name)\n raise ConfigNotFound, \"Environment variable #{config_name} not found !\" unless ENV[config_name]\n ENV[config_name]\n end", "title": "" }, { "docid": "e203a44ff86f6107dcf2064401d89035", "score": "0.62579495", "text": "def array(var_name, sep = ',')\n return [] unless ENV.key?(var_name)\n\n ENV[var_name].split(sep)\n end", "title": "" }, { "docid": "e97c4569f476aa1c05d510e155071b00", "score": "0.62547374", "text": "def list_config\n configs = store :get, 'configs'\n (configs.error?) ? 'No config vars set yet.' : configs.to_s\n end", "title": "" }, { "docid": "13998a76f74800fcd3126c5751866fe2", "score": "0.6252348", "text": "def [](name)\n by_name(name).full?(&:value) || APP_CONFIG_DEFAULTS[name.to_s]\n end", "title": "" }, { "docid": "f62eefbd522a71e27885240ca3febb08", "score": "0.61834985", "text": "def get(name)\n @config[name]\n end", "title": "" }, { "docid": "6cdb93bddd6fb42001003493b77aa60c", "score": "0.61620635", "text": "def [](var)\n return @config[var]\n end", "title": "" }, { "docid": "5e557a30319351d44174e9d022d33db5", "score": "0.6083644", "text": "def environment_variables\n return [] unless options[\"environment_variables\"]\n options[\"environment_variables\"].map do |options|\n EnvironmentVariable.new options\n end\n end", "title": "" }, { "docid": "ad272a9270d861378489d5d798e5e17a", "score": "0.6061312", "text": "def get(key)\n key = key.to_s\n %w(local_config app_config m2mhub_config).each do |config_key|\n if (config = @yaml_config[config_key])\n if config_key == 'app_config'\n next unless config = config[Rails.env.downcase]\n end\n if config.member?(key)\n return config[key]\n end\n end\n end\n nil\n end", "title": "" }, { "docid": "913bc295b2fed1ad518f65d30b738446", "score": "0.6036188", "text": "def config_from_env\n CONFIGURABLE_WITH_ENV.each_with_object({}) do |option, env_vars|\n if value = option_from_env(option)\n env_vars[option] = value\n end\n end\n end", "title": "" }, { "docid": "387eeda26ff517e708ba27e4981d029d", "score": "0.59646803", "text": "def get_env_var key\n key = key.to_s\n exec(Beaker::Command.new(\"env | grep ^#{key}=\"), :accept_all_exit_codes => true).stdout.chomp\n end", "title": "" }, { "docid": "1cbdfd9306aab71f3242518df94a25a4", "score": "0.59642553", "text": "def [](k)\n @config[k]\n end", "title": "" }, { "docid": "17d2bfd8a14ace267be1f04acc5f2ce4", "score": "0.5938749", "text": "def read_config(name)\n read_config_file[name]\n end", "title": "" }, { "docid": "5e0fe3ec5617539abed35599c8ff8dab", "score": "0.5935309", "text": "def locate_config_value(key)\n key = key.to_sym\n config[key] || Chef::Config[:knife][key]\n end", "title": "" }, { "docid": "406b2fed92d433632d1dd06734d0556d", "score": "0.59172004", "text": "def config(key)\n env_key = ENV[key.upcase.gsub(/[\\.-]/, '_')]\n return env_key if env_key and not env_key.strip.empty?\n\n str_to_bool `git config --global --get-all #{key}`.strip\n end", "title": "" }, { "docid": "628fa69f58db5b7cb39e5c5a6fd7a165", "score": "0.59087944", "text": "def setting(name)\n config[environment] && config[environment][name]\n end", "title": "" }, { "docid": "1afb1214bb969f641ae6a990a42742ad", "score": "0.58233595", "text": "def lookup_config(name)\n\t\tend", "title": "" }, { "docid": "57e31b89d3a6b33e0c8fdfc09ebd3b08", "score": "0.5780598", "text": "def names\n @configs.keys\n end", "title": "" }, { "docid": "57e31b89d3a6b33e0c8fdfc09ebd3b08", "score": "0.5780598", "text": "def names\n @configs.keys\n end", "title": "" }, { "docid": "5510151d6d557b94e0cc23c3887d7bdc", "score": "0.5767284", "text": "def [](k)\n @my_conf[k]\n end", "title": "" }, { "docid": "b2160e23e6c683e2104ea036d621e3af", "score": "0.57170266", "text": "def [](key)\n config[key]\n end", "title": "" }, { "docid": "84e3e20f9ae86d4ad60e50ddd1f0cb98", "score": "0.56923646", "text": "def setting(name)\n roots = []\n if @environment_name\n roots << @config.send(@environment_name)\n end\n roots << @config\n roots.each do |root|\n begin\n setting_value = name.split('.').inject(root) { |node,prop| if node.include?(prop.to_sym) then node.send(prop) else raise \"Undefined property #{prop} for #{node.name}\" end}\n return setting_value\n rescue => e\n # Fall through to next case\n end\n end\n # If we get here the property does not exist\n #XXX - should probably ask for a default, and if one is not provided, raise an error\n nil\n end", "title": "" }, { "docid": "f11c85d92234079e4c42039b5bb5b2bd", "score": "0.5674828", "text": "def get name, default: nil\n name_str = name.to_s\n name_sym = name.to_sym\n\n value = nil\n found = false\n @config.each do |configfile|\n if value = configfile[:config][name_str] or value = configfile[:config][name_sym]\n found = true\n break\n end\n end\n value = default if value.nil? and not found\n value\n end", "title": "" }, { "docid": "8506dfc72f65a95a187402d756a6deec", "score": "0.5663808", "text": "def get_config(name, default)\n return ENV[name].nil? ? default : ENV[name]\nend", "title": "" }, { "docid": "7d6ad122c95cec084834218e92fab194", "score": "0.56544083", "text": "def get(key)\n\t\t\treturn @config[key]\n\t\tend", "title": "" }, { "docid": "bb09fe1b2bfb1efada4124f00aba7769", "score": "0.56460583", "text": "def [](key)\n @config[key]\n end", "title": "" }, { "docid": "609fccd05cfe1ba4c94af85ebad3028a", "score": "0.56390697", "text": "def environments\n environment_config.keys\n end", "title": "" }, { "docid": "88b5b9e800258e99b41ac4b3e313591a", "score": "0.56357133", "text": "def app_config\n values = {}\n\n GCLOUD_OPTIONS_LIST.each do |option|\n values[option] = ENV[option.to_s.upcase] || self.send(option)\n end\n\n return values\n end", "title": "" }, { "docid": "ed04f353313ed44e19340a3806502072", "score": "0.5632181", "text": "def known_environments\n return [] unless config?\n config.environments.map { |name, _| environments.find_or_create_by!(name: name) }\n end", "title": "" }, { "docid": "9560a56b7e5820d0355784ce8b4fc6ee", "score": "0.5628167", "text": "def [](path)\n parts = path.to_s.split('.')\n result = @configuration\n\n parts.each do |k|\n result = result[k]\n\n break if result.nil?\n end\n\n result\n end", "title": "" }, { "docid": "238dbb250af89524b84ab9cdfad823db", "score": "0.5627357", "text": "def project_setting(key)\n data.config[config[:environment]][key]\n end", "title": "" }, { "docid": "d9ff4c340e3c75fa695cc3a47cba6907", "score": "0.561174", "text": "def load!\n configs = {}\n @array.each_with_index do |obj, idx|\n next unless obj.start_with?('--' + @env_prefix)\n\n value = extract_value(obj, idx + 1)\n key = obj.split('=').first\n .sub(/^--#{@env_prefix}_?/, '')\n .downcase.split('__')\n recursive_set(configs, key, split_env_string(value))\n end\n configs\n end", "title": "" }, { "docid": "64c095ccc6fb96b4720f959ba4a9483e", "score": "0.5608153", "text": "def get(key, default=nil)\n rv = nil\n\n [*key].each do |k|\n # Lets check for this key\n rv = @config.get(k.to_s)\n break unless rv.nil?\n\n # If it doesn't exist, check with env\n rv = @config.get(KnoxBoxWeb::Application.environment.to_s << '.' << k.to_s)\n break unless rv.nil?\n end\n\n return default if rv.nil?\n return rv\n end", "title": "" }, { "docid": "6a391e208d101d35d9fb2b7fa2942f54", "score": "0.560631", "text": "def read_config\n begin\n config = YAML.load_file('config/config.yml')\n puts config['address']\n puts config['port']\n rescue YAML::LoadError => e\n # If config file is not found or valid, return with errors\n logger.error \"read config error: #{e}\"\n end\n\n [config['address'], config['port']]\n end", "title": "" }, { "docid": "89ee8d54610c303bdaa85c63d4f122a8", "score": "0.55994606", "text": "def [](key)\n @config[key]\n end", "title": "" }, { "docid": "9986a504fe094c53bc2309ff8984a371", "score": "0.55924356", "text": "def get_property(name)\n Config::Collection.get(name)\n end", "title": "" }, { "docid": "9d9b73826b6be55c1d147546a393df3f", "score": "0.5574277", "text": "def [](key)\n ensure_config_loaded!\n if setting = setting_for(key.to_s)\n setting.value\n end\n end", "title": "" }, { "docid": "5c5937c02d7ee8381d12e727df267701", "score": "0.55503786", "text": "def [](key)\n resolved_config[key]\n end", "title": "" }, { "docid": "2f2493cd7e4d2f15659c9377f6006b2b", "score": "0.5545957", "text": "def config_for_key(key)\n settings.config[key]\n end", "title": "" }, { "docid": "1689d26da3340e281e6bae12aa0f0fea", "score": "0.55451965", "text": "def get_env(name)\n ENV[name]\n end", "title": "" }, { "docid": "598f906586e1300167974e3461bc791f", "score": "0.5516359", "text": "def config_opt(*env_vars, default: nil)\n ENV.values_at(*env_vars).compact.fetch(0, default)\n end", "title": "" }, { "docid": "4ad12142db60f2fc82445ea1e1082a52", "score": "0.55080146", "text": "def [](key)\n load_config unless @config\n @config[key]\n end", "title": "" }, { "docid": "aacd168b169107062b3a61edfe8c2ba3", "score": "0.5507649", "text": "def get(key)\n self.config[key]\n end", "title": "" }, { "docid": "aa9eb57c4c7cc8f7d0bcbf20a4d069fe", "score": "0.5489007", "text": "def [](*args)\n args.map!(&:to_s)\n @config.[](*args)\n end", "title": "" }, { "docid": "a6fb90632b81c65a7f6c1274761cf04c", "score": "0.548797", "text": "def get_values()\n\t\t\treturn @config.values\n\t\tend", "title": "" }, { "docid": "f69ed2cf333f5407eee2803494e62387", "score": "0.54875284", "text": "def config_file\n env_config['config_file'] || raise('environment problem:environment information not loaded')\n end", "title": "" }, { "docid": "e723fb06b19d3a351b33ca19067ad2bd", "score": "0.5481943", "text": "def option_from_env(name)\n ViteRuby.env[\"#{ ViteRuby::ENV_PREFIX }_#{ name.upcase }\"]\n end", "title": "" }, { "docid": "af26b5cb53c12ece622a7c2a0656d7ce", "score": "0.5479919", "text": "def [](name = nil)\n if name\n @environments_by_name[name]\n else\n @environments\n end\n end", "title": "" }, { "docid": "86478db3cc846c6373667a4cf6d4fa8a", "score": "0.54778844", "text": "def [](name)\r\n load\r\n @config[name]\r\n end", "title": "" }, { "docid": "050061281ebb59696f003d8c51e6a119", "score": "0.54478073", "text": "def env\n image = options[:image] || app\n config = api.get_config_vars(app).body\n\n config.keys.sort.each do |key|\n puts \"#{key}=#{config[key]}\"\n end\n end", "title": "" }, { "docid": "2a33baa924b2055867a7084969416b0b", "score": "0.5447653", "text": "def [](key)\n @config[key]\n end", "title": "" }, { "docid": "cb4d739541b1471a589d3859548d7473", "score": "0.5445678", "text": "def find_module(name, version)\n e = []\n\n @envs.each do |k, v|\n next unless v.keys.include?(name) && v[name] == version\n e << k\n end\n\n e\n end", "title": "" }, { "docid": "223bcda6e950afd075d9da0192fb77be", "score": "0.5444233", "text": "def [](name)\n @_configs ||= {}\n @_configs[name.to_sym] ||= load(name)\n end", "title": "" }, { "docid": "29ef90ceb25be4661cdb5f0c05d369b5", "score": "0.54291046", "text": "def lookup_environment (varname)\n\n return [\n get_expression_pool.fetch_engine_environment, varname[2..-1]\n ] if varname[0, 2] == '//'\n\n return [\n get_environment.get_root_environment, varname[1..-1]\n ] if varname[0, 1] == '/'\n\n [ get_environment, varname ]\n end", "title": "" }, { "docid": "2a082e247d6c06e294616617cb74576e", "score": "0.5427412", "text": "def obtain_tenant_environments\n envs = Array.new\n chef_api_connect.search.query(:environment, 'tenant_environment:*', start: 0).rows.each do |environ|\n if environ['default_attributes']['fconfig']['tenant_environment'] == \"true\"\n envs << environ['name']\n end\n end\n return envs\nend", "title": "" }, { "docid": "acc21fd2959d32a3fa6ad173e3be9768", "score": "0.54271036", "text": "def [] name\n hash = @env.find { |closure| closure.key? name }\n hash[name] if hash\n end", "title": "" }, { "docid": "4bce9a86f95cb3225860c39f7af4ac43", "score": "0.5425967", "text": "def matched_configs\n [@full_config['environments'][environment], @full_config['nodes'][fqdn]]\n end", "title": "" }, { "docid": "0182bfe47a7743008dfad92ac403a3b5", "score": "0.5423436", "text": "def config(key)\n env_key = ENV[key.upcase.gsub(/\\./, '_')]\n return env_key if env_key and not env_key.empty?\n\n str_to_bool `git config --global #{key}`.strip\n end", "title": "" }, { "docid": "f82f9184ba58de4bd76a10d0f075d8ab", "score": "0.5420969", "text": "def env_config\n OPTIONS.each do |name|\n if value = ENV[name]\n __send__(\"#{name}=\",value)\n end\n end\n end", "title": "" }, { "docid": "2986152474da9044d9e636c3f6baa7cd", "score": "0.542066", "text": "def resolve(value)\n @configurations[value]\n end", "title": "" }, { "docid": "720d3df39683ec2220e48e35ca26eea1", "score": "0.5418092", "text": "def find_module(name, version)\n e = []\n\n @envs.each do |k, v|\n next unless v.keys.include?(name) && v[name] == version\n e << k\n end\n\n e\n end", "title": "" }, { "docid": "5dedc19a03da6f32b51058900da87c2a", "score": "0.5410956", "text": "def [](key)\n config[key]\n end", "title": "" }, { "docid": "e553ebdbf896929bc6120447fe1f5f86", "score": "0.54093015", "text": "def get!(key)\n rv = @config.get(key)\n return rv\n end", "title": "" }, { "docid": "bd1d501b2cb07953ec759dab24efe265", "score": "0.54085004", "text": "def env_config; end", "title": "" }, { "docid": "bd1d501b2cb07953ec759dab24efe265", "score": "0.54085004", "text": "def env_config; end", "title": "" }, { "docid": "bd1d501b2cb07953ec759dab24efe265", "score": "0.54085004", "text": "def env_config; end", "title": "" }, { "docid": "bd1d501b2cb07953ec759dab24efe265", "score": "0.54085004", "text": "def env_config; end", "title": "" }, { "docid": "66604e12abf95bac04840ca91d195907", "score": "0.5401667", "text": "def get_config(key)\n if config.key? key\n config[key]\n else\n application.default_config[key]\n end\n end", "title": "" }, { "docid": "b399693f62f3eca111b5722af3c539b6", "score": "0.5393314", "text": "def [](key)\n configuration[key.to_sym]\n end", "title": "" }, { "docid": "ce9e4aae8a70d1cbb64c3afc6c93dd83", "score": "0.5389655", "text": "def [](k)\n keys = k.to_s.split('/')\n result = read_settings(keys.shift)\n while result && keys.any?\n result = result[keys.shift]\n end\n result\n end", "title": "" }, { "docid": "319eec0a92807c704e9b624380dfe555", "score": "0.5389581", "text": "def propvaluearray(name) #:nodoc:\n @properties.select{ |f| f.name? name }.map{ |p| p.value }\n end", "title": "" }, { "docid": "aee5fc1068baff6e8cd334d94074f610", "score": "0.5381937", "text": "def get_config_var_values(variable_id)\n path = \"/d2l/api/lp/#{$lp_ver}/configVariables/#{variable_id}/values\"\n _get(path)\n # returns Values JSON data block\nend", "title": "" }, { "docid": "c80b6ec895f878ced83d7ba6556e9700", "score": "0.5371087", "text": "def get_value_from_dotenv(var)\n line=open('./.env') { |f| f.lines.find { |line| line.include?(var) } }\n line=line.chomp\n return line.split(\"=\").last.split(' ').first.tr('\"','')\nend", "title": "" }, { "docid": "c7dadd5150ce72fb3f974b1b5a47eec1", "score": "0.5360151", "text": "def configuration(name)\n Alchemy::Config.get(name)\n end", "title": "" }, { "docid": "89d29220a6a29433834cbd519dff1238", "score": "0.53377366", "text": "def config_for(name)\n name = name.to_s\n check_for_changes(name) if auto_check?(name)\n data = get_config_data(name)\n logger.debug \"config_for(#{name.inspect}) => #{data.inspect}\"\n data\n end", "title": "" }, { "docid": "be3bfb078f7bc170f8d480fdb61505f9", "score": "0.53297114", "text": "def app_config_key_value\n return @app_config_key_value\n end", "title": "" }, { "docid": "e6deaa36c78df0ee60a436abd09f6785", "score": "0.53280604", "text": "def config_for name\n yaml = SpaceScrape.root.join 'config', \"#{ name }.yml\"\n\n unless yaml.exist?\n raise \"Could not load configuration. No such file - #{ yaml }\"\n end\n\n erb = ERB.new(yaml.read).result\n erbd_yaml = YAML.load erb\n\n erbd_yaml[SpaceScrape.environment.to_s] || {}\n rescue YAML::SyntaxError => e\n raise \"YAML syntax error occurred while parsing #{ yaml }. \" \\\n \"Please note that YAML must be consistently indented using spaces. Tabs are not allowed. \" \\\n \"Error: #{ e.message }\"\n end", "title": "" }, { "docid": "8d155070ab3e8859686bf327032daa82", "score": "0.53259003", "text": "def config(name)\n config = configs.select {|config| config.name == name.to_s }.first\n raise \"No such config #{name}, available configs are #{configs.map {|c| c.name}.join(', ')}\" if config.nil?\n yield config if block_given?\n config\n end", "title": "" }, { "docid": "ca3ab918703bf7ec31a7432f4ca7b393", "score": "0.5320997", "text": "def [](key)\n config[key.to_s] || config[key.to_sym]\n end", "title": "" }, { "docid": "77ada786c9ade0f0f986d19cc6cd4086", "score": "0.5318012", "text": "def get(name)\n @registry.fetch(name)\n rescue KeyError\n raise UndeclaredNameError, \"config value '#{name}' never loaded\"\n end", "title": "" }, { "docid": "be0fb10fe4f299a3fe77ec0467977251", "score": "0.53111243", "text": "def setting(key)\n keys = [key]\n case key\n when String\n keys << key.to_sym\n when Symbol\n keys << key.to_s\n end\n\n # Scan all possible keys to see if the config has a matching value\n keys.inject(nil) do |rv, k|\n v = @config[k]\n break v unless v.nil?\n end\n end", "title": "" }, { "docid": "be0fb10fe4f299a3fe77ec0467977251", "score": "0.53111243", "text": "def setting(key)\n keys = [key]\n case key\n when String\n keys << key.to_sym\n when Symbol\n keys << key.to_s\n end\n\n # Scan all possible keys to see if the config has a matching value\n keys.inject(nil) do |rv, k|\n v = @config[k]\n break v unless v.nil?\n end\n end", "title": "" }, { "docid": "d3b6bea2a75544aa97a060e130823904", "score": "0.5309861", "text": "def get_config(key)\n config.__send__(key)\n end", "title": "" }, { "docid": "497c025984d347655ec5255684e2f43b", "score": "0.5307937", "text": "def config\n @config ||= YAML.load_file(config_file)[environment]\n end", "title": "" }, { "docid": "50117dcca3bd35aa579fb756eb10922f", "score": "0.5299542", "text": "def get(key)\n @config_hash[key]\n end", "title": "" }, { "docid": "09a56a025957c6af41aab37a6008d9d4", "score": "0.529454", "text": "def search_opts(keys)\n val = Rake.application.options.send(keys[0].downcase.to_sym)\n return parse_opt(val) if !val.nil?\n #\n keys.each do |k|\n val = ENV[k.upcase]\n return parse_opt(val) if !val.nil?\n end\n #\n return nil if !@yaml\n keys.each do |k|\n val = @yaml[k.upcase]\n return val if !val.nil?\n end\n nil\n end", "title": "" }, { "docid": "09a56a025957c6af41aab37a6008d9d4", "score": "0.529454", "text": "def search_opts(keys)\n val = Rake.application.options.send(keys[0].downcase.to_sym)\n return parse_opt(val) if !val.nil?\n #\n keys.each do |k|\n val = ENV[k.upcase]\n return parse_opt(val) if !val.nil?\n end\n #\n return nil if !@yaml\n keys.each do |k|\n val = @yaml[k.upcase]\n return val if !val.nil?\n end\n nil\n end", "title": "" }, { "docid": "0050b7efbe5b4afcb92d19083d36a5db", "score": "0.52925867", "text": "def aggregate_missing_env_vars\n example_env_vars.inject([]) do |array, key_and_value|\n key = key_and_value[0]\n\n begin\n ENV.fetch(key)\n array\n rescue KeyError\n array << key\n end\n end\n end", "title": "" }, { "docid": "d6e5f42921a5557277e1503e1045d8b9", "score": "0.52897674", "text": "def env_config\n @env_config ||= {}\n end", "title": "" }, { "docid": "d3268a737eca5367d944ce795c11ea80", "score": "0.5288153", "text": "def test_array\n set_env 'ARRAY', ''\n assert_equal([], Config.array('ARRAY'))\n set_env 'ARRAY', 'apple'\n assert_equal(['apple'], Config.array('ARRAY'))\n set_env 'ARRAY', 'apple,orange,cherry'\n assert_equal(['apple', 'orange', 'cherry'], Config.array('ARRAY'))\n end", "title": "" }, { "docid": "7d82f322dba125b1b6ad59d38c2c62fd", "score": "0.52842355", "text": "def env_values\n @parse[@env] || @parse[@env.to_s] || {}\n end", "title": "" }, { "docid": "324256b9ef0b851c278085ac3c270654", "score": "0.5278404", "text": "def [](key)\n @configuration[key.to_s]\n end", "title": "" }, { "docid": "1570f57e02d1b6a135dd0f0dbcce5b6c", "score": "0.52775913", "text": "def load_disk_config\n return nil unless File.exists?(@config_file)\n\n config_array = []\n\n File.readlines(@config_file).each do |line|\n next if line =~ /^#.*$/\n config_array.push(line.to_s.strip)\n end\n\n Puppet.debug \"Loaded file: #{@config_file}\"\n return config_array\n end", "title": "" }, { "docid": "4d57dad5f85b0ece452980ccbebde312", "score": "0.52684975", "text": "def [](key)\n @env[key]\n end", "title": "" }, { "docid": "4d57dad5f85b0ece452980ccbebde312", "score": "0.52684975", "text": "def [](key)\n @env[key]\n end", "title": "" }, { "docid": "c5ae37c681a8a6228d245257d03d2b04", "score": "0.5263604", "text": "def config_for(name)\n ConfigFor.load_config!(settings.config_path, name, settings.environment)\n end", "title": "" } ]
cc6514c5b7b9516bef56551765ac0061
Return aggregation counts of the grouped documents. This will count by the first field provided in the fields array.
[ { "docid": "dd6047275a2ef30c88a5181adc870cf9", "score": "0.5856966", "text": "def aggregate\n {}.tap do |counts|\n group.each_pair { |key, value| counts[key] = value.size }\n end\n end", "title": "" } ]
[ { "docid": "9929e8a77629c4c562cca3bef3eb37dd", "score": "0.700089", "text": "def aggregate\n collection.group(options[:fields], selector, { :count => 0 }, AGGREGATE_REDUCE, true)\n end", "title": "" }, { "docid": "f7459189e773a9135d8d859ca0f0ccd0", "score": "0.6880292", "text": "def aggregate\n klass.collection.group(\n :key => field_list,\n :cond => selector,\n :initial => { :count => 0 },\n :reduce => Javascript.aggregate\n )\n end", "title": "" }, { "docid": "2e2236dfdb5cb9ad0b955a67b879a987", "score": "0.61804533", "text": "def aggregate(klass = nil)\n @klass = klass if klass\n @klass.collection.group(@options[:fields], @selector, { :count => 0 }, AGGREGATE_REDUCE)\n end", "title": "" }, { "docid": "b6edc8e1247c8a8ad6d887c9bf42b9be", "score": "0.6135798", "text": "def count(field=nil, options={})\n find(:all, options).size\n end", "title": "" }, { "docid": "4d644ebacb0f45c248d5e660006cafa8", "score": "0.6117533", "text": "def count_records_in_measure_groups\n pipeline = build_query\n\n pipeline << {'$group' => {\n \"_id\" => \"$value.measure_id\", # we don't really need this, but Mongo requires that we group\n QME::QualityReport::POPULATION => {\"$sum\" => \"$value.#{QME::QualityReport::POPULATION}\"},\n QME::QualityReport::DENOMINATOR => {\"$sum\" => \"$value.#{QME::QualityReport::DENOMINATOR}\"},\n QME::QualityReport::NUMERATOR => {\"$sum\" => \"$value.#{QME::QualityReport::NUMERATOR}\"},\n QME::QualityReport::ANTINUMERATOR => {\"$sum\" => \"$value.#{QME::QualityReport::ANTINUMERATOR}\"},\n QME::QualityReport::EXCLUSIONS => {\"$sum\" => \"$value.#{QME::QualityReport::EXCLUSIONS}\"},\n QME::QualityReport::EXCEPTIONS => {\"$sum\" => \"$value.#{QME::QualityReport::EXCEPTIONS}\"},\n QME::QualityReport::MSRPOPL => {\"$sum\" => \"$value.#{QME::QualityReport::MSRPOPL}\"},\n QME::QualityReport::MSRPOPLEX => {\"$sum\" => \"$value.#{QME::QualityReport::MSRPOPLEX}\"},\n QME::QualityReport::CONSIDERED => {\"$sum\" => 1}\n }}\n\n aggregate = get_db.command(:aggregate => 'patient_cache', :pipeline => pipeline)\n aggregate_document = aggregate.documents[0]\n if !aggregate.successful?\n raise RuntimeError, \"Aggregation Failed\"\n elsif aggregate_document['result'].size !=1\n aggregate_document['result'] =[{\"defaults\" => true,\n QME::QualityReport::POPULATION => 0,\n QME::QualityReport::DENOMINATOR => 0,\n QME::QualityReport::NUMERATOR =>0,\n QME::QualityReport::ANTINUMERATOR => 0,\n QME::QualityReport::EXCLUSIONS => 0,\n QME::QualityReport::EXCEPTIONS => 0,\n QME::QualityReport::MSRPOPL => 0,\n QME::QualityReport::MSRPOPLEX => 0,\n QME::QualityReport::CONSIDERED => 0}]\n end\n\n nqf_id = @measure_def.nqf_id || @measure_def['id']\n result = QME::QualityReportResult.new\n result.population_ids=@measure_def.population_ids\n\n\n if @measure_def.continuous_variable\n aggregated_value = calculate_cv_aggregation\n result[QME::QualityReport::OBSERVATION] = aggregated_value\n end\n\n agg_result = aggregate_document['result'].first\n agg_result.reject! {|k, v| k == '_id'} # get rid of the group id the Mongo forced us to use\n # result['exclusions'] += get_db['patient_cache'].find(base_query.merge({'value.manual_exclusion'=>true})).count\n agg_result.merge!(execution_time: (Time.now.to_i - @parameter_values['start_time'].to_i)) if @parameter_values['start_time']\n agg_result.each_pair do |k,v|\n result[k]=v\n end\n result.supplemental_data = self.calculate_supplemental_data_elements\n result\n\n end", "title": "" }, { "docid": "93389588bf389485ba5cd25d1cd62f06", "score": "0.60970575", "text": "def count\n @calc_field_collection.count\n end", "title": "" }, { "docid": "6fb5f341084c376c77abd1ca156aaea1", "score": "0.6067979", "text": "def _count\n @fields.count\n end", "title": "" }, { "docid": "f10738eb5b87ac59bca027dabc9e1f36", "score": "0.6040066", "text": "def count_documents(opts = {})\n opts = @options.merge(opts) unless Mongo.broken_view_options\n pipeline = [:'$match' => filter]\n pipeline << { :'$skip' => opts[:skip] } if opts[:skip]\n pipeline << { :'$limit' => opts[:limit] } if opts[:limit]\n pipeline << { :'$group' => { _id: 1, n: { :'$sum' => 1 } } }\n\n opts = opts.slice(:hint, :max_time_ms, :read, :collation, :session, :comment)\n opts[:collation] ||= collation\n\n first = aggregate(pipeline, opts).first\n return 0 unless first\n first['n'].to_i\n end", "title": "" }, { "docid": "fc081b51b98d08a2f56e89d654e3e73b", "score": "0.598205", "text": "def counts\n self.each.inject({}) {|h, doc| h[doc._key_value.to_s] = doc._count; h }\n end", "title": "" }, { "docid": "8fbbf2f8e11ec3e9b3aa3b9b87c1e9da", "score": "0.58839417", "text": "def count_via_solr\n results = limit(1).select(:id).to_a\n @group_value ? results.total_for_all : results.total_entries\n end", "title": "" }, { "docid": "12b0779d8131ebc40f749692f8de2700", "score": "0.583642", "text": "def count(name = 'count')\n count_aggregator = Java::CascadingOperationAggregator::Count.new(fields(name))\n count_by = Java::CascadingPipeAssembly::CountBy.new(fields(name))\n every(last_grouping_fields, :aggregator => count_aggregator, :output => all_fields, :aggregate_by => count_by)\n end", "title": "" }, { "docid": "cac36ad27178a96c49e6f6024ec764a0", "score": "0.5833985", "text": "def analyze(fields = [])\n puts \"Analyzing CSV values frequency for #{fields.any? ? fields.join(', ') + ' field' : 'all fields'}\"\n\n fields = fields.map &:downcase\n grouped = {}\n fetch do |bike_hash|\n bike_hash.each do |key, value|\n next if fields.any? && !fields.include?(key)\n grouped[key] ||= {}\n grouped[key][value] ||= 0\n grouped[key][value] += 1\n end\n end\n\n grouped.each do |field, values|\n puts \"#{field}:\"\n values.each do |value, count|\n puts \"\\t#{value.inspect}: #{count}\"\n end\n puts \"\\tTotal of #{values.count} distinct values\"\n end\n end", "title": "" }, { "docid": "07edaf7710587ed8cd731526dd46dcd3", "score": "0.5832233", "text": "def group\n field = field_list.first\n execute.group_by { |doc| doc.send(field) }\n end", "title": "" }, { "docid": "849b6da191e54659e38bceab682c1025", "score": "0.58297485", "text": "def aggregate_fields(dims=[])\n agg_fields = fact_class.aggregate_fields.reject {|field| !pivot_on_hierarchical_dimension? and !field.levels_from_parent.empty? } \n dims.each do |dim|\n if !dim.blank? and fact_class.has_and_belongs_to_many_relationship?(dim.to_sym)\n return agg_fields.reject {|field| !field.is_count_distinct?}\n end\n end\n agg_fields\n end", "title": "" }, { "docid": "31c8a15693b07c5152a850554c0634f0", "score": "0.5800053", "text": "def aggregate(query)\n query.fields.each do |f|\n unless f.target == :all && f.operator == :count\n raise ArgumentError, %{Aggregate function #{f.operator} not supported in SOQL}\n end\n end\n\n [ execute_select(query).size ]\n end", "title": "" }, { "docid": "c2aa3ea672f9c852aa1c527ef964e230", "score": "0.57784486", "text": "def tally(field)\n return documents.each_with_object({}) do |d, acc|\n v = retrieve_value_at_path(d, field)\n acc[v] ||= 0\n acc[v] += 1\n end\n end", "title": "" }, { "docid": "1c88525ff046205cc23952e9266ca586", "score": "0.57654077", "text": "def count(options = {})\n options[:field] = \"*\"\n calculate(\"COUNT(*)\", options).to_i\n end", "title": "" }, { "docid": "3049619abcb9f730aaa03fdb6cd8316a", "score": "0.57111347", "text": "def field_count()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "d68ad9008439f42f969165610f042a6e", "score": "0.5701323", "text": "def count_documents(index, query, *schemas)\n get_documents(index, query, {:fields => '@count'}, *schemas)\n end", "title": "" }, { "docid": "fbfce7098071b7ad0127e9ad4b317a4c", "score": "0.568362", "text": "def group_corpus(field)\n ret = {}\n start = 0\n\n num_docs = 0\n total_docs = RLetters::Solr::CorpusStats.new.size\n\n loop do\n search_result = RLetters::Solr::Connection.search_raw({\n q: '*:*',\n def_type: 'lucene',\n group: 'true',\n 'group.field' => field.to_s,\n fl: 'uid',\n facet: 'false',\n start: start.to_s,\n rows: 100\n })\n\n # These conditions would indicate a malformed Solr response\n break unless search_result['grouped'] &&\n search_result['grouped'][field.to_s] &&\n search_result['grouped'][field.to_s]['matches']\n\n grouped = search_result['grouped'][field.to_s]\n break if grouped['matches'] == 0\n\n groups = grouped['groups']\n break unless groups\n\n # This indicates that we're out of records\n break if groups.empty?\n\n # Add this batch to the return\n groups.each do |g|\n key = g['groupValue']\n val = g['doclist']['numFound']\n\n ret[key] = val\n\n # Update the progress meter\n if @progress\n num_docs += g['doclist']['numFound']\n @progress.call((num_docs.to_f / total_docs.to_f * 100.0).to_i)\n end\n end\n\n # Get the next batch of groups\n start = start + 100\n end\n\n @progress.call(100) if @progress\n\n ret\n end", "title": "" }, { "docid": "95c6d44463b108a7bd24fe3d6b831205", "score": "0.5638796", "text": "def document_counts\n @document_count ||= begin\n solr_resp = repository.search('facet.query' => facet_fields.map { |_key, fields| \"#{fields.field}:[* TO *]\" },\n 'rows' => 0,\n 'facet' => true)\n\n solr_resp['facet_counts']['facet_queries'].each_with_object({}) do |(k, v), h|\n h[k.split(/:/).first] = v\n end\n end\n end", "title": "" }, { "docid": "f3c864ec6d73c8376a773c25eda5ad6a", "score": "0.5616093", "text": "def count(filters, options = {})\n count_records(filter_records(filters, options))\n end", "title": "" }, { "docid": "42825cb7dc271049e3fa50a5f5d4ca27", "score": "0.56146353", "text": "def fldCount\n\t\tfldHash = Hash[TINCTURES.collect {|t| [t,0]}]\n\t\t@deck.each do |v|\n\t\t\tv.field.fields.each {|f| fldHash[f.to_s] += 1}\n\t\tend\n\t\treturn fldHash\n\tend", "title": "" }, { "docid": "e35bc4e0a9812bad4a009aaa15a8c1ba", "score": "0.5573068", "text": "def count(opts={})\n return @j_collection.count() if opts.empty?\n query = opts[:query] || opts['query'] || {}\n fields = opts[:fields] || opts['fields'] || {}\n limit = opts[:limit] || opts['limit'] || 0\n skip = opts[:skip] || opts['skip'] || 0\n @j_collection.get_count(to_dbobject(query), to_dbobject(fields), limit, skip)\n end", "title": "" }, { "docid": "1553d0cc26b80a9344b9ef083579f679", "score": "0.55628604", "text": "def field_count\n end", "title": "" }, { "docid": "a2435dcf49811639814722ea577e3c33", "score": "0.55620974", "text": "def count **args\n logger.progname = 'RestOperations#CountRecords'\n query = OrientSupport::OrientQuery.new args\n query.projection 'COUNT(*)'\n result = get_records raw: true, query: query\n result.first[\"COUNT(*)\"] rescue 0 # return_value\n end", "title": "" }, { "docid": "0db56c5ddad6f83c0a6125cf946e2b1b", "score": "0.5560491", "text": "def count(field, value)\n return generate_hash(send_request('count %s \"%s\"' % [field, value]))\n end", "title": "" }, { "docid": "c6881106b304fea96d1b20bdcf733705", "score": "0.55520684", "text": "def hectarage_count(fields)\n hectarage = 0\n fields.each do |field|\n hectarage += field.hectarage\n end\n return hectarage\n end", "title": "" }, { "docid": "797301a3a4e207581e2082a36bcbe286", "score": "0.5549338", "text": "def documents_count\n Api::Web::V1::DocumentsQuery.new(scope, { contact_id: object.id, contact_type: object.class.to_s }).get_documents_count\n end", "title": "" }, { "docid": "7ce49caf9687bb1581d07d2da1cb2346", "score": "0.5538321", "text": "def count(grp)\n @counts[grp] || 0\n end", "title": "" }, { "docid": "ab18be57f45987309e1678a982a9aaaf", "score": "0.5501871", "text": "def group_and_count(*columns)\n group(*columns).select(*(columns + [COUNT_OF_ALL_AS_COUNT])).order(:count)\n end", "title": "" }, { "docid": "9e9dc469df41ccb16fbf64cedfcbe2f4", "score": "0.5449002", "text": "def count(skip_and_limit = false)\n response = RequestResponse.new\n command = BSON::OrderedHash[\"count\", @collection.name, \"query\", @selector]\n\n if skip_and_limit\n command.merge!(BSON::OrderedHash[\"limit\", @limit]) if @limit != 0\n command.merge!(BSON::OrderedHash[\"skip\", @skip]) if @skip != 0\n end\n\n command.merge!(BSON::OrderedHash[\"fields\", @fields])\n\n cmd_resp = @db.command(command)\n\n cmd_resp.callback { |doc| response.succeed( doc['n'].to_i ) }\n cmd_resp.errback do |err|\n if err[1] =~ /ns missing/\n response.succeed(0)\n else\n response.fail([OperationFailure, \"Count failed: #{err[1]}\"])\n end\n end\n\n response\n end", "title": "" }, { "docid": "ae536960c3e5b6ff2456b76d42e52755", "score": "0.5435372", "text": "def field_count\n @fields.size\n end", "title": "" }, { "docid": "d2c72087d6b71a319b09c470b799b080", "score": "0.5425076", "text": "def count_regs\n cve_colls = get_collections\n num = 0\n cve_colls.each do |coll|\n count = @db[\"#{coll}\"].count().to_i\n #puts coll + ' - ' + count.to_s\n num += count\n end\n #puts '[MongoCVE][count_regs] Total documents: ' + num.to_s\n end", "title": "" }, { "docid": "4564f34c68ba6204f6911cce95d97a09", "score": "0.5418717", "text": "def agg_each qry\n raise \"[Error]: Aggregation query object is empty\" unless qry\n rec = 0\n @coll.aggregate(qry).each do |doc|\n rec += 1\n yield doc, rec\n end\n end", "title": "" }, { "docid": "e6c40d62fabe93871856b188207d65c6", "score": "0.54133433", "text": "def group_count(group_by_name, opt = {})\n q = ListQuery.new(@db, self, opt)\n q.group_count(group_by_name)\n end", "title": "" }, { "docid": "dd7bf01948ddac5267fc3c868b82a434", "score": "0.5411726", "text": "def group\n klass.collection.group(\n :key => field_list,\n :cond => selector,\n :initial => { :group => [] },\n :reduce => Javascript.group\n ).collect do |docs|\n docs[\"group\"] = docs[\"group\"].collect do |attrs|\n Mongoid::Factory.from_db(klass, attrs)\n end\n docs\n end\n end", "title": "" }, { "docid": "a8d473cc3c051c1b896566c98f0a8e67", "score": "0.5398342", "text": "def count(*vars)\n variables = deep_merge(*vars)\n result = Find::Scope.flex.count_search(:scope, variables)\n result['hits']['total']\n end", "title": "" }, { "docid": "8fef5f4be7d7c06ae2f2bb6c5fd1c04a", "score": "0.5382285", "text": "def aggregation(groups)\n raise NotImplementedError\n end", "title": "" }, { "docid": "2dadfeb2a95cec8b679f25445ff66bc2", "score": "0.5379238", "text": "def calculate_type_counts\n solr_response = AcademicCommons.search do |p|\n p.aggregators_only.rows(0).facet_by('genre_ssim', 'degree_level_name_ssim').facet_limit(-1)\n end\n\n genre_counts = solr_response.facet_fields['genre_ssim'].each_slice(2).to_a.to_h\n doctoral_count = solr_response.facet_fields['degree_level_name_ssim'].each_slice(2).to_a.to_h\n\n {\n all: solr_response.total,\n articles: genre_counts['Articles'],\n reports: genre_counts['Reports'],\n doctoral_theses: doctoral_count['Doctoral'],\n conference_materials: genre_counts['Conference Objects'],\n datasets: genre_counts['Data (Information)']\n }.transform_values { |v| number_with_delimiter(v.to_i) }\n end", "title": "" }, { "docid": "06a449ede8fb193ecbdf5c0e86e20ea0", "score": "0.53754395", "text": "def create_count_aggregation\n Aggregation::Count.new\n end", "title": "" }, { "docid": "9e83479a320d18b2529bcc6336c0ba4a", "score": "0.53568643", "text": "def group_corpus\n ret = {}\n start = 0\n\n num_docs = 0\n total_docs = RLetters::Solr::CorpusStats.new.size\n\n loop do\n search_result = RLetters::Solr::Connection.search_raw(\n q: '*:*',\n def_type: 'lucene',\n group: 'true',\n 'group.field' => field.to_s,\n fl: 'uid',\n facet: 'false',\n start: start.to_s,\n rows: 100\n )\n\n # These conditions would indicate a malformed Solr response\n break unless search_result.dig('grouped', field.to_s, 'matches')\n\n grouped = search_result['grouped'][field.to_s]\n break if grouped['matches'].zero?\n\n groups = grouped['groups']\n break unless groups\n\n # This indicates that we're out of records\n break if groups.empty?\n\n # Add this batch to the return\n groups.each do |g|\n key = g['groupValue']\n\n # Allow for pathological year values\n key = clean_year(key) if field == :year\n next if key.nil?\n\n val = g['doclist']['numFound']\n\n ret[key] = val\n\n # Update the progress meter\n if progress\n num_docs += g['doclist']['numFound']\n progress.call((num_docs.to_f / total_docs.to_f * 100.0).to_i)\n end\n end\n\n # Get the next batch of groups\n start += 100\n end\n\n progress&.call(100)\n ret\n end", "title": "" }, { "docid": "3c230626c28da6a90bc2b2e9b9038590", "score": "0.53536284", "text": "def field_count(record, opts = {})\n results = {}\n if opts[:subfields]\n record.fields.each do |field|\n tag = field.tag.scrub('')\n case tag\n when /^00/\n results[tag] = 0 unless results[tag]\n results[tag] += 1\n else\n field.subfields.each do |subfield|\n key = tag + subfield.code.to_s.scrub('')\n results[key] = 0 unless results[key]\n results[key] += 1\n end\n end\n end\n else\n record.fields.each do |field|\n tag = field.tag.scrub('')\n results[tag] = 0 unless results[tag]\n results[tag] += 1\n end\n end\n results\nend", "title": "" }, { "docid": "c26ee27213c1a67df6f9439df23a347a", "score": "0.534707", "text": "def count(*args)\n query = args.last.kind_of?(Hash) ? args.pop : {}\n property_name = args.first\n\n if property_name\n assert_kind_of 'property', property_by_name(property_name), Property\n end\n\n aggregate(query.merge(:fields => [ property_name ? property_name.count : :all.count ])).to_i\n end", "title": "" }, { "docid": "09a1fdaa72aeba87907b4e43c5a22865", "score": "0.5330302", "text": "def aggregate_fields\n @aggregate_fields ||= []\n end", "title": "" }, { "docid": "987caa5861ea662d257a4f3e9fc25933", "score": "0.53299916", "text": "def project_count_by_group\n r = nil\n if grouped?\n begin\n # Rails3 will raise an (unexpected) RecordNotFound if there's only a nil group value\n r = Project.\n joins(joins_for_order_statement(group_by_statement)).\n where(statement).\n group(group_by_statement).\n count\n rescue ActiveRecord::RecordNotFound\n r = {nil => project_count}\n end\n c = group_by_column\n if c.is_a?(QueryCustomFieldColumn)\n r = r.keys.inject({}) {|h, k| h[c.custom_field.cast_value(k)] = r[k]; h}\n end\n end\n r\n rescue ::ActiveRecord::StatementInvalid => e\n raise StatementInvalid.new(e.message)\n end", "title": "" }, { "docid": "e5655d365f1613e4a18f914c81b8e936", "score": "0.5324087", "text": "def count(*args)\n coll.count(*args)\n end", "title": "" }, { "docid": "5059409ea036432b259c9b7c6fa38243", "score": "0.5317743", "text": "def count(options={})\n query = {}\n\n if options[:filters]\n query['match'] = options[:filter_match] || 'AND'\n options[:filters].each_with_index do |filter, index|\n query[\"Filter#{ index + 1 }\"] = filter.join(' ')\n end\n end \n\n if options[:system]\n query[:system] = true\n end\n\n @party.get(\"forms/#{@id}/entries/count\", :query => query)['EntryCount']\n end", "title": "" }, { "docid": "21d660fc696d0351921b1d7da966c9f5", "score": "0.53074515", "text": "def project_count_by_group\n r = nil\n if grouped?\n begin\n # Rails3 will raise an (unexpected) RecordNotFound\n # if there's only a nil group value\n r = Project.visible.\n includes(including).where(statement).\n joins(joins_for_order_statement(group_by_statement)).\n group(group_by_statement).count\n rescue ActiveRecord::RecordNotFound\n r = { nil: project_count }\n end\n c = group_by_column\n if c.is_a?(QueryCustomFieldColumn)\n r = r.keys.\n inject({}) { |h, k| h[c.custom_field.cast_value(k)] = r[k]; h }\n end\n end\n r\n rescue ::ActiveRecord::StatementInvalid => e\n raise StatementInvalid.new(e.message)\n end", "title": "" }, { "docid": "a431c33082bfe23d68bb2ccb619c7064", "score": "0.52988964", "text": "def seach_by(fields, positive: true)\n results = name_index.dup\n results.each do |_, items|\n items.each do |item|\n item[:hits] = 0\n end\n end\n\n fields.with_indifferent_access.slice(*FIELDS).each_pair do |field, filters|\n case filters\n when String\n results = filter_by_string(results, field, filters, positive)\n when Array\n results = filter_by_array(results, field, filters, positive)\n else\n raise ArgumentError, 'Value of filter should be String or Array'\n end\n end\n\n convert_raw_to_model results.values.flatten\n end", "title": "" }, { "docid": "63efdd62a5feb970ff7d9d81174c8ee9", "score": "0.52885324", "text": "def sum_label_counts(type=false, ids = false)\n options = {:item_id => self.id}\n options.merge!(:type => type) if type\n options.merge!(:user_id => {'$in' => ids}) if ids\n \n count_array = self.labels.collection.group(['item_id'], options, {'count' => 0}, \"function(doc, prev) {prev.count += 1;}\")\n\t\t#~ count_array = []\n if count_array.length > 0\n #~ return count_array.first['count']\n #~ result = count_array.first['count'].scan(/.*](\\d)/)\n result = count_array.first['count'].to_s.split('.')\n\t\t\treturn (result.empty?)? 0 : result.flatten.first.to_f\n else\n \n return 0\n end\n end", "title": "" }, { "docid": "e421f9d84a98479273fa339d1d528bf6", "score": "0.5276851", "text": "def count(filters = {})\n call('domain.count', filters)\n end", "title": "" }, { "docid": "3136cb4e93f015e5bc31b2c543942696", "score": "0.52742636", "text": "def summarize_counts(tag, group_counts)\n tag = 'all' if @aggregate == :all\n @counts[tag] ||= {}\n \n @mutex.synchronize {\n group_counts.each do |group_key, count|\n @counts[tag][group_key] ||= {}\n countup(@counts[tag][group_key], count)\n end\n\n # total_count = group_counts.map {|group_key, count| count[:count] }.inject(:+)\n # @counts[tag]['__total_count'] = sum(@counts[tag]['__total_count'], total_count)\n }\n end", "title": "" }, { "docid": "7a4eec97eb307eec8af9faacd3d5c36c", "score": "0.5264664", "text": "def count(*args)\n union_relations.map do |union_model, relation|\n relation.send(:count, *args)\n end.reduce(:+)\n end", "title": "" }, { "docid": "653e56f1c4b2902ed66d112793d8bb71", "score": "0.52553165", "text": "def aggregate(field, mode, conditions = {})\n conditions.merge!({ aggregation: { field: field, type: mode } })\n filter(conditions).aggregations[field.to_sym]\n end", "title": "" }, { "docid": "c29483561c1823d65c595c32c4b1087d", "score": "0.5241714", "text": "def group_count(*props)\n result = Hash.new(0)\n props = props.collect { |p| p.to_s }\n if props.empty? and block_given?\n each { |e| result[yield(e)] += 1 }\n elsif block_given?\n each do |e|\n key = props.collect { |p| e.getProperty(p) }\n key << yield(e)\n result[key] += 1\n end\n elsif props.count == 1\n prop = props.first\n each do |e|\n result[e.getProperty(prop)] += 1\n end\n elsif props.any?\n each do |e|\n result[props.collect { |p| e.getProperty(p) }] += 1\n end\n else\n each do |e|\n result[e] += 1\n end\n end\n result\n end", "title": "" }, { "docid": "c29483561c1823d65c595c32c4b1087d", "score": "0.5241714", "text": "def group_count(*props)\n result = Hash.new(0)\n props = props.collect { |p| p.to_s }\n if props.empty? and block_given?\n each { |e| result[yield(e)] += 1 }\n elsif block_given?\n each do |e|\n key = props.collect { |p| e.getProperty(p) }\n key << yield(e)\n result[key] += 1\n end\n elsif props.count == 1\n prop = props.first\n each do |e|\n result[e.getProperty(prop)] += 1\n end\n elsif props.any?\n each do |e|\n result[props.collect { |p| e.getProperty(p) }] += 1\n end\n else\n each do |e|\n result[e] += 1\n end\n end\n result\n end", "title": "" }, { "docid": "ec378f81edb1a1e7bc94b867190c85a8", "score": "0.52222264", "text": "def all_documents_count\n Api::Web::V1::DocumentsQuery.new(scope, { client_id: object.id }).get_all_documents_count\n end", "title": "" }, { "docid": "87a0759314dce4a390a7e57f890a294e", "score": "0.5221189", "text": "def group_dataset(dataset, field)\n ret = {}\n total = dataset.entries.size\n\n enum = RLetters::Datasets::DocumentEnumerator.new(dataset)\n enum.each_with_index do |doc, i|\n key = get_field_for_grouping(doc, field)\n ret[key] ||= 0\n ret[key] += 1\n\n @progress.call((i.to_f / total.to_f * 100.0).to_i) if @progress\n end\n\n @progress.call(100) if @progress\n\n ret\n end", "title": "" }, { "docid": "330378866eb7f5cd2816df3927c19820", "score": "0.52182525", "text": "def aggregate_by(field, method)\n return nil unless any?\n\n map { |doc| doc.public_send(field) }.compact.public_send(method)\n end", "title": "" }, { "docid": "034c5caa8f1562fe3893fa3ad2e195f9", "score": "0.52123106", "text": "def count\n ensure_aggregate!\n @driver.aggregate_count( @func )\n end", "title": "" }, { "docid": "f377e4bbb6f652cbf5efd5403b54ae32", "score": "0.5210825", "text": "def grouped_uids_corpus(field)\n ret = {}\n start = 0\n\n num_docs = 0\n total_docs = RLetters::Solr::CorpusStats.new.size\n\n loop do\n group_result = RLetters::Solr::Connection.search_raw({\n q: '*:*',\n def_type: 'lucene',\n group: 'true',\n 'group.field' => field.to_s,\n fl: 'uid',\n facet: 'false',\n start: start.to_s,\n rows: 1\n })\n\n # These conditions would indicate a malformed Solr response\n break unless group_result['grouped'] &&\n group_result['grouped'][field.to_s] &&\n group_result['grouped'][field.to_s]['matches']\n\n grouped = group_result['grouped'][field.to_s]\n break if grouped['matches'] == 0\n\n groups = grouped['groups']\n break unless groups\n\n # This indicates that we're out of records\n break if groups.empty?\n\n # Get the group\n group = groups[0]\n\n # Run a new query to get all of the UIDs\n key = group['groupValue']\n group_size = group['doclist']['numFound']\n\n uids_result = RLetters::Solr::Connection.search_raw({\n q: '*:*',\n def_type: 'lucene',\n group: 'true',\n 'group.field' => field.to_s,\n fl: 'uid',\n facet: 'false',\n start: start.to_s,\n rows: 1,\n 'group.limit' => group_size\n })\n\n # Malformed Solr response\n break unless uids_result['grouped'] &&\n uids_result['grouped'][field.to_s] &&\n uids_result['grouped'][field.to_s]['groups']\n\n # Turn the documents list into a UIDs list\n uid_group = uids_result['grouped'][field.to_s]['groups'][0]\n ret[key] = uid_group['doclist']['docs'].map do |doc|\n doc['uid']\n end\n\n # Get the next group\n start += 1\n\n # Update the progress meter\n if @progress\n num_docs += group_size\n @progress.call((num_docs.to_f / total_docs.to_f * 50.0).to_i)\n end\n end\n\n @progress.call(50) if @progress\n\n ret\n end", "title": "" }, { "docid": "4e75b93d5922ac5367b07d6bb98d4da3", "score": "0.5197861", "text": "def all_with_counts\n taggings\n .reselect(\"#{tag_alias}, count(*) as count\")\n .group(tag_alias)\n end", "title": "" }, { "docid": "88e133a14f17a7935c542b2c6f16ea79", "score": "0.5190087", "text": "def count\n (field('count') || 0).to_i\n end", "title": "" }, { "docid": "9466fe499daaa525224747b6490c70f9", "score": "0.5188687", "text": "def group_times\n \t@coll.find.aggregate([\n \t\t{ :$group=> {\n \t\t\t\t:_id=> { :age=> \"$group\", :gender=> \"$gender\" },\n \t\trunners: { :$sum=> 1 },\n fastest_time: { :$min=> \"$secs\" }\n }\n }\n ])\n end", "title": "" }, { "docid": "9330639b8dc96184b9ba8c67f78e758b", "score": "0.5186838", "text": "def count_records_in_measure_groups\n patient_cache = get_db.collection('patient_cache')\n query = {'value.measure_id' => @measure_id, 'value.sub_id' => @sub_id,\n 'value.effective_date' => @parameter_values['effective_date'],\n 'value.test_id' => @parameter_values['test_id']}\n result = {:measure_id => @measure_id, :sub_id => @sub_id, \n :effective_date => @parameter_values['effective_date'],\n :test_id => @parameter_values['test_id']}\n %w(population denominator numerator antinumerator exclusions).each do |measure_group|\n patient_cache.find(query.merge(\"value.#{measure_group}\" => true)) do |cursor|\n result[measure_group] = cursor.count\n end\n end\n get_db.collection(\"query_cache\").save(result)\n result\n end", "title": "" }, { "docid": "34f89b8cc59ceca7f1871c94e2b6c658", "score": "0.5179253", "text": "def count_all\n result = connection.get(\"/#{database_name}\")\n JSON.parse(result)['doc_count'].to_i\n end", "title": "" }, { "docid": "ebbf2cd77f86c388af55f8e24a8688ca", "score": "0.51781416", "text": "def count_for(*order_groups)\n order_groups.sum { |group| public_send(group).count }\n end", "title": "" }, { "docid": "33fbcd60dfaea4bfcb4da7ad4a230ebf", "score": "0.517179", "text": "def counts(query, report)\n case report\n when :users\n limit(query, report).group(:company_id).count(:company_id)\n when :sent_recognitions\n limit(query, report).group(:company_id).count(:company_id)\n when :received_recognitions, :approvals, :redemptions\n limit(query, report).group(:company_id).count(:company_id)\n when :comments\n limit(query, report).group(:company_id).count(:company_id)\n else\n raise \"Didn't find counts query for: #{report}\"\n end\n end", "title": "" }, { "docid": "c1d885565f9c3fcf394f4f4ca272e671", "score": "0.516165", "text": "def mysql_search_count_all()\n count = []\n records = Counter.order(\"created_date DESC\")\n records.each do |value|\n count << [value.group_name, value]\n end\n return count\nend", "title": "" }, { "docid": "81100e628f7d8c81378ac2395173c933", "score": "0.5159062", "text": "def field_stats(field)\n Hash[Campaign.joins(:daily_tracking_records)\n .select(\"SUM(#{field}) AS #{field}, date\")\n .where(sb_daily_tracking_records: {campaign_id: @campaign_id, date: @start_date..@end_date})\n .group(:date).launched(@user).by_company(@company).map { |m| [m.date.to_time.to_i*1000, m[@data_type]] if m.date.present? }]\n end", "title": "" }, { "docid": "80b3123ece8c79cdf3da2b539cb204fe", "score": "0.51581246", "text": "def count\n @driver.aggregate_count( @func )\n end", "title": "" }, { "docid": "48d502067953d564490034389c1dd67c", "score": "0.51507074", "text": "def count\n count = field('count')\n count.to_i\n end", "title": "" }, { "docid": "ebc3958faa565097c45008e4eeabc29e", "score": "0.51494366", "text": "def count\n return @fields_update.count\n end", "title": "" }, { "docid": "aa7ee289a8460937db12dc977d5b2b5c", "score": "0.5130687", "text": "def get_total(mongoid_objects)\n\t\tsum = 0\n\t\tmongoid_objects.each do |object|\n\t\t\tsum += object.value.to_i\n\t\tend\n\t\tsum\n\tend", "title": "" }, { "docid": "fcb525b871fad7d416b90cb495e301e9", "score": "0.51304394", "text": "def count\n documents.length\n end", "title": "" }, { "docid": "da77702c64ac2c2fb699072bb726449c", "score": "0.51298743", "text": "def add_count aggregate_alias: nil\n aggregate_alias ||= ALIASES[:count]\n new_aggregate = Google::Cloud::Firestore::V1::StructuredAggregationQuery::Aggregation.new(\n count: Google::Cloud::Firestore::V1::StructuredAggregationQuery::Aggregation::Count.new,\n alias: aggregate_alias\n )\n\n start new_aggregate\n end", "title": "" }, { "docid": "7583ff8b695f64087e2a9e7fc690b79e", "score": "0.51298594", "text": "def aggregations\n {}\n end", "title": "" }, { "docid": "2ecac3532c12af7b3b919cfc21a33c90", "score": "0.51287484", "text": "def collect_counts(hn_doc_name, hn_doc_text)\n COLLECTION_SETS.each_pair do |collection_set_name, set|\n HN_DATA[collection_set_name] = {} unless HN_DATA.has_key?(collection_set_name) # should inject instead of setting up beforehand\n HN_DATA[collection_set_name][hn_doc_name] = {} unless HN_DATA[collection_set_name].has_key?(hn_doc_name)\n set.each do |term|\n # have to extract with a non-alpha character on each side to match\n # terms like \"c\" and \"java\" vs \"javascript\"\n count = hn_doc_text.scan(/[^a-z]#{Regexp.escape(term)}[^a-z]/im).size\n HN_DATA[collection_set_name][hn_doc_name][term] = count\n end\n end\nend", "title": "" }, { "docid": "d49fbd95dde62fba42518e592aaec588", "score": "0.51099306", "text": "def count(*args)\n if @reflection.options[:counter_sql]\n @reflection.klass.count_by_sql(@counter_sql)\n elsif @reflection.options[:finder_sql]\n @reflection.klass.count_by_sql(@finder_sql)\n else\n column_name, options = @reflection.klass.send(:construct_count_options_from_args, *args) \n options[:conditions] = options[:conditions].nil? ?\n @finder_sql :\n @finder_sql + \" AND (#{sanitize_sql(options[:conditions])})\"\n options[:include] ||= @reflection.options[:include]\n\n @reflection.klass.count(column_name, options)\n end\n end", "title": "" }, { "docid": "afd493e3471cc3243defeca759284128", "score": "0.5102306", "text": "def calculate_cv_aggregation\n cv_pipeline = build_query\n cv_pipeline.first['$match'][\"value.#{QME::QualityReport::MSRPOPL}\"] = {'$gt'=>0}\n cv_pipeline << {'$unwind' => '$value.values'}\n cv_pipeline << {'$group' => {'_id' => '$value.values', 'count' => {'$sum' => 1}}}\n\n aggregate = get_db.command(:aggregate => 'patient_cache', :pipeline => cv_pipeline)\n aggregate_document = aggregate.documents[0]\n\n raise RuntimeError, \"Aggregation Failed\" if aggregate_document['ok'] != 1\n\n frequencies = {}\n aggregate_document['result'].each do |freq_count_pair|\n frequencies[freq_count_pair['_id']] = freq_count_pair['count']\n end\n QME::MapReduce::CVAggregator.send(@measure_def.aggregator.parameterize, frequencies)\n end", "title": "" }, { "docid": "3d24eca0dd9f5cbd0960be8d846815c2", "score": "0.509305", "text": "def search_count(filters = {})\n final_options = {:conditions => build_conditions_from_filters(filters)}\n # Eager loading joins\n if self.constants.include?('EAGER_LOADING_JOINS')\n final_options[:include] = self::EAGER_LOADING_JOINS\n end\n filters.assert_valid_keys(self::FILTER_MAPPINGS.keys)\n count(final_options)\n end", "title": "" }, { "docid": "cd43b261ea74bdc3381da7c90ff12b79", "score": "0.50922036", "text": "def third_question\n unwind = { \"$unwind\" => \"$courses\"}\n match = { \"$match\" => { \"$and\" => [\n { \"courses.dept\" => \"ECON\" },\n {\"courses.crs_num\" => 131 },\n {\"courses.grade\" => \"A\"}]\n }}\n group = { \"$group\" => { \"_id\" => \"null\", \"count\" => {\"$sum\" => 1}} }\n\n @q3 = Student.collection.aggregate([unwind, match, group])\n end", "title": "" }, { "docid": "2f281d02cd9308db4e5b5f100142e0c4", "score": "0.50917184", "text": "def count_records_in_measure_groups\n patient_cache = get_db.collection('patient_cache')\n query = {'value.measure_id' => @measure_id, 'value.sub_id' => @sub_id,\n 'value.effective_date' => @parameter_values['effective_date'],\n 'value.test_id' => @parameter_values['test_id']}\n \n query.merge!(filter_parameters)\n \n result = {:measure_id => @measure_id, :sub_id => @sub_id, \n :effective_date => @parameter_values['effective_date'],\n :test_id => @parameter_values['test_id'], :filters => @parameter_values['filters']}\n \n aggregate = patient_cache.group({cond: query, \n initial: {population: 0, denominator: 0, numerator: 0, antinumerator: 0, exclusions: 0, considered: 0}, \n reduce: \"function(record,sums) { for (var key in sums) { sums[key] += (record['value'][key] || key == 'considered') ? 1 : 0 } }\"}).first\n \n aggregate ||= {population: 0, denominator: 0, numerator: 0, antinumerator: 0, exclusions: 0}\n aggregate.each {|key, value| aggregate[key] = value.to_i}\n result.merge!(aggregate)\n \n# need to time the old way agains the single query to verify that the single query is more performant \n# %w(population denominator numerator antinumerator exclusions).each do |measure_group|\n# patient_cache.find(query.merge(\"value.#{measure_group}\" => true)) do |cursor|\n# result[measure_group] = cursor.count\n# end\n# end\n\n result.merge!(execution_time: (Time.now.to_i - @parameter_values['start_time'].to_i)) if @parameter_values['start_time']\n\n get_db.collection(\"query_cache\").save(result, safe: true)\n result\n end", "title": "" }, { "docid": "1fdd85594ebcf1f341af1f6c8be4fddd", "score": "0.5082276", "text": "def issue_count_by_group\n r = nil\n if @query.grouped?\n begin\n # Rails3 will raise an (unexpected) RecordNotFound if there's only a nil group value\n r = Issue.visible.\n joins(:status, :project).\n where(@query.statement).\n joins(joins_for_order_statement(@query.group_by_statement)).\n group(@query.group_by_statement).\n where(inline_edit_condition).\n count\n rescue ActiveRecord::RecordNotFound\n r = {nil => @query.issue_count}\n end\n c = @query.group_by_column\n if c.is_a?(QueryCustomFieldColumn)\n r = r.keys.inject({}) { |h, k| h[c.custom_field.cast_value(k)] = r[k]; h }\n end\n end\n r\n rescue ::ActiveRecord::StatementInvalid => e\n raise StatementInvalid.new(e.message)\n end", "title": "" }, { "docid": "3d52161fcc5a7291d6315aca2b376dcc", "score": "0.5065385", "text": "def captured_group_counts; end", "title": "" }, { "docid": "3d52161fcc5a7291d6315aca2b376dcc", "score": "0.5065385", "text": "def captured_group_counts; end", "title": "" }, { "docid": "3d52161fcc5a7291d6315aca2b376dcc", "score": "0.5065385", "text": "def captured_group_counts; end", "title": "" }, { "docid": "cc2c87ba4dadb4e476cb8c5623d9a59d", "score": "0.5062181", "text": "def count(*args)\n find_by,options = build_options(args)\n return self.model.count(options)\n end", "title": "" }, { "docid": "e043b75ce44cadf75f4315930e89018c", "score": "0.505423", "text": "def compute_stats(*fields)\n return self if fields.empty?\n\n clone.tap do |r|\n r.stats_values += Array.wrap(fields)\n end\n end", "title": "" }, { "docid": "ab14bb6c7a6a42fe6ce87125cb827bb9", "score": "0.50348604", "text": "def count\n filtered = apply_criteria(@data)\n filtered.count\n end", "title": "" }, { "docid": "83297533d734df4843426234b6931bf2", "score": "0.50341195", "text": "def count **args\n orientdb.count_records from: self, **args\n end", "title": "" }, { "docid": "40d501f38043c188e46d8f21982144da", "score": "0.50330424", "text": "def group\n collection.group(\n options[:fields],\n selector,\n { :group => [] },\n GROUP_REDUCE,\n true\n ).collect {|docs| docs[\"group\"] = MongoDoc::BSON.decode(docs[\"group\"]); docs }\n end", "title": "" }, { "docid": "6cb69b8166a3ac8f7a2e59ad5e47e612", "score": "0.5028532", "text": "def count_records(opts={})\n query('summary/count/records/', opts, {rq: {}})['itemCount']\n end", "title": "" }, { "docid": "e3e348d62883d29facc4c20ab74b88f2", "score": "0.50215983", "text": "def num_hits\n if object.params[:q]&.!=('*:*') || object.params[:fq]\n I18n.t 'search.index.num_hits_found', count: object.num_hits\n else\n I18n.t 'search.index.num_documents_database', count: object.num_hits\n end\n end", "title": "" }, { "docid": "f7cc81ffd7a0a820aa43ab1fedbcac31", "score": "0.50185776", "text": "def sum(field)\n grouped(:sum, field.to_s, SUM_REDUCE)\n end", "title": "" }, { "docid": "341eeb9ebde6c6787011f2a85ddc425c", "score": "0.5011076", "text": "def system_user_defined_fields_count_get(opts = {})\n data, _status_code, _headers = system_user_defined_fields_count_get_with_http_info(opts)\n return data\n end", "title": "" }, { "docid": "f39b26fb2238c179123fe860882c5fe0", "score": "0.5006803", "text": "def count(options={})\n criteria = criteria_from(options[:conditions],options[:criteria]).merge!(where_func(options[:where]))\n begin\n collection.find(criteria).count()\n rescue => ex\n if ex.to_s =~ /Error with count command.*ns missing/\n # Return 0 because we will graciously assume that we are being\n # called from a subclass that has been initialized properly, and\n # is therefore mentioned in the schema.\n 0\n else\n raise ex\n end\n end\n end", "title": "" }, { "docid": "65eb0ed09bd6645ae23fadeba6b60caf", "score": "0.5004351", "text": "def total_db_metadata_fields_count\n count = 0\n \n count += 1 unless self.description.blank?\n count += 1 unless self.documentation_url.blank?\n \n self.soap_operations.each do |op|\n count += 1 unless op.description.blank?\n count += 1 unless op.parameter_order.blank?\n \n op.soap_inputs.each do |input|\n count += 1 unless input.description.blank?\n count += 1 unless input.computational_type.blank?\n end\n \n op.soap_outputs.each do |output|\n count += 1 unless output.description.blank?\n count += 1 unless output.computational_type.blank?\n count += 1 unless output.computational_type_details.blank?\n end\n end\n \n return count\n end", "title": "" }, { "docid": "31f99739e55c27eca632642569dbb134", "score": "0.50037235", "text": "def grouped_docs\n @grouped_docs[@association.name] ||= @docs.group_by do |doc|\n doc.send(group_by_key) if doc.respond_to?(group_by_key)\n end.reject do |k, v|\n k.nil?\n end\n end", "title": "" } ]
446968444e195a94b1f49e502910318e
POST /faculties POST /faculties.json
[ { "docid": "1998a8d585bbf3243abcdd5ac11f926f", "score": "0.5553223", "text": "def create\n @faculty = Faculty.new(faculty_params)\n\n respond_to do |format|\n if @faculty.save\n format.html { redirect_to microposts_path, notice: 'Faculty was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end", "title": "" } ]
[ { "docid": "d907a53f73e255db227e72cd3a8bb5c9", "score": "0.7901842", "text": "def create\n @faculties = Faculty.create!(faculty_params)\n json_response(@faculties, :created)\n end", "title": "" }, { "docid": "5ed4a13f4b0585f9542ef2845cba5dff", "score": "0.69751865", "text": "def create\n @facult = Facult.new(facult_params)\n\n respond_to do |format|\n if @facult.save\n format.html { redirect_to @facult, notice: 'Facult was successfully created.' }\n format.json { render action: 'show', status: :created, location: @facult }\n else\n format.html { render action: 'new' }\n format.json { render json: @facult.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2baffb09b3ec980aded6e5d69c0c4df1", "score": "0.6840384", "text": "def faculties\n @faculties = Faculty.where(university_id: params[:university_id]).order(:name)\n @courses = []\n respond_to do |format|\n format.json { render json: @faculties }\n end\n end", "title": "" }, { "docid": "d60ac131930baf69762de3c3b835a8f4", "score": "0.66058135", "text": "def index\n @faculties = Faculty.all\n json_response(@faculties)\n end", "title": "" }, { "docid": "fd42a45ffb9453b39e22e5da08887635", "score": "0.65601563", "text": "def create\n @facility = Facility.new(facility_params)\n @facility.save\n respond_with @facility\n end", "title": "" }, { "docid": "acfaf983cb4cf3f493158322f63229d3", "score": "0.6530278", "text": "def create\n @facility = Facility.new(params[:facility])\n\n respond_to do |format|\n if @facility.save\n format.html { redirect_to @facility, notice: 'Facility was successfully created.' }\n format.json { render json: @facility, status: :created, location: @facility }\n else\n format.html { render action: \"new\" }\n format.json { render json: @facility.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "78e9a150a3c9f3f4752a41290fc04311", "score": "0.6507423", "text": "def create\n @faculty = Faculty.new(faculty_params)\n\n respond_to do |format|\n if @faculty.save\n format.html { redirect_to @faculty, notice: 'Faculty was successfully created.' }\n format.json { render :show, status: :created, location: @faculty }\n else\n format.html { render :new }\n format.json { render json: @faculty.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cd7f54048607b8bc88d6b6495b3dd27c", "score": "0.64741087", "text": "def create\n @facility = Facility.new(facility_params)\n\n respond_to do |format|\n if @facility.save\n format.html { redirect_to @facility, notice: \"Facility was successfully created.\" }\n format.json { render :show, status: :created, location: @facility }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @facility.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "083f59ba7f39f46314ba4e41b005f9cb", "score": "0.6471413", "text": "def create\n @facility = Facility.new(facility_params)\n\n respond_to do |format|\n if @facility.save\n format.html { redirect_to @facility, notice: 'Facility was successfully created.' }\n format.json { render :show, status: :created, location: @facility }\n else\n format.html { render :new }\n format.json { render json: @facility.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b2afa0d67bc089ac4072ea53c1af680b", "score": "0.6451322", "text": "def add_new_faculty\n new_faculty = Faculty.find_by_name(params[:faculty_name])\n\n if new_faculty.nil?\n new_faculty = Faculty.create(name: params[:faculty_name])\n\n unless params[:department_id].nil? || params[:current_department_id] == -1\n department = Department.find(params[:current_department_id])\n unless department.nil?\n department.faculty = new_faculty\n end\n end\n\n end\n\n data = {new_faculty_id: new_faculty.id}\n render json: data\n end", "title": "" }, { "docid": "893287ff803714e9302b7192b5cdda3d", "score": "0.6367607", "text": "def create\n @facility = Facility.new(facility_params)\n\n respond_to do |format|\n if @facility.save\n format.html { redirect_to edit_facility_path(@facility), notice: 'Facility was successfully created.' }\n format.json { render :edit, status: :created, location: @facility }\n else\n format.html { render :new }\n format.json { render json: @facility.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ce9f1da32d9fdb6ade0146d6fbed86c5", "score": "0.6359761", "text": "def create\n @facultade = Facultade.new(facultade_params)\n\n respond_to do |format|\n if @facultade.save\n format.html { redirect_to @facultade, notice: 'Facultade was successfully created.' }\n format.json { render :show, status: :created, location: @facultade }\n else\n format.html { render :new }\n format.json { render json: @facultade.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8b373c43fef4b2092ec0d917756242a0", "score": "0.6301136", "text": "def create\n @facultad = Facultad.new(facultad_params)\n\n respond_to do |format|\n if @facultad.save\n format.html { redirect_to @facultad, notice: 'Facultad was successfully created.' }\n format.json { render :show, status: :created, location: @facultad }\n else\n format.html { render :new }\n format.json { render json: @facultad.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2e2dfb6b41dcb284bf2022e36a2ed89b", "score": "0.6229247", "text": "def create\n @facultad = Facultad.new(facultad_params)\n\n respond_to do |format|\n if @facultad.save\n format.html { redirect_to facultade_path(@facultad), notice: \"Facultad fue creada correctamente.\" }\n format.json { render :show, status: :created, location: @facultad }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @facultad.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7c00e04db83c731719a5e63b5a7b08ea", "score": "0.6195766", "text": "def new\n @facility = Facility.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @facility }\n end\n end", "title": "" }, { "docid": "9799877a90aaa6ed084bb12908c936ce", "score": "0.61205107", "text": "def create\n @facility = Facility.new(facility_params)\n if @facility.save\n redirect_to facilities_path, notice: 'Facility was successfully created.'\n else\n render :new\n end\n end", "title": "" }, { "docid": "7ef2c6006c15744ffea62a4efb229036", "score": "0.6072586", "text": "def create\n @fiestum = Fiestum.new(fiestum_params)\n\n respond_to do |format|\n if @fiestum.save\n format.html { redirect_to @fiestum, notice: 'Fiestum was successfully created.' }\n format.json { render :show, status: :created, location: @fiestum }\n else\n format.html { render :new }\n format.json { render json: @fiestum.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4afd3d2387804cc9410f03333baf1a90", "score": "0.60625714", "text": "def create\n @facility = Facility.new(facility_params)\n @facility.citizen = current_citizen\n\n respond_to do |format|\n if @facility.save\n format.html { redirect_to @facility, notice: 'Facility was successfully built.' }\n format.json { render :show, status: :created, location: @facility }\n else\n format.html { render :new }\n format.json { render json: @facility.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c3070e4ff4f2512393025af1bfc114ac", "score": "0.60416585", "text": "def create\n @factors_user = FactorsUser.new(params[:factors_user])\n\n respond_to do |format|\n if @factors_user.save\n format.html { redirect_to \"/factors_users/new?factor_id=#{@factors_user.factor_id + 1}\", notice: 'Factors user was successfully created.' }\n format.json { render json: @factors_user, status: :created, location: @factors_user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @factors_user.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dd15724b2d93723e4dd84987b5a1303a", "score": "0.60260546", "text": "def create\n @faculty_type = FacultyType.new(faculty_type_params)\n\n respond_to do |format|\n if @faculty_type.save\n format.html { redirect_to faculty_types_path, notice: 'Faculty type was successfully created.' }\n format.json { render :show, status: :created, location: @faculty_type }\n else\n format.html { render :new }\n format.json { render json: @faculty_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1d783fd7f01649c7727cc7d53d77b3ea", "score": "0.59713763", "text": "def index\n # @faculties = Faculty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: Oj.dump(@faculties, mode: :compat) }\n end\n end", "title": "" }, { "docid": "8f28532018b15f4b9a4f90bf6723c0a3", "score": "0.59525496", "text": "def create\n @facility_item = FacilityItem.new(facility_item_params)\n\n respond_to do |format|\n if @facility_item.save\n format.html { redirect_to @facility_item, notice: 'Facility item was successfully created.' }\n format.json { render :show, status: :created, location: @facility_item }\n else\n format.html { render :new }\n format.json { render json: @facility_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8c2be2bd670bbd988f0371a3d7406b54", "score": "0.5933975", "text": "def create\n @fact = @cat.facts.create!({ fact: api_request })\n if @fact.save\n render json: @fact\n else\n render error: { message: \"Não foi possível criar esse fato para este gatinho! :(\" }, status: 400\n end\n end", "title": "" }, { "docid": "0aa6fb7107776b393dd888dbdc631dfd", "score": "0.5912", "text": "def create\n @facility_total = FacilityTotal.new(params[:facility_total])\n\n respond_to do |format|\n if @facility_total.save\n format.html { redirect_to @facility_total, notice: 'Facility total was successfully created.' }\n format.json { render json: @facility_total, status: :created, location: @facility_total }\n else\n format.html { render action: \"new\" }\n format.json { render json: @facility_total.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e888d82cda3c7b311fd483234924d53a", "score": "0.5851949", "text": "def create\n @factor = Factor.new(params[:factor])\n\n respond_to do |format|\n if @factor.save\n format.html { redirect_to @factor, notice: 'Factor was successfully created.' }\n format.json { render json: @factor, status: :created, factor: @factor }\n else\n format.html { render action: \"new\" }\n format.json { render json: @factor.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e75ab3954bedfd1796ca54d1daabc8d0", "score": "0.584383", "text": "def create\n @facility_type = FacilityType.new(facility_type_params)\n\n respond_to do |format|\n if @facility_type.save\n format.html { redirect_to @facility_type, notice: \"Facility type was successfully created.\" }\n format.json { render :show, status: :created, location: @facility_type }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @facility_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d79fe71652bd30828ad1985620c896e5", "score": "0.5816946", "text": "def show\n render json: @faculty\n end", "title": "" }, { "docid": "3dbc5f7ff4be6d2fd8bd9c6a88376309", "score": "0.5800681", "text": "def create\n @facility_item = FacilityItem.new(facility_item_params)\n\n respond_to do |format|\n if @facility_item.save\n format.html { redirect_to '/facilities/'+@facility_item.facility_id.to_s+'/facility_items', notice: 'Facility item was successfully created.' }\n format.json { render :show, status: :created, location: @facility_item }\n else\n format.html { render :new }\n format.json { render json: @facility_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ba03e9337c06d6def9da93bbccbf8f47", "score": "0.5784316", "text": "def create\n @membership_fee = MembershipFee.new(params[:membership_fee])\n\n respond_to do |format|\n if @membership_fee.save\n format.html { redirect_to @membership_fee, notice: 'Membership fee was successfully created.' }\n format.json { render json: @membership_fee, status: :created, location: @membership_fee }\n else\n format.html { render action: \"new\" }\n format.json { render json: @membership_fee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "292f2e6cbc7917c42e5ba02179e0c0ee", "score": "0.57829463", "text": "def create\n @factores_fluctuante = FactoresFluctuante.new(factores_fluctuante_params)\n\n respond_to do |format|\n if @factores_fluctuante.save\n format.html { redirect_to @factores_fluctuante, notice: 'Factores fluctuante was successfully created.' }\n format.json { render :show, status: :created, location: @factores_fluctuante }\n else\n format.html { render :new }\n format.json { render json: @factores_fluctuante.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d57acb28c34185f6be6fa6ec1b0d12e4", "score": "0.57825035", "text": "def new\n @fortune = Fortune.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fortune }\n end\n end", "title": "" }, { "docid": "ae12c3a36c0fd1f7b69a15df9a2800b6", "score": "0.5773247", "text": "def facult_params\n params.require(:facult).permit(:name, :logo, :info, :url)\n end", "title": "" }, { "docid": "85a32d5c74b622a037fb914bb66b6509", "score": "0.5763582", "text": "def creacion\n fiesta = Fiesta.new (params[:id])\n if Fiesta.save\n puts \"su fiesta a sido registrada\"\n else \n puts \"su fiesta no a sido registrada\"\n end\n render = json: fiesta \n end", "title": "" }, { "docid": "49ee5f68846d4705afbd14698989cfad", "score": "0.57505405", "text": "def index\n @facults = Facult.all\n end", "title": "" }, { "docid": "ea6a2f397065bbc523d6dcd2f34ad956", "score": "0.5737472", "text": "def create\n @diagnosis_facility = DiagnosisFacility.new(diagnosis_facility_params)\n\n respond_to do |format|\n if @diagnosis_facility.save\n format.html { redirect_to @diagnosis_facility, notice: 'Diagnosis facility was successfully created.' }\n format.json { render :show, status: :created, location: @diagnosis_facility }\n else\n format.html { render :new }\n format.json { render json: @diagnosis_facility.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ad8a8995971f9ff2abef4dda707c6fee", "score": "0.5735234", "text": "def index\n @faculties = Faculty.all\n end", "title": "" }, { "docid": "ad8a8995971f9ff2abef4dda707c6fee", "score": "0.5735234", "text": "def index\n @faculties = Faculty.all\n end", "title": "" }, { "docid": "78428efc1961dc49dade07ece05c6667", "score": "0.5732414", "text": "def create\n @form_factor = FormFactor.new(form_factor_params)\n\n respond_to do |format|\n if @form_factor.save\n format.html { redirect_to @form_factor, notice: 'Form factor was successfully created.' }\n format.json { render :show, status: :created, location: @form_factor }\n else\n format.html { render :new }\n format.json { render json: @form_factor.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "87783326dddfb25d21f91060d1eef5b3", "score": "0.57164025", "text": "def create\n @home_facility = HomeFacility.new(home_facility_params)\n\n respond_to do |format|\n if @home_facility.save\n format.html { redirect_to @home_facility, notice: 'Home facility was successfully created.' }\n format.json { render :show, status: :created, location: @home_facility }\n else\n format.html { render :new }\n format.json { render json: @home_facility.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a658d7d5d578d42ecb62d46e37ac7008", "score": "0.5715807", "text": "def show\n json_response(@faculty)\n end", "title": "" }, { "docid": "3baf4aa4ec7722fa76791ba0ad7e8a90", "score": "0.5712247", "text": "def create\n @faafacility = Faafacility.new(params[:faafacility])\n\n respond_to do |format|\n if @faafacility.save\n format.html { redirect_to @faafacility, notice: 'Faafacility was successfully created.' }\n format.json { render json: @faafacility, status: :created, location: @faafacility }\n else\n format.html { render action: \"new\" }\n format.json { render json: @faafacility.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "89d54b248d6647ead63cdc54e857ec82", "score": "0.5695867", "text": "def new\n render :json => @fiestas.push(params[:fiesta])\n end", "title": "" }, { "docid": "d6d4c1c9a1632667bc46d41e7c1a0dba", "score": "0.56957734", "text": "def create\n @famille = Famille.new(famille_params)\n\n respond_to do |format|\n if @famille.save\n format.html { redirect_to @famille, notice: 'Famille was successfully created.' }\n format.json { render :show, status: :created, location: @famille }\n\t else\n format.html { render :new }\n end\n end\n end", "title": "" }, { "docid": "93d3d1bf6a137ed11c9caa1f5bfe344f", "score": "0.5688835", "text": "def create\n @facture = Facture.new(facture_params)\n\n respond_to do |format|\n if @facture.save\n format.html { redirect_to @facture, notice: 'Facture was successfully created.' }\n format.json { render :show, status: :created, location: @facture }\n else\n format.html { render :new }\n format.json { render json: @facture.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ff79f3107a410f8d92a4456b8c9ee0c5", "score": "0.5680383", "text": "def create\n @other_facility = OtherFacility.new(other_facility_params)\n\n respond_to do |format|\n if @other_facility.save\n format.html { redirect_to @other_facility, notice: 'Other facility was successfully created.' }\n format.json { render :show, status: :created, location: @other_facility }\n else\n format.html { render :new }\n format.json { render json: @other_facility.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d7e897dc4ba097e5680076074ce37b3d", "score": "0.5679417", "text": "def new\n @facility_total = FacilityTotal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @facility_total }\n end\n end", "title": "" }, { "docid": "bbd1328c76f8c6b4c39c9763a8478495", "score": "0.5677543", "text": "def set_facult\n @facult = Facult.find(params[:id])\n end", "title": "" }, { "docid": "80cb04658450d4d2326a432a0c38f177", "score": "0.5673351", "text": "def create\n @room_facility = RoomFacility.new(room_facility_params)\n\n respond_to do |format|\n if @room_facility.save\n format.html { redirect_to @room_facility, notice: 'Room facility was successfully created.' }\n format.json { render :show, status: :created, location: @room_facility }\n else\n format.html { render :new }\n format.json { render json: @room_facility.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f39b1f5560d01aa94ddd47152444de0b", "score": "0.5665462", "text": "def create\n @technological_factor = TechnologicalFactor.new(technological_factor_params)\n\n respond_to do |format|\n if @technological_factor.save\n format.html { redirect_to @technological_factor, notice: 'Technological factor was successfully created.' }\n format.json { render :show, status: :created, location: @technological_factor }\n else\n format.html { render :new }\n format.json { render json: @technological_factor.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1ef7c641a8d174e0a1c0eb8a4d72694b", "score": "0.56398314", "text": "def new\n @faculty_update = FacultyUpdate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @faculty_update }\n end\n end", "title": "" }, { "docid": "9bc400f90ff272d7ed67dcd5add7ce37", "score": "0.5626113", "text": "def create\n @facility_review = FacilityReview.new(facility_review_params)\n\n respond_to do |format|\n if @facility_review.save\n format.html { redirect_to @facility_review, notice: 'Facility review was successfully created.' }\n format.json { render :show, status: :created, location: @facility_review }\n else\n format.html { render :new }\n format.json { render json: @facility_review.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0e2ce6137e3470a9bd6a35f82048dd33", "score": "0.56159186", "text": "def create\n\n # Rails.logger.warn \"====================\"\n # Rails.logger.warn foaf_params[:interests_attributes]\n # Rails.logger.warn \"====================\"\n\n \n @foaf = Foaf.new(name: foaf_params[:name], work: foaf_params[:work], \n slug: foaf_params[:slug], birthday: foaf_params[:birthday])\n\n if(foaf_params.has_key?(:interests_attributes))\n interest_ids = foaf_params[:interests_attributes].split(\",\").map { |s| s.to_i }\n interest_ids.each do |i|\n @foaf.interests << Interest.find(i)\n end\n end\n\n respond_to do |format|\n if @foaf.save \n format.html { redirect_to @foaf, notice: 'FOAF was successfully created.' }\n format.json { render action: 'show', status: :created, location: @foaf }\n else\n format.html { render action: 'new' }\n format.json { render json: @foaf.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ad8668965467633ff78d006cee60673a", "score": "0.56040835", "text": "def create\n @scheduled_facility = ScheduledFacility.new(params[:scheduled_facility])\n\n respond_to do |format|\n if @scheduled_facility.save\n format.html { redirect_to @scheduled_facility, notice: 'Scheduled facility was successfully created.' }\n format.json { render json: @scheduled_facility, status: :created, location: @scheduled_facility }\n else\n format.html { render action: \"new\" }\n format.json { render json: @scheduled_facility.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b60af496b2d54fb028c42324a1c57d35", "score": "0.55897796", "text": "def create_team_member\n clinics = params[:clinics].split(\", \")\n\n team_member = TeamMember.create(\n email: params[:email],\n first_name: params[:first_name],\n last_name: params[:last_name],\n user: params[:user],\n status: \"Active\",\n role: params[:role]\n )\n\n clinics.each do |clinic|\n Clinic.find(clinic).team_members << team_member\n end\n\n render json: team_member, include: ['clinics']\n end", "title": "" }, { "docid": "15862d3df4ae7933af895950c750bb0c", "score": "0.55720615", "text": "def create\n\n # Rails.logger.warn \"====================\"\n # Rails.logger.warn foaf_params[:interests_attributes]\n # Rails.logger.warn \"====================\"\n\n \n @foaf = Foaf.new(name: foaf_params[:name], work: foaf_params[:work], \n slug: foaf_params[:slug], birthday: foaf_params[:birthday])\n\n if(foaf_params.has_key?(:interests_attributes))\n interest_ids = foaf_params[:interests_attributes].split(\",\").map { |s| s.to_i }\n interest_ids.each do |i|\n @foaf.interests << Interest.find(i)\n end\n end\n\n respond_to do |format|\n if @foaf.save \n format.html { redirect_to @foaf, notice: 'Foaf was successfully created.' }\n format.json { render action: 'show', status: :created, location: @foaf }\n else\n format.html { render action: 'new' }\n format.json { render json: @foaf.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e90306fdf7d23c1b0bc2272e2fa980a6", "score": "0.5562195", "text": "def create\n\n @user_fable = UserFable.new(user_fable_params)\n\n respond_to do |format|\n if @user_fable.save\n format.html { redirect_to @user_fable, notice: 'User fable was successfully created.' }\n format.json { render :show, status: :created, location: @user_fable }\n else\n format.html { render :new }\n format.json { render json: @user_fable.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6a31eb45149006cde94ef31578bfc886", "score": "0.5547696", "text": "def create\n @faktury = Faktury.new(faktury_params)\n\n respond_to do |format|\n if @faktury.save\n format.html { redirect_to @faktury, notice: 'Faktury was successfully created.' }\n format.json { render :show, status: :created, location: @faktury }\n else\n format.html { render :new }\n format.json { render json: @faktury.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "26d089b85ebdf4d78792e1ebc759084b", "score": "0.5540501", "text": "def create\n @facturaventum = Facturaventum.new(facturaventum_params)\n\n respond_to do |format|\n if @facturaventum.save\n format.html { redirect_to @facturaventum, notice: 'Facturaventum was successfully created.' }\n format.json { render :show, status: :created, location: @facturaventum }\n else\n format.html { render :new }\n format.json { render json: @facturaventum.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e29333e86eb2237b0e5f854a667e2a7f", "score": "0.5529953", "text": "def create\n @facture = Facture.new(facture_params)\n\n respond_to do |format|\n if @facture.save\n format.html { redirect_to add_ref_path(@facture), notice: 'La facture a bien été créée.'} \n format.json { render :add_ref, status: :created, location: @facture }\n else\n format.html { render :new }\n format.json { render json: @facture.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "049254b2cf10093d89bc6aefe5fa5284", "score": "0.5528763", "text": "def create\n @falta = Falta.new(falta_params)\n\n respond_to do |format|\n if @falta.save\n format.html { redirect_to @falta, notice: \"Falta was successfully created.\" }\n format.json { render :show, status: :created, location: @falta }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @falta.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8b2df702c157d4872c661ff5ead76605", "score": "0.552497", "text": "def create\n @fund = Fund.new(fund_params)\n\n if @fund.save\n render json: @fund, status: :created, location: @fund\n else\n render json: @fund.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "5cba0354932aa479fc558d1d95c42b0d", "score": "0.55154306", "text": "def create\n @fec_filing = FecFiling.new(params[:fec_filing])\n\n respond_to do |format|\n if @fec_filing.save\n format.html { redirect_to @fec_filing, :notice => 'Fec filing was successfully created.' }\n format.json { render :json => @fec_filing, :status => :created, :location => @fec_filing }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @fec_filing.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5cba0354932aa479fc558d1d95c42b0d", "score": "0.55154306", "text": "def create\n @fec_filing = FecFiling.new(params[:fec_filing])\n\n respond_to do |format|\n if @fec_filing.save\n format.html { redirect_to @fec_filing, :notice => 'Fec filing was successfully created.' }\n format.json { render :json => @fec_filing, :status => :created, :location => @fec_filing }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @fec_filing.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b20c5282a29ebab12513e63819096400", "score": "0.55064064", "text": "def create\n @feild = Feild.new(feild_params)\n\n respond_to do |format|\n if @feild.save\n format.html { redirect_to @feild, notice: 'Feild was successfully created.' }\n format.json { render :show, status: :created, location: @feild }\n else\n format.html { render :new }\n format.json { render json: @feild.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "887a677a75cc1a65c736a10103754a6b", "score": "0.55059385", "text": "def create\n @familium = Familium.new(familium_params)\n\n respond_to do |format|\n if @familium.save\n format.html { redirect_to @familium, notice: 'Familium was successfully created.' }\n format.json { render :show, status: :created, location: @familium }\n else\n format.html { render :new }\n format.json { render json: @familium.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "41382a1d3ce5ac8860159220555db3fe", "score": "0.55036783", "text": "def create\n @stage_fecundity = StageFecundity.new(params[:stage_fecundity])\n\n respond_to do |format|\n if @stage_fecundity.save\n format.html { redirect_to @stage_fecundity, notice: 'Stage fecundity was successfully created.' }\n format.json { render json: @stage_fecundity, status: :created, location: @stage_fecundity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @stage_fecundity.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f63fa2f960c138711214dddfcfb6af1e", "score": "0.5489249", "text": "def create\n @oferta_academica = OfertaAcademica.new(params[:oferta_academica])\n\n if @oferta_academica.save\n render json: @oferta_academica, status: :created, location: @oferta_academica\n else\n render json: @oferta_academica.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "5750318842114331ea3d5298b3dfcc67", "score": "0.5483629", "text": "def new\n @faction = Faction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @faction }\n end\n end", "title": "" }, { "docid": "9c63b654e083bb851610f4afbe1ad433", "score": "0.5477468", "text": "def facultad_params\n params.require(:facultad).permit(:nombre)\n end", "title": "" }, { "docid": "af448d4201aaaa4b7bf807783cf21e61", "score": "0.54716116", "text": "def create\n @facilitator = Facilitator.new(params[:facilitator])\n\n # Creates a facilitator and classroom automatically\n # facilitator = params[:facilitator]\n # classroom = Classroom.new\n # classroom.name = facilitator[\"classroom\"]\n # classroom.region_id = facilitator[\"region_id\"]\n # classroom.save\n\n # @facilitator = Facilitator.new\n # @facilitator.name = facilitator[\"name\"]\n # @facilitator.classroom_id = Classroom.find_by_name(facilitator[\"classroom\"]).id\n # @facilitator.email = facilitator[\"email\"]\n # @facilitator.password = \"facilitator\"\n # @facilitator.password_confirmation = \"facilitator\"\n\n respond_to do |format|\n if @facilitator.save\n format.html { redirect_to facilitators_url, notice: 'Facilitator was successfully created.' }\n format.json { render json: @facilitator, status: :created, location: @facilitator }\n else\n format.html { render action: \"new\" }\n format.json { render json: @facilitator.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5ecf232f490f0b6578bf4d09b73d1f20", "score": "0.5470967", "text": "def faculty_params\n params.require(:faculty).permit(:name)\n end", "title": "" }, { "docid": "04788aa6e14cf7426a5491a8ed5dea19", "score": "0.5468824", "text": "def create\n @profane = Profane.new(profane_params)\n\n respond_to do |format|\n if @profane.save\n format.html { redirect_to @profane, notice: 'Profane was successfully created.' }\n format.json { render :show, status: :created, location: @profane }\n else\n format.html { render :new }\n format.json { render json: @profane.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "844fb7127f9bb0331e3c076202829b71", "score": "0.54679054", "text": "def create\n @unite_fonctionnelle = UniteFonctionnelle.new(unite_fonctionnelle_params)\n\n respond_to do |format|\n if @unite_fonctionnelle.save\n format.html { redirect_to @unite_fonctionnelle, notice: 'Unite fonctionnelle was successfully created.' }\n format.json { render :show, status: :created, location: @unite_fonctionnelle }\n else\n format.html { render :new }\n format.json { render json: @unite_fonctionnelle.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3b67893c7035dfabc3a33241a582eda", "score": "0.5467811", "text": "def new\n @faafacility = Faafacility.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @faafacility }\n end\n end", "title": "" }, { "docid": "38f60103059ad9a6ce9a5302742bd0af", "score": "0.5467612", "text": "def create\n @faculty_update = FacultyUpdate.new(params[:faculty_update])\n\n respond_to do |format|\n if @faculty_update.save\n format.html { redirect_to ([:administrator, @faculty_update]), notice: 'Faculty update was successfully created.' }\n format.json { render json: @faculty_update, status: :created, location: @faculty_update }\n else\n format.html { render action: \"new\" }\n format.json { render json: @faculty_update.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "75c1f9f2176b3441307ed9457efec4a5", "score": "0.54664713", "text": "def create\n\n @jour = current_user.jours.new(jour_params)\n\n respond_to do |format|\n if @jour.save\n format.html { redirect_to jours_url, notice: 'Jour was successfully created.' }\n format.json { render :show, status: :created, location: @jour }\n else\n format.html { render :new }\n format.json { render json: @jour.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d9806a51d31974dd02a233e27192371e", "score": "0.5463762", "text": "def create\n @profesor = Profesor.new(profesor_params)\n\n if @profesor.save\n render json: @profesor, status: :created, location: @profesor\n else\n render json: @profesor.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "f7c3b41a69d6cf884119a11a810d5824", "score": "0.5458638", "text": "def create\n @fortune = Fortune.new(params[:fortune])\n if current_user\n @fortune.user_username = current_user.username\n else\n @fortune.user_username = current_usersocial[:name]\n end\n\n respond_to do |format|\n if @fortune.save\n format.html { redirect_to @fortune, notice: 'Piosenka pozytywnie stworzona' }\n format.json { render json: @fortune, status: :created, location: @fortune }\n else\n format.html { render action: \"new\" }\n format.json { render json: @fortune.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4a27912becf80e7da54cecbe522fc343", "score": "0.54580003", "text": "def create\n @fact = Fact.new(fact_params)\n\n respond_to do |format|\n if @fact.save\n format.html { redirect_to @fact, notice: 'Fact was successfully created.' }\n format.json { render :show, status: :created, location: @fact }\n else\n format.html { render :new }\n format.json { render json: @fact.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4a27912becf80e7da54cecbe522fc343", "score": "0.54580003", "text": "def create\n @fact = Fact.new(fact_params)\n\n respond_to do |format|\n if @fact.save\n format.html { redirect_to @fact, notice: 'Fact was successfully created.' }\n format.json { render :show, status: :created, location: @fact }\n else\n format.html { render :new }\n format.json { render json: @fact.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "abcce8e90338c5d2ce9137e7cd683d4a", "score": "0.5457724", "text": "def create\n @insurance_facility = InsuranceFacility.new(insurance_facility_params)\n\n respond_to do |format|\n if @insurance_facility.save\n format.html { redirect_to @insurance_facility, notice: 'Insurance facility was successfully created.' }\n format.json { render :show, status: :created, location: @insurance_facility }\n else\n format.html { render :new }\n format.json { render json: @insurance_facility.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "703caedcbf441e021a45a4b7c13ad291", "score": "0.54451245", "text": "def create\n @place_facility = PlaceFacility.new(place_facility_params)\n\n respond_to do |format|\n if @place_facility.save\n format.html { redirect_to @place_facility, notice: 'Place facility was successfully created.' }\n format.json { render :show, status: :created, location: @place_facility }\n else\n format.html { render :new }\n format.json { render json: @place_facility.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "57c3b39a77316ace2e7d927e54682508", "score": "0.5443653", "text": "def create\n\n @tea_club = TeaClub.new(tea_club_params)\n\n respond_to do |format|\n\n if @tea_club.save\n\n membership = Membership.new(:tea_club_id => @tea_club.id, :confirmed => true)\n current_user.memberships << membership\n membership.save\n\n format.html { redirect_to @tea_club, notice: 'Tea club was successfully created.' }\n format.json { render action: 'show', status: :created, location: @tea_club }\n\n else\n format.html { render action: 'new' }\n format.json { render json: @tea_club.errors, status: :unprocessable_entity }\n end\n\n end\n end", "title": "" }, { "docid": "5786d84b38e052675dcd0d56279d2b1e", "score": "0.5436916", "text": "def facultade_params\n params.require(:facultade).permit(:nombre, :observaciones, :estado, :borrado)\n end", "title": "" }, { "docid": "7311830f85e7cd8fd835282f18183ee7", "score": "0.5436407", "text": "def create\n @fact = Fact.new(fact_params)\n\n respond_to do |format|\n if @fact.save\n format.html { redirect_to @fact, notice: 'Fact was successfully created.' }\n format.json { render action: 'show', status: :created, location: @fact }\n else\n format.html { render action: 'new' }\n format.json { render json: @fact.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6ba04bfa1c6508b6460b5735ae998e95", "score": "0.5431122", "text": "def create\n #sanity checks, can only modify memberships that you own\n if params[:user_id].to_i != current_user.id then\n render json: {message:'You do not own the membership list'}, :status => :unprocessable_entity\n return\n end\n\n #ensure the membership params is there\n unless params.has_key? :memberships then\n #render json: {message:'memberships list not found'}, :status => :unprocessable_entity\n #return\n #this could me no membership at all\n params[:memberships] = {}\n end\n\n #set the new memberships state\n current_user.set_memberships params[:memberships]\n\n render json: {\n message:'message received from server',\n memberships:User.find(params[:user_id]).memberships.map{ |x| x.attributes.merge({club_name: x.club_name})}\n }\n end", "title": "" }, { "docid": "134465ea47bc53a56fededa75e0da2c8", "score": "0.54277945", "text": "def index\n @facultades = Facultad.all\n end", "title": "" }, { "docid": "da164810c3449f5a29a237cf4698f16a", "score": "0.5424648", "text": "def facility_params\n params.require(:facility).permit(:name)\n end", "title": "" }, { "docid": "58a6b5f6dd432859cc8e19376ba0b4c6", "score": "0.5424647", "text": "def create\n @flight = Flight.new(params[:flight])\n\n if @flight.save\n render json: @flight, status: :created, location: @flight\n else\n render json: @flight.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "7ea71d571dae56c238969c85758cc75b", "score": "0.5420153", "text": "def create\n @faction = Faction.new(params[:faction])\n\n respond_to do |format|\n if @faction.save\n format.html { redirect_to admin_factions_url, notice: 'Faction was successfully created.' }\n format.json { render json: @faction, status: :created, location: @faction }\n else\n format.html { render action: \"new\" }\n format.json { render json: @faction.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7acb47e09a374191697c8e6a68fcf15c", "score": "0.54115725", "text": "def new\n @familium = Familium.new\n @numCategs = Categorium.count\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @familium }\n end\n end", "title": "" }, { "docid": "2773fb965a19ccb5b3fa08ae02021ba5", "score": "0.54084694", "text": "def create\n course = Course.includes(:professors).new(course_params)\n course.professor_ids=(params[:professors])\n\n if course.save\n render json: course.to_json(include: :professors)\n else\n render :json => { :errors => course.errors }, :status => 422\n end\n end", "title": "" }, { "docid": "aec5d25161961680d64c03e3b8b557bd", "score": "0.5405717", "text": "def create\n @frat = Frat.new(frat_params)\n\n respond_to do |format|\n if @frat.save\n format.html { redirect_to @frat, notice: 'Frat was successfully created.' }\n format.json { render action: 'show', status: :created, location: @frat }\n else\n format.html { render action: 'new' }\n format.json { render json: @frat.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "145a62c50120a82227afa20e90fb9cba", "score": "0.54025096", "text": "def create\n @featuring = Featuring.new(featuring_params)\n\n respond_to do |format|\n if @featuring.save\n format.html { redirect_to @featuring, notice: 'Featuring was successfully created.' }\n format.json { render :show, status: :created, location: @featuring }\n else\n format.html { render :new }\n format.json { render json: @featuring.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9f2c7903d59111f845294dc2f7950494", "score": "0.54023606", "text": "def create\n @county = County.new(params[:county])\n\n respond_to do |format|\n if @county.save\n format.html { redirect_to @county, notice: 'County was successfully created.' }\n format.json { render json: @county, status: :created, location: @county }\n else\n format.html { render action: \"new\" }\n format.json { render json: @county.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9966b9c8d180baa3938b203ddaac6628", "score": "0.5401505", "text": "def create\n @fiction = Fiction.new(params[:fiction])\n\n respond_to do |format|\n if @fiction.save\n format.html { redirect_to @fiction, notice: 'Fiction was successfully created.' }\n format.json { render json: @fiction, status: :created, location: @fiction }\n else\n format.html { render action: \"new\" }\n format.json { render json: @fiction.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8458c92d73c95984c3ca816c8e40d4aa", "score": "0.5399749", "text": "def create\n @feat = @person.feats.new(params[:feat])\n\n respond_to do |format|\n if @feat.save\n format.html { redirect_to([@person, @feat], :notice => 'Feat was successfully created.') }\n format.xml { render :xml => @feat, :status => :created, :location => @feat }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @feat.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "663d9e509e6b49fe18f67f7ecc01b469", "score": "0.53994215", "text": "def create\n\n @fact = fact_type.new(fact_params)\n\n respond_to do |format|\n if @fact.save\n format.html { redirect_to @fact, notice: 'Fact was successfully created.' }\n format.json { render json: @fact, status: :created, location: @fact }\n else\n format.html { render action: \"new\" }\n format.json { render json: @fact.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "109b46df5319e5e598beedae3dd7f1e3", "score": "0.5386053", "text": "def create\n @fatality = Fatality.create(fatality_params)\n redirect_to @fatality.tab.tabable\n end", "title": "" }, { "docid": "25d3c27ad843b9e69b22f81121777e30", "score": "0.5378646", "text": "def create\n @sectorial = Sectorial.new(sectorial_params)\n\n respond_to do |format|\n if @sectorial.save\n format.html { redirect_to @sectorial, notice: 'Sectorial was successfully created.' }\n format.json { render :show, status: :created, location: @sectorial }\n else\n format.html { render :new }\n format.json { render json: @sectorial.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
0e2154c74334f69b745d5174f918eeeb
Conversion celcius en faranheit
[ { "docid": "be0cfabf0ae278c07d8234238a1de6f8", "score": "0.0", "text": "def ctof(tp_c)\n\tf = (tp_c * 9.0/5.0) + 32.0\n f = f.to_f\n return f\nend", "title": "" } ]
[ { "docid": "4d6181ecc680ed8e35995f1ffa5dfa91", "score": "0.7894791", "text": "def convert(fahrenheit)\n celsius = (5 * (fahrenheit - 32))/9\nend", "title": "" }, { "docid": "f2ba21bc32f65210880ef5b3e4a1b33b", "score": "0.78083", "text": "def convert(degrees_fahrenheit)\n celsius = (degrees_fahrenheit.to_f - 32) * 5/9\nend", "title": "" }, { "docid": "3d262d79d9635b54de3804d838adce56", "score": "0.7799793", "text": "def convert(fahrenheit_temp)\n @celsius_temp = (fahrenheit_temp - 32) * 5 / 9\nend", "title": "" }, { "docid": "433eaae1459d31db4fdaae759040d1cd", "score": "0.7780346", "text": "def convert_to_celcius(temp)\n\t (temp - 32) * 5/9\nend", "title": "" }, { "docid": "b1867fef448de0ecf8e4bd4d86e656af", "score": "0.770609", "text": "def to_celsius(degree_farhenheit)\n celsius = (degree_farhenheit - 32.0) * 5/9\nend", "title": "" }, { "docid": "3d56c955992f5dad4625917ab71d4478", "score": "0.76381177", "text": "def convert_to_celsius(fahrenheit)\n celsius = (5*(fahrenheit.to_f - 32))/9\n return celsius\nend", "title": "" }, { "docid": "4cfc894ea17ca90225a349c2a244dde8", "score": "0.75710845", "text": "def fahrenheit_to_celsius(fartemp)\n return (fartemp - 32) * 5/9\nend", "title": "" }, { "docid": "2a30b6871dd688e7624b7b816a38ebae", "score": "0.75597715", "text": "def fahrenheit_to_celsius(far_temp)\n return (far_temp -32) * (5/9)\nend", "title": "" }, { "docid": "3df453256c96b91592ca9d292092f7af", "score": "0.74879664", "text": "def celsius_to_fahrenheit(celsius)\n (celsius.to_f * 9) / 5 + 32\nend", "title": "" }, { "docid": "50ff83fba4dcb2087b6c5f503d6db11e", "score": "0.7485752", "text": "def convert_tocelsius(fahrenheit)\n # return (fahrenheit - 32) * (5/9)\n return fahrenheit*5/9 - 32*5/9 \nend", "title": "" }, { "docid": "5bb83d3d5af26feb44e3cf8e47c86678", "score": "0.74840075", "text": "def fahrenheit_to_celsius(temp)\n (temp.to_f - 32) * 5/9\nend", "title": "" }, { "docid": "f552fe1ddaf290d9e470d0ed73f1bef5", "score": "0.74683446", "text": "def celsius_to_fahrenheit(temp)\n temp.to_f * 9/5 + 32\nend", "title": "" }, { "docid": "f8ef921af8577a0deb7f0777d0d2d1d4", "score": "0.7457973", "text": "def convert_fahrenheit(celsius)\n\tmyfahrenheit=((9 * celsius.to_f)/5 +32)\nend", "title": "" }, { "docid": "8ad6d45531162978e63ad2b36bd25223", "score": "0.74373794", "text": "def fahr_to_cel(temp)\n c_temp = (temp - 32) * 5/9\n puts \"The converted temperature is #{c_temp} Celcius\"\nend", "title": "" }, { "docid": "a7befc27608aa9ceed94527b3708a53c", "score": "0.74249506", "text": "def farenheit_to_celsius(temp)\n return (temp - 32) * 5 / 9\nend", "title": "" }, { "docid": "190a00faaf74ac118b1d2a44532c6744", "score": "0.7349427", "text": "def fahrenheit_to_celsius(fahrenheit)\n\n celsius = 0.5556* (fahrenheit - 32)\n\n return celsius.to_i\n\nend", "title": "" }, { "docid": "e0dad8b1861f5eb092456c1a857d44a4", "score": "0.734918", "text": "def to_celcius(temp)\n temp - 273.15\n end", "title": "" }, { "docid": "4c0dc9e8264a76f27e21d77d00c2bb58", "score": "0.73267716", "text": "def celcius_to_farenheit(temp_of_boil)\n\t1.8 * temp_of_boil + 32\nend", "title": "" }, { "docid": "20a2374e90a9496c58472ce78a9d5f3e", "score": "0.72878355", "text": "def f_to_c(fahrenheit)\n celsius = (fahrenheit - 32.0) * (5.0 / 9.0)\n puts celsius\nend", "title": "" }, { "docid": "55f6d812e82dab82eef2cde8d526fe55", "score": "0.72812015", "text": "def toCelsius(fahrenheit)\n return ((fahrenheit-32)*5.0/9.0).round\nend", "title": "" }, { "docid": "55f6d812e82dab82eef2cde8d526fe55", "score": "0.7280466", "text": "def toCelsius(fahrenheit)\n return ((fahrenheit-32)*5.0/9.0).round\nend", "title": "" }, { "docid": "c330584941dd96be481c977503774007", "score": "0.72713906", "text": "def convertCelsius\r\n case self.myScale\r\n when 'K'\r\n self.myDegrees = (self.myDegrees - 273.15)\r\n self.myScale = 'C'\r\n when 'F'\r\n self.myDegrees = ((self.myDegrees - 32.0) * (5.0/9.0))\r\n self.myScale = 'C'\r\n end\r\n end", "title": "" }, { "docid": "0618ac3b39fa6c467fe9f6aebc91d080", "score": "0.72473156", "text": "def convert_to_fahrenheit(cel)\n fah = 1.8 * cel + 32\n puts fah.to_s + \" degrees Fahrenheit\"\nend", "title": "" }, { "docid": "fc84fa3a1171a391b7ba783cb8c9b5b8", "score": "0.72412455", "text": "def convert_to_celsius(fahrenheit)\n \"%.2f\" % ((fahrenheit.to_f-32) * 5 / 9 )\nend", "title": "" }, { "docid": "0090459966d2c49ba8024b2a9c9d1ccb", "score": "0.72371626", "text": "def to_celsius(fahrenheit)\n (fahrenheit - 32) * (5.0 / 9.0)\nend", "title": "" }, { "docid": "810242fcf3f1b12b9e4eed33020d966f", "score": "0.7226014", "text": "def celcius(fahrenheit)\n\t(fahrenheit - 32) * 5 / 9\nend", "title": "" }, { "docid": "b674fdc7f103b37cf23a678ad2fe1411", "score": "0.7225188", "text": "def convert(degree_fahrenheit)\n \n degree_celius = (degree_fahrenheit - 32)/1.8\n\nend", "title": "" }, { "docid": "cb8afaf85f1a4bbb582117dbfad5ee0e", "score": "0.7218949", "text": "def fahrenheit_to_celsius(fahrenheit)\n celsius = ((fahrenheit - 32) * 5.0 / 9.0).round\n end", "title": "" }, { "docid": "cc197b0008057c058a7941d5af945a9d", "score": "0.7213658", "text": "def celscius_to_farenheit(temp_of_boil)\n\t1.8 * temp_of_boil + 32\nend", "title": "" }, { "docid": "2870b4ec739d7a985c62e2fc73e4bb72", "score": "0.7158273", "text": "def convert(temperature_fahrenheit)\n (temperature_fahrenheit.to_f - 32) * 5 / 9\nend", "title": "" }, { "docid": "42a2d0f7c479a075236becdd1fb29ca3", "score": "0.71446013", "text": "def convertCtoFandFtoC\n\t\tif @tempUnit == \"fahrenheit\"\n\t\t\tresult = ((@temperature - 32) * 5/9)\n\t\telsif @tempUnit == \"celsius\"\n\t\t\tresult = ((@temperature + 32) * 9/5)\n\t\tend\n\t\treturn (result).round(3)\n\tend", "title": "" }, { "docid": "df4e34fe6bfb8e8224505d50c2d8d10b", "score": "0.7136711", "text": "def fahrenheit_to_celsius(tempf)\n tempc = ((tempf.to_f()-32)*5)/9\n return tempc\nend", "title": "" }, { "docid": "0b278c863b409fc0c8c021c6c941d8dc", "score": "0.7136078", "text": "def fahrenheit_to_celsius(number)\n celsius_temp = (number-32) * (5.0/9.0)\n return celsius_temp.to_i\nend", "title": "" }, { "docid": "192cfaec4f72dc326b63dbee0eace211", "score": "0.7125121", "text": "def fahrenheit_to_celsius(fahrenheit)\n celcius = (fahrenheit - 32.0) / 1.8\n return celcius.round(2)\nend", "title": "" }, { "docid": "72dc8d0fec4bb8ea5e4babab3412d189", "score": "0.7121997", "text": "def fahrenheit_to_celsius f\n 5.0 / 9.0 * (f - 32.0)\nend", "title": "" }, { "docid": "0378b9f09052359975933e763c507612", "score": "0.71186256", "text": "def celcius_calculation(fahrenheit_input) #Celcius calculation\n ((fahrenheit_input.to_f - 32) * 5) / 9\nend", "title": "" }, { "docid": "07459b3b3420a4fd1cd72cd67a2d46ab", "score": "0.7117815", "text": "def change_to_celcuis(temperature)\n ((temperature - 32) * 5.0 / 9.0).ceil\n end", "title": "" }, { "docid": "bbb8af01aa785dbe6ea96c8946bf3b6d", "score": "0.71101516", "text": "def fahrenheit_to_kelvin(temp)\n (temp.to_f + 459.67) * 5/9\nend", "title": "" }, { "docid": "a8066839c1ee7b0f85a9b441cb49d5a8", "score": "0.70996386", "text": "def fahrenheit_to_celsius(fah)\n celsius = ((fah-32).to_f * 5/9).to_f\n return celsius.round(2)\nend", "title": "" }, { "docid": "bc2401e3f61ce1f268e8e30e3c41acfa", "score": "0.7094971", "text": "def get_fahrenheit_from_celsius( celsius )\n return fahrenheit = celsius * (9.0 / 5.0) + 32.0\nend", "title": "" }, { "docid": "dc6afc1b503c90e791dfabdb0aca6e23", "score": "0.70824385", "text": "def ctof(c) # c celsius parameter/value to be converted to f fahrenheit\n return c * 9.0/5.0 + 32\nend", "title": "" }, { "docid": "5c5ad30046b67c8dc2c061f43de48846", "score": "0.708019", "text": "def celcius\n self.to_c\n end", "title": "" }, { "docid": "db86f8d058f42424a541108df31ba38a", "score": "0.7065003", "text": "def convertFahrToCelsius(degrees) \n degrees = (degrees.to_f - 32) * 5 / 9 \nend", "title": "" }, { "docid": "c6026b3ac3a6831d85d9625d917a43ab", "score": "0.704863", "text": "def convert(temp_in_fahrenheit)\n (temp_in_fahrenheit.to_f - 32) * 5/9\nend", "title": "" }, { "docid": "068be04605401cb59a94483d8c4678cc", "score": "0.70454943", "text": "def test_fahrenheit_to_celsius()\n celcius_value1 = convert_f_to_c(0)\n celcius_value2 = convert_f_to_c(32)\n celcius_value3 = convert_f_to_c(60)\n celcius_value4 = convert_f_to_c(100)\n assert_equal(-17.77777777777778, celcius_value1)\n assert_equal(0, celcius_value2)\n assert_equal(15.555555555555557, celcius_value3)\n assert_equal(37.77777777777778, celcius_value4)\n end", "title": "" }, { "docid": "2731dc83fec2da6d58de0aec7e7ae203", "score": "0.7035148", "text": "def fahrenheit_to_celsius(fahernheit)\n answer = (fahernheit - 32)*(5.0/9.0)\n return answer.round(1)\nend", "title": "" }, { "docid": "ef3f1c56381c6f3b0daf6a70c5a3863d", "score": "0.7013515", "text": "def fahrenheit_to_celsius(fahrenheit = 0.0)\n celsius = (5 * (fahrenheit - 32)) / 9\n \"the value #{fahrenheit} in fahrenheit is #{celsius}\"\nend", "title": "" }, { "docid": "7c422dcc829c467a6cbbde7460a37075", "score": "0.69580406", "text": "def fahrenheit(deg, convert_to)\n if convert_to == 'Celsius'\n (deg - 32) * 5 / 9\n elsif convert_to == 'Kelvin'\n (deg + 459.67) * 5 / 9\n elsif convert_to == 'Rankine'\n deg + 459.67\n elsif convert_to == 'Fahrenheit'\n deg\n end\nend", "title": "" }, { "docid": "3b7c19a3f7500398821142d80231110a", "score": "0.6956233", "text": "def fahrenheit_to_celsius(farenheit)\nreturn (farenheit - 32) * 5 / 9\n #add test code here\nend", "title": "" }, { "docid": "a8110096ed1b1c70a7ea3712e20a9259", "score": "0.6950986", "text": "def celsius_to_fahrenheit(celsius = 0.0)\n fahrenheit = (((9 * celsius) / 5) + 32)\n \"the value #{celsius} in fahrenheit is #{fahrenheit}\"\nend", "title": "" }, { "docid": "b3e47a0f95f6aed88b99b0026170f694", "score": "0.6938594", "text": "def celsius2fahrenheit\n # formel = C *— 9/5 + 32\n\n # Temperature connectors\n celsius = Connector.new('c')\n fahrenheit = Connector.new('f')\n\n # We can use ConstantConnector to... well... use constants.\n divider_const = ConstantConnector.new('divider', (9.0 / 5.0))\n adder_const = ConstantConnector.new('adder', 32)\n\n # Create a new connect that holds the temperature\n temperature = Connector.new('temp')\n\n # Multiply the celsius value by dividerConst\n # c * 9/5\n Multiplier.new(celsius, divider_const, temperature)\n # Add the 32 constant to get fahrenheit\n # c + 32 = f\n Adder.new(temperature, adder_const, fahrenheit)\n\n [celsius, fahrenheit]\nend", "title": "" }, { "docid": "cc56b6c1e5e17c593b760ceb170da097", "score": "0.6937664", "text": "def celsius(f)\n #(f - 32) / 1.8 = c.to_i\n c = ((f.to_i) - 32) * 5 / 9\n \"The temperature in Celsius is #{c}.\"\nend", "title": "" }, { "docid": "26e38f496d6bb59d59cde0c3f4edf683", "score": "0.6922907", "text": "def convert(fahrenheit)\n (fahrenheit - 32) * 5 / 9 \nend", "title": "" }, { "docid": "eebd24e7c7d161a84994920c07f51b85", "score": "0.68499935", "text": "def fahrenheit_to_celsius(f)\n\tc = (f - 32) / 1.8\nend", "title": "" }, { "docid": "094d3be61b8e8830d547ac5a750b2146", "score": "0.68464404", "text": "def convert (temp_f = 0)\n temp_c = (temp_f - 32.0) * 5/9\n temp_c = format(\"%.2f\", temp_c).to_s\n temp_f = format(\"%.2f\", temp_f).to_s\n puts \"#{temp_f} degrees Fahrenheit is #{temp_c} degrees Celsius\"\nend", "title": "" }, { "docid": "eaaca6ec39894102a18d84031a834ad8", "score": "0.6842295", "text": "def fahrenheit_to_celsius(fahrenheit)\n return fahrenheit.to_i - 32 * 5.0 / 9.0\n end", "title": "" }, { "docid": "02fea01cdfb8bd30c7eb2dabc2a3b02f", "score": "0.6824087", "text": "def convert(_Fahrenheit)\n (_Fahrenheit.to_f - 32) * 5 / 9\n end", "title": "" }, { "docid": "ad2bb51755cea86d66d001e3aededae9", "score": "0.6811782", "text": "def convert( temp_in_farenheit)\n (temp_in_farenheit.to_f - 32) * 5/9\nend", "title": "" }, { "docid": "c9a2e50cc312545d189c233a04f0bab0", "score": "0.6771683", "text": "def convert_to_fahrenheit(temp)\n temp * 9/5 + 32\nend", "title": "" }, { "docid": "42769b8d30abfcb762818ee7d39383b5", "score": "0.6763082", "text": "def ctof celcius\n\tcelcius.to_f*(9.0/5.0)+32\nend", "title": "" }, { "docid": "0a663e0c3dd8fd742be58e893d6d21c4", "score": "0.6742436", "text": "def in_celsius\n if @type == :c\n @temp\n else\n (@temp.to_f - 32.0) * (5.0/9.0)\n end\n end", "title": "" }, { "docid": "cb5ca63cb3e3237e7ae6e517e728a273", "score": "0.6741661", "text": "def convert_to_fahrenheit(temp)\n return ((temp * 9) /5) + 32\nend", "title": "" }, { "docid": "fa4dd95112038b629071cb2fd48287d2", "score": "0.67344904", "text": "def test_fahrenheit_to_celsius()\n first_temp = fahrenheit_to_celsius(1)\n second_temp = fahrenheit_to_celsius(3)\n third_temp = fahrenheit_to_celsius(5)\n assert_equal(1 - 32 * 5 / 9, first_temp)\n assert_equal(3 - 32 * 5 / 9, second_temp)\n assert_equal(5 - 32 * 5 / 9, third_temp)\n end", "title": "" }, { "docid": "f9640285a8e05070beff9b53fd2c6e23", "score": "0.673272", "text": "def celcius\n self.celsius\n end", "title": "" }, { "docid": "520ee03df9886d556cb667647aa8d0b3", "score": "0.6721968", "text": "def convert(fahrenheit)\n (fahrenheit - 32).to_f * 5/9\nend", "title": "" }, { "docid": "8e8c71aa3b0da1e7ebd02fe12b01d307", "score": "0.67006695", "text": "def convert_to_kelvin(cel_temp)\n k_temp = (cel_temp + 273)\n return k_temp\nend", "title": "" }, { "docid": "02110faaa5b7bd1a66c4103313fbcda9", "score": "0.6699564", "text": "def in_celsius\n (@fahrenheit - 32) * (5.0/9.0)\n end", "title": "" }, { "docid": "e71ec8acf7254da379efecc485a9ae18", "score": "0.6677694", "text": "def convert_to_fahrenheit(degrees_c)\n\treturn ((degrees_c * 9.0) / 5.0) + 32\nend", "title": "" }, { "docid": "804403ed97ba0f97f779000443df5c32", "score": "0.6653643", "text": "def ctof(celsius)\n celsius * 1.8 + 32\nend", "title": "" }, { "docid": "1da53270f114ee9b9252c404f2004132", "score": "0.66455877", "text": "def c_to_f(celsius)\n fahrenheit = (celsius * (9.0 / 5.0)) + 32\n puts fahrenheit\nend", "title": "" }, { "docid": "3304302967d33dc6b4834ba8ef979a89", "score": "0.6640145", "text": "def ftoc(temp_fahren)\n temp_celsius = (temp_fahren - 32.0) * 5.0 / 9.0\nend", "title": "" }, { "docid": "d099c389c518e63b74938003d40eca3f", "score": "0.66277677", "text": "def to_fahrenheit\n (@temperature * 1.8) + 32\n end", "title": "" }, { "docid": "d099c389c518e63b74938003d40eca3f", "score": "0.66277677", "text": "def to_fahrenheit\n (@temperature * 1.8) + 32\n end", "title": "" }, { "docid": "d099c389c518e63b74938003d40eca3f", "score": "0.66277677", "text": "def to_fahrenheit\n (@temperature * 1.8) + 32\n end", "title": "" }, { "docid": "61b4ac6ce4270c43003c2a852dbd0fd8", "score": "0.6609157", "text": "def convert( fahrenheit )\n puts format( \"%.2f\", ( fahrenheit.to_f - 32 )/ 1.8000 )\nend", "title": "" }, { "docid": "f23d791e3f3883c2043c26e67a2473a9", "score": "0.6607053", "text": "def kelvin_to_fahrenheit(temp)\n temp.to_f * 9/5 - 459.67\nend", "title": "" }, { "docid": "383782f86990b8e0623740886904d8ba", "score": "0.6606438", "text": "def ftoc(num)\n celsius = (num - 32) * 5 / 9\nend", "title": "" }, { "docid": "6a11e3eb97e98e880c774a624fa88f6b", "score": "0.6565788", "text": "def celsius_to_fahrenheit\n celsius = params[:value]\n fahrenheit = (celsius * 9)/5 + 32\n render :soap => fahrenheit\n end", "title": "" }, { "docid": "a0842fb929c92ad97e7119f69bbef5fa", "score": "0.6565454", "text": "def ctof(celsius_degrees)\n fahrenheit = (celsius_degrees.to_i * 1.8 ) + 32\n if celsius_degrees == 37 \n \treturn fahrenheit.to_f\n else\n \treturn fahrenheit\n end \n \nend", "title": "" }, { "docid": "c02a400cd62fcc58312a1616f82dba5a", "score": "0.65642035", "text": "def ftoc(temperature)\n return celsius = (temperature.to_f - 32) * 5 / 9\nend", "title": "" }, { "docid": "5404444efdb0b000c4196973199ea61d", "score": "0.65635645", "text": "def toCelsius\n\t\t\tcase @scale\n\t\t\t\twhen 'C'\n\t\t\t\t\tTemperature.new(@degrees, 'C')\n\t\t\t\twhen 'F'\n\t\t\t\t\tTemperature.new((@degrees - 32.0) * 5.0 / 9.0, 'C')\n\t\t\t\twhen 'K'\n\t\t\t\t\tTemperature.new(@degrees - 273.15, 'C')\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "9f3039102290d68c07eedad155f06491", "score": "0.65561527", "text": "def kelvin_to_fahrenheit(temp)\n 1.8 * (temp - 273) + 32\n end", "title": "" }, { "docid": "3c4fc93b164a76671a4dd3725f8ceb00", "score": "0.65556717", "text": "def toFahrenheit(celsius)\n return (celsius*9.0/5.0).round+32\nend", "title": "" }, { "docid": "3c4fc93b164a76671a4dd3725f8ceb00", "score": "0.65556717", "text": "def toFahrenheit(celsius)\n return (celsius*9.0/5.0).round+32\nend", "title": "" }, { "docid": "18a9b662740bd71c2d675b244c9b1fd3", "score": "0.6554008", "text": "def Celsius(intemp, inunit)\n if inunit == 'f'\n ((intemp - F_TO_C_CONVERSION1) / F_TO_C_CONVERSION2)\n elsif inunit == 'k'\n intemp - K_TO_C_CONVERSION\n elsif inunit == 'r'\n ((intemp - R_TO_C_CONVERSION1) / R_TO_C_CONVERSION2)\n end\n end", "title": "" }, { "docid": "619cee8b19cb191a5920e08868a0ca4d", "score": "0.65441746", "text": "def convertFahrenheit\r\n case self.myScale\r\n when 'K'\r\n self.myDegrees = (self.myDegrees * (9.0/5.0) - 459.67)\r\n self.myScale = 'F'\r\n when 'C'\r\n self.myDegrees = ((self.myDegrees * 1.8) + 32.0)\r\n self.myScale = 'F'\r\n end\r\n \r\n end", "title": "" }, { "docid": "1179465c41fe5b9c4c52be1a54866217", "score": "0.65321827", "text": "def fahrenheit_to_celsius(n)\n fahrenheit = (n -32)*5/9\n return fahrenheit.round(2)\nend", "title": "" }, { "docid": "bbe863639477b8faf3a73df6e101ed76", "score": "0.6524051", "text": "def convert(temp_f)\n (temp_f - 32) * 5 / 9\nend", "title": "" }, { "docid": "991cea50f421611f8d0a9feccece25f9", "score": "0.6507144", "text": "def celcius\n\tvar = { \"Monday\" => 12,\n\t\"Tuesday\" => -14,\n\t\"Wednesday\" => 28,\n\t\"Thursday\" => 32,\n\t\"Friday\" => -1 }\n\tvar.each do |day, cel|\n\tputs \"On #{day} the temperature was #{cel*(9/5)+32} degrees farenheit\"\n\tend\nend", "title": "" }, { "docid": "8421944f0fe274c5c93f3f77a42fe636", "score": "0.6506903", "text": "def test_fahrenheit_to_celsius()\n result = farenheit_to_celsius(32)\n assert_equal(0,result)\n end", "title": "" }, { "docid": "b59a0ef328c944a116c4890f964df14f", "score": "0.6485459", "text": "def f2c(temp_f)\n (temp_f - 32) * 5 / 9\nend", "title": "" }, { "docid": "98f56de4e2d6445dd25134e9cb183640", "score": "0.6475529", "text": "def celsius_fahrenheit (c_temp)\r\n\tf = c_temp * 9 / 5 + 32\r\n puts \"The temperature in fahrenheitis \" + f.to_s \r\n\treturn f\r\nend", "title": "" }, { "docid": "b2cd5558c19d43499a46942190b45236", "score": "0.64700264", "text": "def ctof(cel)\n cel * 9.0 / 5.0 + 32\nend", "title": "" }, { "docid": "fadab8148e623791e3bd60372eb7b655", "score": "0.64278233", "text": "def convert_temp(value, fromUnits)\t\n\t\tif fromUnits == \"F\"\n\t\t\tconverted_value = (value - 32) / 1.8\n\t\telsif fromUnits == \"C\"\n\t\t\tconverted_value = (1.8 * value) + 32\n\t\tend\t\t\n\t\treturn converted_value.round\n\tend", "title": "" }, { "docid": "3e79c5cc904559a01392d0ddff88b99b", "score": "0.6418173", "text": "def ftoc(fahrenheit_degree)\r\n celsius = (fahrenheit_degree - 32) * 5 / 9\r\n celsius\r\n end", "title": "" }, { "docid": "7c310d7ed8d56bacd39707219d80fd65", "score": "0.63910526", "text": "def to_celsius(**options) = convert_to('celsius', **options)", "title": "" }, { "docid": "06bb321d3dac90390a3a3d175cac7eb0", "score": "0.6389968", "text": "def toC\n if @unit == 'F' then\n @unit = 'C'\n @value = 5.0 / 9.0 * (@value - 32.0)\n elsif @unit == 'R' then\n @unit = 'C'\n @value = 5.0 / 9.0 * @value - 273.15\n elsif @unit == 'K' then\n @unit = 'C'\n @value -= 273.15\n end\n self\n end", "title": "" }, { "docid": "596eb0ceb68f6ad0f426e392be52c272", "score": "0.6380147", "text": "def ftoc(fahrenheit)\n celcius = (fahrenheit - 32) * 5 / 9.0\n celcius\nend", "title": "" }, { "docid": "ccd556d0543a2613a837d1254be380af", "score": "0.63729066", "text": "def ctof(celcius)\n\treturn ((celcius.to_f*9)/5)+32\nend", "title": "" }, { "docid": "cc6d6744725bb1084750ddd95ff8db95", "score": "0.63697684", "text": "def to_fahrenheit(temperature)\n (temperature * (9.0 / 5.0)) + 32\n end", "title": "" }, { "docid": "441bb067f23d5616be3aa93191927932", "score": "0.6357386", "text": "def KelvinToCelcius(kelvin)\n return (kelvin - 273.15).round(2)\nend", "title": "" } ]
069335d97ff281eed436ada2ec996a30
Copying Identifiers is not allowed.
[ { "docid": "7c512ae532fc426894583c9d088d4216", "score": "0.57103425", "text": "def initialize_copy(other)\n raise TypeError, \"copy of #{self.class} is not allowed\"\n end", "title": "" } ]
[ { "docid": "56952e5210638a2b238a29fe4dfc7ea9", "score": "0.69145817", "text": "def copy\n end", "title": "" }, { "docid": "6d02131462d8b9390c2f4026f6fd311e", "score": "0.6568707", "text": "def copy\n self.public_send('|', 'copy')\n self\n end", "title": "" }, { "docid": "7178d7b95179b9c325704c645c749171", "score": "0.6483249", "text": "def dup\n out = super\n out.name = out.name + \"copy_from_#{self.id}\"\n out.id = nil\n return out\n end", "title": "" }, { "docid": "cbc1f0b785238094d310d6414ba2608b", "score": "0.6401689", "text": "def copy()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "5d3a0d98d3c38476398527a7a487ab08", "score": "0.62871563", "text": "def uid_copy(source, target, uid)\n select(source)\n \n new_uid = if message_tagging_enabled?\n @connection.check\n message = uid_fetch(source, uid, [\"FLAGS\", \"RFC822\"]).first\n append(target, message.attr[\"RFC822\"], message.attr[\"FLAGS\"])\n else\n response = @connection.uid_copy(uid, target)\n get_uid_from_response(response, \"COPYUID\")\n end\n \n new_uid.to_i\n end", "title": "" }, { "docid": "ba0bf6f1dd579bf850260dfb30637349", "score": "0.6283566", "text": "def copy_to(other); end", "title": "" }, { "docid": "b1faef03b9fa217e8c27feaaaf389bf3", "score": "0.6281765", "text": "def copy\n copy = self.clone\n copy.vector = @vector.copy\n copy.color = @color.copy\n copy.location = @location.copy\n copy.tags = @tags.clone\n copy.identifier = generate_identifier\n copy.name = @name ? \"Copy of \" + @name.to_s : nil\n copy\n end", "title": "" }, { "docid": "440e1bc234b4b4d714d687b81f914d70", "score": "0.6257851", "text": "def copy\n move(:copy)\n end", "title": "" }, { "docid": "a78d765e794f2b5195ec05700de291a9", "score": "0.6234452", "text": "def visit_ident(node)\n node.copy\n end", "title": "" }, { "docid": "2f44399ae1fd2e8b42d2920a9555b8bf", "score": "0.61983114", "text": "def uid_copy(set, mailbox); end", "title": "" }, { "docid": "6a4fc834e1862488e3ca91674d08a6e7", "score": "0.6184984", "text": "def copy(dest)\n raise NotImplementedError\n end", "title": "" }, { "docid": "3044af9e0e6dccef5d5a2a9765006aca", "score": "0.6139484", "text": "def copy_instance\n end", "title": "" }, { "docid": "a4e62c4871f1ad885bb64217a5e76a2b", "score": "0.6094409", "text": "def copy_identity\n return if @copied_identity\n identities = Net::SSH::Authentication::Agent.connect.identities\n raise 'No SSH identities found. Please run ssh-add.' if identities.empty?\n key = identities.first\n enc_key = Base64.encode64(key.to_blob).gsub(\"\\n\", '')\n identitiy = \"ssh-rsa #{enc_key} #{key.comment}\"\n @session.exec! <<-EOT\n test -e ~/.ssh || mkdir ~/.ssh\n test -e ~/.ssh/authorized_keys || touch ~/.ssh/authorized_keys\n if ! grep -q \"#{identitiy}\" ~/.ssh/authorized_keys ; then\n chmod go-w ~ ~/.ssh ~/.ssh/authorized_keys ; \\\n echo \"#{identitiy}\" >> ~/.ssh/authorized_keys\n fi\n EOT\n @copied_identity = true\n end", "title": "" }, { "docid": "edb6fd377b3f394032f7792087100831", "score": "0.6078876", "text": "def copy()\n self\n end", "title": "" }, { "docid": "f24d674c2c05d241a0b56b9a2eeb55d2", "score": "0.6065261", "text": "def copy(dest)\n puts 'copy'\n end", "title": "" }, { "docid": "cec19855fca5c812ebe525227c8a3cbf", "score": "0.6049033", "text": "def copy(p0) end", "title": "" }, { "docid": "6f2c233b6daa84c63ad6c808c6ed9e57", "score": "0.60263544", "text": "def makeCopy\n c = CodeSet.new\n c.setTo(self)\n c\n end", "title": "" }, { "docid": "2d4835d21b4b4d134532a9f3606242d6", "score": "0.6017458", "text": "def put_copy_data\n end", "title": "" }, { "docid": "9741ae965e0f3654ed9b5f42803392bb", "score": "0.60130745", "text": "def copy_identity\n return if @copied_identity\n key = Net::SSH::Authentication::Agent.connect.identities.first\n enc_key = Base64.encode64(key.to_blob).gsub(\"\\n\", '')\n identitiy = \"ssh-rsa #{enc_key} #{key.comment}\"\n @session.exec! <<-EOT\n test -e ~/.ssh || mkdir ~/.ssh\n test -e ~/.ssh/authorized_keys || touch ~/.ssh/authorized_keys\n if ! grep -q \"#{identitiy}\" ~/.ssh/authorized_keys ; then\n chmod go-w ~ ~/.ssh ~/.ssh/authorized_keys ; \\\n echo \"#{identitiy}\" >> ~/.ssh/authorized_keys\n fi\n EOT\n @copied_identity = true\n end", "title": "" }, { "docid": "d604edb46f4e1221a8c8792ecef45b7a", "score": "0.60035", "text": "def mask_copied_id_numbers(element)\n return unless element[:id]\n\n element[:id] = element[:id].gsub(/_copy_(\\d+)$/, '_copy_XXX')\nend", "title": "" }, { "docid": "40bf845b997225f8a29191ace3fcff2c", "score": "0.60018307", "text": "def initialize_copy(other)\n @id, @serial = other.id, other.serial\n end", "title": "" }, { "docid": "c2f088de83a3db65f582c25a1cef2b61", "score": "0.59782606", "text": "def duplicate\n super do |cloned_resource|\n cloned_resource.title = \"Copy #{@resource.title[0...Integral.title_length_maximum - 5]}\"\n cloned_resource.path += \"-#{SecureRandom.hex[1..5]}\"\n end\n end", "title": "" }, { "docid": "9fbbcdddc5a4471c7020f4fa132b535a", "score": "0.59766644", "text": "def duplicable?; end", "title": "" }, { "docid": "9fbbcdddc5a4471c7020f4fa132b535a", "score": "0.59766644", "text": "def duplicable?; end", "title": "" }, { "docid": "b46b7a1991cd27e1fd153880e77917d5", "score": "0.5964746", "text": "def copy(src)\n raise 'Non si può copiare nella cartella di alchemy'\n end", "title": "" }, { "docid": "39163d00ef4e930f67f93c89bc594d6e", "score": "0.59003174", "text": "def copy\n result = dup\n result.name = \"Copy of #{name}\"\n result.assign_enrollment_code\n result.save!\n instructors.each do |instructor|\n result.memberships.create!(user: instructor, role: :instructor)\n end\n result.assignments = assignments.map(&:copy)\n result\n end", "title": "" }, { "docid": "e521c21df6838b17405ee0e38c51c965", "score": "0.58970124", "text": "def cop=(_); end", "title": "" }, { "docid": "e521c21df6838b17405ee0e38c51c965", "score": "0.58970124", "text": "def cop=(_); end", "title": "" }, { "docid": "d0b262d788c66b312f46cc78ee50b2ed", "score": "0.589362", "text": "def copy(from, to)\n raise NotImplementedError.new(\"copy() must be implemented by subclasses of AbstractStagingArea.\")\n end", "title": "" }, { "docid": "e731f5c67901d7e4e54a01e99d9ad16d", "score": "0.5877933", "text": "def __deep_copy__; self; end", "title": "" }, { "docid": "0031ad7acdce0e2bc1ab340ac66df353", "score": "0.58624285", "text": "def copy\n Marshal::load(Marshal.dump(self))\n end", "title": "" }, { "docid": "71eaf0302b6bbd8bd373de664eca0907", "score": "0.5855894", "text": "def initialize_copy(source); end", "title": "" }, { "docid": "5cc795a27737a402e4ee1b37661dc64d", "score": "0.5855126", "text": "def initialize_copy(old)\n set_native_reference `#{old.to_n}.cloneNode(true)`\n end", "title": "" }, { "docid": "a2d6256185e1fb147c358f882831051d", "score": "0.5847141", "text": "def __copy__(other)\n other.as_document\n instance_variables.each { |name| remove_instance_variable(name) }\n COPYABLES.each do |name|\n value = other.send(name)\n instance_variable_set(:\"@#{name}\", value ? value.dup : nil)\n end\n attributes.delete(\"_id\")\n if attributes.delete(\"versions\")\n attributes[\"version\"] = 1\n end\n @new_record = true\n identify\n end", "title": "" }, { "docid": "71542d4c6ab5238c0bcd0bcb6ae10040", "score": "0.58406556", "text": "def copy\n Chromosome.new(map(&:copy))\n end", "title": "" }, { "docid": "38dea240e50b69666d7e2da0c3adc7cc", "score": "0.58297426", "text": "def copy_reference\n\t\t\t@data[\"copy_reference\"]\n\t\tend", "title": "" }, { "docid": "2def1bf1476c2672935e55612c5965e3", "score": "0.5814053", "text": "def copy!(inputpoint)\n end", "title": "" }, { "docid": "af16d2d872a85cb6b9e28cd41b1801c4", "score": "0.58124924", "text": "def copy(_options)\n raise NotImplementedError\n end", "title": "" }, { "docid": "488525be0416aa069888ec1458ae4ba3", "score": "0.58020866", "text": "def deep_copy; end", "title": "" }, { "docid": "488525be0416aa069888ec1458ae4ba3", "score": "0.58020866", "text": "def deep_copy; end", "title": "" }, { "docid": "488525be0416aa069888ec1458ae4ba3", "score": "0.58020866", "text": "def deep_copy; end", "title": "" }, { "docid": "488525be0416aa069888ec1458ae4ba3", "score": "0.58020866", "text": "def deep_copy; end", "title": "" }, { "docid": "6b87e35bac6a5de993a8498d6986f89e", "score": "0.5780554", "text": "def duplicate\n super do |cloned_resource|\n cloned_resource.title = \"Copy #{@resource.title[0...Integral.title_length_maximum - 5]}\"\n cloned_resource.path += \"-#{SecureRandom.hex[1..5]}\"\n cloned_resource.build_active_block_list(content: @resource.active_block_list.content, listable: cloned_resource)\n end\n end", "title": "" }, { "docid": "8037482601eeb15a3459a4db1674b0fc", "score": "0.57772905", "text": "def cop; end", "title": "" }, { "docid": "8037482601eeb15a3459a4db1674b0fc", "score": "0.57772905", "text": "def cop; end", "title": "" }, { "docid": "a92252a8e7ea8da805a6502a073cc565", "score": "0.574017", "text": "def copy\r\n Marshal.load( Marshal.dump(self) )\r\n end", "title": "" }, { "docid": "334fef127060a44a92946de83c09552a", "score": "0.57279944", "text": "def copy_for_id(copy_id)\r\n\t\t\tcopies.find { |c| c.id == copy_id }\r\n\t\tend", "title": "" }, { "docid": "07c273f9e3dc0b62c9b18656c8fa9c4d", "score": "0.572551", "text": "def copy; self.clone; end", "title": "" }, { "docid": "07c273f9e3dc0b62c9b18656c8fa9c4d", "score": "0.572551", "text": "def copy; self.clone; end", "title": "" }, { "docid": "07c273f9e3dc0b62c9b18656c8fa9c4d", "score": "0.572551", "text": "def copy; self.clone; end", "title": "" }, { "docid": "07c273f9e3dc0b62c9b18656c8fa9c4d", "score": "0.572551", "text": "def copy; self.clone; end", "title": "" }, { "docid": "07c273f9e3dc0b62c9b18656c8fa9c4d", "score": "0.572551", "text": "def copy; self.clone; end", "title": "" }, { "docid": "07c273f9e3dc0b62c9b18656c8fa9c4d", "score": "0.572551", "text": "def copy; self.clone; end", "title": "" }, { "docid": "ddb941107bcbde9873a982ef8a47b85e", "score": "0.5723821", "text": "def copy\n self.class.new(@name.dup, @trace.copy, @base_segment_id ? @base_segment_id.dup : nil)\n end", "title": "" }, { "docid": "fed138184a397155dd17d659d58ff5cd", "score": "0.57221836", "text": "def copy_event()\n log(1, \"Event copied.\")\n\t\tedit_event()\n $edit = false\n event_subtype_selected() unless $attr[:reuse]\n add_event()\n end", "title": "" }, { "docid": "aa7d69c3c6e4a78cbe8f7c0e62f6d662", "score": "0.5713727", "text": "def duplicate\n super do |cloned_resource|\n cloned_resource.title = \"Copy #{@resource.title[0...Integral.title_length_maximum - 5]}\"\n cloned_resource.view_count = 0\n cloned_resource.tag_list = @resource.tag_list_on(@resource.tag_context)\n cloned_resource.slug = @resource.slug\n cloned_resource.status = :draft\n cloned_resource.published_at = nil\n end\n end", "title": "" }, { "docid": "b986f9f412efaeff4ce8454f896e67f5", "score": "0.57134193", "text": "def __copy_on_write__(*)\n super.tap do\n new_set = __getobj__.instance_variable_get(:@set).dup\n __getobj__.instance_variable_set(:@set, new_set)\n end\n end", "title": "" }, { "docid": "a1c7149cc9917b04085aed8270e2147d", "score": "0.56965274", "text": "def copy_instruct(lhs, rhs)\n add_instruction(:assign, lhs, rhs)\n end", "title": "" }, { "docid": "e97cb185ab200753554fa251baee2608", "score": "0.5680558", "text": "def copy\n Copier.copy(self)\n end", "title": "" }, { "docid": "da8c207bb84ab9e62bc8e7878e2458fa", "score": "0.56707245", "text": "def copy\n self.class.new.tap do |c|\n c.name = self.name\n c.domid = self.domid\n c.region_type = self.region_type\n\n c.add_renderables(renderables)\n end \n end", "title": "" }, { "docid": "5f08f00e8feea0a3dc6155ecd0928dd3", "score": "0.56701666", "text": "def copy\n class_group = resource.clone\n class_group.name += \" (Copy)\"\n class_group.user_ids = resource.user_ids.clone\n class_group.save!\n\n redirect_to edit_class_group_path(class_group)\n end", "title": "" }, { "docid": "bc9829890f2cda2e3ede296ec095f901", "score": "0.5657634", "text": "def copy\n 'failed input expectations'\n end", "title": "" }, { "docid": "bbb046bfbb07204d6a3950870724c323", "score": "0.56539893", "text": "def copy\n orig_questionnaire = Questionnaire.find(params[:id])\n questions = Question.where(questionnaire_id: params[:id])\n @questionnaire = orig_questionnaire.clone\n @questionnaire.instructor_id = session[:user].instructor_id ## Why was TA-specific code removed here? See Project E713.\n @questionnaire.name = 'Copy of ' + orig_questionnaire.name\n assign_instructor_id\n @questionnaire.name = 'Copy of '+orig_questionnaire.name\n copy_questionnaire(orig_questionnaire, questions)\n end", "title": "" }, { "docid": "c47ca1e4b5e6180b092995ffabb84825", "score": "0.56506294", "text": "def copy(set, mailbox); end", "title": "" }, { "docid": "60fe131b3bcb3c5d9b850401e0403486", "score": "0.5647345", "text": "def clone()\r\n end", "title": "" }, { "docid": "bee927a89c4fe69dba2671453c7cf559", "score": "0.56465346", "text": "def clone(*) end", "title": "" }, { "docid": "ab7b7ff29795cfca2b7224811290710a", "score": "0.5629059", "text": "def copy(source)\n Cproton.pn_terminus_copy(@impl,source.impl)\n end", "title": "" }, { "docid": "1259bec764855ecc413711b45b0ab257", "score": "0.5620705", "text": "def clone; end", "title": "" }, { "docid": "8e03ed8bdd0dcbae1023f76e5de0216c", "score": "0.5619515", "text": "def copy\n self.dup\n end", "title": "" }, { "docid": "8e03ed8bdd0dcbae1023f76e5de0216c", "score": "0.5619515", "text": "def copy\n self.dup\n end", "title": "" }, { "docid": "ef799e04b748954ccb3b8339681d3a17", "score": "0.55963767", "text": "def copy_nonce(p0) end", "title": "" }, { "docid": "e918197b304f5c3d43b4e0fb436c979a", "score": "0.5594768", "text": "def copy_lvm\n raise 'Not implemented'\n end", "title": "" }, { "docid": "fb9edc7501c7203e070c4a71262c3377", "score": "0.55872", "text": "def clone\n end", "title": "" }, { "docid": "fb9edc7501c7203e070c4a71262c3377", "score": "0.55872", "text": "def clone\n end", "title": "" }, { "docid": "fb9edc7501c7203e070c4a71262c3377", "score": "0.55872", "text": "def clone\n end", "title": "" }, { "docid": "fb9edc7501c7203e070c4a71262c3377", "score": "0.55872", "text": "def clone\n end", "title": "" }, { "docid": "fb9edc7501c7203e070c4a71262c3377", "score": "0.55872", "text": "def clone\n end", "title": "" }, { "docid": "fb9edc7501c7203e070c4a71262c3377", "score": "0.55872", "text": "def clone\n end", "title": "" }, { "docid": "7a6fdbe9dfa34e4ee2ace2948f325c90", "score": "0.5582355", "text": "def copy(dest, overwrite=false)\n NotImplemented\n end", "title": "" }, { "docid": "736722b08760fa51dc58698319468f07", "score": "0.55766994", "text": "def duplicable?\n true\n end", "title": "" }, { "docid": "3da0c56d39e9de50e6e0024c05cee819", "score": "0.5576444", "text": "def initialize_copy(other)\n replace other\n end", "title": "" }, { "docid": "ab5e411af13eafb0e7482e8e6c6915c4", "score": "0.5573904", "text": "def duplicate()\n bug( \"you must override duplicate()\" )\n end", "title": "" }, { "docid": "bf809c0ab9c46bccb0b935197737a15d", "score": "0.556654", "text": "def copy\n Marshal.load(Marshal.dump(self))\n end", "title": "" }, { "docid": "bf809c0ab9c46bccb0b935197737a15d", "score": "0.556654", "text": "def copy\n Marshal.load(Marshal.dump(self))\n end", "title": "" }, { "docid": "d9fea35b42548449223c61a66db3df1c", "score": "0.5565521", "text": "def hardcopy\n @session.write ':HARDCOPY'\n end", "title": "" }, { "docid": "0430b5e3f4873113d804699ac5b29902", "score": "0.5564204", "text": "def cop_names; end", "title": "" }, { "docid": "b9cc14cd9f54ac16813865d59e42b369", "score": "0.5551219", "text": "def copy(mailbox)\n @connection.uid_copy(@uid, mailbox.name)\n end", "title": "" }, { "docid": "46686d8b2e201d64dbd51c30ead393d4", "score": "0.5541724", "text": "def addCopy\n\t\t@copies += 1\n\tend", "title": "" }, { "docid": "8f83c147506d9b03be65f51efd3938bc", "score": "0.55390525", "text": "def clone\n\n end", "title": "" }, { "docid": "394fbb19ee334ff5aed124a5b8e3cb80", "score": "0.5539039", "text": "def initialize_copy(other)\n super\n @contents = other.contents.dup\n @rawgaps = other.rawgaps.dup\n end", "title": "" }, { "docid": "e870f077b8aa81562795dbe49450c92c", "score": "0.5526603", "text": "def clone\n end", "title": "" }, { "docid": "e870f077b8aa81562795dbe49450c92c", "score": "0.5526603", "text": "def clone\n end", "title": "" }, { "docid": "0231ab7c3fa73be60186c289d3b77311", "score": "0.5507415", "text": "def copied\n self.recipients.select { |r| r.id != self.signee.id }\n end", "title": "" }, { "docid": "f3527b94710ed3aa1c8c821dd61a4cf3", "score": "0.5497267", "text": "def initialize_copy(other); end", "title": "" }, { "docid": "f3527b94710ed3aa1c8c821dd61a4cf3", "score": "0.5497211", "text": "def initialize_copy(other); end", "title": "" }, { "docid": "f3527b94710ed3aa1c8c821dd61a4cf3", "score": "0.5497211", "text": "def initialize_copy(other); end", "title": "" }, { "docid": "f3527b94710ed3aa1c8c821dd61a4cf3", "score": "0.5497211", "text": "def initialize_copy(other); end", "title": "" }, { "docid": "f3527b94710ed3aa1c8c821dd61a4cf3", "score": "0.5497211", "text": "def initialize_copy(other); end", "title": "" } ]