query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
GET /moresmalltrials/new GET /moresmalltrials/new.json
def new @moresmalltrial = Moresmalltrial.new max_id = Moresmalltrial.maximum(:id) max_id = 1 if max_id.nil? next_id = max_id + 1 @moresmallmaps = Moresmallmap.where('start_trial_id <= ?', next_id).where('end_trial_id >= ?', next_id) respond_to do |format| format.html # new.html.erb format.json { render json: @moresmalltrial } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @trial = Trial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trial }\n end\n end", "def create\n @moresmalltrial = Moresmalltrial.new(params[:moresmalltrial])\n\n respond_to do |format|\n if @moresmalltrial.save\n format.html { redirect_to @moresmalltrial, notice: 'Moresmalltrial was successfully created.' }\n format.json { render json: @moresmalltrial, status: :created, location: @moresmalltrial }\n else\n format.html { render action: \"new\" }\n format.json { render json: @moresmalltrial.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @medium_trial = MediumTrial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @medium_trial }\n end\n end", "def new\n @my_time_trial = MyTimeTrial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @my_time_trial }\n end\n end", "def new\n @trial = Trial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @trial }\n end\n end", "def new\n @missionmaker = Missionmaker.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @missionmaker }\n end\n end", "def new\n @test_plan = TestPlan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test_plan }\n end\n end", "def create\n @mosttinytrial = Mosttinytrial.new(params[:mosttinytrial])\n\n respond_to do |format|\n if @mosttinytrial.save\n format.html { redirect_to @mosttinytrial, notice: 'Mosttinytrial was successfully created.' }\n format.json { render json: @mosttinytrial, status: :created, location: @mosttinytrial }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mosttinytrial.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @my_time_trial = MyTimeTrial.new(params[:my_time_trial])\n\n respond_to do |format|\n if @my_time_trial.save\n format.html { redirect_to @my_time_trial, :notice => 'My time trial was successfully created.' }\n format.json { render :json => @my_time_trial, :status => :created, :location => @my_time_trial }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @my_time_trial.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @lunchplan = Lunchplan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @lunchplan }\n end\n end", "def create\n @trial = Trial.new(trial_params)\n\n respond_to do |format|\n if @trial.save\n format.html { redirect_to @trial, notice: 'Trial was successfully created.' }\n format.json { render action: 'show', status: :created, location: @trial }\n else\n format.html { render action: 'new' }\n format.json { render json: @trial.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @moretinymobtrail = Moretinymobtrail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @moretinymobtrail }\n end\n end", "def new\n @mall = Mall.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mall }\n end\n end", "def new\n @t = T.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @t }\n end\n end", "def new\n @goal = Goal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @goal }\n end\n end", "def new\n @goal = Goal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @goal }\n end\n end", "def new\n @goal = Goal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @goal }\n end\n end", "def new\n @mill = Mill.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mill }\n end\n end", "def new\n @trip = Trip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trip }\n end\n end", "def new\n @trip = Trip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trip }\n end\n end", "def new\n @mission = Mission.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mission }\n end\n end", "def new\n @mlp = Mlp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mlp }\n end\n end", "def new\n @mosttinymobtrail = Mosttinymobtrail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mosttinymobtrail }\n end\n end", "def new\n @monit = Monit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @monit }\n end\n end", "def create\n @medium_trial = MediumTrial.new(params[:medium_trial])\n\n respond_to do |format|\n if @medium_trial.save\n format.html { redirect_to @medium_trial, notice: 'Medium trial was successfully created.' }\n format.json { render json: @medium_trial, status: :created, location: @medium_trial }\n else\n format.html { render action: \"new\" }\n format.json { render json: @medium_trial.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @mattress = Mattress.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mattress }\n end\n end", "def new\n @planned_time = PlannedTime.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @planned_time }\n end\n end", "def new\n @mrj = Mrj.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mrj }\n end\n end", "def create\n @trial_model = TrialModel.new(trial_model_params)\n\n respond_to do |format|\n if @trial_model.save\n format.html { redirect_to @trial_model, notice: 'Trial model was successfully created.' }\n format.json { render :show, status: :created, location: @trial_model }\n else\n format.html { render :new }\n format.json { render json: @trial_model.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @patent = Patent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patent }\n end\n end", "def new\n @request = @skill.requests.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @request }\n end\n end", "def new\n @timetable = Timetable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @timetable }\n end\n end", "def new\n @title = t('view.surveys.new_title')\n @survey = Survey.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @survey }\n end\n end", "def new\n @mostsmallmission = Mostsmallmission.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mostsmallmission }\n end\n end", "def new\n @exercise_plan = ExercisePlan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise_plan }\n end\n end", "def new\n @survey = Survey.new\n\n respond_to do |format|\n format.html # new.slim\n format.json { render json: @survey }\n end\n end", "def new\n @work_plan = WorkPlan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @work_plan }\n end\n end", "def new\n\t\n\t@timetable = Timetable.new\n\t\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @timetable }\n end\n end", "def new\n @traffic = Traffic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @traffic }\n end\n end", "def new\n # Form to create a new record\n @maintenance = Maintenance.new\n @trips = Trip.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @maintenance }\n end\n end", "def new\n @tablet = Tablet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tablet }\n end\n end", "def new\n @tester = Tester.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tester }\n end\n end", "def new\n @tester = Tester.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tester }\n end\n end", "def new\n @planner = Planner.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @planner }\n end\n end", "def new\n @assert = Assert.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @assert }\n end\n end", "def new\n @assert = Assert.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @assert }\n end\n end", "def new\n @tattoo = Tattoo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tattoo }\n end\n end", "def new\n @take = Take.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @take }\n end\n end", "def new\n #@matches = Match.all\n @title = \"New Ticket\"\n @ticket = Ticket.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ticket }\n end\n end", "def new\n @mosttinytrial = Mosttinytrial.new\n\n @gurad_mobs_size = Mosttinymob.find_all_by_mosttinyuser_id(2).size\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mosttinytrial }\n end\n end", "def new\n @plan = Plan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @plan }\n end\n end", "def new\n @plan = Plan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @plan }\n end\n end", "def new\n @planning_time = PlanningTime.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @planning_time }\n end\n end", "def new\n @taker = Taker.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @taker }\n end\n end", "def new\n @line = ReportingForms::Tanimoto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line }\n end\n end", "def new\n @scenario = Scenario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scenario }\n end\n end", "def new\n @moresmallmobsquad = Moresmallmobsquad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @moresmallmobsquad }\n end\n end", "def new\n @trip_item = TripItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trip_item }\n end\n end", "def new\n\n\n @goal_id = params[:id]\n @milestone = Milestone.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @milestone }\n end\n end", "def new\n @lift = Lift.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lift }\n end\n end", "def new\n @test_suite = TestSuite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test_suite }\n end\n end", "def new\n @ram = Ram.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ram }\n end\n end", "def new\n @tenure = Tenure.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tenure }\n end\n end", "def new\n @scenario = Scenario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scenario }\n end\n end", "def new\n @meal_time = MealTime.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meal_time }\n end\n end", "def new\n @trainer = Trainer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trainer }\n end\n end", "def new\n @dummy = Dummy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dummy }\n end\n end", "def new\n @weekly_expectation = WeeklyExpectation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @weekly_expectation }\n end\n end", "def new\n @survey = Survey.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @survey }\n end\n end", "def new\n @survey = Survey.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @survey }\n end\n end", "def new\n @survey = Survey.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @survey }\n end\n end", "def new\n @survey = Survey.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @survey }\n end\n end", "def new\n @survey = Survey.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @survey }\n end\n end", "def new\n \n @step = Step.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @step }\n end\n end", "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", "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", "def new\r\n @work_plan = WorkPlan.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @work_plan }\r\n end\r\n end", "def new\n \n @act = Act.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @act }\n end\n end", "def new\n @retail_unit = RetailUnit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @retail_unit }\n end\n end", "def new\n @v_goal = VGoal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @v_goal }\n end\n end", "def new\n\n @contestant = Contestant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contestant }\n end\n end", "def new\n @plan_milestone = PlanMilestone.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @plan_milestone }\n end\n end", "def new\n @precinct = Precinct.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @precinct }\n end\n end", "def new\n @slam = Slam.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slam }\n end\n end", "def new\n @mi = Mi.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mi }\n end\n end", "def new\n @sslplan = Sslplan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @sslplan }\n end\n end", "def new\n @microplst = Microplst.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @microplst }\n end\n end", "def new\n @mostsmallskill = Mostsmallskill.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mostsmallskill }\n end\n end", "def new\n @skill = Skill.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @skill }\n end\n end", "def new\n @trail = Trail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trail }\n end\n end", "def new\n @trail = Trail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trail }\n end\n end", "def new\n @create_request_skill = CreateRequestSkill.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @create_request_skill }\n end\n end", "def new\n @momsg = Momsg.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @momsg }\n end\n end", "def new\r\n @general_plan = GeneralPlan.new\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @general_plan }\r\n end\r\n end", "def new\n @gotcha = Gotcha.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gotcha }\n end\n end", "def new\n @completed_quest = CompletedQuest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @completed_quest }\n end\n end", "def new\n @tupian = Tupian.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tupian }\n end\n end", "def new\n @quest = Quest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quest }\n end\n end", "def new\n @klassplan = Klassplan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @klassplan }\n end\n end", "def new\n @precious_metal = PreciousMetal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @precious_metal }\n end\n end" ]
[ "0.8111692", "0.76569766", "0.75826657", "0.74594134", "0.71292454", "0.697623", "0.6968015", "0.6959363", "0.6907986", "0.6904861", "0.6903871", "0.6878174", "0.6877298", "0.6865072", "0.6802715", "0.6802715", "0.6802715", "0.6800956", "0.67997634", "0.67997634", "0.67756337", "0.6758204", "0.67556715", "0.6753546", "0.67384857", "0.6736762", "0.6726997", "0.67248714", "0.67209256", "0.6704393", "0.6697532", "0.6692524", "0.6681062", "0.66786236", "0.66775185", "0.6667199", "0.66666675", "0.66631866", "0.66567904", "0.66504043", "0.6644378", "0.66441816", "0.66441816", "0.66430527", "0.6639184", "0.6639184", "0.6636995", "0.6632983", "0.66311634", "0.66269654", "0.6625907", "0.6625907", "0.6624949", "0.66204894", "0.66154194", "0.6607704", "0.6594436", "0.65943027", "0.6593979", "0.65939426", "0.6592444", "0.659155", "0.65898925", "0.6583581", "0.65831035", "0.6581928", "0.65812457", "0.65804213", "0.65777993", "0.65777993", "0.65777993", "0.65777993", "0.65777993", "0.6575757", "0.65726674", "0.65726674", "0.6571505", "0.65670425", "0.6562079", "0.6562062", "0.65613896", "0.65594345", "0.6556749", "0.6556384", "0.6554633", "0.6554061", "0.65529144", "0.6550363", "0.6546385", "0.6545029", "0.6545029", "0.65446633", "0.65420896", "0.65391773", "0.6538051", "0.65378296", "0.653633", "0.6535752", "0.6535503", "0.6535193" ]
0.7570346
3
POST /moresmalltrials POST /moresmalltrials.json
def create @moresmalltrial = Moresmalltrial.new(params[:moresmalltrial]) respond_to do |format| if @moresmalltrial.save format.html { redirect_to @moresmalltrial, notice: 'Moresmalltrial was successfully created.' } format.json { render json: @moresmalltrial, status: :created, location: @moresmalltrial } else format.html { render action: "new" } format.json { render json: @moresmalltrial.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @moresmalltrial = Moresmalltrial.new\n max_id = Moresmalltrial.maximum(:id)\n max_id = 1 if max_id.nil?\n next_id = max_id + 1\n @moresmallmaps = Moresmallmap.where('start_trial_id <= ?', next_id).where('end_trial_id >= ?', next_id)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @moresmalltrial }\n end\n end", "def create\n @my_time_trial = MyTimeTrial.new(params[:my_time_trial])\n\n respond_to do |format|\n if @my_time_trial.save\n format.html { redirect_to @my_time_trial, :notice => 'My time trial was successfully created.' }\n format.json { render :json => @my_time_trial, :status => :created, :location => @my_time_trial }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @my_time_trial.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @medium_trial = MediumTrial.new(params[:medium_trial])\n\n respond_to do |format|\n if @medium_trial.save\n format.html { redirect_to @medium_trial, notice: 'Medium trial was successfully created.' }\n format.json { render json: @medium_trial, status: :created, location: @medium_trial }\n else\n format.html { render action: \"new\" }\n format.json { render json: @medium_trial.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @trial = Trial.new(trial_params)\n\n respond_to do |format|\n if @trial.save\n format.html { redirect_to @trial, notice: 'Trial was successfully created.' }\n format.json { render action: 'show', status: :created, location: @trial }\n else\n format.html { render action: 'new' }\n format.json { render json: @trial.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @mosttinytrial = Mosttinytrial.new(params[:mosttinytrial])\n\n respond_to do |format|\n if @mosttinytrial.save\n format.html { redirect_to @mosttinytrial, notice: 'Mosttinytrial was successfully created.' }\n format.json { render json: @mosttinytrial, status: :created, location: @mosttinytrial }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mosttinytrial.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @trial_model = TrialModel.new(trial_model_params)\n\n respond_to do |format|\n if @trial_model.save\n format.html { redirect_to @trial_model, notice: 'Trial model was successfully created.' }\n format.json { render :show, status: :created, location: @trial_model }\n else\n format.html { render :new }\n format.json { render json: @trial_model.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @trial = Trial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trial }\n end\n end", "def create\n @time_trial = TimeTrial.new(time_trial_params)\n @time_trial.save\n end", "def new\n @medium_trial = MediumTrial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @medium_trial }\n end\n end", "def create\n @testmonial = Testmonial.new(testmonial_params)\n\n if @testmonial.save\n render json: @testmonial, status: :created\n else\n render json: @testmonial.errors, status: :unprocessable_entity\n end\n end", "def new\n @my_time_trial = MyTimeTrial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @my_time_trial }\n end\n end", "def create\n @trial = Trial.new(params[:trial])\n\n respond_to do |format|\n if @trial.save\n format.html { redirect_to(@trial, :notice => 'Trial was successfully created.') }\n format.xml { render :xml => @trial, :status => :created, :location => @trial }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @trial.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @trial = Trial.new(params[:trial])\n\n respond_to do |format|\n if @trial.save\n flash[:notice] = 'Trial was successfully created.'\n format.html { redirect_to(@trial) }\n format.xml { render :xml => @trial, :status => :created, :location => @trial }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @trial.errors, :status => :unprocessable_entity }\n end\n end\n end", "def show\n @moresmalltrial = Moresmalltrial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @moresmalltrial }\n end\n end", "def create\n @associated_trial = AssociatedTrial.new(associated_trial_params)\n\n respond_to do |format|\n if @associated_trial.save\n format.html { redirect_to @associated_trial, notice: 'Associated trial was successfully created.' }\n format.json { render :show, status: :created, location: @associated_trial }\n else\n format.html { render :new }\n format.json { render json: @associated_trial.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #raise params.inspect\n\n wmsPhase = session[\"wms_phase\"].to_f\n total = 0\n \n #number of answers\n if wmsPhase == 1 \n total = 21\n else\n total = 16\n end\n\n #correct answers\n correct = params[:hiddenResult][0].to_f\n #wrong answers\n wrong = total-correct\n\n @wm = WmsResult.new(params[:wms_result])\n @wm.correct_items = correct\n @wm.wrong_items = wrong\n @wm.phase = wmsPhase\n appoint_id = session[\"current_appointment\"].to_f\n if(!appoint_id.blank?)\n ev_test = EvaluationTest.find_by_name(\"wms\")\n app = AppointmentPlan.where(:appointment_id => appoint_id, :evaluation_test_id => ev_test.id)\n @wm.appointment_plan_id = app.first.id \n end\n\n respond_to do |format|\n if @wm.save\n if wmsPhase == 1\n format.html { redirect_to new_wms_result_path, notice: 'WMS II - Sequencia Letra-Numero guardada com sucesso.' }\n else\n session[\"wms_phase\"] = nil\n if session[\"test_sequence\"].blank?\n appID = session[\"current_appointment\"]\n session[\"current_appointment\"] = nil\n format.html { redirect_to :controller => \"evaluation_results\", :action => \"new\" , :appID => appID}\n else\n format.html { redirect_to appointment_plans_path, notice: 'WMS II - Sequencia Espacial Direta guardada com sucesso.' }\n end\n end\n format.json { render json: @wm, status: :created, location: @wm }\n else\n format.html { render action: \"new\" }\n format.json { render json: @wm.errors, status: :unprocessable_entity }\n end\n end\n end", "def suscriber_wm\n\t\turi = URI(\"http://staging.benchprep.com/api/v1/test/fixtures.json\")\t\n\n\t\tres = Net::HTTP.post_form(uri, 'email' => 'integration-tester+1@benchprep.com&enrollments_persona=subscriber&devices_persona=web_and_mobile')\n\t\t# write this output to a file\n\t\toutput = File.open( \"spec/fixtures/sp_wm_persona.json\",'w' ){|f| \n\t\t\tf.flock(File::LOCK_EX)\n\t\t\tf.write(res.body)\n\t\t}\n\n\t\t# Now parse this string as json\n\t\tjson = File.read('spec/fixtures/sp_wm_persona.json')\n\t\templs = JSON.parse(json)\n\n\t\treturn empls #pretty printed output\n\tend", "def destroy\n @moresmalltrial = Moresmalltrial.find(params[:id])\n @moresmalltrial.destroy\n\n respond_to do |format|\n format.html { redirect_to moresmalltrials_url }\n format.json { head :no_content }\n end\n end", "def trial_params\n params.require(:trial).permit(:id, :name, :description, :summary, :organization_id, :question_id,{ :question_ids => []})\n end", "def create\n @trial_site = TrialSite.new(trial_site_params)\n\n respond_to do |format|\n if @trial_site.save\n format.html { redirect_to @trial_site, notice: 'Trial site was successfully created.' }\n format.json { render :show, status: :created, location: @trial_site }\n else\n format.html { render :new }\n format.json { render json: @trial_site.errors, status: :unprocessable_entity }\n end\n end\n end", "def trial_params\n params.require(:trial).permit(:trial_id, :number, :study_id, :state, :value, :datetime_start, :datetime_complete)\n end", "def new\n @mosttinytrial = Mosttinytrial.new\n\n @gurad_mobs_size = Mosttinymob.find_all_by_mosttinyuser_id(2).size\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mosttinytrial }\n end\n end", "def create\n @moresmallmobsquad = Moresmallmobsquad.new(params[:moresmallmobsquad])\n\n respond_to do |format|\n if @moresmallmobsquad.save\n format.html { redirect_to @moresmallmobsquad, notice: 'Moresmallmobsquad was successfully created.' }\n format.json { render json: @moresmallmobsquad, status: :created, location: @moresmallmobsquad }\n else\n format.html { render action: \"new\" }\n format.json { render json: @moresmallmobsquad.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @moresmalltrial = Moresmalltrial.find(params[:id])\n\n respond_to do |format|\n if @moresmalltrial.update_attributes(params[:moresmalltrial])\n format.html { redirect_to @moresmalltrial, notice: 'Moresmalltrial was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @moresmalltrial.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @moretinymobtrail = Moretinymobtrail.new(params[:moretinymobtrail])\n\n respond_to do |format|\n if @moretinymobtrail.save\n format.html { redirect_to @moretinymobtrail, notice: 'Moretinymobtrail was successfully created.' }\n format.json { render json: @moretinymobtrail, status: :created, location: @moretinymobtrail }\n else\n format.html { render action: \"new\" }\n format.json { render json: @moretinymobtrail.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_trial\n @trial = Trial.find(params[:id])\n end", "def create\n @step_m = StepM.new(step_m_params)\n\n respond_to do |format|\n if @step_m.save\n format.html { redirect_to @step_m, notice: 'Step m was successfully created.' }\n format.json { render :show, status: :created, location: @step_m }\n else\n format.html { render :new }\n format.json { render json: @step_m.errors, status: :unprocessable_entity }\n end\n end\n end", "def time_trial_params\n params.require(:time_trial).permit(:firstname, :lastname, :email, :time, :cheater)\n end", "def create\n err_objs=[]\n error=false\n user_id=MobileDevice.where(:access_token=>params[:access_token]).first.user_id\n if params.has_key?('trips')\n params[:trips].each do |trip|\n trip_id=trip[1][:trip_id] #save ref to trip id in case @trip.save fails (used in return response)\n if !create_trip(trip[1],user_id)\n error=true\n err_objs.push(trip_id)\n end\n end\n else\n error=true\n end\n respond_to do |format|\n if !error\n format.json { render json: {:msg => \"success\"}, status: :created }\n else\n format.json { render json: {:msg => \"Could not save the following trips. Please check that all required fields are filled out (license_plate, cargo, start_location, end_location, start_timestamp, end_timestamp)\", :err_ids => err_objs}, status: :unprocessable_entity }\n end\n end\n end", "def submit_form_2122\n validate_json_schema\n\n power_of_attorney = ClaimsApi::PowerOfAttorney.find_using_identifier_and_source(header_md5: header_md5,\n source_name: source_name)\n unless power_of_attorney&.status&.in?(%w[submitted pending])\n power_of_attorney = ClaimsApi::PowerOfAttorney.create(\n status: ClaimsApi::PowerOfAttorney::PENDING,\n auth_headers: auth_headers,\n form_data: form_attributes,\n source_data: source_data,\n header_md5: header_md5\n )\n\n unless power_of_attorney.persisted?\n power_of_attorney = ClaimsApi::PowerOfAttorney.find_by(md5: power_of_attorney.md5)\n end\n\n power_of_attorney.save!\n end\n\n ClaimsApi::PoaUpdater.perform_async(power_of_attorney.id)\n\n render json: power_of_attorney, serializer: ClaimsApi::PowerOfAttorneySerializer\n end", "def post\n Typhoeus.post(@url,\n body: @results_hash.to_json,\n headers: { 'Content-Type' => 'application/json' })\n end", "def create #creates a new trial object in db\n @trial = Trial.new(params[:trial])\n if @trial.enrolledGoal == nil\n @trial.enrolledGoal = 0\n end \n if @trial.trialID == nil\n @trial.trialID = 0\n end\n if @trial.completedGoal == nil\n @trial.completedGoal = 0\n end \n logger.info(@trial.endDate)\n\n @trial.endDate = Date.strptime(params[:trial][:endDate], '%m/%d/%Y')\n\n\n @trial.startDate = Date.strptime(params[:trial][:startDate], '%m/%d/%Y')\n @trial.userowner = session[:userID]\n respond_to do |format|\n if @trial.save\n entry = @trial.entries.create(:input_at => @trial.startDate, :enrolled => 0, :active => 0, :completed => 0, :withdrawn => 0, :refused => 0,:lost => 0, :trial_id => @trial.id)\n #@trial.users << @current_crc\n @trial.users << @user = User.find(session[:userID])\n \n session[:current_trial] = @trial.id\n logger.info(\"our current session, create\")\n logger.info(session[:current_trial])\n session[:current_tab] = 'settings'\n # format.html { redirect_to @trial, notice: 'Trial was successfully created.' }\n format.json { head :no_content }\n format.html {redirect_to :controller => 'home', :action => 'index' }\n else\n format.html { render action: \"new\" }\n format.json { render json: @trial.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_trial\n @trial = Trial.find(params[:id])\n end", "def new\n @monthlybill = Monthlybill.new\n @this_test_item = params[:repetitionField].to_i\n @test = \"test\"\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.js\n format.json { render json: @monthlybill }\n end\n end", "def create\n retval = @survey.create_report_mockup(params[:report_mockup])\n render_json_auto retval and return\n end", "def create_task\n\n #Assign url\n url=\"https://api.scaleapi.com/v1/task/phonecall\"\n\n #Auth credentials setup\n auth = {:username=>ENV[\"SCALE_API_KEY\"], :password=>\"\"}\n \n #Assign headers\n headers = {\"Content-Type\"=>\"application/json\"}\n\n #Create payload\n params = {callback_url: 'https://mysterious-ridge-35983.herokuapp.com/survey_callback',\n instruction: \"Call this person and ask him his calorie counts for yesterday and the number of coffees he drank. Then, ask him if he took his morning and evening medications.\",\n script: \"Hey! (pause) How many calories did you eat yesterday? (pause) What about protein grams (pause)?\"\\\n \" What about carbohydrate grams (pause)? What about fat grams (pause)? What about fiber grams (pause)?\"\\\n \" How many coffees did you drink (pause)? Did your take your morning and evening meds (pause)?\",\n phone_number: ENV[\"PHONE_NUMBER\"],\n entity_name: ENV[\"OWNER_NAME\"],\n fields: { total_calories: 'Total Calories',\n protein_grams: 'Protein Grams',\n carbohydrate_grams: 'Carbohydrate Grams',\n fiber_grams: 'Fiber Grams',\n fat_grams: 'Fat Grams',\n number_of_coffees: 'Coffees per Day'},\n urgency: \"immediate\",\n choices: ['only_took_morning_meds', 'only_took_evening_meds', 'took_both_morning_and_evening','no_meds_taken']}\n\n #Send request\n begin\n\n request=HTTParty.post(url,:basic_auth=>auth, :headers=> headers, :body=>params.to_json)\n\n #Receive request and store response\n self.scale_api_id=request[\"task_id\"]\n self.json_data=JSON.dump(request)\n\n rescue\n\n #If there's an error, raise an exception to prevent DailySurvey object being created\n raise \"Bad Scale API request\"\n \n end\n \n end", "def create\n @mall = Mall.new(params[:mall])\n\n respond_to do |format|\n if @mall.save\n format.html { redirect_to @mall, notice: 'Mall was successfully created.' }\n format.json { render json: @mall, status: :created, location: @mall }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mall.errors, status: :unprocessable_entity }\n end\n end\n end", "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", "def trial_model_params\n params.require(:trial_model).permit(:trial_attribute)\n end", "def test_new_microtask\r\n #@assignment = assignments(:Assignment_Microtask1)\r\n questionnaire_id = questionnaires(:questionnaire1).id\r\n instructorid = users(:instructor1).id\r\n courseid = courses(:course_object_oriented).id,\r\n number_of_topics = SignUpTopic.count\r\n # create a new assignment\r\n post :new, :assignment => { :name => \"Assignment_Microtask1\",\r\n :directory_path => \"CSC517_instructor1/Assignment_Microtask1\",\r\n :submitter_count => 0,\r\n :course_id => courseid,\r\n :instructor_id => instructorid,\r\n :num_reviews => 1,\r\n :num_review_of_reviews => 0,\r\n :num_review_of_reviewers => 0,\r\n :review_questionnaire_id => questionnaire_id,\r\n :reviews_visible_to_all => 0,\r\n :require_signup => 0,\r\n :num_reviewers => 3,\r\n :team_assignment => 0,\r\n :team_count => 1,\r\n :microtask => true }\r\n\r\n assert_response 200\r\n assert Assignment.find(:all, :conditions => \"name = 'Assignment_Microtask1'\")\r\n\r\n end", "def create\n @concept = CustomizedConcept.find(params[:test_attempt][:customized_concept_id])\n @tests = @concept.tests\n @test_attempt = @concept.test_attempts.new(test_attempt_params)\n @course = @concept.course\n @answer_records = @test_attempt.answer_records\n \n @error_test = check_answer(params[:select_answers])\n respond_to do |format|\n if (@error_test.length == 0) \n @test_attempt.test_time_sec = Time.now.to_i - @test_attempt.test_time_sec\n if @test_attempt.save\n format.html { redirect_to course_customized_concept_path(@course, @concept), notice: 'Successfully pass' }\n format.json { render :show, status: :created, location: @test_attempt }\n end\n else\n\t\t\t\t@test_attempt.retry_time += 1\n\t\t\t\tbinding.pry\n @error_test.each do |e|\n @answer_records.each do |a|\n a.error_times += 1 if a.test == e\n end\n end\n format.html { render :new }\n format.json { render json: @test_attempt.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @timer = Timer.new(timer_params)\n\n if @timer.save\n render json: @timer, status: :created, location: @timer\n else\n render json: @timer.errors, status: :unprocessable_entity\n end\n end", "def create\n @test_metum = TestMetum.new(test_metum_params)\n\n respond_to do |format|\n if @test_metum.save\n format.html { redirect_to @test_metum, notice: 'Test metum was successfully created.' }\n format.json { render action: 'show', status: :created, location: @test_metum }\n else\n format.html { render action: 'new' }\n format.json { render json: @test_metum.errors, status: :unprocessable_entity }\n end\n end\n end", "def measurements_post(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: MeasurementApi#measurements_post ...\"\n end\n \n # resource path\n path = \"/measurements\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\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 = @api_client.object_to_http_body(opts[:'body'])\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:POST, 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 => 'inline_response_200_13')\n if Configuration.debugging\n Configuration.logger.debug \"API called: MeasurementApi#measurements_post. Result: #{result.inspect}\"\n end\n return result\n end", "def create\n @smallsurvey = Smallsurvey.new(smallsurvey_params)\n\n respond_to do |format|\n if @smallsurvey.save\n format.html { redirect_to final_path, notice: 'Smallsurvey was successfully created.' }\n format.json { render :show, status: :created, location: @smallsurvey }\n else\n format.html { render :new }\n format.json { render json: @smallsurvey.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @mrv = Mrv.new(mrv_params)\n\n respond_to do |format|\n if @mrv.save\n format.html { redirect_to @mrv, notice: 'Mrv was successfully created.' }\n format.json { render :show, status: :created, location: @mrv }\n else\n format.html { render :new }\n format.json { render json: @mrv.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tm = Tm.new(tm_params)\n\n respond_to do |format|\n if @tm.save\n format.html { redirect_to @tm, notice: 'Tm was successfully created.' }\n format.json { render :show, status: :created, location: @tm }\n else\n format.html { render :new }\n format.json { render json: @tm.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n json = HTTParty.get(\"https://api.typeform.com/v1/form/WaIffL?key=f486f2db8f1249c077a08b582bc3efe0a2617668\").body\n\n @jsontests = JSON.parse(json)\n\n end", "def create\n @tune = Tune.new(params[:tune])\n\n respond_to do |format|\n if @tune.save\n format.html { redirect_to root_path notice: 'Tune was successfully created.' }\n format.json { render json: @tune, status: :created, location: @tune }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tune.errors, status: :unprocessable_entity }\n end\n end\n end", "def generatesingletestplan\n\trelease = params[:release]\n\tpriority = params[:priority]\n\texectype = params[:exectype]\n\ttimelimit = params[:timelimit]\n\t# получаем с сервера нужные данные\n\tmds = Hash.new()\n\tTCPSocket.open('172.20.5.130', 2000){ |client|\n\t\t# say Hello to server\n\t\tclient.puts \"MasterOnline\"\n\t\tclient.gets\n\t\tclient.puts \"master_set get_singletestplan #{release} #{priority} #{exectype} #{timelimit}\"\n\t\tmds = JSON.parse(client.gets)\n\t\tclient.puts \"master_set close_connection\"\n\t}\n\t# подготавливаем данные для отправки на веб страницу\n\tnewTree = mds\n\t#newTree = newTree[\"TestItem\"][0]\n\t# новое дерево\n\t# вводим фиктивную вершину\n\tvalue = Hash.new()\n\tvalue[:data] = \"Тестирование \" + release\n\t\tfalseAttr = Hash.new()\n\t\tfalseAttr[:class] = \"jstree-checked\"\n\t\tfalseAttr[:id] = \"0001\"\n\t\tfalseAttr[:MethodName] = \"\"\n\t\tfalseAttr[:UnitName] = \"\"\n\tvalue[:attr] = falseAttr\n\t# получаем дерево\n\tchildrens = Array.new()\n\tnewTree[\"TestItem\"].each do |x|\n\t\ttree = createTreeForView(x)\n\t\tchildrens.push(tree)\n\tend\n\tvalue[:children] = childrens\n\trawarray = { :data => value}\n\tmds_for_send = rawarray.to_json\n\trender :text => mds_for_send\n end", "def create\n @alram_test = AlramTest.new(alram_test_params)\n\n respond_to do |format|\n if @alram_test.save\n format.html { redirect_to @alram_test, notice: 'Alram test was successfully created.' }\n format.json { render :show, status: :created, location: @alram_test }\n else\n format.html { render :new }\n format.json { render json: @alram_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @m_test_type = MTestType.new(m_test_type_params)\n\n respond_to do |format|\n if @m_test_type.save\n format.html { redirect_to @m_test_type, notice: 'M test type was successfully created.' }\n format.json { render :show, status: :created, location: @m_test_type }\n else\n format.html { render :new }\n format.json { render json: @m_test_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n # raise params.inspect\r\n @wai = WaisResult.new(params[:wais_result])\r\n @wai.phase = session[\"wais_phase\"]\r\n @wai.spent_time = Time.at(params[:wais_result][:spent_time].to_i).utc.strftime(\"%H:%M:%S\")\r\n appoint_id = session[\"current_appointment\"].to_f\r\n if(!appoint_id.blank?)\r\n ev_test = EvaluationTest.find_by_name(\"wais\")\r\n app = AppointmentPlan.where(:appointment_id => appoint_id, :evaluation_test_id => ev_test.id)\r\n @wai.appointment_plan_id = app.first.id\r\n end\r\n\r\n if params[:correct_items].nil?\r\n @wai.correct_items = 0;\r\n end\r\n\r\n if params[:wrong_items].nil?\r\n @wai.wrong_items = 0;\r\n end\r\n\r\n respond_to do |format|\r\n if @wai.save\r\n format.html {\r\n if session[\"wais_phase\"] == 2\r\n session[\"wais_phase\"] = nil\r\n if session[\"test_sequence\"].blank?\r\n appID = session[\"current_appointment\"]\r\n session[\"current_appointment\"] = nil\r\n redirect_to :controller => \"evaluation_results\", :action => \"new\" , :appID => appID\r\n else\r\n redirect_to appointment_plans_path, notice: 'WAIS III - Resultados Codigo gravados com sucesso.'\r\n end\r\n else\r\n redirect_to new_wais_result_path, notice: 'WAIS III - Resultados Pesquisa de Simbolos gravados com sucesso.'\r\n end\r\n }\r\n format.json { render json: @wai, status: :created, location: @wai }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @wai.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def index\n @testmonials = Testmonial.all\n\n render json: @testmonials\n end", "def create(attrs, user = @@default_user)\n attrs = { project_token: @project_token }.merge(attrs)\n @attributes = send_request('test_plans', :post) do |req|\n req.body = {\n test_plan: attrs.except(:project_token),\n token: attrs[:project_token],\n auth_token: user.auth_token\n }\n end\n end", "def create\n @initial_survey = InitialSurvey.new(initial_survey_params)\n cookies[:user] = @initial_survey.user\n\n respond_to do |format|\n if @initial_survey.save\n format.html { redirect_to new_simulation_path, notice: 'Initial survey was successfully created.' }\n format.json { render :show, status: :created, location: @initial_survey }\n else\n format.html { render :new }\n format.json { render json: @initial_survey.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n cnt = params[:tutor_availability][:repeat].to_i - 1\n params[:tutor_availability].delete :repeat\n @tutor_availability = TutorAvailability.new(params[:tutor_availability])\n\n respond_to do |format|\n if @tutor_availability.save\n if cnt > 0\n for i in 1..cnt\n new_ta = TutorAvailability.new(params[:tutor_availability])\n new_ta.start_time = @tutor_availability.start_time + 604800*i\n new_ta.save\n end\n end\n format.html { redirect_to tutor_availabilities_path, notice: 'Tutor availability was successfully created.' }\n format.json { render json: @tutor_availability, status: :created, location: @tutor_availability }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tutor_availability.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test_stall = TestStall.new(test_stall_params)\n\n respond_to do |format|\n if @test_stall.save\n format.html { redirect_to @test_stall, notice: 'Test stall was successfully created.' }\n format.json { render :show, status: :created, location: @test_stall }\n else\n format.html { render :new }\n format.json { render json: @test_stall.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test_suite = TestSuite.new(params[:test_suite])\n\n respond_to do |format|\n if @test_suite.save\n format.html { redirect_to @test_suite, notice: 'Test suite was successfully created.' }\n format.json { render json: @test_suite, status: :created, location: @test_suite }\n else\n format.html { render action: \"new\" }\n format.json { render json: @test_suite.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @medical_test = MedicalTest.new(medical_test_params)\n\n respond_to do |format|\n if @medical_test.save\n format.html { redirect_to @medical_test, notice: 'Medical test was successfully created.' }\n format.json { render :show, status: :created, location: @medical_test }\n else\n format.html { render :new }\n format.json { render json: @medical_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n megam_rest.post_promos(to_hash) #WONT BE USED AS OF NOW\n end", "def create\n @tmpr_monthly_log = TempsMonthly.new(tmpr_monthly_log_params)\n\n respond_to do |format|\n if @tmpr_monthly_log.save\n format.html { redirect_to @tmpr_monthly_log, notice: 'Tmpr monthly log was successfully created.' }\n format.json { render :show, status: :created, location: @tmpr_monthly_log }\n else\n format.html { render :new }\n format.json { render json: @tmpr_monthly_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @monthly = current_user.monthlies.new(params[:monthly])\n\n respond_to do |format|\n if @monthly.save\n session[:monthly] = @monthly\n #format.html { redirect_to @monthly, notice: 'Monthly was successfully created.' }\n format.html { redirect_to time_records_url }\n format.json { render json: @monthly, status: :created, location: @monthly }\n else\n format.html { render action: \"new\" }\n format.json { render json: @monthly.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_time_trial\n @time_trial = TimeTrial.find(params[:id])\n end", "def create\n @goal = @todo.goals.create(goal_params)\n render json: @goal\n end", "def create\n @project_step_m = ProjectStepM.new(project_step_m_params)\n\n respond_to do |format|\n if @project_step_m.save\n format.html { redirect_to @project_step_m, notice: 'Project step m was successfully created.' }\n format.json { render :show, status: :created, location: @project_step_m }\n else\n format.html { render :new }\n format.json { render json: @project_step_m.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n byebug\n @admin_skill = Admin::Skill.new(admin_skill_params)\n\n if @admin_skill.save\n render json: @admin_skill, status: :created, location: @admin_skill\n else\n render json: @admin_skill.errors, status: :unprocessable_entity\n end\n end", "def new\n @trial = Trial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @trial }\n end\n end", "def create\n @testimonio = Testimonio.new(testimonio_params)\n\n respond_to do |format|\n if @testimonio.save\n format.html { redirect_to @testimonio, notice: 'Testimonio was successfully created.' }\n format.json { render :show, status: :created, location: @testimonio }\n else\n format.html { render :new }\n format.json { render json: @testimonio.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @trial_models = TrialModel.all\n end", "def tally_params\n params.require(:tally).permit(:total_time_m, :total_time_s, :total_time_ms, :total_points, :total_faults, :title, :qualifying_score, :qualifying_scores, :event_ids => [], :entrant_ids => [] )\n end", "def create\n @test_suite = TestSuite.new(test_suite_params)\n\n respond_to do |format|\n if @test_suite.save\n format.html { redirect_to @test_suite, notice: 'Test suite was successfully created.' }\n format.json { render :show, status: :created, location: @test_suite }\n else\n format.html { render :new }\n format.json { render json: @test_suite.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @lunchplan = Lunchplan.new(params[:lunchplan])\n\n respond_to do |format|\n if @lunchplan.save\n format.html { redirect_to @lunchplan, :notice => 'Lunchplan was successfully created.' }\n format.json { render :json => @lunchplan, :status => :created, :location => @lunchplan }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @lunchplan.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @skill_set = SkillSet.new(params[:skill_set])\n\n respond_to do |format|\n if @skill_set.save\n format.html { redirect_to @skill_set, notice: 'Skill set was successfully created.' }\n format.json { render json: @skill_set, status: :created, location: @skill_set }\n else\n format.html { render action: \"new\" }\n format.json { render json: @skill_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @taken_step = TakenStep.new(taken_step_params)\n\n respond_to do |format|\n if @taken_step.save\n format.html { redirect_to @taken_step, notice: 'Steps Taken was successfully created.' }\n format.json { render :show, status: :created, location: @taken_step }\n else\n format.html { render :new }\n format.json { render json: @taken_step.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @moresmallmobsquad = Moresmallmobsquad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @moresmallmobsquad }\n end\n end", "def create\n p'*'*800\n p params\n\n @trainer = Trainer.new(trainer_params)\n\n p @trainer\n\n if @trainer.save\n render json: @trainer, status: :created, location: @trainer\n else\n render json: @trainer.errors, status: :unprocessable_entity\n end\n end", "def create\n @weekly_expectation = WeeklyExpectation.new(params[:weekly_expectation])\n\n respond_to do |format|\n if @weekly_expectation.save\n format.html { redirect_to @weekly_expectation, notice: 'Weekly expectation was successfully created.' }\n format.json { render json: @weekly_expectation, status: :created, location: @weekly_expectation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @weekly_expectation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @gym_rat = GymRat.new(gym_rat_params)\n\n respond_to do |format|\n if @gym_rat.save\n format.html { redirect_to @gym_rat, notice: \"Gym rat was successfully created.\" }\n format.json { render :show, status: :created, location: @gym_rat }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @gym_rat.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @mohr = Mohr.new(mohr_params)\n\n respond_to do |format|\n if @mohr.save\n format.html { redirect_to @mohr, notice: 'Mohr was successfully created.' }\n format.json { render :show, status: :created, location: @mohr }\n else\n format.html { render :new }\n format.json { render json: @mohr.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tune = Tune.new(parse_tune)\n\n respond_to do |format|\n if @tune.save\n format.html { redirect_to @tune, notice: 'Tune was successfully created.' }\n format.json { render action: 'show', status: :created, location: @tune }\n else\n format.html { render action: 'new' }\n format.json { render json: @tune.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @skillset = Skillset.new(skillset_params)\n\n respond_to do |format|\n if @skillset.save\n format.html { redirect_to @skillset, notice: 'Skillset was successfully created.' }\n format.json { render :show, status: :created, location: @skillset }\n else\n format.html { render :new }\n format.json { render json: @skillset.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @questionnaire = @participant.build_questionnaire(params[:questionnaire])\n @questionnaire.step = 1\n \n respond_to do |format|\n if @questionnaire.save\n format.html { redirect_to new_questionnaire_path }\n # format.json { render json: @questionnaire, status: :created, location: @questionnaire }\n else\n format.html { render \"questionnaires/steps/step0\" }\n # format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @trip = Trip.new(trip_params)\n authorize @trip\n @trip.submitter = current_account.accountable\n\n\n @trip.estimated_expenses.each do |exp|\n exp.requests.each do |req|\n req.amount_from_total = req.percentrequested * exp.total\n req.destination = @trip.destination\n req.expense_type = 'estimated'\n end\n end\n\n respond_to do |format|\n if @trip.save\n format.html { redirect_to home_index_path, notice: 'Trip was successfully created.' }\n format.json { render :show, status: :created, location: @trip }\n else\n format.html { render :new }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @backend_tutorial_stat = Backend::TutorialStat.new(params[:backend_tutorial_stat])\n\n respond_to do |format|\n if @backend_tutorial_stat.save\n Backend::TutorialStat.update_all_cohorts\n Backend::Stat.update_all_cohorts\n \n format.html { redirect_to @backend_tutorial_stat, notice: 'Tutorial stat was successfully created.' }\n format.json { render json: @backend_tutorial_stat, status: :created, location: @backend_tutorial_stat }\n else\n format.html { render action: \"new\" }\n format.json { render json: @backend_tutorial_stat.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @timetable = Timetable.new(timetable_params)\n @timetable.save\n respond_with [@timetable.lesson,@timetable]\n end", "def index\n @assertions = Assertion.all.sample(10)\n\n respond_to do |format|\n format.html\n format.json { render json: @assertions }\n end\n end", "def create\n @tap = Tap.new\n\n respond_to do |format|\n if @tap.save\n format.html { redirect_to taps_path, notice: 'Tap was successfully created.' }\n format.json { render action: 'show', status: :created, location: @tap }\n else\n format.json { render json: @tap.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_twit(twit)\n RestClient.post configuration.base_url + '/twits',\n { twit: twit }.to_json,\n content_type: :json,\n accept: :json\n end", "def create\n @tally = Tally.new(tally_params)\n respond_to do |format|\n if @tally.save\n format.html { redirect_to @tally, notice: 'Tally was successfully created.' }\n format.json { render :show, status: :created, location: @tally }\n else\n format.html { render :new }\n format.json { render json: @tally.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @trustees_minute = TrusteesMinute.new(trustees_minute_params)\n\n respond_to do |format|\n if @trustees_minute.save\n format.html { redirect_to @trustees_minute, notice: 'Trustees minute was successfully created.' }\n format.json { render action: 'show', status: :created, location: @trustees_minute }\n else\n format.html { render action: 'new' }\n format.json { render json: @trustees_minute.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @mosttinymobtrail = Mosttinymobtrail.new(params[:mosttinymobtrail])\n\n respond_to do |format|\n if @mosttinymobtrail.save\n format.html { redirect_to @mosttinymobtrail, notice: 'Mosttinymobtrail was successfully created.' }\n format.json { render json: @mosttinymobtrail, status: :created, location: @mosttinymobtrail }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mosttinymobtrail.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @skillset = Skillset.new(skillset_params)\n\n respond_to do |format|\n if @skillset.save\n format.html { redirect_to @skillset, notice: 'Skillset was successfully created.' }\n format.json { render action: 'show', status: :created, location: @skillset }\n else\n format.html { render action: 'new' }\n format.json { render json: @skillset.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_trial_model\n @trial_model = TrialModel.find(params[:id])\n end", "def create\n @mrj = Mrj.new(params[:mrj])\n\n respond_to do |format|\n if @mrj.save\n format.html { redirect_to @mrj, notice: 'Mrj was successfully created.' }\n format.json { render json: @mrj, status: :created, location: @mrj }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mrj.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if @test.done.blank?\n redirect_to root_path, warning: \"This test have not finished yet\"\n return\n end\n params[:submission] = {}\n params[:submission][:user_id] = current_user.id\n @submission = @test.submissions.create(submission_params)\n respond_to do |format|\n if @submission.save\n @test.questions.each do |question|\n question.answers.each do |answer|\n answer.answers_of_questions.create({choice: false, question_id: question.id, submission_id: @submission.id})\n end\n end\n format.html { redirect_to edit_test_submission_path(@test, @submission) }\n else\n format.html { render :new }\n end\n end\n end", "def create\n @requisition = Requisition.new(requisition_params)\n respond_to do |format|\n if @requisition.save\n # Send to the Business Insight Model\n RestClient::Resource.new(APP_CONFIG[:insight_url], :verify_ssl => false, :user => APP_CONFIG[:insight_username], :password => APP_CONFIG[:insight_password]).post({\n \"modelId\" => \"Resupply_Ky06ggwO\",\n \"measures\" => [{\n \"name\" => \"TotalCost\",\n \"value\" => @requisition.amount\n }],\n \"identifierValue\" => @requisition.id,\n \"correlationValue\" => @requisition.id,\n \"eventTime\" => Time.now.strftime('%Y-%m-%dT%H:%M:%S'),\n \"milestoneId\" => \"RequsitionRaised\",\n \"dimensions\" => [ {\n \"name\" => \"Location\",\n \"value\" => @requisition.loc\n } ]\n }.to_json, :content_type=>'application/json')\n format.html { redirect_to requisitions_url, notice: 'Requisition was successfully created.' }\n format.json { render :show, status: :created, loc: @requisition }\n else\n format.html { render :new }\n format.json { render json: @requisition.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n @survey = Survey.new(json)\n respond_to do |format|\n if @survey.save\n format.html { redirect_to @survey, notice: 'Survey was successfully created.' }\n format.json { render json: @survey, status: :created, location: @survey }\n else\n format.html { render action: \"new\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @httparty_test = HttpartyTest.new(httparty_test_params)\n\n respond_to do |format|\n if @httparty_test.save\n format.html { redirect_to @httparty_test, notice: 'Httparty test was successfully created.' }\n format.json { render :show, status: :created, location: @httparty_test }\n else\n format.html { render :new }\n format.json { render json: @httparty_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test = Test.create!(test_params)\n\n render json: @test\n end" ]
[ "0.6589716", "0.6442382", "0.643282", "0.64206207", "0.63953453", "0.6309926", "0.6182574", "0.60563034", "0.6003", "0.5991035", "0.5976615", "0.5943033", "0.5859429", "0.5814396", "0.5762834", "0.5760689", "0.5749525", "0.57071453", "0.56892467", "0.5636526", "0.55937165", "0.55703104", "0.5541921", "0.5527029", "0.55040747", "0.5482478", "0.54468876", "0.54457825", "0.544528", "0.5435772", "0.5432336", "0.5404395", "0.5403597", "0.53904134", "0.5378504", "0.53728294", "0.53451735", "0.5327953", "0.5324032", "0.53191906", "0.5296579", "0.52962905", "0.52822316", "0.5275897", "0.5271153", "0.52694905", "0.52418894", "0.52394235", "0.52377605", "0.52369785", "0.52343225", "0.522023", "0.5217412", "0.5193258", "0.5186472", "0.5186321", "0.5179871", "0.5179855", "0.51782054", "0.5157201", "0.51497155", "0.5148371", "0.5146836", "0.5143442", "0.51360345", "0.51337206", "0.5126717", "0.5121252", "0.5119623", "0.51156116", "0.510204", "0.5097901", "0.50919706", "0.50838697", "0.5069237", "0.50677687", "0.5067166", "0.50643736", "0.5063938", "0.50620365", "0.5061017", "0.50588894", "0.5055642", "0.5050092", "0.50497127", "0.50478804", "0.5047618", "0.5043641", "0.5036604", "0.5032525", "0.5030557", "0.50271815", "0.50265676", "0.502616", "0.50229865", "0.50188166", "0.5016061", "0.50138503", "0.5003989", "0.49998507" ]
0.76854515
0
PUT /moresmalltrials/1 PUT /moresmalltrials/1.json
def update @moresmalltrial = Moresmalltrial.find(params[:id]) respond_to do |format| if @moresmalltrial.update_attributes(params[:moresmalltrial]) format.html { redirect_to @moresmalltrial, notice: 'Moresmalltrial was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @moresmalltrial.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @moresmalltrial = Moresmalltrial.new(params[:moresmalltrial])\n\n respond_to do |format|\n if @moresmalltrial.save\n format.html { redirect_to @moresmalltrial, notice: 'Moresmalltrial was successfully created.' }\n format.json { render json: @moresmalltrial, status: :created, location: @moresmalltrial }\n else\n format.html { render action: \"new\" }\n format.json { render json: @moresmalltrial.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @mosttinytrial = Mosttinytrial.find(params[:id])\n\n respond_to do |format|\n if @mosttinytrial.update_attributes(params[:mosttinytrial])\n format.html { redirect_to @mosttinytrial, notice: 'Mosttinytrial was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mosttinytrial.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @trial_model.update(trial_model_params)\n format.html { redirect_to @trial_model, notice: 'Trial model was successfully updated.' }\n format.json { render :show, status: :ok, location: @trial_model }\n else\n format.html { render :edit }\n format.json { render json: @trial_model.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @my_time_trial = MyTimeTrial.find(params[:id])\n\n respond_to do |format|\n if @my_time_trial.update_attributes(params[:my_time_trial])\n format.html { redirect_to @my_time_trial, :notice => 'My time trial was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @my_time_trial.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n p = trial_params.clone\n if p[\"question_ids\"].nil?\n p[\"question_ids\"] = []\n end\n\n respond_to do |format|\n if @trial.update(p)\n format.html { redirect_to @trial, notice: 'Trial was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @trial.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @time_trial.update(time_trial_params)\n format.html { redirect_to @time_trial, notice: 'Time trial was successfully updated.' }\n format.json { render :show, status: :ok, location: @time_trial }\n else\n format.html { render :edit }\n format.json { render json: @time_trial.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @medium_trial = MediumTrial.find(params[:id])\n\n respond_to do |format|\n if @medium_trial.update_attributes(params[:medium_trial])\n format.html { redirect_to @medium_trial, notice: 'Medium trial was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @medium_trial.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @moresmalltrial = Moresmalltrial.find(params[:id])\n @moresmalltrial.destroy\n\n respond_to do |format|\n format.html { redirect_to moresmalltrials_url }\n format.json { head :no_content }\n end\n end", "def update\n @testmonial = Testmonial.find(params[:id])\n\n if @testmonial.update(testmonial_params)\n head :no_content\n else\n render json: @testmonial.errors, status: :unprocessable_entity\n end\n end", "def update\n @trial = Trial.find(params[:id])\n\n respond_to do |format|\n if @trial.update_attributes(params[:trial])\n flash[:notice] = 'Trial was successfully updated.'\n format.html { redirect_to(@trial) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @trial.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_trial\n @trial = Trial.find(params[:id])\n end", "def show\n @moresmalltrial = Moresmalltrial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @moresmalltrial }\n end\n end", "def update\n respond_to do |format|\n if @associated_trial.update(associated_trial_params)\n format.html { redirect_to @associated_trial, notice: 'Associated trial was successfully updated.' }\n format.json { render :show, status: :ok, location: @associated_trial }\n else\n format.html { render :edit }\n format.json { render json: @associated_trial.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_trial\n @trial = Trial.find(params[:id])\n end", "def new\n @moresmalltrial = Moresmalltrial.new\n max_id = Moresmalltrial.maximum(:id)\n max_id = 1 if max_id.nil?\n next_id = max_id + 1\n @moresmallmaps = Moresmallmap.where('start_trial_id <= ?', next_id).where('end_trial_id >= ?', next_id)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @moresmalltrial }\n end\n end", "def update\n @moresmallmobsquad = Moresmallmobsquad.find(params[:id])\n\n respond_to do |format|\n if @moresmallmobsquad.update_attributes(params[:moresmallmobsquad])\n format.html { redirect_to @moresmallmobsquad, notice: 'Moresmallmobsquad was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @moresmallmobsquad.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_time_trial\n @time_trial = TimeTrial.find(params[:id])\n end", "def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", {\"passed\" => success}.to_json, :content_type => :json\nend", "def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", { 'passed' => success }.to_json, :content_type => :json\nend", "def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", { 'passed' => success }.to_json, :content_type => :json\nend", "def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", { 'passed' => success }.to_json, :content_type => :json\nend", "def update\n @skill = Skill.find(params[:id])\n\n if @skill.update(skill_params)\n head :no_content\n else\n render json: @skill.errors, status: :unprocessable_entity\n end\n end", "def update\n @mall = Mall.find(params[:id])\n\n respond_to do |format|\n if @mall.update_attributes(params[:mall])\n format.html { redirect_to @mall, notice: 'Mall was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mall.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @mobile = Story.find(params[:id])\n @mobile.update(mobile_params)\n\n redirect_to mobile_path(@mobile)\n end", "def update\n respond_to do |format|\n if @tap.update(tap_params)\n format.html { redirect_to taps_path, notice: 'Tap was successfully updated.' }\n format.json { head :no_content }\n else\n format.json { render json: @tap.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_trial_model\n @trial_model = TrialModel.find(params[:id])\n end", "def update\n respond_to do |format|\n if @trial_document.update(trial_document_params)\n format.html { redirect_to @trial_document, notice: 'Trial document was successfully updated.' }\n format.json { render :show, status: :ok, location: @trial_document }\n else\n format.html { render :edit }\n format.json { render json: @trial_document.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @admin_skill = Admin::Skill.find(params[:id])\n\n if @admin_skill.update(admin_skill_params)\n head :no_content\n else\n render json: @admin_skill.errors, status: :unprocessable_entity\n end\n end", "def update\n @mostsmallmission = Mostsmallmission.find(params[:id])\n\n respond_to do |format|\n if @mostsmallmission.update_attributes(params[:mostsmallmission])\n format.html { redirect_to @mostsmallmission, notice: 'Mostsmallmission was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mostsmallmission.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @trial_site.update(trial_site_params)\n format.html { redirect_to @trial_site, notice: 'Trial site was successfully updated.' }\n format.json { render :show, status: :ok, location: @trial_site }\n else\n format.html { render :edit }\n format.json { render json: @trial_site.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @timer = Timer.find(params[:id])\n\n if @timer.update(timer_params)\n head :no_content\n else\n render json: @timer.errors, status: :unprocessable_entity\n end\n end", "def update\n @mugshot = Mugshot.find(params[:id])\n\n respond_to do |format|\n if @mugshot.update_attributes(params[:mugshot])\n format.html { redirect_to @mugshot, notice: 'Mugshot was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mugshot.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tune = Tune.find(params[:id])\n\n respond_to do |format|\n if @tune.update_attributes(params[:tune])\n format.html { redirect_to @tune, notice: 'Tune was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tune.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @trials = args[:trials] if args.key?(:trials)\n end", "def update\n url = 'https://casa-core.herokuapp.com/api/units/' + params[:id]\n query = {\n 'name' => params[:name]\n }\n response = HTTParty.put(url, :query => query, :headers => { \"Authorization\" => AUTH, \"Host\" => HOST})\n\n if response.code == 200\n redirect_to unit_path(params[:id]), notice: 'Unit was successfully updated.'\n else\n redirect_to unit_path(params[:id]), notice: 'Sheesh! Minor hiccup...run that again!'\n end\n end", "def update\n @test_plan = TestPlan.find(params[:id])\n\n respond_to do |format|\n if @test_plan.update_attributes(params[:test_plan])\n format.html { redirect_to @test_plan, notice: 'Test plan was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n mk = connect_mikrotik\n respond_to do |format|\n\n \n @plan_old = @plan.as_json # Guarda os parâmetros antigos do registro para retornar caso não consiga mudar no mikrotik\n \n id = mk.get_reply(\"/ppp/profile/print\", \"?name=#{@plan.profile_name}\")[0][\".id\"]\n puts \"Id do registro a ser mudado\"\n puts id\n\n if @plan.update(plan_params)\n \n result = mk.get_reply(\"/ppp/profile/set\",\n \"=name=#{plan_params[\"profile_name\"]}\",\n \"=rate-limit=#{plan_params[\"rate_limit\"]}\",\n \"=.id=#{id}\")[0][\"message\"]\n\n @notice = 'Plan was successfully updated.'\n if result != nil\n @notice = \"It wasn't possible to update mikrotik\"\n @plan.update(@plan_old)\n end\n\n format.html { redirect_to @plan, notice: @notice }\n format.json { render :show, status: :ok, location: @plan }\n else\n format.html { render :edit }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @custom_workout = @user.custom_workouts.find(params[:id])\n\n respond_to do |format|\n if @custom_workout.update_attributes(params[:custom_workout])\n format.html { redirect_to my_fit_wit_fit_wit_workout_progress_path(month: params[:month]), notice: 'Custom workout was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render controller: \"my_fit_wit\", action: \"show_custom_workout\" }\n format.json { render json: @custom_workout.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @monthly_interest = MonthlyInterest.find(params[:id])\n\n respond_to do |format|\n if @monthly_interest.update_attributes(params[:monthly_interest])\n format.html { redirect_to @monthly_interest, notice: 'Monthly interest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @monthly_interest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @smallsurvey.update(smallsurvey_params)\n format.html { redirect_to @smallsurvey, notice: 'Smallsurvey was successfully updated.' }\n format.json { render :show, status: :ok, location: @smallsurvey }\n else\n format.html { render :edit }\n format.json { render json: @smallsurvey.errors, status: :unprocessable_entity }\n end\n end\n end", "def update #updates the settings of a trial, like its start and end dates and its goals\n @trial = Trial.find(params[:id])\n logger.info(\"updating trial:\")\n logger.info(@trial)\n\n session[:current_tab] = 'settings'\n params[:trial][:startDate] = Date.strptime(params[:trial][:startDate], '%m/%d/%Y')\n params[:trial][:endDate] = Date.strptime(params[:trial][:endDate], '%m/%d/%Y')\n\n respond_to do |format|\n if @trial.update_attributes(params[:trial])\n format.html { redirect_to :controller => 'home', :action => 'index'}\n format.json { head :no_content }\n else\n flash[:nameerror] = 'You must have a Trial Name!'\n format.html {redirect_to :back} #{ render action: \"edit\" }\n format.json { render json: @trial.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @mostsmallskill = Mostsmallskill.find(params[:id])\n\n respond_to do |format|\n if @mostsmallskill.update_attributes(params[:mostsmallskill])\n format.html { redirect_to @mostsmallskill, notice: 'Mostsmallskill was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mostsmallskill.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @survey = Survey.find(params[:id])\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n\n respond_to do |format|\n if @survey.update_attributes(json)\n format.html { redirect_to @survey, notice: 'Survey was successfully updated.' }\n format.json { render json: @survey }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @my_time_trial = MyTimeTrial.new(params[:my_time_trial])\n\n respond_to do |format|\n if @my_time_trial.save\n format.html { redirect_to @my_time_trial, :notice => 'My time trial was successfully created.' }\n format.json { render :json => @my_time_trial, :status => :created, :location => @my_time_trial }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @my_time_trial.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @plan_milestone = PlanMilestone.find(params[:id])\n\n respond_to do |format|\n if @plan_milestone.update_attributes(params[:plan_milestone])\n format.html { redirect_to @plan_milestone, notice: 'Plan milestone was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @plan_milestone.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @mohr.update(mohr_params)\n format.html { redirect_to @mohr, notice: 'Mohr was successfully updated.' }\n format.json { render :show, status: :ok, location: @mohr }\n else\n format.html { render :edit }\n format.json { render json: @mohr.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n params.require(%i[id units])\n retrieve_and_validate_put.update!(units: params[:units])\n head :no_content\n end", "def update\n @skill_set = SkillSet.find(params[:id])\n\n respond_to do |format|\n if @skill_set.update_attributes(params[:skill_set])\n format.html { redirect_to @skill_set, notice: 'Skill set was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @skill_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @mrv.update(mrv_params)\n format.html { redirect_to @mrv, notice: 'Mrv was successfully updated.' }\n format.json { render :show, status: :ok, location: @mrv }\n else\n format.html { render :edit }\n format.json { render json: @mrv.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @trip\n\n\n @trip.estimated_expenses.each do |exp|\n exp.requests.each do |req|\n req.amount_from_total = req.percentrequested * exp.total\n req.destination = @trip.destination\n req.expense_type = 'estimated'\n end\n end\n\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip }\n else\n format.html { render :edit }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @milestone = Milestone.find(params[:id])\n @milestone.update_attributes(params[:milestone])\n respond_to do |format|\n if @milestone.save\n format.html { redirect_to goals_path, notice: 'Milestone was successfully created.' }\n format.json { respond_with_bip(@milestone) }\n else\n format.html { render action: \"new\" }\n format.json { respond_with_bip(@milestone) }\n end\n end\n end", "def set_trial_document\n @trial_document = TrialDocument.find(params[:id])\n end", "def put(path, data = {})\n # Allow format override\n format = data.delete(:format) || @format\n # Clear cache\n expire_matching \"#{parent_path(path)}.*\"\n # Extract return unit params\n query_params = {}\n query_params[:returnUnit] = data.delete(:returnUnit) if data[:returnUnit]\n query_params[:returnPerUnit] = data.delete(:returnPerUnit) if data[:returnPerUnit]\n # Create PUT request\n put_params = {\n :verbose => DEBUG,\n :method => \"put\",\n :body => form_encode(data)\n }\n put_params[:params] = query_params unless query_params.empty?\n put = Typhoeus::Request.new(\"#{protocol}#{@server}#{path}\", put_params)\n # Send request\n do_request(put, format)\n end", "def new\n @trial = Trial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trial }\n end\n end", "def update\n @mrj = Mrj.find(params[:id])\n\n respond_to do |format|\n if @mrj.update_attributes(params[:mrj])\n format.html { redirect_to @mrj, notice: 'Mrj was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mrj.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test_metum.update(test_metum_params)\n format.html { redirect_to @test_metum, notice: 'Test metum was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @test_metum.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @karma = Karma.find(params[:id])\n\n respond_to do |format|\n if @karma.update_attributes(params[:karma])\n flash[:notice] = 'Karma was successfully updated.'\n format.html { redirect_to(@karma) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @karma.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\n update_args = {}\n if params[:reupload].blank?\n properties_array = Array.new\n property_names = params[:test_plan]['property_name']\n property_values = params[:test_plan]['property_value']\n\n count = 0\n property_names.each_with_index.each do |name, index|\n if(!name.strip.empty? and !property_values[index].strip.empty?)\n properties_array[count] = {\"name\" => name.strip, \"value\" => property_values[index].strip}\n count += 1\n end\n end\n\n update_args[:properties] = properties_array.to_json\n else\n update_args = params.require(:test_plan).permit(:jmx)\n end\n\n respond_to do |format|\n if @test_plan.update(update_args)\n format.html { redirect_to project_test_plans_path(@project), flash: {success: 'Test plan was successfully updated.'} }\n format.json { render :show, status: :ok, location: @test_plan }\n else\n format.html { render :edit }\n format.json { render json: @test_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(attrs, user = @@default_user)\n attrs = { id: @id, project_token: @project_token }.merge(attrs)\n @attributes = send_request(\"test_plans/#{attrs[:id]}\", :put) do |req|\n req.body = {\n test_plan: attrs.except(:project_token, :id),\n token: attrs[:project_token],\n auth_token: user.auth_token\n }\n end\n end", "def update\n if @measure.update(measure_params)\n head :no_content\n else\n render json: @measure.errors, status: :unprocessable_entity\n end\n end", "def measurements_id_put(id, opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: MeasurementApi#measurements_id_put ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling measurements_id_put\" if id.nil?\n \n # resource path\n path = \"/measurements/{id}\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\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 = @api_client.object_to_http_body(opts[:'body'])\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:PUT, 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 => 'inline_response_200_2')\n if Configuration.debugging\n Configuration.logger.debug \"API called: MeasurementApi#measurements_id_put. Result: #{result.inspect}\"\n end\n return result\n end", "def update\n respond_to do |format|\n if @test_stall.update(test_stall_params)\n format.html { redirect_to @test_stall, notice: 'Test stall was successfully updated.' }\n format.json { render :show, status: :ok, location: @test_stall }\n else\n format.html { render :edit }\n format.json { render json: @test_stall.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @trial = Trial.new(trial_params)\n\n respond_to do |format|\n if @trial.save\n format.html { redirect_to @trial, notice: 'Trial was successfully created.' }\n format.json { render action: 'show', status: :created, location: @trial }\n else\n format.html { render action: 'new' }\n format.json { render json: @trial.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @shot = Shot.find(params[:id])\n\n if @shot.update(shot_params)\n head :no_content\n else\n render json: @shot.errors, status: :unprocessable_entity\n end\n end", "def update\n goal = Goal.find params[:id]\n if goal.update(goal_params)\n render json: goal, status: 200\n else\n render json: goal.errors.full_messages, status: 422\n end\n end", "def update\n @timer = Timer.find(params[:id])\n\n respond_to do |format|\n if @timer.update_attributes(params[:timer])\n format.html { redirect_to @timer, notice: 'Timer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @timer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @shop_claim = ShopClaim.find(params[:id])\n\n if @shop_claim.update(shop_claim_params)\n head :no_content\n else\n render json: @shop_claim.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @step_m.update(step_m_params)\n format.html { redirect_to @step_m, notice: 'Step m was successfully updated.' }\n format.json { render :show, status: :ok, location: @step_m }\n else\n format.html { render :edit }\n format.json { render json: @step_m.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @my_time_trial = MyTimeTrial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @my_time_trial }\n end\n end", "def test_update_successful\n data = {\n firstname: \"Anh\",\n lastname: \"Hoang\",\n avatar: \"avatar.png\",\n address: \"111D Ly Chinh Thang\",\n city: \"Ho Chi Minh\",\n email: \"anh@gmallds.sl\",\n mobile: \"0309433343545\",\n gender: 1,\n birthday: \"1991/10/10\"\n }\n\n user_id = 28\n expected = 200\n uri = URI.parse('http://localhost:3000/v1/users/'+user_id.to_s)\n\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Put.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end", "def update\n authorize! :update, @theorem\n if @theorem.update(theorem_params)\n render json: @theorem, status: :ok, location: @theorem\n else\n render json: @theorem.errors, status: :unprocessable_entity\n end\n end", "def update\n @momsg = Momsg.find(params[:id])\n\n respond_to do |format|\n if @momsg.update_attributes(params[:momsg])\n format.html { redirect_to @momsg, notice: 'Momsg was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @momsg.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @special_skill.update(special_skill_params)\n format.html { redirect_to @special_skill, notice: 'Special skill was successfully updated.' }\n format.json { render :show, status: :ok, location: @special_skill }\n else\n format.html { render :edit }\n format.json { render json: @special_skill.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_update_unsuccessful\n data = {\n firstname: \"\",\n lastname: \"Hoang\",\n avatar: \"avatar.png\",\n address: \"111D Ly Chinh Thang\",\n city: \"Ho Chi Minh\",\n email: \"anh@gmallds.sl\",\n mobile: \"0309433343545\",\n gender: 1,\n birthday: \"1991/10/10\"\n }\n\n user_id = 28\n expected = 1002\n uri = URI.parse('http://localhost:3000/v1/users/'+user_id.to_s)\n\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Put.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end", "def update\n @my_ministry = MyMinistry.find(params[:id])\n\n respond_to do |format|\n if @my_ministry.update_attributes(params[:my_ministry])\n format.html { redirect_to @my_ministry, notice: 'My ministry was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @my_ministry.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @matthew.update(matthew_params)\n format.html { redirect_to @matthew, notice: 'Matthew was successfully updated.' }\n format.json { render :show, status: :ok, location: @matthew }\n else\n format.html { render :edit }\n format.json { render json: @matthew.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @microtask = Microtask.find(params[:id])\n\n respond_to do |format|\n if @microtask.update_attributes(params[:microtask])\n format.html { redirect_to @microtask, notice: 'Microtask was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @microtask.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @optimal_trials = args[:optimal_trials] if args.key?(:optimal_trials)\n end", "def update\n respond_to do |format|\n if @tune.update(tune_params)\n format.html { redirect_to @tune, notice: 'Tune was successfully updated.' }\n format.json { head :no_content } \n else\n format.html { render action: 'edit' }\n format.json { render json: @tune.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @shot = Shot.find(params[:id])\n @shot.update_attributes(shot_params)\n respond_with @shot\n end", "def update_tenant_maintenance_window(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/maintenance/{tenantId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update\n if @physician.update(survey_params)\n head :no_content\n else\n render json: @physician.errors, status: :unprocessable_entity\n end\n end", "def update\n @mill = Mill.find(params[:id])\n\n respond_to do |format|\n if @mill.update_attributes(params[:mill])\n format.html { redirect_to @mill, notice: 'Mill was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mill.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @trainer = Trainer.find(params[:id])\n\n if @trainer.update(trainer_params)\n head :no_content\n else\n render json: @trainer.errors, status: :unprocessable_entity\n end\n end", "def create\n @trial_model = TrialModel.new(trial_model_params)\n\n respond_to do |format|\n if @trial_model.save\n format.html { redirect_to @trial_model, notice: 'Trial model was successfully created.' }\n format.json { render :show, status: :created, location: @trial_model }\n else\n format.html { render :new }\n format.json { render json: @trial_model.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @plan = Plan.find(params[:id])\n\n if @plan.update(params[:plan])\n head :no_content\n else\n render json: @plan.errors, status: :unprocessable_entity\n end\n end", "def update\n @team = Team.find(params[:id])\n\n if @team.update_attributes(params[:team])\n head :no_content\n else\n render json: @team.errors, status: :unprocessable_entity\n end\n end", "def update\n @mall_type = MallType.find(params[:id])\n\n respond_to do |format|\n if @mall_type.update_attributes(params[:mall_type])\n format.html { redirect_to @mall_type, notice: 'Mall type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mall_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end", "def update\n respond_to do |format|\n if @male_shot_put_head.update(male_shot_put_head_params)\n format.html { redirect_to @male_shot_put_head, notice: 'Male shot put head was successfully updated.' }\n format.json { render :show, status: :ok, location: @male_shot_put_head }\n else\n format.html { render :edit }\n format.json { render json: @male_shot_put_head.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @skillset.update(skillset_params)\n format.html { redirect_to @skillset, notice: 'Skillset was successfully updated.' }\n format.json { render :show, status: :ok, location: @skillset }\n else\n format.html { render :edit }\n format.json { render json: @skillset.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_item_value_twenty_four\n response_search = Partay.get('http://shoponline.tescolotus.com/api/v1/search/products?query=Sugar&page=1&sortBy=Relevance', :headers => {'Content-Type' => 'application/json', 'language' => 'en-gb', 'region' => 'TH', 'userId' => access_token})\n puts search_result=JSON(response_search['productItems'][0])\n puts productid =JSON(search_result)[\"product\"][\"id\"]\n items_json_responses = {'items' => [{'id'=>'6071448594','oldValue'=>0.0,'oldUnitChoice'=>'pcs','newUnitChoice'=>'pcs','newValue'=>24.0}]}.to_json\n puts items_json_responses\n response = Partay.put('http://shoponline.tescolotus.com/api/v1/trolley/items/', :headers => {'Content-Type' => 'application/json', 'language' => 'en-GB', 'region' => 'TH', 'userId' => access_token}, :body => items_json_responses)\n puts response\n end", "def update\n respond_to do |format|\n if @trustees_minute.update(trustees_minute_params)\n format.html { redirect_to @trustees_minute, notice: 'Trustees minute was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @trustees_minute.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @mattress = Mattress.find(params[:id])\n\n respond_to do |format|\n if @mattress.update_attributes(params[:mattress])\n format.html { redirect_to [:admin, @mattress], notice: 'Mattress was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mattress.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @testimonio.update(testimonio_params)\n format.html { redirect_to @testimonio, notice: 'Testimonio was successfully updated.' }\n format.json { render :show, status: :ok, location: @testimonio }\n else\n format.html { render :edit }\n format.json { render json: @testimonio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @sixmonth_customer = SixmonthCustomer.find(params[:id])\n\n respond_to do |format|\n if @sixmonth_customer.update_attributes(params[:sixmonth_customer])\n format.html { redirect_to action: :index }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sixmonth_customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :update_almacen,Sigesp::Solicitud\n if @sigesp_solicitud.update(sigesp_solicitud_alamcen_params)\n return render json: { url: sigesp_solicitudsalmacen_path(@sigesp_solicitud)} \n else\n return render json:@sigesp_solicitud.errors ,status: :unprocessable_entity\n end \n end", "def update\n @metric = Metric.find(params[:id])\n\n if @metric.update(params[:metric])\n head :no_content\n else\n render json: @metric.errors, status: :unprocessable_entity\n end\n end", "def update\n @survey_choice = Survey::Choice.find(params[:id])\n\n respond_to do |format|\n if @survey_choice.update_attributes(params[:survey_choice])\n format.html { redirect_to @survey_choice, notice: 'Choice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey_choice.errors, status: :unprocessable_entity }\n5 end\n end\n end" ]
[ "0.66722953", "0.6413313", "0.64067096", "0.63649887", "0.62892205", "0.6211682", "0.61859596", "0.60644203", "0.6031823", "0.6013322", "0.60030776", "0.6000524", "0.5951241", "0.5942575", "0.59059215", "0.580721", "0.58007234", "0.5777142", "0.5735435", "0.5735435", "0.5735435", "0.5655821", "0.5652381", "0.56336963", "0.56104356", "0.5577524", "0.55760634", "0.55742335", "0.5571306", "0.5568504", "0.55535537", "0.5524725", "0.55188346", "0.55054504", "0.54836255", "0.54771", "0.5472462", "0.5471007", "0.5461318", "0.545967", "0.5454483", "0.544827", "0.5445166", "0.54429615", "0.5441825", "0.5441271", "0.54409003", "0.5440138", "0.5433418", "0.54316497", "0.54132164", "0.54123455", "0.5408094", "0.54046357", "0.53965336", "0.53931534", "0.5392723", "0.5392039", "0.5381664", "0.53777486", "0.5374139", "0.5373906", "0.5373035", "0.53696364", "0.5365416", "0.53595614", "0.53586715", "0.5355681", "0.5350429", "0.53472555", "0.5341149", "0.53370595", "0.5330764", "0.5327938", "0.53202134", "0.53157943", "0.53156406", "0.53150904", "0.5313392", "0.5309932", "0.53002644", "0.5300058", "0.5293595", "0.52922934", "0.52900046", "0.52892035", "0.5288691", "0.52880085", "0.52731884", "0.52708757", "0.52706045", "0.5270083", "0.5262591", "0.52612054", "0.5260649", "0.52593845", "0.52565217", "0.5255128", "0.5254724", "0.5250213" ]
0.75724864
0
DELETE /moresmalltrials/1 DELETE /moresmalltrials/1.json
def destroy @moresmalltrial = Moresmalltrial.find(params[:id]) @moresmalltrial.destroy respond_to do |format| format.html { redirect_to moresmalltrials_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @mosttinytrial = Mosttinytrial.find(params[:id])\n @mosttinytrial.destroy\n\n respond_to do |format|\n format.html { redirect_to mosttinytrials_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @trial.destroy\n respond_to do |format|\n format.html { redirect_to trials_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @my_time_trial = MyTimeTrial.find(params[:id])\n @my_time_trial.destroy\n\n respond_to do |format|\n format.html { redirect_to my_time_trials_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @medium_trial = MediumTrial.find(params[:id])\n @medium_trial.destroy\n\n respond_to do |format|\n format.html { redirect_to medium_trials_url }\n format.json { head :no_content }\n end\n end", "def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @trial = Trial.find(params[:id])\n @trial.destroy\n\n respond_to do |format|\n format.html { redirect_to(trials_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @trial = Trial.find(params[:id])\n @trial.destroy\n\n respond_to do |format|\n format.html { redirect_to(trials_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @time_trial.destroy\n respond_to do |format|\n format.html { redirect_to '/admin', notice: 'Time trial was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def destroy\n @trial_model.destroy\n respond_to do |format|\n format.html { redirect_to trial_models_url, notice: 'Trial model was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @associated_trial.destroy\n respond_to do |format|\n format.html { redirect_to associated_trials_url, notice: 'Associated trial was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end", "def destroy\n @treq = Treq.find(params[:id])\n @treq.destroy\n\n respond_to do |format|\n format.html { redirect_to treqs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_plan = TestPlan.find(params[:id])\n @test_plan.destroy\n\n respond_to do |format|\n format.html { redirect_to test_plans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mostsmallmission = Mostsmallmission.find(params[:id])\n @mostsmallmission.destroy\n\n respond_to do |format|\n format.html { redirect_to mostsmallmissions_url }\n format.json { head :no_content }\n end\n end", "def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end", "def destroy\n @trial = Trial.find(params[:id])\n @trial.users.delete(User.find session[:userID])\n logger.info(@trial.users)\n session[:current_trial] = nil\n respond_to do |format|\n format.html { redirect_to :controller => 'home', :action => 'index' }\n format.json { head :no_content }\n end\n end", "def destroy\n @testmonial.destroy\n\n head :no_content\n end", "def destroy\n @moretinymobtrail = Moretinymobtrail.find(params[:id])\n @moretinymobtrail.destroy\n\n respond_to do |format|\n format.html { redirect_to moretinymobtrails_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @moresmallmobsquad = Moresmallmobsquad.find(params[:id])\n @moresmallmobsquad.destroy\n\n respond_to do |format|\n format.html { redirect_to moresmallmobsquads_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @assert = Assert.find(params[:id])\n @assert.destroy\n\n respond_to do |format|\n format.html { redirect_to asserts_url }\n format.json { head :ok }\n end\n end", "def destroy\n @assert = Assert.find(params[:id])\n @assert.destroy\n\n respond_to do |format|\n format.html { redirect_to asserts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @trial_site.destroy\n respond_to do |format|\n format.html { redirect_to trial_sites_url, notice: 'Trial site was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @mall = Mall.find(params[:id])\n @mall.destroy\n\n respond_to do |format|\n format.html { redirect_to malls_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_stall.destroy\n respond_to do |format|\n format.html { redirect_to test_stalls_url, notice: 'Test stall was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def delete_demo(id)\n delete_record \"/demos/#{id}\"\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def destroy\n @smallsurvey.destroy\n respond_to do |format|\n format.html { redirect_to smallsurveys_url, notice: 'Smallsurvey was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @mosttinymobtrail = Mosttinymobtrail.find(params[:id])\n @mosttinymobtrail.destroy\n\n respond_to do |format|\n format.html { redirect_to mosttinymobtrails_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @metric_speedtest.destroy\n respond_to do |format|\n format.html { redirect_to metric_speedtests_url }\n format.json { head :no_content }\n end\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def destroy\n @weekly_expectation = WeeklyExpectation.find(params[:id])\n @weekly_expectation.destroy\n\n respond_to do |format|\n format.html { redirect_to weekly_expectations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise_plan = ExercisePlan.find(params[:id])\n @exercise_plan.destroy\n\n respond_to do |format|\n format.html { redirect_to exercise_plans_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def destroy\n @test_metum.destroy\n respond_to do |format|\n format.html { redirect_to test_meta_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @goldmeasure.destroy\n respond_to do |format|\n format.html { redirect_to goldmeasures_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @backend_tutorial_stat = Backend::TutorialStat.find(params[:id])\n @backend_tutorial_stat.destroy\n\n respond_to do |format|\n format.html { redirect_to backend_tutorial_stats_url }\n format.json { head :ok }\n end\n end", "def delete_and_give_me_a_json(additional_path, params = nil)\n if self.service_base_path != nil\n if params == nil\n params = Hash.new\n end\n params[:api_key] = self.access_token\n message = self.http_client.delete \"#{self.base_url}#{self.service_base_path}/#{additional_path}.json\", params\n trata_erro(message.content)\n end\n end", "def destroy\n @measure = Measure.find(params[:id])\n @measure.destroy\n\n respond_to do |format|\n format.html { redirect_to measures_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @trustees_minute.destroy\n respond_to do |format|\n format.html { redirect_to trustees_minutes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mob.destroy\n respond_to do |format|\n format.html { redirect_to mobs_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Alien.delete(params[\"id\"])\n end", "def destroy\n @testpat.destroy\n respond_to do |format|\n format.html { redirect_to testpats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n\t\t\t\n\t\t\t\tTestimony.find(params[:id]).destroy\n\n\t\t\t\trender json: nil,status: 200\n\t\t\t\n\t\t\tend", "def incident_delete(statuspage_id, incident_id)\n data = {}\n data['statuspage_id'] = statuspage_id\n data['incident_id'] = incident_id\n\n request :method => :post,\n :url => @url + 'incident/delete',\n :payload => data\n end", "def destroy\n @go_slim = GoSlim.find(params[:id])\n @go_slim.destroy\n\n respond_to do |format|\n format.html { redirect_to go_slims_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @momsg = Momsg.find(params[:id])\n @momsg.destroy\n\n respond_to do |format|\n format.html { redirect_to momsgs_url }\n format.json { head :ok }\n end\n end", "def destroy\n @alram_test.destroy\n respond_to do |format|\n format.html { redirect_to alram_tests_url, notice: 'Alram test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end", "def destroy\n @unidade_metrica = UnidadeMetrica.find(params[:id])\n @unidade_metrica.destroy\n\n respond_to do |format|\n format.html { redirect_to unidade_metricas_url }\n format.json { head :no_content }\n end\n end", "def delete\n request(:delete)\n end", "def destroy\n render_json_auto @survey.delete_filter(params[:id].to_i) and return\n end", "def delete(path)\n request(:delete, path)\n end", "def destroy\n @ai_contest = AiContest.find(params[:id])\n @ai_contest.destroy\n\n respond_to do |format|\n format.html { redirect_to ai_contests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @smoke_test = SmokeTest.find(params[:id])\n @smoke_test.destroy\n\n respond_to do |format|\n format.html { redirect_to(smoke_tests_url) }\n format.json { head :ok }\n format.xml { head :ok }\n end\n end", "def destroy\n @trial_document.destroy\n respond_to do |format|\n format.html { redirect_to trial_documents_url, notice: 'Trial document was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n url = 'https://casa-core.herokuapp.com/api/units/' + params[:id]\n response = HTTParty.delete(url, :headers => { \"Authorization\" => AUTH, \"Host\" => HOST})\n redirect_to units_url, notice: 'Unit was successfully deleted.'\n end", "def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end", "def destroy\n @tally.destroy\n respond_to do |format|\n format.html { redirect_to tallies_url, notice: 'Tally was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @expectation = Expectation.find(params[:id])\n @expectation.destroy\n\n respond_to do |format|\n format.html { redirect_to expectations_url }\n format.json { head :no_content }\n end\n end", "def delete(path)\n request 'DELETE', path\n end", "def destroy\n @server = Server.find(params[:id])\n checkaccountobject(\"servers\",@server)\n @server.send_delete\n respond_to do |format|\n format.html { redirect_to servers_url }\n format.json { head :ok }\n end\n end", "def destroy\n @goal = Goal.find(params[:id])\n @goal.destroy\n render json: @goal\n end", "def destroy\n @contestant = Contestant.find(params[:id])\n @contestant.destroy\n\n respond_to do |format|\n format.html { redirect_to contestants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @m1.destroy\n respond_to do |format|\n format.html { redirect_to m1s_url, notice: 'M1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @cpanel_mall.destroy\n respond_to do |format|\n format.html { redirect_to cpanel_malls_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @stall.destroy\n respond_to do |format|\n format.html { redirect_to stalls_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @testimonio.destroy\n respond_to do |format|\n format.html { redirect_to testimonios_url, notice: 'Testimonio was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @mill = Mill.find(params[:id])\n @mill.destroy\n\n respond_to do |format|\n format.html { redirect_to mills_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mission = Mission.find(params[:id])\n @mission.destroy\n\n respond_to do |format|\n format.html { redirect_to missions_url }\n format.json { head :ok }\n end\n end", "def destroy\n @test_run.destroy\n respond_to do |format|\n format.html { redirect_to test_runs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @plan.destroy\n\n head :no_content\n end", "def destroy\n @testing_.destroy\n respond_to do |format|\n format.html { redirect_to testing_s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test = LoadTest.find(params[:id])\n @test.destroy\n\n respond_to do |format|\n format.html { redirect_to load_tests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @moonwalk.destroy\n respond_to do |format|\n format.html { redirect_to moonwalks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_run = TestRun.find(params[:id])\n @test_run.destroy\n\n respond_to do |format|\n format.html { redirect_to test_runs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @timer = Timer.find(params[:id])\n @timer.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @aliquotum = Aliquotum.find(params[:id])\n @aliquotum.destroy\n\n respond_to do |format|\n format.html { redirect_to aliquota_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mystic.destroy\n respond_to do |format|\n format.html { redirect_to mystics_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @stage_drymass = StageDrymass.find(params[:id])\n @stage_drymass.destroy\n\n respond_to do |format|\n format.html { redirect_to stage_drymasses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mrj = Mrj.find(params[:id])\n @mrj.destroy\n\n respond_to do |format|\n format.html { redirect_to mrjs_url }\n format.json { head :ok }\n end\n end", "def destroy\n @mosttinymobsetup = Mosttinymobsetup.find(params[:id])\n @mosttinymobsetup.destroy\n\n respond_to do |format|\n format.html { redirect_to mosttinymobsetups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @talent = Talent.find(params[:id])\n @talent.destroy\n\n respond_to do |format|\n format.html { redirect_to talents_url }\n format.json { head :ok }\n end\n end", "def destroy\n contest = @data_set.contest\n @data_set.destroy\n respond_to do |format|\n format.html { redirect_to admin_contest_url(contest), notice: 'Data set was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @patient_sample = PatientSample.find(params[:id])\n @patient_sample.destroy\n\n respond_to do |format|\n format.html { redirect_to patient_samples_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @meal_time = MealTime.find(params[:id])\n @meal_time.destroy\n\n respond_to do |format|\n format.html { redirect_to meal_times_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @lunchplan = Lunchplan.find(params[:id])\n @lunchplan.destroy\n\n respond_to do |format|\n format.html { redirect_to lunchplans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @contest.destroy\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sampling.destroy\n respond_to do |format|\n format.html { redirect_to samplings_url, notice: 'Sampling was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @request = @skill.requests.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to myrequests_path }\n format.json { head :no_content }\n end\n end", "def deleteExecution(execution_id)\n uri = URI(RUNDECKSERVER + ':' + RUNDECKPORT + '/api/12/execution/' + execution_id)\n http = Net::HTTP.new(uri.host, uri.port)\n headers = {'Content-Type'=> 'application/jsonr','X-RunDeck-Auth-Token'=> API_KEY }\n r = http.delete(uri.path, headers) \n return r\nend", "def destroy\n @httparty_test.destroy\n respond_to do |format|\n format.html { redirect_to httparty_tests_url, notice: 'Httparty test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_suite = TestSuite.find(params[:id])\n @test_suite.destroy\n\n respond_to do |format|\n format.html { redirect_to test_suites_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.7178326", "0.7156257", "0.7130006", "0.70846915", "0.68739235", "0.68045586", "0.6801004", "0.6801004", "0.6749269", "0.67466396", "0.671006", "0.66621035", "0.6648582", "0.6600067", "0.6546773", "0.6546406", "0.6543899", "0.6535698", "0.65352637", "0.6507185", "0.65015906", "0.649907", "0.64923227", "0.6490234", "0.64793265", "0.6473825", "0.6456654", "0.64401126", "0.64278567", "0.64269805", "0.6422155", "0.6419781", "0.6402736", "0.6402736", "0.6402736", "0.6402736", "0.64014006", "0.63994294", "0.63821554", "0.6370418", "0.63659036", "0.63635045", "0.6357321", "0.6350831", "0.6348087", "0.634539", "0.63392705", "0.6329014", "0.632323", "0.6321715", "0.6321601", "0.63189954", "0.63180214", "0.63148075", "0.63148075", "0.6305219", "0.6296498", "0.6294746", "0.6288013", "0.62877", "0.62875986", "0.6286013", "0.62857544", "0.62819695", "0.6278023", "0.62764007", "0.6275958", "0.62758285", "0.62696743", "0.62635374", "0.6257311", "0.6256682", "0.6256584", "0.62532234", "0.62521017", "0.6249832", "0.6248155", "0.6244614", "0.6244196", "0.6242173", "0.6240996", "0.62406075", "0.6236448", "0.6234883", "0.6233918", "0.62329304", "0.6231257", "0.6230836", "0.6227203", "0.62248766", "0.6223448", "0.62231123", "0.6222966", "0.6222367", "0.6221872", "0.62205684", "0.6220102", "0.62161523", "0.6216099", "0.6215804" ]
0.79821914
0
GET /moresmalltrials/select_mobunits GET /moresmalltrials/1/select_mobunits
def select_mobunits @def_unit_data = Moresmallmobunit.where('cur_map_id = ?', params[:map_id]).where('tgt_map_id = ?', params[:map_id]).where('is_prepared = "t"').collect{|m| [m.name, m.id]} @atk_unit_data = Moresmallmobunit.where('cur_map_id != ?', params[:map_id]).where('tgt_map_id = ?', params[:map_id]).where('is_prepared = "t"').collect{|m| [m.name, m.id]} render end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_mob_and_unit\n @mobs = Moresmallmob.find_all_by_moresmalluser_id(params[:user_id]).collect{|m| [m.name, m.id]}\n @selected_mob = Moresmallmobsquad.find(params[:id]).mob_ids unless Moresmallmobsquad.find_by_moresmalluser_id(params[:user_id]).nil?\n @units = Moresmallmobunit.find_all_by_moresmalluser_id(params[:user_id]).collect{|m| [m.name, m.id]}\n @units.unshift([\"\", 0])\n @selected_unit = Moresmallmobsquad.find(params[:id]).moresmallmobunit_id\n render\n end", "def select_atk_mobs\n @atk_mob_size = Mosttinymob.find_all_by_mosttinyuser_id(params[:atk_user_id]).size\n @atk_bench_mob = Mosttinytrial.find(params[:id]).def_bench_mob_ids_and_names_by_user(params[:atk_user_id])\n @atk_setup_mob = Mosttinytrial.find(params[:id]).def_setup_mob_ids_and_names_by_user(params[:atk_user_id])\n render\n end", "def select_map_and_def_mobs\n @def_map = Mosttinymap.find_all_by_mosttinyuser_id(params[:def_user_id])\n @def_mob_size = Mosttinymob.find_all_by_mosttinyuser_id(params[:def_user_id]).size.to_s\n @def_bench_mob = Mosttinytrial.find(params[:id]).def_bench_mob_ids_and_names_by_user(params[:def_user_id])\n @def_setup_mob = Mosttinytrial.find(params[:id]).def_setup_mob_ids_and_names_by_user(params[:def_user_id])\n render\n end", "def show\n @moresmalltrial = Moresmalltrial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @moresmalltrial }\n end\n end", "def units\n @units = Item.select(\"DISTINCT unit\").where(\"unit like ?\", \"%#{params[:q]}%\").limit(20).map(&:unit)\n @units += Detail.select(\"DISTINCT unit\").where(\"unit like ?\", \"%#{params[:q]}%\").limit(20).map(&:unit)\n @units = @units.uniq\n respond_to do |format|\n format.json { render json: @units }\n end\n end", "def show\n @mosttinymobsetup = Mosttinymobsetup.find(params[:id], :include => [:mosttinytrial, {:mosttinymob => :mosttinymobinfo}])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mosttinymobsetup }\n end\n end", "def getUnitFormElements unit_id\n unit_form = UNIT_TYPES[unit_id]\n if mobile_device?\n unit_form_mobile = unit_form + \"_mobile\"\n render :partial => 'examiners/performances/subforms/'.concat(unit_form_mobile)\n else\n render :partial => 'examiners/performances/subforms/'.concat(unit_form)\n end\n end", "def get_units\n @agency, @depts = params[:agency], params[:dept]\n render :layout => false\n end", "def upgrade_selected_units_upgrade_selected_units_with_http_info(upgrade_unit_list, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: UpgradeApi.upgrade_selected_units_upgrade_selected_units ...\"\n end\n # verify the required parameter 'upgrade_unit_list' is set\n if @api_client.config.client_side_validation && upgrade_unit_list.nil?\n fail ArgumentError, \"Missing the required parameter 'upgrade_unit_list' when calling UpgradeApi.upgrade_selected_units_upgrade_selected_units\"\n end\n # resource path\n local_var_path = \"/upgrade/plan?action=upgrade_selected_units\"\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 = @api_client.object_to_http_body(upgrade_unit_list)\n auth_names = ['BasicAuth']\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: UpgradeApi#upgrade_selected_units_upgrade_selected_units\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def new\n @moresmalltrial = Moresmalltrial.new\n max_id = Moresmalltrial.maximum(:id)\n max_id = 1 if max_id.nil?\n next_id = max_id + 1\n @moresmallmaps = Moresmallmap.where('start_trial_id <= ?', next_id).where('end_trial_id >= ?', next_id)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @moresmalltrial }\n end\n end", "def upgrade_selected_units_upgrade_selected_units_with_http_info(upgrade_unit_list, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiUpgradePlanApi.upgrade_selected_units_upgrade_selected_units ...'\n end\n # verify the required parameter 'upgrade_unit_list' is set\n if @api_client.config.client_side_validation && upgrade_unit_list.nil?\n fail ArgumentError, \"Missing the required parameter 'upgrade_unit_list' when calling ManagementPlaneApiUpgradePlanApi.upgrade_selected_units_upgrade_selected_units\"\n end\n # resource path\n local_var_path = '/upgrade/plan?action=upgrade_selected_units'\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 = @api_client.object_to_http_body(upgrade_unit_list)\n auth_names = ['BasicAuth']\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: ManagementPlaneApiUpgradePlanApi#upgrade_selected_units_upgrade_selected_units\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @commercial_units = CommercialUnit.where(manager_id: current_manager.id)\n end", "def available_units\n # After manual set, duplicate map for form select lists\n all_units = ['gram', 'kg', 'lb', 'oz', 'liter', 'gal', 'qt', 'pt', 'us_fl_oz', 'tsp', 'tbsp', 'cup', 'each'].map { |unit| [unit, unit] }.sort\n return all_units\n\tend", "def show\n @moresmallmobsquad = Moresmallmobsquad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @moresmallmobsquad }\n end\n end", "def select_unit_by_id(unit_id)\n @units[unit_id]\n end", "def select_unit_by_id(unit_id)\n @units[unit_id]\n end", "def unit_of_measurement_find_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: UnitOfMeasurementApi.unit_of_measurement_find ...\"\n end\n # resource path\n local_var_path = \"/UnitsOfMeasurement\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']\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/x-www-form-urlencoded', 'application/xml', 'text/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 => 'Array<UnitOfMeasurement>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UnitOfMeasurementApi#unit_of_measurement_find\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def select\n @select_stations = CorpLocation.all\n session[:station] = nil\n respond_to do |format|\n format.html # select.html.erb\n # format.json { render json: @product_result }\n end\n end", "def show\n @resource = Resource.find(params[:resource_id])\n @incident = Incident.find(@resource.incident_id)\n @demob = Demob.find(params[:id])\n @logistics_units = @demob.units[0..5]\n @finance_units = @demob.units[6..8]\n @other_units = @demob.units[9..10]\n @plans_units = @demob.units[11..13]\n end", "def foods_units\n get('/foods/units.json')\n end", "def unit_show\n @product = Product.find(params[:id])\n\n @store_cust_group = CustomerGroup.find_by_name(\"Bakul/Toko\")\n @workshop_cust_group = CustomerGroup.find_by_name(\"Bengkel/Montir\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def get_adapter_unit_by_moid_with_http_info(moid, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AdapterApi.get_adapter_unit_by_moid ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling AdapterApi.get_adapter_unit_by_moid\"\n end\n # resource path\n local_var_path = '/api/v1/adapter/Units/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.to_s))\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', 'text/csv', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'AdapterUnit'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"AdapterApi.get_adapter_unit_by_moid\",\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: AdapterApi#get_adapter_unit_by_moid\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def set_mob\n @mob = Mob.find(params[:id])\n end", "def getmill\n\tformid = Windmill.where(windformid: params[:id])\n\tif formid.present?\n render json: formid.as_json(only:[:no])\n\telse\n\t\trender json: {massage: 'Windform not found'}\n\tend\nend", "def assign_unit \n if !params[:ic_number].nil?\n @val = params[:transfer_from][:agency]\n user = User.find_by_ic_number(params[:ic_number])\n departments = user.units.active.collect(&:name)\n render :json=>[departments] if departments\n end\n end", "def show\n\n @moretinymap = Moretinymap.find(params[:id])\n\n @guardmobs = Moretinymob.find_all_by_moretinymap_id_and_is_guard(params[:id], true, :include => :moretinymobinfo)\n @intrudermobs = Moretinymob.find_all_by_moretinymap_id_and_is_guard(params[:id], false, :include => :moretinymobinfo)\n\n @intrudermobtrail = Moretinymobtrail.first(:include => :moretinymob, :conditions => [\"moretinymobs.is_guard = ?\", false])\n\n @mobbattles = Moretinymobbattle.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @moretinymap }\n end\n end", "def set_measurement_unit\n @measurement_unit = MeasurementUnit.find(params[:id])\n end", "def selected_units\n SQF.groupSelectedUnits @this\n end", "def set_unit_measure\n @unit_measure = UnitMeasure.find(params[:id])\n end", "def set_all_mobile\n @all_mobile = AllMobile.find(params[:id])\n end", "def getform\n\tgetform = Windmill.where(no: params[:no])\n\tif getform.present?\n render json: getform.as_json(only: [:windformid])\n\telse\n\t\trender json: {massage: 'No windfrom available in this id'}\n\tend\nend", "def select_marital_option\n ran_num = rand(2)\n status = @chrome_driver.find_elements(:name, \"radio_4[]\")\n status.each do |stat|\n if stat['value'] == MARITAL_STATUS[ran_num]\n stat.click\n end\n end\n end", "def transfer_unit\n if !params[:ic_number].nil?\n user = User.find_by_ic_number(params[:ic_number])\n departments = user.units.active.collect(&:name)\n render :json=>[departments] if departments\n end\n end", "def index\n @filterrific = initialize_filterrific(\n Meter.includes(:route,customer: [:town,:zone]),\n params[:filterrific],\n :select_options => {\n sorted_by: Meter.options_for_sorted_by,\n with_town_id: Town.options_for_select,\n with_town_id_zone_id: Zone.options_for_select\n }\n ) or return\n @meters = @filterrific.find.page(params[:page])\n end", "def index\n @all_mobiles = AllMobile.all\n end", "def get_measurements_mobile\n\t\tif !params[:card_id].nil? and !params[:measure_type_id].nil?\n\t\t\t@measurements = Measurement.where(\"card_id = ? and measure_type_id = ?\", params[:card_id], params[:measure_type_id]).order(created_at: :desc)\n\t\t\trender json: @measurements\n\t\telse\n\t\t\trender json: Measurement.all.order(created_at: :desc)\n\t\tend\n\tend", "def index\n @cust_mobiles = CustMobile.all\n end", "def new\n @mosttinytrial = Mosttinytrial.new\n\n @gurad_mobs_size = Mosttinymob.find_all_by_mosttinyuser_id(2).size\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mosttinytrial }\n end\n end", "def at_millesime\n @millesime = @wine.millesimes.find(params[:id])\n end", "def show\n @mobile_type_list = MobileTypeList.find(params[:id])\n\tend", "def index\n @units = Unit.all\n end", "def index\n @units = Unit.all\n end", "def index\n @units = Unit.all\n end", "def index\n @units = Unit.all\n end", "def index\n @units = Unit.all\n end", "def index\n @units = Unit.all\n end", "def mls_select; select(:account, :mls_id, options_with_ids(mlses)); end", "def index\n @units = @gang.units.order( :id )\n @can_add_units = can_add_units\n end", "def set_unit_of_measure\n @unit_of_measure = UnitOfMeasure.find(params[:id])\n end", "def find_units(modids)\n # TODO: Rename unit_search?\n units = connection.get(connection.build_url(\"units/search\", :modids => modids)).body\n units.map!{|hash| hash.values.first}\n units.each{|u| u.extend UnitMethods; u._cloud_connect = self;}\n end", "def index\n response = HTTParty.get(\"https://casa-core.herokuapp.com/api/units\", :headers => { \"Authorization\" => AUTH, \"Host\" => HOST})\n @units = JSON.parse(response.body)\n return @units\n end", "def set_unit\n @unit = Unit.find(params[:id])\n @unit_time = @unit.unit_times[1]\n @unit_time_2 = @unit.unit_times[2]\n end", "def set_unit\n @unit = Unit.friendly.find(params[:id])\n end", "def set_unit\n hash = cookies[:city_hash]\n @city = City.find_by(city_hash: hash)\n @units = @city.units\n @unit = Unit.find(params[:id])\n\n unless @units.includes(@unit)\n @unit = nil\n end\n\n end", "def show\n query = {\n 'id' => unit_params[:id]\n }\n response = HTTParty.get(\"https://casa-core.herokuapp.com/api/units/?id\", :query => query, :headers => { \"Authorization\" => AUTH, \"Host\" => HOST})\n\n if response.code == 200\n @unit = JSON.parse(response.body)\n else\n redirect_to unit_path(params[:id]), notice: 'Hmm...thats strange...try that again.'\n end\n end", "def report_unit_statuses\n u_times = Unit.all.map do |u|\n { :id => u.id, :state => u.state, :duration => u.duration, :time_available => u.time_available }\n end\n respond_to do |format|\n format.html { render nothing: true }\n format.js { respond_with(u_times) }\n end\n end", "def create\n @moresmalltrial = Moresmalltrial.new(params[:moresmalltrial])\n\n respond_to do |format|\n if @moresmalltrial.save\n format.html { redirect_to @moresmalltrial, notice: 'Moresmalltrial was successfully created.' }\n format.json { render json: @moresmalltrial, status: :created, location: @moresmalltrial }\n else\n format.html { render action: \"new\" }\n format.json { render json: @moresmalltrial.errors, status: :unprocessable_entity }\n end\n end\n end", "def for_unit(unit); find(:all, :conditions => {:unit_id => (unit.nil? ? nil : unit.class == Fixnum ? unit : unit.id)}); end", "def set_cust_mobile\n @cust_mobile = CustMobile.find(params[:id])\n end", "def get_adapter_unit_expander_by_moid_with_http_info(moid, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AdapterApi.get_adapter_unit_expander_by_moid ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling AdapterApi.get_adapter_unit_expander_by_moid\"\n end\n # resource path\n local_var_path = '/api/v1/adapter/UnitExpanders/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.to_s))\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', 'text/csv', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'AdapterUnitExpander'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"AdapterApi.get_adapter_unit_expander_by_moid\",\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: AdapterApi#get_adapter_unit_expander_by_moid\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def set_unit\n #@unit = Unit.find(params[:id])\n end", "def select_agent agent\n select agent, :from => \"staffID_1\"\n end", "def get\n\t\t\t result = Status.find_by(windmillid: params[:windmillid]) \n \t\t\trender json: [result.as_json(only: [:status,:power,:gen,:frequency,:rotor,:wind,:pitch])]\n\tend", "def show\n @mum = Mum.find(params[:mum_id])\n end", "def index\n @customer_mobiles = CustomerMobile.all\n end", "def set_unit_of_measure\n @unit_of_measure = UnitOfMeasure.find(params[:id])\n end", "def unit(unit_id=nil, opts = {})\n units = connection.get(connection.build_url(\"units\", opts.merge(:unitids => unit_id))).body\n units.map!{|hash| hash.values.first}\n units.each{|u| u.extend UnitMethods; u._cloud_connect = self;}\n units.first\n end", "def units\n q = \"select distinct unit_id from master_files m inner join master_file_locations l on l.master_file_id=m.id\"\n q << \" where location_id = #{id}\"\n return Location.connection.query(q).flatten\n end", "def set_mobile_type_list\n @mobile_type_list = MobileTypeList.find(params[:id])\n end", "def index\n @unit_measures = UnitMeasure.all\n end", "def currentunit_params\n params[:currentunit]\n end", "def index\n if params[:search].present?\n @atm_machines = AtmMachine.near(params[:search], 50)\n else\n @atm_machines = AtmMachine.all\n end\n end", "def show\n @mosttinytrial = Mosttinytrial.find(params[:id], :include => [:def_user, :atk_user, :def_strategy, :atk_strategy, :map])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mosttinytrial }\n end\n end", "def index\n hash = cookies[:city_hash]\n @city = City.find_by(city_hash: hash)\n @units = @city.units\n\n render json: @units, status: :ok\n end", "def select_type_montant\n [\n \t['montant_ht', \"Montant Hors-Taxe\"],\n \t['montant_ttc', \"Montant TTC\"],\n \t['montant_net', \"Net à payer\"]\n ].in_select(id:'facture_montant_id', name:\"facture[montant_id]\")\nend", "def getlocation\n \tlocafid = Windmill.where(no: params[:no])\nif locafid.present?\n \t\tlocafid = Windmill.find_by(no: params[:no])\n \t\trender json: [locafid.as_json(only: [:no, :latitude, :londitude,:location])]\nelse\n \t\trender json: {massage: 'windmill not found'}\n end\nend", "def getmill\n\t\n \tformid = Userdet.where(usid: params[:userid]).all\n \t\nif formid.present?\n\t\t\n render json: formid.as_json(only: [:windmill])\nelse\nrender json: [{message: 'not found'}]\nend\nend", "def show\n @units = @commercial_lead.units\n end", "def index\n @army_units = ArmyUnit.all\n end", "def autocomplete_known_uri_units\n lookup_predicate\n if params[:term].blank? || params[:term].strip.blank?\n @known_uris = @predicate ? @predicate.units_for_form_select : []\n if @known_uris.blank?\n @known_uris = KnownUri.default_units_for_form_select\n end\n else\n @known_uris = search_known_uris_by_name_or_uri(params[:term])\n allowed_values = KnownUri.unit_of_measure.allowed_values\n @known_uris.delete_if{ |ku| ! allowed_values.include?(ku) }\n end\n render_autocomplete_results\n end", "def set_medical_unit\n @medical_unit = MedicalUnit.find(params[:id])\n end", "def show\n @unit_of_measure = UnitOfMeasure.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @unit_of_measure }\n end\n end", "def show\n @m_machine_number = MMachineNumber.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @m_machine_number }\n end\n end", "def index_with_unit\n @assignments = current_user.assignments(includes: includes_array)\n .where(unit_id: params[:unit_id])\n serialize_collection @assignments, :ok\n end", "def inNeedMobile\n inNeed = InNeed.find_by(first_name: params[:inNeed][:first_name], last_name: params[:inNeed][:last_name], last4_ssn: params[:inNeed][:last4_ssn])\n\n if inNeed.nil?\n render :json => {:success => false }\n else\n # Get all the services they have. \n services_to_return = []\n Service.where(in_need_id: inNeed.id).find_each do |service|\n services_to_return.push(service.as_json)\n end\n render :json => {:success => true, :services => services_to_return}\n end\n end", "def unit_of_measurement_find_one_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: UnitOfMeasurementApi.unit_of_measurement_find_one ...\"\n end\n # resource path\n local_var_path = \"/UnitsOfMeasurement/findOne\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']\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/x-www-form-urlencoded', 'application/xml', 'text/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 => 'UnitOfMeasurement')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UnitOfMeasurementApi#unit_of_measurement_find_one\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @units = if params[:order] == 'updated'\n Unit.order('updated_at ' + params[:updated_direction])\n elsif params[:order] == 'created'\n Unit.order('created_at ' + params[:created_direction])\n elsif params[:order] == 'note_updated'\n Unit.order('note_updated_at ' + params[:note_updated_direction])\n elsif params[:order] == 'first_name'\n Unit.joins(:resident).order('residents.first_name ' + params[:first_name_direction])\n elsif params[:order] == 'last_name'\n Unit.joins(:resident).order('residents.last_name ' + params[:last_name_direction])\n elsif params[:order] == 'name'\n Unit.order('name ' + params[:name_direction])\n elsif params[:order] == 'address'\n Kaminari.paginate_array(Address.joins(:street, :units).order(\"streets.name #{params[:address_direction]}\").order(\"addresses.street_number #{params[:address_direction]}\").map(&:units).flatten)\n else\n Unit.order('created_at desc')\n end.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @units }\n end\n end", "def customer_usage_params\n params.require(:customer_usage).permit(:mo_01, :mo_02, :mo_03, :mo_04, :mo_05, :mo_06, :mo_07, :mo_08, :mo_09, :mo_10, :mo_11, :mo_12)\n end", "def select_marital_option(marital_status)\n # Consider something like a case statement and check the selenium selected? method\n case marital_status.downcase\n when 'single'\n @chrome_driver.find_elements(:name, MARITAL_STATUS)[0].click\n when 'married'\n @chrome_driver.find_elements(:name, MARITAL_STATUS)[1].click\n when 'divorced'\n @chrome_driver.find_elements(:name, MARITAL_STATUS)[2].click\n end\n end", "def index\n @display_units = DisplayUnit.all\n end", "def index\n @unit_names = UnitName.all\n end", "def index\n @survey_results = HTTParty.get('https://shielded-wave-66393.herokuapp.com',\n :headers =>{'Content-Type' => 'application/json'} )\n @survey_results = SurveyResults.all_(current_customer)\n end", "def index\n site_ids=Site.where(user_id: current_user.id).select(:id)\n site_ids=[1,2,3]\n @billable_meters = BillableMeter.joins(:meter).where(meters: { site_id:site_ids })\n respond_to do |format|\n format.json { render :json => @products }\n format.html { render :index }\n end\n end", "def index\n @workout_units = WorkoutUnit.all\n end", "def fill_mobile_data(user)\n puts \"Selecting moble nr country: #{mobile_country = user.mobile_country}\"\n select_item_from_list(:xpath, MOBILE_COUNTRY_SELECT, mobile_country)\n mobile_phone = user.mobile_phone\n puts \"Inputing mobile nr: '#{mobile_phone}'\"\n get_elem_and_fill(:xpath, MOBILE_NR_FILL, mobile_phone)\n end", "def set_unit\n @unit = Unit.find(params[:id])\n end", "def select_marital_option\n # Consider something like a case statement and check the selenium selected? method\n ran_num = rand(2)\n status = @chrome_driver.find_elements(:name, \"radio_4[]\")\n status.each do |stat|\n if stat['value'] == MARITAL_STATUS[ran_num]\n stat.click\n return stat.selected?\n end\n end\n end", "def set_unit\n @unit = Unit.find params[:id]\n end", "def index\n @base_units = BaseUnit.all\n end", "def set_unit\n @unit = Unit.find(params[:id])\n end" ]
[ "0.7767612", "0.67045027", "0.6238261", "0.6097225", "0.60156", "0.5676386", "0.5630235", "0.55827385", "0.5499818", "0.549147", "0.54616195", "0.54372257", "0.536816", "0.53639144", "0.5348078", "0.5348078", "0.5346673", "0.5336801", "0.5318684", "0.5304373", "0.5261055", "0.5258733", "0.524945", "0.5235508", "0.52159214", "0.52032053", "0.51877165", "0.5156051", "0.5135182", "0.5127979", "0.5118593", "0.5117231", "0.510397", "0.51019454", "0.50744236", "0.50672466", "0.5060218", "0.5057397", "0.5035706", "0.5033843", "0.5018644", "0.5018644", "0.5018644", "0.5018644", "0.5018644", "0.5018644", "0.501159", "0.50106347", "0.5007261", "0.5002849", "0.50025773", "0.49982214", "0.4996479", "0.49904618", "0.4987786", "0.49748278", "0.4968295", "0.49580446", "0.49443936", "0.4938716", "0.4933884", "0.49338132", "0.49330786", "0.49243313", "0.491523", "0.49066323", "0.49061275", "0.4905152", "0.49044403", "0.48990127", "0.4898213", "0.48968697", "0.48916268", "0.48867452", "0.4879572", "0.4877704", "0.48762652", "0.48533016", "0.485107", "0.48471707", "0.48470914", "0.4842146", "0.4839583", "0.48347527", "0.48331258", "0.48142928", "0.48114598", "0.48034355", "0.47980857", "0.47928897", "0.47927287", "0.47924814", "0.4785939", "0.4784727", "0.4784008", "0.47818735", "0.47809586", "0.47740948", "0.47641057", "0.47637883" ]
0.767579
1
Use callbacks to share common setup or constraints between actions.
def set_account_transaction @account_transaction = AccountTransaction.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "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", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "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", "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", "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", "def setup_handler\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "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", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "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", "def workflow\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "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", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "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", "def determine_valid_action\n\n end", "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", "def startcompany(action)\n @done = true\n action.setup\n end", "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", "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", "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", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "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", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "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", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "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", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "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", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "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", "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", "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", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "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", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "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", "def before_setup\n # do nothing by default\n end", "def default_action; end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "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" ]
[ "0.6163927", "0.6046165", "0.59465253", "0.59167755", "0.58904207", "0.58346355", "0.577713", "0.5703502", "0.5703502", "0.56531286", "0.56215113", "0.54224145", "0.5410795", "0.5410795", "0.5410795", "0.53924775", "0.5379919", "0.53580743", "0.53401667", "0.53397506", "0.5332605", "0.5312215", "0.5296594", "0.52965283", "0.52957606", "0.5259903", "0.52443177", "0.523896", "0.523896", "0.523896", "0.523896", "0.523896", "0.52329034", "0.52322394", "0.5227445", "0.5222394", "0.5220348", "0.5212759", "0.5207747", "0.5205933", "0.5176468", "0.5173833", "0.5171983", "0.51663405", "0.5159596", "0.5158247", "0.51526845", "0.5152398", "0.5151361", "0.5145775", "0.5140135", "0.51338995", "0.51127726", "0.5112607", "0.5112607", "0.5110613", "0.51067513", "0.5092337", "0.508788", "0.5081578", "0.5080434", "0.50679874", "0.50567716", "0.5051213", "0.5048352", "0.5048352", "0.5035347", "0.5026666", "0.5023127", "0.5016081", "0.50129867", "0.5000684", "0.4999752", "0.49979812", "0.499026", "0.499026", "0.49866846", "0.49800366", "0.49795717", "0.49771172", "0.4968475", "0.4965813", "0.4958072", "0.49561292", "0.4954901", "0.49536785", "0.4953058", "0.49468648", "0.49424478", "0.4932989", "0.49291888", "0.49273813", "0.49271655", "0.4925948", "0.49236968", "0.49203572", "0.49181753", "0.49173692", "0.4916862", "0.49161318", "0.49155986" ]
0.0
-1
Only allow a trusted parameter "white list" through.
def account_transaction_params params.require(:account_transaction).permit(:transaction_id, :amount, :transaction_type, :date, :pending, :pending_transaction_id, :address, :city, :state, :zip, :lat, :lon, :name, :category_id, :account_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def filtered_parameters; end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end", "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", "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", "def param_whitelist\n [:rating, :review]\n end", "def valid_params?; end", "def permitted_params\n declared(params, include_missing: false)\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "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", "def filter_parameters; end", "def filter_parameters; end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def check_params; true; end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def list_params\n params.permit(:name)\n end", "def check_params\n true\n end", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "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", "def additional_permitted_params\n []\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end", "def allow_params_authentication!; end", "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", "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", "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", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end", "def quote_params\n params.permit!\n end", "def list_params\n params.permit(:list_name)\n end", "def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end", "def all_params; end", "def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end", "def source_params\n params.require(:source).permit(all_allowed_params)\n end", "def user_params\n end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end", "def permitted_params\n @wfd_edit_parameters\n end", "def user_params\r\n end", "def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend", "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", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end", "def params_permit\n params.permit(:id)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def filter_params\n params.permit(*resource_filter_permitted_params)\n end", "def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end", "def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend", "def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\n end", "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", "def argument_params\n params.require(:argument).permit(:name)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\n end", "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", "def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end", "def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end", "def parameters\n nil\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end", "def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end", "def normal_params\n reject{|param, val| param_definitions[param][:internal] }\n end", "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", "def special_device_list_params\n params.require(:special_device_list).permit(:name)\n end", "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" ]
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.63804525", "0.6373396", "0.6360051", "0.6355191", "0.62856233", "0.627813", "0.62451434", "0.6228103", "0.6224965", "0.6222941", "0.6210244", "0.62077755", "0.61762565", "0.61711127", "0.6168448", "0.6160164", "0.61446255", "0.6134175", "0.6120522", "0.6106709", "0.60981655", "0.6076113", "0.60534036", "0.60410434", "0.6034582", "0.6029977", "0.6019861", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.60184896", "0.60157263", "0.6005857", "0.6003803", "0.60012573", "0.59955895", "0.5994598", "0.5993604", "0.5983824", "0.5983166", "0.5977431", "0.597591", "0.5968824", "0.5965953", "0.59647584", "0.59647584", "0.59566855", "0.59506303", "0.5950375", "0.59485626", "0.59440875", "0.5930872", "0.5930206", "0.5925668", "0.59235454", "0.5917905", "0.59164816", "0.5913821", "0.59128743", "0.5906617", "0.59053683", "0.59052664", "0.5901591", "0.58987755", "0.5897456", "0.58970183", "0.58942604" ]
0.0
-1
This scripts checks the group membership of each user on the machine to to see if they are in the local admin group
def local_admins list_of_users_tocheck = [] for x in Dir.entries("/Users") if !x.start_with?(".") list_of_users_tocheck.push(x) end end localadmins = [] for x in list_of_users_tocheck if `dsmemberutil checkmembership -U #{x} -G admin 2>/dev/null`.chomp == "user is a member of the group" localadmins.push(x) end end puts "Local Admins:" return localadmins end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_in_admin_group?\r\n cmd_exec(\"groups `whoami`\").split(/\\s+/).include?(SUDOER_GROUP)\r\n end", "def admin_of?(group)\n memberships.exists?(group_id: group.id, admin: true)\n end", "def is_admin?\n cmd_exec('groups | grep -wq admin && echo true').eql? 'true'\n end", "def user_is_admin?\n\t`groups`.split.include? \"admin\"\n end", "def is_group_admin_for_user? user\n !primary_network.restrict_access && UserGroup.where(:group_id => user.groups.collect(&:id), :user_id => self.id, :administrator => true).size > 0\n end", "def is_admin?\n group_names.include?(ADMIN_GROUP_NAME)\n end", "def isCurrentUserAdmin(id)\n\t@user = User.find(id)\n return @user.group == 1\n end", "def group_admin? group\n g = group.groups_userss.detect{|i| i.user_id == session[:id]}\n g.is_admin unless g.nil?\n end", "def admin?\n Group.find('admin').members.member?(self)\n end", "def group_admin?\n return false unless group\n\n group.admin?(user)\n end", "def running_elevated?\n\tputs \"Checking current process elevated status...\"\n\tgroups = com.sun.security.auth.module.NTSystem().new.getGroupIDs\n\tgroups.each do |group|\n\t\tif group.strip == \"S-1-5-32-544\"\n\t\t\tputs \"User found to be member of Administrators group\"\n\t\t\treturn true\n\t\tend\n\tend\n\treturn false\nend", "def user_is_admin?\n\tbegin\n\t `gpresult /r /scope user`.split.include? \"Admin\"\n\trescue\n\t false\n\tend\n end", "def admin_of(group)\n current_user.is_admin?(group)\n end", "def is_admin_in(group)\n unless group.admins.include? current_user\n flash[:danger] = \"Devi essere un amministratore per eseguire questa azione\"\n redirect_to group_path(uuid: group.uuid)\n end\n end", "def admin?\n c_user = current_user\n not c_user.nil? and c_user.group==\"admin\"\n end", "def user_admin?(login, repo, settings)\n user_in_group?(login, repo, settings, 'repo_to_admin_teams')\n end", "def priviledge_check\n # If we are allowing everybody to connect, then just check the 'everybody' settings\n @users_to_repair = []\n if resource[:users].key?('all')\n unless @config.empty?\n\t return false unless @config['ARD_AllLocalUsersPrivs']\n return false unless resource[:users]['all'].eql?(@config['ARD_AllLocalUsersPrivs'].to_ruby)\n return false unless @config['ARD_AllLocalUsers'].boolValue\n return true\n end\n return false\n end\n # If operation mode is autocratic, check all unscoped users for naprivs \n @removals = []\n if resource[:autocratic]\n unscoped_users = all_users - resource[:users].keys\n unless unscoped_users.empty?\n unscoped_users.each do |user|\n user = get_user(user)\n @removals << user if user['naprivs']\n end\n end\n end\n # Always check scoped users\n @additions = []\n resource[:users].each do |k,v|\n user = get_user(k)\n if user['naprivs']\n\tunless user['naprivs'].to_ruby.to_s.eql?(v)\n\t @additions << user \n\tend\n else\n\t@additions << user \n end\n end\n @users_to_repair = @additions + @removals\n return false unless @config['ARD_AllLocalUsers']\n unless @config['ARD_AllLocalUsers'].boolValue.eql?(true)\n return @users_to_repair.empty? \n end\n false\n end", "def ansible_check_permissions pb, u, uma\n u.info!\n perm = pb['extra_data']['PERMISSIONS'].split('')\n mod = perm.values_at(*Array.new(3) { |i| uma + 3 * i }).map { | value | value == '1' ? true : false }\n return (\n (u.id == pb['uid'] && mod[0]) ||\n (u.groups.include?(pb['gid']) && mod[1]) ||\n (mod[2]) ||\n (u.groups.include?(0))\n )\nend", "def admin?(user = nil)\n membership = Membership.find_by group_id: id, user_id: user.id,\n role: 'admin'\n return false if membership.nil?\n membership.user_id == user.id\n end", "def is_group_admin_for_network? network\n user_groups.joins(:group).where(:groups => {:network_id => network.id}, :administrator => true, :can_authorize_users => true).size > 0\n end", "def administrator?\n immortal? or groups.find_by_administrators true\n end", "def test_truth\n assert groups(:teacher_group).has_user(users(:teacheruser))\n assert ! groups(:admin_group).has_user(users(:teacheruser))\n assert groups(:admin_group).has_user(users(:adminuser))\n end", "def admin?\n (session[:drupal_user_role] && (session[:drupal_user_role].values.include?('administrator') || session[:drupal_user_role].values.include?('staff'))) ? true : false\n end", "def work_is_group_admin wgid, isredirect = false\n\t\tif DB[:work_group_user].filter(:uid => _user[:uid], :wgid => wgid).get(:rule) > 1\n\t\t\ttrue\n\t\telse\n\t\t\tif isredirect\n\t\t\t\t_throw L[:'you are not the administrator of this group']\n\t\t\telse\n\t\t\t\tfalse\n\t\t\tend\n\t\tend\n\tend", "def admin?\n Site.where(:memberships => { '$elemMatch' => { :account_id => self._id, :role => :admin } }).count > 0\n end", "def is_loc_group_admin?(dept)\n dept.loc_groups.any?{|lg| self.is_admin_of?(lg)}\n end", "def may_read_groups?\n\t\t\tmay_administrate?\n\t\tend", "def admin_user(user)\n config_hash = settings.latte_config\n # nobody is admin if there is no admin group.\n return nil if config_hash[:latte_admin_group].nil?\n\n config_hash[:admin_members] = LdapCheck.new(\"group\" => config_hash[:latte_admin_group]) if config_hash[:admin_members].nil?\n config_hash[:admin_members].is_user_in_admin_hash user\n\n end", "def is_admin_of?(group, cookie)\n return false unless group.is_member?(self, cookie)\n PersonConnection.get_group_admin_status(id, group.id, cookie)[\"entry\"][\"admin_role\"]\n end", "def admin?\n Site.where(memberships: { '$elemMatch' => { account_id: self._id, role: :admin } }).count > 0\n end", "def may_create_groups?\n\t\t\tmay_administrate?\n\t\tend", "def admin_user\n @group = Membership.find(params[:id]).group\n redirect_to group_members_url(@group) unless @group.has_admin?(current_user)\n end", "def cdb_admin_exist\n users = self.cdb_list\n users.any?{ |u| self.cdb_load(u).admin }\n end", "def show\n @group_members = Membership.where(group_id: @group.id).all\n @members_count = @group_members.count \n @is_member = @group_members.exists?(user_id: current_user.id)\n @is_admin = @group_members.exists?(user_id: current_user.id, admin: true)\n end", "def is_admin\n @user = User.find(params[:user_id])\n @group = Group.find(params[:group_id])\n if @user.is_admin?(@group)\n render json: {result: 1}\n else\n render json: {result: 0}\n end\n end", "def ifMember(group_id,user_id)\n GroupUser.where(:group_id => group_id, :user_id => user_id).exists? #change to current_user_id \n end", "def administrator?(usr)\n user_has_user_group?(usr, Lockdown.administrator_group_symbol)\n end", "def administrator?(usr)\n user_has_user_group?(usr, Lockdown.administrator_group_symbol)\n end", "def admin()\n @data[\"access\"][\"user\"][\"roles\"].each do |role|\n if role[\"name\"].eql?(\"admin\")\n return true\n end\n end\n return false\n end", "def is_admin?\n ((!user_group_id.nil?) && has_permission(:is_admin))\n end", "def administerable_by(user_id)\n\t\tuser = project_groups.find_by_user_id(user_id)\n\t\tif (! user.nil?) && user.project_administrator then\n\t\t\treturn true\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend", "def other_users_online()\n userlist = `ps haeo user | sort -u`.split(\"\\n\")\n userlist -= userlist.grep(/s0840449|root/)\n not userlist.empty?\nend", "def is_super_admin_in(group)\n unless group.super_admin == current_user\n flash[:danger] = \"Devi essere il fondatore per eseguire questa azione\"\n redirect_to group_path(uuid: group.uuid)\n end\n end", "def check_admin\n # using the function above by grabbing the id\n @current_user = find_current_user\n # cross checking to see if user is also an admin\n unless @current_user.present? and @current_user.is_admin?\n #they're find so no additional code needed\n #if they're not admin\n redirect_to root_path\n end\n end", "def manage_group\n member_options = set_members_options\n if member_options.empty?\n shell_out!(\"pw\", \"groupmod\", set_options)\n else\n member_options.each do |option|\n shell_out!(\"pw\", \"groupmod\", set_options, option)\n end\n end\n end", "def user_is_admin?\n ALLOWED_USERS.include? current_user.email\n end", "def admin?(uid)\n circle = DeterLab.view_circles(uid, \"admin:admin\").first\n return circle && !circle.members.find { |m| m.uid == uid }.nil?\n rescue DeterLab::AccessDenied\n return false\n end", "def admin?(&block)\n if @sso_groups.include?(\"Admin\") || @user.role_id >= 2\n concat(capture(&block))\n end\n end", "def user_group_membership(domain,username,password,dc_ip,user)\n output = \"#{domain}-#{user}-groups.txt\"\n enum = `net rpc user info #{user} -U \"#{domain}\\\\#{username}%#{password}\" -S #{dc_ip}`\n puts \"[+] Currently identifying groups that #{user} is a member of ...\"\n\n if enum.length == 0\n puts \"[-] It looks like the target domain contoller at #{dc_ip} is unresponsive or the user #{user} does not exist\"\n elsif enum.length == 1\n puts \"[-] It looks like the target domain contoller at #{dc_ip} is unresponsive or the user #{user} does not exist\"\n else\n enum = `net rpc user info #{user} -U \"#{domain}\\\\#{username}%#{password}\" -S #{dc_ip} | tee #{output}`\n puts enum\n puts \"[+] Success! All groups that #{user} is a member of has been stored in #{output}\"\n end\nend", "def admin?\n isAdmin = false ; \n self.role.each { |r|\n if r.name == 'Administrator'\n isAdmin = true\n end\n \n }\n return isAdmin\n end", "def admins\n app_users.select(&:admin?)\n end", "def group_admins\n group.blank? ? [] : group.has_admins\n end", "def admin_logged_in?\n #if session[:logged_in] == true && (session[:host_id] == 670999089 || session[:host_id] == 753452019 || session[:host_id] == 100000182246137)\n if session[:logged_in] == true && User.find(session[:id]).admin == true\n true\n else\n false\n end\n\n end", "def check_role_group\n @roles = Role.role_group.accessible_by(current_ability)\n end", "def admin\n match = rabbitmqctl('list_users').split(/\\n/)[1..-2].collect do |line|\n line.match(/^#{Regexp.escape(resource[:name])}\\s+\\[(.*)\\]/)\n end.compact.first\n if match\n if match[1].to_s.split(/,\\s*/).index('administrator')\n unless resource[:admin]==:false and user_tags_get().index(\"administrator\")\n :true \n else\n # admin and user_tags can conflict if admin is unset but the user \n # tags include administrator. This confuses puppet. So don't report\n # the administrator tag in this case even though present\n :false\n end\n else \n # really not found\n :false\n end\n else\n raise Puppet::Error, \"Could not match line '#{resource[:name]} (true|false)' from list_users (perhaps you are running on an older version of rabbitmq that does not support admin users?)\"\n end\n end", "def priv_groups(domain,username,password,dc_ip)\n groupArr = [\"Domain Admins\",\"Enterprise Admins\",\"Administrators\"]\n groupArr.each {|group| enum_group_membership(domain,username,password,dc_ip,group)}\n\n priv_groups = Array.new\n\n groupArr.each do |group|\n groupFormatted = group.gsub(' ','-')\n file = \"#{domain}-#{groupFormatted}.txt\"\n r = File.open(file)\n r.each_line {|line| priv_groups.push line.split(\"\\\\\")[1].chomp}\n end\n\n priv_groups.sort!.uniq!\n\n for i in 0 .. priv_groups.length-1 do\n group = priv_groups[i].to_s\n puts \"\"\n puts \"[+] Searching for users in the group #{group}\"\n enum_group_membership(domain,username,password,dc_ip,group)\n end\nend", "def manage_groups\n @other_user = @login_user\n @groups = @login_user.groups\n end", "def check_admin\n ac = AdminConfigFile.new\n ac.read\n @admin = ac.exist?(@user_id)\n end", "def has_any_group?(*group_list)\n return :system_admin if system_admin?\n return false if anonymous?\n\n r = group_list.select{|g| effective_groups.include?(g.upcase)}\n\n r.blank? ? false : r\n end", "def admin_user\n @group = Group.find(by_id)\n redirect_to @group unless @group.has_admin?(current_user)\n end", "def is_admin?\n if login == \"ankit\"\n return true\n else\n return false\n end\n end", "def is_network_admin_for_user? user\n UserNetwork.where(:network_id => user.networks.collect(&:id), :user_id => self.id, :administrator => true).size > 0\n end", "def user_admin\n user_role.in? [\"Department Admin\",\"College Admin\",\"Tech User\"] if user_role\n end", "def admin?\n self.global_role == GLOBAL_ROLES[0] if !self.global_role.blank?\n end", "def admin_user?\n member_type == MEMBER_TYPE[:admin]\n end", "def has_user_group?(ug)\n sym = Lockdown.get_symbol(ug)\n\n return true if sym == Lockdown.administrator_group_symbol\n user_group_exists?(sym)\n end", "def is_admin?(_user_id)\n Rails.cache.fetch \"UserGroup:is_admin_#{id}_#{_user_id}\" do\n user_relationships.where(user_id: _user_id, is_admin: true).any?\n end\n end", "def is_member_in(group)\n unless group.members.include? current_user\n flash[:danger] = \"Devi essere un membro per accedere ad un gruppo ed alle sue informazioni\"\n redirect_to groups_path\n end\n end", "def check_admin_of\n redirect_to root_path if current_user &&\n @user != current_user &&\n !current_user.admin_of?(@user, \"can_manage_users\")\n end", "def admin?\n super? or group_name == 'admin'\n end", "def group_required\n required_group = Group.find_or_create_by(:name => \"Admin\")\n unless current_user.groups.is_member?(required_group)\n flash[:error] = \"The function you wish to use is only available to admin users\"\n redirect_to root_path\n end\n end", "def valid_admin_user\n admin_workspace = ScAdmin.find_by_workspace_id(current_workspace_member.workspace.id)\n admin_user = admin_workspace.user_sc_admins.find(:first, :conditions => {:user_id => current_user.id})\n if !admin_user\n redirect_to scratch_user_path(current_user)\n end\n end", "def check_domain_admin(verbose=true)\n files=[]\n users=[]\n cmd1 = \"net group \\\"Domain Admins\\\" /domain\"\n cmd2 = \"net group \\\"Enterprise Admins\\\" /domain\"\n begin\n text = \"#{@tmp}\\\\#{Rex::Text.rand_text_alpha(16)}.txt\"\n bat = \"#{@tmp}\\\\#{Rex::Text.rand_text_alpha(16)}.bat\"\n cmdexec = \"%COMSPEC% /C echo #{cmd1} ^> #{text} > #{bat} & %COMSPEC% /C start %COMSPEC% /C #{bat}\"\n smb_psexec(cmdexec, false)\n da_output = get_output(text, false)\n files << text\n files << bat\n text = \"#{@tmp}\\\\#{Rex::Text.rand_text_alpha(16)}.txt\"\n bat = \"#{@tmp}\\\\#{Rex::Text.rand_text_alpha(16)}.bat\"\n cmdexec = \"%COMSPEC% /C echo #{cmd2} ^> #{text} > #{bat} & %COMSPEC% /C start %COMSPEC% /C #{bat}\"\n smb_psexec(cmdexec, false)\n ea_output = get_output(text, false)\n files << text\n files << bat\n cleanup_after(files, false)\n usr=false\n da_output.split(\"\\n\").each do |line|\n if usr\n if not line =~ /The command completed successfully/i and not line.nil? and not line == ''\n line.split(' ').each {|user| users << user unless user.nil? or user == '' }\n end\n end\n usr=true if line =~ /-{1,79}/\n end\n usr=false\n ea_output.split(\"\\n\").each do |line|\n if usr\n if not line =~ /The command completed successfully/i and not line.nil? and not line == ''\n line.split(' ').each {|user| users << user unless user.nil? or user == '' }\n end\n end\n usr=true if line =~ /-{1,79}/\n end\n users = users.uniq!\n return users\n rescue Rex::Proto::SMB::Exceptions::InvalidCommand => e\n puts \"[\".light_blue + \"*\".white + \"]\".light_blue + \" Error running commands to check actively logged in users!\".white if verbose\n return nil\n end\nend", "def admins\n # Use the where clause to return users who have admin column set to true (false by default)\n board_members.where(is_admin: true)\n end", "def is_admin? oid\n admins.include? oid\n end", "def all_members_available?\n @rs.members.each do |member|\n machine = @machine.env.machine(member[:host], @machine.provider_name)\n return false if !member_available?(machine)\n end\n true\n end", "def isUserMemberOfGroup \n redirect_to groups_path unless !GroupMember.userIsAlreadyInGroup(params[:group_id], current_user.id)\n end", "def can_admin?(loc_group)\n permission_list.include?(loc_group.admin_permission) && self.is_active?(loc_group.department)\n end", "def check_admin\n if current_user && current_user.admin\n logger.info \"[auth] Allowed for #{current_user.email}\"\n true\n else\n logger.info (\"[auth] Access Denied\")\n redirect_to new_user_session\n end\n end", "def is_admin?(_user_id)\n conversation_members.admin.where(user_id: _user_id).any?\n end", "def can_sudo?(u)\n return true if u.is_admin?\n# for p in all_periods\n# return true if p.admins.include?(u)\n# end\n\n return false\n end", "def run_valid_user?\n\t\t\tif v.valid_user?(ev.user, ev.user_groups, \"railsdep\")\n\t\t\t\t$stdout.puts Rainbow(\"Success: '#{ev.user}' is member of 'railsdep' group\").green\n\t\t\telse\n\t\t\t\texit 1\n\t\t\tend\n\t\tend", "def user_in_group?(attribs, dir_info)\n temp = user_record_name_alternatives(attribs)\n username = temp[:record_name]\n # pp username\n # pp attribs\n\n attribs = group_record_name_alternatives(attribs)\n # groupname = attribs[:record_name]\n attribs[:value] = username\n # pp attribs\n\n check_critical_attribute( attribs, :value, :username )\n check_critical_attribute( attribs, :record_name, :groupname )\n attribs = tidy_attribs(attribs)\n\n command = {action: 'read', scope: 'Groups', attribute: nil, value: nil}\n cmd_attribs = attribs.merge(command)\n\n dscl( cmd_attribs, dir_info )\n end", "def member_of(group)\n current_user.is_member?(group)\n end", "def test_group\n \n user = @user_1\n group = 'customer-test'\n \n assert (not @crowd.group_member? user.name, group), \"#{user.name} is already a member of group #{group}\"\n\n @crowd.add_user_to_group user.name, group \n assert (@crowd.group_member? user.name, group) \n\n groups = @crowd.find_group_memberships user.name\n assert (groups.length > 0)\n assert (groups.include? group)\n\n @crowd.remove_user_from_group user.name, group \n assert (not @crowd.group_member? user.name, group)\n\n groups_after_remove = @crowd.find_group_memberships user.name\n\n # ensure the user in one less group \n assert_equal groups.length - 1, groups_after_remove.length\n \n end", "def may_launch? (definition)\n is_admin? or (self.groups & definition.groups).size > 0\n end", "def is_last_admin?\n count = 0\n users = Chef::WebUIUser.list\n users.each do |u, url|\n user = Chef::WebUIUser.load(u)\n if user.admin\n count = count + 1\n return false if count == 2\n end\n end\n true\n end", "def is_admin?\n level >= USER_LEVELS[\"system_admin\"]\n end", "def clistalladmins(m)\n if is_supadmin?(m.user) || is_admin?(m.user)\n m.reply \"The current admins are #{$adminhash}.\", true\n else\n m.reply NOTADMIN, true\n end\n end", "def check_admin_set(admin_set_id)\n a = AdminSet.find(admin_set_id)\n return a.members.select { |m| m.profile_version == profile_version }.count > 0\n rescue\n true\n end", "def admin? \n (logged_in? && current_member.admin?) ? true : false\n end", "def forum_admin?\n privilege?('User Manager')\n end", "def administration?\n self.privileges == PRIVILEGE_CODES[:administration]\n end", "def index\n @member_groups = @user.groups_where_member\n @admin_groups = @user.groups_where_admin\n end", "def check_membership\n unless @group.includes_user?(current_user)\n respond_to do |format|\n flash.alert = \"Forbidden: must be a member.\"\n format.js { render js: \"window.location.href = '#{groups_url}'\" }\n format.html { redirect_to groups_url }\n end\n end\n end", "def admin?\n \troles.member?(Role.find(:first, :conditions => {:name => \"Administrator\"}))\n end", "def update_administrators\n if user_id_changed?\n if (user_id)\n Membership.find_by_user_id_and_network_id(user_id, id).try(:destroy) # delete membership of new owner\n end \n if (user_id_was)\n Membership.create(:user_id => user_id_was, :network_id => id,\n :administrator => true, :invited_by => User.find(user_id)).accept! # create membership for old owner\n end\n end\n end", "def is_any_admin?(network)\n user_roles = self.roles(network)\n return user_roles.network_admin || user_roles.location_admin || user_roles.group_admin\n false\n end", "def check_or_create_group_ips_dirs\n @config[:groups].each do |key, value|\n if value[:enable]\n change_dir(@working_directory+value[:name])\n begin\n unless value[:ips] == nil\n value[:ips].each do |ip|\n Dir.mkdir(ip.gsub(/[.]/, '-')) unless Dir.exists?(ip.gsub(/[.]/, '-'))\n end\n end\n rescue Exception => error\n change_dir(@working_directory)\n Loggers::Main.log.warn error.message\n exit 6\n end\n end\n end\n change_dir(@working_directory)\n end", "def is_admin_or_pm?\n (@ticket.project.team_members.where(user_id: current_user.id).exists? and \n @ticket.project.organization.positions.where(filled_by_id: current_user.id, role: \"PM\").exists?) or\n @ticket.project.organization.positions.where(filled_by_id: current_user.id, role: \"Admin\").exists? \n end" ]
[ "0.7384816", "0.7222062", "0.7219268", "0.70986426", "0.70076305", "0.69900006", "0.6904335", "0.68876874", "0.68767476", "0.6792933", "0.67712164", "0.67275745", "0.66510236", "0.664713", "0.6566432", "0.6557021", "0.6555653", "0.6534765", "0.65182966", "0.65170693", "0.64085305", "0.6393047", "0.6390598", "0.6388677", "0.6349141", "0.6342327", "0.632558", "0.6320889", "0.63126194", "0.6296885", "0.6281003", "0.6260775", "0.6252354", "0.62281334", "0.62083256", "0.6190725", "0.61895746", "0.61895746", "0.6177016", "0.61759233", "0.6175865", "0.6172679", "0.61635596", "0.61611116", "0.6158081", "0.61514574", "0.6147567", "0.6134438", "0.6134277", "0.61331373", "0.6132641", "0.612598", "0.6123482", "0.6107097", "0.6100078", "0.6097845", "0.6085572", "0.6078688", "0.60699", "0.6068315", "0.606077", "0.60548186", "0.60536623", "0.6038215", "0.60360533", "0.60359055", "0.60271496", "0.6023936", "0.60226357", "0.60208064", "0.6013709", "0.60127217", "0.6004832", "0.6001507", "0.59983826", "0.59951144", "0.5993377", "0.5992548", "0.5977186", "0.5974289", "0.5938116", "0.5923493", "0.5921585", "0.5919082", "0.58955485", "0.58948404", "0.58889914", "0.5888136", "0.5886824", "0.58789384", "0.58754635", "0.587243", "0.5856018", "0.5845962", "0.5844467", "0.5839994", "0.5836237", "0.58336866", "0.5828399", "0.5824521" ]
0.7812426
0
returns the list of available page layouts
def list_page_layouts(layouts=[]) if layouts.empty? layouts_path = Rails.root + "app/views/layouts" if Dir.exists? layouts_path Dir.foreach(layouts_path) do |file_name| if file_name.include? '.html.haml' layouts << File.basename(file_name,'.html.haml') elsif file_name.include? '.html.erb' layouts << File.basename(file_name,'.html.erb') end end end layouts << 'application' if layouts.empty? end layouts end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def available_layouts\n layouts = Array.new\n extension_dirs.each do |ext|\n Dir.entries(\"#{RAILS_ROOT}/vendor/extensions/#{ext}/app/views/layouts\").only_files.collect{ |e| layouts << e.scan(/\\w+/).first } if File.exist?(\"#{RAILS_ROOT}/vendor/extensions/#{ext}/app/views/layouts\")\n end\n\n layouts\n end", "def layouts\n raise Nanoc3::Errors::DataNotYetAvailable.new('Layouts', true) unless @layouts_loaded\n @layouts\n end", "def selectable_layouts(language_id, only_layoutpages = false)\n @language_id = language_id\n all.select do |layout|\n if only_layoutpages\n layout[\"layoutpage\"] && layout_available?(layout)\n else\n !layout[\"layoutpage\"] && layout_available?(layout)\n end\n end\n end", "def layouts\n @layouts || site.layouts\n end", "def multipage_layouts\n return @multipage_layouts\n end", "def page_layout\n @user = User.current\n @blocks = @user.pref[:my_page_layout] || DEFAULT_LAYOUT.dup\n @block_options = []\n BLOCKS.each do |k, v|\n unless @blocks.values.flatten.include?(k)\n @block_options << [l(\"my.blocks.#{v}\", :default => [v, v.to_s.humanize]), k.dasherize]\n end\n end\n end", "def page_layout\n @user = User.current\n @blocks = @user.pref[:my_page_layout] || DEFAULT_LAYOUT.dup\n @block_options = []\n BLOCKS.each do |k, v|\n unless @blocks.values.flatten.include?(k)\n @block_options << [l(\"my.blocks.#{v}\", :default => [v, v.to_s.humanize]), k.dasherize]\n end\n end\n end", "def page_layout\n @user = User.current\n @blocks = @user.pref.my_page_layout\n end", "def layout_list_with_engine_additions\n plugin_layouts = Rails.plugins.by_precedence.map do |p| \n File.join(p.root, \"app\", \"views\", \"layouts\")\n end\n layout_list_without_engine_additions + Dir[\"{#{plugin_layouts.join(\",\")}}/**/*\"]\n end", "def layouts; end", "def layouts; end", "def find_layouts(path)\n\t\t\tfind_files(path, layout_dirs)\n\t\t\t\t.select { |file| Tilt[file] }\n\t\t\t\t.sort! { |a, b| b.split('/').size <=> a.split('/').size }\n\t\tend", "def get_layouts(path)\n Dir.glob(File.join(path, \"*.yml\")).map { |file| File.basename(file).gsub(/\\..+$/, \"\") }.sort\n end", "def layout_for_page\n if params[:layout] == 'none' || params[:layout] == 'false'\n false\n else\n params[:layout] || 'application'\n end\n end", "def print_layout\n [print_layout_application,\n print_layout_landfill_operator, print_layout_waste_producer,\n print_layout_waste_water_details, print_layout_banned_from_landfill,\n print_layout_about_the_waste, print_layout_about_water_content, print_layout_water_treatment,\n print_layout_start_date,\n { code: :sites,\n type: :object },\n print_layout_supporting_document,\n print_layout_declaration]\n end", "def layouts_for_select(language_id, only_layoutpages = false)\n @map_array = []\n mapped_layouts_for_select(selectable_layouts(language_id, only_layoutpages))\n end", "def get_layout\n\tlogged_in? and :page_user or :page_visitor\nend", "def layouts\n @layouts ||= Subdomain.new.layouts\n end", "def index\n @maker_layouts = MakerLayout.all\n end", "def available_page_templates\n dirname = Rails.root.join('app/' + Option.theme_full_dir)\n templates = []\n Dir.foreach(dirname) do |filename|\n if filename.length > 19 + 1 && filename.slice(0, 9) == 'template_' && filename.slice(-10, 10) == '.html.haml'\n templates << filename.slice(9, filename.length - 19)\n end\n end\n templates\n end", "def get_page_layout(params)\n if params[:layout] == 'comatose_content'\n File.join(plugin_layout_path, params[:layout])\n else\n params[:layout]\n end\n end", "def layout_available?\n if !@_layout_available\n @_layout_available = @site.layouts.include? @layout\n end\n @_layout_available\n end", "def layout\n lookup_layout\n end", "def get_page_layout\n if params[:layout] == 'comatose_content'\n File.join(plugin_layout_path, params[:layout])\n else\n params[:layout]\n end\n end", "def layout_dirs\n @layout_dirs ||= begin\n [\n File.join(Dir.pwd, \"layouts\"),\n File.join(Dir.pwd, \"views/layouts\"),\n File.join(Dir.pwd, \"app/views/layouts\")\n ]\n end\n end", "def get_layout\n layout ||= Amz::Config[:layout] \n layout = Amz::Config[:amp_layout] \n # layout = Amz::Config[:mobile_layout] if browser.mobile?\n # layout = Amz::Config[:tablet_layout] if browser.tablet?\n layout\n end", "def default_layout\n site.config.page_layout\n end", "def page_pool\n\td = Dir.entries(settings.statics_folder.to_s)\n\td_filt = Array.new\n\td.each do |i|\n\t\n\tcase settings.deep_or_flat_structure\n\t\twhen 'flat'\n\t\t\tif i.include? \".html\"\n\t\t\t\td_filt << i\n\t\t\tend\n\t\twhen 'deep'\n\t\t\tif i.include? \"dir_\"\n\t\t\t\td_filt << i\n\t\t\tend\n\t\tend\n\tend\n\treturn d_filt\nend", "def FindsLayoutsForTemplate(input, options={})\n Benoit::Utils::FindsLayoutsForTemplate.new(input, options).lookup_layouts\nend", "def setup_layouts\n @content_layouts = []\n get_layouts(File.join(::Rails.root.to_s, 'app', 'views', 'layouts')).each do |layout|\n @content_layouts << OpenStruct.new(:name => layout.titleize, :value => layout)\n end\n end", "def render_all_layouts(layouts, payload, info); end", "def reserved_pages\n [initialize_requested_page_by_shortcut(home_shortcut), initialize_requested_page_by_shortcut(items_shortcut), initialize_requested_page_by_shortcut(inventory_shortcut), initialize_requested_page_by_shortcut(blogs_shortcut),\n initialize_requested_page_by_shortcut(calendars_shortcut), initialize_requested_page_by_shortcut(categories_shortcut), initialize_requested_page_by_shortcut(items_shortcut)].uniq.compact\n end", "def available_on_site?(layout)\n return false unless Alchemy::Site.current\n\n Alchemy::Site.current.definition.blank? ||\n Alchemy::Site.current.definition.fetch(\"page_layouts\", []).include?(layout[\"name\"])\n end", "def determine_layout\n return @__layout if @__layout\n return false if params[:_no_layout] || request.xhr?\n\n @__layout ||= current_page.layout.try(:template) if current_page.present? \n @__layout ||= 'application/default'\n @__layout\n end", "def index\n @user_layouts = UserLayout.all\n end", "def determine_layout\n 'akinu'\n end", "def get_layout\n layout ||= Spree::Frontend::Config[:layout]\n end", "def get_layout_metrics\n {\n method: \"Page.getLayoutMetrics\"\n }\n end", "def get_layout\n layout ||= Spree::Config[:layout]\n end", "def element_names_for(page_layout)\n if definition = get(page_layout)\n definition.fetch(\"elements\", [])\n else\n Rails.logger.warn \"\\n+++ Warning: No layout definition for #{page_layout} found! in page_layouts.yml\\n\"\n []\n end\n end", "def page_layout\n if @page\n if params[:popup]\n \"modal\"\n elsif !@page.layout.blank?\n @page.layout\n else\n choose_layout\n end\n else\n params[:popup] ? 'modal' : choose_layout\n end\n end", "def determine_layout\n mobile_request? ? mobile_layout : desktop_layout\n end", "def layout_for_page(page_number)\n page_key = layout_key_for_page(page_number)\n @layout_for[page_key]\n end", "def all_for_page(page)\n raise TypeError if page.class.name != \"Alchemy::Page\"\n # if page_layout has cells, collect elements from cells and group them by cellname\n page_layout = PageLayout.get(page.page_layout)\n if page_layout.blank?\n Alchemy::Logger.warn \"Could not find page_layout description for page: #{page.name}\", caller.first\n return []\n end\n elements_for_layout = []\n elements_for_layout += all_definitions_for(page_layout['elements'])\n return [] if elements_for_layout.blank?\n # all unique and limited elements from this layout\n limited_elements = elements_for_layout.select{ |m| m[\"unique\"] == true || (m[\"amount\"] > 0 unless m[\"amount\"].nil?) }\n elements_already_on_the_page = page.elements.not_trashed\n # delete all elements from the elements that could be placed that are unique or limited and already and the page\n elements_counts = Hash.new(0)\n elements_already_on_the_page.each { |e| elements_counts[e.name] += 1 }\n limited_elements.each do |limited_element|\n next if elements_counts[limited_element[\"name\"]] == 0\n if limited_element[\"unique\"]\n elements_for_layout.delete(limited_element) if elements_counts[limited_element[\"name\"]] > 0\n next\n end\n unless limited_element[\"amount\"].nil?\n elements_for_layout.delete(limited_element) if elements_counts[limited_element[\"name\"]] >= limited_element[\"amount\"]\n end\n end\n elements_for_layout\n end", "def index\n @tbl_layouts = TblLayout.all\n\n end", "def print_layouts\n STDOUT.puts @layouts.join(\"\\n\")\n exit 0\n end", "def read_layouts\n base, entries = folder_info(\"_layouts\")\n\n entries.each do |f|\n name = f.split(\".\")[0..-2].join(\".\")\n self.layouts[name] = Layout.new(self, base, f)\n end\n rescue Errno::ENOENT => e\n # ignore missing layout dir\n end", "def index\n @layouts = Layout.with_permissions_to(:index).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @layouts }\n end\n end", "def get_layout_from_params\n params[:layout] ? params[:layout] : 'application' \n end", "def index\n respond_with @layouts\n end", "def layout_for(page_range = :all)\n yield(@layout_for[page_range]) if block_given?\n @layout_for[page_range]\n end", "def index\n @page_layouts = PageLayout.order(\"id ASC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @page_layouts }\n end\n end", "def layouts_path\n @layouts_path || root / 'layouts'\n end", "def layout\n return @layout if @layout\n return if no_layout?\n\n @layout = site.layouts[data.layout].tap do |layout|\n unless layout\n Bridgetown.logger.warn \"Generated Page:\", \"Layout '#{data.layout}' \" \\\n \"requested via #{relative_path} does not exist.\"\n end\n end\n end", "def wiselinks_layout\n 'layouts/application'\n end", "def layout\n case @mode\n when :injector\n \"injector\"\n when :page\n \"application\"\n else\n false\n end\n end", "def static_layout\n nil\n end", "def dynamic_layout\n # ALL THIS SUCKS, I KNOW..\n \n # No layout for AJAX calls\n @layout = if request.xhr? \n nil\n # dialog param = lightview popup\n elsif params[:dialog]\n 'dialog'\n # uses user 'role' name for layout ... bad\n elsif current_user && !current_user.role.nil?\n current_user.role.downcase\n # no user, check for 'about' action\n elsif controller_name == 'about'\n 'about'\n # none of the above, use Rails default\n else\n 'home'\n end\n return nil unless @layout\n \n Rails.logger.debug \"Dyamic layout = #{@layout}\"\n # Layouts further divided by site subdomain: www vs vault\n if current_subdomain == 'vault'\n # Then public vs logged in...ugh\n if current_user\n @layout = 'vault/private/' + @layout\n else\n @layout = 'vault/public/' + @layout\n end\n end\n @layout\n end", "def available_widgets\n options = {:page_template => page.page_template, :block => block_type}\n UbiquoDesign::Structure.get(options)[:widgets].map(&:keys).flatten\n end", "def layout_by_resource\n \"admin_layout\"\n end", "def load_layouts\n @layouts = []\n data_sources.each do |ds|\n layouts_in_ds = ds.layouts\n layouts_in_ds.each { |i| i.identifier = File.join(ds.layouts_root, i.identifier) }\n @layouts += layouts_in_ds\n end\n\n @layouts_loaded = true\n end", "def [](layout_name)\n layouts[layout_name]\n end", "def read_layouts\n base = options['layouts_path']\n entries = []\n Dir.chdir(base) { entries = filter_entries(Dir['*.*']) }\n \n entries.each do |f|\n name = f.split(\".\")[0..-2].join(\".\")\n self.layouts[name] = Layout.new(base, f)\n end\n rescue Errno::ENOENT => e\n # ignore missing layout dir\n end", "def elements_for_layout(layout)\n elements = []\n layout_elements = PageLayout.get(layout)[\"elements\"]\n return Element.descriptions if layout_elements == \"all\"\n Element.descriptions.each do |element|\n if layout_elements.include?(element[\"name\"])\n elements << element\n end\n end\n elements\n end", "def index\n @match_layouts = MatchLayout.all\n end", "def read_layouts\n self.layouts = []\n layouts_dir = File.join(source_path, \"layouts\")\n entries = Dir.entries(layouts_dir).reject{|f| File.directory?(f)}\n entries.each do |name|\n self.layouts << Layout.new(layouts_dir, name)\n end\n end", "def layout\n @layout\n end", "def layouts_file_path\n Rails.root.join \"config/alchemy/page_layouts.yml\"\n end", "def layouts_file_path\n Rails.root.join \"config/alchemy/page_layouts.yml\"\n end", "def layout\n nil\n end", "def read_layouts\n base = File.join(self.source, \"_layouts\")\n entries = Dir.entries(base)\n entries = entries.reject { |e| e[-1..-1] == '~' }\n entries = entries.reject { |e| File.directory?(File.join(base, e)) }\n \n entries.each do |f|\n name = f.split(\".\")[0..-2].join(\".\")\n self.layouts[name] = Layout.new(base, f)\n end\n rescue Errno::ENOENT => e\n # ignore missing layout dir\n end", "def layout \n return @layout\n end", "def mapped_layouts_for_select(layouts)\n layouts.each do |layout|\n @map_array << [human_layout_name(layout[\"name\"]), layout[\"name\"]]\n end\n @map_array\n end", "def default_layout_for_request\n return params[:__layout] if params[:__layout]\n return params[:layout] if params[:layout]\n 'application'\n end", "def discover_paginate_templates(site_pages)\r\n candidates = []\r\n site_pages.select do |page|\r\n # If the page has the enabled config set, supports any type of file name html or md\r\n if page.data['pagination'].is_a?(Hash) && page.data['pagination']['enabled']\r\n candidates << page\r\n end\r\n end\r\n return candidates\r\n end", "def read_layouts\n base = File.join(self.source, \"_layouts\")\n entries = Dir.entries(base)\n entries = entries.reject { |e| File.directory?(e) }\n \n entries.each do |f|\n name = f.split(\".\")[0..-2].join(\".\")\n self.layouts[name] = Layout.new(base, f)\n end\n rescue Errno::ENOENT => e\n # ignore missing layout dir\n end", "def read_layouts\n base = File.join(self.source, \"_layouts\")\n entries = Dir.entries(base)\n entries = entries.reject { |e| File.directory?(e) }\n \n entries.each do |f|\n name = f.split(\".\")[0..-2].join(\".\")\n self.layouts[name] = Layout.new(base, f)\n end\n rescue Errno::ENOENT => e\n # ignore missing layout dir\n end", "def layout_by_resource\n if devise_controller? # Devise helper that returns true if the Controller it's a Devise\n \"backoffice_devise\"\n else\n \"application\"\n end\n end", "def folder_layout\n @config.get_value('FOLDER_LAYOUT')\n end", "def custom_layout\n case action_name\n when \"industry_xls\"\n \"no_layout\"\n when \"supplier_profiles\"\n \"no_layout\"\n when \"total_xls\"\n \t \"no_layout\"\n when \"industry_level\"\n \"no_layout\"\n when \"supplier_level\"\n \"no_layout\"\n when \"company_xls\"\n \t\"no_layout\"\n when \"customer_record\"\n \t\"no_layout\"\n when \"most_company_xls\"\n \t\"no_layout\"\n when \"conversion_industry\"\n \t\"no_layout\"\n when \"conversion_company\"\n \t\"no_layout\"\n when \"company_xls\"\n \t\"no_layout\"\t\n when \"suppliers_profiles\"\n \t\"no_layout\"\n when \"registered_suppliers\"\n \t\"no_layout\"\n when \"unregistered_suppliers\"\n \t\"no_layout\"\n when \"all_customers\"\n \t\"no_layout\"\n when \"jagent\"\n \t\"no_layout\"\n when \"sagent\"\n \t\"no_layout\"\n when \"poll\"\n \"no_layout\"\t\n when \"industry_conversion\"\n \"no_layout\"\t\n when \"company_conversion\"\t\t\n \"no_layout\"\n when \"reviews_processed\"\n \"no_layout\"\n when \"agent_output\"\n \"no_layout\"\n when \"agent_performance\"\n \"no_layout\"\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n else\n \"admin\"\n end\n end", "def layout_by_resource\n if devise_controller? && resource_name == :client\n 'public'\n else\n 'lims'\n end\n end", "def layouts_by_resource\n if devise_controller? && resource_name == :user && action_name == \"edit\"\n \"dashboard\"\n elsif controller_name == \"posts\" && [\"edit\",\"new\",\"index\"].include?(action_name)\n \"dashboard\"\n else\n \"application\"\n end\n end", "def get_pages\n sitemap.resources.select { |resource| resource.data.type == 'page' }\n .sort_by { |r| get_page_priority(r.data) }\n end", "def all_layout_packages(validate = true)\n default_packages(validate)\n end", "def layout_by_resource\n\t\tif devise_controller?\n\t\t\t\"dashboard\"\n\t\telse\n\t\t\t\"application\"\n\t\tend\n\tend", "def layout_name\n umlaut_config.search_layout\n end", "def layout\n nil\n end", "def print_layout_supporting_document\n return if application_type == 'LO-WD'\n\n { code: :supporting_documents, # section code\n key: :title, # key for the title translation\n key_scope: %i[applications slft supporting_documents], # scope for the title translation\n divider: true, # should we have a section divider\n display_title: true, # Is the title to be displayed\n type: :list, # type list = the list of attributes to follow\n list_items: [{ code: :supporting_document_list, lookup: true, format: :list }] }\n end", "def layout\n properties[:layout]\n end", "def layout_name\n controller = @tracker.controllers[@current_class]\n\n return controller[:layout] if controller[:layout]\n return false if controller[:layout] == false\n\n app_controller = @tracker.controllers[:ApplicationController]\n\n return app_controller[:layout] if app_controller and app_controller[:layout]\n\n nil\n end", "def index \n @layout = Layout.find(params[:layout_id])\n @layout_fields = @layout.layout_fields.paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @layout_fields }\n end\n end", "def layout_by_resource\n if devise_controller?\n \"devise_layout\"\n else\n \"application\"\n end\n end", "def layout\n self.class.layout || @app.layout\n end", "def choose_layout\n Rails.configuration.blog.layout\n end", "def layout_available?(layout)\n !layout[\"hide\"] && !already_taken?(layout) && available_on_site?(layout)\n end", "def allow_layout?\n true\n end", "def determine_layout\n ['show'].include?(action_name) ? 'application' : nil \n end", "def default_layout\n nil\n end", "def layout_tags\n unless @layout_tags\n @layout_tags = Array.new\n layout_config[\"groups\"].each do |group, gdata|\n gdata[\"all_tags\"].each do |tag, tdata|\n @layout_tags.push tag\n end\n end\n @layout_tags.uniq!\n @layout_tags.sort!\n end\n @layout_tags \n end", "def layout_by_resource\n if devise_controller?\n \"landing\"\n else\n \"application\"\n end\n end" ]
[ "0.71930134", "0.7095451", "0.6915558", "0.6800581", "0.6614504", "0.6593947", "0.6593947", "0.6562008", "0.6546522", "0.6284322", "0.6284322", "0.62566537", "0.61939174", "0.6190009", "0.6176771", "0.6161486", "0.61513245", "0.6150834", "0.6150793", "0.61333925", "0.61264974", "0.6121106", "0.6030176", "0.6015171", "0.5999625", "0.5977219", "0.5974081", "0.59420305", "0.5938308", "0.59350276", "0.5933423", "0.59111077", "0.5884522", "0.58590746", "0.5832248", "0.5815469", "0.5811871", "0.58097196", "0.58076483", "0.57797575", "0.5776935", "0.57649916", "0.57649815", "0.5760789", "0.5759448", "0.5752466", "0.57333416", "0.57280797", "0.57242364", "0.56965965", "0.5692343", "0.56886667", "0.5682632", "0.5668739", "0.5657221", "0.5653955", "0.5640742", "0.5637324", "0.563072", "0.5622572", "0.56180257", "0.56177336", "0.5594309", "0.5593022", "0.55865026", "0.55859923", "0.5578601", "0.55760914", "0.55760914", "0.5574", "0.5569781", "0.55679303", "0.5559887", "0.5556085", "0.5555125", "0.555409", "0.555409", "0.5547484", "0.5544371", "0.55237466", "0.5523683", "0.5507655", "0.5505741", "0.54932034", "0.5487541", "0.54875124", "0.5477157", "0.547377", "0.5468067", "0.54666364", "0.5464788", "0.545519", "0.5449566", "0.544877", "0.5447072", "0.5446249", "0.5444843", "0.54439616", "0.54332393", "0.5423562" ]
0.74132097
0
Compares two die values from AllowedDice, useable for +sort+ _if_ you use it with a block. i.e.: [:d6, :d10, :d8].sort do |d1, d2| compare_dice(d1, d2) end => [:d6, :d8, :d10]
def compare_dice(die1, die2) idx1 = AllowedDiceOrder.index(die1) idx2 = AllowedDiceOrder.index(die2) # This handles values -not- in AllowedDice idx1 = -1 if idx1.nil? idx2 = -1 if idx2.nil? return idx1 <=> idx2 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort_dice(dice=[])\n return [] if not dice.is_a?(Array)\n return dice.sort {|d1, d2| compare_dice(d1, d2) }\n end", "def score_dice(dice)\n score(dice_values(dice))\n end", "def scorelist(roll)\n #return a hash that shows all the possible scores for these dice, sorted\n categories = ['yahtzee','fourk','house','threek', \n 'n6', 'n5', 'n4', 'n3', 'n2', 'n1', 'small' ,'large', 'chance']\n scores = {}\n categories.each do |entry|\n #populate the hash\n scores[entry] = eval(\"#{entry}(#{roll})\")\n end\n return scores.sort_by{|k,v| v}.reverse\nend", "def score(dice)\n score = 0\n # n refers to an array which members are non-special die faces except when occurring three times in a roll of three or more.\n n = [2,3,4,6]\n # Creates an empty hash referred to as scorer with default value of zero\n scorer = Hash.new(0)\n # Iterates through the dice roll and creates a key/value pair in scorer\n # where the key is the die face and the value is increased by one for every occurrence of that die face\n dice.each do |die| scorer[die] += 1\n end\n # Iterates through the hash scorer, looking for the key 1 with a value equal to or greater than 3.\n if scorer[1] >= 3\n # 1000 is added to score for 3 occurrences of die face 1, and 100 is added for each additional occurrence.\n score += 1000+(100*(scorer[1]-3))\n # If the value of the key 1 is less than 3 it adds 100 to score for every occurrence of the die face 1.\n elsif scorer[1] < 3\n score += scorer[1]*100\n end\n # Iterates through the hash scorer, looking for the key 5 with a value equal to or greater than 3.\n if scorer[5] >= 3\n # 500 is added to score for 3 occurrences of die face 5, and 50 is added for each additional occurrence.\n score += 500+(50*(scorer[5]-3))\n # If the value of the key 5 is less than 3 it adds 50 to score for every occurrence of the die face 5.\n elsif scorer[5] < 3\n score += scorer[5]*50\n end\n# Iterates through array referred to as n.\n n.each do |x|\n if scorer[x] == 3\n score += x * 100\n end\n end\n # Returns the value of score after all the die values have been summed.\n score\nend", "def compare_cards(cards1, cards2)\n\t\tcards1.each_index do |i| \n\t\t\tsort_score = (cards1[i] <=> cards2[i])\n\t\t\treturn sort_score unless sort_score.zero?\n\t\tend\n\t\t\n\t\t0\n\tend", "def dice_outcomes(dice, rolls)\n outcomes = []\n rolls.times do |roll|\n outcomes << roll_dice(dice)\n end\n occurences = outcomes.each_with_object(Hash.new(0)) do |outcome, count|\n count[outcome] += 1\n end\n occurences.sort.map do |key, val|\n outcome = \"\"\n val.times do\n outcome << '#'\n end\n $stdout.puts \"#{key}: #{outcome}\"\n end\nend", "def roll_dice(dice, num_dice)\n dice.roll(num_dice)\n values = dice.values\n puts \"Your dice values: #{values}\"\n roll_score = dice.score(values)\n puts \"Roll score #{roll_score}\"\n [roll_score, values]\n end", "def compare_kickers(other)\n @kickers.zip(other.kickers) do |a_kicker, b_kicker|\n return 1 if a_kicker.index > b_kicker.index\n return -1 if a_kicker.index < b_kicker.index\n end\n return 0\n end", "def sort_actors(x, y)\n if x < y\n result = -1\n elsif x > y\n result = 1\n elsif x == y\n result = 0\n end\n \n return result\n end", "def sort_bound(a, b, c, d)\n if (a < c)\n if (b < d)\n temp = [a, b, c, d]\n else\n temp = [a, d, c, b]\n end\n else\n if (b < d)\n temp = [c, b, a, d]\n else\n temp = [c, d, a, b]\n end\n end\n return temp\n end", "def compare(x, y); end", "def diceGame()\n player1Score = 0\n player2Score = 0\n \n while player1Score<2&&player2Score<2 do\n random_number1 = rand(6)+1 + rand(6)+1\n random_number2 = rand(6)+1 + rand(6)+1\n \n puts \"player1: \" + random_number1.to_s\n puts \"player2: \" + random_number2.to_s\n \n if random_number1 > random_number2\n player1Score = player1Score + 1\n else\n player2Score = player2Score + 1\n end \n end\n\n puts \"player1 Score: \" + player1Score.to_s\n puts \"player2 Score: \" + player2Score.to_s\n\n if player1Score == 2\n return true\n else\n return false\n end\nend", "def compare_kickers(other)\n kicker_cards.each_with_index do |kicker, i|\n other_kicker = other.kicker_cards[i]\n compared_by_kicker = kicker <=> other_kicker\n return compared_by_kicker unless compared_by_kicker == 0\n end\n 0\n end", "def challenge(args)\n @dice_bag.select { |d| d == args[:value] }.size == args[:dice]\n end", "def compare_further p1hand, p2hand, rank, secondary\n p1values = p1hand.map{|c| $value_map[c[0]]}.sort\n p2values = p2hand.map{|c| $value_map[c[0]]}.sort\n # no further comparison if it's a straight\n return 0 if rank == 9 || rank == 8 || rank == 4\n if rank == 7 # four of a kind\n comp1 = (p1values[0] == secondary ? p1values[4] : p1values[0])\n comp2 = (p2values[0] == secondary ? p2values[4] : p2values[0])\n return 1 if comp1 > comp2\n return 2 if comp2 > comp1\n return 0\n end\n if rank == 6 # full house\n comp1 = (p1values - [secondary]).uniq[0]\n comp2 = (p2values - [secondary]).uniq[0]\n return 1 if comp1 > comp2\n return 2 if comp2 > comp1\n return 0\n end\n if rank <= 5 # all remaining ranks\n comp1 = (p1values - [secondary]).uniq.reverse\n comp2 = (p2values - [secondary]).uniq.reverse\n comp1.each_with_index do |e,i|\n return 1 if e > comp2[i]\n return 2 if comp2[i] > e\n end\n return 0\n end\nend", "def sort\n @cards.sort_by {|card| card.poker_value}\n end", "def determine_winner\n @active_players.sort! do |player1, player2|\n if player1.strongest_hand > player2.strongest_hand\n -1\n elsif player1.strongest_hand < player2.strongest_hand\n 1\n else\n 0\n end\n end\nend", "def winner &block\n if block_given?\n @hands.sort(&block)\n end\n end", "def dominant_sort(fish)\n return fish if fish.length <= 1\n\n mid = fish.length / 2\n\n left = fish[0...mid]\n right = fish[mid..-1]\n\n left_sorted = dominant_sort(left)\n right_sorted = dominant_sort(right)\n\n sorted = dominant_merge(left_sorted, right_sorted)\nend", "def candidate_events_sorted\n # TODO: rewrite using event states\n candidate_events.sort do |ce1, ce2|\n # in order for this to work due_dates should not be nil.\n # if they are move them to the top so admin can give them\n # one.\n if ce1.due_date.nil?\n if ce2.due_date.nil?\n ce1.event_key <=> ce2.event_key\n else\n -1\n end\n elsif ce2.due_date.nil?\n 1\n elsif ce1.completed_date.nil?\n # due_dates filled in.\n if ce2.completed_date.nil?\n # if neither completed then the first to come\n # due is first\n due_date = ce1.due_date <=> ce2.due_date\n if due_date.zero?\n ce1.event_key <=> ce2.event_key\n else\n due_date\n end\n else\n # non completed goes on top.\n -1\n end\n elsif ce2.completed_date.nil?\n # non completed goes on top.\n 1\n else\n # if both are completed then the first to come\n # due is on top\n due_date = ce1.due_date <=> ce2.due_date\n if due_date.zero?\n ce1.event_key <=> ce2.event_key\n else\n due_date\n end\n end\n end\n end", "def dealer_method\n\tdcard1 = deck.sample\n\tdcard2 = deck.sample\n\tputs \"The dealer's cards are #{dcard1} and #{dcard2}. His total is currently #{dealer_total}\"\n\t\tif dealer_total > 21\n\t\t\tputs \"Dealer Busts\"\n\t\telsif dealer_total < 17 \n\t\t\tputs \"Dealer needs to draw\"\n\t\t\tdealer_draw\n\t\telse dealer_total >= 17 && dealer_total <= 21 \n\t\t\tcompare_method \n\t\tend \nend", "def tie_breaker_multi hand2\n values1 = values.sort.reverse\n values2 = hand2.values.sort.reverse\n 4.downto(1).each do |num|\n pick1 = values1.select {|card| values1.count(card) == num}\n pick2 = values2.select {|card| values2.count(card) == num}\n return pick1 <=> pick2 if pick1 != pick2\n end\n 0 # hands are identical\n end", "def score( dice )\n total_score = 0\n hash = Hash.new(0)\n dice.each {|x| hash[x] += 1}\n total_score += hash[1] < 3 ? hash[1] * 100 : 1000 + (hash[1] - 3) * 100\n total_score += hash[5] < 3 ? hash[5] * 50 : 500 + (hash[5] -3) * 50\n total_score += hash[6] > 2 ? 600 : 0\n total_score += hash[4] > 2 ? 400 : 0\n total_score += hash[3] > 2 ? 300 : 0\n total_score += hash[2] > 2 ? 200 : 0\n total_score\n end", "def dice_outcomes(die=1, rolls=1)\n\tresults = Hash.new(0)\n\n\t# Roll the dice rolls times and track the sums in hash\n\trolls.times do \n\t\tresults[roll_dice(die)] += 1 # Utilize existing function! Ruby will evaluate L side first\n\tend\n\n\t# Print out number each possible outcome occurred\n\t(1..(6*die)).each do |key|\n\t\tputs \"#{key}: \" + \"\\#\"*results[key]\n\tend\nend", "def dice_results\r\n Array.new(number_of_dice) { rand(1..number_of_sides) }\r\n end", "def comparaData(d1, d2)\n count = 0;\n arr_d1 = d1.split(\"-\")\n arr_d2 = d2.split(\"-\")\n arr_d1.each do\n\n if arr_d1[count] > arr_d2[count]\n return 0\n end\n if arr_d1[count] < arr_d2[count]\n return 1\n end\n count += 1\n end\n return 0\n end", "def compare_dates(a, b)\n if a[6...10] > b[6...10]\n return 1\n elsif a[6...10] == b[6...10]\n if a[0...2] > b[0...2]\n return 1\n elsif a[0...2] == b[0...2]\n if a[3...5] > b[3...5]\n return 1\n elsif a[3...5] == b[3...5]\n return 0\n else\n return -1\n end\n else\n return -1\n end\n else\n return -1\n end\n\n end", "def fighter_order\n [fighter1, fighter2].shuffle\n end", "def score( dice )\n @result = []\n values = [*1..6]\n values.each do |i|\n if dice.count(i) >= 3\n case i\n when 1\n result << 1000\n when 2\n result << 200\n when 3\n result << 300\n when 4\n result << 400\n when 5\n result << 500\n when 6\n result << 600\n end\n if (dice.count(i) - 3) > 0\n case i\n when 1\n result << 100 * (dice.count(1) - 3)\n when 5\n result << 50 * (dice.count(5) - 3)\n end\n end\n else\n once_check(i)\n # case i\n # when 1\n # result << 100 * dice.count(1)\n # when 5\n # result << 50 * dice.count(5)\n # end\n end\n end\n result.sum\nend", "def roll_dice(sides, dice)\n\tfor i in 1..dice\n\t\tresult = 1 + rand(sides)\n\t\tif result == sides\n\t\t\t# this is fixed \n\t\t\tputs result.to_s.red\n\t\telse\n\t\t\tputs result\n\t\tend\n\tend\nend", "def compare(a, b)\n comparator.call a, b\n end", "def compare(hand1, hand2)\n return 1 if HANDS[hand1.type] < HANDS[hand2.type]\n return -1 if HANDS[hand1.type] > HANDS[hand2.type]\n\n normalize(hand1)\n normalize(hand2)\n\n case hand1.type\n when :straight_flush, :straight\n indexes = [0]\n when :four_of_a_kind, :full_house\n indexes = [0, 4]\n when :flush, :high_card\n indexes = (0..4).to_a\n when :three_of_a_kind\n indexes = (2..4).to_a\n when :two_pair\n indexes = [0, 2, 4]\n when :one_pair\n indexes = [0, 2, 3, 4]\n end\n\n indexes.each do |i|\n next if hand1.cards[i].rank == hand2.cards[i].rank\n return hand1.cards[i].rank - hand2.cards[i].rank\n end\n\n 0\n end", "def straight?(dice)\n ([1, 2, 3, 4, 5, 6] - dice) == []\n end", "def sort(*arguments, &block)\n data.sort(*arguments, &block)\n end", "def dice_roller2\n (1..6).each do |roll1|\n (1..6).each do |roll2|\n puts \"#{roll1} #{roll2}\"\n end\n end\nend", "def comp(array1, array2)\n p array1\n p array2\n if array1.nil? || array2.nil?\n return false\n else\n array2 = array2.map { |num| Math.sqrt(num) }\n p array1.sort\n p array2.sort\n array1.sort == array2.sort\n end\nend", "def e5115_sublinear_sort(values)\n end", "def dice_values(dice)\n values = []\n Cube.find(dice).each do |die|\n values << die.face\n end\n values\n end", "def dominant_eat(fishes)\n prc = Proc.new { |x, y| y.length <=> x.length}\n largest_sorted = fish.merge_sort(&prc)\n largest_sorted[0]\n end", "def tie_breaker_single hand2\n values.sort.reverse <=> hand2.values.sort.reverse\n end", "def test_sort\n\n a_plus = Grade.new(\"A+\")\n a = Grade.new(\"A\")\n b_minus = Grade.new(\"B-\")\n\n ordered = [a_plus,b_minus, a].sort # should return [a, a_plus]\n\n assert(ordered[0] == b_minus)\n assert(ordered[1] == a)\n assert(ordered[2] == a_plus)\n\n end", "def sort_defined_names(names) # :nodoc:\n names.sort do |a, b|\n name_a = normalise_defined_name(a[0])\n name_b = normalise_defined_name(b[0])\n sheet_a = normalise_sheet_name(a[2])\n sheet_b = normalise_sheet_name(b[2])\n # Primary sort based on the defined name.\n if name_a > name_b\n 1\n elsif name_a < name_b\n -1\n elsif sheet_a >= sheet_b # name_a == name_b\n # Secondary sort based on the sheet name.\n 1\n else\n -1\n end\n end\n end", "def sort_students(students, comparator)\n students.sort do |x,y|\n comparator.call(x) <=> comparator.call(y)\n end\nend", "def comparePrice(x,y)\n if x.price < y.price\n result = -1\n elsif x.price > y.price\n result = 1\n elsif x.price == y.price\n result = 0\n end\n \n # Switch when in descendant order\n case @order\n when 1\n result *= -1 \n end\n \n return result\n end", "def compare\n if self.terms.all? { |t| t.results[:count] }\n @winner, @loser = self.count_winner_loser\n elsif self.terms.all? { |t| t.results[:seconds] }\n @winner, @loser = terms.sort_by { |t| t.results[:seconds] }\n else\n @winner = terms.select { |t| t.results[:seconds]}[0]\n @loser = terms.select { |t| t.results[:count]}[0]\n end\n end", "def score(dice)\n # I like it better as a string\n dice = dice.sort.join if dice.is_a?(Array)\n \n # find a scoring pattern, figure out its value\n # then remove those dice\n regexp, value = VALUES.detect() {|v| dice =~ v.first}\n dice.sub!(regexp, \"\")\n \n # I did it recursively just for fun\n return value if value == 0\n value + score(dice)\nend", "def bubble_sort_by!(&_block)\n if block_given?\n bubble_sort! do |a, b|\n yield(a) <=> yield(b)\n end\n else\n to_enum :bubble_sort_by!\n end\n end", "def sort_cards_by_value!()\r\n\t\taucun_echange=false\r\n\t\twhile aucun_echange==false\r\n\t\t\taucun_echange=true\r\n\t\t\tlen=@list.length-2\r\n\t\t\tfor i in 0..len\r\n\t\t\t\tif !@list[i].nil? and !@list[i+1].nil?\r\n\t\t\t\t\tif @list[i].get_value<@list[i+1].get_value\r\n\t\t\t\t\t\ttemp=@list[i]\r\n\t\t\t\t\t\t@list[i]=@list[i+1]\r\n\t\t\t\t\t\t@list[i+1]=temp\r\n\t\t\t\t\t\taucun_echange=false\r\n\t\t\t\t\t\tbreak\r\n\t\t\t\t\telsif @list[i].get_value == @list[i+1].get_value\r\n\t\t\t\t\t\t@list.delete_at(i)\r\n\t\t\t\t\t\taucun_echange=false\r\n\t\t\t\t\t\tbreak\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\tend\r\n\tend", "def sort\n sorted = []\n\n # Iterate Over Array Length\n array_length.times do\n m = randomized_array[0]\n mi = 0\n\n # Iterate over collection and compare the first element in the collection\n # Change the value of variable m if iterated value is less than the initial value\n # Our goal is to set the lowest value as variable m's value\n randomized_array.each_with_index do |value, idx|\n if value < m\n m = value\n mi = idx\n end\n end\n # Remove the lowest value from the original collection and append into new\n # collection\n randomized_array.delete_at mi\n sorted << m\n end\n\n sorted\n end", "def sort_cards_by_same_value()\r\n\t\tresult=Array.new\r\n\t\tfor i in 2..14\r\n\t\t\tresult[i]=CardList.new\r\n\t\tend\r\n\t\t@list.each{|x| result[x.get_value].add_card(x)}\r\n\t\treturn result\r\n\tend", "def sort\n sorted = {}\n \n roster.each do |grades, students|\n sorted[grades] = students.sort\n end\n sorted\n # binding.pr\n end", "def <=>(other)\n suit_order = [0,1,3,2]\n suit_compare = suit_order.index(@suit) <=> suit_order.index(other.suit)\n if suit_compare == 0\n return @value <=> other.value\n else\n return suit_compare\n end\n end", "def odd_sort array\n # create a variable that selects the odd numbers from the aray\n only_odd_numbers = array.select do |value|\n value.is_a?(Numeric) && value.odd?\n end\n #sort this variable from least to greatest\n only_odd_numbers.sort\nend", "def cmp(a, b)\n return 0 if a == b\n if a.is_a?(Integer) && b.is_a?(Integer)\n return a < b ? -1 : 1\n end\n return cmp([a], b) if a.is_a?(Integer)\n return cmp(a, [b]) if b.is_a?(Integer)\n\n len = [a.length, b.length].min\n len.times do |i|\n val = cmp(a[i], b[i])\n return val if val != 0\n end\n a.count <= b.count ? -1 : 1\nend", "def two(array)\n array.sort\nend", "def cmp2(a,b)\n\t\t@order*@sort.call(*(@sort_by ? [@sort_by.call(a), b] : [a, b]))\n\tend", "def roll\n dice_sides = [1, 2, 3, 4, 5, 6]\n dice_sides.sample\nend", "def dice_outcomes(dice = 1, rolls = 1)\n# I used an array method instead of a hash method as I found it easier to match the example output chart\n tracker = 0\n copies = []\n# first create an arry of all outcomes called copies\n while rolls > tracker\n growth = 0\n outcome = 0\n while dice > growth\n outcome += 1 + rand(6)\n growth += 1\n end\n copies << outcome\n tracker += 1\n end\n unique = []\n chart = []\n limit = 0\n# now create an array of the unique values in the copies array called unique\n copies.each do |original|\n if !unique.include?(original)\n unique << original\n end\n end\n unique.sort!\n# delete the unique values from the copies array so only the duplicate values remain\n unique.each do |del|\n copies.delete_at(copies.index(del))\n end\n# format the values of the copies and unique arrays for display in the chart array\n unique.map { |formaty|\n chart << (formaty.to_s + \": #\")\n }\n copies.each do |hashify|\n hashy = chart[unique.index(hashify)]\n hashy.replace(hashy + \"#\")\n end\n puts \"#{dice.to_s} dice were rolled #{rolls} times to produce the following results\"\n puts chart\nend", "def <=>(hand)\n result = set_tiers[self.tier] <=> set_tiers[hand.tier]\n \n return result unless result == 0\n ke_sort(self.numbers) <=> ke_sort(hand.numbers)\n end", "def sort\r\n @roster.each do |key, value|\r\n value.sort!\r\n end\r\n end", "def promedio(visitas_mes1 ,visitas_mes2)\n promedio_mes1 = visitas_mes1.sum / visitas_mes1.count\n\n promedio_mes2 =visitas_mes2.sum / visitas_mes2.count\n\n puts promedio_mes1\n puts promedio_mes2\n\n\n if promedio_mes1 > promedio_mes2\n puts promedio_mes1\n return promedio_mes1\n else\n puts promedio_mes2\n return promedio_mes2\n end\n\nend", "def sort_items_in_day(items)\n items.sort do |a,b|\n sign_a = a.allday? ? 0 : 1\n sign_b = b.allday? ? 0 : 1\n\n if sign_a != sign_b\n sign_a - sign_b\n else\n a <=> b\n end\n end\n end", "def sort_items_in_day(items)\n items.sort do |a,b|\n sign_a = a.allday? ? 0 : 1\n sign_b = b.allday? ? 0 : 1\n\n if sign_a != sign_b\n sign_a - sign_b\n else\n a <=> b\n end\n end\n end", "def getDiceRoll()\n\tdie1 = rand(Diemaxroll - (Dieminroll - 1)) + Dieminroll\n\tdie2 = rand(Diemaxroll - (Dieminroll - 1)) + Dieminroll\n\treturn die1 + die2\nend", "def sorted_random()\n arr = 10.times.map{ 55 + Random.rand(46) }.sort\n p arr\n p arr[0]\n p arr[9]\nend", "def move_dice(temp_a, temp_b, temp_c, temp_d, player_a, player_b, player_c, player_d)\n\t\tif temp_d.size > 0\n\t\t\ttemp_d.each do |k, v|\n\t\t\t\tplayer_a.store(k,v)\n\t\t\tend\n\t\tend\n\n\t\tif temp_a.size > 0\n\t\t\ttemp_a.each do |k, v|\n\t\t\t\tplayer_b.store(k,v)\n\t\t\tend\n\t\tend\n\n\t\tif temp_b.size > 0\n\t\t\ttemp_b.each do |k, v|\n\t\t\t\tplayer_c.store(k,v)\n\t\t\tend\n\t\tend\n\n\t\tif temp_c.size > 0\n\t\t\ttemp_c.each do |k, v|\n\t\t\t\tplayer_d.store(k,v)\n\t\t\tend\n\t\tend\n\n\t\tputs ' ', 'After dice moved/removed'\n\t\tputs '-------------------------'\n\t\tdisplay(player_a, player_b, player_c, player_d)\n\tend", "def sort_tickets(tickets)\n tickets.select { |ticket| in_range?(ticket_values(ticket).uniq, @f_ranges.flatten.uniq) }\n end", "def sort_cards\n hearts = []\n spades = []\n clubs = []\n diamonds = []\n\n # Sort each card into its corresponding suit array\n @cards.each do |card|\n case card.suit\n when :hearts\n hearts << card\n when :spades\n spades << card\n when :clubs\n clubs << card\n when :diamonds\n diamonds << card\n end\n end\n\n # Cards need to be in descending order, so sort\n # then reverse the arrays\n hearts.sort!.reverse!\n spades.sort!.reverse!\n clubs.sort!.reverse!\n diamonds.sort!.reverse!\n\n # Combine all suit arrays in order\n @cards = hearts + spades + clubs + diamonds\n end", "def <=>(other)\n return super if self.class != other.class\n @pair.each_with_index do |card, i|\n compare = (other.pair[i].rank_compare card)\n return compare if compare != 0\n end\n compare_kickers(@kickers, other.kickers)\n end", "def compare_numbers(n1, n2)\r\n\tif n1>n2\r\n\t\t\"Higher\"\r\n\telsif n1<n2\r\n\t\t\"Lower\"\r\n\telse\r\n\t\t\"Correct\"\r\n\tend\r\n\r\nend", "def reorder best=nil\n\t\tif !best\n\t\t\tbest = lambda {|d1, d2| d1.e < d2.e}\n\t\tend\n\t\tif @daughters.length != 0\n\t\t\tindex = 0\n\t\t\t(0...@daughters.length).each do |i|\n\t\t\t\tif best.call @daughters[i], @daughters[index]\n\t\t\t\t\tindex = i\n\t\t\t\tend\n\t\t\tend\n\t\t\t@daughters.unshift(@daughters.delete_at index)[0].reorder !best\n\t\tend\n\tend", "def sort_cards_by_value_bis!()\r\n\t\taucun_echange=false\r\n\t\twhile aucun_echange==false\r\n\t\t\taucun_echange=true\r\n\t\t\tlen=@list.length-2\r\n\t\t\tfor i in 0..len\r\n\t\t\t\tif !@list[i].nil? and !@list[i+1].nil?\r\n\t\t\t\t\tif @list[i].get_value_bis<@list[i+1].get_value_bis\r\n\t\t\t\t\t\ttemp=@list[i]\r\n\t\t\t\t\t\t@list[i]=@list[i+1]\r\n\t\t\t\t\t\t@list[i+1]=temp\r\n\t\t\t\t\t\taucun_echange=false\r\n\t\t\t\t\t\tbreak\r\n\t\t\t\t\telsif @list[i].get_value_bis == @list[i+1].get_value_bis\r\n\t\t\t\t\t\t@list.delete_at(i)\r\n\t\t\t\t\t\taucun_echange=false\r\n\t\t\t\t\t\tbreak\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\tend\r\n\tend", "def sort_divisible_numbers(array)\n divisible_numbers = []\n other_numbers = []\n\n array.each do |number|\n if divisible_by_five?(number)\n divisible_numbers << number\n else\n other_numbers << number\n end\n end\n\n return [divisible_numbers, other_numbers]\nend", "def <=>(other)\n # since the default in the @hand Hash is false, we can just check for keys\n \n if @hand[:royal_flush]\n if @other.hand[:royal_flush]\n return 0\n else\n return 1\n end\n end\n \n if @hand[:straight_flush]\n # value here is the starting value\n if other.hand[:royal_flush]\n # the other is higher\n return -1\n elsif other.hand[:straight_flush]\n # need to check values\n return @hand[:straight_flush] <=> other.hand[:straight_flush]\n else\n return 1\n end\n end\n \n if @hand[:four_of_a_kind]\n if other.hand[:royal_flush] || other.hand[:straight_flush]\n return -1\n elsif other.hand[:four_of_a_kind]\n return @hand[:four_of_a_kind] <=> other.hand[:four_of_a_kind]\n else\n return 1\n end\n end\n \n if @hand[:full_house]\n if other.hand[:royal_flush] || \n other.hand[:straight_flush] || \n other.hand[:four_of_a_kind]\n return -1\n elsif other.hand[:full_house]\n # first element of value array is the number of the three-of-a-kind part\n return @hand[:full_house][0] <=> other.hand[:full_house][0]\n else\n return 1\n end\n end\n \n if @hand[:flush]\n if other.hand[:royal_flush] || \n other.hand[:straight_flush] || \n other.hand[:four_of_a_kind] || \n other.hand[:full_house]\n return -1\n elsif other.hand[:flush]\n return compare_values(other)\n else\n return 1\n end\n end\n \n if @hand[:straight]\n if other.hand[:royal_flush] || \n other.hand[:straight_flush] || \n other.hand[:four_of_a_kind] || \n other.hand[:full_house] ||\n other.hand[:flush]\n return -1\n elsif other.hand[:straight]\n # just check starting point\n return @cards[0] <=> other.cards[0]\n else\n return 1\n end\n end\n \n if @hand[:three_of_a_kind]\n if other.hand[:royal_flush] || \n other.hand[:straight_flush] || \n other.hand[:four_of_a_kind] || \n other.hand[:full_house] ||\n other.hand[:flush] ||\n other.hand[:straight]\n return -1\n elsif other.hand[:three_of_a_kind]\n return @hand[:three_of_a_kind] <=> other.hand[:three_of_a_kind]\n else\n return 1\n end\n end\n \n if @hand[:two_pair]\n if other.hand[:royal_flush] || \n other.hand[:straight_flush] || \n other.hand[:four_of_a_kind] || \n other.hand[:full_house] ||\n other.hand[:flush] ||\n other.hand[:straight] ||\n other.hand[:three_of_a_kind]\n return -1\n elsif other.hand[:two_pair]\n pairs_s = @hand[:two_pair].sort\n pairs_o = other.hand[:two_pair].sort\n \n # we need to test the higher, and then the lower if necessary\n if (pairs_s[1] <=> pairs_o[1]) == 0\n return pairs_s[0] <=> pairs_o[0]\n else\n return pairs_s[1] <=> pairs_o[1]\n end\n else\n return 1\n end\n end\n \n if @hand[:one_pair]\n if other.hand[:royal_flush] || \n other.hand[:straight_flush] || \n other.hand[:four_of_a_kind] || \n other.hand[:full_house] ||\n other.hand[:flush] ||\n other.hand[:straight] ||\n other.hand[:three_of_a_kind] ||\n other.hand[:two_pair]\n return -1\n elsif other.hand[:one_pair]\n if @hand[:one_pair] == other.hand[:one_pair]\n # compare highest card\n return compare_values(other)\n else\n return @hand[:one_pair] <=> other.hand[:one_pair]\n end\n else\n return 1\n end\n end\n \n if @hand[:high_card]\n if other.hand[:royal_flush] || \n other.hand[:straight_flush] || \n other.hand[:four_of_a_kind] || \n other.hand[:full_house] ||\n other.hand[:flush] ||\n other.hand[:straight] ||\n other.hand[:three_of_a_kind] ||\n other.hand[:two_pair] ||\n other.hand[:one_pair]\n return -1\n elsif other.hand[:high_card]\n return @hand[:high_card] <=> other.hand[:high_card]\n else\n return 1\n end\n end\n \n raise RuntimeError \"WE SHOULD NOT EVER GET HERE: #{@hand.inspect}\"\n \n 1\n end", "def dominant_octopus(fishes)\n prc = Proc.new { |a, b| a <=> b }\n\n fishes.merge_sort(prc).first\nend", "def sorting(numbers)\n numbers.sort\nend", "def radix_sort_unstable(arr, d)\n arrayified_hash = prepare_number_to_digit_array_map(arr, d).to_a\n\n (0..d-1).reverse_each do |digit|\n arrayified_hash.sort! { |x, y| x[1][digit] == y[1][digit] ?\n x[0] <=> y[0] :\n x[1][digit] <=> y[1][digit]\n }\n end\n\n arrayified_hash.map { |x| x[0] }\n end", "def get_valid_dice_count(num_dice, values)\n valid_dice = values.select { |e| e != 1 && e != 5 && values.count(e) >= 3 }\n num_dice -= 3 if valid_dice.size >= 3\n\n valid_dice = values.select { |e| e == 1 || e == 5 }\n num_dice -= valid_dice.size\n num_dice = 5 if num_dice == 0\n\n num_dice\n end", "def odds_sorted array\n odd_nums = array.select do |value|\n value.is_a?(Integer) && value.odd?\n end\n odd_nums.sort\nend", "def score( dice )\n score = 0\n\n [1,6,5,4,3,2,1,5].each { |x|\n if dice.count(x) >= 3 # Three 1's => 1000 points\n 3.times { dice.delete_at(dice.index(x) || dice.length) }\n case x\n when 1\n score += 1000\n else\n score += (x*100)\n end\n end\n }\n\n 2.times {\n if dice.count(1) >= 1 # One 1 => 100 points\n dice.delete_at(dice.index(1) || dice.length)\n score += 100\n end\n\n if dice.count(5) >= 1 # One 5 => 100 points\n dice.delete_at(dice.index(5) || dice.length)\n score += 50\n end\n }\n score\nend", "def sluggish_octopus_2(fishes) \n prc = Proc.new { |a, b| a <=> b }\n\n bubble_sort(&prc).first\nend", "def dice_trial(dice_obj, player_obj, dice_to_roll)\n\t\tputs \"Rolling dice now:\"\n\t\tdice_to_roll.each do |i|\n\t\t\tdice_value = roll_a_dice\n\t\t\tputs \"Dice ##{i} value: #{dice_value}\"\n\t\t\tdice_obj.scores[\"dice_#{i}\".to_sym] = dice_value\n\t\tend\n\t\tputs \"Score summary of all dices ==> #{pretty_print_hash(dice_obj.scores)}\"\n\t\t# Possible score options\n\t\tputs \"\\n\\n\"\n\t\tplayer_obj.calculate_and_display_score_options(dice_obj.scores)\n\t\tputs \"Overall score for player #{player_obj.id}:\"\n\n\t\tscore_display(player_obj.score)\n\t\tputs \"=\"*20\n\t\tputs \"Following are possible scores to choose from:\"\n\t\tscore_display(player_obj.round_scores, true)\n\tend", "def test_sort\n [ FactoryGirl.build(:category, :id => 2), FactoryGirl.build(:category, :id => 1), FactoryGirl.build(:category)].sort\n end", "def sort(&block)\n self.map{|*val| val.__svalue}.sort(&block)\n end", "def score( dice )\n res = 0\n val = { \"111\" => 1000, \"666\" => 600, \"555\" => 500, \"444\" => 400,\n \"333\" => 300, \"222\" => 200, \"1\" => 100, \"5\" => 50 }\n\n [*1..6].each do |num|\n next if dice.count(num).nil?\n many = dice.count(num)\n if many >= 3\n res += val[num.to_s * 3]\n many -= 3\n end\n if num == 1 || num == 5\n until many < 1\n res += val[num.to_s]\n many -= 1\n end\n end\n end\n \n res\nend", "def compare(v1, v2)\n if v1.value == v2.value\n return 0\n elsif v1.value > v2.value\n return 1\n else\n return -1\n end\n end", "def roll(godfest_tags)\n boosted_gfe = godfest_tags.include?(\"4\")\n unboosted_gfes = godfest_tags.select{|tag| tag[0] == \"-\"}.map{|tag| tag[1..-1].downcase}\n tags = godfest_tags.select{|tag| !([\"4\", \"X\", \"@\"].include?(tag) || tag[0] == \"-\")}\n \n test = rand(1000)\n if test < 300\n @silvers.sample\n elsif test < 650\n @troll_golds.sample\n elsif test < 700\n @gods.sample\n elsif test < (boosted_gfe ? 900 : 920)\n pantheon = tags.sample\n @pantheons[pantheon] ? @pantheons[pantheon].sample : @gods.sample\n elsif test < (boosted_gfe ? 975 : 980)\n roll_gfe(unboosted_gfes)\n else\n roll_super(unboosted_gfes)\n end\n end", "def sort_teams_and_adjs\n @teams.sort! { |a,b| b.calc_rank <=> a.calc_rank }\n @adjs.sort! { |a,b| b.score <=> a.score }\n\n #@teams.sort! { |a,b| b.score <=> a.score } #allows sorting by score only\n #expression is flipped in terms of a and b\n #therefore we have decending in teams by score\n end", "def sort_by_algo(state_list)\n state_list.sort_by(&:algie_check)\n end", "def roll\n results = []\n\n self.dice.each do |die|\n results << die.roll\n end\n\n return results\n end", "def test_merge_sort\n card_1 = Card.new(\"4\",\"Hearts\")\n card_2 = Card.new(\"3\", \"Clubs\")\n card_3 = Card.new(\"5\", \"Diamonds\")\n deck = Deck.new([card_1, card_2, card_3])\n assert_equal [card_2, card_1, card_3], deck.merge_sort\n end", "def score(dice)\n dice.sort\n\n if !dice.any?\n return 0\n end\n\n arr = Array.new (6)\n count = 1\n 6.times do\n arr[count-1] = dice.count(count)\n count +=1\n end\n\n sum = 0\n count = 1\n arr.each do |item|\n p \" #{count + 1} = #{item} :\"\n if item == 0 || item == nil\n count += 1\n next\n end\n\n if item >= 3 && count == 1\n sum += 1000 + 100 * (item - 3)\n elsif item >= 3 && count == 5\n sum += 5 * 100 + 50 * (item - 3)\n elsif item >= 3\n sum += count * 100\n end\n\n if item < 3 && count == 1\n sum += item * 100\n elsif item < 3 && count == 5\n sum += item * 50\n end\n\n count +=1\n end\n sum\nend", "def comp(array1, array2)\n return false if array1.nil? || array2.nil? || array1.length != array2.length\n a = array1.sort\n b = array2.sort\n b.each_with_index do |value, i|\n if a[i]*a[i] != value\n return false\n end\n end\n return true\nend", "def roll(dice)\n dice\n end", "def compare_triplets(a,b)\n scores = [0,0]\n a.each_with_index do |val, index|\n case val <=> b[index]\n when 1\n scores[0] += 1\n when -1\n scores[1] += 1\n end\n end\n scores\n end", "def alphabetic_number_sort2(nums)\n nums.sort { |num1, num2| ENGLISH_NUMBERS[num1] <=> ENGLISH_NUMBERS[num2] }\nend", "def thrice_dice(arr)\n dice_counter = Hash.new(0)\n score = 0\n\n arr.each do |el|\n dice_counter[el] += 1\n end\n\n arr.each do |k|\n # 3 of the same dice\n case dice_counter[k]\n when 3\n case k\n when 1\n score += 1000\n dice_counter[k] -= 3\n when 2\n score += 200\n dice_counter[k] -= 3\n when 3\n score += 300\n dice_counter[k] -= 3\n when 4\n score += 400\n dice_counter[k] -= 3\n when 5\n score += 500\n dice_counter[k] -= 3\n when 6\n score += 600\n dice_counter[k] -= 3\n end\n end\n\n if k == 5 && dice_counter[k] > 0\n score += 50\n dice_counter[k] -= 1\n elsif k == 1 && dice_counter[k] > 0\n score += 100\n dice_counter[k] -= 1\n end\n\n end\n score\nend", "def sorted_data &block\n @data.to_a.sort(&block)\n end", "def compare(a, b)\n if getCookie(a.getProducts).getAmount - getCookie(b.getProducts).getAmount == 0\n return (b.getId - a.getId)\n else\n return (getCookie(a.getProducts).getAmount - getCookie(b.getProducts).getAmount)\n end\nend", "def sort_by_value\n \tnew_hand = []\n \twhile @cards.size > 0\n \t\tpos = 0\n \t\tc = @cards[0]\n \t\t@cards.each_with_index do |card, index|\n \t\t\tc1 = card\n \t\t\tif (c1.value < c.value || (c1.suit == c.suit && c1.suit < c.suit) )\n pos = index\n c = c1\n end\n end\n\n remove_card_at(pos)\n new_hand << c\n end\n @cards = new_hand\n\n end" ]
[ "0.7356072", "0.52847916", "0.5277148", "0.52326214", "0.521826", "0.5194588", "0.51915973", "0.5120726", "0.5078136", "0.50256276", "0.499052", "0.49794155", "0.49698907", "0.49549085", "0.4946462", "0.48435494", "0.48420608", "0.48389658", "0.4830706", "0.48208693", "0.48193017", "0.4815278", "0.4809886", "0.48001316", "0.4794454", "0.47941867", "0.47685155", "0.47624964", "0.47578344", "0.47366416", "0.47003496", "0.4676856", "0.4676701", "0.46488026", "0.46458822", "0.46341357", "0.46308872", "0.45860574", "0.4585667", "0.4573984", "0.45612627", "0.455858", "0.4556084", "0.45522508", "0.45369482", "0.4530566", "0.45258713", "0.45256838", "0.45195702", "0.4518784", "0.45131043", "0.4501752", "0.44920075", "0.44890133", "0.4488532", "0.44828147", "0.44825193", "0.44817162", "0.44773003", "0.44762227", "0.4470747", "0.44634855", "0.4461756", "0.44595745", "0.44585976", "0.44575658", "0.4452595", "0.44480708", "0.44416294", "0.44408348", "0.44380516", "0.44367284", "0.4427912", "0.4423453", "0.44233626", "0.4419092", "0.44156805", "0.4413678", "0.44136456", "0.44106382", "0.4407984", "0.44045365", "0.44018844", "0.43994597", "0.4396001", "0.43949255", "0.43940303", "0.43871415", "0.43864068", "0.4385621", "0.43836316", "0.43816394", "0.43813366", "0.43796438", "0.43704727", "0.43515596", "0.43478924", "0.4343221", "0.43390703", "0.4331375" ]
0.77219313
0
Used to sort an array of dice. NOTE: Values not in AllowedDice end up at the front of the array.
def sort_dice(dice=[]) return [] if not dice.is_a?(Array) return dice.sort {|d1, d2| compare_dice(d1, d2) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compare_dice(die1, die2)\n idx1 = AllowedDiceOrder.index(die1)\n idx2 = AllowedDiceOrder.index(die2)\n\n # This handles values -not- in AllowedDice\n idx1 = -1 if idx1.nil?\n idx2 = -1 if idx2.nil?\n\n return idx1 <=> idx2\n end", "def sort\n sorted = []\n\n # Iterate Over Array Length\n array_length.times do\n m = randomized_array[0]\n mi = 0\n\n # Iterate over collection and compare the first element in the collection\n # Change the value of variable m if iterated value is less than the initial value\n # Our goal is to set the lowest value as variable m's value\n randomized_array.each_with_index do |value, idx|\n if value < m\n m = value\n mi = idx\n end\n end\n # Remove the lowest value from the original collection and append into new\n # collection\n randomized_array.delete_at mi\n sorted << m\n end\n\n sorted\n end", "def dices=(arr)\n @dices = ((arr + [0,0,0]).sort.reverse)[0..1]\n end", "def shuffle_array array\n array.sort_by!{ rand }\n end", "def sort_array(source_array)\n odd=[]\n nArr=[]\n for x in source_array do\n if x != 0 && x % 2 != 0\n odd.push(x)\n end\n end\n odd.sort!\n i=0\n for x in source_array do\n if x != 0 && x %2 != 0\n nArr.push(odd[i])\n i += 1\n else\n nArr.push(x)\n end\n end\n p nArr\nend", "def sort_by_luck(arr)\n arr.sort! { |a,b|\n b[0] <=> a[0]\n }\n return arr\nend", "def funny_sort(array)\n\tputs array.sort{ |a, b| findEarliestDigits(a) <=> findEarliestDigits(b) }\nend", "def sort_array\n @data.sorted_by.inject([]) do |memo, (key, value)|\n memo << [@data.columns.index(key), value == 'descending' ? 0 : 1]\n end\n end", "def take_array(array)\r\n array.sort\r\nend", "def odd_sort array\n # create a variable that selects the odd numbers from the aray\n only_odd_numbers = array.select do |value|\n value.is_a?(Numeric) && value.odd?\n end\n #sort this variable from least to greatest\n only_odd_numbers.sort\nend", "def sort_array(source_array)\n odd_array = source_array.select{|number| number.odd?}.sort \n source_array.map{ |number| number.even? ? number : odd_array.shift }\n\nend", "def sort_array(arr)\n \n odds = arr.select { |num| num. odd? }.sort\n evens = arr.select{ |num| num.even? }.sort.reverse\n \n arr.map! do |num|\n if num.odd?\n odds.shift\n else\n evens.shift\n end\n end\n \nend", "def sort_array_asc(array)\n\tarray.sort\nend", "def sort\n @pokers.sort.reverse\n end", "def bozosort!(arr)\n while not arr.sort == arr\n a, b = rand(arr.length), rand(arr.length)\n arr[a], arr[b] = arr[b], arr[a]\n end\n return arr\nend", "def hot_dice(roll)\n while roll.length > 0\n asides << roll.shift\n end\n end", "def sort_array_asc(integers)\n integers.sort\nend", "def using_sort(array)\narray.sort\nend", "def using_sort(array)\narray.sort\nend", "def radix_sort_unstable(arr, d)\n arrayified_hash = prepare_number_to_digit_array_map(arr, d).to_a\n\n (0..d-1).reverse_each do |digit|\n arrayified_hash.sort! { |x, y| x[1][digit] == y[1][digit] ?\n x[0] <=> y[0] :\n x[1][digit] <=> y[1][digit]\n }\n end\n\n arrayified_hash.map { |x| x[0] }\n end", "def dex_sorted_squads\n return Tools.sort_by_dex(active_squads)\n end", "def sorted_rolls\n tsort_hash = {}\n @rolls.each do |file_name, roll|\n tsort_hash[file_name.to_s] = roll.dependencies.map(&:to_s)\n end\n\n tsort_hash.tsort.map(&:to_sym)\n end", "def array_ranked_descending(array)\n\t\treturn array.sort{|x,y| y <=> x} \n\tend", "def orderly(array)\n p array.sort\nend", "def alphabetic_number_sort(arr)\n arr.sort { |a, b| INT_NAMES[a] <=> INT_NAMES[b] }\nend", "def puzzle_5\n arr = 10.times.map{ 55 + Random.rand(46) }\n puts arr.sort!\n puts arr.first\n puts arr.last\nend", "def sorting_gross(array)\n #variable sorted by release is equal to the array movie data and sorting it by the gross but\n #first needing to delete and split so it is able to sort the integers only in the order of smallest to largest\n #then reversing the order so the largest grossing movie comes first\n sorted_by_gross = array.sort_by {|gross_movie| gross_movie[:gross].delete('$').split(',').join.to_i}.reverse\n #outputs the array list sorted by release\n puts sorted_by_gross\nend", "def sort_array(source_array)\n odd_num = source_array.select(&:odd?).sort.each\n source_array.map { |n| n.odd? ? odd_num.next : n }\nend", "def sort(array)\n return array if array.length <= 1\n less, more = [], []\n # first element as pivot value\n pivot = array.delete_at(0)\n\n array.each { |el| el < pivot ? less << el : more << el}\n\n sort(less) + [pivot] + sort(more)\n end", "def odds_sorted array\n odd_nums = array.select do |value|\n value.is_a?(Integer) && value.odd?\n end\n odd_nums.sort\nend", "def bar arr\n arr.sort!\nend", "def sort_array_asc(array)\n array.sort\nend", "def gnome_sort(array)\n count = 0\n\n while count < array.length - 1\n if array[count] > array[count + 1]\n array[count + 1], array[count] = array[count], array[count + 1]\n count -= 2 if count.positive?\n end\n count += 1\n end\n\n array\nend", "def alphabetic_number_sort(arr)\n words = %w[zero, one, two, three, four, five, six, seven, eight, nine, ten, eleven, twelve, thirteen, fourteen, fifteen, sixteen, seventeen, eighteen, nineteen]\n arr.sort_by do |number|\n words[number]\n end\nend", "def sort_if_needed\n @rules.sort! unless @sorted\n @sorted = true\n end", "def sort_array_desc(array)\n array.sort do |x,y|\n if x == y\n 0\n elsif x < y\n 1\n elsif x > y\n -1\n end\n end\nend", "def using_sort(array)\n sorted_array=array.sort\nend", "def odds_and_ordered (array)\n # Use filter to take out only the odd numbers\n odd_num_array = array.select do | value |\n (value.instance_of? Integer) && (value % 2 != 0)\n end\n # Sort the array of numbers\n odd_num_array.sort { |a, b| a <=> b}\nend", "def sort(array)\n array.sort_by { |digit| [digit.digits(2).count(1), digit] }\nend", "def sort_array_asc(array)\n array.sort\nend", "def sort_array_asc(array)\n array.sort\nend", "def sort_array_asc(array)\n array.sort\nend", "def sort_array_asc(array)\n array.sort\nend", "def sort_array_asc(array)\n array.sort\nend", "def sort_array_asc(array)\n array.sort\nend", "def sort_defined_names(names) # :nodoc:\n names.sort do |a, b|\n name_a = normalise_defined_name(a[0])\n name_b = normalise_defined_name(b[0])\n sheet_a = normalise_sheet_name(a[2])\n sheet_b = normalise_sheet_name(b[2])\n # Primary sort based on the defined name.\n if name_a > name_b\n 1\n elsif name_a < name_b\n -1\n elsif sheet_a >= sheet_b # name_a == name_b\n # Secondary sort based on the sheet name.\n 1\n else\n -1\n end\n end\n end", "def sort_counts()\n @count_array = @counts.to_a\n @count_array.sort_by! { |pair| pair[1] }\n @count_array.reverse!\n @count_array\n end", "def sort1(array)\n\nend", "def del_sort(array)\n end", "def fighter_order\n [fighter1, fighter2].shuffle\n end", "def poorly_written_ruby(*arrays)\n combined_array = []\n\n arrays.each do |array|\n combined_array.concat(array)\n end\n \n def quick_sort(collection)\n return collection if collection.length <= 1\n pivot = collection.sample\n\n left = Array.new\n right = Array.new\n\n collection.each do |x|\n if x <= pivot\n left << x\n else\n right << x\n end\n end\n\n quick_sort(left) + quick_sort(right)\n\n end\n\n def buckethash_sort(collection)\n\n buckets = Hash.new\n\n (\"A\"..\"Z\").each do |x|\n buckets[x] = Array.new\n end\n\n collection.each do |x|\n if buckets.key?(x[0])\n buckets[x[0]] << x\n end\n end\n\n buckets.each_key do |key|\n buckets[key] = quick_sort(buckets[key])\n end\n\n buckets.values.flatten\n\n end\n\n buckethash_sort(combined_array)\n\nend", "def sorted_random()\n arr = 10.times.map{ 55 + Random.rand(46) }.sort\n p arr\n p arr[0]\n p arr[9]\nend", "def sort\n limit = array.size - 1\n (0..limit).each do |index|\n min = index\n (index..limit).each do |target|\n min = target if array[min] > array[target]\n end\n array[index], array[min] = array[min], array[index]\n end\n array\n end", "def scorelist(roll)\n #return a hash that shows all the possible scores for these dice, sorted\n categories = ['yahtzee','fourk','house','threek', \n 'n6', 'n5', 'n4', 'n3', 'n2', 'n1', 'small' ,'large', 'chance']\n scores = {}\n categories.each do |entry|\n #populate the hash\n scores[entry] = eval(\"#{entry}(#{roll})\")\n end\n return scores.sort_by{|k,v| v}.reverse\nend", "def sort_array_asc int_arr\n new_arr = []\n int_arr.each {|integer| new_arr.unshift(integer)}\n new_arr\nend", "def get_sorted_array\n @ary.sort\n end", "def sort_divisible_numbers(array)\n divisible_numbers = []\n other_numbers = []\n\n array.each do |number|\n if divisible_by_five?(number)\n divisible_numbers << number\n else\n other_numbers << number\n end\n end\n\n return [divisible_numbers, other_numbers]\nend", "def sean_sort(numbers)\n\n\nend", "def sort_array_desc(array)\n\tarray.sort do |a, b|\n\t\tb <=> a\n\tend\nend", "def e5115_sublinear_sort(values)\n end", "def using_sort(array)\n array.sort\nend", "def using_sort(array)\n array.sort\nend", "def using_sort(array)\n array.sort\nend", "def pancake_sort(arr)\n # your code goes here \n r = arr.length\n while r >= 0\n max_index = max(arr, r)\n if max_index != r - 1\n flip(arr, max_index + 1)\n flip(arr, r)\n end\n r -= 1\n end\n return arr\nend", "def reorder best=nil\n\t\tif !best\n\t\t\tbest = lambda {|d1, d2| d1.e < d2.e}\n\t\tend\n\t\tif @daughters.length != 0\n\t\t\tindex = 0\n\t\t\t(0...@daughters.length).each do |i|\n\t\t\t\tif best.call @daughters[i], @daughters[index]\n\t\t\t\t\tindex = i\n\t\t\t\tend\n\t\t\tend\n\t\t\t@daughters.unshift(@daughters.delete_at index)[0].reorder !best\n\t\tend\n\tend", "def odd_nums_ascending (array)\n #map through array\n #create new array to hold numbers\n num_array = array.select do | num |\n num.class == Integer\n #chaining on select to see if number is odd\n end.select do | num |\n num.odd?\n #sort by ascending\n end.sort\n #return array\n num_array\nend", "def sort_by_odd(arr)\n arr.sort_by do |sub_arr|\n sub_arr.select(&:odd?)\n end\nend", "def candidates_above_default\n Array(@ranking[0...@default_rank]).flatten.sort\n end", "def sort_hits!\n @array.sort! do |a, b|\n code = a.hit[:code] <=> b.hit[:code]\n next code unless code.zero?\n\n b.hit[:release_date] <=> a.hit[:release_date]\n end\n self\n end", "def odd_sort array\n new_arr = array.grep(Numeric)\n (new_arr.select { |value| value%2!=0 }).sort()\n \nend", "def poorly_written_sort(*arrays)\n combined_array = []\n arrays.each do |array|\n array.each do |value|\n combined_array << value\n end\n end\n\n sorted_array = [combined_array.delete_at(combined_array.length-1)]\n\n for val in combined_array\n i = 0\n while i < sorted_array.length\n if val <= sorted_array[i]\n sorted_array.insert(i, val)\n break\n elsif i == sorted_array.length - 1\n sorted_array.insert(i, val)\n break\n end\n i+=1\n end\n end\n\n # Return the sorted array\n sorted_array\nend", "def sortExits()\n @exits = (@exits ||= []).sort_by { |x| x.to_s }\n end", "def sort_array_desc(array)\n array.sort do |a, b|\n if a == b\n 0\n elsif a > b\n -1\n elsif a < b\n 1\n end\n end\nend", "def my_array_sorting_method(source)\n source.reject{|x| x.is_a? String}.sort + source.reject{|x| x.is_a? Numeric}.sort\nend", "def dictionary_sort arr\r\n\trec_dict_sort arr, []\r\nend", "def sort_array_desc(array)\n array.sort do |a,b|\n if a == b\n 0\n elsif a > b\n -1\n elsif a < b\n 1\n end\n end\nend", "def ordered_abilities\n ability_names.sort\n end", "def selection_sort(array=@base)\n 0.upto(array.size-1) do |index1|\n min_index = index1\n (index1+1).upto(array.size-1) do |index2|\n min_index = index2 if array[index2] < array[min_index]\n end\n array[index1], array[min_index] = array[min_index], array[index1]\n end\n array\n end", "def my_array_sorting_method(array)\n\t@array=array\n\t@array.sort\n\treturn @array\nend", "def sort_percentages\n @_sort_percentages ||= percentages.sort { |a, b| b.last <=> a.last }\n end", "def bucket_sort\n buckets = {}\n #Ideal for known and uniformly distributed range. Sort age of employees for eg.:\n @array.each do |age|\n bucket = age/10\n buckets[bucket] ||= []\n buckets[bucket] << age\n end\n\n result = []\n for i in 0..20\n arr = buckets[i]\n puts \"i=#{i}, buckets[i]=#{arr}\"\n puts \"result=#{result}, sorted value=#{insertion_sort(arr)}\" if arr\n result << insertion_sort(arr) if arr && arr != []\n end\n @array = result.flatten\n end", "def sort_values cells\n cells.collect { |cell| cell.value }.uniq.sort.reverse\n end", "def mothrah_sort (an_array)\n\tdef move_to_end (value, array)\n\t\tarray.delete(value)\n\t\tarray.push(value)\n\tend\n\tpos = 0\n\twhile pos < an_array.length \n\t\tif an_array[pos] > an_array[pos + 1]\n\t\t\tmove_to_end(an_array[pos], an_array)\n\t\telse\n\t\t\tpos += 1\n\t\tend\n\tend\n\tan_array\nend", "def roll_dice(dice, num_dice)\n dice.roll(num_dice)\n values = dice.values\n puts \"Your dice values: #{values}\"\n roll_score = dice.score(values)\n puts \"Roll score #{roll_score}\"\n [roll_score, values]\n end", "def shuffle array\r\n array.sort_by{rand}\r\nend", "def sorted_triples(array)\n sort_array = []\n array.each_slice(3) do |group|\n sort_array << group.sort\n end\n return sort_array\nend", "def sort(unsorted_array)\n @sorted_array << unsorted_array.delete_at(unsorted_array.min)\n sort(unsorted_array) until unsorted_array.length == 0\n# This is the RECURSION - latest value of unsorted_array after each iteration\n# is then re-run through the sort method until everything is sorted.\n @sorted_array\nend", "def alphabetic_number_sort(arr)\r\n arr.sort {|num1, num2| NUM[num1] <=> NUM[num2]}\r\nend", "def sorting(numbers)\n numbers.sort\nend", "def alphabetic_number_sort(arr)\n number_arr = %w(zero, one, two, three, four, five, six, seven, eight, nine, ten, eleven, twelve, thirteen, fourteen, fifteen, sixteen, seventeen, eighteen, nineteen)\n number_hash = arr.zip(number_arr).to_h\n number_hash.sort_by{|k,v| v}.to_h.keys\nend", "def shuffle arr\r\n\tarr.sort_by{rand}\r\nend", "def shuffle arr\r\n\tarr.sort_by{rand}\r\nend", "def sort_relevant_rules\r\n # sort array in rule priority order\r\n @relevant_rules = @relevant_rules.sort do |r1, r2| \r\n r2.priority <=> r1.priority \r\n end\r\n end", "def sort(arr)\n return arr if arr.length < 1\n\n pivot = arr.pop\n less = arr.select { |item| item < pivot}\n more = arr.select { |item| item >= pivot}\n\n sort(less) + [pivot] + sort(more)\nend", "def pbArrangeByTier(pokemonlist,rule)\n tiers=[\n withRestr(rule,0,500,0),\n withRestr(rule,380,500,0),\n withRestr(rule,400,555,0),\n withRestr(rule,400,555,0),\n withRestr(rule,400,555,0),\n withRestr(rule,400,555,0),\n withRestr(rule,580,680,1),\n withRestr(rule,500,680,0),\n withRestr(rule,580,680,2)\n ]\n tierPokemon=[]\n for i in 0...tiers.length\n tierPokemon.push([])\n end\n for i in 0...pokemonlist.length\n next if !rule.ruleset.isPokemonValid?(pokemonlist[i])\n validtiers=[]\n for j in 0...tiers.length\n tier=tiers[j]\n if tier.ruleset.isPokemonValid?(pokemonlist[i])\n validtiers.push(j)\n end\n end\n if validtiers.length>0\n vt=validtiers.length*i/pokemonlist.length\n tierPokemon[validtiers[vt]].push(pokemonlist[i])\n end\n end\n # Now for each tier, sort the Pokemon in that tier\n ret=[]\n for i in 0...tiers.length\n tierPokemon[i].sort!{|a,b|\n bstA=baseStatTotal(a.species)\n bstB=baseStatTotal(b.species)\n if bstA==bstB\n a.species<=>b.species\n else\n bstA<=>bstB\n end\n }\n ret.concat(tierPokemon[i])\n end\n return ret\nend", "def cards_sorted_ace_high\n @cards_sorted_ace_high ||= @cards.sort!.reverse!\n end", "def dice_outcomes(dice, rolls)\n outcomes = []\n rolls.times do |roll|\n outcomes << roll_dice(dice)\n end\n occurences = outcomes.each_with_object(Hash.new(0)) do |outcome, count|\n count[outcome] += 1\n end\n occurences.sort.map do |key, val|\n outcome = \"\"\n val.times do\n outcome << '#'\n end\n $stdout.puts \"#{key}: #{outcome}\"\n end\nend", "def strand_sort(array)\n temp = array.dup\n result = []\n until temp.empty?\n value = temp.first\n sublist, temp = temp.partition { |val| value = val if value <= val }\n result += sublist.shift(sublist.length) if result.empty?\n result = binary_sort(result, sublist)\n end\n result\nend", "def sort_zombies\n index = 0\n while index < @zombie_apocalypse_supplies.length\n index2 = index + 1\n while index2 < @zombie_apocalypse_supplies.length\n if @zombie_apocalypse_supplies[index2] < @zombie_apocalypse_supplies[index]\n @zombie_apocalypse_supplies[index], @zombie_apocalypse_supplies[index2] = @zombie_apocalypse_supplies[index2], @zombie_apocalypse_supplies[index]\n end\n index2 += 1\nend\nindex += 1\nend\nputs\nputs @zombie_apocalypse_supplies\nputs\nend", "def sort\r\n @roster.each do |key, value|\r\n value.sort!\r\n end\r\n end" ]
[ "0.62039465", "0.593092", "0.5883547", "0.5554808", "0.5543136", "0.5527346", "0.55195254", "0.55148035", "0.5514463", "0.5506463", "0.54830354", "0.545409", "0.54452163", "0.5436267", "0.54168856", "0.5409858", "0.54074436", "0.5392816", "0.5392816", "0.5383297", "0.5368558", "0.53526425", "0.5324874", "0.5310712", "0.5310162", "0.53064877", "0.53000087", "0.52946913", "0.52923167", "0.52845025", "0.52774006", "0.5277018", "0.5263482", "0.52630156", "0.5256929", "0.52506423", "0.5250352", "0.52471554", "0.52454877", "0.5239281", "0.5239281", "0.5239281", "0.5239281", "0.5239281", "0.5239281", "0.52381235", "0.52271456", "0.5227047", "0.5224979", "0.52244455", "0.52192324", "0.5219203", "0.5218262", "0.5217878", "0.5217101", "0.5215477", "0.5211692", "0.52109396", "0.5208326", "0.5207613", "0.5182897", "0.5182897", "0.5182897", "0.51773936", "0.5175568", "0.51747876", "0.5174055", "0.51710576", "0.5170239", "0.5170235", "0.5169264", "0.516627", "0.51625735", "0.5158814", "0.51542723", "0.5151483", "0.5150898", "0.5147765", "0.5146899", "0.5146344", "0.514327", "0.5143173", "0.51420695", "0.51405406", "0.5139043", "0.51372296", "0.51358235", "0.5134926", "0.5134025", "0.51321787", "0.5130649", "0.5130649", "0.5129268", "0.5124551", "0.5122815", "0.5122141", "0.511724", "0.5111824", "0.51068634", "0.51042086" ]
0.76090306
0
before_action :authenticate_coach!, only: [:index]
def index @players = Player.all @coachplayers = CoachPlayer.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authorized\n redirect_to :controller => 'home', :action => 'index' unless logged_in?\n end", "def index\n redirect_to current_user\n end", "def index\n redirect_to(:action => 'login') unless logged_in? \n end", "def index\n redirect_to(:action => 'login') and return unless logged_in?\n \n @user = current_user\n end", "def index\r\n redirect_to :action => :login\r\n end", "def index\n redirect_to(:action => 'login') #unless logged_in? || User.count > 0\n end", "def authorized\n redirect_to \"/login\" unless logged_in? \n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def index\n redirect_to @current_user if current_user\n end", "def index\n # set_user, is the only action taken here\n end", "def index\n # set_user, is the only action taken here\n end", "def index\n redirect_to after_sign_in_path_for current_user if current_user\n end", "def index\n redirect_to after_sign_in_path_for current_user if current_user\n end", "def authorized_user!\n unless user_logged_in?\n redirect_to root_path\n end\n end", "def authorized\n redirect_to '/welcome' unless logged_in?\n end", "def authorized\n redirect_to '/signin' unless current_driver\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def index\n if is_logged_in\n redirect_to(:action=>'list')\n end\n #all logic in login_redirect_logic\n end", "def index\n redirect_to :nieuw if current_user\n end", "def my_account\r\n if !logged_in?\r\n redirect_to :controller=>'user' , :action=>'list'\r\n end\r\n end", "def authorize\n redirect_to('/login') unless @current_user\n end", "def index\n\n Planout.instance.info()\n\n @user = User.authenticate('alex', 'wja0DjFEGd9D')\n # if @user = User.authenticate('alex', 'wja0DjFEGd9D')\n # if @user = User.authenticate('kriztean', 'strewersk62S?')\n session[:user_id] = @user.id\n # else\n # puts \"Invalid username/password.\"\n # end\n\n redirect_to new_participant_path\n\n end", "def index\n # Handle bookmarked or otherwise incorrect GETs to the login action\n if request.method == :get\n redirect_to login_path\n else\n redirect_to member_home_path\n end\n end", "def authorize\n redirect_to '/' unless current_user || current_dealer\n end", "def authenticate\n\n redirect_to_login if current_user.nil?\n \n end", "def authorize\n redirect_to new_sessions_path if current_user.nil?\nend", "def authorize\n redirect_to :root, alert: 'You must be logged in to view this page' if current_user.nil?\n end", "def index\n @pagina_principals = PaginaPrincipal.all\n def index\n if( !(session[:cafe] != nil && session[:cafe] != '') )\n redirect_to '/'\n end\n end\n end", "def index\n @role = session[:role]\n @househunters = Househunter.all\n if session[:role] != \"admin\"\n redirect_to login_path, notice: \"You are not allowed to access that url\"\n end\n end", "def authorize\n redirect_to :login unless user_signed_in?\n end", "def authorize\n if current_user.nil? && current_photographer.nil?\n redirect_to :login\n end\n end", "def show\n authorize @career\n end", "def authorize\n @logged_in_user = User.find(session[:user_id])\n rescue\n reset_session\n @logged_in_user = nil\n if User.find(:all).length > 0\n session[:jumpto] = request.parameters\n redirect_to :controller => 'authentication', :action => :login and return false\n else\n redirect_to :controller => 'authentication', :action => :setup and return false\n end\n end", "def login_required\n authenticate_user! \n end", "def authorize\n redirect_to new_session_path unless current_user #call method curent_user in sessions_helper\n end", "def authorize\n redirect_to login_path, alert: 'You must be logged in to access this page.' if current_user.nil?\n end", "def home\n authenticate!\n end", "def authorize!\n redirect '/' unless logged_in?\n end", "def authorized_for_team\n team = Team.find(params[:id]);\n redirect_to root_path unless team.users_ids.include?(current_user.id) || \n current_user.in_tab_room?(team.tournament);\n end", "def index\n if user_signed_in?\n redirect_to :controller=>'reviews', :action => 'index'\n end\nend", "def show\n # authorize Admin\n end", "def landing\n redirect_to dashboard_path if current_user\n end", "def must_be_authenticated!\n unless current_admin\n redirect_to :controller => 'home', :action => 'index'\n end\n end", "def authorize\n redirect_to root_path unless current_recruiter\n end", "def authorize\n # First check if user is already logged in\n if (session[:user_id].nil? || session[:user_id] == \"\")\n redirect_to :controller => 'user', :action => 'login'\n return\n end\n end", "def authorize\n\t\tredirect_to '/login' unless current_user\n\tend", "def user_authorized\n redirect_to \"/\" unless session[:user_id]\n end", "def authorize\n redirect_to login_url, alert: \"Not authorized\" if current_user.nil?\n end", "def authorize\n redirect_to login_url, alert: \"Not authorized\" if current_user.nil?\n end", "def authorize\n redirect_to login_url, alert: \"Not authorized\" if current_user.nil?\n end", "def index\n if current_user\n @clients = Client.all.order(:id)\n else\n flash[:notice] = \"First Login to view the client Details\"\n redirect_to new_user_session_path\n end\n end", "def authorized\n redirect_to new_user_session_path unless logged_in?\n end", "def index\n # The hook below can access controller's instance variables.\n if current_user\n if current_user.role?:livia_admin\n redirect_to companies_url\n elsif is_secretary_or_team_manager?\n redirect_to \"/wfm/notes\"\n elsif current_user.end_user\n redirect_to physical_clientservices_home_index_path\n elsif is_client\n redirect_to matter_clients_url\n elsif current_user.role?:lawfirm_admin\n redirect_to lawfirm_admins_url\n return\n end\n else\n flash[:error] = t(:flash_DB_error)\n redirect_to login_url\n end\n end", "def landing_page\n if current_user\n redirect_to actions_path(current_user[:id])\n end\n end", "def before_action \n end", "def authorize\n if current_user.nil?\n redirect_to login_path, alert: 'You must be logged in to access this page.'\n end\n end", "def authorize_redirect\n \tif session[:user_id]\n\t\tredirect_to :controller => 'home'\n \tend\n end", "def enforce_login\n redirect_to welcome_path if @user.nil?\n end", "def authenticate\n redirect_to login_path if !logged_in\n end", "def index\n if logged_in?\n redirect_to :controller => 'account', :action => 'mypage'\n else\n if User.count > 0\n redirect_to :controller => 'account', :action => 'signup'\n else\n redirect_to :controller => 'recommend', :action => 'question'\n end\n end\n end", "def index\n if instructor_signed_in? and current_instructor.is_admin\n # Only an admin has access to this information. Ohter instructors will not get the link\n @instructor = Instructor.all\n else \n redirect_to root_path\n return\n end\n end", "def authorize\n return if current_user\n\n redirect_to login_url\n end", "def authorize\n @logged_in_user = User.find(session[:user_id])\n rescue\n reset_session\n @logged_in_user = nil\n if User.find(:all).length > 0\n session[:jumpto] = request.parameters\n redirect_to :controller => 'authentication', :action => 'login' and return false\n else\n redirect_to :controller => 'authentication', :action => 'create_admin' and return false\n end\n end", "def redirect_to_index\n redirect_to :action => 'index' unless current_user\n @user = current_user\n end", "def index\n unless current_user.admin? or current_user.coordinador?\n redirect_to '/', :alert => \"Acceso denegado.\" #por ahora solo un adminsitrador puede ver esto\n end\n\n @tutors = Tutor.where(status:true)\n @careers = Career.all\n\n end", "def show\n redirect_to login_path \n end", "def index\n \tif current_user\n\t\tredirect_to home_profile_path\n\tend\n end", "def index\n if current_user.admin?\n @participants = Participant.all \n else\n redirect_to new_participant_url\n end\n \n \n end", "def authenticate_reporter\n unless current_user.acts_like_reporter?\n redirect_to site_path, alert: 'You do not have permission to access that page.' and return\n end\n end", "def authorize\n return if session[:user_id]\n flash[:notice] = \"Please log in\"\n session[:jumpto] = request.parameters\n redirect_to(:controller => \"/login\", :action => \"index\")\n end", "def index\n @admins = Admin.order(:email)\n authorize @admins\n end", "def authenticate!\n unless current_user\n redirect \"/login\"\n end\nend", "def authorized!\n redirect_to root_url, alert: \"You need to be set up for receiving whispers first\" and return unless current_user\n end", "def index\n redirect_to user_path(current_user)\n end", "def authenticate\n \treturn if controller_name == \"pages\"\n \tif !logged_in?\n \t\tflash[:alert] = \"Must be an admin or a nutritionist\"\n \t\tredirect_to root_path\n \tend\n end", "def show\n @users = User.all\n authorize @colaboradore\n end", "def index\n @activist_fronts = ActivistFront.all\n authorize ActivistFront\n end", "def authorize \n redirect_to login_url, notice: \"Please log in\" if session[:user_id].nil?\n end", "def index\n redirect_to user_path(@user)\n end", "def authenticate_user\n# save current page for redirection after login\n redirect_to controller: :user, action: :login unless logged_in? \n current_user\n end", "def authorize # we can call it anything\n redirect_to '/login' unless current_user # if there is a current user then it will never redirect\n end", "def authorized\n\t unless admin?\n\t redirect_to root_path\n\t end\n end", "def loginpage\n end", "def authorize\n redirect_to new_session_path unless logged_in?\n end", "def authorize\n redirect_to login_url, alert: \"Not authorized\" if !current_user\n end", "def authentication_required\n if !logged_in?\n redirect_to login_path\n end\n end", "def show\n redirect_user\n end", "def user_authentication\n end", "def index\n if !current_user\n redirect_to '/'\n end\n\n if current_user.email == 'samir@test.com' || current_user.email == 'priyatham.ven@gmail.com'\n @critiques = Critique.all\n else\n redirect_to '/'\n end\n end", "def show\n authorize User\n end", "def show\n authorize User\n end", "def show \n #if current_user.company_id == @user.company_id \n authorize @user \n end", "def login_required\n not_authorized unless current_user\n end" ]
[ "0.71549875", "0.69425726", "0.69250274", "0.68490267", "0.68470484", "0.6843138", "0.677879", "0.67738414", "0.67673504", "0.6763529", "0.6763529", "0.6733842", "0.6733842", "0.67153317", "0.67111766", "0.6686565", "0.66669947", "0.6665994", "0.6665994", "0.6665994", "0.6665994", "0.6665994", "0.6665994", "0.6665994", "0.6665994", "0.666135", "0.6645357", "0.6641674", "0.6633666", "0.66322845", "0.6625406", "0.66195965", "0.66156584", "0.661295", "0.66065705", "0.6584063", "0.6576952", "0.65698045", "0.65691125", "0.6554717", "0.65490913", "0.6544059", "0.65309536", "0.65232056", "0.65224576", "0.65208745", "0.6519024", "0.6514485", "0.65100807", "0.6505882", "0.6496274", "0.64937735", "0.64779484", "0.64686793", "0.64565104", "0.6432016", "0.6432016", "0.6432016", "0.64318186", "0.6431498", "0.6428715", "0.64260244", "0.6425379", "0.6420747", "0.64205116", "0.64158887", "0.640934", "0.6408606", "0.6398909", "0.6393746", "0.63880795", "0.638595", "0.6384351", "0.63823104", "0.6379709", "0.6379615", "0.6379373", "0.6377728", "0.6372467", "0.6367206", "0.6363312", "0.63473755", "0.63410264", "0.63392556", "0.633846", "0.63372743", "0.63364345", "0.6335744", "0.6335146", "0.63351065", "0.6330818", "0.6326298", "0.63170636", "0.6314409", "0.6313448", "0.6310782", "0.63100576", "0.63088673", "0.63088673", "0.6306408", "0.6301081" ]
0.0
-1
GET /authors/1 GET /authors/1.xml
def show @author = Author.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @author } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @author_repository = AuthorRepository.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @author_repository }\n end\n end", "def show_authors\n tag = params['query']\n\n @article = Article.where('arxiv_id = ?', tag).first\n @authors = @article.authors\n # puts authors\n\n @found = 1\n if @authors.nil?\n @msg = \"None found, try again...\"\n @found = 0\n @authors = []\n end\n\n render \"authors\"\n end", "def index\n @authors = Author.all\n respond_with(@authors)\n end", "def index\n conditions = { :block => false }\n conditions.merge!( :is_opinion => true ) if params[:opinion] == '1'\n conditions.merge!( :is_agency => true ) if params[:agency] == '1'\n unless params[:author_id].blank? && params[:author_ids].blank?\n author_ids = scan_multiple_value_param( :author_id, :first ) || scan_multiple_value_param( :author_ids )\n conditions.merge!( :id => author_ids )\n end\n params[:top] == '1' ? top() : ( !params[:q].blank? ? search( conditions ) : list( conditions ) )\n @authors.delete_if{ |a| a.story_authors.count < 2 } if params[:cf] == '1'\n rxml_data( @authors, :root => 'authors', :with_pagination => true )\n end", "def index\n @authors = Author.all\n end", "def index\n @authors = Author.all\n end", "def index\n @authors = Author.all\n end", "def index\n @authors = Author.all\n end", "def authors\n nodes = @doc.xpath(\"atom:feed/atom:author\", ::AtomFeed::NS) || []\n nodes.map { |node| AtomPerson.new(node) }\n end", "def get_related_authors\n tag = params['query']\n\n @articles = get_articles(tag) # gets all articles of this author\n # puts 'ARTICLES'\n # ap @articles\n\n @related_articles = []\n @authors = []\n\n # for each of the author's articles, get 1st degree articles and their respective authors\n @articles.each do |article|\n puts \"ARTIClE ID \"\n puts article.arxiv_id\n getRelatedPapers(article.arxiv_id, -1).each do |related|\n\n authors = related.authors\n authors.each do |author|\n\n if !@authors.include?(author)\n @authors << author\n end\n\n end\n end\n end\n \n\n @found = 1\n if @authors == []\n @msg = \"None found, try again...\"\n @found = 0\n end\n\n render \"authors\"\n end", "def show\n @publications = @author.publications.paginate(page: params['page'], per_page: 10)\n @crumbs = [['Authors', authors_path], @author.family]\n end", "def books_author\n \t@books = Book.where(\"author = '#{params[:author]}'\")\n\n \trespond_to do |format|\n format.html # list_authors.html.erb\n format.json { render json: @books }\n end\n end", "def authors\n nodes = @node.xpath(\"atom:author\", ::AtomFeed::NS) || []\n nodes.map { |node| AtomPerson.new(node) }\n end", "def crossref_authors\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.contributors {\n authors.each_with_index do |author, index|\n given_name = author.given_name\n surname = author.last_name\n orcid = author.orcid\n if index == 0\n sequence = \"first\"\n else\n sequence = \"additional\"\n end\n xml.person_name(:sequence => sequence, :contributor_role => \"author\") {\n xml.given_name given_name.encode(:xml => :text)\n if surname.nil?\n xml.surname \"No Last Name\".encode(:xml => :text)\n else\n xml.surname surname.encode(:xml => :text)\n end\n xml.ORCID \"http://orcid.org/#{author.orcid}\" if !orcid.nil?\n }\n end\n }\n end\n\n return builder.doc.xpath('//contributors').to_xml\n end", "def show\n @authors_book = AuthorsBook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @authors_book }\n end\n end", "def get_all_authors\n count = params[:count] # Optional - and must be an integer. Cuts the amount of authors return down to the number specified.\n timeline = params[:timeline] # Optional - and must be boolean. Determines whether to return personality predictions by day, month, and year.\n traits = params[:traits] # Optional - value must be a substring of \"ESACO\". Determines which traits to return.\n puts \"count:#{count}\"\n puts \"timeline:#{timeline}\"\n puts \"traits:#{traits}\"\n\n request = Net::HTTP::Get.new(\"/personality-api/1/all_authors.json?count=#{count}&timeline=#{timeline}&traits=#{traits}\")\n request.basic_auth BmnPersonalityApiSkeletonRor::Application.config.user_name, BmnPersonalityApiSkeletonRor::Application.config.password\n response = @http.request(request)\n render :text => response.body\n\n end", "def authors\n\t#params[:diff] = params[:diff].eql?\"true\"\n \trespond_in_format Marginalia.authors(params[:id],params[:diff])\n end", "def index\n @authors = Author.all\n end", "def authors\n author\n end", "def show\n @author = Author.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @author }\n end\n end", "def index\n @references_authors = References::Author.all\n end", "def index\n @authorships = Authorship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render xml: @authorships }\n end\n end", "def getAuthors(indexMeta, rawMeta)\n # If not UC-Ingest formatted, fall back on index info\n if !rawMeta.at(\"/record/authors\")\n return indexMeta.multiple(\"creator\").map { |name| {name: name} }\n end\n\n # For UC-Ingest, we can provide more detailed author info\n rawMeta.xpath(\"/record/authors/*\").map { |el|\n if el.name == \"organization\"\n { name: el.text, organization: el.text }\n elsif el.name == \"author\"\n data = { name: formatAuthName(el) }\n el.children.each { |sub|\n if sub.name == \"identifier\"\n data[(sub.attr('type') + \"_id\").to_sym] = sub.text\n else\n data[sub.name.to_sym] = sub.text\n end\n }\n data\n else\n raise(\"Unknown element #{el.name.inspect} within UCIngest authors\")\n end\n }\nend", "def show\n @map_author = MapAuthor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @map_author }\n end\n end", "def index\n\t\t@people = Person.all\n\t\t# respond_to do |format|\n\t\t# \tformat.xml { send_data @entries.to_xml, :type => 'text/xml; charset=UTF-8;', :disposition => 'attachment; filename=entries.xml'}\n\t\t# end\n\tend", "def show\n # @authorship = Authorship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render xml: @authorship }\n end\n end", "def show\n @author = Author.find(params[:id])\n respond_with(@author)\n end", "def new\n @author = Author.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @author }\n end\n end", "def show_authors(result)\n author_array = []\n if result['Items'].present?\n flag = 0\n authorString = []\n result['Items'].each do |item|\n if item['Group'].present?\n if item['Group'] == \"Au\"\n # let Don and Michelle know what this cleaner function does\n newAuthor = processAPItags(item['Data'].to_s)\n # i'm duplicating the semicolor - fix\n newAuthor.gsub!(\"<br />\", \"; \")\n authorString.push(newAuthor)\n flag = 1\n end\n end\n end\n if flag == 1\n return truncate_article authorString.join(\"; \").html_safe\n end\n end\n contributors = result.fetch('RecordInfo', {}).fetch('BibRecord', {}).fetch('BibRelationships', {}).fetch('HasContributorRelationships', [])\n if not contributors.empty?\n contributors.each do |contributor|\n namefull = contributor.fetch('PersonEntity', {}).fetch('Name', {}).fetch('NameFull', nil)\n if namefull\n url_vars = {\"q\" => '\"' + namefull.gsub(\",\", \"\").gsub(\"%2C\", \"\").to_s + '\"', \"search_field\" => \"author\"}\n link2 = generate_next_url_newvar_from_hash(url_vars)\n author_link = '<a href=\"' + request.fullpath.split(\"?\")[0] + \"?\" + link2 + '\">' + namefull.to_s + '</a>'\n author_array.push(author_link)\n end\n\n end\n return author_array.join(\"; \").html_safe\n end\n return ''\n end", "def new\n @author_repository = AuthorRepository.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @author_repository }\n end\n end", "def index\n @products = Product.find(:all, :include => [:author])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @products }\n end\n end", "def author\n @node.at_xpath(\"author\").try(:content)\n end", "def index1\n @publications = Publication.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @publications }\n end\n end", "def show\n @author = Author.find(params[:id])\n render :show\n end", "def authors\n @authors\n end", "def show\n @authorid = params[:id]\n @author = Author.find( params[:id] )\n @publishedBooks = Book.where( \"author = '#{@author.name}' \" )\n end", "def authors\n document.search(\"[@id='bookAuthors']/[@itemprop='author']/a/span\").map { |elem| elem.innerHTML.strip } rescue []\n end", "def author_info(url)\n authorinfo = handle_response(self.class.get(\"/authorinfo.json\", :query => {:url => url}))\n Topsy::Author.new(authorinfo)\n end", "def index\n if params[:author_id]\n @author = Author.find(params[:author_id])\n @books = @author.books\n else\n @books = Book.all\n end\n end", "def get_author\n id = params[:ID]\n puts \"ID:#{id}\"\n request = Net::HTTP::Get.new(\"/personality-api/1/author.json?ID=#{id}\")\n request.basic_auth BmnPersonalityApiSkeletonRor::Application.config.user_name, BmnPersonalityApiSkeletonRor::Application.config.password\n response = @http.request(request)\n render :text => response.body\n\n end", "def author\n I18n.locale = params[:lang]\n\n @quotes = Quote.where(:author => CGI::unescape(params[:author]))\n @quote = Quote.new\n\n @quote.author = params[:author] if !(params[:author].nil?)\n\n respond_to do |format|\n format.html # author.html.erb\n format.xml { render :xml => @quotes }\n end\n end", "def show\n @authorship = Authorship.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @authorship.to_xml }\n end\n end", "def index\n if @author_id\n @publications = @author.publications\n else\n @publications = Publication.all\n end\n render json: @publications\n end", "def author\n traverse_element('meta',\n '{http://www.w3.org/1999/xhtml}meta') {|e|\n begin\n next unless e.fetch_attr('name').downcase == 'author'\n author = e.fetch_attribute('content').strip\n return author if !author.empty?\n rescue IndexError\n end\n }\n\n traverse_element('link',\n '{http://www.w3.org/1999/xhtml}link') {|e|\n begin\n next unless e.fetch_attr('rev').downcase == 'made'\n author = e.fetch_attribute('title').strip\n return author if !author.empty?\n rescue IndexError\n end\n }\n\n if channel = find_element('{http://purl.org/rss/1.0/}channel')\n channel.traverse_element('{http://purl.org/dc/elements/1.1/}creator') {|e|\n begin\n author = e.extract_text.strip\n return author if !author.empty?\n rescue IndexError\n end\n }\n channel.traverse_element('{http://purl.org/dc/elements/1.1/}publisher') {|e|\n begin\n author = e.extract_text.strip\n return author if !author.empty?\n rescue IndexError\n end\n }\n end\n\n ['http://www.w3.org/2005/Atom', 'http://purl.org/atom/ns#'].each {|xmlns|\n each_child {|top|\n next unless top.elem?\n if top.name == \"{#{xmlns}}feed\"\n if feed_author = find_element(\"{#{xmlns}}author\")\n feed_author.traverse_element(\"{#{xmlns}}name\") {|e|\n begin\n author = e.extract_text.strip\n return author if !author.empty?\n rescue IndexError\n end\n }\n end\n end\n }\n }\n\n nil\n end", "def show\n @research = Research.find(params[:id])\n @page_title = \"Hello Congress research request: \" + @research.name\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @research.to_xml(:except => [:email]) }\n end\n end", "def show\n (@response, @document_list) = search_results(set_author_query(params))\n\n # Remove the header search form, to prefer the search within author form\n @no_header_search = true\n end", "def index\n @authors_books = AuthorsBook.all\n end", "def index\n @organizations = Organization.find(:all, :order => 'name ASC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @organizations }\n end\n end", "def index\n if params.include?(:name)\n @owner = Owner.find_by_name(params[:name])\n @articles = @owner.articles\n else\n @owner = nil\n @articles = Article.includes(:owner).all\n end\n\n respond_to do |format|\n format.html { render :index }\n format.json { render_json_responsibly(articles: @articles) }\n end\n end", "def index\n @person_verses = PersonVerse.all\n\n respond_to do |format|\n format.html { render :layout => \"main\" } # index.html.erb\n format.xml { render :xml => @person_verses }\n end\n end", "def show\n @copyright_holder = CopyrightHolder.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @copyright_holder.to_xml }\n end\n end", "def get_authors(authors, options={})\n Array(authors).map { |author| get_one_author(author, options) }\n end", "def author\n @author_data ||= read(\"/user/#{@author}/about.json\", :handler => \"User\")\n end", "def author\n if @author.nil?\n @author = FeedTools::Author.new\n author_node = FeedTools::XmlHelper.try_xpaths(self.channel_node, [\n \"atom10:author\",\n \"atom03:author\",\n \"atom:author\",\n \"author\",\n \"managingEditor\",\n \"dc:author\",\n \"dc:creator\"\n ])\n unless author_node.nil?\n @author.raw = FeedTools::XmlHelper.try_xpaths(\n author_node, [\"text()\"], :select_result_value => true)\n @author.raw = FeedTools::HtmlHelper.unescape_entities(@author.raw)\n unless @author.raw.nil?\n raw_scan = @author.raw.scan(\n /(.*)\\((\\b[A-Z0-9._%-\\+]+@[A-Z0-9._%-]+\\.[A-Z]{2,4}\\b)\\)/i)\n if raw_scan.nil? || raw_scan.size == 0\n raw_scan = @author.raw.scan(\n /(\\b[A-Z0-9._%-\\+]+@[A-Z0-9._%-]+\\.[A-Z]{2,4}\\b)\\s*\\((.*)\\)/i)\n unless raw_scan.size == 0\n author_raw_pair = raw_scan.first.reverse\n end\n else\n author_raw_pair = raw_scan.first\n end\n if raw_scan.nil? || raw_scan.size == 0\n email_scan = @author.raw.scan(\n /\\b[A-Z0-9._%-\\+]+@[A-Z0-9._%-]+\\.[A-Z]{2,4}\\b/i)\n if email_scan != nil && email_scan.size > 0\n @author.email = email_scan.first.strip\n end\n end\n unless author_raw_pair.nil? || author_raw_pair.size == 0\n @author.name = author_raw_pair.first.strip\n @author.email = author_raw_pair.last.strip\n else\n unless @author.raw.include?(\"@\")\n # We can be reasonably sure we are looking at something\n # that the creator didn't intend to contain an email address\n # if it got through the preceeding regexes and it doesn't\n # contain the tell-tale '@' symbol.\n @author.name = @author.raw\n end\n end\n end\n if @author.name.blank?\n @author.name = FeedTools::HtmlHelper.unescape_entities(\n FeedTools::XmlHelper.try_xpaths(author_node, [\n \"atom10:name/text()\",\n \"atom03:name/text()\",\n \"atom:name/text()\",\n \"name/text()\",\n \"@name\"\n ], :select_result_value => true)\n )\n end\n if @author.email.blank?\n @author.email = FeedTools::HtmlHelper.unescape_entities(\n FeedTools::XmlHelper.try_xpaths(author_node, [\n \"atom10:email/text()\",\n \"atom03:email/text()\",\n \"atom:email/text()\",\n \"email/text()\",\n \"@email\"\n ], :select_result_value => true)\n )\n end\n if @author.url.blank?\n @author.url = FeedTools::HtmlHelper.unescape_entities(\n FeedTools::XmlHelper.try_xpaths(author_node, [\n \"atom10:url/text()\",\n \"atom03:url/text()\",\n \"atom:url/text()\",\n \"url/text()\",\n \"atom10:uri/text()\",\n \"atom03:uri/text()\",\n \"atom:uri/text()\",\n \"uri/text()\",\n \"@href\",\n \"@uri\",\n \"@href\"\n ], :select_result_value => true)\n )\n end\n if @author.name.blank? && !@author.raw.blank? &&\n !@author.email.blank?\n name_scan = @author.raw.scan(\n /\"?([^\"]*)\"? ?[\\(<].*#{@author.email}.*[\\)>].*/)\n if name_scan.flatten.size == 1\n @author.name = name_scan.flatten[0].strip\n end\n if @author.name.blank?\n name_scan = @author.raw.scan(\n /.*#{@author.email} ?[\\(<]\"?([^\"]*)\"?[\\)>].*/)\n if name_scan.flatten.size == 1\n @author.name = name_scan.flatten[0].strip\n end\n end\n end\n @author.name = nil if @author.name.blank?\n @author.raw = nil if @author.raw.blank?\n @author.email = nil if @author.email.blank?\n @author.url = nil if @author.url.blank?\n if @author.url != nil\n begin\n if !(@author.url =~ /^file:/) &&\n !FeedTools::UriHelper.is_uri?(@author.url)\n @author.url = FeedTools::UriHelper.resolve_relative_uri(\n @author.url, [author_node.base_uri, self.base_uri])\n end\n rescue\n end\n end\n if FeedTools::XmlHelper.try_xpaths(author_node,\n [\"@gr:unknown-author\"], :select_result_value => true) == \"true\"\n if @author.name == \"(author unknown)\"\n @author.name = nil\n end\n end\n end\n # Fallback on the itunes module if we didn't find an author name\n begin\n @author.name = self.itunes_author if @author.name.nil?\n rescue\n @author.name = nil\n end\n end\n return @author\n end", "def index\n @authors = Author.all.includes(:books)\n end", "def author\n traverse_element('meta',\n '{http://www.w3.org/1999/xhtml}meta') {|e|\n begin\n next unless e.fetch_attr('name').downcase == 'author'\n author = e.fetch_attribute('content').strip\n return author if !author.empty?\n rescue IndexError\n end\n }\n\n traverse_element('link',\n '{http://www.w3.org/1999/xhtml}link') {|e|\n begin\n next unless e.fetch_attr('rev').downcase == 'made'\n author = e.fetch_attribute('title').strip\n return author if !author.empty?\n rescue IndexError\n end\n } \n\n if channel = find_element('{http://purl.org/rss/1.0/}channel')\n channel.traverse_element('{http://purl.org/dc/elements/1.1/}creator') {|e|\n begin\n author = e.extract_text.strip\n return author if !author.empty?\n rescue IndexError\n end\n }\n channel.traverse_element('{http://purl.org/dc/elements/1.1/}publisher') {|e|\n begin\n author = e.extract_text.strip\n return author if !author.empty?\n rescue IndexError\n end\n }\n end\n\n nil\n end", "def index\n @books_authors = BooksAuthor.all\n end", "def\n get_author()\n @author\n end", "def show\n @university = University.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @university }\n end\n end", "def index\n @chapter_authors = ChapterAuthor.all\n end", "def author\n authors.first\n end", "def author\n authors.first\n end", "def get_authors(authors, options = {})\n Array(authors).map { |author| get_one_author(author, options) }\n end", "def get_authors(authors)\n Array(authors).map { |author| get_one_author(author) }\n end", "def index\n @book_authors = BookAuthor.all\n end", "def show\n @publication = Publication.find(params[:id])\n @people = Person.find(:all)\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @publication }\n end\n end", "def show\n @researcher = Researcher.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @researcher }\n end\n end", "def index\n @users = User.find(:all, :order => 'name ASC')\n respond_to do |format|\n format.html \n format.xml { @users.to_xml }\n end\n end", "def index\n @sort = params[:sort]\n @authors =\n case @sort\n when 'date'\n Author.order(created_at: :desc)\n when 'publications'\n Author\n .left_joins(:publications).group(:id)\n .order('COUNT(publications.id) DESC')\n when 'names'\n Author\n .left_joins(:names).group(:id)\n .select('\"authors\".*, COUNT(DISTINCT names.id) AS name_count')\n .order(name_count: :desc)\n else\n @sort = 'alphabetically'\n Author.order(name: :asc)\n end\n @authors = @authors.paginate(page: params[:page], per_page: 100)\n @crumbs = ['Authors']\n end", "def index\n @dataset_researchers = Lien.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @dataset_researchers }\n end\n end", "def index\n @publications = Publication.all\n @publications_by_year = @publications.group_by(&:year).sort.reverse\n @people = Person.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @publications }\n end\n end", "def list_books(api_object)\n puts \"Current Books:\"\n doc = Nokogiri::XML.parse api_object.read\n names = doc.xpath('books/book/title').collect {|e| e.text }\n puts names.join(\", \")\n puts \"\"\nend", "def show\n @author_extra = AuthorExtra.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @author_extra }\n end\n end", "def get_author()\n @author\n end", "def index\n @q = Author.search(params[:q])\n @authors = @q.result(distinct: true).paginate(:page => params[:page]).order('last_name ASC')\n end", "def serialize!\n\t\t\t@namespaces=raw_doc.root.namespaces if @namespaces.nil?\n\t\t\t@authors=[]\n\t\t\t@raw_doc=raw_doc.at('./xmlns:entry',@namespaces) if raw_doc.at('./xmlns:entry',@namespaces)\n\t\t\t@title=text(raw_doc.at('./xmlns:title',@namespaces))\n\t\t\t@id=text(raw_doc.at('./xmlns:id',@namespaces))\n\t\t\t@summary=text(raw_doc.at('./xmlns:summary',@namespaces))\n\t\t\td=text(raw_doc.at('./xmlns:updated',@namespaces))\n\t\t\t@updated=DateTime.parse(d) unless d.nil?\n\t\t\td=text(raw_doc.at('./xmlns:published',@namespaces))\n\t\t\t@published=DateTime.parse(d) unless d.nil?\n\n\t\t\t@authors=raw_doc.xpath('./xmlns:author',@namespaces).collect do |author|\n\t\t\t\t{\n\t\t\t\t\t:name => text(author.at('./xmlns:name',@namespaces)),\n\t\t\t\t\t:uri => text(author.at('./xmlns:uri',@namespaces)),\n\t\t\t\t\t:email => text(author.at('./xmlns:email',@namespaces))\n\t\t\t\t}\n\t\t\tend\n\n\t\t\t@links=OPDS::Support::LinkSet.new @browser\n\t\t\traw_doc.xpath('./xmlns:link',@namespaces).each do |n|\n\t\t\t\ttext=nil\n\t\t\t\ttext=n.attributes['title'].value unless n.attributes['title'].nil?\n\t\t\t\tlink=n.attributes['href'].value\n\t\t\t\ttype=n.attributes['type'].value unless n.attributes['type'].nil?\n\t\t\t\tprice=nil\n\t\t\t\tcurrency=nil\n\t\t\t\t@namespaces['opds']||='http://opds-spec.org/2010/catalog'\n\t\t\t\ttypes=n.search('.//opds:indirectAcquisition',@namespaces).map{|b| b['type']}\n\t\t\t\ttype=[type,types].flatten.compact unless types.nil? || types.empty?\n\t\t\t\toprice=n.at('./opds:price',@namespaces)\n\t\t\t\tif oprice\n\t\t\t\t\tprice=text(oprice)\n\t\t\t\t\tcurrency=oprice.attributes['currencycode'].value unless oprice.attributes['currencycode'].nil?\n\t\t\t\tend\n\n\t\t\t\tunless n.attributes['rel'].nil?\n\t\t\t\t\tn.attributes['rel'].value.split.each do |rel|\n\t\t\t\t\t\t@links.push(rel,link,text,type,price,currency)\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\t@links.push(nil,link,text,type,price,currency)\n\t\t\t\tend\n\t\t\tend\n\t\t\t@dcmetas=Hash.new\n\t\t\tprefs=@namespaces.reject{|_,v| !%W[http://purl.org/dc/terms/ http://purl.org/dc/elements/1.1/].include?v}\n\t\t\tprefs.keys.map{|p| p.split(':').last}.each do |pref|\n\t\t\t\traw_doc.xpath('./'+pref+':*',@namespaces).each do |n|\n\t\t\t\t\t@dcmetas[n.name]=[] unless @dcmetas[n.name]\n\t\t\t\t\t@dcmetas[n.name].push [n.text, n]\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t@categories=raw_doc.xpath('./xmlns:category',@namespaces).collect do |n|\n\t\t\t\t[text(n.attributes['label']),text(n.attributes['term'])]\n\t\t\tend\n\n\t\t\t@content=raw_doc.at('./xmlns:content',@namespaces).to_s\n\t\t\t\n\t\t\t@contributors=raw_doc.xpath('./xmlns:contributor',@namespaces).collect do |auth|\n\t\t\t\t{\n\t\t\t\t\t:name => text(raw_doc.at('./xmlns:contributor/xmlns:name',@namespaces)),\n\t\t\t\t\t:uri => text(raw_doc.at('./xmlns:contributor/xmlns:uri',@namespaces)),\n\t\t\t\t\t:email => text(raw_doc.at('./xmlns:contributor/xmlns:email',@namespaces))\n\t\t\t\t}\n\t\t\tend\n\n\t\t\t@rights=text(raw_doc.at('./xmlns:rights',@namespaces))\n\t\t\t@subtitle=text(raw_doc.at('./xmlns:rights',@namespaces))\n\n\t\tend", "def index\n @paper_authors = PaperAuthor.all\n end", "def show\n @citation = Citation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @citation }\n end\n end", "def index\n @articles = Article.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @articles }\n end\n end", "def show\n @journal = @book.journals.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @journal }\n end\n end", "def index\n @authors = Author.find_by_sql(\"SELECT * FROM AUTHOR\").paginate(:page => params[:page] || 1,:per_page => 20)\n end", "def index\n @q = Author.ransack(params[:q])\n \n # The sortable_name field gives the last name downcased with \"ae\" etc substituted for umlauted vowels\n @authors = @q.result.paginate(:page => params[:page], :per_page => 14).order(sortable_name: :asc, firstnames: :asc)\n end", "def set_authors_publication\n @authors_publication = AuthorsPublication.find(params[:id])\n end", "def author\n @author ||= Readability::Document.new(@html).author\n end", "def author\n @author\n end", "def set_authors_book\n @authors_book = AuthorsBook.find(params[:id])\n end", "def index\n @by_pageview = Author.with_article.order('pageview desc').limit(10)\n @by_article = Author.with_article.order('articles_count desc').limit(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @authors }\n end\n end", "def show_all_article_titles_with_authors\n @all = all_article_titles_with_authors\n @all.each do |title, author|\n puts \"#{author} - #{title}\"\n end\n return @all\n end", "def index\n @people = Person.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @people }\n end\n end", "def index\n @people = Person.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @people }\n end\n end", "def index\n @people = Person.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @people }\n end\n end", "def index\n @people = Person.all\n @title = \"peoples\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @people }\n end\n end", "def show\n @artist = Artist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @artist }\n end\n end", "def authors\n read_property 'Authors'\n end", "def show\n @reviewer = Reviewer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @reviewer }\n end\n end", "def index\n @organs = Organ.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @organs }\n end\n end", "def index\n @distributions = @foyer.distributions\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @distributions }\n end\n end", "def show\n @author_paper = AuthorPaper.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @author_paper }\n end\n end", "def author\n response = read(\"/user/#{@author}/about.json\", :handler => \"User\") if @author\n @author_data ||= response[0] if response\n end", "def the_author(content=nil)\n if node = content || @content || Content.get(params[:id]) \n author = node.author\n end\n end" ]
[ "0.68134266", "0.6810114", "0.6691908", "0.65655464", "0.65010214", "0.65010214", "0.65010214", "0.65010214", "0.649269", "0.64491683", "0.63969254", "0.63959527", "0.63925344", "0.6384979", "0.63823915", "0.63539195", "0.63266855", "0.63105977", "0.62936586", "0.62145835", "0.6188758", "0.6175385", "0.6148734", "0.6132537", "0.6118228", "0.60956496", "0.6077894", "0.6072816", "0.6062476", "0.6039097", "0.60146266", "0.5994908", "0.59784555", "0.59757704", "0.59712875", "0.596915", "0.59646356", "0.59424514", "0.59396714", "0.59270144", "0.5915828", "0.59145653", "0.59050614", "0.5893158", "0.5881538", "0.5873908", "0.5871017", "0.5861074", "0.5840504", "0.5826871", "0.5822706", "0.58195215", "0.5819023", "0.5807522", "0.58040327", "0.57919747", "0.5786832", "0.57862127", "0.5770362", "0.57671493", "0.5757457", "0.5757457", "0.5748841", "0.5744669", "0.57376075", "0.5730042", "0.57231295", "0.5707956", "0.57062626", "0.5704525", "0.5700581", "0.56984556", "0.56916636", "0.56886804", "0.56779504", "0.5667062", "0.5666097", "0.56560284", "0.56547123", "0.56516814", "0.56424737", "0.56416035", "0.5640411", "0.5635694", "0.5624005", "0.5620428", "0.5618162", "0.56172043", "0.5616405", "0.5616405", "0.5616405", "0.5615506", "0.56115097", "0.5605852", "0.56054467", "0.5599393", "0.5598064", "0.5594256", "0.55908114", "0.5578603" ]
0.70273745
0
this is for escaping in sql
def clean_text(input) output = input.gsub(/'/) { |x| "\'#{x}" } return output end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def escape(s)\n dummy_conn.escape(s)\n end", "def to_escaped_for_sql_like\n gsub(/[\\\\%_]/) { |x| '\\\\' + x }.gsub(\"*\", \"%\")\n end", "def generate_sql_escape(token)\n escaped_token = token.gsub(/\\\\|'/, '\\0\\0\\0\\0').gsub(\"?\", \"\\\\\\\\77\")\n \"'\" + escaped_token + \"'\"\n end", "def escape(string); end", "def escape_sql(args)\n return @text if args.empty?\n sql = @text.dup\n vars = args.dup\n\n replacements = 0\n mismatch = false\n\n sql.gsub!(/'[^']*'|\"[^\"]*\"|`[^`]*`|\\?/) do |x|\n next x unless x == '?'\n replacements += 1\n if vars.empty?\n mismatch = true\n else\n var = vars.shift\n connection.quote_value(var)\n end\n end\n\n if !vars.empty? || mismatch\n raise ArgumentError, \"Binding mismatch: #{args.size} for #{replacements}\"\n else\n sql\n end\n end", "def escape(string)\n # This code is taken directly from the documentation so we dont have to rely on the SQLite3::Database class. This way it can also be used with JRuby and IronRuby...\n # http://sqlite-ruby.rubyforge.org/classes/SQLite/Database.html\n string.to_s.gsub(\"'\", \"''\")\n end", "def escape(str)\n return ActiveRecord::Base.connection.quote_string(str)\n end", "def escape(input); input.to_s.gsub('\"', '\\\\\"'); end", "def escape(value)\n $db.escape_identifier(value)\nend", "def sanitize_sql_like(text, escape_character = '\\\\')\n text.to_s.gsub(/(^|.)([%_])/) do |s|\n ($1 == escape_character) ? s : [$1, escape_character, $2].compact.join\n end\n end", "def escape(string)\n #This is a stub, used for indexing\n end", "def escape(value)\n end", "def escape(str); end", "def sql_string(value)\n \"'#{value.gsub(\"'\", \"''\")}'\" \nend", "def escape(query)\n @my.escape(query)\n end", "def escaped_sql\n sql % binds.reduce({}) { |a, (col, val)|\n a[col.to_sym] = if val.is_a? Array\n val.map { |x| @conn.quote x }.join(', ')\n else\n @conn.quote val\n end\n a\n }\n end", "def escape_query(query)\n # backslash escape doesn't seem to work\n #query.gsub(/([\\\\\\(\\)\\:])/) do |match|\n # \"\\\\#{$1}\"\n #end\n query.gsub(/([\\\\\\(\\)\\:])/, ' ')\n end", "def escape(string)\n @conn.escape(string.to_s)\n end", "def escape(s)\n s.gsub('\"', '\\\"')\nend", "def esc_sql(data )\n # global $wpdb;\n $wpdb._escape(data)\n end", "def escape_value(connection, value)\n connection.quote(value)\n end", "def escape_quotes(unfiltered)\n unfiltered.to_s.gsub(/'/, \"''\")\n end", "def escape_str_field(str)\n str = str.to_s.sub(/\\`/,'')\n @mysql.escape(str)\n end", "def escape(s)\n s.to_s.gsub('\"', '&quot;').gsub(\"'\", '&apos;')\n end", "def test_sql_escaped\n exc_handler = HumanParseExceptionHandler.new\n new_str = exc_handler.get_human_result_for_string(\"fo'ob\\\"ar\",\"ParseException\")\n assert_equal(false, new_str)\n end", "def escape(x)\n x = x.to_s\n x.gsub! @delimiter, @edelim if @delimiter\n x.gsub! @internal_delimiter, @eidelim\n x\n end", "def escape(text)\n text.gsub('\"', '\\\"')\nend", "def quote_and_escape(value)\n case value\n when \"NULL\"\n value\n else\n value = value.gsub(/\\\\/, ARRAY_ESCAPE)\n value.gsub!(/\"/,\"\\\\\\\"\")\n \"\\\"#{value}\\\"\"\n end\n end", "def escape_for_cql_double_quotes(str)\n str = str.gsub('\"', \" \")\n str = str.gsub(\"'\", \"''\")\n\n return str\n end", "def sql_quoted(value)\n Arel::Nodes.build_quoted(value)\n end", "def quote_string(string)\n @logger.unknown(\"ODBCAdapter#quote_string>\") if @trace\n\n # MySQL requires backslashes to be escaped\t\t\t\t\n string.gsub(/\\\\/, '\\&\\&').gsub(/'/, \"''\")\n end", "def sanitize_sql_like(string, escape_character = '\\\\')\n pattern = Regexp.union(escape_character, '%', '_')\n string.gsub(pattern) { |x| [escape_character, x].join }\n end", "def cgi_escape(input); end", "def escape(val)\n return val\n end", "def quote_string( s ) #:nodoc:\n @connection.escape( s )\n end", "def literal_string_append(sql, s)\n sql << \"'\" << db.synchronize(@opts[:server]){|c| c.escape(s)} << \"'\"\n end", "def quote(s, column = nil)\n dummy_conn.quote(s)\n end", "def escape_string(str)\n str.gsub(\"'\", \"''\")\n end", "def escaped_query\n /\\s/.match?(query) ? \"\\\"#{query}\\\"\" : query\n end", "def sql_valuify\n nil? ? 'NULL' : \"'#{to_s.gsub(/\\\\/, '\\&\\&').gsub(/'/, \"''\").gsub(/\\t/, \"\\\\t\").gsub(/\\r/, \"\\\\r\").gsub(/\\n/, \"\\\\n\")}'\"\n end", "def escape_for_single_quotes(str)\n str.gsub \"'\", \"''\"\n end", "def escape_string(str)\n raw_connection.escape(str)\n end", "def escape_quotes(text)\n text.gsub(\"'\", \"''\")\n end", "def escape_literal(text)\n text\n end", "def quote_string(s) #:nodoc:\n @connection.escape(s)\n end", "def literal_string_append(sql, v)\n sql << \"'\" << v.gsub(\"'\", \"''\") << \"'\"\n end", "def qesc(s)\n s.gsub(\"'\", \"''\")\nend", "def escape_value(v) \n if v.nil?\n # Nulls (nil)\n return \"NULL\"\n elsif v.kind_of? Integer or v.kind_of? Float\n # Integers / Floats\n return v.to_s\n else\n # Everything Else\n return \"'#{@mysql.escape(v.to_s)}'\" \n end\n end", "def literal_string_append(sql, s)\n sql << APOS << s.to_s.gsub(STRING_ESCAPE_RE){|m| STRING_ESCAPES[m]} << APOS\n end", "def consume_escaped; end", "def requote(value) return restore_ends(value, '\"') end", "def escape_double_quotes\r\n return self.gsub('\"', '\\\"')\r\n end", "def quote_string(string)\n string.gsub(/\\\\/, '\\&\\&').gsub(/'/, \"''\") \n end", "def escape_single_quotes(str)\n str.gsub(\"'\", '\\\\\\\\\\'')\nend", "def quoted(value)\n sql _scope.connection.quote(value)\n end", "def quoted(value)\n sql _scope.connection.quote(value)\n end", "def escape_text(text)\n text\n end", "def literal_string_append(sql, v)\n sql << APOS << db.synchronize{|c| c.escape_string(v)} << APOS\n end", "def quote(value); end", "def shell_escape(s)\n s = s.to_s\n if s !~ /^[0-9A-Za-z+,.\\/:=@_-]+$/\n s = s.gsub(\"'\") { \"'\\\\''\" }\n s = \"'#{s}'\"\n end\n s\n end", "def escape_javascript(raw)\n if raw\n quote = raw.count(%{'}) >= raw.count(%{\"}) ? %{\"} : %{'}\n escaped = raw.gsub(/(\\\\|\\r\\n|[\\n\\r#{quote}])/u) {|match| JS_ESCAPE_MAP[match] }\n \"#{quote}#{escaped}#{quote}\"\n else\n '\"\"'\n end\n end", "def literal_string_append(sql, v)\n sql << \"'\" << ::Mysql.quote(v) << \"'\"\n end", "def escape_and_execute_sql(query)\n query = ::ActiveRecord::Base.send :sanitize_sql_array, query\n ::ActiveRecord::Base.connection.execute(query).first\n end", "def replace_params(sql, *params)\n sql.gsub!(/\\?/) { |a| quote(params.shift) }\n end", "def quote\n %q[(?:\"|')?]\n end", "def escape_quotes input\n\t\tinput.gsub!(/([\\'\\\"])/,\"\\\\\\1\") #single quote\n\t\t\n\t\treturn input\n\tend", "def literal_string_append(sql, v)\n sql << \"'\" << db.synchronize(@opts[:server]){|c| c.escape(v)} << \"'\"\n end", "def escape(str)\n str.to_s.gsub(/\\\\/, '\\&\\&').gsub(/'/, \"''\").force_encoding('US-ASCII')\n end", "def quote_str(s)\n s.gsub(/\\\\/, '\\&\\&').gsub(/'/, \"''\")\n end", "def escape(string)\n return '' if string.nil?\n return string unless string.to_s =~ /[\\\\\\$`\" \\(\\)\\{\\}\\[\\]]/\n '\"' + string.to_s.gsub(/[\\\\\\$`\"]/) { |match| '\\\\' + match } + '\"'\n end", "def _format_sql(sql)\n sql = sql.delete '\"'\n sql.downcase\n end", "def quote_and_escape(text, quote = '\"')\n \"#{quote}#{text.gsub(/#{quote}/) { |m| \"#{m}\\\\#{m}#{m}\" }}#{quote}\"\n end", "def to_sql_contains\n \"%#{to_sql_escaped_for_like}%\"\n end", "def escape_string(str)\n if not defined? Encoding and @charset.unsafe\n raise ClientError, 'Mysql#escape_string is called for unsafe multibyte charset'\n end\n self.class.escape_string str\n end", "def escape_double_quote (s)\n if ( /\"/ =~ s )\n return '\"' + s.gsub('\"','\"\"') + '\"'\n else\n return '\"' + s + '\"'\n end\nend", "def extra_escape(string)\n string.gsub('\\\\', '\\\\\\\\\\\\').\n gsub(\"\\\\'\", '\\\\\\\\' + \"'\").\n gsub('\\\\\\\\\\\\', '\\\\\\\\\\\\')\n end", "def quote( val )\n\t\treturn %q{\"%s\"} % [ val.to_s.gsub(/\"/, '\\\\\"') ]\n\tend", "def escape_javascript(raw)\n if raw\n quote = raw.count(%{'}) >= raw.count(%{\"}) ? %{\"} : %{'}\n escaped = raw.gsub(/(\\\\|\\r\\n|[\\n\\r#{quote}])/u) {|match| JS_ESCAPE_MAP[match] }\n \"#{quote}#{escaped}#{quote}\"\n else\n '\"\"'\n end\n end", "def double_quote(value)\n return if value.nil?\n\n case value.to_s\n # Ignore keys that contain double quotes or a Arel.star (*)[all columns]\n # or if a table has already been explicitly declared (ex: users.id)\n when \"*\", /((^\".+\"$)|(^[[:alpha:]]+\\.[[:alnum:]]+)|\\(.+\\))/\n value\n else\n PG::Connection.quote_ident(value.to_s)\n end\n end", "def escape(str)\n ERB::Util.h(str).gsub('&quot;', '\"').gsub('&#39;', \"'\")\n end", "def pre_escape_query(query)\n # have to include apostrophe in here too, even though it's NOT\n # in the docs reserved list (and does not generally require URI escaping,\n # in theory) -- still need to double escape it to avoid YBoss returning\n # &#39; in suggestions! \n #\n # Do not need to double escape spaces even though they do need URI escaping. \n #\n # We are telling it ONLY to escape our list of punctuation that causes\n # trouble for YBoss unless double-escaped. Which means it won't escape\n # diacritics and other non-latin. Which means the output is still UTF8, \n # but ruby URI.escape incorrectly tags it \"ascii\", which causes probelms\n # later with illegal bytes -- so we need to retag as UTF-8 \n return URI.escape(query, \"/?&;:@,$=%\\\"#*<>{}|[]^\\\\`()'\").force_encoding(\"UTF-8\")\n end", "def escape(value)\n value.nil? ? nil : value.shellescape\n end", "def _quoteString ( str )\n str.gsub( /\\\\/, '\\&\\&' ).gsub( /'/, \"''\" ) # ' (for ruby-mode)\n end", "def literal_string_append(sql, v)\n sql << \"'\" << db.synchronize(@opts[:server]){|c| c.escape_string(v)} << \"'\"\n end", "def force_quotes?() @force_quotes end", "def double_escape_quotes(s)\n s.gsub(/\\\"/, \"\\\"\\\"\") unless s.nil?\n end", "def escape_quotes(str)\n str.gsub(\"\\\"\", \"'\")\n end", "def escape(string)\n if string.present?\n string.gsub(/\\\"/, \"\\\\\\\"\").gsub(/\\'/, '\\\\\\\\\\'')\n else\n nil\n end\n end", "def escape(*chars)\n gsub(/(?<!\\\\)(#{chars.join(\"|\")})/) do |char|\n \"\\\\\" + char\n end\n end", "def quote_string(string)\n string.gsub(/\\\\/, '\\&\\&').gsub(/'/, \"''\")\n end", "def esc\r\n \"\\\"#{self}\\\"\"\r\n end", "def latex_escape(s)\n quote_count = 0\n s.to_s.\n gsub(/([{}_$&%#])/, \"__LATEX_HELPER_TEMPORARY_BACKSLASH_PLACEHOLDER__\\\\1\").\n gsub(/\\\\/, BACKSLASH).\n gsub(/__LATEX_HELPER_TEMPORARY_BACKSLASH_PLACEHOLDER__/, BS).\n gsub(/\\^/, HAT).\n gsub(/~/, TILDE).\n gsub(/\"/) do\n quote_count += 1\n quote_count.odd? ? %{\"`} : %{\"'}\n end\n end", "def quote_string(string)\n with_raw_connection(allow_retry: true, materialize_transactions: false) do |connection|\n connection.escape(string)\n end\n end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end" ]
[ "0.78345376", "0.76842344", "0.76347286", "0.74052525", "0.73874944", "0.7350359", "0.7333641", "0.7262449", "0.72495884", "0.72454137", "0.72427595", "0.72328216", "0.71821284", "0.7135403", "0.7124588", "0.7121587", "0.708996", "0.7032694", "0.7024474", "0.7009703", "0.6981647", "0.6971821", "0.69683576", "0.696565", "0.69374865", "0.69117486", "0.6909834", "0.69064856", "0.690355", "0.6887424", "0.6820132", "0.68110836", "0.68011475", "0.67522323", "0.6750094", "0.67492235", "0.67324454", "0.6729872", "0.6717954", "0.6710596", "0.67039484", "0.6693823", "0.6689647", "0.6682562", "0.6679389", "0.6659275", "0.66304666", "0.66295934", "0.66275984", "0.6609789", "0.66016906", "0.6588062", "0.6564966", "0.6546942", "0.6541213", "0.6541213", "0.6537303", "0.65252125", "0.6520008", "0.65136397", "0.65126145", "0.6508973", "0.65019757", "0.64926136", "0.64874256", "0.6481137", "0.6477448", "0.646226", "0.6445247", "0.6437985", "0.6432271", "0.64310676", "0.6415377", "0.64140993", "0.64079547", "0.6407202", "0.6405377", "0.6387077", "0.6385072", "0.6380271", "0.63736326", "0.6359331", "0.63530654", "0.6347311", "0.6346202", "0.63444734", "0.63353264", "0.63215137", "0.6319985", "0.6319315", "0.630401", "0.6303329", "0.6301931", "0.6300531", "0.6300531", "0.6300531", "0.6300531", "0.6300531", "0.6300531", "0.6300531", "0.6300531" ]
0.0
-1
Returns a scope for this object by its identifier
def get_scope_by_id(id) id = id.to_s scopes.find{|s| s.id == id } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scope\n read_attr :scope, :to_sym\n end", "def scope\n @scope\n end", "def scope\n @scope\n end", "def scope\n return @scope\n end", "def scope\n return @scope\n end", "def scope\n return @scope\n end", "def scope\n return @scope\n end", "def scope\n return @scope\n end", "def scope\n return @scope\n end", "def scope\n @attributes[:scope]\n end", "def scope\n @scope ||= {}\n end", "def scope\n @scope ||= {}\n end", "def scope\n finder_or_run(:scope)\n end", "def scope\n parameter[:scope]\n end", "def scope\n @scope ||= Scope.new(parent)\n end", "def scope\n @scope.dup\n end", "def scope(scope_name)\n Scope.new(@backend, @name, scope_name)\n end", "def scope_name; end", "def custom_scope_get scope_name\n\t\t\tThread.current[SESSION].custom_scope_get scope_name\n\t\tend", "def find_scope!(obj); end", "def scoped_by(name, options = {})\n options[:scope] ||= :reference\n if scope_class = self.class.scope_types[options[:scope]]\n @scopes[name] = scope_class.new(@model, name, options)\n end\n end", "def scope\n @scope ||= Array(@root_scope) + [Inflector.underscore(name)]\n end", "def scope\n klass\n end", "def scope\n @options[:scope]\n end", "def scope\n\t\treturn @scopes.last\n\tend", "def scope\n return !@scopes.empty? ? @scopes[-1] : @storage[:scope]\n end", "def current_scope\n @scope\n end", "def scope\n field[:scope]\n end", "def scope\n record.class\n end", "def scope *args\n [main_scope, args, graphite_identifier].flatten.compact.map(&:to_s).join('.')\n end", "def scope_name scope\n\t\traise \"No data-source set\" unless data_source\n\t\tdata_source.scopes.get(scope).human_name\n\tend", "def scoped(scope = {}, &block)\n ActiveRecord::NamedScope::Scope.new(self, scope, &block)\n end", "def scope\n GlobalScope.instance\n end", "def scope( new_scope=nil )\n\t\tif new_scope\n\t\t\tself.log.debug \"cloning %p with new scope: %p\" % [ self, new_scope ]\n\t\t\treturn self.clone( :scope => new_scope.to_sym )\n\t\telse\n\t\t\treturn @options[:scope]\n\t\tend\n\tend", "def current_scope\n params[:scope].try(:to_sym) || railgun_resource.default_scope.try(:key)\n end", "def scope\n self.slug.scope\n end", "def scope(level = @skl_level)\n return @skl_levelcache[level][:scope]\n end", "def scope; end", "def scope; end", "def scope; end", "def scope; end", "def scope; end", "def scope; end", "def scope; end", "def scope; end", "def scope; end", "def scope; end", "def lookup\n InternalId.find_by(**scope, usage: usage_value)\n end", "def scope\n @scope ||= \"study.#{app_name}\"\n end", "def read_scope(user)\n self\n end", "def getEditorObjectScope _obj, _args\n \"_obj getEditorObjectScope _args;\" \n end", "def scope\n if tree.columns.scope?\n tree.base_class.where Hash[tree.columns.scope.map { |column| [column, record[column]] }]\n else\n tree.base_class.where(nil)\n end\n end", "def set_scope\n @scope = Scope.find(params[:id])\n end", "def set_scope\n @scope = Scope.find(params[:id])\n end", "def privacy_scope\r\n\t\t\tif @privacy_scope.nil?\r\n\t\t\t\t@privacy_scope = privacy_owner.get_privacy_scope(self.class.privacy_rule_name, privacy_object_id)\r\n\t\t\tend\r\n\t\t\treturn @privacy_scope\r\n\t\tend", "def create_with_scope(name); end", "def scope_model\n @scope_association ||= scoping_object.send(model_name_to_method_sym)\n end", "def [](identifier)\n QualifiedIdentifier.new(self, identifier)\n end", "def resolved_scope(scope)\n scoper_object(scope).resolve\n end", "def scope_name name\n name.to_s.pluralize.to_sym\n end", "def variables_scope_id\n current_variables_scope.guid\n end", "def read_scope(reader)\n self\n end", "def find_property\n @property ||= scope.find(params[:id])\n end", "def resolve(scope)\n scope\n end", "def get_scope(cur_scope = nil)\n # base default scope is set up here so that deactivated module can update this\n cur_scope = AssemblyComponent.scoped if (cur_scope.nil?)\n return (defined?(super)) ? super(cur_scope) : cur_scope\n end", "def scope=(value)\n @scope = value\n end", "def scope=(value)\n @scope = value\n end", "def scope=(value)\n @scope = value\n end", "def scope=(value)\n @scope = value\n end", "def scope=(value)\n @scope = value\n end", "def scope=(value)\n @scope = value\n end", "def identifyScope(theLine, currentScope)\n\n\ttheText = theLine[:text];\n\tnewScope = currentScope;\n\t\n\tif (theText =~ /^enum /)\n\t\tnewScope = :enum;\n\t\n\telsif (theText =~ /^struct /)\n\t\tnewScope = :struct;\n\t\n\telsif (theText =~ /^class /)\n\t\tnewScope = :class;\n\t\n\telsif (theText =~ /^(\\w+)::\\1\\(/)\n\t\tnewScope = :constructor;\n\t\n\telsif (theText == \"{\")\n\t\tif (currentScope == :global)\n\t\t\tnewScope = :function;\n\t\tend\n\t\n\telsif (theText == \"}\")\n\t\tnewScope = :global;\n\tend\n\t\n\treturn newScope;\n\nend", "def scope(object = nil)\n configure(:scope, object)\n end", "def [] identifier\n\t\t\tscope, initializer = nil\n\t\t\tREGISTRY_SYNC.synchronize do\n\t\t\t\tscope, initializer = @registry[identifier]\n\t\t\tend\n\t\t\t\n\t\t\tcase scope\n\t\t\t\twhen nil\n\t\t\t\traise_without_self \"The '#{identifier}' Name is not Managed!\", MicroContainer \n\t\t\t\twhen :instance\n\t\t\t\treturn initializer.call\n\t\t\t\twhen :application\n\t\t\t\tAPPLILCATION_SYNC.synchronize do\n\t\t\t\t\to = @application[identifier]\n\t\t\t\t\tunless o\n\t\t\t\t\t\to = initializer.call\n\t\t\t\t\t\t@application[identifier] = o\n\t\t\t\t\tend\n\t\t\t\t\treturn o\n\t\t\t\tend\n\t\t\t\twhen :thread\n\t\t\t\tthread = Thread.current[THREAD]\n\t\t\t\to = thread[identifier]\n\t\t\t\tunless o\n\t\t\t\t\to = initializer.call\n\t\t\t\t\tthread[identifier] = o\n\t\t\t\tend\n\t\t\t\treturn o\n\t\t\t\twhen :session\n\t\t\t\tsession = Thread.current[SESSION]\n\t\t\t\to = session[identifier]\n\t\t\t\tunless o\n\t\t\t\t\to = initializer.call\n\t\t\t\t\tsession[identifier] = o\n\t\t\t\tend\n\t\t\t\treturn o\n\t\t\telse # Custom\n\t\t\t\tsession = Thread.current[SESSION]\n\t\t\t\to = session.get identifier, scope\n\t\t\t\tunless o\n\t\t\t\t\to = initializer.call\n\t\t\t\t\tsession.set identifier, scope, o\n\t\t\t\tend\n\t\t\t\treturn o\n\t\t\tend\n\t\tend", "def scope() binding end", "def it_scope\n @it_scope ||= Example::Scope.new(self)\n end", "def scoped\n @scoped ||= Scope[:context => flex.context]\n end", "def scope(method, key = nil) #:nodoc:\n if current_scoped_methods && (scope = current_scoped_methods[method])\n key ? scope[key] : scope\n end\n end", "def scope\n scope!(operator) if @scopes.empty?\n scope!(\"AND\") if @scopes.last.is_a?(NestedScope)\n @scopes.last\n end", "def find_in_scope scope, element\n scope.select do |struct|\n struct.keys.include?(element.to_sym)\n end.first\n end", "def policy_scope(target, options={})\n policy(target, options).scope\n end", "def scoped_by( *scope )\n scope = scope.length == 1 ? scope.first : scope\n sub_map = @map.get( expand_key( scope ) ) || {}\n Properties.new( sub_map )\n end", "def find_single(scope)\n path = element_path(scope)\n self.new(connection.get(path))\n end", "def get_closest_containing_scope\n self\n end", "def scope_context\n @sssn\n end", "def scopeName _args\n \"scopeName _args;\" \n end", "def named_tag_scope\r\n NamedTagScopeController.instance\r\n end", "def get_scope(cur_scope = nil)\n # base default scope is set up here so that deactivated module can update this\n cur_scope = StateComponentTypeTax.scoped if (cur_scope.nil?)\n return (defined?(super)) ? super(cur_scope) : cur_scope\n end", "def scope\n if @scope.kind_of? String\n @scope = @scope.split \",\"\n else\n @scope || []\n end\n end", "def active_span\n scope = scope_manager.active\n scope.span if scope\n end", "def find_single(scope, options)\n context = options[:context] || {}\n reload_fields_definition(false)\n fields = options[:fields] || options[:only] || fast_fields(options)\n fields += options[:include] if options[:include]\n \n if scope\n is_collection, records = read_scope(context, fields, scope)\n else\n is_collection, records = read_domain(context, fields, options)\n end\n active_resources = []\n records.each { |record| active_resources << new(record, [], true)}\n if is_collection\n active_resources\n else\n active_resources[0]\n end\n end", "def subscope\n self.clone\n end", "def scope_for(finder, options = {})\n return finder unless options.keys.include? @named_scope\n value = options.delete(@named_scope)\n finder.send(@named_scope, value)\n end", "def get_current_scope\n get_current_hub&.current_scope\n end", "def build_scope_from_columns\n self.scope\n end", "def scope(scope_name, &block)\n scope_obj = LocatorScope.new(self)\n scope_obj.scoped_locator = send \"#{scope_name}_locator\"\n scope_obj.run(&block)\n end", "def qualify(qualifier, identifier)\n SQL::QualifiedIdentifier.new(qualifier, identifier)\n end", "def scope=(_); end", "def selected_scope\n (params[:scope] || :default).to_sym\n end", "def select_scope(scope)\n if [Scopes::SCOPE_PRIVATE, Scopes::SCOPE_PUBLIC, nil].include?(scope)\n Scopes::SCOPE_PRIVATE\n else\n scope\n end\n end" ]
[ "0.6986587", "0.69153583", "0.69153583", "0.6775095", "0.6775095", "0.6775095", "0.6775095", "0.6775095", "0.6775095", "0.67681456", "0.6573853", "0.6573853", "0.6544657", "0.6534917", "0.6349983", "0.6338787", "0.6282708", "0.6270241", "0.6237588", "0.6230415", "0.6224204", "0.6168785", "0.6160607", "0.6103767", "0.60837173", "0.6039642", "0.60372955", "0.6029632", "0.6027034", "0.59661007", "0.5898776", "0.58593154", "0.58585507", "0.5851349", "0.5826039", "0.57913136", "0.57913136", "0.57592094", "0.57592094", "0.57592094", "0.57592094", "0.57592094", "0.57592094", "0.57592094", "0.57592094", "0.57592094", "0.57592094", "0.5752927", "0.5722138", "0.5716792", "0.5692148", "0.56919986", "0.56753045", "0.56753045", "0.5626453", "0.5618782", "0.5602993", "0.5599704", "0.5596713", "0.55960035", "0.5595652", "0.5582734", "0.5580638", "0.5579834", "0.55776227", "0.55661607", "0.55661607", "0.55661607", "0.55661607", "0.55661607", "0.55661607", "0.5536066", "0.55310816", "0.55248", "0.5511949", "0.5511824", "0.5490877", "0.5453237", "0.5444572", "0.54267323", "0.5412831", "0.5411466", "0.5410979", "0.53927195", "0.5383035", "0.53809005", "0.5368979", "0.5348964", "0.53276026", "0.53209525", "0.5311548", "0.5300622", "0.52953273", "0.5293886", "0.5290326", "0.5287253", "0.5253178", "0.52510655", "0.5249194", "0.5248874" ]
0.7012059
0
problem input: sentence output: sentence, with word reversed if it is of length 5 or greater. examples given already algorithm Split string with space as a seperator Map over resulting Array, reversing word if length is greater than 5 Join the contents of the array back to a sentence with space as a seperator.
def reverse_words(string) words = string.split(' ') words = words.map do |word| if word.length >= 5 word.reverse else word end end words.join(' ') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reverse_sentence(str)\n str.split.map { | word | word.length > 5 ? word.reverse : word }.join(\" \")\nend", "def reverse_sentence(str)\n word_array = str.split(\" \")\n word_array.each do |item| \n item.reverse! if item.size >= 5\n end\n word_array.join(\" \")\nend", "def reverse_words(sentence)\n arr = []\n sentence.split(' ').each do |word| \n if word.length >= 5\n arr << word.split(//).reverse!.join\n else \n arr << word\n end \n end\n arr.join(\" \")\nend", "def reverse_words(sentence)\n words = sentence.split\n word_array = []\n words.each do |word|\n if word.length < 5\n word_array << word\n else\n word_array << word.reverse\n end\n end\n word_array.join(' ')\nend", "def reversal2(string)\n array = string.split\n array.map! do |word|\n if word.length >= 5\n word.reverse\n else\n word\n end\n end\n array.join(' ')\nend", "def reverse_words(string)\n array = string.split.map do |element| \n if element.length >= 5\n element.reverse\n else \n element\n end\nend\narray.join(' ')\nend", "def reverse_words3(str)\n str.split.map { |word| word.length >= 5 ? word.reverse : word }.join(' ') \nend", "def reverse_words(string)\n string.split.map { |word| word.length >= 5 ? word.reverse : word }.join(' ')\nend", "def reverse_words(string)\n words = string.split\n \n words.map! do |word|\n if word.length >= 5\n word.reverse\n else\n word\n end\n end\n words.join(\" \")\nend", "def reverse_words(input_string)\n words_array = input_string.split\n\n words_array.map! do |word|\n word.size >= 5 ? word.reverse : word\n end\n\n words_array.join(' ')\nend", "def reverse_words(string)\n string.split.map { |word| (word.length >= 5) ? word.reverse : word }.join(' ')\nend", "def reverse_words(sentence)\n reversed_array = sentence.split.map do |x| \n if x.length > 4\n x.reverse\n else\n x\n end\n end\n reversed_array.join ' '\nend", "def reverse_words(string)\n \n array_words = string.split\n \n array_reverse = \n array_words.map do |str|\n if str.size >= 5\n str.reverse\n else\n str\n end\n end\n array_reverse.join(' ')\nend", "def reverse_words(string)\n array_words = string.split(\" \")\n array_words.map! do |word|\n if word.length >= 5\n word.reverse!\n else\n word\n end\n end\n array_words.join(\" \")\nend", "def reverse_words(sentence)\n words = []\n sentence.split.each do |word|\n if word.size >= 5\n word.reverse!\n end\n words << word\n end\n words.join(' ')\nend", "def reverse_words(str)\r\n arr = str.split\r\n arr.map do |x| \r\n if x.length >= 5 \r\n x.reverse!\r\n else\r\n x\r\n end\r\n end\r\n arr.join(' ')\r\nend", "def reverse_words(str)\n str.split.map do |word|\n word = word.reverse if word.size > 5\n\n word\n end.join(' ')\nend", "def reverse_five(str)\n arr = str.split\n new_arr = []\n arr.each do |word|\n word.length >= 5 ? new_arr << word.reverse : new_arr << word\n end\n new_arr.join(' ')\nend", "def reverse_words(string)\n reversed_string = string.split.map do |word|\n word.size >= 5 ? word.reverse : word\n end\n reversed_string.join(' ')\nend", "def reverse_words(str)\n new_array = str.split(' ').map do |word|\n if word.size >= 5\n word.reverse!\n else\n word\n end\n end\n new_array.join(' ')\nend", "def reverse_words(str)\n result_array = []\n str.split.each do |word|\n if word.size >= 5\n result_array << word.reverse\n else\n result_array << word\n end\n end\n if result_array.size > 1\n answer = result_array.join(' ')\n else\n answer = result_array.join('')\n end\n answer\nend", "def reverse_words(string)\n reversed = string.split.map do |word|\n word.reverse! if word.length >= 5\n word\n end\n reversed.join(' ')\nend", "def reverse_words(string)\n string.split.map {|x| x.length >= 5 ? x.reverse : x}.join(\" \")\nend", "def reverse_words(string)\n array = string.split(\" \").each do |word|\n if word.length >= 5\n word.reverse!\n else\n word\n end\n end\n array.join(\" \")\nend", "def reverse_words(str)\n arr = str.split.map do |item|\n item.reverse! if item.size >= 5\n item\n end\n arr.join(' ')\nend", "def reverse_five(str)\n new_str_arr = str.split.map do |word|\n if word.length >= 5\n word.reverse\n else\n word\n end\n end\n return new_str_arr.join(\" \")\nend", "def reverse_words(string)\n words_array = string.split\n words_array.each do |word|\n word.reverse! if word.size >= 5\n end\n words_array.join(' ')\nend", "def reverse_five(str)\n str_arr = str.split(' ')\n output_arr = []\n\n str_arr.each do |word|\n if word.length >= 5\n output_arr << word.reverse\n else\n output_arr << word\n end\n end\n\n output_arr.join(' ')\nend", "def reverse_words(string)\n result = []\n\n string.split.each do |word|\n word.reverse! if word.size >= 5\n result.push(word)\n end\n\n result.join(' ')\n\nend", "def reverse_words(string)\n if string.split.size >= 2\n counter = 0\n array = string.split\n loop do \n current_element = array[counter] \n if current_element.size >= 5\n array[counter] = current_element.chars.reverse.join\n end\n counter += 1\n break if counter == array.size\n end\n array.join(' ')\n else\n string.chars.reverse.join\n end\nend", "def reverse_words(str)\n str.split.each { |word| word.reverse! if word.length >= 5 }.join(' ')\nend", "def reverse_words(string)\n words = string.split(' ')\n words.each do |word|\n word.reverse! if word.length >= 5\n end\n reverse = words.join(' ')\nend", "def reverse_five(str)\n arr = str.split\n new_str = []\n arr.each do |word|\n if word.length >= 5\n word.reverse!\n end\n new_str.push(word)\n end\n new_str.join(\" \")\nend", "def reverse_words(string)\n words = string.split.each do |word|\n words = word.reverse! if word.length >= 5\n end\n words.join(' ')\nend", "def reverse_words(string)\n string.split.each { |word| word.reverse! if word.length >= 5 }.join(' ')\nend", "def reverse_words(string)\n string.split.each { |word| word.reverse! if word.length >= 5 }.join(' ')\nend", "def reverse_words(string)\n words = string.split\n new_words = []\n words.each do |word|\n if word.length >= 5\n new_words << word.reverse\n else\n new_words << word\n end\n end\n new_words.join(' ')\nend", "def reverse_words(string)\n words = string.split\n words.each { |word| word.reverse! if word.length >= 5 }\n words.join(' ')\nend", "def reverse_words(str)\n str.split.each { |word| word.reverse! if word.size >= 5 }.join(' ')\nend", "def reverse_words(str)\n new_sentence = str.split.map do |word|\n if word.length > 4\n word.reverse\n else\n word\n end\n end\n new_sentence.join(\" \")\nend", "def reverse_five(str)\n arr = str.split\n arr.each do |word|\n if word.length >= 5\n word.reverse!\n end\n end\n arr.join(\" \")\nend", "def reverse_words(str)\n words = []\n \n str.split.each do |word|\n word.reverse! if word.size >= 5\n words << word\n end\n \n words.join(' ')\n \nend", "def reverse_words1(string)\n words = []\n\n string.split.each do |word|\n word.reverse! if word.size >= 5\n words << word\n end\n\n words.join(' ')\nend", "def reverse_words(str)\n new_words = []\n str.split(' ').each do |s|\n new_words << s.length >= 5 ? s.chars.reverse.join : s\n end\n new_words.join(' ')\nend", "def reverse_words(words)\n arr = words.split\n arr.each_with_index do |word, index|\n if word.size >= 5\n arr[index] = word.reverse\n end\n end \n arr.join(' ') \nend", "def reverse_words(string)\n words = []\n \n string.split.each do |word|\n word.reverse! if word.length >= 5\n words << word\n end \n\n words.join(' ')\nend", "def reverse_words(string)\n words = []\n string.split.each do |word|\n word.reverse! if word.length >= 5\n words << word\n end\n words.join(\" \")\nend", "def reverse_words(str)\n words = []\n\n str.split.each do |word|\n word.reverse! if word.size >= 5\n words << word\n end\n\n words.join(\" \")\nend", "def reverse_words(words)\n arr_words = words.split(\" \")\n reverse_array = []\n arr_words.each do |word|\n if word.length >= 5\n reverse_array << word.reverse\n else\n reverse_array << word\n end\n end\n reverse_array.join(\" \")\nend", "def reverse_five(str)\n result = str.split(' ').map do |word|\n word.size >= 5 ? word.reverse : word\n end\n result.join(' ')\nend", "def reverse_words(string)\n \n if string.class == String\n \n array = string.split\n result = array.map do |word|\n \n word.reverse! if word.length >= 5\n word\n\n end\n\n result.join(' ') \n \n else\n \"Strings only!\"\n end\nend", "def reverse_words(string)\n words = []\n\n string.split.each do |word|\n word.reverse! if word.size >= 5\n words.push(word)\n end\n words.join(' ')\nend", "def reverse_word(string)\n words = []\n\n string.split each do |word|\n word.reverse! if word.size >= 5\n words << word\n end\n\n words.join(' ')\nend", "def reverse_five(str)\n words = str.split\n words.each {|word| word.reverse! if word.length >= 5}\n words.join(\" \")\nend", "def reverse_words(string)\n words = []\n words = string.split\n for word in words\n if word.size >= 5\n word.reverse!\n end\n end\n words.join(\" \")\nend", "def reverse_words(string)\n words = []\n\n string.split.each do |word|\n word.reverse! if word.size >= 5\n words << word\n end\n\n words.join(' ')\nend", "def reverse_words(sentence)\n # sentence_array = sentence.split\n sentence.split.map(&:reverse)\n .join(' ')\n\nend", "def another_way(string)\n words = []\n \n string.split.each do |word|\n word.reverse! if word.size >= 5\n words << word\n end\n \n words.join(' ')\nend", "def reverse_five(str)\nnew_sent = []\nwords = str.split(\" \")\nwords.each do |x|\n if x.length > 4\n new_sent << x.reverse\n else\n new_sent << x\n end\nend\n new_sent.join(\" \")\nend", "def reverse_words(str)\n new_str = []\n str.split.each do |word|\n new_str.push(word.chars.reverse.join) if word.length > 4\n new_str.push(word) if word.length < 5\n end\n new_str.join(\" \")\nend", "def reverse_sentence(sentence)\n s_array = sentence.split\n r_array = []\n s_array.length.times do\n r_array << s_array.pop\n end\n r_array.join(' ')\nend", "def reverse_words(str)\n\tarr = []\n\n\tstr.split.map do |word| \n\tword.reverse if word.size >= 5\n\tarr << word\n\tend\n\n\tarr.join(' ')\nend", "def reverse_words(words)\n words = words.split\n i = 0\n\n while i < words.count do\n words[i].replace(words[i].reverse) if words[i].size >= 5\n i += 1\n end\n\n words.join(' ')\nend", "def reverse_sentence(string)\n array_string = string.split\n array_string.reverse #discovered after looking at the solution, adding .join(\" \") here yields a true conditional\nend", "def reverse_sentence(my_sentence)\n # raise NotImplementedError\n return my_sentence if my_sentence.nil? || my_sentence.empty?\n\n array = my_sentence.split(/\\s(\\s$)?/)\n\n reverse_array = []\n i = array.length - 1\n\n while i >= 0\n reverse_array << array[i]\n i -= 1\n end\n\n joined_sentence = reverse_array.join(\" \")\n j = 0\n while j < joined_sentence.length\n my_sentence[j] = joined_sentence[j]\n j += 1\n end\n\nend", "def reverse_words(str)\n arr = str.split.map do |word|\n if word.length > 4\n word.reverse!\n else\n word\n end\n end\n arr.join(' ')\nend", "def reverse_five(str)\n result = []\n str = str.split(\" \")\n str.each do |word|\n if word.length > 4\n result << word.reverse\n else\n result << word\n end\n end\n result.join(\" \")\nend", "def reverse_long_words(sentence)\n temp_array = []\n sentence.split.each do |word|\n word.length > 4 ? temp_array.push(word.reverse) : temp_array.push(word)\n end\n temp_array.join(\" \")\nend", "def reverse_words(string)\n new_string = string.split.each do |word|\n if word.size > 4 #next time use single line\n word.reverse!\n end\n end\n new_string.join(' ')\nend", "def reverse_sentence(my_sentence)\n return nil if my_sentence.nil? \n new_arr = []\n holder = []\n i = 0\n while i < my_sentence.length\n\n if my_sentence[i] == \" \" \n new_arr << holder.join \n new_arr << \" \" \n holder = [] \n else\n holder << my_sentence[i] \n end\n i += 1\n end \n\n new_arr << holder.join \n\n # creating the reversed string from the above array\n k = new_arr.length - 1\n i = 0\n while k >= 0\n \n if i < k\n temp = new_arr[i] # temporarly save words in the first half of the array \n new_arr[i] = new_arr[k] # swap each words in the array\n new_arr[k] = temp\n i += 1\n end\n k -= 1\n end\n \n i = 0\n new_sentence = new_arr.join\n\n while i < new_sentence.length\n my_sentence[i] = new_sentence[i] \n i += 1\n end\n return my_sentence\nend", "def reverse_words(string)\n reverted_string = []\n string.split.each do |word|\n word.length > 4 ? reverted_string << word.reverse : reverted_string << word\n end\n reverted_string.join(\" \")\nend", "def word_reverse(sentence)\n sentence.split(\" \").reverse.join(\" \")\nend", "def reverse_words(sentence)\n if sentence != \"\"\n sent_array = sentence.split\n sent_array.each do |word|\n word.reverse!\n end\n sentence = sent_array.join(\" \")\n end\n sentence\nend", "def reverse_sentence(sentence)\n words = sentence.split(' ')\n reversed_words = []\n\n (words.size).downto(1) do |i|\n reversed_words << words[i-1]\n end\n\n reversed_words.join(' ')\nend", "def reverse_it(sentence)\n sentence.split(' ').reverse.join(' ')\nend", "def reverse_words(string)\n loop do\n string.split.each do |word|\n if word.length >= 5\n print word.reverse, ' '\n else\n print word, ' '\n end\n end\n break\n end\nend", "def reverse_sentence str \n str.split.reverse.join' '\nend", "def reverse_sentence(sentence)\n array = sentence.split(' ')\n reverse_array = []\n idx = array.size\n\n loop do\n idx -= 1\n break if idx < 0\n reverse_array << array[idx]\n end\n\n reverse_array.join(' ')\nend", "def reverse_words(words = ' ')\n if words.to_s =~ /\\d+/\n puts 'Invalid input: only letters and spaces allowed.'\n else\n array = words.split.map { |x| x.length >= 5 ? x.reverse : x }\n array.join(' ')\n end\nend", "def reverse_words(word)\n word_array= sentence.split(\" \").to_a\n reversed_sent= []\n \n if sentence == \"\"\n \treturn \"\"\n elsif word_array.length== 1\n \tprint sentence.reverse!\n else\n \treversed_sent << word_array[0..-2].map { |word|\n \t word.reverse! + \" \"}\n end\n reversed_sent << word_array[-1].reverse!\n print reversed_sent.join\nend", "def reverse_sentence(string)\n array = string.split\n array.reverse!\n array.join(\" \")\nend", "def reverse_sentence(string)\n \n string.split.reverse.join(' ')\n \nend", "def reverse_sentence(sentence)\n sentence_array = sentence.split(\" \")\n reverse_array = []\n iterator = sentence_array.length\n while iterator > 0\n reverse_array << sentence_array[(iterator - 1)]\n iterator -= 1\n end\n reverse_array.join(' ')\nend", "def reverse_sentence(string)\n \n arr = string.split\n arr = arr.reverse\n arr.join(' ')\nend", "def reverse_sentence(string)\n=begin\n p string.reverse # ex. \"dlroW olleH\" --- reverses whole string\n p string.split(' ') # ex. [\"Hello\", \"World\"] --- returns array of strings split by the space\n p string.split(' ').reverse # ex. [\"World\", \"Hello\"] --- returns array in reverse order\n p string.split(' ').reverse.join # ex. \"WorldHello\" --- returns string from reversed array\n p string.split(' ').reverse.join(' ') # ex. \"World Hello\" --- solution\n=end\n if string != ''\n string.split(' ').reverse.join(' ')\n else\n string\n end\nend", "def reverse_sentence(sentence)\n sentence.split.reverse.join(' ')\nend", "def reverse_sentence(my_sentence)\n return nil if my_sentence.nil?\n\n array = my_sentence.split(/(\\S+)|(\\W)/)\n\n first_index = 0\n last_index = (array.length) - 1\n \n while first_index < last_index\n temp = array[first_index]\n array[first_index] = array[last_index]\n array[last_index] = temp\n first_index += 1\n last_index -= 1\n end\n\n array = array.join(\"\")\n\n array.length.times do |n|\n my_sentence[n] = array[n]\n end\n return my_sentence \nend", "def reverse_sentence(string)\n reverse = []\n words = string.split(\" \")\n words.length.times do\n reverse << words.pop\n end\n reverse.join(\" \")\nend", "def reverse_words(sentence)\n arr_of_words = split_sentence(sentence)\n arr_of_reversed_words = reverse_array(arr_of_words)\n join_array(arr_of_reversed_words)\nend", "def reverse_each_word(sentence)\narrayed = sentence.split (\" \")\nreversed = arrayed.collect {|i| i.reverse}\nreversed.join (\" \")\nend", "def reversal(sentence)\n sentence.split(' ').reverse.join(' ')\nend", "def reverse_words sentence\n sentence.split(\" \").map{ |x| x.reverse }.join(\" \")\nend", "def reverse_sentence(my_sentence)\n return nil if my_sentence.nil?\n new_arr = []\n holder = []\n i = 0\n while i < my_sentence.length\n if my_sentence[i] == \" \"\n new_arr << holder.join # [\"Hello\"]\n new_arr << \" \" # [\"Hello\", \" \"]\n holder = [] # empty array for the next word\n else\n holder << my_sentence[i]\n end\n i += 1\n end\n new_arr << holder.join # [\"Hello\", \" \", \"world\"]\n # creating the reversed string from the above array\n k = new_arr.length - 1\n i = 0\n while k >= 0\n if i < k\n temp = new_arr[i] # temporarly save words in the first half of the array\n new_arr[i] = new_arr[k] # swap each words in the array\n new_arr[k] = temp\n i += 1\n end\n k -= 1\n end\n # [\"world\", \" \", \"Hello\"]\n i = 0\n new_sentence = new_arr.join\n while i < new_sentence.length\n my_sentence[i] = new_sentence[i] #my_sentence at index 0 is replaced by new_sentence at index 0\n i += 1\n end\n return my_sentence\nend", "def reverse_words(sentence)\n temp_array = sentence.split(' ')\n temp_array.map! do |x| x.reverse end\n temp_array.join(' ')\nend", "def reverse_sentence(string)\n results = []\n\n split_string = string.split(' ')\n\n split_string.size.times do \n results << split_string.pop\n end\n\n results.join(\" \")\nend", "def reverse_words(sent)\n split = sent.split(' ')\n reversed = []\n split.each do | word |\n reversed.push(word.reverse)\n end\n return reversed.join(' ')\nend", "def reverse_sentence(string)\r\n string.split.reverse.join(\" \")\r\nend", "def solution(sentence)\n sentence.split.reverse.join(\" \")\nend", "def reverse_five(str)\n str = str.split(\" \")\n str.each do |s|\n s.to_s\n s.reverse! if s.length >= 5\n end\n str.join(\" \")\nend", "def reverse_sentence(string)\n result = []\n\n array = string.split(' ')\n \n i = 0\n loop do\n break if i == array.size\n result << array.pop\n end\n\n answer = result.join(' ')\n answer\nend" ]
[ "0.8737681", "0.8442387", "0.8397807", "0.8379236", "0.8329726", "0.82612985", "0.82593143", "0.82581896", "0.82462627", "0.82462585", "0.82446265", "0.82241976", "0.82220244", "0.8189794", "0.8175875", "0.8171706", "0.81656456", "0.8164751", "0.8164259", "0.81511635", "0.8142296", "0.81292605", "0.8124289", "0.81195825", "0.8095608", "0.8080908", "0.80718046", "0.806915", "0.8060867", "0.8020226", "0.8014629", "0.8008592", "0.8006176", "0.79914707", "0.7991168", "0.7991168", "0.79758084", "0.7968664", "0.7966175", "0.7964449", "0.79581547", "0.795024", "0.79301304", "0.79291487", "0.7928084", "0.7921543", "0.78866315", "0.788399", "0.787013", "0.7869963", "0.78443664", "0.78392434", "0.7836094", "0.78267974", "0.7814164", "0.7804637", "0.7779224", "0.7772012", "0.77669704", "0.7760638", "0.77193666", "0.77130526", "0.76838034", "0.76372886", "0.76368576", "0.7625889", "0.7625485", "0.76175404", "0.7599194", "0.7590702", "0.75841826", "0.7563045", "0.7537964", "0.75280863", "0.7502113", "0.7495929", "0.7490801", "0.748936", "0.74867916", "0.748576", "0.7481061", "0.74797076", "0.747638", "0.7455406", "0.7452955", "0.74505", "0.74504924", "0.74212843", "0.74133986", "0.74084014", "0.7406202", "0.74050057", "0.7401072", "0.739715", "0.7393405", "0.7384279", "0.73806983", "0.73764646", "0.7369929", "0.7368309" ]
0.8187845
14
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.user_mailer.reset_password_email.subject
def reset_password_email(user) @user = user @url = edit_forgot_password_url(user.reset_password_token) mail(to: user.email, subject: "Your ClosetGroupie password has been reset") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subject\n @mail.subject\n end", "def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end", "def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end", "def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end", "def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end", "def password_reset(user)\n @user = user\n mail :to => user.email, :subject => I18n.t(\"reset_password\")\n end", "def message_subject=(value)\n @message_subject = value\n end", "def get_email_subject(email_type)\n email_subject = email_type\n case(email_type)\n when \"welcome\"\n email_subject = \"Welcome to Aspera Files\"\n when \"reset\"\n email_subject = \"Password Reset\"\n end\n return email_subject\n end", "def forgot_password(user)\n setup_email(user)\n subject \"Password Reset\"\n end", "def password_reset_notice (email, accounts)\n @from = Bolt::Config.email_from\n @recipients = email\n @subject = \"Reset your password for #{Bolt::Config.application_name}\"\n @body = {:accounts => accounts}\n end", "def reset_password_email(user)\n @user = User.find user.id\n @url = edit_password_reset_url(@user.reset_password_token)\n mail(to: user.email,\n subject: \"[Fjord Bootcamp] #{I18n.t(\"your_password_has_been_reset\")}\")\n end", "def reset_password_email(user)\n @user = user\n @password_reset_url = edit_password_reset_url(user.reset_password_token)\n mail to: user.email, subject: \"Reset your VCDelta.org password\"\n end", "def reset_password(user)\n @recipients = user.email\n @from = \"#{Site.current.email}\"\n @body [\"name\"] = user.login\n @subject = 'Your password has been reset'\n end", "def subject (recipient)\n subject_variables = alert_variables[:subject].dup\n subject_variables.merge!(recipient_details(recipient))\n subject = \"#{I18n.t(\"#{recipient_type.to_s}_subject_#{alert_name.to_s}\", subject_variables)}\"\n subject\n end", "def subject\n self['subject'] || msg['subject']\n end", "def password_reset_mail(user)\n subject \"Password Reset Instructions\"\n from \"sender_email_id@test.com\"\n recipients user\n content_type \"text/html\"\n sent_on Time.now\n body \"RESET your Password\"\n end", "def reset_password_email(user)\n @user = user\n @url = edit_password_reset_url(@user.reset_password_token)\n @subject = \"[#{SITE_NAME}] Password reset request\"\n mail(bcc: @user.email, subject: @subject)\n end", "def subject\n @subject ||= Envelope::MessageTools.normalize(message.subject || '')\n end", "def reset_password_email\n UserMailer.reset_password_email(User.first)\n end", "def reset_password_email(user)\n @user = User.find(user.id)\n @url = edit_password_reset_url(@user.reset_password_token)\n mail(:to => user.email,\n :subject => \"パスワードリセットのご案内\")\n end", "def translate(mapping, key)\n I18n.t(:\"#{mapping.name}_subject\", :scope => [:devise, :mailer, key],\n :default => [:subject, key.to_s.humanize])\n end", "def notify_password_reset!\n with_user_locale do\n reset_single_access_token!\n UserMailer.password_reset(self).deliver!\n end\n end", "def subject\n @options.fetch(:subject) { \"Invitation\" }\n end", "def reset_password_email\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def password_reset(user)\n mail_to user, password_reset_subject\n end", "def subject=(subject); @message_impl.setSubject subject; end", "def password_reset(user)\n @user = user\n mail :to => user.email#, :subject => t(\"Password_Reset\")\n end", "def subject=(string)\n set('Subject', string)\n end", "def password_reset(user)\n @user=user\n mail(:to=>@user.email,:subject=>\"Hey there! Thanks for using instaprint\")\n#mail (:to=>@user.email,:from=>'basics.aki@gmail.com',:subject=>\"Please find the password reset instructions\")\n end", "def password_reset(user)\n @user = user\n mail to: user.email, subject: \"Återställning av ditt lösenord på Biblion.\"\n end", "def reset_notification(user)\n\t\tsetup_email(user)\n\t\tsubject self.site_name+\" : \"+I18n.t('mailer.reset_notification.subject')\n\t\tbody :url => self.daurl+\"/admin/reset_password/#{user.password_reset_code}\",\n\t\t\t:user_login => user.login,\n\t\t\t:site => self.site_name\n end", "def password_reset(user)\n @user = user\n\n mail to: user.email, subject: t(:mailer_user_password_reset_subject)\n end", "def password_reset(teacher)\n @teacher = teacher\n mail to: teacher.email, subject: \"Password reset\"\n end", "def send_password_reset_email\r\n UserMailer.password_reset(self).deliver!\r\n end", "def reset_password_instructions(user)\n @resource = user\n mail(:to => @resource.email,\n :subject => \"Reset password instructions\",\n :tag => 'password-reset',\n :content_type => \"text/html\") do |format|\n format.html { render \"devise/mailer/reset_password_instructions\" }\n end\n end", "def send_password_reset_email\n UserMailer.password_reset(self.class.name.to_s.downcase.pluralize, self).deliver_now\n logger.info \"email: admin password reset sent to #{email}\"\n end", "def send_password_reset_email\n \t\tUserMailer.password_reset(self).deliver_now\n \tend", "def password_reset( user )\n @user = user\n mail( to: @user.email, subject: 'Restablecer contraseña Happitch' )\n end", "def send_password_reset_email\n UserMailer.password_reset(self).deliver\n end", "def send_password_reset_email\n UserMailer.password_reset(self).deliver\n end", "def send_password_reset_email\n UserMailer.password_reset(self).deliver\n end", "def send_password_reset_email\n UserMailer.password_reset(self).deliver\n end", "def send_password_reset_email\n UserMailer.password_reset(self).deliver\n end", "def send_password_reset_email\n UserMailer.password_reset(self).deliver\n end", "def send_password_reset_email\n \t\tUserMailer.password_reset(self).deliver_now\n \tend", "def password_reset(user)\n @user = user\n mail(:to => user.email, :subject => \"Password Reset\", :from => 'bassoonfingeringfinder@gmail.com') \n \n end", "def email_welcome_and_pass\r\nold_gt = I18n.locale\r\nI18n.locale = self.language unless self.language.blank?\r\nUserMailer.deliver_account_infos(self, @password) # Uniq time with decoded password\r\nI18n.locale = old_gt\r\nend", "def reset_password_instructions(resource, token, _options)\n @resource = resource\n @token = token\n mail(\n to: resource.email,\n subject: ['¿Solicitaste un cambio de contraseña en tus servicios de ',\n 'GurúComm?'].join('')\n )\n end", "def reset_password(user)\n setup_email(user)\n subject \"Password reset link\"\n\n body :user => user, :host => FROM_HOST\n end", "def password_reset(user)\n @user = user\n # missing \"from: \"norply@example.com\"\" -> error\n mail to: user.email, subject: \"Password reset\"\n end", "def student_password_reset\n StudentMailer.student_password_reset\n end", "def send_password_reset_email\n\t UserMailer.password_reset(self).deliver_now\n\tend", "def password_reset(user)\n @user = user\n\n mail :to => user.email, :subject => t(:password_recover)\n end", "def email_subject(form)\n \"#{form.type_of_enquiry} - #{reference}\"\n end", "def formatted_subject(text)\n name = PersonMailer.global_prefs.app_name\n label = name.blank? ? \"\" : \"[#{name}] \"\n \"#{label}#{text}\"\n end", "def password_reset(user)\n @user = user\n mail :to => user.email, :subject => \"Password reset for Project Help\"\n end", "def send_password_reset_email\n \tUserMailer.password_reset(self).deliver_now\n end", "def reset_password\n [send_email(MailPart.new_subject(I18n.t('devise.mailer.reset_password_instructions.subject')),\n nil,\n MailPart.new_body(''),\n EmailStuff::TYPES[:reset_password],\n reset_pass_call),\n @candidate_mailer_text.token]\n end", "def send_password_reset_email\n\t\tUserMailer.password_reset(self).deliver_now\n\tend", "def send_password_reset_email\n\t\tUserMailer.password_reset(self).deliver_now\n\tend", "def send_password_reset_email\n\t\tUserMailer.password_reset(self).deliver_now\n\tend", "def send_password_reset_email\n\t\tUserMailer.password_reset(self).deliver_now\n\tend", "def send_password_reset_email\n\t\tUserMailer.password_reset(self).deliver_now\n\tend", "def send_password_reset_email\n\t\tUserMailer.password_reset(self).deliver_now\n\tend", "def send_password_reset_email\n\t\tUserMailer.password_reset(self).deliver_now\n\tend", "def send_password_reset_email\n\t\tUserMailer.password_reset(self).deliver_now\n\tend", "def send_password_reset_email\n\t\tUserMailer.password_reset(self).deliver_now\n\tend", "def reset_password_instructions(user)\n @user = user\n setup_mail(:reset_password_instructions, :headers => {:to => @user.email})\n end", "def send_password_reset_email\n\t UserMailer.password_reset(self).deliver_now\n\tend", "def setSubject(subject)\n @fields['subject'] = subject\n self\n end", "def setSubject(subject)\n @fields['subject'] = subject\n self\n end", "def setSubject(subject)\n @fields['subject'] = subject\n self\n end", "def setSubject(subject)\n @fields['subject'] = subject\n self\n end", "def send_password_reset_email\r\n UserMailer.password_reset(self).deliver_now\r\n end", "def send_password_reset_email\r\n UserMailer.password_reset(self).deliver_now\r\n end", "def send_password_reset_email\n UserMailer.reset_senha(self).deliver_now\n end", "def password_reset\n #@greeting = \"Pershendetje\"\n\n #mail to: \"to@example.org\"\n end", "def password_reset(user)\n @user = user\n\n mail to: user.email, subject: 'Password Reset Instructions for Application'\n end", "def send_password_reset_email\r\n UserMailer.password_reset(self).deliver_now\r\n end", "def send_password_reset_email\n PasswordResetMailer.password_reset_email(self).deliver\n end", "def reset_password(user, reset_link)\r\n recipients user.email\r\n from system_email(reset_link)\r\n subject \"#{subject_prefix}Forgotton Password\"\r\n body :user => user, :reset_link => reset_link\r\n end", "def password_reset(user)\n #@greeting = \"Hi\"\n @user = user\n #mail to: user.email, subject: \"Password Reset\"\n mail to: user.email, subject: 'Welcome to Project Quest!'\n end", "def send_reset_email\n\t\tUserMailer.reset_password(self).deliver_now\n\tend", "def subject\n @subject ||= \"(sans sujet)\"\n if @no_header_subject.nil?\n \"#{header_subject}#{@subject}\"\n else\n @subject\n end\n end", "def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end", "def password_reset(user)\n @user = user\n mail to: user.email, subject: \"Password reset\"\n end", "def send_passwordreset_email\n UserMailer.password_reset(self).deliver_now\n end", "def send_password_reset_mail\n UserMailer.password_reset(self).deliver_now\n end", "def password_reset(user)\n @user = user\n mail to: user.email, subject: \"Password reset for TechScreen.net\"\n end", "def reset_email(user)\n @user = user\n @greeting = 'hello' \n #@url = 'http://localhost:3000/reset/<%= @user.code %>'\n mail to: @user.email, subject: \"Change your RAILS credentials\"\n end", "def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end", "def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end", "def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end", "def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end", "def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end", "def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end", "def password_reset(user)\n @user = user\n mail to: user.email, subject: 'Password reset'\n # @greeting = \"Hi\"\n # mail to: \"to@example.org\"\n end", "def send_reset_password_email(user)\n \t@user = user\n \tmail( :to => @user.email ,\n \t:subject => '[Todo Manager] Password Reset')\n end", "def send_reset_email\n UserMailer.password_reset(self).deliver_now\n end", "def send_reset_email\n UserMailer.password_reset(self).deliver_now\n end" ]
[ "0.6753835", "0.6676887", "0.66758966", "0.66571647", "0.66553485", "0.6648849", "0.6644893", "0.66416764", "0.6640451", "0.6615871", "0.65731955", "0.6564822", "0.6562829", "0.6503226", "0.64942807", "0.6487838", "0.64407206", "0.6436815", "0.64235705", "0.6387818", "0.6377299", "0.637288", "0.63519144", "0.6321811", "0.6297849", "0.62513125", "0.62335193", "0.62216455", "0.6215503", "0.62104446", "0.6209568", "0.6197635", "0.6196005", "0.6178253", "0.6158677", "0.61446565", "0.61429566", "0.614081", "0.61386", "0.61386", "0.61386", "0.61386", "0.61386", "0.61386", "0.6129941", "0.61246735", "0.61191666", "0.6116669", "0.6112866", "0.61117464", "0.61071956", "0.61027193", "0.61010826", "0.60961545", "0.6091616", "0.6082453", "0.60768455", "0.6076071", "0.6073866", "0.6073866", "0.6073866", "0.6073866", "0.6073866", "0.6073866", "0.6073866", "0.6073866", "0.6073866", "0.6073593", "0.60676384", "0.6063649", "0.6063649", "0.6063649", "0.6063649", "0.6056872", "0.6056872", "0.6049558", "0.6046785", "0.6045474", "0.60449153", "0.6039175", "0.60374147", "0.6031164", "0.60293025", "0.60289997", "0.6024006", "0.6021931", "0.6020627", "0.6019156", "0.601748", "0.6013457", "0.60105044", "0.60105044", "0.60105044", "0.60105044", "0.60105044", "0.60105044", "0.60046023", "0.59964764", "0.5995664", "0.5995664" ]
0.6087296
55
collective setters & getters
def set_up_readers can_walk @walk = can_walk end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getters; end", "def attribute_to_set; end", "def set; end", "def set; end", "def name\n return @name\nend\ndef age\n return @age\nend\n#setters, allows you to change or set something\ndef name=(name)\n @name = name\nend", "def setter\r\n @setter ||= Field.setter(@name)\r\n end", "def method_missing(meth, *args, &blk)\n match = meth.to_s.match(/^([a-zA-Z\\_]+)(=|$)$/)\n if match\n attribute, setter = match[1], !match[2].blank?\n if setter\n write_attribute(attribute, args.first)\n else\n read_attribute(attribute)\n end\n else\n super(meth, *args, &blk)\n end\n end", "def setter_methods\n return @setter_methods if @setter_methods\n @setter_methods = get_setter_methods\n end", "def setter_methods\n return @setter_methods if @setter_methods\n @setter_methods = get_setter_methods\n end", "def setter_method\n :\"#{self[:name]}=\"\n end", "def _setter_method\n :\"_#{self[:name]}=\"\n end", "def create_setter\n @model.class_eval <<-EOS, __FILE__, __LINE__\n #{writer_visibility}\n def #{name}=(value)\n self[#{name.inspect}] = value\n end\n EOS\n end", "def setter_method\n :\"#{self[:name]}=\"\n end", "def _setter_method\n :\"_#{self[:name]}=\"\n end", "def to_setter\n\t\t\t\t(to_getter.to_s+\"=\").to_sym\n\t\t\tend", "def setter_to_getter(node); end", "def get_setter_methods\n meths = instance_methods.map(&:to_s).select{|l| l.end_with?('=')} - RESTRICTED_SETTER_METHODS\n meths -= Array(primary_key).map{|x| \"#{x}=\"} if primary_key && restrict_primary_key?\n meths\n end", "def create_setters\n schema_fields.keys.each do |key|\n self.class.send(:define_method, \"#{key.to_s}=\".to_sym) do |value| \n @data[key] = value #get_value key, value\n end\n end\n end", "def accessors\n self.class.accessors\n end", "def create_setter\n @model.class_eval <<-EOS, __FILE__, __LINE__\n #{writer_visibility}\n def #{name}=(value)\n attribute_set(#{name.inspect}, value)\n end\n EOS\n end", "def attr_writer( * )\n fail \"Remember, an Entity is immutable. Use a Services::Service to mutate the underlying data.\"\n end", "def method_missing(method, *args)\n # Give OpenStruct a chance to create getters and setters for the\n # corresponding field\n super method, *args\n\n if field = setter?(method)\n # override setter logic to apply any existing sanitization rules before\n # assigning the new value to the field\n override_setter_for(field) if sanitize?(field)\n # uses the newly created setter to set the field's value and apply any\n # existing sanitization rules\n send(method, args[0])\n end\n end", "def method_missing(method_name, *arguments, &block)\n if /^(?<id>[^=]+)(?<assign>=)?$/ =~ method_name.to_s && attribute = self[id]\n assign ? attribute.send(\"value=\", *arguments) : attribute.value\n else\n super\n end\n end", "def attr_accessor(*args)\n attr_reader(*args)\n attr_writer(*args)\n end", "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", "def set(object, value); end", "def __setter__\n \"#{self}=\"\n end", "def attr_accessor( * )\n fail \"Remember, an Entity is immutable. Use a Services::Service to mutate the underlying data.\"\n end", "def method_missing(meth,*args,&block)\n\n method = meth.to_s # convert method name to a string\n setter = method.end_with?('=') # determine if this is a setter method (which would have the last character \"=\" in the method name)\n attribute = setter ? method.chop : method # the attribute name needs to have the \"=\" removed if it is a setter\n multivalued_field = attribute.end_with?(self.class.multivalued_field_marker) # in place editing fields can end with the special character marker, which will join arrays when return; and split them when setting\n attribute.gsub!(self.class.multivalued_field_marker,'') if multivalued_field\n\n solr_field_config=self.class.field_mappings[attribute.downcase.to_sym] # lookup the solr field for this accessor\n if solr_field_config\n solr_field_name=solr_field_config[:field].downcase\n default_value=solr_field_config[:default] || ''\n if setter # if it is a setter, cache the edit if it has changed\n old_values=self[solr_field_name]\n new_values=args.first\n if !self.class.is_equal?(old_values,new_values,multivalued_field) # we should only cache the edit if it actually changed\n value = (multivalued_field ? new_values.split(\"|\") : new_values) # split the values when setting if this is an in place edit field\n cache_edit({solr_field_name.to_sym=>value})\n return value\n else\n return old_values\n end\n else # if it is a getter, return the value\n value = unsaved_edits[solr_field_name.to_sym] || self[solr_field_name] # get the field value, either from unsaved edits or from solr document\n value = default_value if value.blank?\n return (multivalued_field && value.class == Array ? value.join(\" | \") : value) # return a joined value if this is an in place edit field, otherwise just return the value\n end\n else\n super # we couldn't find any solr fields configured, so just send it to super\n end\n\n end", "def define_setter_for(name)\n define_method(\"#{name}=\") do |associated|\n instance_variable_set(\"@#{name}\".to_sym, associated)\n\n assign_id_for(name, associated)\n assign_type_for(name, associated)\n assign_serialized_attributes(name, associated)\n end\n end", "def override_setters(*setters)\n setters.each do |setter|\n case setter\n\n #######################################################################\n ## facility_code\n #######################################################################\n when :facility_code\n define_method(:facility_code=) do |v|\n write_attribute(:facility_code, v.strip.upcase) if v.present?\n end\n\n #######################################################################\n ## institution\n #######################################################################\n when :institution\n define_method(:institution=) do |v|\n if v.present?\n v = v.to_s.gsub(\"'\", \"''\").strip.try(:upcase)\n write_attribute(:institution, v)\n end\n end\n\n #######################################################################\n ## ope6\n #######################################################################\n when :ope6\n define_method(:ope6=) do |v|\n if v.present? && !self.class.forbidden_word?(v.downcase)\n write_attribute(:ope6, self.class.pad(v.strip, 8)[1, 5])\n end\n end\n\n #######################################################################\n ## ope\n #######################################################################\n when :ope\n define_method(:ope=) do |v|\n v = v.try(:strip).try(:upcase) if v.is_a?(String)\n v = nil if self.class.forbidden_word?(v)\n\n write_attribute(:ope, self.class.pad(v, 8))\n self.ope6 = ope\n end\n\n #######################################################################\n ## state\n #######################################################################\n when :state\n define_method(:state=) do |v|\n write_attribute(:state, DS::State.get_abbr(v.strip)) if v.present?\n end\n\n #######################################################################\n ## miscellaneous\n #######################################################################\n else\n define_method(\"#{setter.to_s}=\".to_sym) do |v|\n col = self.class.columns.find { |col| col.name == setter.to_s }\n\n if v.is_a?(String)\n v = v.try(:strip)\n v = nil if self.class.forbidden_word?(v) || v.blank?\n v = v.to_s.gsub(\"'\", \"''\") if !v.nil?\n end\n\n if col.try(:sql_type) == \"boolean\"\n if !v.nil?\n v = self.class.truthy?(v) if v.is_a?(String)\n write_attribute(setter, v)\n end\n else\n write_attribute(setter, v)\n end\n end\n end\n end\n end", "def get_setters!\r\n return @extended_spec.first.get_setter!.merge(@setters) if !@extended_spec.empty?\r\n return @setters\r\n end", "def run\n methods = self.class.instance_methods - Object.instance_methods\n methods.grep(%r!^set_!).each do |v|\n send(v)\n end\n end", "def attr_writer(*fields)\n check_fields(fields)\n added_fields = jiak.data.writable(*fields)\n added_fields.each do |field|\n class_eval <<-EOM\n def #{field}=(val)\n @jiak.object.data.#{field} = val\n self.class.do_auto_update(self)\n end\n EOM\n end\n nil\n end", "def attr_accessor(*fields)\n attr_reader *fields\n attr_writer *fields\n end", "def attr_reader(*)\n end", "def method_missing(method, *args, &block)\n \n # The getter\n if @metadata.has_key?(method)\n return attribute_get(method)\n else\n # The setter\n \n if (attribute=method.to_s.match(/(.+)=$/).to_a.last)\n attribute_set(attribute, args.first)\n return\n end\n end\n \n super\n \n end", "def get_setter_methods\n if allowed_columns\n # SEQUEL5: Remove allowed_columns handling\n allowed_columns.map{|x| \"#{x}=\"}\n else\n meths = instance_methods.map(&:to_s).select{|l| l.end_with?('=')} - RESTRICTED_SETTER_METHODS\n meths -= Array(primary_key).map{|x| \"#{x}=\"} if primary_key && restrict_primary_key?\n meths\n end\n end", "def method_missing(method_name, *args, &block)\n if method_name.to_s.end_with?('=')\n set_attribute(method_name, *args)\n elsif has_attribute?(method_name)\n get_attribute(method_name)\n else\n super\n end\n end", "def inject_acl_object_getter_setter(method_name)\n inject_acl_object_check(method_name, :read)\n inject_acl_object_check(\"#{method_name}=\",:write)\n end", "def define_setter\n name = @name\n klass.send :define_method, \"#{name}=\" do |unit|\n send \"#{name}_value=\", unit.value\n send \"#{name}_unit=\", unit.unit.to_s\n end\n end", "def method_missing(meth, *args)\n return if not method_missing_hook(meth, args)\n\n d = self.class.structure_field_names\n m = meth.to_s\n\n setter = (m[-1].chr == \"=\") ? true : false\n m = m[0..-2] if setter\n\n puts \"WARNING: assignment to @value as struct field\" if setter and m == \"value\"\n\n if (i = d[m.intern])\n if setter\n self[m.intern] = args[0]\n else\n self[m.intern]\n end\n else\n super(meth, *args)\n end\n end", "def setup_object_attributes; end", "def setter\n @setter ||= :\"#{@name}=\"\n end", "def method_missing(method, *args, &block)\n meth, setter = /^(.*?)(=?)$/.match(method).values_at(1,2)\n if valid_temporal_attribute?(meth.to_sym) \n setter.empty? ? get(meth, *args) : set(meth, *args)\n else super\n end\n end", "def define_accessors\n self.metadata.properties_and_identity.each do |name, _|\n self.model.send :attr_accessor, name.downcase\n end\n end", "def properties\n super\n end", "def set_accessor\n @accessor = Accessor.find(params[:id])\n end", "def set_accessor\n @accessor = Accessor.find(params[:id])\n end", "def initialize\n @attribute = 'truite'\n @accessor = 'pouet'\n end", "def create_accessors(attribute_name)\n class_eval do\n define_method(attribute_name) do\n odata_entity[property_map[attribute_name]]\n end\n\n define_method(\"#{attribute_name}=\") do |value|\n # unless entity[property_map[attribute_name]] == value\n # send(\"#{attribute_name}_will_change!\") if defined?(::ActiveModel)\n # end\n\n odata_entity[property_map[attribute_name]] = value\n end\n end\n\n nil\n end", "def attr_accessor_sybling(method)\n attr_reader?(method) ? to_attr_writer(method) : to_attr_reader(method)\n end", "def age=(value)\n @age = value\nend", "def age=(value)\n @age = value\nend", "def setter_methods(type)\n if type == :default && !@singleton_setter_added\n return model.setter_methods\n end\n\n meths = methods.map(&:to_s).select{|l| l.end_with?('=')} - RESTRICTED_SETTER_METHODS\n meths -= Array(primary_key).map{|x| \"#{x}=\"} if primary_key && model.restrict_primary_key?\n meths\n end", "def set_attribute(name, value); end", "def attribute; end", "def attribute; end", "def attribute; end", "def attribute; end", "def attribute; end", "def attribute; end", "def attribute; end", "def create_setter(name, meth)\n define_method(\"#{meth}=\") do |value|\n write_attribute(name, value)\n end\n end", "def attr_writer(sym, *more) end", "def attr_writer(*args)\n sym_args=args_to_sym(args)\n sym_args.each do |value|\n self.instance_eval(\"def #{value}=(arg); @#{value}=arg;end;\")\n end\n \n end", "def def_set_accessor(key)\n key = key.to_sym\n raise ArgumentError.new('Invalid entry type: %s' % key) if respond_to?(key)\n metaclass.class_eval do\n define_method(key) {|*val| val.size > 0 ? (self[key] ||= Set.new).merge(val) : self[key] }\n define_method(\"#{key}!\") {|*val| val.size > 0 ? (cache[key] ||= Set.new).merge(val) : cache[key] }\n end\n end", "def attr; end", "def setter( name ) (name.to_s + '=').to_sym end", "def initialize(attr)\n #iterate over each key/value pair in attribute hash\n attr.each do |k,v|\n #name of key becomes setter\n #value associated with key is the name of value you want to pass to method\n self.send(\"#{k}=\", v)\n #send method is another way of calling a method on an object\n #same as instance_of_user.key = value\n #when you want to mass assign, send is better than .name= method\n end\n end", "def method_missing(method_name, *args, &block)\n #Rails.logger.debug(\"MongoRecord: #{method_name} - #{args.join(',')}\")\n method_name = method_name.to_s; setter = false\n if method_name.ends_with? '='\n method_name.chop!\n setter = true\n end\n\n method_name = '_id' if method_name == 'id'\n\n if setter\n @attributes[method_name] = args.first\n elsif @attributes.include?(method_name)\n @attributes[method_name]\n else\n nil\n #super(method_name, *args, &block)\n end\n end", "def accessor(*args)\n attr_accessor(*args)\n args\n end", "def setter\n @setter ||= \"#{name}=\"\n end", "def set(value)\n raise NotImplementedError\n end", "def initialize_set(values)\n super\n serialize_deserialized_values\n end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def internal_attr_accessor(*syms)\n internal_attr_reader(*syms)\n internal_attr_writer(*syms)\n end", "def attributes=(params)\n params.each do |attr, value|\n public_send(\"#{attr}=\", value)\n end\n self\n end", "def method_missing(method, *args, &block)\n if method[-1] == '='\n # setter\n key = method.slice(0...-1).to_sym\n\n unless has_key?(key)\n super\n end\n self[key] = args[0]\n else\n unless has_key?(method)\n super\n end\n\n prop = self[method]\n if prop.is_a? JSFunction\n prop.call_with_instance(self, *args, &block)\n else\n prop\n end\n end\n end", "def create_setter!\n @target.class_eval <<-EOS\n #{writer_visibility.to_s}\n def #{name}=(value)\n attribute_set(#{name.inspect}, value)\n end\n EOS\n rescue SyntaxError\n raise SyntaxError.new(column)\n end", "def assign_attributes\n @data.each do |attribute, value|\n self.class.send(:attr_accessor, attribute)\n set(attribute, value)\n end\n end", "def set(*args)\n # not supported\n end", "def set(*args)\n # not supported\n end", "def setter(name, metadata)\n re_define_method(\"#{name}=\") do |object|\n without_autobuild do\n if value = get_relation(name, metadata, object)\n if value.respond_to?(:substitute)\n set_relation(name, value.substitute(object.substitutable))\n end\n else\n __build__(name, object.substitutable, metadata)\n end\n end\n end\n self\n end", "def method_missing(method_name, *args, &block)\n # Check if the method missing an \"attr=\" method\n raise unless method_name.to_s.end_with?(\"=\")\n\n setter = method_name\n getter = method_name.to_s.slice(0...-1).to_sym\n instance_var = \"@#{getter}\".to_sym\n\n # attr_writer\n define_singleton_method(setter) do |new_val|\n instance_variable_set(instance_var, new_val)\n end\n\n # attr_reader\n define_singleton_method(getter) { instance_variable_get(instance_var) }\n\n # Ignores all arguments but the first one\n value = args[0]\n\n # Actually sets the value on the instance variable\n send(setter, value)\n rescue MethodMissing\n # Raise error as normal, nothing to see here\n super(method_name, *args, &block)\n end", "def method_missing(setter, value)\n case setter.to_s\n when /^set_(.+)/\n variable_name = \"@#{$1}\"\n if instance_variable_defined?(variable_name)\n instance_variable_set(variable_name, value)\n else\n raise NoMethodError.new(\"Undefined setter '#{setter.to_s}' for #{self.class}.\")\n end\n else\n super\n end\n end", "def properties; end", "def properties; end", "def properties; end", "def properties; end", "def properties; end" ]
[ "0.75267607", "0.72674066", "0.7120496", "0.7120496", "0.6949387", "0.685067", "0.67682636", "0.6683524", "0.6683524", "0.6667603", "0.66647977", "0.6606873", "0.65469044", "0.6507976", "0.6489649", "0.6478666", "0.64632004", "0.64498717", "0.64422643", "0.6437255", "0.64293253", "0.6392308", "0.63780683", "0.63393503", "0.6331281", "0.6325421", "0.63235253", "0.631261", "0.63120985", "0.6294718", "0.6263183", "0.62501264", "0.62460756", "0.62412935", "0.62352234", "0.62259567", "0.6215662", "0.61922795", "0.6180769", "0.6179195", "0.61574703", "0.61553264", "0.6154588", "0.6147306", "0.6142877", "0.6142702", "0.6126514", "0.61264676", "0.61264676", "0.6110074", "0.6102917", "0.6095029", "0.60832983", "0.60832983", "0.6017596", "0.6015318", "0.60118794", "0.60118794", "0.60118794", "0.60118794", "0.60118794", "0.60118794", "0.60118794", "0.60062116", "0.60033226", "0.60013753", "0.6000274", "0.59998643", "0.5983979", "0.5975788", "0.59755564", "0.5966082", "0.59654576", "0.59652716", "0.59551114", "0.5937329", "0.5937329", "0.5937329", "0.5937329", "0.5937329", "0.5937329", "0.5937329", "0.5937329", "0.5937329", "0.5937329", "0.5937329", "0.5921479", "0.59144294", "0.5913949", "0.5899319", "0.5887201", "0.5882151", "0.5882151", "0.5875682", "0.5872997", "0.5872578", "0.5863427", "0.5863427", "0.5863427", "0.5863427", "0.5863427" ]
0.0
-1
isAlt("amazon") // true isAlt("apple") // false isAlt("banana") // true Arguments consist of only lowercase letters.
def is_alt(s) staging_area = [] staging_area << s[0] consonants = "bcdfghjklmnpqrstvwxyz" vowels = "aeiou" s.chars[1..-1].each do |letter| if consonants.include?(letter) staging_area << letter unless consonants.include?(staging_area.last) end if vowels.include?(letter) staging_area << letter unless vowels.include?(staging_area.last) end end staging_area.join == s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uppercase_alt?(str)\n str == str.upcase\nend", "def is_alt(s)\n vowels = %w(a e i o u)\n test = s.chars.map { |letter| vowels.include?(letter) ? 1 : 0 }\n test.each_with_index { |char, index| return false if char == test[index+1] }\n true\nend", "def is_uppercase?(word)\nend", "def not_in_alphabet?(letter)\n !UPPERCASE.include?(letter) && !LOWERCASE.include?(letter)\nend", "def letter_in_word?(letter)\n end", "def letters(arg)\n return tuc(arg.sub(/[eiou]/, 'a')) != \"\"\n end", "def alphabetical?(str)\r\n ('A'..'Z').to_a.include? str.upcase\r\nend", "def alt?\n @alt\n end", "def panagram2?(string)\n ('a'..'z').all? { |letter| string.downcase.include?(letter) }\nend", "def has_vowels?(word)\nend", "def panagram?(string)\nend", "def is_upercase?(char)\n if char==char.upcase then\n return \"true\"\n else\n return \"false\"\n end\nend", "def is_vowel(letter)\n \"aeiou\".include?(letter.downcase)\nend", "def is_alpha(c)\n c =~ /[a-z]/i\nend", "def is_alpha(c)\n c =~ /[a-z]/i\nend", "def is_alpha(c)\n c =~ /[a-z]/i\nend", "def in_all_strings?(long_strings, short_string)\nend", "def validate_alpha_accent str\n\t\t\t(ActiveSupport::Inflector.transliterate(str) =~ /^[a-zA-Z\\'\\-\\s]*$/ ) == nil ? false : true\n\t\tend", "def starts_with_vowel?(str)\n @str= str.capitalize\n (@str[0] == 'A' or @str[0] == 'E' or @str[0] == 'I' or @str[0] == 'O' or @str[0] == 'U') ? true : false\nend", "def is_lowecase letter\n if letter == letter.downcase\n return true\n else\n return false\n end\n\nend", "def isAlpha(c)\n ('A' .. 'Z').include?(c.capitalize)\nend", "def mixed_case?()\n LuckyCase.mixed_case? self\n end", "def alpha?(value, option = nil)\n if option.is_a?(Symbol)\n options = {:case => option}\n else\n options = option\n end \n\n return true if value.nil? and not required(options) \n return false unless value.is_a?(String)\n return value.match(/^[a-zA-Z]+$/) unless options.is_a?(Hash)\n\n case \n when options[:case] == :down\n return value.match(/^[a-z]+$/)\n when options[:case] == :up || options[:case] == :upper\n return value.match(/^[A-Z]+$/)\n else\n raise ArgumentError.new(\"options must be :down or :up.\")\n end\n end", "def strict_matching(ingredient_name,item)\n return item.downcase.include?(ingredient_name)\nend", "def is_letter?(l)\n return l.match?(/[A-Za-z]/)\nend", "def finder?(word, letter)\n word.upcase.include?(letter.upcase)\nend", "def verify_choice_ok (choice)\r\n if \"adehlnq+?\".include? (choice)\r\n return true\r\n else\r\n return false\r\n end\r\nend", "def test_check_capital_non_alpha\r\n assert_equal true, @g.check_capital('?!.(3')\r\n end", "def test_2_accepts_mixed_case_passwords\n result = at_least_one_caps?(\"1Abjils&a\")\n assert(result, \"'1Abjils&a' should be valid because it is mixed case\")\n end", "def letter?(s)\n\ts =~ /[A-Za-z]/\nend", "def ordered_vowel_word?(word)\nend", "def is_vowel?(letter)\n case letter\n when \"a\", \"e\", \"i\", \"o\", \"u\"\n return true\n else\n return false\n end\nend", "def is_vowel?(letter)\n if [\"a\", \"e\", \"i\", \"o\", \"u\"].include?(letter)\n return true \n else \n return false \n end \nend", "def vowels_with_case(letter)\n case letter\n when \"a\",\"e\",\"i\",\"o\",\"u\"\n return true\n else\n return false\n end\nend", "def valid_anagram(text)\n\nend", "def screaming?\n upcase == self && self =~ /[A-Z]/\n end", "def is_are_upcase\n is_are.upcase\n end", "def starts_with_consonant? s\n s_lower=s.downcase\n if /^[a-z&&[^aeiou]]/.match(s_lower) \n return true\n else \n return false\n end\nend", "def starts_and_ends_with_same_letter?(word)\nend", "def same_case( your_string , options = Hash.new )\n return your_string.upcase if options[:upcase] == true\n return your_string.upcase if options[:downcase] == false\n your_string.downcase\nend", "def alt_caps(string)\n case\n when string.length > 10\n string.upcase\n else\n string\n end\nend", "def upcase?(string)\n string == string.upcase\nend", "def uppercase3?(string)\n #p string.scan(/[a-z]/i)\n !string.scan(/[A-Z]/).empty? && string.scan(/[A-Z]/) == string.scan(/[a-z]/i)\nend", "def all_letters? str\r\n str[/[a-zA-z]+/] == str\r\nend", "def contains_alias(aliaz)\n\n end", "def speak_to_grandma(takes_string_arguement)\n\n if takes_string_arguement == takes_string_arguement.upcase\n return \"NO, NOT SINCE 1938!\"\n else\n return \"HUH?! SPEAK UP, SONNY!\"\n end\n \nend", "def isIdentifier(str)\n digitsOfAlphabet = getAlphabet[0] # if its a digit\n charsOfAlphabet = getAlphabet[1] # if a letter\n\n # first character in name cannot be digit\n if digitsOfAlphabet.include?(str[0])\n return false\n end\n\n # if keyword includes str\n if getKeywords.include?(str)\n return false\n end\n\n # check is in the alphabet\n for i in 1..str.size-1\n character = str[i]\n\n unless digitsOfAlphabet.include?(character) or charsOfAlphabet.include?(character)\n return false\n end\n end\n\n return true\nend", "def string_behavior (strings)\n\n strings.each do |str|\n if not str =~ /[A-Z]/ and str.length > 4\n puts \"long and lowercase\"\n elsif not str =~ /[A-Z]/\n puts \"lowercase\"\n elsif str.length > 4\n puts \"long\"\n\n else\n puts str\n end\n end\n end", "def vocales str\n puts !!(str =~ /[aeiou]/)\nend", "def check_choice\n @word.downcase.include?(@letter)\n end", "def a_or_an(word)\n %w(a e i o u).include?(word[0].downcase) ? \"an\" : \"a\"\n end", "def alien?() is_type?( 'Alien'); end", "def check_string(string)\n\tzombie_apocalypse_supplies = [\"hatchet\", \"rations\", \"water jug\", \"binoculars\",\n \"shotgun\", \"compass\", \"CB radio\", \"batteries\"]\n\tzombie_apocalypse_supplies.each do |item|\n\t\tif string.downcase == item.downcase\n\t\t\treturn true\n\t\tend\n\tend\n false\nend", "def is_all_this_letter?(word, character)\n a = is_all_as?(word)\n\n end", "def maybe_matching(ingredient_long_name,item)\n return (item.downcase.split(\" \") & ingredient_long_name.split(\" \")).size >= 1\nend", "def is_lower?(c)\n return c != c.capitalize\n end", "def has_lab?(string)\n if string.downcase =~ /lab/\n puts \"#{string} includes the word lab.\"\n else\n puts \"#{string} does not include the word lab\"\n end\nend", "def show_me(name)\n !!name.match(/\\A[A-Z][a-z]+(-[A-Z][a-z]+)*\\z/)\nend", "def vowel? (char)\n 'aeiou'.include? (char) \nend", "def is_vowel letter\n return false if letter.class != String || letter.length != 1\n vowels = \"aeiouAEIOU\"\n vowels.include? letter\nend", "def valid_case_string?()\n LuckyCase.case(self) != nil\n end", "def panagram?(string)\n alphabet_arr = ('a'..'z').to_a\n \n alphabet_arr.each do |element|\n return false if string.downcase.include?(element) == false\n end\n\n true\nend", "def lower_case?()\n LuckyCase.lower_case? self\n end", "def string_check(elem)\n (('a'..'z').to_a + ('A'..'Z').to_a).each { |k| return true if elem.include?(k) }\n false\n end", "def letter(input)\n\t(/[a-zA-Z]{2,}(\\,)\\s?[A-Z]{2}(\\s)([0-9]{5}|[0-9]{5}(\\-)?[0-9]{4}|[a-zA-Z]{1}[0-9]{1}[a-zA-Z]{1}(\\s|\\-)?[0-9]{1}[a-zA-Z]{1}[0-9]{1})}/i =~ input)? \"true\" : \"false\"\nend", "def proper(word)\n /[[:upper:]]/.match(word) != nil\n end", "def exempt?\n if @a_name.include?(\"book\") || @a_name.include?(\"chocolate\") || @a_name.include?(\"headache\")\n true\n else \n false\n end\n end", "def staggered_case_decide(string, use_all_char=false)\n alt_cap = ''\n need_upper = true\n split_str = string.chars\n split_str.each do |char|\n if use_all_char\n if need_upper\n alt_cap << char.upcase\n else\n alt_cap << char.downcase\n end\n need_upper = !need_upper\n else\n if char =~ /[^A-z]/\n alt_cap << char\n else\n if need_upper\n alt_cap << char.upcase\n else\n alt_cap << char.downcase\n end\n need_upper = !need_upper\n end\n end\n end\n alt_cap\nend", "def alpha_search(str)\r\n\r\nend", "def starts_with_a_vowel?(word)\n word.match(/^[aeiouAEIOU]\\w+/) ? true : false #beginning of string is a lower or upper vowel with at least one or many word characters\nend", "def is_password(password)\n if password.downcase == \"password\"\n puts \"Password cannot be the word password\"\n else \n puts \"Acceptable\"\n end\nend", "def is_upper? str; str == str.upcase; end", "def is_anagram(test, original)\n test.downcase.chars.sort == original.downcase.chars.sort\nend", "def is_letter?(letter)\r\n (Alphabet.include? letter.downcase) && (letter.length == 1)\r\n end", "def starts_with_consonant? s\n # if /^[^aeiou\\W]/i.match(s) == nil then false else true end\n /^[^aeiou\\W]/i.match(s)==nil ? false : true\n # !%w(a e i o u).include? s[0].downcase unless s.empty? or /^\\W/.match(s)\n \nend", "def is_upper(letter)\n letter == letter.upcase\nend", "def can_tweak_sign?(normal_sign, vandalized_sign)\n str = normal_sign.delete \",.!?';\".downcase\n letters = character_count(str)\n vandalized_sign.each_char do |char|\n char = char.downcase\n return false if letters[char].nil? || letters[char].zero?\n\n letters[char] -= 1\n end\n true\nend", "def panagram3?(string)\n string.downcase.scan(/[a-z]/).uniq.size == 26\nend", "def is_alpha?(input)\n !is_digit?(input)\nend", "def is_capitalized?(word)\n return true if word == word.upcase\n return false\n end", "def match?(given_names); end", "def panagram?(string)\n string.downcase.scan(/[a-z]/).uniq.size == 26\nend", "def is_special?\n # Only consonants\n return true if self =~ /^[bcdfghjklmnpqrstvwxz]+$/i\n\n # Not a word\n return false if self =~ /[^\\s]\\s[^\\s]/;\n return false if self.length < 3;\n # Alphanumeric\n return true if self =~ /[0-9]/ && self =~ /[a-z]/i\n # All Caps\n return true if self =~ /[A-Z]{2,}/;\n # Caps Mix\n return true if self =~ /[a-z][A-Z]/;\n # All consonants\n return true if self =~ /^[a-z]$/i && self !~ /[aeiou]/i\n # Dashed word\n return true if self =~ /(^\\w-|-\\w$)/\n # To many consonants (very heuristic)\n if self =~ /([^aeiouy]{3,})/i && !CONSONANTS.include?($1.downcase)\n return true\n end\n\n return false\n end", "def starts_with_a_vowel?(word)\n word.match(/\\b[AEIOUaeiou][a-z]*\\b/)? (true) : (false)\nend", "def anagrams?\n same_length? && same_letters?\n end", "def panagram?(string)\n return false if string.length < 26\n\n letters = string.downcase.gsub(/[^a-z]/, '')\n letters.chars.uniq.count >= 26\nend", "def starts_with_consonant?(s)\n if s.empty?\n return false\n elsif ( /[a-z]/ =~ s[0].downcase && /[^aeiou]/ =~ s[0].downcase)\n return true\n elsif ( /[A-Z]/ =~ s[0].upcase && /[^AEIOU]/ =~ s[0].upcase)\n return true\n else\n return false\n end\nend", "def is_lowercase(string)\n lowercase = ('a'..'z').to_a\n lowercase.include? string\nend", "def is_upper?(string)\n string == string.upcase\nend", "def letter?(string)\n string =~ /[A-Za-z]/\n end", "def vowels_with_no_if_or_case(letter)\n while vowels.include? letter \n # alternatively, use a text string of potential vowel options\n return true\n end\n return false\nend", "def a_or_an(word)\n word = word.strip\n if %w{a e i o u}.include? word[0..0].to_s.downcase\n \"an #{word}\"\n else\n \"a #{word}\"\n end \n end", "def is_vowel?(letter)\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n if vowels.include?(letter.downcase)\n return true\n else\n return false\n end\nend", "def starts_with_consonant? s\n s !~ /^[AEIOU]/i && s =~ /^\\w/i\nend", "def test_3_rejects_all_upper_case_passwords\n result = at_least_one_downcase?(\"1abjils&a\")\n assert(result, \"'1abjils&a' should be invalid because it contains no upcase\")\n #assert(result == false, \".same message as above\")\n end", "def same_case( str , options = Hash.new )\n return str.upcase if options[:upcase] || options[:downcase] == false\n str.downcase\nend", "def starts_with_a_vowel?(word)\nword.match? (/\\b[aeiou]/i)\n end", "def is_valid_name(name)\n name_arr = name.split(\" \")\n if (name_arr.length > 1)\n name_arr.each do |word|\n if !(word[0] == word[0].upcase && word[1..-1] == word[1..-1].downcase)\n return false\n end\n end\n else\n return false\n end\n true\nend", "def is_vowel?(letter)\n \"aeiou\".include?(letter)\n end", "def starts_with_a_vowel?(word)\n word.match(/^[aeiouAEIOU]/) ? true : false\nend" ]
[ "0.7200832", "0.7196417", "0.6402511", "0.6397173", "0.63875604", "0.6314357", "0.6312497", "0.6300727", "0.62596756", "0.6240101", "0.6208027", "0.6168394", "0.6158213", "0.6148368", "0.6148368", "0.6148368", "0.6147766", "0.61189866", "0.6118201", "0.61177754", "0.61121714", "0.61105686", "0.6109456", "0.61080104", "0.6100388", "0.60968643", "0.60733515", "0.6061935", "0.6056565", "0.6022338", "0.6008326", "0.5994816", "0.59900355", "0.59893394", "0.5983517", "0.5981085", "0.5980034", "0.59792334", "0.59694886", "0.5968453", "0.5965234", "0.59406215", "0.5904108", "0.5903391", "0.59015256", "0.59001565", "0.5896485", "0.58963585", "0.5893878", "0.58886915", "0.5882934", "0.58773285", "0.5876974", "0.5875385", "0.5869718", "0.5862303", "0.5860486", "0.5860392", "0.5852824", "0.58447653", "0.583841", "0.5837479", "0.583306", "0.5829264", "0.58286005", "0.5821851", "0.5813613", "0.5813597", "0.5811931", "0.58075273", "0.580615", "0.5806066", "0.58056074", "0.5802932", "0.5801891", "0.58017796", "0.5801568", "0.58005357", "0.57954526", "0.5790849", "0.5790779", "0.5784102", "0.5782936", "0.5781938", "0.57780635", "0.5767228", "0.5766075", "0.57608354", "0.57564497", "0.5753106", "0.5752925", "0.57525194", "0.57418644", "0.57372", "0.5736223", "0.57293797", "0.57287765", "0.57268703", "0.57262444", "0.5724427" ]
0.6500952
2
This function imports the JASON file and stores it into a hash table
def read_jason(file_path) json_file = File.read(file_path) data_hash = JSON.parse(json_file) return data_hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def import\n Map.import(params[:file])\n end", "def jload(fname)\n return j2h(loadfile(fname)) unless (res = @preload)\n verbose { 'Loading from Preloading' }\n @preload = nil\n res\n rescue InvalidData\n show_err\n Hashx.new\n end", "def importFromFile(type, json_hash)\n idx = 0\n len = json_hash.length\n json_hash.each do |arr|\n # this is for jason, remove for prod\n if idx > 500\n break\n end\n begin\n type.create(arr)\n idx += 1\n puts \"Added #{idx}/#{len}\"\n rescue => exception\n puts \"Error #{exception}\"\n end\n end\nend", "def load_hash(file_path) \n file=File.read(file_path)\n JSON.parse(file)\n end", "def load_hash(file_path) \n file=File.read(file_path)\n JSON.parse(file)\n end", "def load_table (filename)\n\t\t\tnew_table = File.open(filename)\n\t\t\t@file_table = JSON.load(new_table)\n\t\t\tnew_table.close\n\t\tend", "def getHashFromJson(filename)\n File.open( filename, \"r\" ) do |f|\n JSON.load(f)\n end\nend", "def import_file(filename)\n h = Oj.load_file(filename)\n import(h)\n end", "def load_json(filename); end", "def import()\n # TODO\n end", "def load_penalties\n JSON.parse(File.read(@filename))\n end", "def import\n end", "def import\n end", "def import\n end", "def import\n end", "def to_import_hash\n {\n :import_from_file => @import_from_file,\n :db_configuration => @db_configuration,\n :db_connection => @db_connection,\n :append_to_table => @append_to_table,\n :force_name => @force_name,\n :suggested_name => @suggested_name,\n :ext => @ext,\n :path => @path,\n :python_bin_path => @python_bin_path,\n :psql_bin_path => @psql_bin_path,\n :entries => @entries,\n :runlog => @runlog,\n :import_type => @import_type\n }\n end", "def initialize(file_name)\n @file = File.read(file_name)\n @json_hash = JSON.parse(@file)\n end", "def import\n read_dict_file(:langA)\n write_database(:langA)\n\n read_dict_file(:langB)\n write_database(:langB)\n end", "def initialize(json_file_path)\n @@_module_key = ENV['MODULE_KEY'].to_sym\n @@_content_key = ENV['CONTENT_KEY'].to_sym\n @@_lesson_key = ENV['LESSON_KEY'].to_sym\n @@_lesson_title_key = ENV['LESSON_TITLE_KEY'].to_sym\n @@_lesson_description = ENV['LESSON_DISCRIPTION'].to_sym\n\n\n hash = Utilities.load_json(json_file_path)\n descriptions = :Description\n mod = :Module\n\n\n super()\n @title = hash[mod][:Title]\n @difficulty = hash[mod][:Difficulty]\n\n @author = hash[mod][:Author]\n @updated = hash[mod][:Last_Updated]\n @desc = hash[mod][descriptions]\n @section_titles = []\n @section_descriptions = []\n @file_ref = json_file_path\n # alias to ContentController module\n @sys = ContentController\n\n\n hash[@@_content_key].each do |section|\n @section_titles.push section[@@_lesson_title_key] ||= []\n @section_descriptions.push section[@@_lesson_description] ||= []\n end\n end", "def run\n super\n\n f = _get_entity_name\n\n # Read and split the file up\n begin\n json = JSON.parse (File.open(f,\"r\").read)\n rescue JSON::ParserError => e\n _log_error \"Unable to parse, failing...\"\n return\n end\n\n\n\n\n\n end", "def load\n @cache = JSON.parse(File.read(file))\n rescue\n @cache = {}\n end", "def loadResult()\n json = nil ;\n file = scannedResultFilename() ;\n open(file,\"r\"){|strm|\n json = JSON.load(strm.read()) ;\n }\n\n json.each{|result|\n analyzer = AnalyzerExpA.new(@logBaseDir, nil) ;\n analyzer.scanResultJson(result) ;\n basename = analyzer.basename ;\n @basenameList.push(basename) ;\n @analyzerTable[basename] = analyzer ;\n }\n end", "def import_static_kata_data\n @katas = dojo.katas\n Session.delete_all\n Compile.delete_all\n\n print \"\\nPopulating DB with Static Kata Data\\n\"\n count = 0\n\n @katas.each do |kata|\n kata.avatars.active.each do |avatar|\n\n session = Session.new do |s|\n s.cyberdojo_id = kata.id\n s.avatar = avatar.name\n end\n session.save\n\n session = Session.find_by(cyberdojo_id: kata.id, avatar: avatar.name)\n puts \"Processing: #{session}\" if DEBUG\n session.kata_name = kata.exercise.name\n session.language_framework = kata.language.name\n session.path = avatar.path\n session.start_date = kata.created\n session.save\n\n avatar.lights.each_with_index do |light, index|\n compile = Compile.new\n compile.light_color = light.colour\n compile.git_tag = light.number\n compile.session = session\n compile.save\n end \n count += 1\n print \"\\r \" + dots(count)\n end\n end\nend", "def import_dict_from_file_hnd(dict_name, dict_folder)\n puts \"start importing dictionary\"\n\n base_path = @file_dir+\"/\"+dict_folder\n dict_idx_path = base_path + \"/\" + \"#{dict_folder}.index\"\n dict_data_path = base_path + \"/\" +\"#{dict_folder}.dict\"\n\n dict_table = @DB[@dict_table_name];\n dict_id = -1\n begin\n dict_id = dict_table.insert(:name=>dict_name.force_encoding(\"UTF-8\"),\n :string_id=>dict_folder.force_encoding(\"UTF-8\"))\n rescue\n #dict_id = @DB['SELECT * FROM ? WHERE string_id = ?',@dict_table_name, dict_folder].first\n dict_id = dict_table[:string_id=>dict_folder][:id]\n #puts \"count not insert dict #{dict_id}\"\n end\n\n if (dict_id<0)\n puts \"unknown error, could not find dict_id\"\n return\n end\n\n word_table = @DB[@word_table_name];\n meaning_table = @DB[@meaning_table_name];\n\n\n count = 0\n File.open(dict_data_path, \"r\") do |data_file|\n File.open(dict_idx_path, \"r\") do |idx_file|\n while (line = idx_file.gets)\n count+=1\n pos1 = line.index(\"\\t\")\n pos2=line.index(\"\\t\",pos1+1)\n\n keyword = line[0..pos1-1]\n str_entry_offset = line[pos1+1..pos2-1]\n str_entry_len = line[pos2+1..line.length-2]\n\n entry_offset = dec_val(str_entry_offset)\n entry_len = dec_val(str_entry_len)\n data_file.seek(entry_offset, IO::SEEK_SET)\n meaning = data_file.read(entry_len)\n\n word_id = -1\n existed_meaning = nil\n begin\n ch = keyword[0].upcase\n kind = 0\n if (ch<='Z' and ch >= 'A')\n kind = ch.getbyte(0) - 64\n end\n word_id = word_table.insert(:word=>keyword.force_encoding(\"UTF-8\"), :kind=>kind)\n rescue Exception => e\n word_id = word_table[:word=>keyword][:id]\n existed_meaning = meaning_table[:word=>word_id, :dict=>dict_id]\n if !existed_meaning.nil?\n existed_meaning = existed_meaning[:meaning]\n end\n end\n\n if (word_id<0)\n puts \"unknown error, could not get word id\"\n return\n end\n\n begin\n if (!existed_meaning.nil?)\n meaning = existed_meaning + \"\\n\\n\" + meaning.force_encoding(\"UTF-8\");\n meaning_table[:dict=>dict_id, :word=>word_id] = {:meaning=>meaning}\n else\n meaning_table.insert(:dict=>dict_id,:word=>word_id, :meaning=>meaning)\n end\n rescue Exception => e\n puts \"could not insert meaning #{keyword} e: #{e}\"\n end\n\n if count%1000==0\n puts \"count: #{count}\"\n #return\n end\n\n end\n end\n end\n\n puts \"importing done\"\n\nend", "def reload(file=nil)\n @file = file if file\n @h = JSON.parse(IO.read(@file), :symbolize_names => true)\n self\n end", "def load_bitbucket()\n JSON.parse(IO.read('db-1.0.json'))\nend", "def parse_script(script_src)\n\n\tfile = File.read(script_src)\n\n\tfile = file.sub(/<script type=\"text\\/javascript\">window\\._sharedData =/, '')\n\tfile = file.sub(/;<\\/script>/, '')\n\n\topen(script_src, 'w') do |f|\n\t\tf << file\n\tend\n\n\tjson = JSON.load(File.read(script_src))\n\tentry = json['entry_data']\n\t#puts entry.inspect\n\n\n\tscrap_tag_media(entry['TagPage'].first['tag']['media']) if entry['TagPage'] and entry['TagPage'].first['tag']['media']['nodes'].size != 0\t\n\tscrap_tag_media(entry['LocationsPage'].first['location']['media']) if entry['LocationsPage'] and entry['LocationsPage'].first['location']['media']['nodes'].size != 0\t\nend", "def import_from_jar\n # Example\n # this is used to import java generated file from the jar \n # within the application which will be running in java\n # you need to put the name of all the required class\n %w[\n controller\n handler\n application_controller\n application_handler\n ].each do |c|\n require c\n end\n\nend", "def parse_file(src, dest)\n create_table(dest)\n\n puts \"***** Importing #{dest}\"\n\n count = 0\n# names = File.foreach(src).collect do |line|\n names = open(src).collect do |line| \n count += 1\n if count % 2000 == 0\n puts count\n end\n\n data = line.split\n\n name = data.first.capitalize\n freq = data[2].to_f\n\n name = if dest == \"surname\"\n cleanup_surname(name)\n else\n cleanup_firstname(name)\n end\n\n {:name => name, :freq => freq}\n end\n\n puts \"loading into db\"\n\n # remove any existing records\n @db[dest.to_sym].truncate\n\n # insert!\n @db[dest.to_sym].multi_insert(names)\n end", "def source filename\n source_hash[filename]\n end", "def import\n History.import(params[:file])\n redirect_to histories_url\n end", "def load_report_to_hash(file = nil)\n # Need to add option to pass an array\n require \"csv\" unless defined? CSV\n file ||= Dir.glob(\"#{ENV[\"HOME\"]}/Google Drive/CMS Reports/cms_report*.csv\").sort_by{|x| File.mtime(x)}.last\n @data = CSV.read(file)\n @data[0] = @data[0].map{|x| x.downcase.gsub(\" \",\"_\")} #convert headers to slug\n @headers = @data[0]\n @data[1..-1].map {|r| \n @cms ||= {}\n @cms[title_slug(r[@headers.index(\"show_name\")], r[@headers.index(\"video_name\")])] = r\n }\n @cms\n end", "def load_model(model_class)\n begin\n file_content = File.read(model_class.db_filename)\n json_data = JSON.parse(file_content)\n rescue Errno::ENOENT\n # The file does not exists\n json_data = []\n end\n json_data.each do |data_hash|\n new_object = model_class.from_hash(data_hash)\n new_object.save\n end\nend", "def load_model(model_class)\n begin\n file_content = File.read(model_class.db_filename)\n json_data = JSON.parse(file_content)\n rescue Errno::ENOENT\n # The file does not exists\n json_data = []\n end\n json_data.each do |data_hash|\n new_object = model_class.from_hash(data_hash)\n new_object.save\n end\nend", "def load_script(file); end", "def load_sample(file)\n path = Rails.root.join(\"lib\", \"assets\", \"sample_data\", \"#{file}.json\")\n file_data = File.read(path)\n return JSON.parse(file_data, symbolize_names: true)\n end", "def load(file); end", "def load_json(filename)\n File.open(File.expand_path(\"../support/#{filename}\", __FILE__), \"r\") do |json_file|\n JSON.load(json_file)\n end\nend", "def load_transitions(filename)\n file = File.read(filename)\n JSON.parse(file)\n end", "def import_from_hash(session, params)\n @model = params[:model]\n contents_hash = eval(params[:contents_hash])\n \n if params[:has_header] == \"true\"\n @header_integrated_body = hash_rows_with_headers(contents_hash[:header], contents_hash[:body])\n else\n # If there is no header, recover the selected fields in the select* params\n new_header = []\n params.each_key do |p|\n if p.match(/\\Aselect/)\n new_header << params[p]\n end\n end\n @header_integrated_body = hash_rows_with_headers(new_header, contents_hash[:body])\n end\n\n # Call ::import for each row of the file\n errors = []\n begin\n @header_integrated_body.each do |row_hash|\n if @model.constantize.import_options.empty?\n @model.constantize.import(row_hash, session, params[:id])\n else\n @model.constantize.import(row_hash, session, params[:id], params[:options])\n end\n end\n rescue\n errors << $ERROR_INFO\n end\n errors\n end", "def load_library(file_path)\n emoji_sheet = YAML.load_file(file_path)\n japanese_meaning = {}\n western_to_japanese = {}\n emoji_sheet.each do |meaning, emojis|\n japanese_meaning[emojis.last] = meaning\n western_to_japanese[emojis.first] = emojis.last\n end\n hash = {\"get_emoticon\" => western_to_japanese, \"get_meaning\" => japanese_meaning}\nend", "def parse_file\n #needs begin rescue exception handling \n \tbegin \n \t\traise FileNotFoundException.new(\"File not Found\") unless File.exists?(@file_path)\n\t\n \t\tFile.open(@file_path).slice_before(@delimiter).each do |chunk|\n \t\t\tchunk.reject! {|item| item =~ @delimiter }\n \t\ttitle = chunk.shift\n \t\tif @title_hash.has_key?(title)\n \t\t\t@title_hash[title] = @title_hash[title] << chunk \n \t\telse\n \t\t p chunk\n \t\t\t@title_hash[title] = chunk\n \t\tend \t\t\n \t\tend\n \t\t\n \trescue FileNotFoundException => e\n \t\tp e.message\n \tend\n\t\n end", "def load_json(file)\n type = File.basename(file, File.extname(file)).to_sym\n JSON.parse(File.read(file)).each do |allocation, settings|\n next if allocation == \"_\"\n\n settings.reject! { |k, _| k.start_with?(\"_\") }\n host = settings.delete(\"host\")\n host = intern_string(host) if host\n options = if settings.empty?\n EMPTY_HASH\n else\n settings.map { |k, v| [k.to_sym, v.is_a?(String) ? intern_string(v) : v] }.to_h.freeze\n end\n define(type, allocation, host, options)\n end\n end", "def load_file(filename); end", "def load_file(filename); end", "def load(filename)\n end", "def import output_buffer, key, import_file\n\n output_buffer.sub(/\\/\\* @import [\"']#{key}[\"']; \\*\\//, \"/* Imports #{key} */ \\n\\n\" + File.read(import_file.path()) + \"\\n\")\n end", "def load\n if File.exist?(@file_path)\n\n @_cache = JSON File.open(@file_path, &:read).strip\n else\n $stderr.puts \"#{@file_path} does not exist\"\n end\n end", "def store\n @store ||= JapaneseNames::Util::Kernel.deep_freeze(\n File.open(filepath, 'r:utf-8').each_with_object({}) do |line, hash|\n ary = line.chop.split('|')\n hash[ary[0]] ||= []\n hash[ary[0]] << ary\n end\n )\n end", "def load\n sleeper = 0.0\n while File.exist? lock_file\n sleeper += 0.1 if sleeper <= 10.0\n sleep(sleeper.to_i)\n end\n # :symbolize_names does not play nicely with :create_additions\n tmp = JSON.parse(File.read(path),\n {:symbolize_names=>false, :create_additions=>true})\n @data = {}\n tmp.each_pair{ |k,v| self[k] = v }\n end", "def load(filename)\n\t\tend", "def read\n file = File.read(@filename)\n JSON.parse(file)\n end", "def get_data_from_json_file(filename)\n file_to_parse = File.read(filename)\n data_hash = JSON.parse(file_to_parse)\n return data_hash\nend", "def getFileContent(file_path)\n file = File.read(file_path)\n data_hash = JSON.parse(file)\n return data_hash\nend", "def load_file(file); end", "def run (hdin)\n i = 0;\n dups = 0;\n puts \"Reading from #{hdin.path}\";\n\n # Opens temporary loadfile. Overwrites existing file.\n @loadfiles.values.each do |hdout|\n hdout.open('w');\n end\n\n # Open infile and process line.\n hdin.open('r').file.each_line do |line|\n i += 1;\n\n # Skip stuff that doesn't look like json.\n if !line.start_with?('{') then\n STDERR.puts \"Skipping line: #{line}\";\n next;\n # For testing purposes.\n # elsif i > 2000 then\n # puts \"ok we are done here\";\n # break;\n elsif i % 1000 == 0 then\n puts \"#{i} ...\";\n end\n\n # gd_id is the id used as primary key in hathi_gd\n # and foreign key in all other tables, connecting the snowflake.\n gd_id = nil;\n item_id = nil;\n line_hash = JSON.parse(line);\n\n # The file where the data originally came from, not the file currently being read.\n infile = line_hash['infile'];\n file_id = get_infile_id(infile);\n # We don't want to include lineno or mongo_id in digest, so we delete them from the hash.\n lineno = line_hash.delete('lineno');\n mongo_id = line_hash.delete('mongo_id');\n # hashsum goes in hathi_gd to make sure we don't put total dups in there.\n hashsum = @sha_digester.hexdigest(line_hash.to_json);\n\n # Not all records have a record id.\n rec_id = 'N/A';\n if !line_hash['record_id'].nil? then\n rec_id = line_hash['record_id'].first.values.first;\n\n if rec_id.length > @max_record_id_len then\n rec_id = rec_id[0..(@max_record_id_len-1)];\n end\n\n\n end\n\n if !line_hash['item_id'].nil? then\n if line_hash['item_id'].first.class == {}.class then\n item_id = line_hash['item_id'].first.values.first;\n if item_id.size > 50 then\n # Make sure we fit in the column.\n item_id = item_id[0..49];\n end\n end\n end\n\n # Get a gd_id from mysql.\n # Use it as primary key in hathi_gd.\n # Use it in all the tables (except hathi_str) as foreign key.\n begin\n @hathi_gd_insert_q.execute(1, file_id, lineno, mongo_id, hashsum, rec_id, item_id);\n @last_id_q.query() do |row|\n gd_id = row[:id];\n end\n rescue Java::ComMysqlJdbcExceptionsJdbc4::MySQLIntegrityConstraintViolationException => e\n if (e.to_s =~ /Duplicate entry.+for key 'hashsum'/) == 0 then\n dups += 1;\n next;\n else\n puts e;\n puts line;\n end\n end\n # If we got a gd_id, proceed to insert the rest.\n insert_line(line_hash, gd_id);\n end\n hdin.close();\n\n # When all the lines in the file have been read and the loadfiles are done,\n # use the loadfiles for their intended purpose.\n @loadfiles.keys.each do |suffix|\n loadfile = @loadfiles[suffix];\n loadfile.close();\n sql = \"LOAD DATA LOCAL INFILE ? REPLACE INTO TABLE hathi_#{suffix} (gd_id, str_id, marc_field)\";\n puts sql;\n query = @conn.prepare(sql);\n query.execute(loadfile.path);\n # loadfile.delete();\n end\n\n puts @bench.prettyprint();\n puts \"#{dups} dups\";\nend", "def load; end", "def load; end", "def load; end", "def load(file_path); end", "def load(file_path); end", "def get_hash(name)\n file_name = File.join(@db_dir, name + '.json')\n return ::Hash.new unless File.exist?(file_name)\n\n begin\n json = File.read(file_name)\n rescue => e\n PEROBS.log.fatal \"Cannot read hash file '#{file_name}': #{e.message}\"\n end\n JSON.parse(json, :create_additions => true)\n end", "def parse_kanjidic lines\n line_number=1\n # get id values from the tables for the various attributes such as kunyomi, onyomi etc\n # to be used in the join tables \n readings_to_import= {}\n @lookup_attributes.each do |column|\n #stores readings in a hash of arrays with the key being\n #the attribute name e.g. :nanori, :kunyomi, etc\n readings_to_import[column]=[]\n end \n\n\n #create empty arrays to store index values\n indexes_to_import= [] #2D array of [[dictionary_id, kanji_id, index_value],...]\n\n lines.each do |line|\n unless line_number == 1\n kanji = get_element(:kanji,line)\n kanji_id = @kanji_lookup[kanji]\n #for each of nanori, onyomi, meanings, pinyin etc\n @lookup_attributes.each do |column| \n #get each of the multiple value attributes and append them to an array \n #to import at the end\n klass = eval(column.to_s.capitalize)\n relation_klass = eval(column.to_s.capitalize.pluralize+\"Kanji\")\n lookup = \"@#{column}_lookup\"\n #puts lookup\n lookup = eval(lookup)\n\n values = get_element(column, line)\n values.each do |value|\n #e.g. equivalent to o=Onyomi.find_by_onyomi onyomi\n relation_id = lookup[value]\n # e.g. equivalent to array << OnyomisKanji.new(:kanji_id=>id,:onyomi_id =>o.id)\n readings_to_import[column] << [kanji_id ,relation_id]\n end\n end \n\n #for the indexes we have a KanjiIndex table an Dictionaries table\n #and a KanjiIndex has a dictionary_id column\n @index_names.each do |index_name|\n indexes_to_import += get_dictionary_index(index_name, line)\n end\n\n end\n line_number +=1\n end\n return readings_to_import, indexes_to_import\n end", "def import_file! file\n # if given a file name, try opening it\n if file.instance_of? String\n _file = File.open file\n elsif file.instance_of? File\n _file = file\n else\n raise \"type not recognized: #{file.class.name}\"\n end\n\n puts \"- Iterating over keys in #{_file.inspect}\" if @verbose\n \n # iterate over keys\n YAML::load(_file).each do |env, env_hash|\n env_hash.each do |app, app_hash|\n app_hash.each do |namespace, namespace_hash|\n namespace_hash.each do |identifier, value|\n k = \"#{namespace}:#{identifier}\"\n set! k, value, app, env\n end\n end\n end\n end\n end", "def import(file)\n spreadsheet = ModelCommon.open_spreadsheet(file)\n return '<p class = \"alert alert-error\">Try to do the following instructions:<br/>\n 1. Please save as the file to excel format.<br/>\n 2. Make sure MOAS data in the first sheet.<br/>\n 3. Header is in the first row.</p>' if spreadsheet.nil?\n\n header = downcase_array_key spreadsheet.row(1)\n\n # verify header, raise error if not map\n no_failed_hearders = MOASHeader.verify_header(header, @language)\n\n return ('<p class = \"alert alert-error\">Below is the missing header titles list. Please update header title(s) of the excel file || contact your administrator<br/>' << no_failed_hearders.to_s << '</p>') if no_failed_hearders != true\n return ('<p class = \"alert alert-error\">No data in excel file. Please re-check!</p>') if spreadsheet.last_row <= 1\n\n # begin transaction\n begin\n connection = Connection.new\n connection.open_connection_in_config\n connection.con.autocommit false\n\n # 1. DELETE ALL RECORDS\n connection.execute_sql_statement \"delete from #{@table}\"\n pstmt = connection.con.prepare(\"insert into #{@table}(golivedate,appstatus,sku,shorttitle,longtitle,gender,agefrommonths,agetomonths,skill,curriculum,longdesc,platformcompatibility,specialmsg,teaches,licenselegal,licnonlic,license,language,pricetier,category,us,ca,uk,ie,au,row,fr_fr,fr_ca,fr_row) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)\")\n (2..spreadsheet.last_row).each do |i|\n row = Hash[[header, spreadsheet.row(i)].transpose]\n\n # 2. INSERT DATA TO DATABASE\n insert_data pstmt, row\n end\n\n # 3. UPDATE DATA FOR LOCALE\n update_locale connection\n connection.con.commit # commit transaction\n\n return '<p class = \"alert alert-success\">MOAS file is imported successfully!</p>'\n rescue => e\n connection.con.rollback # rollback transaction\n return '<p class = \"alert alert-error\">PLEASE SELECT CORRECT TABLE. <br/>' << e.message << '</p>'\n ensure\n connection.close_connection if connection\n end # end begin transaction\n end", "def import\n#song_by_filename\n files.each{|f| Song.new_by_filename(f)}\n\nend", "def parse_klass_json(json_file_path)\n json_string = IO.read(json_file_path)\n klass_data = ActiveSupport::JSON.decode(json_string)\n season= klass_data['season']\n year = klass_data['year']\n formatted_semester = Klass.semester_code_from_s(\"#{season} #{year}\")\n klass_data['departments'].each do |dept_abbr, klasses_for_dept|\n import_department(dept_abbr, klasses_for_dept, formatted_semester)\n end\nend", "def read_classes\n\n data = File.read(PLAYER_CLASSES)\n JSON.parse(data).map do |player_class|\n Character.new(\n player_class['name'],\n player_class['short_description'],\n player_class['stats']\n )\n end\n\nend", "def call\n log.info 'loading ..'\n validate_keys_are_correct\n\n # maintain key ordering\n json.keys.each { |entity| db.tables[entity] ||= {} } # JIT initialization\n\n # load in this order to validate playlists (users and songs need to be loaded first)\n EXPECTED_MODELS.each { |entity| insert_values_into_db_cache(entity, json[entity]) }\n end", "def readUnihanDatabase(filename, char_hash)\n File.open(filename) do |f|\n while (line = f.gets)\n next if line.match(/^#/) # line commented out?\n a = line.strip.split(\"\\t\")\n char_hash[a[0]] = Hash.new() unless char_hash.has_key? a[0]\n char_hash[a[0]][a[1].to_sym] = a[2]\n end\n end\nend", "def import(filename=\"import/study_units.csv\")\n require 'csv'\n CSV.foreach(filename, headers: true) do |row|\n @row = row.to_hash\n @study_unit = StudyUnit.where(study_id: id, name: @row[\"study_unit.name\"]).first ||\n StudyUnit.create(study_id: id, name: @row[\"study_unit.name\"])\n @logical_product = LogicalProduct.where(study_unit_id: @study_unit.id, name: @row[\"logical_product.name\"]).first ||\n LogicalProduct.create(study_unit_id: @study_unit.id, name: @row[\"logical_product.name\"])\n @concept = Concept.find_or_create_by_name(@row[\"concept.name\"])\n @variable_group = VariableGroup.where(logical_product_id: @logical_product.id, concept_id: @concept.id,\n name: @row[\"variable_group.name\"]).first ||\n VariableGroup.create(logical_product_id: @logical_product.id, concept_id: @concept.id,\n name: @row[\"variable_group.name\"], label: @row[\"variable_group.label\"])\n end\n end", "def load_entries\n @lines = IO.readlines(@filename)\n @lines.each_with_index do |line,idx|\n if entry_klass.is_entry?(line) then\n entry = entry_klass.from_line(line)\n v = { 'entry' => entry, 'line_index' => idx }\n @entries[entry.key] = v\n end\n end\n end", "def import(name)\n unless name\n sessions = Dir.glob(File.join(@basedir, '*.json'))\n if sessions.count == 0\n @output.puts \"There is no recorded session locally.\"\n @output.puts \"Do you want to play a remote recording?\"\n name = ask \"url: \"\n else\n @output.puts \"What session do you want to load?\"\n name = ask \"(input a number or an url if you want to play a remote recording)\",\n aslist: true,\n choices: sessions.map { |f| File.basename(f, '.json') }\n end\n end\n if /^https?:\\/\\//.match name\n infile = open(name) { |f| f.read }\n @name = File.basename(name, '.json')\n else\n infile = IO.read(File.join(@basedir, \"#{name}.json\"))\n @name = name\n end\n data = JSON.parse(infile)\n @title = data['title']\n @config = Shellplay::Config.new({\n basedir: @basedir,\n basefile: File.join(@basedir, @basefile),\n prompt: data['prompt'],\n timeformat: data['timeformat'] }, input, output)\n data['sequence'].each do |screenhash|\n add_screen(screenhash)\n end\n end", "def load(name); end", "def make_table(dex,name) ## class syntax will be placed in jruby directory for pasting back here at a later time\n keydex = []\n dex.each do |di|\n keydex << di.to_s.split(\",\")[0].to_s\n end \n str = \"\"\n str << \"class \" + name.to_s.capitalize + \"_Data\\n\"\n str << \" def initialize()\\n\"\n str << \" @keydex = \" + keydex.to_s + \"\\n\"\n str << \" @datadex = \" + dex.to_s + \"\\n\"\n str << \" end\\n\"\n str << \" def get(key)\\n\"\n str << \" return @datadex[@keydex.index(key)]\\n\"\n str << \" end\\n\"\n str << \"end\\n\"\n file = File.open(name.to_s.downcase + \"_datadex.rb\",\"w\")\n file.write(str.to_s)\n file.close\n return [Dir.getwd.to_s + \"/\" + name.to_s.downcase + \"_datadex.rb\",dex.length.to_i]\n end", "def load_file(filename)\n file = File.open(filename, \"r\")\n grid = JSON.parse(file.read)\n file.close\n return Game.new(grid.length, grid[0].length, grid)\nend", "def extract_and_store_haml_javascript(file_and_depth)\n tmp_javascript_files = []\n #hash of replaced ruby variables and new values\n replacement_hash = {}\n\n indent_depth = Regexp.new(/((\\s?)+)\\S/i)\n #need to caputre the number of \\s in the front of :javascript and use it determine if i reject lines\n file_and_depth.each do |ele|\n file = ele[:file]\n depth_of_tag = ele[:depth]\n\n puts \"Processing #{file} for JSLint validation\"\n\n tmp_file_handle = \"tmp/jslint/#{file}.js\"\n tmp_javascript_files << tmp_file_handle\n\n tmp_file = create_tmp_javascript_file(file, tmp_file_handle)\n\n lines = File.new(tmp_file,\"r\")\n out = File.new(tmp_file_handle, \"w\")\n\n while (line = lines.gets)\n #Drops commented lines\n next if line =~ /\\A\\s+\\//i\n\n #drops blank lines\n next if line.strip.empty?\n\n #replace ruby injections\n line, replacement_hash = find_and_replace_ruby_injection(line, replacement_hash)\n\n #now check to see how many indents. If less then the number :javascript was endnted drop them\n #we have the indent for the :javascript\n #if indent is <= depth_of_tag drop the rest of the file\n #FIXME Known bug. Will only eval first :javascript block in HAML file\n break if line.match(indent_depth)[1].size < depth_of_tag + 2\n\n out.puts line\n end\n\n out.close\n end\n\n return tmp_javascript_files\n end", "def load!\n JSON.load(File.read(@name))\n rescue JSON::ParserError => e\n raise LogFile::LoadError, e.message\n end", "def parse_scenario_file(scenario_id)\n JSON.parse(File.read(File.join('config', 'scenarios', scenario_id + '.json')))\nend", "def diphot_metadata_to_h\n File.open(@qualified_filename, 'r') do |fd|\n diff = fd.readline.chomp\n reference = fd.readline.chomp\n @obj_metadata = { 'diff' => diff, 'reference' => reference }\n end\n end", "def import\n @scenario_xml = parse(src)\n \n DB.transaction do\n @scenario = Scenario.create_from_xml(scenario_xml)\n end\n \n return scenario[:id]\n end", "def import_from(file)\n raise 'File not found' unless File.exist?(file)\n CSV.foreach(file, headers: true) do |row|\n extract_streaks_data(row)\n end\n # Handle the parsed data\n [@habits, @entries]\n end", "def import(filename)\n definitions << self.class.from_filename(filename, scoped_options)\n end", "def parse_json(filename)\n\tfile = File.read(filename)\n\tbegin\n \t\tdata_hash = JSON.parse(file)\n\trescue JSON::ParserError\n\t\tfile = nil\n\tend\n\tdata_hash\n end", "def load(path); end", "def load_dict(filename)\n if File.exist?(filename)\n f = File.read(filename)\n @hash_dict = JSON.parse(f)\n else\n puts('read error')\n end\n end", "def load_script_from_index\n lines = File.readlines(index_filename)\n path = ENV['ALTERNATIVE_PATH'] || '.'\n lines.each do |filename|\n require(File.join(path, filename.chomp))\n end\n end", "def readTable(path)\n return JSON.parse(File.read(path).rstrip)\nend", "def get_entries(filename)\n lines = File.readlines(filename)\n hsh = lines.select { |s| s !~ /^#/ && s.strip != '' }.map do |lin|\n parts = lin.split('|')\n raise \"Bad line #{lin}\" unless parts.size == 5\n {\n raw: lin,\n rank: parts[0],\n word: parts[1],\n type: parts[2],\n translation: parts[3],\n sample: parts[4].strip\n }\n end\n hsh\n end", "def load_query_response\n load_file('sample_query_response.json')\nend", "def import\n files.each{|file| Song.new_by_filename(file)}\n end", "def import\n files.each {|filename| Song.new_by_filename}\n end", "def read_fixture_as_hash(name)\n JSON.parse(read_fixture(name))\nend", "def load_library(file_path)\n emoticons_hash = YAML.load_file(file_path)\n emoticons_hash.each_with_object({}){|(outer_key,outer_value), new_hash|\n new_hash[outer_key] = {english: outer_value[0], japanese: outer_value[1]}\n }\nend", "def script_load(script); end", "def import_venues_from_file(country_code,file_name)\n f = File.open(file_name, 'r') \n text = f.read \n lines = text.split(/$/) \n lines.each{|line|\n begin\n tokens = line.split(\"|\")\n code = tokens[0].strip\n venue = Venue.find_by_code(code)\n venue ||= Venue.new\n venue.code=code\n venue.name=tokens[1].strip\n venue.affiliate_url_1=tokens[12].strip\n venue.affiliate_url_2=tokens[13].strip\n venue.logo_url=tokens[14].strip\n venue.city=tokens[35].strip\n venue.state=tokens[36].strip\n venue.address=tokens[37].strip\n venue.zipcode=tokens[38].strip\n venue.url=\"http://www.ticketmaster.com/json/search/event?vid=#{code}\"\n venue.source=\"ticketmaster\"\n venue.save\n puts \"#{venue.code} #{venue.name} in #{venue.city}, #{venue.state}\"\n rescue\n end\n }\n f.close\n end", "def parsed\n JSON.parse(File.read(\"#{Rails.root}/public/#{@file}\"))\n end", "def populate\n file = File.read(json_file)\n storage = JSON.parse(file, :symbolize_names => true)\n\n @hashes = storage[:hashes]\n convert if @hashes.is_a? Array\n\n @hashes\n end", "def decodeFile\n encodedText = handleFileInput\n data = JSON.load(File.read(\"frequencyTable.json\"))\n testRoot = genHuffmanTree(data)\n testTable = Hash.new\n createCodeTable(testRoot, \"\", testTable)\n puts \"\\nDecoded File: #{convertCodeToString(encodedText, testTable)}\\n\\n\"\nend", "def import\n files.each{|f| Song.new_by_filename(f)}\n end" ]
[ "0.5931426", "0.5915452", "0.58235085", "0.57677865", "0.57677865", "0.57223034", "0.56863755", "0.5564768", "0.5520754", "0.54119825", "0.5411914", "0.53963196", "0.53963196", "0.53963196", "0.53963196", "0.5351877", "0.52670175", "0.5264046", "0.52624375", "0.5262029", "0.5238319", "0.5223353", "0.5168922", "0.5155632", "0.51484704", "0.5145678", "0.5140816", "0.5140411", "0.5130021", "0.5113928", "0.50924873", "0.50883245", "0.5085274", "0.5085274", "0.5083884", "0.5082164", "0.5080215", "0.5066806", "0.5065282", "0.5063775", "0.5055803", "0.5055312", "0.50507504", "0.50368226", "0.50368226", "0.5032516", "0.5030477", "0.5027359", "0.5016421", "0.4996516", "0.49963447", "0.49905416", "0.49901134", "0.4986638", "0.49764267", "0.49693272", "0.49676317", "0.49676317", "0.49676317", "0.4951777", "0.4951777", "0.49471125", "0.49413496", "0.494029", "0.49290597", "0.49245545", "0.49225077", "0.4897819", "0.48952657", "0.48934627", "0.48923406", "0.48921385", "0.4891444", "0.4882154", "0.48817676", "0.48796055", "0.48746535", "0.4866673", "0.48569304", "0.48534322", "0.48430222", "0.4841738", "0.48408338", "0.48399293", "0.4839875", "0.48388222", "0.4838676", "0.48357573", "0.48354548", "0.48352456", "0.48265147", "0.48220405", "0.48215413", "0.48174745", "0.4816303", "0.48150304", "0.4813799", "0.48126802", "0.48108485", "0.48093578" ]
0.5917401
1
This procedure increments the score of the player
def update_score() @score += GAME_PRESET["score_increment"] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_to_player_score (player)\r\n\tplayer.player_wins += 1\r\n\t@total_number_of_plays += 1\r\n\tend", "def score(player)\n\t$running = false\n\tplayer.score += 1\n\t$gui.show_scored(player.name)\n\t$gui.show_info()\n\t$gui.update_score($p1.score, $p2.score)\nend", "def increment_win_score\n PlayerModelContracts.invariant(self)\n @score = @score + 1\n end", "def update_score\n if @round_won\n @player.increment_rounds_won\n else\n @player.increment_rounds_lost\n end\n end", "def add_score\n transaction do\n self.player.points = self.player.points + 1\n if self.player.save\n self.player.team.score = self.player.team.score + 1\n self.player.team.save\n end\n self.player.inc_score_stats\n end\n end", "def update_score(score, board)\n if detect_winner(board) == 'Player'\n score[0] += 1\n else\n score[1] += 1\n end\nend", "def win\n @score += 1\n end", "def win\n @score += 1\n end", "def win_pts\n self.score += 1\n end", "def score_player(player)\n score = 0\n player.hand.each do |card|\n score += card.value\n end\n player.update_score(score)\n end", "def gain_points\n @score += 1\n end", "def give_point\n if@current_player == @player1\n @p1_score += 1\n else\n @p2_score += 1\n end\nend", "def player_score(score)\n @grand_total += (score)\n end", "def updateScore(score, result)\n\tif result == \"Player 1 wins this round!\"\n\t\tscore[0] += 1\n\telsif result == \"Player 2 wins this round!\"\n\t\tscore[1] += 1\n\telsif result == \"Tie!\"\n\t\tscore[2] += 1\n\tend\n\treturn score\nend", "def update_score!(points)\n increment!(:score, points)\n end", "def gain_point\n @score += 1\n end", "def updateScore(score, result)\n\tif result == \"P1 wins!\"\n\t\tscore[\"Player 1\"] += 1\n\telsif result == \"P2 wins!\"\n\t\tscore[\"Player 2\"] += 1\n\tend\n\tputs result\n\tputs \"Current score:\\n Player 1: \" + score[\"Player 1\"].to_s + \" Player 2: \" + score[\"Player 2\"].to_s + \"\\n\\n\"\n\treturn score\nend", "def score(player)\n @players[player][:score] += 1\nend", "def update_score()\n\t\t# Uses ELO rating to calculate new rank for both users. Ref: https://metinmediamath.wordpress.com/2013/11/27/how-to-calculate-the-elo-rating-including-example/\n\t\t# Updates score by adding game scores to players score\n\tend", "def AddPoints(score)\n\tscore = score + 100\nend", "def gain_a_point\n\n self.score += 1\n\n end", "def player_win\n @player_win += 1\n end", "def incement_score\r\n\t\t \t @score += 2000\r\n\t\t end", "def update_score\n \t\tuser.score += 10\n user.save\n\tend", "def next_score(player)\n if player == 1\n get_score(@player1,@player2)\n else\n get_score(@player2,@player1)\n end\n\n end", "def increase_scn_score\n count = voteable.user.scn_score\n count = count + 1\n voteable.user.update_attributes(scn_score: count)\n end", "def score\n puts \"---#{player.name.upcase}: #{player.score} -- #{dealer.name.upcase}: #{dealer.score}---\"\n end", "def increment_player_stat\n @team.increment_player_stat(@stat_type, @player)\n\n redirect_to team_path(@team)\n end", "def score\n puts \"\\n---PLAYER 1: #{self.players_score} -- DEALER: #{self.dealers_score}---\"\n end", "def play\n @players.each { |player| player.score = 0 }\n\t \n\tloop do\n\t @board.clear\n @cur_player = @players[0]\n\t @rounds += 1\n\t\t\n\t print \"\\n******************* Connect Four ********************\"\n\t puts \"\\n#{@players[0].name} will play with #{@players[0].color}; #{@players[1].name} will play with #{@players[1].color}\\n\\n\"\n\t @board.print_board \n\t \n\t loop do\n position = prompt_movement\n\t @board.set_disk(position, @cur_player.color)\n\t\t@board.print_board \n\t\t \n\t\tresult = \n\t\t if @board.is_winner?(@cur_player.color)\n\t\t @cur_player.score += 1\n\t\t puts \"\\n#{@cur_player.name} wins!!\"\n\t\t\ttrue\n\t\t elsif @board.is_full?\n\t\t puts \"\\nThe game ended in a tie!\"\n\t\t\ttrue\n\t end\n\t\t \n\t\tbreak if result\n\t\tswap_players\n end\n\t\t\n\t break if prompt_quit\n\tend\n\t \n\tprint_final_score\n end", "def add_point\n @score += 1\n end", "def update_counters\n player.plays_count.increment\n opponent.plays_count.increment\n true\n end", "def update_total_score\n @total_score += @score\n end", "def inc_score(table, user)\n ZSet.inc_score(table, user)\n end", "def increment_win\n self.games_won += 1 \n increment_games_played\n end", "def play\n\t @players.each { |player| player.score = 0 }\n\t \n\t loop do\n\t @board.clear\n\t\t@cur_player = @players[0]\n\t\t@rounds += 1\n\t\t\n\t\tprint \"\\n******************* Tic-Tac-Toe ********************\"\n\t puts \"\\n#{@players[0].name} will play with #{@players[0].mark}; #{@players[1].name} will play with #{@players[1].mark}\\n\\n\"\n\t\t@board.print_board \n\t \n\t\tloop do\n position = prompt_movement\n\t @board.set_mark(position, @cur_player.mark)\n\t\t @board.print_board \n\t\t \n\t\t result = \n\t\t if @board.is_winner?(@cur_player.mark)\n\t\t @cur_player.score += 1\n\t\t puts \"\\n#{@cur_player.name} wins!!\"\n\t\t\t true\n\t\t elsif @board.is_full?\n\t\t puts \"\\nThe game ended in a tie!\"\n\t\t\t true\n\t\t\tend\n\t\t \n\t\t break if result\n\t\t swap_players\n\t\tend\n\t\t\n\t\tbreak if prompt_quit\n\t end\n\t \n\t print_final_score\n\tend", "def increment_games_played\n self.games_played += 1\n end", "def updateGamesPlayed\n @gamesPlayed += 1\n end", "def player_score()\n\t\tparams.each do |name, guess| #recieves guess from form on guess.slim\n\t\t\tsession[:player].each do |z|\n\t\t\t\tif z.name == name\n\t\t\t\t\tz.guess = guess.to_i\n\t\t\t\t\tz.round_score = (z.guess - session[:movie][session[:round_count]].ratings['critics_score'].to_i).abs\n\t\t\t\t\tz.total_score += (z.guess - session[:movie][session[:round_count]].ratings['critics_score'].to_i).abs\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "def formulate_score()\n @player_score = @player_score.sort!().reverse!().join().to_i()\n p \"#{@players[0].get_name}'s score is #{@player_score}\"\n check_score()\n end", "def update_score_by(value)\n @score.increment_by(value)\n end", "def givepoints \n x = comparison(@player_choice, @opponent_choice)\n if x == -1\n @player_score += 1\n elsif x == 0\n @player_score += 0\n @opponent_score += 0\n elsif x == 1\n @opponent_score += 1\n end \n return x\n end", "def rescore(delta)\n self.score += delta\n self.save!\n end", "def inc_score(table, user)\n raise NotImplementedError, \"Implement this method in a child class\"\n end", "def start\n 9.times do |index|\n @score = @score + @frames[index][0].to_i + @frames[index][1].to_i\n @scores[index] = @score\n @score\n end\n @score = @score + @frames[9][0].to_i + @frames[9][1].to_i + @frames[9][2].to_i\n @scores[9] = @score\n end", "def handle\n self.status\n output << \"Your final score is => #{player.score}\\n\"\n end", "def formulate_score()\n @player_score = @player_score.sort!().reverse!().join().to_i()\n p \"#{@players_joined[0]}'s score is #{@player_score}\"\n check_score()\n end", "def call_score\n if @player1.points == @player2.points\n tie_score\n elsif advantage?\n advantage \n else \n \"#{current_server.score} #{current_server.opponent.score}\"\n end\n end", "def increment_player_idx\n @current_player_idx = (@current_player_idx + 1) % 2\n end", "def advance_player!(player)\n<<<<<<< HEAD\n # lanzo el dado\n if not_advance_more_than_lenght?(player)\n @race_progress[player] += @die.roll\n if somebody_is_winner?(player)\n @finished = true \n end\n end\n end", "def updatePlayer(player)\n puts \"\\n\"\n print \"#{ frase } | \"\n print \" #{@@listPlayer[player].name }\".colorize(:green)\n print \" you roll : \"\n valuesOfRoll = @@listPlayer[player].arrayV\n p valuesOfRoll\n arrayValuesPoints = @@scoreTable.evaluate(@@listPlayer, player)\n scoreRolling = arrayValuesPoints.pop\n print \"You got : \"\n print \"#{scoreRolling}\".colorize(:green) if scoreRolling > 0\n print \"#{scoreRolling}\".colorize(:red) if scoreRolling == 0\n print \" points \"\n gets.chomp\n @@listPlayer[ player ].score += scoreRolling\n dices = arrayValuesPoints.length\n @@listPlayer[ player ].arrayV = []\n dices = 0 if scoreRolling == 0\n @@listPlayer[ player ].score = 0 if @@listPlayer[ player ].score < 300 and dices == 0\n return dices\n end", "def earn_point(player)\n player ==1 ? @player_2_wins += 1 : @player_1_wins +=1\nend", "def score(player)\n @score[player]\n end", "def score\n \n case @points\n when 0 \n @player_score[@points] = 'Love'\n return @player_score[@points]\n when 1 \n @player_score[@points] = 'Fifteen'\n return @player_score[@points]\n when 2 \n @player_score[@points] = 'Thirty'\n return @player_score[@points]\n when 3 \n @player_score[@points] = 'Forty'\n return @player_score[@points]\n else \n return @points \n end\n end", "def increment_scores_index\n @scores_idx +=1 if valid_scores_idx?(@scores_idx + 1)\n self\n end", "def update_score!\n update(score: game.rounds.count { |g| g.winner == self })\n game.update(winner: self) if score >= game.max_points\n end", "def update_score(time)\n case time\n when 0..2.5\n $player_score += 3\n when 2.6..4.5\n $player_score += 2\n when 4.6..7\n $player_score += 1\n end\nend", "def player_won\n\t\tputs \"\\nCongratulations! your have won!\"\n\t\tself.player_record[\"Wins\"] += 1\n\tend", "def set_games_won()\n @score_count.set_games_won()\n end", "def score_player(player,score)\n\t\tputs \"|#{player[0]}: #{score[0]} |_SCORE_| #{player[1]}: #{score[1]}|\\n\\n\".colorize(:red) \n\tend", "def play(iterations)\n last_score = 0\n current_player = 0\n iterations.times do\n current_player += 1\n current_player = 1 if current_player > num_players\n scoreboard[current_player] += emitter.next\n end\n scoreboard\n end", "def score_roll\n @total_score += @roll + @next_roll\n @current_roll += 2\n end", "def initialize_score(player)\n\n player.score = 3\n\nend", "def increment_game\n change_turn\n @turn += 1 if @player_to_move == \"w\"\n end", "def adjust_score(team, points)\n team.inject(self) do |s, player|\n s.update_in(:scores, player) {|n| n + points }\n end\n end", "def update_score(accumulated_score)\n @net_score += accumulated_score\n puts \"Total turn score: #{accumulated_score}, net score: #{@net_score}\"\n @net_score\n end", "def get_score()\r\n return @player.score()\r\n end", "def rescore(delta)\n self.score += delta\n self.score = self.score.round(2)\n self.save!\n end", "def play \n game_loop\n if @player1.score >= @num_of_games\n puts \"#{@player1.name} is the WINNER!\"\n elsif @player2.score >= @num_of_games\n puts \"#{@player2.name} is the WINNER!\"\n end\n end", "def rescore(delta)\n self.score += delta\n self.score = self.score.round(2)\n self.save! \n end", "def score_game\n self.score = frames.reduce(0) { |sum, frame| sum + score_frame(frame) } \n end", "def winner?(score)\n return false unless @players.value?(score)\n\n @event.respond('And that\\'s the game!')\n sleep 3\n winner = @players.key(score)\n @event.respond(\"#{winner.name} wins!\")\n @@trivia_db.prepare('INSERT OR IGNORE INTO score(id) VALUES(?)').execute(winner.id) # Add a user if they don't exist\n @@trivia_db.prepare('UPDATE score SET rank = rank + 1 WHERE id = ?').execute(winner.id) # Add 1 to score\n open_channel\n true\n end", "def score_player\n raise 'Method score_player cannot be called directly. It must be overridden in a child class first.'\n end", "def increment_loss\n self.games_lost += 1\n increment_games_played\n end", "def addScore _score=0\n SQF.addScore @this, _score\n end", "def start_game\n player = 0\n\n until @winner == true\n say '--------------------'.light_blue\n player = 0 if player >= @score_table.total_players\n play(player, 5)\n player += 1\n end\n\n @score_table.display_winner\n\n display_all_scores\n end", "def accumulate_series_score(winner)\n if winner == 1\n return @player_1_score +=1\n elsif winner == 2\n return @player_2_score +=1\n end\n end", "def update_rank\n self.score = calculate_score\n self.save\n end", "def show_score\n puts\n @@score.each do |player, score|\n print \"- #{player.capitalize}: #{score} -\"\n end\n puts\n end", "def set_other_games_won()\n @score_count.set_other_games_won()\n end", "def reset_player_scores()\n @players.each do |player|\n player.score = 0\n player.save\n end\n end", "def keep_score(player, computer)\n if win?(player, computer)\n player_core += 1\n elsif win?(computer, player)\n computer_score += 1\n else\n nil\n end\nend", "def score_strike\n @total_score += 10 + @rolls[@current_roll + 1] + @rolls[@current_roll + 2]\n @current_roll += 1\n end", "def score_strike\n @total_score += 10 + @rolls[@current_roll + 1] + @rolls[@current_roll + 2]\n @current_roll += 1\n end", "def won_game(player)\n if player.advantage\n player.win = true\n player.games_won += 1\n won_set(player)\n reset_scores\n elsif player.points > 3 and player.opponent.points < 3\n player.win = true\n player.games_won += 1\n won_set(player)\n reset_scores\n end\n end", "def score\n end", "def score\n 2 * won + drawn + noresult\n end", "def score_strike\n @total_score += 10 + @next_roll + @rolls[@current_roll + 2]\n @current_roll += 1\n end", "def score\n populate_frames.inject(0) {|a,v| a+ v.frame_total}\n end", "def player1_score\n player_hand.inject(0){|sum,n| sum + n.value }\n end", "def execute_turn\n display_scores\n\n @players.each do |idx, player|\n dice_count = DICE_COUNT\n current_score = 0\n\n loop do\n @dice.roll(dice_count)\n dice_score = @dice.score\n current_score = (dice_score == 0)? 0: current_score + dice_score\n\n @dice.dump_values(\"Player #{idx} rolls \")\n puts \"Score in this round: #{current_score}\"\n puts \"Total score: #{player.total_points}\"\n\n non_scoring_dice = @dice.non_scoring_dice_count\n dice_count = (non_scoring_dice == 0)? DICE_COUNT: non_scoring_dice\n # Have modified the print to show the dice he can re-roll\n if current_score != 0\n puts \"You can roll #{dice_count} dice again, do you want to(y/n)?\"\n re_roll = gets.chomp\n end\n break if (current_score == 0) || re_roll == \"n\"\n end\n\n next if current_score == 0\n player.add_points(current_score)\n end\n end", "def inc_rater_score(add)\n if add || false\n fu = self._call_for_rater\n fu.score += add \n end\n #puts \"add: #{add}\"\n add\n end", "def games_played\n @games_played = @games_played += 1\n end", "def update_score!\n entries = leaderboards.to_a.map do |lb|\n lb.entrys.where(user: self).last\n end\n\n value = entries.map { |e| e.leaderboard.scored ? Score.value(e.rank) : 0 }.reduce(:+)\n\n update(score: value)\n\n value\n end", "def advance_player(player)\n @position[player] += @die.roll\n end", "def game_score(score)\n end", "def score_frame\n if strike?\n strike_frame\n elsif spare?\n spare_frame\n else\n regular_frame\n end\n\n @frame += 1\n end", "def set_score(num, socre)\n @game[num] = score\n end", "def assign_score; end", "def playRound(score)\n\tputs \"Player 1 enter your weapon: \"\n\tp1 = gets.chomp.downcase\n\tputs \"Player 2 enter your weapon: \"\n\tp2 = gets.chomp.downcase\n\tresult = determineWinner(p1, p2)\n\tupdateScore(score,result)\nend" ]
[ "0.8423483", "0.8392943", "0.81935835", "0.8093406", "0.7999613", "0.7763389", "0.76975703", "0.76975703", "0.7619253", "0.7559456", "0.7548223", "0.75233835", "0.75176954", "0.74955714", "0.7487081", "0.73984545", "0.73951244", "0.73274577", "0.73095053", "0.728738", "0.72810185", "0.71999764", "0.7188371", "0.71838176", "0.7177901", "0.70944136", "0.7073278", "0.7069167", "0.70577085", "0.70122075", "0.7010012", "0.6999739", "0.69930553", "0.6984944", "0.6983264", "0.6973527", "0.69581586", "0.6949832", "0.69339633", "0.6931212", "0.6925222", "0.6890604", "0.68764013", "0.6862307", "0.6850048", "0.68228596", "0.6820057", "0.68048376", "0.6789288", "0.6771998", "0.67698854", "0.67445713", "0.67428654", "0.67350477", "0.67321783", "0.6726401", "0.6722265", "0.6721728", "0.6700749", "0.6700107", "0.6673993", "0.666141", "0.6655482", "0.66454476", "0.66396767", "0.6636902", "0.6608119", "0.6607448", "0.65905595", "0.6567703", "0.6554619", "0.6549334", "0.65444106", "0.65308404", "0.65182245", "0.6517613", "0.65122867", "0.6511384", "0.6499255", "0.64893365", "0.6487109", "0.64851016", "0.64833313", "0.64833313", "0.6481392", "0.6470533", "0.647022", "0.64641005", "0.6456355", "0.6446867", "0.64422643", "0.6440867", "0.64337313", "0.6428272", "0.64267004", "0.64177257", "0.6409456", "0.6402664", "0.6402312", "0.639196" ]
0.8111573
3
Procedure to reduce the life of the player
def lose_life() @life -= 1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lose_life\n @life -= 1\n end", "def reduce_life\n if @lives > 0\n @lives -= 1\n end\n end", "def lose_life\n @lives -= 1\n end", "def lose_life\n @lives -= 1\n end", "def lose_life\n @lives -= 1\n end", "def lose_life\n @lives -= 1\n end", "def lose_life(player)\n player == 1 ? @player_1_lives -= 1 : @player_2_lives -= 1\nend", "def take_life\n @lives -= 1\n end", "def lose_life\n puts \"Sorry, that is the wrong answer!\"\n @current_player.life -= 1\n if @current_player.life == 0\n puts \"#{current_player.name} loses! Game Over!\"\n end\n end", "def remove_life \r\n @lives -= 1 # this is part of class and objects above\r\n end", "def deduct_life\n @lives -= 1\n end", "def lives_decriment\n\t\tlives_will_change!\n\t\tself.lives -= 1 \n\t\tself.hp = self.level+5\n\t\tself.save!\n\t\tif self.lives <=0 \n\t\t\t# restarts NPC's renders user-wizards unusable\n\t\t\tif self.user_id == 1\n\t\t\t\tself.default_values()\n\t\t\telse\n\t\t\t\tputs \"Game Over for #{self.name}!\"\n\t\t\t\tself.level = 0\n\t\t\tend\n\t\tend\n\tend", "def looses_life\n @lives -= 1\n end", "def essence_to_life\n if not r_pause\n if essence >= new_life\n @essence -= new_life\n @life += 1\n $hud.set_lives(life)\n $sm.play_sound(\"regain1\",1.0,1.0,false)\n @r_pause = true\n else\n $sm.play_sound(\"error\",0.5,1.0,false)\n @r_pause = true\n end\n end\n end", "def reduce_life\n if @life > 0 \n @life = @life - (1 * @starvation_rate)\n else\n @status = :dead\n end\n end", "def lose_life(player)\n @players[player][:lives] -= 1\nend", "def kill_player\r\n @enemies.each do |player|\r\n if (player.life_points <= 0)\r\n @enemies.delete(player)\r\n puts \"#{player.name} vient d'être éliminé !\"\r\n end\r\n end \r\n end", "def fly\n @health -= 10\n self\n end", "def kick(player_name)\n\t\n\t player_name.hp = player_name.hp - 20\n\n\t end", "def gets_damage(point)\n @life_points -= point\n if @life_points <= 0\n puts \"Player #{@name} has been died!\"\n end\n end", "def wrong \n @lives -= 1\n end", "def blam!\n self.health -= 10\n end", "def reduce_HP\n @points -= 10\n end", "def punch(player_name)\n\t # we change the life (hp) of our adversary, and we can because of the hp accessor ! \n\t player_name.hp = player_name.hp - 10\n\n\tend", "def wrong\n self.lives -= 1\n end", "def lose_energy\n @energy -= 1\n end", "def damaged\n @hp = @hp - 1\n end", "def reset_player args\n args.state.player.x = 0\n args.state.player.y = args.state.bridge_top\n args.state.player.dy = 0\n args.state.player.dx = 0\n args.state.enemy.hammers.clear # empties hammer collection\n args.state.enemy.hammer_queue.clear # empties hammer_queue\n args.state.game_over_at = args.state.tick_count # game_over_at set to current frame (or passage of time)\nend", "def reset_player args\n args.state.player.x = 0\n args.state.player.y = args.state.bridge_top\n args.state.player.dy = 0\n args.state.player.dx = 0\n args.state.enemy.hammers.clear # empties hammer collection\n args.state.enemy.hammer_queue.clear # empties hammer_queue\n args.state.game_over_at = args.state.tick_count # game_over_at set to current frame (or passage of time)\nend", "def hit\n @health -= 1\n end", "def hit\n @health -= 1\n end", "def do_battle\n @health_points = @health_points -= 1\n puts \"Battle! You lost a health point. You're down to #{ @health_points }.\"\n if @health_points <= 0\n @lives = @lives -= 1\n puts \"You lost a life! You now have #{ @lives } lives.\"\n if @lives <= 0\n puts \"You ran out of lives! Restarting game now.\"\n restart\n end #if-lives\n end #if health_points\n end", "def update_life(time)\n add_life(time*TimeFactor) if @team != :neutral\n end", "def walk\n @health -= 1\n return self\n end", "def lose_pts\n self.score -= 1\n end", "def lose_a_point\n\n self.score -= 1\n\n end", "def resign(game = ongoing_game)\n game.player(self).update(role: \"dead_player\")\n end", "def restart\n @lives == 5\n @gold_coins == 0\n @health_points == 10\n end", "def end_screen(player)\r\n puts \" ----------------------- \"\r\n puts \"\"\r\n puts \" -- La partie est finie --\"\r\n puts \"\"\r\n puts \" ----------------------- \"\r\n puts \"\"\r\n if player.life_points > 0\r\n puts \"Félicitations, Vous remportez la partie !\"\r\n puts \"\"\r\n puts \" ----------------------- \"\r\n else\r\n puts \"Dommage, Vous avez perdu la partie !\"\r\n puts \"\"\r\n puts \" ----------------------- \"\r\n end\r\nend", "def damage(ap)\n @health_points -= ap\n end", "def current_player_effect\n # Retire 1 au nombre de cartes a piocher du joueur en cours\n if @current_player.draw_card_count >= 1\n @current_player.draw_card_count -= 1\n end\n # Enleve une carte mixed de la main du joueur en cours\n @current_player.cards.delete_at(@current_player.cards.index(\"lock_down\"))\n end", "def end_game (player)\n if (player.life == 0)\n return false\n end\n return true\n end", "def tick\n lose_energy\n if @energy <= 0\n @world.roids.delete self\n end \n end", "def on_player_walk\n for actor in members\n if actor.slip_damage?\n actor.hp -= 1 if actor.hp > 1 # Poison damage\n $game_map.screen.start_flash(Color.new(255,0,0,64), 4)\n end\n if actor.auto_hp_recover and actor.hp > 0\n actor.hp += 1 # HP auto recovery\n end\n end\n end", "def die (board, player)\n\t\t@currentHealth = health\n\t\tif player.side == 1\n\t\t\tboard.p1Board.delete(self)\n\t\t\tboard.p1GY.push(self)\n\t\telsif player.side == 2\n\t\t\tboard.p2Board - [self]\n\t\t\tboard.p2GY.push(self)\n\t\tend\n\tend", "def advance_player!(player)\n<<<<<<< HEAD\n # lanzo el dado\n if not_advance_more_than_lenght?(player)\n @race_progress[player] += @die.roll\n if somebody_is_winner?(player)\n @finished = true \n end\n end\n end", "def attacks(player)\n dice = compute_damage\n puts \"#{@name} attaque #{player.name} : Il lui inflige #{dice} points de dommages\"\n player.life_points = player.life_points - dice\n end", "def update_hp(change)\n self.update(hp:self.hp + change)\n\n #check to see if the character is dead\n if self.hp <= 0\n\n #display to the user that the character is dead\n puts \"$$$$$$$$$$$$$$$$$$$$$$$$$$$\".blink\n puts \"#{self.name} IS DEAD !!!!!!!!!!!\".bold.red.on_black\n\n #destroy the object from the database\n self.destroy\n end\n end", "def subtract_point \n\t\t@lives -= 1\n\tend", "def kill\n @lives -= 1\n @alive = false\n return if @lives <= 0\n warp\n end", "def receive_damage\n @hit_points-= 10\n end", "def hit( power )\n @life -= power\n # Maybe remove this?\n if @life <= 0\n puts \"#{self} died!\"\n # Remove dead monster from the list of living monsters\n $livingmonsters.delete( self )\n end\n end", "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", "def finished\n destination.hp -= damage\n\tGame.scene.remove_object self\n end", "def update\n if Gosu.milliseconds - @creation_milliseconds >= SLIME_TIME * 2\n @window.level.enemies.delete(self)\n end\n end", "def level_up\n @lives += 1\n end", "def end \n \tif @human_player.life_points == 0\n\t\tputs \" Looser tu as perdu...\"\n\t\telsif @enemies.empty? == true\n\t\tputs \"__________________________________\"\n\t\tputs \" VICTOIRE !!! $$$$ \"\n\t\tputs \" ___________________________________\"\n\t\tend\n\tend", "def card10(player)\n player.position -= 3\n end", "def bringToLife\n @dead = false\n end", "def run\n @health -= 10\n return self\n end", "def dead\r\n @energy < 0\r\n @gameover = true\r\n @timeout = true\r\n @time == 0\r\nend", "def lose!\n\t\t@bet = 0\n\tend", "def gets_damage(damage) \n @life_points -= damage\n\n if @life_points <= 0 \n puts \"Déso #{@name} t'es mort !\"\n end\n end", "def deuce\n @player1.points >= 3\n @player2.points = @player1.points\n\n return 'The score is deuce.'\n end", "def resurrect!\n alive! if resurrectable?\n end", "def change_score\n @lives = @lives - 1\n end", "def lives_lost\n @lives -= 1\n pp \"INCORRECT -- YOU HAVE #{@lives} LIVES LEFT\"\n end", "def change_player\n\n end", "def player_hit(bullet)\r\n @bullets.delete bullet\r\n @ship_hit_sound.bmp.play\r\n # If the player has lost all the lifeline end the game\r\n if @player.life == 0\r\n # Ending the game\r\n GameOverWindow.new.show\r\n close\r\n end \r\n # Player lost one lifeline\r\n @player.lose_life()\r\n # Plaing a blank heart to represent it\r\n @heart_list[@player.life] = @blank_heart\r\n @heart = @blank_heart \r\n end", "def affichage_player\n\n\n end", "def advance_player(player)\n player[\"player_position\"] += die.roll\n player[\"player_position\"] = 29 if player[\"player_position\"] > 29\n end", "def player; end", "def player; end", "def player; end", "def player; end", "def player; end", "def player; end", "def player; end", "def fold_hand\n @active_players[0].folded = true\n pot_adjustment\n @active_players[0].current_bet = 0\n @active_players[0].acted = false\n system 'clear'\n puts 'You have folded your hand.'\n sleep(3)\nend", "def restartGame\r\n\t\r\nend", "def release_pieces\n @game_world.release_active\n end", "def finalize_game\n\n end", "def update\n\n # Check if the player is colliding with a deadly tile. If so: Lose!\n if Position.collide?(@active_tile, @player)\n timer = Time.new\n until Time.now - timer > 3\n @player.move(:none)\n end\n Game.lose_level\n Game.lose_life\n new_level\n end\n\n # Periodically activate a deadly tile in order of decreasing rarity\n if @player.direction != :none\n if Time.now - @enemy_timer > Settings.enemy_spawn_rate\n eligable_tiles = []\n Grid.tiles.each do |tile|\n if !@target.include?(tile.contents) &&\n tile.is_deadly == false &&\n tile.contents != :empty &&\n tile.contents != \" \"\n eligable_tiles << tile.contents\n end\n end\n @enemy_tile = Grid.characters.detect{|tile| eligable_tiles.include? (tile)}\n Grid.tiles.each do |tile|\n tile.is_deadly = true if tile.contents == @enemy_tile\n end\n @enemy_timer = Time.new\n end\n end\n\n # Align the player's position to the closest tile on the grid\n if Position.within_bounds?(@player)\n @player.x, @player.y = @player.x.round_to(Settings.tile_size), @player.y.round_to(Settings.tile_size)\n end\n\n # Wrap the player around the screen if they reach the edge\n Position.wrap(@player)\n\n # Respond to Keypresses\n if button_down? KbEscape\n close\n puts \"You reached level #{Game.current_level}. Goodbye!\"\n exit\n end\n Moving.parts.each {|part| part.move :none if button_down? KbSpace}\n @player.move(:left) if button_down?(KbLeft) && Position.within_bounds?(@player) && (@player.direction != :right)\n @player.move(:right) if button_down?(KbRight) && Position.within_bounds?(@player) && (@player.direction != :left)\n @player.move(:up) if button_down?(KbUp) && Position.within_bounds?(@player) && (@player.direction != :down)\n @player.move(:down) if button_down?(KbDown) && Position.within_bounds?(@player) && (@player.direction != :up)\n\n # Move all the movable objects in the game\n @player.move(@player.direction)\n Moving.all_move\n \n # Update the player's location on the grid\n if Position.within_bounds?(@player)\n @active_tile = Grid.tiles\n .find {|tile| tile.x == @player.x\n .round_to(Settings.tile_size) && tile.y == @player.y\n .round_to(Settings.tile_size)}\n end\n\n # Have the invisible spacer tile track the player's position\n @head.x, @head.y, @head.direction = @player.path.last[0], @player.path.last[1], @player.path.last[2] \n \n # Update all the tail sections so the previous location of the section in front\n # becomes their current location\n Moving.parts.each_with_index do |section, index|\n section.path << [section.x.round_to(Settings.tile_size), section.y.round_to(Settings.tile_size), section.direction]\n leader = Moving.parts[index-1].path.last if index > 0\n section.x, section.y, section.direction = leader[0], leader[1], leader[2] if index > 0\n section.path.drop(1) if section.path.size > @message.size + 1\n end\n \n # If the player moves over a target tile create a new tail section\n if @active_tile.is_edible\n lastpath = Moving.parts.last.path.last\n image = Image.from_text(@active_tile.contents, Settings.tile_size, options={font: Settings.font, bold: true})\n Tail.new(lastpath[0], lastpath[1], lastpath[2], image)\n @completed << @active_tile.contents.to_s\n Grid.subtract_character(@active_tile.contents)\n @active_tile.contents = :empty\n @target = @target.drop(1)\n Grid.tiles.each {|tile| tile.is_edible = false}\n end\n\n # Set the target letter\n Grid.tiles.each {|tile| tile.is_edible = true if tile.contents == @target[0]}\n\n # Check if the player has collected all the target letters and in the case that\n # they have, check if they have arrived at the mailbox. If so: Level up!\n if @message.join(\"\") == @completed\n if @active_tile.y.between?(Settings.margin_bottom + Settings.tile_size / 2, Settings.margin_bottom + Settings.tile_size * 2) &&\n @active_tile.x.between?(Settings.margin_left, Settings.margin_left + Settings.tile_size)\n @player.move(:none)\n sleep 2\n Game.add_life\n new_level\n end\n end\n end", "def lose\n @music.pause if @sonido\n @loser_song.volume = 0.6\n @loser_song.play if @sonido\n\n GAME_OBJECTS.each(&:destroy_all)\n pop_game_state\n push_game_state(Puntajes.new(player_name: @player_name, score: @score, difficulty: @difficulty, sonido: @sonido))\n end", "def reduce_hitpoint(damage)\r\n @hitpoint -= damage\r\n end", "def on_player_toggle_sneak(evt)\n player = evt.player\n return unless %w[world world_nether].include?(player.location.world.name)\n\n #if player.name == 'ujm'\n # #location_around(add_loc(player.location, 0, 5, 0), 5).map(&:block).each {|b| b.type = Material::AIR if b.type != Material::AIR }\n # location_around_flat(loc_below(player.location), 5).map(&:block).each {|b| b.type = Material::GRASS if b.type != Material::AIR }\n # player.perform_command 'dynmap render'\n #end\n # Superjump\n name = player.name\n @crouching_counter ||= {}\n @crouching_counter[name] ||= 0\n @crouching_countingdown ||= false\n if evt.sneaking?\n # counting up\n @crouching_counter[name] += 1\n later sec(2.0) do\n @crouching_counter[name] -= 1\n end\n if @crouching_counter[name] == 4\n play_sound(add_loc(player.location, 0, 5, 0), Sound::BAT_TAKEOFF, 1.0, 0.0)\n # evt.player.send_message \"superjump!\"\n player.fall_distance = 0.0\n player.velocity = player.velocity.tap {|v| v.set_y jfloat(1.4) }\n end\n\n # map teleport\n if player.location.pitch == 90.0\n item = player.item_in_hand\n if item && item.type == Material::MAP\n map = Bukkit.get_map(item.data.data)\n loc = block2loc(map.world.get_highest_block_at(map.center_x, map.center_z))\n loc = add_loc(loc, 0, 3, 0)\n loc.pitch = 90.0\n loc.yaw = player.location.yaw\n loc.chunk.load\n\n animals = player.get_nearby_entities(2, 2, 2).select {|e|\n Player === e\n }\n move_livings = [player] + animals\n\n play_effect(player.location, Effect::ENDER_SIGNAL, nil)\n play_sound(player.location, Sound::ENDERMAN_TELEPORT , 1.0, 0.5)\n move_livings.each do |e|\n e.velocity = e.velocity.tap {|v| v.set_y 1.0 }\n end\n later sec(0.5) do\n move_livings.select(&:valid?).each do |e|\n e.teleport(loc)\n e.fall_distance = 0.0\n play_effect(player.location, Effect::ENDER_SIGNAL, nil)\n play_sound(loc, Sound::ENDERMAN_TELEPORT , 1.0, 0.5)\n end\n end\n end\n end\n\n ctf_sneaking(player) if @ctf_players.member?(player)\n end\n\n #player_update_speed(evt.player, snp: evt.sneaking?)\n\n #player = evt.player\n #if player.equipment.boots && HARD_BOOTS.include?(player.equipment.boots.type)\n # if !evt.player.on_ground? && evt.sneaking?\n # later 0 do\n # newloc = player.location\n # newloc.x = newloc.x.to_i.to_f - 0.5\n # newloc.z = newloc.z.to_i.to_f - 0.5\n # player.teleport newloc\n # play_effect(newloc, Effect::ENDER_SIGNAL)\n # player.velocity = Vector.new(0.0, -1.0, 0.0)\n # end\n # loc = (1..4).lazy.\n # map {|y| evt.player.location.clone.add(0, -y, 0) }.\n # find {|l| l.block.type != Material::AIR }\n # later sec(0.2) do\n # if loc && loc.block.type == Material::STONE\n # loc.block.break_naturally(ItemStack.new(Material::DIAMOND_PICKAXE))\n # end\n # end\n # end\n #end\n end", "def suffer_damage(points)\n @health = @health - points\n if @health <= 0\n #puts \"#{proxy} has died.\"\n @alive = false\n @health = 0\n end\n end", "def change_variables_for_next_pass\n @number_of_drop_points /= 2\n @number_of_passes -= 1\n @min_particles = (@min_particles * 1.1).round\n @max_particles = (@max_particles * 1.1).round\n end", "def heal()\r\n @warrior.rest!\r\n end", "def heal()\r\n @warrior.rest!\r\n end", "def heal()\r\n @warrior.rest!\r\n end", "def heal()\r\n @warrior.rest!\r\n end", "def ask_question_and_update_lives(player)\n result = ask_question_and_check_answer\n if !result\n player.lives -= 1\n end\n end", "def takeDamage (dmg)\n\t\t@currentHealth -= dmg\n\tend", "def update\n if @board.recheck\n #@board.compact_pieces\n @board.clear_matches\n elsif @board.pieces_removed != 0\n adjust_score(@board.pieces_removed)\n @board.pieces_removed = 0 \n #end game if no legal moves left \n if not @board.any_moves?\n stop_anim\n stop_update\n stop_timer\n @game_over = true\n draw\n $app.alert(\"Game over: no more moves\")\n end \n end\n #end game if out of time\n if @time_remaining && (@time_remaining < 0)\n stop_anim\n stop_update\n stop_timer\n @game_over = true\n draw\n $app.alert(\"Game over: out of time.\") \n end\n end", "def decrease_health\n @health.update { |v| v - 1 }\n end", "def life_lost\n # if we are attacking ourselves, don't give our life back (otherwise it will never end)\n unless current_user == current_user.previous.player\n # Render the status message and push it to all clients\n message = render_to_string :partial => 'messages/gained_a_life', \n :locals => {:user_1 => current_user.previous.player, :user_2 => current_user}\n send_status_message(message) \n \n # Attacker gains the life that their victim lost\n attacker = current_user.previous.player\n life_gained(attacker)\n end\n ensure\n render :nothing => true\n end", "def update_standings\n system(\"clear\")\n puts \"#{previous_player} spelled #{fragment}.\"\n puts \"#{previous_player} gets a letter!\"\n\n losses[previous_player] += 1\n\n if losses[previous_player] == MAX_LOSS_COUNT\n puts \"#{previous_player} has been eliminated!\"\n end\n\n display_standings\n\n sleep(2)\n end", "def end_game\n end", "def end_game\r\n @game_over = true\r\n end" ]
[ "0.7591858", "0.75863034", "0.7402945", "0.7402945", "0.7402945", "0.7402945", "0.73868203", "0.73052967", "0.72994196", "0.72235984", "0.71686816", "0.70550114", "0.7036182", "0.6953916", "0.6926268", "0.68712837", "0.6800104", "0.6708862", "0.66474104", "0.6575665", "0.653235", "0.65035045", "0.6477529", "0.6467671", "0.6465891", "0.6464811", "0.64455515", "0.6413691", "0.6413691", "0.6380014", "0.6380014", "0.6374417", "0.6369614", "0.63510144", "0.6329392", "0.630549", "0.6289422", "0.6257681", "0.6252325", "0.62479967", "0.6239969", "0.6235457", "0.6216229", "0.6215354", "0.6212358", "0.6201553", "0.6195641", "0.6187325", "0.6183628", "0.61765444", "0.6171247", "0.6160833", "0.61585635", "0.615189", "0.6147079", "0.6143609", "0.6137672", "0.61295027", "0.6122377", "0.6118119", "0.6108711", "0.61000574", "0.6076529", "0.6061977", "0.6053217", "0.60485804", "0.60449445", "0.60420936", "0.60389256", "0.6034304", "0.6022631", "0.60033464", "0.60033464", "0.60033464", "0.60033464", "0.60033464", "0.60033464", "0.60033464", "0.60009724", "0.59935874", "0.5977284", "0.5976591", "0.5968849", "0.59658533", "0.5964384", "0.59596604", "0.5949848", "0.59422493", "0.5941755", "0.5941755", "0.5941755", "0.5941755", "0.5941233", "0.5921165", "0.59147394", "0.59037477", "0.589733", "0.5896469", "0.58862555", "0.58849907" ]
0.77073747
0
Move the Space Ship to the left
def move_left if @x - @vel_x > GAME_PRESET["player_move_left"] @x -= @vel_x end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_left\n # @dx = -8\n @x -= 8\n end", "def move_left\n\t\t# if the horse isn;t yet at the left of of the screne move it left 20\n\t\tif @x > 0\n\t\t\t\t@x = @x -20\n\t\tend\n\tend", "def move_left\n\t\tmove([-1,0])\n\tend", "def moveLeft(dist)\n @body.p.x -= dist\n end", "def move_left\n left_tile = C[@location.first, @location.second - 1]\n move_to(left_tile)\n end", "def move_left\n @memory_position -= 1\n @memory_position = 0xfffffe if @memory_position < 0\n end", "def move_left\n\t\t@x_speed -= @speed_inc_step\n\t\tif @x_speed < -@max_speed\n\t\t\t@x_speed = -@max_speed\n\t\tend\n\n\t\tupdate_x(@x_speed)\n\n\t\tif !face_left?\n\t\t\tupdate_angle(calculate_angle(180))\n\t\tend\n\n\t\t@has_moved = @player_moved = true\n\tend", "def moveLeft\n if @x > 1\n call Screen.setColor(false)\n call Screen.drawRectangle((@x + @size) - 1, @y, @x + @size, @y + @size)\n let @x = @x - 2\n call Screen.setColor(true)\n call Screen.drawRectangle(@x, @y, @x + 1, @y + @size)\n end\n end", "def left\n direction.move_left!\n end", "def move_left\n left_tile = Couple.new(@location.first, @location.second - 1)\n move_to(left_tile)\n end", "def move_left(environment)\n @previous_action = 'moved left'\n location[:x] -= 1 if can_move_right?(environment)\n\n environment.state\n end", "def moveLeft(distance)\n @x = @x - distance\n @image.x = @x\n end", "def moveLeft(distance)\n @x = @x - distance\n @image.x = @x\n end", "def move_west\n @x -= 1\n end", "def stair_move_left\n # unless @through\n if front_system_tag == StairsL\n return true unless $game_map.system_tag(@x - 1, @y - 1) == StairsL\n move_upper_left\n return true\n elsif system_tag == StairsR\n move_lower_left\n return true\n end\n # end\n return false\n end", "def left\n check_placed\n @facing = next_facing(-1)\n end", "def move_to_left_of(node)\n self.move_to node, :left\n end", "def piece_left\n return unless @falling_piece\n\n @falling_piece.x -= @block_size\n @falling_piece.grid_position.x -= 1\n\n piece_right if collides?\n end", "def move_to_left_of(node)\n move_to node, :left\n end", "def move_to_left_of(node)\n move_to node, :left\n end", "def move_to_left_of(node)\n move_to node, :left\n end", "def move_to_left_of(node)\n self.move_to node, :left\n end", "def move_to_left_of(node)\n self.move_to(node, :left)\n end", "def move_left(array)\r\n set_current_row_col(array)\r\n new_col = (@current_col == 0) ? array.first.length - 1 : @current_col - 1 # This logic will decide the new co-ordinated of space\r\n current_ele = array[@current_row][new_col]\r\n array[@current_row][new_col] = ' '\r\n replace_existing_element(array,current_ele, @current_row, @current_col)\r\n array\r\n end", "def left\n @_x + self.collision[0]\n end", "def turnLeft\n case @currentDir\n when :north\n @currentDir = :west\n when :south\n @currentDir = :east\n when :east\n @currentDir = :north\n when :west\n @currentDir = :south\n end\n end", "def move_left(turn_enabled = true)\n @x -= 1 if passable?(@x, @y, 4)\n turn_left if turn_enabled\n add_move_update('move_left')\n end", "def move_right\n\t\tmove([1,0])\n\tend", "def turn_left\n if @@compass.index(@direction) == 0\n @direction = @@compass[-1]\n else\n current_index = @@compass.index(@direction)\n @direction = @@compass[current_index - 1]\n end\n end", "def turn_left\n @shape.body.t -= 300.0\n end", "def forward_move\n case @facing\n when 'NORTH'\n @y += 1\n when 'SOUTH'\n @y -= 1\n when 'EAST'\n @x += 1\n when 'WEST'\n @x -= 1\n end\n self\n end", "def move_left\n self.move_to_left_of(self.left_sibling)\n end", "def turn_left\n index = DIRECTIONS.index(@facing)-1\n @facing = DIRECTIONS[index]\n end", "def move_left(mat, y, x)\n return if (x - 1) < 0\n\n zero_el = mat[y][x]\n other_el = mat[y][x - 1]\n mat[y][x - 1] = zero_el\n mat[y][x] = other_el\n\n { m: mat, zero: update_coordinates(zero_el, other_el), move: :left }\nend", "def turn_left\n @orientation = CompassPoints::LEFT_TURNS[@orientation] if placed?\n end", "def move\n # Stores change in x and y position based off of vel and current x,y\n newX = @x + @vel_x\n newY = @y + @vel_y\n # Prevents ship from exiting bounds in x along the ship's edge\n if newX >= @image.width and newX <= @window.width-@image.width then\n @x += @vel_x\n end\n # Prevents ship from exiting bounds in y along the ship's edge\n if newY >= @image.height and newY <= @window.height-@image.height then\n @y += @vel_y\n end\n # Slows down the ship if no new input is given\n # Lower values for tighter controls\n @vel_x *= 0.50\n @vel_y *= 0.50\n end", "def move_lower_left\n unless @direction_fix\n @direction = (@direction == 6 ? 4 : @direction == 8 ? 2 : @direction)\n end\n if (passable?(@x, @y, 2) && passable?(@x, @y + 1, 4)) ||\n (passable?(@x, @y, 4) && passable?(@x - 1, @y, 2)) # 8 a la place de 2 sur les deux lignes\n move_follower_to_character\n @x -= 1\n @y += 1\n if @follower && $game_variables[Yuki::Var::FM_Sel_Foll] == 0\n @memorized_move = :move_lower_left\n @follower.direction = @direction\n end\n movement_process_end(true)\n increase_steps\n end\n end", "def position_for_next_harvest()\n turn_right()\n move()\n turn_right()\n end", "def move\n @leading_x = coordinate_array[0]\n @leading_y = coordinate_array[1]\n end", "def move\n\t\t# move 5px to the left\n\t @x = @x - 5\n\t # move up or down based on the Y velocity\n\t @y = @y + @vy\n\tend", "def turn_left\n turn(:left)\n end", "def move_forward\n\t\tnew_position = forward_position\n\t\t@x = new_position[0]\n\t\t@y = new_position[1]\n\tend", "def move_toward_beeper()\n if front_is_clear?()\n move()\n else\n turn_left()\n end\n end", "def move_x\n return if @x_vel.zero?\n new_x = @x + @x_vel\n impacts = @space.entities_overlapping(new_x, @y).delete(self)\n if impacts.empty?\n @x = new_x\n return\n end\n @x = if @x_vel > 0 # moving right\n # X position of leftmost candidate(s)\n impact_at_x = impacts.collect(&:x).min\n impacts.delete_if {|e| e.x > impact_at_x }\n impact_at_x - WIDTH\n else # moving left\n # X position of rightmost candidate(s)\n impact_at_x = impacts.collect(&:x).max\n impacts.delete_if {|e| e.x < impact_at_x }\n impact_at_x + WIDTH\n end\n @x_vel = 0\n impacts.each {|other| other.impacted_by(self) }\n end", "def move\n case @rover_facing\n when 'N'\n @coordinates[1] += 1\n when 'E'\n @coordinates[0] += 1\n when 'S'\n @coordinates[1] -= 1\n when 'W'\n @coordinates[0] -= 1\n end\n end", "def move\n\t\t@x += 0\n\t\t@y += @vel\n\tend", "def move_object_left(object)\n object.location_move_left unless is_wall?(object.location_left)\n end", "def left\n position.x\n end", "def move_player_left(grid, player)\n return if player.grid_x.zero?\n return if player.left_wall\n\n return grid[player.grid_y][player.grid_x - 1]\nend", "def move(left, top)\n # no-op\n end", "def turnLeft\n if @placed\n @face = @face.turnLeft\n end\n end", "def turn_left\n @direction = DIRECTIONS[DIRECTIONS.index(@direction) - 1]\n end", "def move\n check_placement\n\n new_position = make_move(current_position, direction)\n position(new_position[0], new_position[1], @table.size)\n end", "def update\n space.fall(self) if should_fall?\n move\n end", "def castle_left(a, b, x, y)\n\t\t@board[x][y].piece = @board[a][b].piece\n\t\t@board[a][b].piece = nil\n\t\t@board[x + 1][y].piece = @board[x - 1][y].piece\n\t\t@board[x - 1][y].piece = nil\n\tend", "def move(direction)\n @x += @velocity if direction == :right\n @x -= @velocity if direction == :left\n end", "def move_right\r\n if @x + @vel_x < SCREEN_WIDTH - GAME_PRESET[\"player_move_right\"]\r\n @x += @vel_x\r\n end\r\n end", "def moveto(x, y)\r\r\n @x = x % $game_map.width\r\r\n @y = y % $game_map.height\r\r\n @real_x = @x\r\r\n @real_y = @y\r\r\n @prelock_direction = 0\r\r\n straighten\r\r\n update_bush_depth\r\r\n end", "def move\n\n end", "def move_left\n move_to_left_of left_sibling\n end", "def move_lower\n movement { self.position += 1 }\n end", "def turn_left\n case @direction\n when \"n\"\n then \"w\"\n when \"w\"\n then \"s\"\n when \"s\"\n then \"e\"\n when \"e\"\n then \"n\"\n end\n end", "def left\n self.position[:x]\n end", "def moveto(x, y)\r\n @x = x % $game_map.width\r\n @y = y % $game_map.height\r\n @real_x = @x\r\n @real_y = @y\r\n @prelock_direction = 0\r\n straighten\r\n update_bush_depth\r\n end", "def move\n \n end", "def move\n \n end", "def move; end", "def move; end", "def move\n @coordinates[1] += 1 if @rover_facing == 'N'\n @coordinates[0] += 1 if @rover_facing == 'E'\n @coordinates[1] -= 1 if @rover_facing == 'S'\n @coordinates[0] -= 1 if @rover_facing == 'W'\nend", "def left(j)\n\t\tnew_loc = @location.dup\n\t\tnew_loc[:x] -= j\n\t\tGridPoint3D.new(x: new_loc[:x], y: new_loc[:y], z: new_loc[:z])\n\tend", "def turn_left\n\t\tif @direction == \"N\"\n\t\t\t@direction = \"W\"\n\t\telsif @direction == \"W\"\n\t\t\t@direction = \"S\"\n\t\telsif @direction == \"S\"\n\t\t\t@direction = \"E\"\n\t\telsif @direction == \"E\"\n\t\t\t@direction = \"N\"\n\t\tend\n\tend", "def move_ears(left, right)\n message.posleft = left if left\n message.posright = right if right\n nil\n end", "def left!\n # TODO: Refactor. Can be less explicit\n case @facing\n when Direction::NORTH\n @facing = Direction::WEST\n when Direction::EAST\n @facing = Direction::NORTH\n when Direction::SOUTH\n @facing = Direction::EAST\n when Direction::WEST\n @facing = Direction::SOUTH\n else\n raise %q{Cannot rotate left}\n end\n end", "def go_left(length)\r\n go_to(@location.x - length, @location.y)\r\n end", "def move_left(turn_enabled = true)\n\n @move_angle = 0\n\n # Turn left\n if turn_enabled\n # If facing right, turn down for just second\n turn_left\n end\n # If passable\n if passable?(@x, @y, 4)\n # Turn left\n turn_left\n\n # Remove from cache\n $scene.map.cache_clear(@x,@y,self)\n\n # Update coordinates\n @x -= 1\n\n $scene.map.cache_push(@x,@y,self)\n\n # Increase steps\n increase_steps\n\n if self == $player && $party.leader != 'ship'\n tt = terrain_tag\n $audio.queue(\"steps/foot#{rand(8)}\",12,0.4) if tt != 3\n $audio.queue('steps/foot5',12,0.6) if tt == 2\n end\n else\n # Determine if touch event is triggered\n check_event_trigger_touch(@x-1, @y)\n end\n end", "def move_x\n return if doomed?\n return if @x_vel.zero?\n new_x = @x + @x_vel\n impacts = entities_obstructing(new_x, @y)\n if impacts.empty?\n @x = new_x\n return\n end\n @x = if @x_vel > 0 # moving right\n # X position of leftmost candidate(s)\n impact_at_x = impacts.collect(&:x).min\n impacts.delete_if {|e| e.x > impact_at_x }\n impact_at_x - WIDTH\n else # moving left\n # X position of rightmost candidate(s)\n impact_at_x = impacts.collect(&:x).max\n impacts.delete_if {|e| e.x < impact_at_x }\n impact_at_x + WIDTH\n end\n i_hit(impacts, @x_vel.abs)\n self.x_vel = 0\n end", "def move\r\n @x += @x_direction\r\n @y += @y_direction\r\n # Preventing the Alien moving out of the screen\r\n if @x > (SCREEN_WIDTH - GAME_PRESET[\"alien_reach\"]) || @x < 0\r\n @x_direction= -@x_direction\r\n elsif @y > (SCREEN_HEIGHT * @height_limit)\r\n @y_direction = 0\r\n end\r\n end", "def move_left\n tenacious_transaction do\n move_to_left_of left_sibling.try(:lock!)\n end\n end", "def left(robot, robot_positions)\n move_horizontally(robot, robot_positions, :left)\n end", "def move\n return unless placed?\n # no need to use a loop since the length is only 2\n new_x = @pos_x + @direction[:x]\n new_y = @pos_y + @direction[:y]\n\n return unless valid_position?(new_x, new_y)\n set_position(new_x, new_y)\n end", "def move\n @position.shift unless @growing\n case @direction\n when 'down'\n @position.push(new_coords(head[0], head[1] + 1))\n when 'up'\n @position.push(new_coords(head[0], head[1] - 1))\n when 'left'\n @position.push(new_coords(head[0] - 1, head[1]))\n when 'right'\n @position.push(new_coords(head[0] + 1, head[1]))\n end\n @growing = @turned = false\n end", "def move_east\n @x += 1\n end", "def left\n check_placement\n\n super\n end", "def move_down_left\n i = 1\n until false\n x, y = @pos\n x += i\n y -= i\n pos = [x, y]\n break if x > 7 || x < 0 || y > 7 || y < 0 || @board[pos].color == @color\n @moves << pos\n break if @board[pos].color != @color\n i += 1\n end\n end", "def walk\n if @headed_left\n move_left\n else\n move_right\n end\n end", "def moving!\n end", "def move_left\n new_board = Marshal.load(Marshal.dump(@board))\n (0..3).each do |i|\n (0..3).each do |j|\n (j..2).each do |k|\n if @board[i][k + 1] == 0\n next\n elsif @board[i][j] == @board[i][k + 1]\n @board[i][j] = @board[i][j] * 2\n @board[i][k + 1] = 0\n end\n break\n end\n end\n @board[i] = shift_left(@board[i])\n end\n @board == new_board ? false : true\n end", "def move\n\t\tif valid_move?\n\t\t\tputs \"\"\n\t\t\tif OS.mac?\n\t\t\t\tcmd = ('say \"roger-roger\"')\n\t\t\t\tsystem cmd\n\t\t\tend\n\t\t\tputs \"Roger, roger I\\'m moving forward one field!\"\n\t\t\tcase @robot_direction\n\t\t\twhen \"EAST\" then @x += 1\n\t\t\twhen \"WEST\" then @x -= 1\n\t\t\twhen \"NORTH\" then @y += 1\n\t\t\twhen \"SOUTH\" then @y -= 1\n\t\t\tend\n\t\telse\n puts \"This is the end of this world and I can't go further in this direction, please change direction\"\n\t\tend\n\tend", "def rotate_left\n placed?\n @direction = case @direction\n when \"NORTH\" then \"WEST\"\n when \"EAST\" then \"NORTH\"\n when \"SOUTH\" then \"EAST\"\n when \"WEST\" then \"SOUTH\"\n end\n end", "def accelLeft\n @vel_x -= @VELOCITY\n end", "def change_direction\n @move_x = -@move_x\n @speed = -@speed\n end", "def move\n case @facing\n when \"north\"\n @posY += 1 if @posY+1 < @table.width\n when \"east\"\n @posX += 1 if @posX+1 < @table.height\n when \"south\"\n @posY -= 1 if @posY-1 >= 0\n when \"west\"\n @posX -= 1 if @posX-1 >= 0\n end\n end", "def move(direction)\n \n end", "def move(forward)\n moves = [0, forward ? 1 : -1]\n moves.reverse! if @hor\n new_coord = @coord.add(moves + moves)\n set!(new_coord[0], new_coord[1], @hor)\n end", "def turn_left\n case @direction\n when :up\n @direction = :left\n when :right\n @direction = :up\n when :down\n @direction = :right\n when :left\n @direction = :down\n end\n end", "def left(robot)\n extend Placed\n\n return robot unless placed? robot\n robot.f = Navigation::ALL[\n Navigation::ALL.index(robot.f) - 1\n ]\n robot\n end", "def turn_left\n index = DIRECTIONS.index(direction) - 1\n index = DIRECTIONS.length-1 if index < 0\n change_direction(DIRECTIONS[index])\n end", "def turn_left\n index = DIRECTIONS.index(direction) - 1\n index = DIRECTIONS.length-1 if index < 0\n change_direction(DIRECTIONS[index])\n end", "def move\n\t\treturn \"INVALID COMMANDS, YOU CAN NOT MAKE THE ROBOT FALL OFF THE TABLE\" unless is_valid_move?\n\t\tcase @direction\n\t\twhen \"east\"\n\t\t\t@x_coordinate += 1\n\t\twhen \"west\"\n\t\t\t@x_coordinate -= 1\n\t\twhen \"south\"\n\t\t\t@y_coordinate -= 1\n\t\twhen \"north\"\n\t\t\t@y_coordinate += 1\n\t\telse\n\t\tend\n\t\ttrue\n\tend", "def left\n return cancel_action(\"Robot isn't placed on the surface yet\") unless placed?\n\n target_direction = current_placement.direction.rotate_counterclockwise\n rotate(target_direction)\n end" ]
[ "0.77708113", "0.75958306", "0.75864613", "0.74042237", "0.70948565", "0.70789635", "0.69773436", "0.69617635", "0.69616073", "0.695098", "0.6902597", "0.6878532", "0.6878532", "0.6755922", "0.66719335", "0.66525656", "0.662645", "0.6607497", "0.65876603", "0.65876603", "0.65876603", "0.65871435", "0.65469724", "0.6518504", "0.6498869", "0.6479093", "0.6473718", "0.6435408", "0.64241415", "0.6422022", "0.6418356", "0.6416967", "0.6407937", "0.63905555", "0.6370812", "0.63692266", "0.63662577", "0.6359545", "0.6356042", "0.6348717", "0.63485897", "0.6335817", "0.6317166", "0.6310072", "0.6297337", "0.62914914", "0.6280014", "0.62657964", "0.62582916", "0.6221215", "0.6219889", "0.62084585", "0.6205699", "0.6200138", "0.6196811", "0.6191864", "0.6188997", "0.6185063", "0.618421", "0.6181559", "0.61322343", "0.61291635", "0.6117105", "0.6114573", "0.6109425", "0.6109425", "0.6098893", "0.6098893", "0.6096972", "0.607491", "0.6056282", "0.60560805", "0.6055012", "0.6047007", "0.60460055", "0.6045674", "0.6044853", "0.60425913", "0.60418653", "0.6039449", "0.60388327", "0.6038752", "0.6028393", "0.60268706", "0.60101765", "0.5999632", "0.59920233", "0.59874064", "0.59767807", "0.5973567", "0.59625286", "0.59621286", "0.5955677", "0.59517175", "0.5949059", "0.59470314", "0.5940907", "0.5940907", "0.59316677", "0.593075" ]
0.74570507
3
Move the Space Ship to the right
def move_right if @x + @vel_x < SCREEN_WIDTH - GAME_PRESET["player_move_right"] @x += @vel_x end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_right\n\t\tmove([1,0])\n\tend", "def moveRight\n if (@x + @size) < 510\n call Screen.setColor(false)\n call Screen.drawRectangle(@x, @y, @x + 1, @y + @size)\n let @x = @x + 2\n call Screen.setColor(true)\n call Screen.drawRectangle((@x + @size) - 1, @y, @x + @size, @y + @size)\n end\n end", "def move_right\n right_tile = C[@location.first, @location.second + 1]\n move_to(right_tile)\n end", "def move\n case @rover_facing\n when 'N'\n @coordinates[1] += 1\n when 'E'\n @coordinates[0] += 1\n when 'S'\n @coordinates[1] -= 1\n when 'W'\n @coordinates[0] -= 1\n end\n end", "def move_left\n # @dx = -8\n @x -= 8\n end", "def position_for_next_harvest()\n turn_right()\n move()\n turn_right()\n end", "def move\n\t\t@x += 0\n\t\t@y += @vel\n\tend", "def move_right\n\t\t@x_speed += @speed_inc_step\n\t\tif @x_speed > @max_speed\n\t\t\t@x_speed = @max_speed\n\t\tend\n\n\t\tupdate_x(@x_speed)\n\n\t\tif face_left?\n\t\t\tupdate_angle(calculate_angle(180))\n\t\tend\n\n\t\t@has_moved = @player_moved = true\n\tend", "def move_right\n right_tile = Couple.new(@location.first, @location.second + 1)\n move_to(right_tile)\n end", "def right\n direction.move_right!\n end", "def move_west\n @x -= 1\n end", "def update\n space.fall(self) if should_fall?\n move\n end", "def moveRight(distance)\n @x = @x + distance\n @image.x = @x\n end", "def move\n # Stores change in x and y position based off of vel and current x,y\n newX = @x + @vel_x\n newY = @y + @vel_y\n # Prevents ship from exiting bounds in x along the ship's edge\n if newX >= @image.width and newX <= @window.width-@image.width then\n @x += @vel_x\n end\n # Prevents ship from exiting bounds in y along the ship's edge\n if newY >= @image.height and newY <= @window.height-@image.height then\n @y += @vel_y\n end\n # Slows down the ship if no new input is given\n # Lower values for tighter controls\n @vel_x *= 0.50\n @vel_y *= 0.50\n end", "def move_right\n @memory_position += 1\n @memory_position = 0 if @memory_position > 0xfffffe\n end", "def moveLeft(dist)\n @body.p.x -= dist\n end", "def move_right\n @board.each(&:reverse!)\n action = move_left\n @board.each(&:reverse!)\n action\n end", "def move\n\t\tif valid_move?\n\t\t\tputs \"\"\n\t\t\tif OS.mac?\n\t\t\t\tcmd = ('say \"roger-roger\"')\n\t\t\t\tsystem cmd\n\t\t\tend\n\t\t\tputs \"Roger, roger I\\'m moving forward one field!\"\n\t\t\tcase @robot_direction\n\t\t\twhen \"EAST\" then @x += 1\n\t\t\twhen \"WEST\" then @x -= 1\n\t\t\twhen \"NORTH\" then @y += 1\n\t\t\twhen \"SOUTH\" then @y -= 1\n\t\t\tend\n\t\telse\n puts \"This is the end of this world and I can't go further in this direction, please change direction\"\n\t\tend\n\tend", "def move(direction)\n @x += @velocity if direction == :right\n @x -= @velocity if direction == :left\n end", "def move_right(environment)\n @previous_action = 'moved right'\n location[:x] += 1 if can_move_left?(environment)\n environment.state\n end", "def move\n\t\tif @direction == \"N\"\n\t\t\t@y += 1\n\t\telsif @direction == \"W\"\n\t\t\t@x -= 1\n\t\telsif @direction == \"E\"\n\t\t\t@x += 1\n\t\telsif @direction == \"S\"\n\t\t\t@y -= 1\n\t\tend\n\tend", "def move\n #we're modifying the ship's coordinates based on the velocity calculated in the accelerate method (which is called when we hit 'Up')\n @x += @velocity_x\n @y += @velocity_y\n #we use these to slow down the speed, acting like a friction\n #calculates the rate of acceleration \n @velocity_x *= FRICTION\n @velocity_y *= FRICTION\n # we add conditionals to delimt the edge of the window\n if @x > @window.width - @radius\n @velocity_x = 0\n @x = @window.width - @radius \n end\n if @x < @radius\n @velocity_x = 0\n @x = @radius\n end\n if @y > @window.height - @radius\n @velocity_y = 0\n @y = @window.height - @radius\n end\n end", "def move(direction)\n \n end", "def stair_move_right\n # unless @through\n if system_tag == StairsL\n move_lower_right\n return true\n elsif front_system_tag == StairsR\n return true unless $game_map.system_tag(@x + 1, @y - 1) == StairsR\n move_upper_right\n return true\n end\n # end\n return false\n end", "def move_ears(left, right)\n message.posleft = left if left\n message.posright = right if right\n nil\n end", "def move\n\n end", "def move_right(window)\n\t\t# if the horse isn't yet at the right edge move it right 20\n\t\tif @x < window.width - @image.width\n\t\t\t@x = @x +20\n\t\tend\n\tend", "def forward_move\n case @facing\n when 'NORTH'\n @y += 1\n when 'SOUTH'\n @y -= 1\n when 'EAST'\n @x += 1\n when 'WEST'\n @x -= 1\n end\n self\n end", "def move_by(right_by = 0, down_by = 0)\n action.move_by(right_by, down_by).perform\n end", "def move\n @coordinates[1] += 1 if @rover_facing == 'N'\n @coordinates[0] += 1 if @rover_facing == 'E'\n @coordinates[1] -= 1 if @rover_facing == 'S'\n @coordinates[0] -= 1 if @rover_facing == 'W'\nend", "def move\n \n end", "def move\n \n end", "def turn_right\n @shape.body.t += 300.0\n end", "def move; end", "def move; end", "def piece_right\n return unless @falling_piece\n\n @falling_piece.x += @block_size\n @falling_piece.grid_position.x += 1\n\n piece_left if collides?\n end", "def move\n\t\t# move 5px to the left\n\t @x = @x - 5\n\t # move up or down based on the Y velocity\n\t @y = @y + @vy\n\tend", "def move_left\n\t\t# if the horse isn;t yet at the left of of the screne move it left 20\n\t\tif @x > 0\n\t\t\t\t@x = @x -20\n\t\tend\n\tend", "def shrink_ship\n @length -= 1\n end", "def turnRight\n if @placed\n @face = @face.turnRight\n end\n end", "def move\n return unless placed?\n # no need to use a loop since the length is only 2\n new_x = @pos_x + @direction[:x]\n new_y = @pos_y + @direction[:y]\n\n return unless valid_position?(new_x, new_y)\n set_position(new_x, new_y)\n end", "def move\n case @direction\n when \"N\" then @y += 1 unless @y + 1 > @plateau.y || @@rover_locations.values.include?([@x, @y + 1])\n when \"E\" then @x += 1 unless @x + 1 > @plateau.x || @@rover_locations.values.include?([@x + 1, @y])\n when \"S\" then @y -= 1 unless @y - 1 < 0 || @@rover_locations.values.include?([@x, @y -1])\n when \"W\" then @x -= 1 unless @x - 1 < 0 || @@rover_locations.values.include?([@x -1, @x])\n end\n @@rover_locations[@id.to_sym] = [@x, @y]\n end", "def move_left\n\t\tmove([-1,0])\n\tend", "def move_right(turn_enabled = true)\n @x += 1 if passable?(@x, @y, 6)\n turn_right if turn_enabled\n add_move_update('move_right')\n end", "def move\n case @direction\n when \"N\"\n @y_coord += 1\n when \"S\"\n @y_coord -= 1\n when \"W\"\n @x_coord += 1\n when \"E\"\n @x_coord -= 1\n end\n end", "def move\n\t\treturn \"INVALID COMMANDS, YOU CAN NOT MAKE THE ROBOT FALL OFF THE TABLE\" unless is_valid_move?\n\t\tcase @direction\n\t\twhen \"east\"\n\t\t\t@x_coordinate += 1\n\t\twhen \"west\"\n\t\t\t@x_coordinate -= 1\n\t\twhen \"south\"\n\t\t\t@y_coordinate -= 1\n\t\twhen \"north\"\n\t\t\t@y_coordinate += 1\n\t\telse\n\t\tend\n\t\ttrue\n\tend", "def move(direction)\n @old = @pos\n @pos += direction\n end", "def move_east\n @x += 1\n end", "def move # takes (x, y, direction) from Rover\n\t\tif direction == \"N\"\n\t\t\t@y += 1\n\t\telsif direction == \"W\"\n\t\t\t@x -= 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\telse \n\t\t\treturn \"The input direction enterned is wrong\"\n\t\tend\n\tend", "def move\n check_placement\n\n new_position = make_move(current_position, direction)\n position(new_position[0], new_position[1], @table.size)\n end", "def move(x,y)\n self.dup.move!(x,y)\n end", "def move(y, x)\n update(y, x)\n apply_pos\n end", "def move\r\n @x += @x_direction\r\n @y += @y_direction\r\n # Preventing the Alien moving out of the screen\r\n if @x > (SCREEN_WIDTH - GAME_PRESET[\"alien_reach\"]) || @x < 0\r\n @x_direction= -@x_direction\r\n elsif @y > (SCREEN_HEIGHT * @height_limit)\r\n @y_direction = 0\r\n end\r\n end", "def move!\n case @facing\n when Direction::NORTH\n @loc[:y] += 1 unless out_of_bounds? @loc[:x], @loc[:y] + 1\n when Direction::EAST\n @loc[:x] += 1 unless out_of_bounds? @loc[:x] + 1, @loc[:y]\n when Direction::SOUTH\n @loc[:y] -= 1 unless out_of_bounds? @loc[:x], @loc[:y] - 1\n when Direction::WEST\n @loc[:x] -= 1 unless out_of_bounds? @loc[:x] - 1, @loc[:y]\n else\n raise %q{Don't know which direction to move}\n end\n end", "def move\n if $window.button_down?(Gosu::KbD)\n @facing = :right\n @x += speed unless out_of_bounds?(@x + speed, @y)\n end\n \n if $window.button_down?(Gosu::KbA)\n @facing = :left\n @x -= speed unless out_of_bounds?(@x - speed, @y)\n end\n \n if $window.button_down?(Gosu::KbW)\n @facing = :up\n @y -= speed unless out_of_bounds?(@x, @y - speed)\n end\n \n if $window.button_down?(Gosu::KbS)\n @facing = :down\n @y += speed unless out_of_bounds?(@x, @y + speed)\n end\n \n sprinting?\n end", "def change_direction\n @move_x = -@move_x\n @speed = -@speed\n end", "def move(pos, down, right)\n\t\t[pos[0] + down, pos[1] + right]\n\tend", "def move\n case @direction\n when \"n\"\n @y_axis += 1\n when \"e\"\n @x_axis += 1\n when \"s\"\n @y_axis -= 1\n when \"w\"\n @x_axis -= 1\n end\n end", "def move\n @position.shift unless @growing\n case @direction\n when 'down'\n @position.push(new_coords(head[0], head[1] + 1))\n when 'up'\n @position.push(new_coords(head[0], head[1] - 1))\n when 'left'\n @position.push(new_coords(head[0] - 1, head[1]))\n when 'right'\n @position.push(new_coords(head[0] + 1, head[1]))\n end\n @growing = @turned = false\n end", "def move(x,y=@y)\r\n @x2=x+(@x2-@x1)\r\n @y2=y+(@y2-@y1)\r\n @y1=y\r\n @x1=x\r\n end", "def move(rover)\n rover.command.each do |m|\n remove_rover(rover)\n rover.move(m)\n place_rover(rover)\n end\n end", "def move(x,y)\n @x +=x\n @y +=y\n end", "def move_to_right_of(node)\n self.move_to node, :right\n end", "def move(x, y)\n (x < 0 ? backward(-x) : (x > 0 ? forward(x) : '')) +\n (y < 0 ? down(-y) : (y > 0 ? up(y) : ''))\n end", "def standard_move\n pos.set(x,y)\n tar = move_towards_player\n sep = seperate_from_enemies\n sep.scalar(5.5, '*')\n tar.scalar(4.0, '*')\n apply_force(sep)\n apply_force(tar)\n if acc.x == 0 and acc.y == 0\n return\n else\n vel.add(acc)\n vel.limit(speed)\n end\n pos.add(vel)\n @x = pos.x\n @y = pos.y\n acc.scalar(0, '*')\n end", "def moveto(x, y)\r\r\n @x = x % $game_map.width\r\r\n @y = y % $game_map.height\r\r\n @real_x = @x\r\r\n @real_y = @y\r\r\n @prelock_direction = 0\r\r\n straighten\r\r\n update_bush_depth\r\r\n end", "def move\n @x += @vel_x\n @y += @vel_y\n @spin += @vel_spin\n end", "def turn_right\n if @@compass.index(@direction) == @@compass.length - 1\n @direction = @@compass[0]\n else\n current_index = @@compass.index(@direction)\n @direction = @@compass[current_index + 1]\n end\n end", "def move_to_right_of(node)\n self.move_to node, :right\n end", "def move_position\n @x += @velocity_x\n @y += @velocity_y\n end", "def move_to_right_of(node)\n move_to node, :right\n end", "def move_to_right_of(node)\n move_to node, :right\n end", "def move_to_right_of(node)\n move_to node, :right\n end", "def accelRight\n @vel_x += @VELOCITY\n end", "def move_rover()\n puts \"DEBUG: moving: #{@orientation}\" if DEBUG\n case @orientation\n when DIRECTION_EAST\n @position[:x] += 1 if @position[:x] < @map.width\n when DIRECTION_WEST\n @position[:x] -= 1 if @position[:x] > 0\n when DIRECTION_NORTH\n @position[:y] += 1 if @position[:y] < @map.height\n when DIRECTION_SOUTH\n @position[:y] -= 1 if @position[:y] > 0\n end\n puts \"DEBUG: position after move: #{@position}\" if DEBUG\n end", "def move( x, y=nil )\n self.dup.move!(x, y)\n end", "def move_to_right_of(node)\n self.move_to(node, :right)\n end", "def move x, y\n put x, y # FIXME\n end", "def move_toward_beeper()\n if front_is_clear?()\n move()\n else\n turn_left()\n end\n end", "def move_south\n @y -= 1\n end", "def move_friendly_piece(x,y)\n update_attributes(position_x: x, position_y: y)\n end", "def move_friendly_piece(x,y)\n update_attributes(position_x: x, position_y: y)\n end", "def moveto(x, y)\r\n @x = x % $game_map.width\r\n @y = y % $game_map.height\r\n @real_x = @x\r\n @real_y = @y\r\n @prelock_direction = 0\r\n straighten\r\n update_bush_depth\r\n end", "def move(distance)\n self.position -= distance\n ensure_bounds\n end", "def move_right(mat, y, x)\n return if (x + 1) > (mat.size - 1)\n\n zero_el = mat[y][x]\n other_el = mat[y][x + 1]\n mat[y][x + 1] = zero_el\n mat[y][x] = other_el\n\n { m: mat, zero: update_coordinates(zero_el, other_el), move: :right }\nend", "def move\n case @facing\n when \"north\"\n @posY += 1 if @posY+1 < @table.width\n when \"east\"\n @posX += 1 if @posX+1 < @table.height\n when \"south\"\n @posY -= 1 if @posY-1 >= 0\n when \"west\"\n @posX -= 1 if @posX-1 >= 0\n end\n end", "def turnRight\n case @currentDir\n when :north\n @currentDir = :east\n when :south\n @currentDir = :west\n when :east\n @currentDir = :south\n when :west\n @currentDir = :north\n end\n end", "def move!\n\t\tbounce! until !will_bounce? #TODO add surroundedness checking\n\t\t@x += @@target_coords[@direction][:dx]\n\t\t@y += @@target_coords[@direction][:dy]\n\tend", "def moving!\n end", "def turn_right\n index = DIRECTIONS.index(@facing)+1\n @facing = DIRECTIONS[index] || DIRECTIONS[0]\n end", "def move\n check_placed\n new_position = case facing\n when :north then @position.inc_y\n when :south then @position.dec_y\n when :east then @position.inc_x\n when :west then @position.dec_y\n end\n check_position(new_position)\n @position = new_position\n end", "def move\r\n # Move bullet fired by the Spaceship up the screen \r\n if @type == 'good'\r\n @y -= @SPEED\r\n # Move bullet fired by the Aliens down the screen \r\n elsif @type == 'evil'\r\n @y += @SPEED\r\n end\r\n end", "def right\n check_placed\n @facing = next_facing(+1)\n end", "def move_right(array)\r\n set_current_row_col(array)\r\n new_col = (@current_col == array.first.length - 1) ? 0 : @current_col + 1 # This logic will decide the new co-ordinated of space\r\n current_ele = array[@current_row][new_col]\r\n array[@current_row][new_col] = ' '\r\n replace_existing_element(array,current_ele, @current_row, @current_col)\r\n array\r\n end", "def move\n if @direction.north? then @y += 1\n elsif @direction.south? then @y -= 1\n elsif @direction.east? then @x += 1\n elsif @direction.west? then @x -= 1\n end\n return self\n end", "def move_left \r\n if @x - @vel_x > GAME_PRESET[\"player_move_left\"]\r\n @x -= @vel_x\r\n end\r\n end", "def move!(x,y)\n self[0]+=x; self[1]+=y\n return self\n end", "def move()\n case @mov_dir\n when :right\n if @coord_x == @max_x\n @max_x += 1 # Moving out of bounds. No need to do anything because Ruby rocks! :P\n end\n @coord_x += 1\n \n when :up\n if @coord_y == 0\n @map.unshift [] # Moving out of bounds. Adds a new line to the top\n @max_y += 1\n else\n @coord_y -= 1\n end\n \n when :down\n if @coord_y == @max_y\n @max_y += 1\n @map.push [] # Moving out of bounds. Adds a new line to the bottom\n end\n @coord_y += 1\n \n when :left\n if @coord_x == 0\n @map.each do |a| # Moving out of bounds. Adds a new line to the left\n a.unshift ' ' \n end\n @max_x += 1\n else\n @coord_x -= 1\n end\n end\n end", "def update_fall\n self.x += @direction\n self.y -= @speed\n @speed -= GRAVITY\n end", "def turn_right\n @orientation = CompassPoints::RIGHT_TURNS[@orientation] if placed?\n end" ]
[ "0.7360024", "0.6865995", "0.6825685", "0.68051517", "0.6802973", "0.6776518", "0.67689365", "0.67439413", "0.67415863", "0.6721613", "0.67200565", "0.67092615", "0.6702407", "0.6700961", "0.668674", "0.65932626", "0.6518812", "0.6516152", "0.64827204", "0.6449603", "0.6442801", "0.64410925", "0.64378405", "0.6436582", "0.64164454", "0.64148307", "0.6402851", "0.6386058", "0.6376469", "0.6363447", "0.6358567", "0.6358567", "0.6344281", "0.6336943", "0.6336943", "0.63367933", "0.63182056", "0.63094515", "0.6305656", "0.62959665", "0.62952864", "0.62686014", "0.62597024", "0.6259434", "0.6248183", "0.6241142", "0.6239162", "0.62309355", "0.6225505", "0.6219278", "0.62171876", "0.6203657", "0.62023085", "0.6193061", "0.6190449", "0.61804706", "0.6179097", "0.61716735", "0.61645174", "0.61596966", "0.6150118", "0.61499506", "0.6144758", "0.61442465", "0.61293477", "0.6124744", "0.6123666", "0.61196935", "0.6108264", "0.6107816", "0.610717", "0.610717", "0.610717", "0.61056393", "0.6100971", "0.61005336", "0.60893816", "0.6077604", "0.60674137", "0.6066969", "0.60636944", "0.60636944", "0.60589606", "0.6048826", "0.60485756", "0.6039998", "0.6028027", "0.60276985", "0.6022874", "0.6016225", "0.60133356", "0.60047024", "0.600119", "0.59983015", "0.5998284", "0.59981954", "0.59980917", "0.59968275", "0.59922373", "0.59908354" ]
0.7194565
1
Move the Space Ship forward
def move_up if @y + @vel_y > GAME_PRESET["player_move_up"] @y -= @vel_y end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_forward\n\t\tnew_position = forward_position\n\t\t@x = new_position[0]\n\t\t@y = new_position[1]\n\tend", "def forward_move\n case @facing\n when 'NORTH'\n @y += 1\n when 'SOUTH'\n @y -= 1\n when 'EAST'\n @x += 1\n when 'WEST'\n @x -= 1\n end\n self\n end", "def move\n # Stores change in x and y position based off of vel and current x,y\n newX = @x + @vel_x\n newY = @y + @vel_y\n # Prevents ship from exiting bounds in x along the ship's edge\n if newX >= @image.width and newX <= @window.width-@image.width then\n @x += @vel_x\n end\n # Prevents ship from exiting bounds in y along the ship's edge\n if newY >= @image.height and newY <= @window.height-@image.height then\n @y += @vel_y\n end\n # Slows down the ship if no new input is given\n # Lower values for tighter controls\n @vel_x *= 0.50\n @vel_y *= 0.50\n end", "def update\n space.fall(self) if should_fall?\n move\n end", "def move_forward\n self.velocity_x = Gosu::offset_x(self.angle, 0.5)*self.max_velocity_x\n self.velocity_y = Gosu::offset_y(self.angle, 0.5)*self.max_velocity_y\n end", "def move\n #we're modifying the ship's coordinates based on the velocity calculated in the accelerate method (which is called when we hit 'Up')\n @x += @velocity_x\n @y += @velocity_y\n #we use these to slow down the speed, acting like a friction\n #calculates the rate of acceleration \n @velocity_x *= FRICTION\n @velocity_y *= FRICTION\n # we add conditionals to delimt the edge of the window\n if @x > @window.width - @radius\n @velocity_x = 0\n @x = @window.width - @radius \n end\n if @x < @radius\n @velocity_x = 0\n @x = @radius\n end\n if @y > @window.height - @radius\n @velocity_y = 0\n @y = @window.height - @radius\n end\n end", "def move \n\n # If we've reached the end of our path, not much to do\n if @path_step >= @path.length\n return\n end\n\n # So, just set the destination to the next step on the path and let the base\n # ship movement handle it\n @dest_x = @path[@path_step][0]\n @dest_y = @path[@path_step][1]\n super\n\n # Now just check to see if we've reached the target - if so, move on to the next\n # step on the path\n if ( @x == @path[@path_step][0] ) && ( @y == @path[@path_step][1] )\n @path_step += 1\n end\n\n end", "def move_forward\n raise 'Это последняя станция' if @stations[@index + 1].nil?\n\n @stations[@index].departure(self)\n @index += 1\n @current_station = @stations[@index]\n @stations[@index].arrival(self)\n end", "def move_forward\n new_location = @location + facing_direction.coordinate_component\n \n if !surface.within_bounds?(new_location)\n raise OutOfBoundaryError, \"The movement has put the robot out of boundaries\"\n end\n \n @location = new_location\n self\n end", "def move(forward)\n moves = [0, forward ? 1 : -1]\n moves.reverse! if @hor\n new_coord = @coord.add(moves + moves)\n set!(new_coord[0], new_coord[1], @hor)\n end", "def move!\n\t\tbounce! until !will_bounce? #TODO add surroundedness checking\n\t\t@x += @@target_coords[@direction][:dx]\n\t\t@y += @@target_coords[@direction][:dy]\n\tend", "def move\n\t\t@x += 0\n\t\t@y += @vel\n\tend", "def move\n\n end", "def move_forward\n case @orientation\n when :north\n @position.y_coordinate += 1\n when :east\n @position.x_coordinate += 1\n when :south\n @position.y_coordinate -= 1\n when :west\n @position.x_coordinate -= 1\n end\n end", "def move\n \n end", "def move\n \n end", "def move_forward\n case @direction\n when 2\n move_down(false)\n when 4\n move_left(false)\n when 6\n move_right(false)\n when 8\n move_up(false)\n end\n end", "def move(direction)\n \n end", "def moving!\n end", "def move; end", "def move; end", "def forward(steps)\n move(steps)\n end", "def move_forward\r\r\n @move_poll+= [[@direction, true]] * (32.0 / CXJ::FREE_MOVEMENT::PIXELS_PER_STEP).ceil\r\r\n end", "def moveForward\n case @currentDir\n when :north\n incrementY\n when :south\n decrementY\n when :east\n incrementX\n when :west\n decrementX\n end\n\n #if new current position has obstacle, move back and report it\n if @grid.obstacles.include?(@currentPos)\n puts \"Cannot move forward. Obstacle present ahead at (#{@currentPos.x}, #{@currentPos.y})\"\n moveBackward\n return false\n end\n\n true\n end", "def forward\n\n\t\t#Could use case statement here\n\t\t# case (@angle.abs % 360)\n\t\t# \twhen 0 then x = @x + 1\n\t\t# \tetc...\n\t\t# end\n\n\t\t#Get new x\n\t\tx = @x + Math.cos(@angle * (Math::PI / 180)).round\n\n\t\t#Get new y\n\t\ty = @y + Math.sin(@angle * (Math::PI / 180)).round\n\n\t\t# This should perhaps be tested in the command method after each command\n\t\tif !isLostPoint(x, y) and !isLost(x, y) then\n\t\t\t@x = x\n\t\t\t@y = y\n\t\tend\n\n\tend", "def move\n @position.shift unless @growing\n case @direction\n when 'down'\n @position.push(new_coords(head[0], head[1] + 1))\n when 'up'\n @position.push(new_coords(head[0], head[1] - 1))\n when 'left'\n @position.push(new_coords(head[0] - 1, head[1]))\n when 'right'\n @position.push(new_coords(head[0] + 1, head[1]))\n end\n @growing = @turned = false\n end", "def update\n accelerate(0, 1) if should_fall?\n move\n end", "def move\n return unless placed?\n # no need to use a loop since the length is only 2\n new_x = @pos_x + @direction[:x]\n new_y = @pos_y + @direction[:y]\n\n return unless valid_position?(new_x, new_y)\n set_position(new_x, new_y)\n end", "def move(direction)\n @old = @pos\n @pos += direction\n end", "def move\n move_by get_incremental_position_for_velocity if (any_velocity?)\n decrease_velocity\n @has_increased_velocity_for = {\n x: false,\n y: false\n }\n @velocity_deltatime.update\n end", "def move\n check_placement\n\n new_position = make_move(current_position, direction)\n position(new_position[0], new_position[1], @table.size)\n end", "def move\n\t\t# move 5px to the left\n\t @x = @x - 5\n\t # move up or down based on the Y velocity\n\t @y = @y + @vy\n\tend", "def move_forward\n position.depart_train(self)\n @current_station += 1 if @route.stations[@current_station] != @route.stations.last\n position.add_train(self)\n end", "def move\n\t\tif valid_move?\n\t\t\tputs \"\"\n\t\t\tif OS.mac?\n\t\t\t\tcmd = ('say \"roger-roger\"')\n\t\t\t\tsystem cmd\n\t\t\tend\n\t\t\tputs \"Roger, roger I\\'m moving forward one field!\"\n\t\t\tcase @robot_direction\n\t\t\twhen \"EAST\" then @x += 1\n\t\t\twhen \"WEST\" then @x -= 1\n\t\t\twhen \"NORTH\" then @y += 1\n\t\t\twhen \"SOUTH\" then @y -= 1\n\t\t\tend\n\t\telse\n puts \"This is the end of this world and I can't go further in this direction, please change direction\"\n\t\tend\n\tend", "def move!\n case @facing\n when Direction::NORTH\n @loc[:y] += 1 unless out_of_bounds? @loc[:x], @loc[:y] + 1\n when Direction::EAST\n @loc[:x] += 1 unless out_of_bounds? @loc[:x] + 1, @loc[:y]\n when Direction::SOUTH\n @loc[:y] -= 1 unless out_of_bounds? @loc[:x], @loc[:y] - 1\n when Direction::WEST\n @loc[:x] -= 1 unless out_of_bounds? @loc[:x] - 1, @loc[:y]\n else\n raise %q{Don't know which direction to move}\n end\n end", "def move\n check_placed\n new_position = case facing\n when :north then @position.inc_y\n when :south then @position.dec_y\n when :east then @position.inc_x\n when :west then @position.dec_y\n end\n check_position(new_position)\n @position = new_position\n end", "def move_position\n @x += @velocity_x\n @y += @velocity_y\n end", "def move_forward(count)\n old_position = position\n\n if facing > 0 and facing < 180\n @x += count\n elsif facing > 180\n @x -= count\n end\n\n if facing > 90 and facing < 270\n @y += count\n elsif facing > 270 or facing < 90\n @y -= count\n end\n draw_line(old_position, position)\n end", "def move(y, x)\n update(y, x)\n apply_pos\n end", "def move(player, x, y)\n\n end", "def move_left\n # @dx = -8\n @x -= 8\n end", "def move\r\n @x += @x_direction\r\n @y += @y_direction\r\n # Preventing the Alien moving out of the screen\r\n if @x > (SCREEN_WIDTH - GAME_PRESET[\"alien_reach\"]) || @x < 0\r\n @x_direction= -@x_direction\r\n elsif @y > (SCREEN_HEIGHT * @height_limit)\r\n @y_direction = 0\r\n end\r\n end", "def move(direction)\n @position += direction\n end", "def move(x,y)\n @x +=x\n @y +=y\n end", "def move\n\t\tif @direction == \"N\"\n\t\t\t@y += 1\n\t\telsif @direction == \"W\"\n\t\t\t@x -= 1\n\t\telsif @direction == \"E\"\n\t\t\t@x += 1\n\t\telsif @direction == \"S\"\n\t\t\t@y -= 1\n\t\tend\n\tend", "def move(direction)\n @x += @velocity if direction == :right\n @x -= @velocity if direction == :left\n end", "def move\n if $window.button_down?(Gosu::KbD)\n @facing = :right\n @x += speed unless out_of_bounds?(@x + speed, @y)\n end\n \n if $window.button_down?(Gosu::KbA)\n @facing = :left\n @x -= speed unless out_of_bounds?(@x - speed, @y)\n end\n \n if $window.button_down?(Gosu::KbW)\n @facing = :up\n @y -= speed unless out_of_bounds?(@x, @y - speed)\n end\n \n if $window.button_down?(Gosu::KbS)\n @facing = :down\n @y += speed unless out_of_bounds?(@x, @y + speed)\n end\n \n sprinting?\n end", "def move\n if @placed\n position = @face.move(@x, @y)\n x = position[0]\n y = position[1]\n if @table.validate(x, y)\n @x = x\n @y = y\n end\n end\n end", "def change_direction\n @move_x = -@move_x\n @speed = -@speed\n end", "def move\r\n # Move bullet fired by the Spaceship up the screen \r\n if @type == 'good'\r\n @y -= @SPEED\r\n # Move bullet fired by the Aliens down the screen \r\n elsif @type == 'evil'\r\n @y += @SPEED\r\n end\r\n end", "def move_by_route(forward = true)\n return unless exist_train_route?\n depart_from_station\n\n train_start_speed_kmh = 5\n train_regular_speed_kmh = 60\n\n move train_start_speed_kmh\n move train_regular_speed_kmh\n move train_start_speed_kmh\n\n arrive_to_station forward\n brake\n end", "def move_towards(x,y,speed)\n dx = x-@x\n dy = y-@y\n\n norm = Math.sqrt( dx*dx+dy*dy )\n\n if norm < speed || norm < 1\n self.set_pos(x,y)\n return true\n end\n\n #self.look_towards(x, y)\n self.move_pos(dx*(speed/norm),dy*(speed/norm))\n\n return false\n end", "def move(space)\n @board.move(@current_player, space)\n @state = \n if @board.winning?\n :win\n elsif @board.full?\n :draw\n else\n @current_player = @current_player.opponent\n :continue\n end\n rescue InvalidSpaceException\n :continue\n end", "def move\n # Force evaluation of both update_x and update_y (no short-circuit)\n # If we're moving faster horizontally, do that first\n # Otherwise do the vertical move first\n moved = @space.process_moving_entity(self) do\n if @x_vel.abs > @y_vel.abs then move_x; move_y\n else move_y; move_x\n end\n end\n\n # Didn't move? Might be time to go to sleep\n if !moved && sleep_now?\n puts \"#{self} going to sleep...\"\n @moving = false\n end\n end", "def move\n # Force evaluation of both update_x and update_y (no short-circuit)\n # If we're moving faster horizontally, do that first\n # Otherwise do the vertical move first\n moved = @space.process_moving_entity(self) do\n if @x_vel.abs > @y_vel.abs then move_x; move_y\n else move_y; move_x\n end\n end\n\n # Didn't move? Might be time to go to sleep\n @moving = false if !moved && sleep_now?\n\n moved\n end", "def move\n @leading_x = coordinate_array[0]\n @leading_y = coordinate_array[1]\n end", "def move(x, y)\n if y != 0\n @y += y\n bounce if game_state.first_terrain_collision(self)\n end\n \n if x != 0\n @x += x\n turn if game_state.first_terrain_collision(self)\n end\n end", "def move(x,y=@y)\r\n @x2=x+(@x2-@x1)\r\n @y2=y+(@y2-@y1)\r\n @y1=y\r\n @x1=x\r\n end", "def move\n case @rover_facing\n when 'N'\n @coordinates[1] += 1\n when 'E'\n @coordinates[0] += 1\n when 'S'\n @coordinates[1] -= 1\n when 'W'\n @coordinates[0] -= 1\n end\n end", "def move(distance)\n self.position -= distance\n ensure_bounds\n end", "def move_to(x, y); end", "def move\n if !destination.alive\n Game.scene.remove_object self\n else\n d_x, d_y = *destination.position\n b_x, b_y = *position\n \n if d_x.round == b_x.round and d_y.round == b_y.round\n finished\n else\n vlen = Math.sqrt((d_x - b_x)*(d_x - b_x) + (d_y - b_y)*(d_y - b_y))\n\t \n\t m_x = (d_x - b_x)*speed/vlen\n\t m_y = (d_y - b_y)*speed/vlen\n\t \n\t position[0] += m_x\n\t position[1] += m_y\n end\n end\n end", "def move(x, y)\n (x < 0 ? backward(-x) : (x > 0 ? forward(x) : '')) +\n (y < 0 ? down(-y) : (y > 0 ? up(y) : ''))\n end", "def move_to(x, y, speed = 2)\n @new_x = x\n @new_y = y\n @speed = speed\n end", "def move\n @route.stations[@index_current_station].recieve_train(self)\n @route.stations[@index_current_station - 1].send_train(self)\n end", "def update_move\n if !@ch.moving? && @moves.size > 0\n @moves.shift if proccess_move(@moves[0])\n end\n end", "def move\n return false unless on_the_table?\n\n next_x, next_y = facing.next_move_position(x, y)\n unless falls_off?(next_x, next_y)\n self.x = next_x\n self.y = next_y\n true\n else\n false\n end\n end", "def move\n @x += @vel_x\n @y += @vel_y\n @spin += @vel_spin\n end", "def standard_move\n pos.set(x,y)\n tar = move_towards_player\n sep = seperate_from_enemies\n sep.scalar(5.5, '*')\n tar.scalar(4.0, '*')\n apply_force(sep)\n apply_force(tar)\n if acc.x == 0 and acc.y == 0\n return\n else\n vel.add(acc)\n vel.limit(speed)\n end\n pos.add(vel)\n @x = pos.x\n @y = pos.y\n acc.scalar(0, '*')\n end", "def forward\n direction(:forward)\n end", "def update_move\n self.x = screen_x\n self.y = screen_y\n update_move_arch if @type == Arched\n end", "def move\n\t\t'moved passed'\n\tend", "def move\n case @direction\n when \"N\"\n @y_coord += 1\n when \"S\"\n @y_coord -= 1\n when \"W\"\n @x_coord += 1\n when \"E\"\n @x_coord -= 1\n end\n end", "def move(x,y)\n self.dup.move!(x,y)\n end", "def move_to!(x, y, z)\n #f = front\n #re = rear\n #t = top\n #b = bottom\n #l = left\n #r = right\n\n ## since the (ftl) front top left facing side's vertex is always\n ## the origin with my implementation, I am able to simply\n ## define the new origin and I am able to move the whole\n ## object with just two lines of code\n\n self.origin[0], self.origin[1], self.origin[2] = x, y, z\n self\n\n end", "def move_to(x, y, nb_frame)\n @moving = true\n @move_frame = nb_frame\n @move_total = nb_frame\n @new_x = x\n @new_y = y\n @del_x = self.x - x\n @del_y = self.y - y\n end", "def move\n move_by a, m\n end", "def moveto(x, y)\r\r\n @x = x % $game_map.width\r\r\n @y = y % $game_map.height\r\r\n @real_x = @x\r\r\n @real_y = @y\r\r\n @prelock_direction = 0\r\r\n straighten\r\r\n update_bush_depth\r\r\n end", "def move(x, y, speed = 1, delay = 0)\n @destx = x\n @desty = y\n @move_speed = speed\n @move_delay = delay\n @move_old = Graphics.frame_count\n @moving = true\nend", "def move_to!(x, y, z)\n @origin_x = x\n @origin_y = y\n @origin_z = z\n end", "def move_west\n @x -= 1\n end", "def move(forward)\n if @direction == \"N\"\n if @y + 1 < @@ymax\n @y += 1\n else\n puts \"Nice try sucker\"\n end\n elsif @direction == \"S\"\n if @y - 1 > @@ymin\n @y -= 1\n else\n puts \"Nice try sucker\"\n end\n elsif @direction ==\"E\"\n if @x + 1 < @@xmax\n @x += 1\n else\n puts \"Nice try sucker\"\n end\n elsif @direction == \"W\"\n if @x - 1 > @@xmin\n @x -= 1\n else\n puts \"Nice try sucker\"\n end\n else\n puts \"Where in the world are you?\"\n end\nend", "def moveLeft(dist)\n @body.p.x -= dist\n end", "def move\n puts \"The computer is playing...\".cyan\n sleep(0.5) #computer \"thinks\" for half a second, this seemed more realistic\n return if @game.game_over?\n space = (@game.available_moves & [1,3,5,7,9]).first\n if space.nil? \n space = @game.available_moves.first\n end\n @game.place_piece(space, @piece)\n end", "def move(x, y)\n State.new(@x + x, @y + y, @distance + 1)\n end", "def position_for_next_harvest()\n turn_right()\n move()\n turn_right()\n end", "def move\n @positions.shift\n case @direction\n when 'down'\n @positions.push(new_coords(head[0], head[1] + 1))\n when 'up'\n @positions.push(new_coords(head[0], head[1] - 1))\n when 'left'\n @positions.push(new_coords(head[0] - 1, head[1]))\n when 'right'\n @positions.push(new_coords(head[0] + 1, head[1]))\n end\n end", "def move_straight(step, x)\n comp(:position).add!(x * step)\n on_move\n end", "def go!\n send_position_to_engine\n move_piece(bestmove)\n end", "def move\n @speed = map1d(total_count, (5..25), (0.1..0.4))\n @speed = (0..10.0).clip speed\n @position[Y] += speed\n @position[Y] = -height if position[Y] > height * 2\n end", "def move x, y\n put x, y # FIXME\n end", "def moves\n\n end", "def moveto(x, y)\r\n @x = x % $game_map.width\r\n @y = y % $game_map.height\r\n @real_x = @x\r\n @real_y = @y\r\n @prelock_direction = 0\r\n straighten\r\n update_bush_depth\r\n end", "def move_by_input\r\r\n return if !movable? || $game_map.interpreter.running?\r\r\n if CXJ::FREE_MOVEMENT::ENABLE_DIAGONAL && Input.dir8 > 0 && Input.dir8 % 2 != 0\r\r\n d = Input.dir8\r\r\n horz = (d == 1 || d == 7 ? 4 : 6)\r\r\n vert = (d == 1 || d == 3 ? 2 : 8)\r\r\n move_diagonal(horz, vert)\r\r\n elsif Input.dir4 > 0\r\r\n move_straight(Input.dir4)\r\r\n end\r\r\n end", "def move( x, y=nil )\n self.dup.move!(x, y)\n end", "def move\n if @x + @x_vel < 0\n net_move = (-2 * @x) - @x_vel\n @x += net_move\n @truex += net_move\n @x_vel = -@x_vel\n elsif @x + @x_vel > (1280 - @w)\n net_move = (2 * (1280 - @w - @x)) - @x_vel \n @x += net_move\n @truex += net_move\n @x_vel = -@x_vel\n else\n @truex += @x_vel\n @x += @x_vel\n end\n\n if @y + @y_vel < 0\n net_move = (-2 * @y) - @y_vel\n @y += net_move\n @truey += net_move\n @y_vel = -@y_vel\n elsif @y + @y_vel > (720 - @h)\n net_move = (2 * (720 - @h - @y)) - @y_vel \n @y += net_move\n @truey += net_move\n @y_vel = -@y_vel\n else\n @truey += @y_vel\n @y += @y_vel\n end\n end", "def move!(x,y)\n self[0]+=x; self[1]+=y\n return self\n end", "def look_forwards()\n if enemy_check?\n @warrior.shoot! @movement_direction\n else\n check_forwards\n end\n end", "def move\n case @status\n when Dead\n @position += @direction * DeadFishFloatSpeed\n when Idle\n coin = rand(1000.0)\n if coin <= (@direction_change_factor/1000)\n turn = rand(10)\n setup_turn(Turning,turn)\n else\n @position += @direction * @speed\n end\n when Avoiding\n self.turn\n when Turning \n self.turn\n when Pursuing\n speed = \n case @target.type\n when Food\n 5*@speed\n when Salmon\n 2*@speed\n when Shark\n 4*@speed\n end\n @position += @direction * speed\n end\n @position = Position.new(@position.a)\n # update the state of the fish:\n @virility += (@virility >= 9999) ? 1 : 0 \n health_to_subtract = (rand>(@resilience/10.0)) ? 1 : 0\n @health -= health_to_subtract\n @age += (rand<0.2) ? 1 : 0\n self.die if @health<=0 or @age >= MaxAge\n end", "def ship; end", "def move_toward_beeper()\n if front_is_clear?()\n move()\n else\n turn_left()\n end\n end" ]
[ "0.7481864", "0.7349816", "0.7052332", "0.69652635", "0.6963785", "0.69612134", "0.68935484", "0.68801934", "0.6859657", "0.68236697", "0.6786813", "0.6786297", "0.6720608", "0.67092246", "0.6695535", "0.6695535", "0.6674765", "0.667008", "0.663291", "0.6623445", "0.6623445", "0.6587351", "0.6579004", "0.6550592", "0.6548627", "0.6504927", "0.6491745", "0.64673656", "0.6442562", "0.6435157", "0.6419932", "0.64053863", "0.6393686", "0.63794917", "0.6360302", "0.6313546", "0.63132226", "0.6312013", "0.6293314", "0.6258238", "0.62462544", "0.6234002", "0.6230184", "0.6219105", "0.61978304", "0.6181589", "0.6181021", "0.6169404", "0.6157827", "0.6145208", "0.6141075", "0.61360365", "0.61355233", "0.6128139", "0.61135685", "0.6103655", "0.60986066", "0.6087745", "0.608042", "0.60790175", "0.6076025", "0.6065577", "0.60642946", "0.60608304", "0.6060009", "0.6057814", "0.6055569", "0.6052356", "0.6039466", "0.60386413", "0.60337317", "0.6028169", "0.60237235", "0.6006641", "0.5997523", "0.5997029", "0.599647", "0.59886825", "0.59871095", "0.5980589", "0.5975246", "0.5972836", "0.596177", "0.59613174", "0.59598273", "0.59586877", "0.59485716", "0.59440285", "0.59431046", "0.5931356", "0.59278053", "0.59269994", "0.5919731", "0.5917249", "0.5915414", "0.59135884", "0.5908436", "0.5904745", "0.59008056", "0.58985144", "0.58898795" ]
0.0
-1
Move the Space Ship backwards
def move_down if @y + @vel_y < SCREEN_HEIGHT - GAME_PRESET["player_move_down"] @y += @vel_y end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_backward\r\r\n last_direction_fix = @direction_fix\r\r\n @direction_fix = true\r\r\n @move_poll+= [[reverse_dir(@direction), false]] * (32.0 / CXJ::FREE_MOVEMENT::PIXELS_PER_STEP).ceil\r\r\n @direction_fix = last_direction_fix\r\r\n end", "def shrink_ship\n @length -= 1\n end", "def move_higher\n movement { self.position -= 1 }\n end", "def update\n space.fall(self) if should_fall?\n move\n end", "def back(steps)\n move(-steps)\n end", "def move_down\n\t\tmove([0,1])\n\tend", "def moveBackward\n case @currentDir\n when :north\n decrementY\n when :south\n incrementY\n when :east\n decrementX\n when :west\n incrementX\n end\n\n #if new current position has obstacle, move back and report it\n if @grid.obstacles.include?(@currentPos)\n puts \"Cannot move backward. Obstacle present behind at (#{@currentPos.x}, #{@currentPos.y})\"\n moveForward\n return false\n end\n\n true\n end", "def unmove\n\t\t@board[@movelist.pop] = \"-\"\n\t\t@turn = other_turn\n\t\tself\n\tend", "def move_backward\n last_direction_fix = @direction_fix\n @direction_fix = true\n case @direction\n when 2 # 下\n move_up(false)\n when 4 # 左\n move_right(false)\n when 6 # 右\n move_left(false)\n when 8 # 上\n move_down(false)\n end\n @direction_fix = last_direction_fix\n end", "def move_south\n @y -= 1\n end", "def move_west\n @x -= 1\n end", "def backward\n direction(:backward)\n end", "def move_down\n down_tile = C[@location.first + 1, @location.second]\n move_to(down_tile)\n end", "def forward_move\n case @facing\n when 'NORTH'\n @y += 1\n when 'SOUTH'\n @y -= 1\n when 'EAST'\n @x += 1\n when 'WEST'\n @x -= 1\n end\n self\n end", "def retreat()\r\n @warrior.walk!:backward\r\n end", "def retreat()\r\n @warrior.walk!:backward\r\n end", "def move_down\n down_tile = Couple.new(@location.first + 1, @location.second)\n move_to(down_tile)\n end", "def move_back\n position.depart_train(self)\n @current_station -= 1 if @route.stations[@current_station] != @route.stations.first\n position.add_train(self)\n end", "def move_down(n)\n self.y -= n\n end", "def change_direction\n @move_x = -@move_x\n @speed = -@speed\n end", "def move(x,y)\n self.dup.move!(x,y)\n end", "def move!(end_pos)\n board.remove_piece(pos)\n\n if (pos[0] - end_pos[0]).abs == 2\n board.remove_piece(jumped_place(end_pos))\n end\n\n self.pos = end_pos\n board.place_piece(self, end_pos)\n\n maybe_promote\n end", "def move_down( index )\r\n if index == @deck.length - 1\r\n @deck[1..1] = @deck[index], @deck[1]\r\n @deck.pop\r\n else\r\n @deck[index], @deck[index + 1] = @deck[index + 1], @deck[index]\r\n end\r\n end", "def flip\n Loc.new(@y,@x)\n end", "def move\n\n end", "def move_away_from_player\n move_away_from_character($game_player)\n end", "def reverse!\n @direction = - @direction\n self\n end", "def move_piece_back\n @chess_board.board[@row][@col] = @chess_board.board[@row_new][@col_new]\n end", "def move; end", "def move; end", "def move_up\n\t\tunless @y_player <= 0\n\t\t\t@y_player -= 4\n\t\tend\n\tend", "def turn\n @delta.x = -@delta.x\n @delta.y = -@delta.y\n end", "def move_toward_beeper()\n if front_is_clear?()\n move()\n else\n turn_left()\n end\n end", "def move\n \n end", "def move\n \n end", "def move_down\n return if at_bottom?\n self.class.where(:position => self.position + 1).first.inc(:position, -1)\n inc(:position, 1)\n end", "def decrementY\n @currentPos.y -= 1\n if @currentPos.y < @grid.minY\n @currentPos.y = @grid.maxY\n end\n end", "def test_backward\n rover = MarsRover.new(0,1,'N')\n rover.command('B')\n assert_equal([0,0,'N'], rover.position)\n end", "def move(distance)\n self.position -= distance\n ensure_bounds\n end", "def backward\n if self.route_check_true\n if @current_station != @route.stations.first\n @route.stations[@route.stations.index(@current_station)].departure(self)\n @current_station = previous_station\n @route.stations[@route.stations.index(@current_station)].coming(self)\n end\n end\n end", "def move( x, y=nil )\n self.dup.move!(x, y)\n end", "def move_down\n\t\t@y_speed += @speed_inc_step\n\t\tif @y_speed > @max_speed\n\t\t\t@y_speed = @max_speed\n\t\tend\n\n\t\tupdate_y(@y_speed)\n\n\t\trotation = (face_left?) ? -@rotation_speed : @rotation_speed\n\t\tif (face_left? && @angle <= 90 + @rotation_speed) ||\n\t\t\t(!face_left? && @angle >= 90 - @rotation_speed)\n\t\t\t\n\t\t\tupdate_angle(90)\n\t\telse\n\t\t\tupdate_angle(calculate_angle(rotation))\n\t\tend\n\n\t\t@has_moved = @player_moved = @moved_y_axis = true\n\tend", "def reverse\n @x = -@x\n @y = -@y\n self\n end", "def moving!\n end", "def move\n # Stores change in x and y position based off of vel and current x,y\n newX = @x + @vel_x\n newY = @y + @vel_y\n # Prevents ship from exiting bounds in x along the ship's edge\n if newX >= @image.width and newX <= @window.width-@image.width then\n @x += @vel_x\n end\n # Prevents ship from exiting bounds in y along the ship's edge\n if newY >= @image.height and newY <= @window.height-@image.height then\n @y += @vel_y\n end\n # Slows down the ship if no new input is given\n # Lower values for tighter controls\n @vel_x *= 0.50\n @vel_y *= 0.50\n end", "def move_left\n # @dx = -8\n @x -= 8\n end", "def back(steps)\n forward(-steps)\n end", "def reverse!\n @upwards = !@upwards\n skip!(2)\n end", "def move(direction)\n \n end", "def back(steps)\n forward(-steps)\n end", "def move_backward(n); print \"\\e[#{n}D\" end", "def move_forward\n\t\tnew_position = forward_position\n\t\t@x = new_position[0]\n\t\t@y = new_position[1]\n\tend", "def backward(pasos)\t\n\t\tif pasos < 0\n\t\t\tself.forward(pasos.abs)\n\t\telse\n\t\t\tself.rotatel(180)\n\t\t\tself.forward(pasos)\n\t\t\tself.rotatel(180)\n\t\tend\n\tend", "def move_upper_right\n unless @direction_fix\n @direction = (@direction == 4 ? 6 : @direction == 2 ? 8 : @direction)\n end\n if (passable?(@x, @y, 8) && passable?(@x, @y - 1, 6)) ||\n (passable?(@x, @y, 6) && passable?(@x + 1, @y, 8))\n move_follower_to_character\n @x += 1\n @y -= 1\n if @follower && $game_variables[Yuki::Var::FM_Sel_Foll] == 0\n @memorized_move = :move_upper_right\n @follower.direction = @direction\n end\n movement_process_end(true)\n increase_steps\n end\n end", "def move_down(environment)\n @previous_action = 'moved down'\n location[:y] += 1 if can_move_down?(environment)\n environment.state\n end", "def pedestal(view, time)\n direction = Geom::Vector3d.new(0,0,1)\n direction.reverse! if( (@keys & DOWN_ARROW) != 0 )\n self.move(view, time, direction, @speedy)\nend", "def decrementX\n @currentPos.x -= 1\n if @currentPos.x < @grid.minX\n @currentPos.x = @grid.maxX\n end\n end", "def move_upper_left\n unless @direction_fix\n @direction = (@direction == 6 ? 4 : @direction == 2 ? 8 : @direction)\n end\n if (passable?(@x, @y, 8) && passable?(@x, @y - 1, 4)) ||\n (passable?(@x, @y, 4) && passable?(@x - 1, @y, 8))\n move_follower_to_character\n @x -= 1\n @y -= 1\n if @follower && $game_variables[Yuki::Var::FM_Sel_Foll] == 0\n @memorized_move = :move_upper_left\n @follower.direction = @direction\n end\n movement_process_end(true)\n increase_steps\n end\n end", "def moveto(x, y)\n super(x, y)\n @move_update.clear\n end", "def move(x, y)\n (x < 0 ? backward(-x) : (x > 0 ? forward(x) : '')) +\n (y < 0 ? down(-y) : (y > 0 ? up(y) : ''))\n end", "def move_forward\n raise 'Это последняя станция' if @stations[@index + 1].nil?\n\n @stations[@index].departure(self)\n @index += 1\n @current_station = @stations[@index]\n @stations[@index].arrival(self)\n end", "def move \n\n # If we've reached the end of our path, not much to do\n if @path_step >= @path.length\n return\n end\n\n # So, just set the destination to the next step on the path and let the base\n # ship movement handle it\n @dest_x = @path[@path_step][0]\n @dest_y = @path[@path_step][1]\n super\n\n # Now just check to see if we've reached the target - if so, move on to the next\n # step on the path\n if ( @x == @path[@path_step][0] ) && ( @y == @path[@path_step][1] )\n @path_step += 1\n end\n\n end", "def update_fall\n self.x += @direction\n self.y -= @speed\n @speed -= GRAVITY\n end", "def move_down(array)\r\n set_current_row_col(array)\r\n new_row = @current_row == array.length - 1 ? 0 : @current_row + 1 # This logic will decide the new co-ordinated of space\r\n current_ele = array[new_row][@current_col]\r\n array[new_row][@current_col] = ' '\r\n replace_existing_element(array,current_ele, @current_row, @current_col)\r\n array\r\n end", "def move_down_right\n i = 1\n until false\n x, y = @pos\n x += i\n y += i\n pos = [x, y]\n break if x > 7 || x < 0 || y > 7 || y < 0 || @board[pos].color == @color\n @moves << pos\n break if @board[pos].color != @color\n i += 1\n end\n end", "def slide_move!(end_pos)\n board[end_pos] = self\n board.set_to_empty(self.pos)\n self.pos = end_pos\n end", "def move_right\n\t\tmove([1,0])\n\tend", "def move_B\r\n 2.times { move_down( @deck.index( 'B' ) ) }\r\n end", "def rolldown\n\t\t\tpush [:swap]\n\t\t\tdip\n\t\t\tswap\n\t\tend", "def decrease_spaces()\n @spaces -= 1\n end", "def back_wall\n if @reached_back_wall\n @movement_direction = @directions.fetch(\"forward\")\n else\n @movement_direction = @directions.fetch(\"backward\")\n end\n end", "def moveUpAndDown(dis)\n vector = getCurrentDirection\n vector.length = dis\n moveTransformation = Geom::Transformation.translation(vector)\n @@componentInstance.transform! moveTransformation\n updateAvatarLocation\n updateTransformation\n updateViewPort\n\n \n\n end", "def move\n\t\tif @direction == \"N\"\n\t\t\t@y += 1\n\t\telsif @direction == \"W\"\n\t\t\t@x -= 1\n\t\telsif @direction == \"E\"\n\t\t\t@x += 1\n\t\telsif @direction == \"S\"\n\t\t\t@y -= 1\n\t\tend\n\tend", "def check_backwards()\n if !(@warrior.feel(@movement_direction).wall?) && !(@reached_back_wall)\n if !@warrior.feel(@movement_direction).empty?\n if !@warrior.feel(@movement_direction).captive?\n @warrior.attack! @movement_direction\n else\n @warrior.rescue! @movement_direction\n end\n else\n @warrior.walk! @movement_direction\n end\n else\n @reached_back_wall = true\n change_direction\n\n look_forwards\n @health = @warrior.health\n end\n end", "def reverse_hypo_move(original_coords, test_coords)\n @board[original_coords[0]][original_coords[1]] = @board[test_coords[0]][test_coords[1]]\n @board[test_coords[0]][test_coords[1]] = @piece_purgatory\n @piece_purgatory = nil\n end", "def turn_away_from_xy(x, y)\n sx = distance_x_from(x)\n sy = distance_y_from(y)\n if sx.abs > sy.abs\n set_direction(sx > 0 ? 6 : 4)\n elsif sy != 0\n set_direction(sy > 0 ? 2 : 8)\n end\n end", "def move_right\n @board.each(&:reverse!)\n action = move_left\n @board.each(&:reverse!)\n action\n end", "def move_forward\n self.velocity_x = Gosu::offset_x(self.angle, 0.5)*self.max_velocity_x\n self.velocity_y = Gosu::offset_y(self.angle, 0.5)*self.max_velocity_y\n end", "def decrement_position\n # return unless in_list?\n update_attribute position_column, self.send(position_column).to_i - 1\n end", "def update\n accelerate(0, 1) if should_fall?\n move\n end", "def bounce_off_paddle\n if @velocity_y > 0 \n change_direction(:y) \n end\n end", "def ship; end", "def turn_away_from_character(character)\n sx = distance_x_from(character.x)\n sy = distance_y_from(character.y)\n if sx.abs > sy.abs\n set_direction(sx > 0 ? 6 : 4)\n elsif sy != 0\n set_direction(sy > 0 ? 2 : 8)\n end\n end", "def undo\n\t\t@moves.undo\n\tend", "def moveto(x, y)\r\r\n @x = x % $game_map.width\r\r\n @y = y % $game_map.height\r\r\n @real_x = @x\r\r\n @real_y = @y\r\r\n @prelock_direction = 0\r\r\n straighten\r\r\n update_bush_depth\r\r\n end", "def move(x,y=@y)\r\n @x2=x+(@x2-@x1)\r\n @y2=y+(@y2-@y1)\r\n @y1=y\r\n @x1=x\r\n end", "def flip\n @facing_up = !@facing_up\n self\n end", "def move_right\n @memory_position += 1\n @memory_position = 0 if @memory_position > 0xfffffe\n end", "def after_ship\n inventory_units.each { |u| u.ship! if u.can_ship? && !u.state?('shipped') }\n end", "def moveDown\n if (@y + @size) < 254\n call Screen.setColor(false)\n call Screen.drawRectangle(@x, @y, @x + @size, @y + 1)\n let @y = @y + 2\n call Screen.setColor(true)\n call Screen.drawRectangle(@x, (@y + @size) - 1, @x + @size, @y + @size)\n end\n end", "def moveLeft(dist)\n @body.p.x -= dist\n end", "def move\n\t\t@x += 0\n\t\t@y += @vel\n\tend", "def move(direction)\n @old = @pos\n @pos += direction\n end", "def move_forward\n case @direction\n when 2\n move_down(false)\n when 4\n move_left(false)\n when 6\n move_right(false)\n when 8\n move_up(false)\n end\n end", "def moveto(x, y)\r\n @x = x % $game_map.width\r\n @y = y % $game_map.height\r\n @real_x = @x\r\n @real_y = @y\r\n @prelock_direction = 0\r\n straighten\r\n update_bush_depth\r\n end", "def move\n #we're modifying the ship's coordinates based on the velocity calculated in the accelerate method (which is called when we hit 'Up')\n @x += @velocity_x\n @y += @velocity_y\n #we use these to slow down the speed, acting like a friction\n #calculates the rate of acceleration \n @velocity_x *= FRICTION\n @velocity_y *= FRICTION\n # we add conditionals to delimt the edge of the window\n if @x > @window.width - @radius\n @velocity_x = 0\n @x = @window.width - @radius \n end\n if @x < @radius\n @velocity_x = 0\n @x = @radius\n end\n if @y > @window.height - @radius\n @velocity_y = 0\n @y = @window.height - @radius\n end\n end", "def dolly(view, time)\n # compute the direction to move in. We want to move in the direction\n # that the camera is pointing but keeping the height constant\n direction = view.camera.direction\n direction.z = 0.0\n \n # see if we need to reverse it\n direction.reverse! if( (@keys & DOWN_ARROW) != 0 )\n\n # now move the camera\n self.move(view, time, direction, @speedy)\nend", "def move_away_from_character(character)\n sx = distance_x_from(character.x)\n sy = distance_y_from(character.y)\n if sx.abs > sy.abs\n move_straight(sx > 0 ? 6 : 4)\n move_straight(sy > 0 ? 2 : 8) if !@move_succeed && sy != 0\n elsif sy != 0\n move_straight(sy > 0 ? 2 : 8)\n move_straight(sx > 0 ? 6 : 4) if !@move_succeed && sx != 0\n end\n end", "def move_up\n current_y = position[0] - 1\n position[0] = (current_y < 0 ) ? (width-1) : current_y\n end", "def move_object_down(object)\n object.location_move_down unless is_wall?(object.location_down)\n end" ]
[ "0.69868886", "0.671078", "0.6707044", "0.6621565", "0.6615811", "0.6557973", "0.6517314", "0.6494956", "0.6460636", "0.63434106", "0.6325666", "0.6309632", "0.6275839", "0.62092525", "0.6194765", "0.6194765", "0.6186067", "0.61658204", "0.6163308", "0.6148122", "0.61373687", "0.6103868", "0.60990554", "0.60826164", "0.60825706", "0.60725915", "0.60640395", "0.60397726", "0.60312", "0.60312", "0.6026986", "0.602682", "0.6023019", "0.5999648", "0.5999648", "0.5973543", "0.5960399", "0.59541506", "0.5953482", "0.59516937", "0.594001", "0.5926652", "0.59250325", "0.5915852", "0.5906556", "0.5906335", "0.5895914", "0.5881611", "0.58594656", "0.5843218", "0.58406556", "0.58327943", "0.58293974", "0.5805575", "0.5804133", "0.57950795", "0.5791218", "0.5775831", "0.5771108", "0.5750678", "0.57422256", "0.5738433", "0.5736646", "0.5734964", "0.57317924", "0.5730975", "0.5727646", "0.57149446", "0.57095206", "0.570592", "0.56975365", "0.5681379", "0.56812793", "0.56691486", "0.56621397", "0.5639011", "0.56338507", "0.56328815", "0.56319296", "0.5631687", "0.56227475", "0.56163955", "0.55977255", "0.5594283", "0.55918425", "0.5591552", "0.5590138", "0.5579178", "0.55772406", "0.55716324", "0.5564638", "0.5558719", "0.5558128", "0.55540454", "0.5551204", "0.55487823", "0.55449164", "0.55431026", "0.55389994", "0.5535713" ]
0.6055388
27
Draw procedure for the Player calss
def draw @image_player.bmp.draw(@x, @y, ZOrder::TOP) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw\n @player.draw\n if @twoplayer\n @player2.draw\n else\n @bot.draw\n end\n @ball.draw\n @wall.draw\n @score.draw\n @help.draw\n end", "def draw\n @headers[@game_state_model::players[@game_state_model.player_turn_state]::player_color].draw(@x, @y, 35)\n\n if @game_state_model.player_turn_state == 0\n @ico_one.draw(@x + 143, @y + 20, 35)\n elsif @game_state_model::players[@game_state_model.player_turn_state]::ai == nil\n @ico_two.draw(@x + 143, @y + 20, 35)\n else \n @ico_ai.draw(@x + 143, @y + 20, 35)\n end\n\n @tiles[@game_state_model::players[0]::player_color].draw(@x + 10, @y + 8, 35)\n @tiles[@game_state_model::players[1]::player_color].draw(@x + 10, @y + 48, 35)\n # @block_purple.draw(@x + 10, @y + 5, 1)\n # @block_green.draw(@x + 10, @y + 45, 1)\n @question.draw\n @cancel.draw\n @font.draw(\"#{@game_state_model::players[0]::name}\", 50, @y + 7, 35, 1.0, 1.0, 0xff_ffffff)\n @font.draw(\"Wins: #{@game_state_model::players[0]::score}\", 50, @y + 22, 35, 1.0, 1.0, 0xff_ffffff)\n @font.draw(\"#{@game_state_model::players[1]::name}\", 50, @y + 47, 35, 1.0, 1.0, 0xff_ffffff)\n @font.draw(\"Wins: #{@game_state_model::players[1]::score}\", 50, @y + 62, 35, 1.0, 1.0, 0xff_ffffff)\n end", "def draw\n\t\t@player.draw\n\t\t@background_img.draw(0, 0, 0)\n\t\t@stars.each{|star| star.draw}\n\t\t@font.draw(\"Score:#{@player.score}\", 10, 10, ZOrder::UI, 1.0, 1.0, 0xff_ffff00)\n\tend", "def draw\n @ball.draw\n @player1.draw(@player1_x,@player1_y,0)\n @player2.draw(@player2_x,@player2_y,0)\n @font.draw(\"Score: A #{@player1_score} B #{@player2_score} \", 10, 10, 3, 1.0, 1.0, 0xffffff00)\n end", "def draw \n 0.upto(3) do |i| \n if @playing[i]\n if @winner == i\n @labels[i].draw_rel(\" Winner\", 540, 80+i*40, 1, 0.5, 0.5, 1, 1, 0xff0000ff, :default) \n else\n @labels[i].draw_rel(@score[i].to_s()+\" 000 $\", 540, 80+i*40, 1, 0.5, 0.5, 1, 1, 0xffffffff, :default)\n end\n else\n @labels[i].draw_rel(\" out\", 540, 80+i*40, 1, 0.5, 0.5, 1, 1, 0xdddddddd, :default)\n end\n \n @@players_icons[i].draw(450, 70+i*40, 1, 1, 1)\n end \n end", "def draw\n # Mostrar fondo\n @background_image.draw(0, 0, ZOrder::BACKGROUND)\n # Mostrar jugador\n @player.draw\n # Mostrar estrellas\n @agent_array.each { |agent| agent.draw }\n # Mostrar score\n #@font.draw(\"Score: #{@score}\", 10, 10, ZOrder::UI, 1.0, 1.0, Gosu::Color::YELLOW)\n end", "def draw\n if @show_game != true\n @menu.draw\n @cursor.draw self.mouse_x, self.mouse_y, 0\n else\n if wins\n @font.draw(\"Game over\", WIDTH/4+ 120/2, HEIGHT/2 - 120/2, 0, 2, 5,Gosu::Color::RED)\n @font.draw(\"Player #{wins} wins\", WIDTH/4 +100, HEIGHT/2 +20, 0,1,2)\n \n else\n @font.draw(\"Player 1: #{@player_1.score}\", 10, 10, 2,1,1, Gosu::Color::RED) #,1,1, Gosu::Color::WHITE)\n @font.draw(\"Player 2: #{@player_2.score}\", 10,25,2, 1, 1, Gosu::Color::GREEN) #,1,1, Gosu::Color::WHITE)\n @ball.draw\n @player_1.draw\n @player_2.draw\n end\n end\n end", "def draw\n @updated_blocks.each do |block|\n block.draw(self, [@x_viewport, @y_viewport].to_vec2d)\n end\n @player.draw(self, [@x_viewport, @y_viewport].to_vec2d)\n @font.draw(\"Score: #{@player.score}\", 10, 10, ZOrder::UI,\n 1.0, 1.0, Gosu::Color::WHITE)\n end", "def draw\n\t\t\t\t\n\t\t\tend", "def draw\n\t\t\n\tend", "def draw\n\t\t\n\tend", "def draw\n\t\t\n\tend", "def draw\n\t\t\n\tend", "def draw\n @player.draw\n Graphics.render_tail\n Graphics.draw_tiles(@font)\n Graphics.display_centered_title(@message.join(\"\"), @small_font)\n Graphics.display_lives(@small_font)\n Graphics.show_emoticon(Settings.mailbox, @font) if @message.join(\"\") == @completed \n if Position.collide?(@active_tile, @player)\n Graphics.erase_emoticon\n Graphics.show_emoticon(Settings.failbox, @font) \n end\n end", "def draw\n\t\t@party_horn.draw\n\t\tangle = draw_angle(face_left?)\n\t\tprawn_img = @@tiles[@tile_idx]\n\t\tprawn_img.draw_rot(@x+TILE_WIDTH/2, \n\t\t\t\t\t\t @y+TILE_HEIGHT/2, \n\t\t\t\t\t\t PRAWN_Z + @player.z, \n\t\t\t\t\t\t angle)\n\n\t\tprawn_skin = @@skins[@tile_idx] \n\t\tprawn_skin.draw_rot(@x + TILE_WIDTH/2, \n\t\t\t\t\t\t @y + TILE_HEIGHT/2, \n\t\t\t\t\t\t PRAWN_Z + @player.z, \n\t\t\t\t\t\t angle, \n\t\t\t\t\t\t 0.5, # Default center_x \n\t\t\t\t\t\t 0.5, # Default center_y\n\t\t\t\t\t\t 1, # Default scale_x\n\t\t\t\t\t\t 1, # Default scale_y\n\t\t\t\t\t\t @player.colour)\n\tend", "def draw\n\n\t\tend", "def draw\n\t\tend", "def draw\n end", "def draw\n end", "def draw\n end", "def draw\n end", "def draw\n if @winner == Const::GAME_ON\n @game.draw\n @o_board.draw\n elsif @winner == Const::GAME_LOST\n @font.draw(Const::GAME_LOST_CAPTION,\n @window.width / 2 - 170, @window.height / 2 - 30, 0)\n else\n @font.draw(Const::GAME_WON_CAPTION,\n @window.width / 2 - 170, @window.height / 2 - 30, 0)\n end\n end", "def draw()\n\t\t# convert integer array to X and O\n\t\tplayer_moves = @gameplay_positions.map do |n|\n\t\t\tcase n\n\t\t\twhen 1\n\t\t\t \"X\"\n\t\t\twhen 2\n\t\t\t \"O\"\n\t\t\telse\n\t\t\t \" \"\n\t\t\tend\n\t\tend\n\n\t\tprintMap(player_moves)\n\t\t\n\tend", "def draw\n unless @track_result.nil?\n draw_play()\n end \n draw_btns()\n draw_stuff()\n draw_background()\n draw_albums(@albums)\n display_tracks()\n @info_font.draw(\"mouse_x: #{mouse_x}\", 200, 50, ZOrder::UI, 1.0, 1.0, Gosu::Color::WHITE)\n @info_font.draw(\"mouse_y: #{mouse_y}\", 350, 50, ZOrder::UI, 1.0, 1.0, Gosu::Color::WHITE)\n end", "def draw()\n @ucCharFace.draw()\n @cCharName.draw()\n @ucCharLvl.draw()\n @cHpStatGauge.draw()\n @ucHpStat.draw()\n @cMpStatGauge.draw()\n @ucMpStat.draw()\n end", "def draw()\n @ucCharFace.draw()\n @cCharName.draw()\n @ucCharLvl.draw()\n @cHpStatGauge.draw()\n @ucHpStat.draw()\n @cMpStatGauge.draw()\n @ucMpStat.draw()\n end", "def draw\n\t\t# Loop through and draw each player\n\t\t@players.each do |player|\n\t\t\tplayer.draw\n\t\tend\n\n\t\t# Loop through and draw each projectile\n\t\t@projectiles.each do |projectile|\n\t\t\tprojectile.draw\n\t\tend\n\tend", "def draw\r\n @game_objects.draw\r\n end", "def draw\n\t\t# Complete the missing code\n\t\tdraw_background\n\t\tdraw_albums\n if @play > -1\n @font.draw(\"Now playing...\\n#{@albums[@selection].tracks[@play].name}\", 650, 550, ZOrder::UI, 1.0, 1.0, Gosu::Color::BLACK)\n end\n\n\tend", "def draw\n\tend", "def draw; end", "def draw; end", "def draw\n @board.draw\n x = @window.width / 2\n y = @window.height / 2 - 30\n @font.draw(Const::PAUSE_CAPTION, x - 130, y, 0) if @paused\n @font.draw(Const::GAME_OVER_CAPTION, x - 170, y, 0) if @game_over\n end", "def draw\n case @status\n when :alive\n @normal_image.draw(@x - @normal_image.width / 2, @y - @normal_image.height / 2, ZOrder::Player)\n when :crashed\n @crash_image.draw(@x - @crash_image.width / 2, @y - @crash_image.height / 2, ZOrder::Player)\n when :resurrecting\n @normal_image.draw(@x - @normal_image.width / 2, @y - @normal_image.height / 2, ZOrder::Player) if (Time.now.to_f * 1000).to_i % 2 == 0\n end\n end", "def draw\n\t\tsub_face_left = face_left?\n\n\t\tdraw_sub(sub_face_left)\n\t\t@has_moved = false\n\t\t@prawn.draw\n\tend", "def draw\n @background_image.draw 0, 0, ZOrder::BACKGROUND\n case @game_settings.current_screen\n when \"start\"\n start_screen\n when \"levels\"\n levels_screen\n when \"gameover\"\n game_over_screen\n when \"game\"\n @deck.deal_cards! @playing_cards\n\n if @game_settings.is_cpu_player_enabled\n @subtitle_font.draw_text \"Computer:\", 645, 215, ZOrder::TEXT, 1.0, 1.0, Gosu::Color::BLACK\n @subtitle_font.draw_text \"Score : #{@computer_signal.score}\", 645, 245, ZOrder::TEXT, 1.0, 1.0, Gosu::Color::BLACK\n end\n\n # Computer messages\n if @true_mes\n @subtitle_font.draw_text \"I found a set!\", 645, 275, ZOrder::TEXT, 1.0, 1.0, Gosu::Color::BLACK\n if @computer_signal.score > @p1.score\n @subtitle_font.draw_text \"#{@computer_signal.mean_msg}\", 645, 305, ZOrder::TEXT, 1.0, 1.0, Gosu::Color::BLACK\n end\n end\n\n @subtitle_font.draw_text \"Still trying!\", 645, 275, ZOrder::TEXT, 1.0, 1.0, Gosu::Color::BLACK if @trying_mes\n\n @subtitle_font.draw_text \"Oops not a set!\", 645, 275, ZOrder::TEXT, 1.0, 1.0, Gosu::Color::BLACK if @false_mes\n\n # Creates players if need be.\n if !@players_created\n @p1 = Player.new 1 if @game_settings.p1_init\n @p2 = Player.new 2 if @game_settings.p2_init\n @players_created = true\n end\n\n Gosu.draw_rect 640,0,280,480,Gosu::Color::GRAY,ZOrder::UI\n\n @subtitle_font.draw_text \"Player 1 Statistics:\", 645, 0, ZOrder::TEXT, 1.0, 1.0, Gosu::Color::BLACK\n if @p1.set_times.length > 0\n \t@subtitle_font.draw_text \"Fastest time to find a set: #{@p1.set_times.at 0}\", 645, 30, ZOrder::TEXT, 1.0, 1.0, Gosu::Color::BLACK\n \t@subtitle_font.draw_text \"Slowest time to find a set: #{@p1.set_times.at -1}\", 645, 60, ZOrder::TEXT, 1.0, 1.0, Gosu::Color::BLACK\n \t@subtitle_font.draw_text \"Average time to find a set: #{@p1.time_sum / @p1.set_times.length}\", 645, 90, ZOrder::TEXT, 1.0, 1.0, Gosu::Color::BLACK\n else\n \t@subtitle_font.draw_text \"No sets found yet\", 645, 30, ZOrder::TEXT, 1.0, 1.0, Gosu::Color::BLACK\n end\n @subtitle_font.draw_text \"Hints used: #{@p1.hints_used}\", 645, 120, ZOrder::TEXT, 1.0, 1.0, Gosu::Color::BLACK if @game_settings.are_hints_enabled\n @subtitle_font.draw_text \"Score: #{@p1.score}\", 645, 150, ZOrder::TEXT, 1.0, 1.0, Gosu::Color::BLACK\n @subtitle_font.draw_text \"Total Game Time: #{@game_timer.current}\", 645, 490, ZOrder::TEXT, 1.0, 1.0, Gosu::Color::BLACK\n \n if @game_settings.p2_init\n @subtitle_font.draw_text \"Player 2 Statistics:\", 645, 280, ZOrder::TEXT, 1.0, 1.0, Gosu::Color::BLACK\n \tif @p2.set_times.length > 0\n \t @subtitle_font.draw_text \"Fastest time to find a set: #{@p2.set_times.at 0}\", 645, 310, ZOrder::TEXT, 1.0, 1.0, Gosu::Color::BLACK\n \t @subtitle_font.draw_text \"Slowest time to find a set: #{@p2.set_times.at -1}\", 645, 340, ZOrder::TEXT, 1.0, 1.0, Gosu::Color::BLACK\n \t @subtitle_font.draw_text \"Average time to find a set: #{@p2.time_sum / @p2.set_times.length}\", 645, 370, ZOrder::TEXT, 1.0, 1.0, Gosu::Color::BLACK\n \telse\n \t @subtitle_font.draw_text \"No sets found yet\", 645, 310, ZOrder::TEXT, 1.0, 1.0, Gosu::Color::BLACK\n \tend\n \t@subtitle_font.draw_text \"Score: #{@p2.score}\", 645, 430, ZOrder::TEXT, 1.0, 1.0, Gosu::Color::BLACK\n end\n\n num_cols = @playing_cards.length / 3\n count, x_offset, y_offset, x_between, y_between = 0, 5, 35, 90, 135\n (0...3).each do |row|\n (0...num_cols).each do |col|\n @playing_cards[count].image.draw(x_offset + x_between*col, y_offset + y_between*row, ZOrder::CARDS, 0.15, 0.15)\n count += 1\n end\n end\n\n # Prints out hints\n @hint.each do |card_index|\n # initial card corner values.\n left_x ,right_x, top_y, bottom_y = 5, 85, 40, 160\n\n # Highlight for hints\n draw_rect left_x + x_between*(card_index % num_cols), top_y + y_between*(card_index / num_cols),80,10,Gosu::Color::BLACK,ZOrder::CARDS\n draw_rect left_x + x_between*(card_index % num_cols), top_y + y_between*(card_index / num_cols),10,130,Gosu::Color::BLACK,ZOrder::CARDS\n draw_rect left_x + x_between*(card_index % num_cols), bottom_y + y_between*(card_index / num_cols),80,10,Gosu::Color::BLACK,ZOrder::CARDS\n draw_rect right_x + x_between*(card_index % num_cols), top_y + y_between*(card_index / num_cols),10,130,Gosu::Color::BLACK,ZOrder::CARDS\n end\n\n #TO MOVE RECTANGLE:\n # X POSITION = @currentCardIndex % numCols\n # Y POSITION = @currentCardIndex / numCols\n if @game_settings.p1_init\n x_movement = x_offset + (x_between/2.4) + x_between*(@p1.current_card_index % num_cols)\n y_movement = y_offset + (y_between/2) + y_between*(@p1.current_card_index / num_cols)\n\n # Draws current position\n draw_rect x_movement, y_movement, 20, 20, Gosu::Color::CYAN,ZOrder::CARDS\n\n # Draws current selected values\n @p1.chosen_cards_indexes.each {|index| draw_rect(x_offset + (x_between/2.4) + (x_between)*(index % num_cols), y_offset + (y_between/2) + y_between*(index / num_cols), 20, 20, Gosu::Color::CYAN, ZOrder::CARDS)}\n end\n if @game_settings.p2_init\n x_movement = x_offset + (x_between/2.4) + x_between*(@p2.current_card_index % num_cols)\n y_movement = (y_between/2) + y_between*(@p2.current_card_index / num_cols)\n\n # Draws current position\n draw_rect x_movement, y_movement, 20, 20, Gosu::Color::FUCHSIA, ZOrder::CARDS\n\n # Draws current selected values\n @p2.chosen_cards_indexes.each {|index| draw_rect(x_offset + (x_between/2.4) + (x_between)*(index % num_cols), (y_between/2) + y_between*(index / num_cols), 20, 20, Gosu::Color::FUCHSIA, ZOrder::CARDS)}\n end\n end\n end", "def draw\n @image.draw(0, 0, 0, Float(@player.health) / 10, 1)\n end", "def draw\r\n\r\n # Attach the camera location to the player\r\n @player.draw(@camera_x, @camera_y,1)\r\n\r\n # Cycle thru each map level...\r\n for l in 0...@level.size\r\n\r\n # ... and cycle thru each y coord ...\r\n for y in 0...@level[l].size\r\n \r\n # ... and cycle thru each x coord\r\n for x in 0...@level[l][y].size\r\n\r\n # Check if this is the first level\r\n if l == 1 then\r\n\r\n # If this is a hidden tile location...\r\n if @hidden_tiles.include?([x,y]) then\r\n @tileset[@level[l][y][x]].draw((x*16)-@camera_x,\r\n (y*16)-@camera_y,\r\n l+1,\r\n 1,\r\n 1,\r\n Gosu::Color.new(160,255,255,255))\r\n\r\n # Otherwise just a normal location\r\n else\r\n @tileset[@level[l][y][x]].draw((x*16)-@camera_x,\r\n (y*16)-@camera_y,\r\n l+1)\r\n end\r\n\r\n # Otherwise just default to the start location\r\n else\r\n @tileset[@level[l][y][x]].draw((x*16)-@camera_x,\r\n (y*16)-@camera_y,\r\n l+1)\r\n end\r\n end\r\n end\r\n end\r\n\r\n # For the given camera location, draw all entites present in that\r\n # location\r\n @entities.each{|en| en.draw(@camera_x, @camera_y)}\r\n\r\n # Draw the score counter onto the game window\r\n $text.draw_text(\"< #{@score} >\", 16, 16, 10)\r\n end", "def draw\r\n draw_background\r\n draw_h(@balls)\r\n end", "def draw\n\n if @init\n @background.draw(0, 0, -1, 2.5, 2.5)\n end\n\n if not @playing\n @font.draw(\"Game Over\", 300, 300, 3)\n @font.draw(\"Press the Space Bar to Play Again\", 175, 350, 3)\n @visible = 20\n end\n\n @hammer_image.draw(mouse_x-40, mouse_y-10, 2)\n\n if @visible > 0\n @image.draw(@x-@width/2, @y-@height/2, 1)\n end\n\n if @hit == 0\n c = Gosu::Color::NONE\n elsif @hit == 1\n c = Gosu::Color::GREEN\n elsif @hit == -1\n c = Gosu::Color::RED\n end\n @hit = 0\n\n draw_quad(0, 0, c, 800, 0, c, 800, 600, c, 0, 600, c)\n\n @font.draw(@score.to_s, 700, 20, 2)\n @font.draw(@time_left, 20, 20, 2)\n\n end", "def draw\n print \" | |\\n\" \\\n \"#{board_line(0)}\\n\" \\\n \" | |\\n\" \\\n \"-----+-----+-----\\n\" \\\n \" | |\\n\" \\\n \"#{board_line(1)}\\n\" \\\n \" | |\\n\" \\\n \"-----+-----+-----\\n\" \\\n \" | |\\n\" \\\n \"#{board_line(2)}\\n\" \\\n \" | |\\n\"\n end", "def draw\n game_name = \"MAD POKEMONS\"\n height = @game_font.height\n width = @game_font.text_width(game_name, scale_x = 1)\n x = Game::ScreenWidth / 2\n y = Game::ScreenHeight / 3\n @game_font.draw(game_name, x - width/2 ,y - height/2, ZOrder::UI, 1.0, 1.0, Gosu::Color::WHITE)\n \n @buttons.each {|button| button.draw }\n end", "def draw \n\t\tsuper(\"You Won!! Great Battle!!\", X, Y, 5)\n\tend", "def draw\n @image.draw(@x - @image.width/2.0, @y - @image.height/2.0, ZOrder::Player)\n end", "def draw\n @osd.draw\n end", "def draw(eol = \"\\n\")\n player_positions = {}\n players.each do |p| \n unless p.state == 'quit'\n player_positions[p.x_pos] ||= {}\n player_positions[p.x_pos][p.y_pos] = p\n end\n end\n buf = \"\"\n start = 0\n size = board_size - 1\n for x in 0..size do\n for y in 0..size do\n start += 1\n if p = (player_positions[x] && player_positions[x][y])\n klass = ' occupied'\n spot = \"#{p.id}#{FACINGS_VISUAL[p.facing]}\"\n else\n klass = nil\n spot = '.'\n end\n buf += \"<span class='space#{klass}'>#{spot}</span>\"\n end\n buf+=eol\n end\n buf\n end", "def draw()\n draw_controls()\n end", "def draw\n\tsuper\n\t\n\tif Game.scene.selected_tower\n\t position = grids_to_pixels(Game.scene.selected_tower.position)\n\t \n\t @surface.drawFilledCircle(position[0], position[1], Game.scene.selected_tower.range * Config.part_size[0], Screen.handle.format.mapRGB(0xbb, 0xbb, 0xbb))\n\tend\n\t\n\tposition = Config.monsters_start_at\n\tposition[0] += 1\n\tposition = grids_to_pixels(position)\n\tposition[0] -= 20\n\tposition[1] -= 20\n\tImage.draw(\"images/arrow.png\", @surface, *position)\n\t\n\tposition = Config.monsters_end_at\n\tposition[0] -= 1\n\tposition = grids_to_pixels(position)\n\tposition[0] -= 20\n\tposition[1] -= 20\n\tImage.draw(\"images/arrow.png\", @surface, *position)\n\t\n\tConfig.map_size[1].times do |y|\n Config.map_size[0].times do |x|\n @surface.draw_rect(Config.part_size[0]*x,Config.part_size[1]*y,Config.part_size[0],Config.part_size[1],Screen.handle.format.mapRGB(0x88, 0x88, 0x88))\n end\n end\n\t\n\tGame.scene.get_drawable_objects.each do |i|\n\t position = grids_to_pixels(i.position)\n\t if i.class <= Model::Monster # Drawing HP lines\n\t color = Screen.handle.format.mapRGB(0xaa, 0xaa, 0xaa)\n\t if i.poisoned\n\t color = Screen.handle.format.mapRGB(0xff, 0x00, 0xff)\n\t end\n\t @surface.draw_line(position[0]-12, position[1]-18, position[0]+12, position[1]-18, color)\n\t @surface.draw_line(position[0]-12, position[1]-17, position[0]+12, position[1]-17, color)\n\t \n\t line_len = i.hp * 24 / i.max_hp\n\t \n\t color = Screen.handle.format.mapRGB(0x00, 0xff, 0x00)\n\t if i.frozen\n\t color = Screen.handle.format.mapRGB(0x00, 0xff, 0xff)\n\t end\n\t @surface.draw_line(position[0]-12, position[1]-18, position[0]-12+line_len, position[1]-18, color)\n\t @surface.draw_line(position[0]-12, position[1]-17, position[0]-12+line_len, position[1]-17, color)\n\t end\n\t position[0] -= i.image_size[0]/2\n\t position[1] -= i.image_size[1]/2\n\t \n\t Image.draw(i.image, @surface, *position)\n\tend\n end", "def draw\n framerate_counter.update\n\n draw_background_on self\n poops.each {|poop| poop.draw_on self }\n draw_targets_on self\n boid.draw_on self\n draw_ui_on self\n end", "def draw\n @hud = Gosu::Image.from_text(self, stats, Gosu::default_font_name, 30) \n @hud.draw(0, 0, 0)\n\n end", "def draw\n #Updates the map if necessary.\n update\n #If the level is completed, draws a black screen with text on it. Also returns to prevent uncessary updates.\n if @victory and !@win\n @victoryScreen.draw(0, 0, 0)\n return\n #Same but for if the player wins the game.\n elsif @victory and @win\n @winScreen.draw(0, 0, 0)\n return\n end\n #Draws background image. Note that it is drawn using the modulus operator. This is to ensure that the background \"scrolls\"\n #through the screen, and does not only go through once. Further, the position is negative, and is offset by 600. This is to\n #make the background move backwards while the player appears to move forwards. The division by 4 creates parallax\n #scrolling, as the background moves at a slower pace than the camera does.\n @background_image.draw(-((camera.camX + 400) / 4 % 1600) + 600, 0, 0)\n #Draws each DYNAMIC object in the map.\n @DobjectArray.each do |object|\n object.draw\n end\n #Draws each PROJECTILE object in the map.\n @PobjectArray.each do |object|\n object.draw\n end\n #Draws each Static object in the map.\n @SobjectArray.each do |object|\n object.draw\n end\n #Draws each EFFECT object in the map.\n @EobjectArray.each do |object|\n object.draw\n end\n #Draws healthbar last.\n @healthBar.draw\n #If the game is fading in/out, a mask draws on the screen to emulate washing in/out.\n if @fadingIn\n @mask.draw(0, 0, 0, 1, 1, getAlphaIn)\n elsif @fadingOut\n @mask.draw(0, 0, 0, 1, 1, getAlphaOut)\n end\n end", "def draw_player_pieces args\n #$gtk.log \"INFO: RENDERING GAME PIECES...\"\n args.state.player.pieces.each do |p|\n if p[:onboard]\n args.outputs.primitives << {\n x: args.state.board.x + args.state.tiles[p[:tile]][:x],\n y: args.state.board.y + args.state.tiles[p[:tile]][:y],\n w: 100,\n h: 100,\n path: \"sprites/circle-indigo.png\"\n }.sprite\n \n args.outputs.primitives << {\n x: args.state.board.x + args.state.tiles[p[:tile]][:x] + 35,\n y: args.state.board.y + args.state.tiles[p[:tile]][:y] + 75,\n text: p[:order],\n size_enum: 16,\n alignment_enum: 0,\n r: 0,\n g: 0,\n b: 0,\n a: 255\n }.label\n end\n end\nend", "def draw\n return if map.nil?\n\n # Draw overall score\n scores = Gameplay::Scoring.scores_for_map(map)\n @previous_valid_total_score = scores.values.min if scores.values.all?\n\n IO::FontManager.font(30).draw_text('SCORE', 50, 18, 1, 1.0, 1.0,\n Gosu::Color::BLACK)\n IO::FontManager.font(70).draw_text(@previous_valid_total_score,\n 50, 50, 1, 1.0, 1.0,\n scores.values.all? ? Gosu::Color::BLACK : Gosu::Color::GRAY)\n\n # Draw individual station scores\n scores.each.with_index do |(station, score), i|\n Gosu.draw_rect(i * 50 + 170, 70, 40, 40,\n Entities::StationObject::BACKGROUND_COLORS[station], 10)\n\n @previous_valid_scores[station] = score unless score.nil?\n\n IO::FontManager.font(25).draw_text_rel(@previous_valid_scores[station],\n i * 50 + 190, 90, 10, 0.5, 0.5,\n 1, 1, !score.nil? \\\n ? Entities::StationObject::TEXT_COLORS[station]\n : Entities::StationObject::INACTIVE_TEXT_COLORS[station])\n end\n\n # Draw a medal for the overall score\n medal = map.metadata.medal_for(@previous_valid_total_score) || 'none'\n medal_img = IO::ImageManager.image(\"medal_#{medal}\".to_sym)\n\n medal_img.draw(170, 10, 10)\n\n # Draw the next level button, if necessary\n if medal != 'none'\n @next_level_button.draw_element(10)\n @next_level_button.enabled = true\n IO::FontManager.font(25).draw_text(\"Next\\nLevel\",\n @next_level_button.point.x + 10, 25, 10, 1, 1, 0xFF000000)\n else\n @next_level_button.enabled = false\n end\n end", "def draw\n\t\t# draws the background image\n\t\t# @welcome.draw\n\t\t@background_image.draw(0, 0, 0)\n\t\t# go through each star and draw them\n\t\t@stars.each do |star|\n\t\t\tstar.draw\n\t\tend\n\t\t# draw the horse\n\t\t@horse.draw\n\t\t# draw the candy\n\t\t@candy.draw\n\t\t# draw the score\n\t\t@score_text.draw(\"#{@score}\", 0, 0, 1)\n\tend", "def draw()\n @ucIcon.draw()\n @cSkillName.draw()\n @cSkillMpCost.draw()\n end", "def draw\n # gl will execute the given block in a clean OpenGL environment, then reset\n # everything so Gosu's rendering can take place again.\n \n #gl do\n # glClearColor(0.0, 0.2, 0.5, 1.0)\n # glClearDepth(0)\n # glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)\n # \n # @gl_background.exec_gl\n #end\n #@background_image.draw(0, 0, ZOrder::Background)\n \n @bullets.each { |o| o.draw }\n @e_bullets.each { |o| o.draw }\n @ennemies.each{|e| e.draw}\n @bonuses.each{|b| b.draw}\n @particles.each{|p| p.draw}\n \n @player.draw\n \n # TODO externalize UI methods\n # Score\n @font.draw(\"Score: #{@player.score}\", 10, 10, ZOrder::UI, 1.0, 1.0, 0xffffff00)\n # Player's lives count\n @font.draw(\"LIVES: #{(@player.lives > -1)? @player.lives : \"GAME OVER\"}\", 10, 30, ZOrder::UI, 1.0, 1.0, 0xffff0000)\n # Current level\n @font.draw(\"LEVEL: #{@w_generator.current_level}\", 10, 50, ZOrder::UI, 1.0, 1.0, 0xffff0000)\n \n # Pause label\n if @state == :paused\n @big_font.draw(\" PAUSE \", @GAME_OVER_X, @GAME_OVER_Y, ZOrder::UI, 1.0, 1.0, 0xffff0000)\n end\n # Game Over label\n if @player.lives < 0\n @big_font.draw(\"GAME OVER\", @GAME_OVER_X, @GAME_OVER_Y, ZOrder::UI, 1.0, 1.0, 0xffff0000)\n end\n # End game label\n if @finished\n @big_font.draw(\"THE END\", @GAME_OVER_X, @GAME_OVER_Y, ZOrder::UI, 1.0, 1.0, 0xffff0000)\n end\n end", "def draw()\n @ucActStates.draw()\n @cCharImage.draw()\n @cCharName.draw()\n @ucCharLvl.draw()\n @cHpStatGauge.draw()\n @ucHpStat.draw()\n @cMpStatGauge.draw()\n @ucMpStat.draw()\n @cExpGauge.draw()\n @ucExp.draw()\n end", "def draw()\n if self.actor != nil\n bitmap = Cache.character(self.actor.character_name)\n sign = self.actor.character_name[/^[\\!\\$]./]\n if sign != nil && sign.include?('$')\n cw = bitmap.width / 3\n ch = bitmap.height / 4\n else\n cw = bitmap.width / 12\n ch = bitmap.height / 8\n end\n n = self.actor.character_index\n \n @cCharGraphic.img_bitmap = bitmap\n @cCharGraphic.src_rect = Rect.new((n%4*3+1)*cw, (n/4*4+@direction)*ch, cw, ch)\n @cCharGraphic.draw()\n end\n end", "def draw\n self.rock = Square.new(x: self.rock_x * $GRID_SIZE, y: self.rock_y * $GRID_SIZE, size: ($GRID_SIZE - 1) * 2, color: 'red')\n end", "def draw\n intro if @intro_flag\n draw_ruby\n draw_emerald\n @dude.draw(mouse_x - 75, mouse_y - 75, 1)\n hitter\n draw_header\n game_over unless @playing || @intro_flag\n end", "def draw\n clear\n puts \"|\" + table_empty_space('-') + \"|\"\n puts \"|\" + table_empty_space(' ') + \"|\"\n puts \"|\" + show_dealer_total.center(TABLE_SIZE) + \"|\"\n puts \"|\" + \"#{show_dealer_unknown} #{show_dealer_hand}\".center(TABLE_SIZE) + \"|\"\n 2.times { puts \"|\" + table_empty_space(' ') + \"|\" }\n puts \"|\" + \"- #{dealer.name} -\".center(TABLE_SIZE) + \"|\"\n 2.times { puts \"|\" + table_empty_space(' ') + \"|\" }\n puts \"|\" + \"- #{player.name} -\".center(TABLE_SIZE) + \"|\"\n 2.times { puts \"|\" + table_empty_space(' ') + \"|\" }\n puts \"|\" + \"#{show_player_unknown} #{show_player_hand}\".center(TABLE_SIZE) + \"|\"\n puts \"|\" + show_player_total.center(TABLE_SIZE) + \"|\"\n puts \"|\" + table_empty_space(' ') + \"|\"\n puts \"|\" + table_empty_space('-') + \"|\"\n puts \"\"\n end", "def plays_draw(other_player, options = {})\n versus(other_player, options).draw\n end", "def draw\n\t\t# Complete the missing code\n\t\tdraw_background()\n\tend", "def draw()\n if visible\n \n case self.align \n when 0 # Left\n x = self.rect.x\n when 1 # Middle\n x = self.rect.x + self.rect.width/2 - self.src_rect.width/2\n when 2 # Right\n x = self.rect.x + self.rect.width - self.src_rect.width\n else\n x = 0\n end\n \n case self.valign \n when 0 # Top\n y = self.rect.y\n when 1 # Middle\n y = self.rect.y + self.rect.height/2 - self.src_rect.height/2\n when 2 # Bottom\n y = self.rect.y + self.rect.height - self.src_rect.height\n else\n y = 0\n end\n\n if !active\n opacity = Font.inactive_alpha()\n else\n opacity = self.opacity\n end\n \n bitmap.blt(x, y, self.img_bitmap, self.src_rect, opacity)\n end\n end", "def draw\n if @state == :menu\n i = 0\n for option in @menu_options\n color = option == @menu_options[@menu_selection] ? LIGHT_GREEN : DARK_GREEN\n Gosu::Image.from_text(self, option.to_s, \"Courier New\", 24 * SCALE).draw(100 * SCALE, 50 * i * SCALE + 30 * SCALE, 0, 1, 1, color)\n i += 1\n end\n elsif @state == :instructions\n Gosu::Image.from_text(self, \"Use the arrow keys to move the player left and right.\\nPress control to jump.\\nAlt to toggle the pogo stick.\\nSpace to shoot.\\nUp in a doorway for next level.\\n\\nCollect candy.\\nAvoid enemies.\\nGame over if you run out of lives.\", \"Times New Roman\", 12 * SCALE, 10 * SCALE, 250 * SCALE, :left).draw(50 * SCALE, 25 * SCALE, 0, 1, 1, 0xffffffff)\n elsif @state == :game\n @level.draw SCALE, @player.x * SCALE, @player.y * SCALE\n @player.draw SCALE\n end\n end", "def draw\n opacity = 0.4\n @position.reverse.each do |pos|\n opacity *= 0.8\n Square.new(x: pos[0] * GRID_SIZE, y: pos[1] * GRID_SIZE, size: NODE_SIZE, color: @snake_color, z: @z) # the regular snake\n Square.new(x: pos[0] * GRID_SIZE, y: pos[1] * GRID_SIZE, size: NODE_SIZE, color: 'white' , opacity: opacity, z: @z + 1) # a lighting effect\n end\n end", "def draw\n\t\tif @is_blown\n\t\t\tis_facing_left = face_left?\n\n\t\t\tangle = draw_angle(is_facing_left)\n\t\t\tidx = is_facing_left ? 0 : 1\n\n\t\t\timg = @@tiles[idx]\n\t\t\timg.draw_rot(@x + PARTY_HORN_TILE_WIDTH/2.0, \n\t\t\t\t\t\t @y + PARTY_HORN_TILE_HEIGHT/2.0, \n\t\t\t\t\t\t PARTY_HORN_Z + @player.z, \n\t\t\t\t\t\t angle)\n\t\tend\n\tend", "def draw\n # clear the terminal\n system(\"clear\")\n # draw the top rail\n puts '-' * self.length\n # draw each horse in it's own lane\n self.horses.each do |horse|\n # draw .......all the way up to the position of the horse\n print '.' * horse.position + horse.print\n puts\n # draw the bottom rail\n puts '-' * self.length\n end\n end", "def draw()\n @ucEncounters.draw()\n @ucDefeated.draw()\n @ucEscaped.draw()\n @ucExp.draw()\n @ucGold.draw()\n end", "def render_player x, y \n \tboxsize = 16\n \tgrid_x = (1280 - (@grid_w * boxsize)) / 2\n \tgrid_y = (720 - ((@grid_h - 2) * boxsize)) / 2\n\t\t@args.outputs.sprites << [ grid_x + (x * boxsize), (grid_y) + (y * boxsize), boxsize, boxsize, \"sprites/debug.png\"]\n\tend", "def draw_hadouken\n # left\n if @player.push_hadouken\n @hadouken_img.draw(@player.player_x - @mov, @center_y, 1, -1) if @player.player2?\n # right\n @hadouken_img.draw(@player.player_x + @mov, @center_y, 1) unless @player.player2?\n\n # calcula novamente o valor de X\n @center_x = @player.player_x - @mov if @player.player2?\n @center_x = @player.player_x + @mov unless @player.player2?\n end\n end", "def render args\n # draw the player's bullet\n render_player_bullet args\n # draw the player\n render_player args\n # draw the enemy bullet\n render_enemy_bullet args\n # draw the enemy\n render_enemy args\n # draw game over\n render_game_over args\nend", "def draw()\n @ucActStates.draw()\n @cHpStatGauge.draw()\n @ucHpStat.draw()\n @cMpStatGauge.draw()\n @ucMpStat.draw()\n @ucAtkStat.draw()\n @ucDefStat.draw()\n @ucSpiStat.draw()\n @ucAgiStat.draw()\n @ucEvaStat.draw()\n @ucHitStat.draw()\n @ucCriStat.draw()\n end", "def draw()\n\t\tif @grabbed != nil\n\t\t\t#draw a translucent piece under the mouse\n\t\t\tmouse_pos = mouse_over_position()\n\t\t\tfade_color = Gosu::Color.argb(192, 255, 255, 255) #75% opacity\n\t\t\tfade_color = Gosu::Color.argb(128, 255, 255, 255) unless valid_move?(@grabbed, mouse_pos)\n\t\t\t@board.get_piece_icon(@grabbed).draw(@board.left_edge+mouse_pos.x*48, @board.top_edge+mouse_pos.y*48-4, 3, 1, 1, fade_color)\n\t\tend\n\tend", "def draw(players)\n players.each do |player|\n player.win(@bank / players.size)\n end\n\n players\n end", "def draw\n @font_small.draw_rel(\"Made by\", StartX, StartY, ZOrder::UI, 0.5, 0.5)\n @font_credits.draw_rel(\"Annie Dang\", StartX, StartY + 30, ZOrder::UI, 0.5, 0.5)\n @font_small.draw_rel(\"A Student Of Swinburne University\", StartX, StartY + 60, ZOrder::UI, 0.5, 0.5, 1, 1, 0xfff4cc00)\n @font_small.draw_rel(\"Who always loves to make people laugh\", StartX, StartY + 90, ZOrder::UI, 0.5, 0.5, 1, 1, 0xfff4cc00)\n \n @button.draw\n end", "def draw\r\n @background_image.bmp.draw(0, 0, ZOrder::BACKGROUND)\r\n @function_UI.place_button((SCREEN_WIDTH/3) + 100, 300, \"Close\")\r\n draw_border((SCREEN_WIDTH/3) + 105, 305, mouse_x, mouse_y)\r\n @function_UI.big_font.draw_text(\"GAME OVER!\", @function_UI.pos- 120, 30, ZOrder::TOP, 1.0, 1.0, Gosu::Color::YELLOW)\r\n @score_font.draw_text(\"Your Score: #{@score}\", @function_UI.pos-100, 200, ZOrder::TOP, 1.0, 1.0, Gosu::Color::YELLOW)\r\n @score_font.draw_text(\"Time of Game PLay: #{@game_play_time} Seconds\", @function_UI.pos-140, 100, ZOrder::TOP, 1.0, 1.0, Gosu::Color::YELLOW)\r\n end", "def draw()\n if self.enemy != nil\n bitmap = Cache.battler(self.enemy.battler_name, self.enemy.battler_hue)\n @cEnemyGraphic.img_bitmap = bitmap\n @cEnemyGraphic.src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)\n @cEnemyGraphic.draw()\n end\n end", "def draw\n call Screen.setColor(true)\n call Screen.drawRectangle(@x, @y, @x + @size, @y + @size)\n end", "def draw()\n @cEquipKind.draw()\n @ucIcon.draw()\n @cEquipName.draw()\n end", "def draw\n @screen.insert(@frame, 0, 0)\n @screen.draw(0, 0, 0)\n end", "def draw()\n @ucStat.draw()\n @ucCompareStat.draw()\n end", "def draw \n\t\tsuper(\"Lives: #{@lives.to_s}\", X, Y, 5)\n\tend", "def render_player\n state.player_sprite = [state.player.x,\n state.player.y,\n 4 * 3,\n 8 * 3, \"sprites/player-#{animation_index(state.player.created_at_elapsed)}.png\"] # string interpolation\n outputs.sprites << state.player_sprite\n\n # Outputs a small red square that previews the angles that the player can attack in.\n # It can be moved in a perfect circle around the player to show possible movements.\n # Change the 60 in the parenthesis and see what happens to the movement of the red square.\n outputs.solids << [state.player.x + state.player.attack_angle.vector_x(60),\n state.player.y + state.player.attack_angle.vector_y(60),\n 3, 3, 255, 0, 0]\n end", "def board_visualization\n @players.each do |player|\n before = 0\n after = @length\n puts \" | \"*(before += @position[player]) + \"#{player}\" + \" | \"*(after -= @position[player])\n end\n nil\n end", "def draw\n draw_background\n draw_ambient\n draw_objects\n draw_ui\n end", "def draw_board\n clear_screen\n print_logo\n put_column_headers\n @rows.each do |row|\n row_string = \"\"\n slots_filled_in_row = 0\n row.each do |slot|\n if slot\n color_code = slot\n if @players.size == 2\n slot = \"X\" if slot == 1\n slot = \"O\" if slot == 2\n end\n color_code = COLOR_CODES[color_code]\n slot = slot.to_s.colorize(color_code)\n slots_filled_in_row += 1\n else\n slot = '.'\n end\n row_string << (slot + \" \")\n end\n center_puts((' ' * 11 * slots_filled_in_row) + row_string)\n end\n put_column_headers\n end", "def draw\r\n draw_rect(0, 0, WIDTH, 50, COLOR_BLACK, 0) # Header Background\r\n draw_rect(WIDTH-300, 50, 300, HEIGHT, COLOR_LIGHT_GREY, 1) # Action Panel\r\n @heading_font.draw_text(\"Swincoin\", 350, 9, 1, 1.0, 1.0, COLOR_WHITE, mode=:default) # Header Text\r\n draw_info(mouse_x, mouse_y)\r\n draw_transaction_box(mouse_x, mouse_y)\r\n draw_peers\r\n # Footer\r\n draw_rect(0,HEIGHT-32,WIDTH,32,COLOR_BLACK,2)\r\n @content_font.draw_text(\"Last Action: #{$status}\", 10, HEIGHT-22, 2, 1.0, 1.0, COLOR_WHITE, mode=:default)\r\n end", "def display_track(title, ypos)\r\n @track_font.draw(title, TrackLeftX, ypos, ZOrder::PLAYER, 1.0, 1.0, Gosu::Color::BLACK)\r\nend", "def draw\n @game.state.views.each do |view|\n view.draw\n end\n end", "def draw\n puts\n output_to_diplay('', \" | | \", '')\n output_to_diplay('', \" #{squares[1]} | #{squares[2]} | #{squares[3]} \", '')\n output_to_diplay('', \" | | \", '')\n output_to_diplay('', \"-----+-----+-----\", '')\n output_to_diplay('', \" | | \", '')\n output_to_diplay('', \" #{squares[4]} | #{squares[5]} | #{squares[6]} \", '')\n output_to_diplay('', \" | | \", '')\n output_to_diplay('', \"-----+-----+-----\", '')\n output_to_diplay('', \" | | \", '')\n output_to_diplay('', \" #{squares[7]} | #{squares[8]} | #{squares[9]} \", '')\n output_to_diplay('', \" | | \", '')\n puts\n end", "def draw\n @graphics.draw\n @script.draw\n end", "def draw\n Gosu.scale(@scale[:x], @scale[:y], x, y) do\n Gosu.rotate(@rotation, *get_center.values) do\n Gosu.translate(*get_corner(:left, :top).get_position.values) do\n call_method_on_children :draw\n end\n #draw_debug # TODO: Clean up\n end\n end\n end", "def draw_winner\n case @winner_direction\n when :horizontal\n line_x1_1 = Utility.c_to_x(@winner_c)\n line_y1_1 = Utility.r_to_y(@winner_r) + 20\n line_x1_2 = Utility.c_to_x(@winner_c + 5)\n line_y1_2 = Utility.r_to_y(@winner_r) + 20\n\n line_x2_1 = line_x1_1\n line_y2_1 = line_y1_1 + 1\n line_x2_2 = line_x1_2\n line_y2_2 = line_y1_2 + 1\n\n line_x3_1 = line_x1_1\n line_y3_1 = line_y1_1 + 2\n line_x3_2 = line_x1_2\n line_y3_2 = line_y1_2 + 2\n when :vertical\n line_x1_1 = Utility.c_to_x(@winner_c) + 20\n line_y1_1 = Utility.r_to_y(@winner_r)\n line_x1_2 = Utility.c_to_x(@winner_c) + 20\n line_y1_2 = Utility.r_to_y(@winner_r + 5)\n\n line_x2_1 = line_x1_1 + 1\n line_y2_1 = line_y1_1\n line_x2_2 = line_x1_2 + 1\n line_y2_2 = line_y1_2\n\n line_x3_1 = line_x1_1 + 2\n line_y3_1 = line_y1_1\n line_x3_2 = line_x1_2 + 2\n line_y3_2 = line_y1_2\n when :diagonal_up\n line_x1_1 = Utility.c_to_x(@winner_c)\n line_y1_1 = Utility.r_to_y(@winner_r + 1)\n line_x1_2 = Utility.c_to_x(@winner_c + 5)\n line_y1_2 = Utility.r_to_y(@winner_r - 4)\n\n line_x2_1 = line_x1_1\n line_y2_1 = line_y1_1 + 1\n line_x2_2 = line_x1_2 + 1\n line_y2_2 = line_y1_2\n\n line_x3_1 = line_x1_1 + 1\n line_y3_1 = line_y1_1 + 1\n line_x3_2 = line_x1_2 + 1\n line_y3_2 = line_y1_2 + 1\n when :diagonal_down\n line_x1_1 = Utility.c_to_x(@winner_c)\n line_y1_1 = Utility.r_to_y(@winner_r)\n line_x1_2 = Utility.c_to_x(@winner_c + 5)\n line_y1_2 = Utility.r_to_y(@winner_r + 5)\n\n line_x2_1 = line_x1_1 + 1\n line_y2_1 = line_y1_1\n line_x2_2 = line_x1_2\n line_y2_2 = line_y1_2 - 1\n\n line_x3_1 = line_x1_1\n line_y3_1 = line_y1_1 + 1\n line_x3_2 = line_x1_2 - 1\n line_y3_2 = line_y1_2\n end\n\n # Render the three lines\n draw_line(line_x1_1, line_y1_1, Gosu::Color.argb(0xffff0000),\n line_x1_2, line_y1_2, Gosu::Color.argb(0xffff0000), 2, :default)\n draw_line(line_x2_1, line_y2_1, Gosu::Color.argb(0xffff0000),\n line_x2_2, line_y2_2, Gosu::Color.argb(0xffff0000), 2, :default)\n draw_line(line_x3_1, line_y3_1, Gosu::Color.argb(0xffff0000),\n line_x3_2, line_y3_2, Gosu::Color.argb(0xffff0000), 2, :default)\n end", "def draw\n # Draw background color\n Gosu.draw_rect(0, 0, WIN_WIDTH, WIN_HEIGHT, @background, ZOrder::BACKGROUND, mode=:default)\n # Draw the button\n Gosu.draw_rect(50, 50, 100, 50, Gosu::Color::GREEN, ZOrder::MIDDLE, mode=:default)\n # Draw the button text\n @button_font.draw(\"Click me\", 65, 65, ZOrder::TOP, 1.0, 1.0, Gosu::Color::BLACK)\n # Draw the mouse position information\n @info_font.draw(\"mouse_x: #{@locs[0]}\", 0, 350, ZOrder::TOP, 1.0, 1.0, Gosu::Color::BLACK)\n end", "def draw\n\t\tframe_rate 10\n\t\tbackground 0\n\t\tstroke 255\n\t\tstroke_weight 2\n\t\tdx = width/2 - mouse_x\n\t\tdy = height/2 - mouse_y\n\t\tline(width/2, height/2, mouse_x, mouse_y)\n\t\t\n\t\tangle = atan2(dy, dx)\n\t\t#puts \"angle in radians\" + angle.to_s\n\t\tdeg = degrees(angle)\n\t\tputs \"degrees(angle) \" + deg.to_s\n\t\t\n\t\tmapped = north(deg)\n\t\tputs \"mapped = \" + mapped.to_s\n\tend", "def draw\r\n yield @screen\r\n\r\n # Show the changes to the screen surface by flipping the buffer that is visible\r\n # to the user. All changes made to the screen surface will appear\r\n # simultaneously\r\n @screen.flip\r\n end", "def draw\n\t\t@move_action.draw\n\tend", "def draw\n @img_background.draw(0, 0, 0)\n\n color = 0xfff4cc00\n @logo_font.draw_rel(\"Level #{@level}\", Game::ScreenWidth / 2, 120, ZOrder::Hud, 0.5, 0.5, 2, 2, color)\n\n end", "def draw\n Gosu.draw_rect(@xpos, @ypos, @width, @height, Gosu::Color.argb(0xff_000000))\n for i in 0..2\n if(@text[i] != nil) \n @text[i].draw(@xpos + 10, @ypos + @height - (i + 1)* (@text[i].getImage().height + 2) -3)\n end\n end \n end" ]
[ "0.80781794", "0.8012489", "0.799902", "0.7836345", "0.77422065", "0.7699074", "0.761155", "0.75536776", "0.7488505", "0.74707276", "0.74707276", "0.74707276", "0.74707276", "0.74156445", "0.7412836", "0.741004", "0.7400605", "0.73975027", "0.73975027", "0.73975027", "0.73744744", "0.72987413", "0.7285038", "0.72591716", "0.7242774", "0.7242774", "0.72361267", "0.7230403", "0.72277373", "0.72077954", "0.71664447", "0.71664447", "0.71544635", "0.7133624", "0.7104339", "0.71030676", "0.70980245", "0.70799047", "0.70789504", "0.7076757", "0.7055677", "0.7039681", "0.7024375", "0.6950821", "0.6950465", "0.6939451", "0.6922699", "0.6922524", "0.6900299", "0.68858194", "0.68621516", "0.6861111", "0.6860023", "0.6831366", "0.68283635", "0.68217164", "0.6786686", "0.6749775", "0.6738228", "0.67331433", "0.67229456", "0.6710772", "0.6672617", "0.666492", "0.66613126", "0.66576844", "0.6650978", "0.66427976", "0.6637829", "0.6619496", "0.6619138", "0.66106576", "0.6605743", "0.6594996", "0.65937304", "0.6586518", "0.65771157", "0.6570563", "0.6570023", "0.6562298", "0.65556353", "0.65550464", "0.6551496", "0.6550176", "0.6547049", "0.65355885", "0.6533905", "0.653114", "0.6527348", "0.652412", "0.651623", "0.65016097", "0.6501607", "0.64990956", "0.6491509", "0.648485", "0.6481064", "0.6455862", "0.64508694", "0.6446714" ]
0.73315066
21
Moving thr bullet across the screen after being fired
def move # Move bullet fired by the Spaceship up the screen if @type == 'good' @y -= @SPEED # Move bullet fired by the Aliens down the screen elsif @type == 'evil' @y += @SPEED end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_bullets args\n args.state.bullets.each do |bullet| # perform action on each bullet in collection\n bullet.x += bullet.speed # increment x by speed (bullets fly horizontally across screen)\n\n # By randomizing the value that increments bullet.y, the bullet does not fly straight up and out\n # of the scope of the screen. Try removing what follows bullet.speed, or changing 0.25 to 1.25 to\n # see what happens to the bullet's movement.\n bullet.y += bullet.speed.*(0.25).randomize(:ratio, :sign)\n bullet.rect = [bullet.x, bullet.y, bullet.size, bullet.size] # sets definition of bullet's rect\n end\nend", "def move()\n #first it checks if it is on an edge\n if (\n @model.x >= Window.width-@size ||\n @model.x <= 0 ||\n @model.y >= Window.height-@size ||\n @model.y <= 0\n )\n #if the bullet is on the edge then it will die\n self.kill()\n end\n #this moves the bullet by the velocity of the bullet\n @pos.x += @vel.x\n @pos.y += @vel.y\n #moves the bullets model\n @model.x = @pos.x\n @model.y = @pos.y\n end", "def shoot\n return Bullet.new(@window, @x, @y, 0, -2, true)\n end", "def move_player_bullet args\n # don't update the position if the bullet isn't in action\n if args.state.player_bullet_shooting\n # go see if the bullet hit the enemy\n check_enemy_hit args\n # update the bullet y position\n args.state.player_bullet_y += 10\n # has the bullet gone off the top of the screen?\n if args.state.player_bullet_y > 720\n # don't bother updating it\n args.state.player_bullet_shooting = false\n end\n end\nend", "def move_enemy_bullet args\n # don't update the position if the bullet isn't in action\n if args.state.enemy_bullet_shooting\n # go see if the bullet hit the player\n check_player_hit args\n # update the bullet y position\n args.state.enemy_bullet_y -= 10\n # has the bullet gone off the bottom of the screen?\n if args.state.enemy_bullet_y < 0 - args.state.enemy_bullet_h\n # don't bother updating it\n args.state.enemy_bullet_shooting = false\n end\n end\nend", "def shoot(dir)\n\t\tx_origin = @x + (@width / 2.0) - (10)\n\t\ty_origin = @y + (@height / 2.0) - (10)\n\t\t@bullets.push(Bullet.new(x_origin, y_origin, 20, 20, @player.bullet_image, @gameWindow, 3, 3, dir)) #fix this.\n\t\t@remaining_time = @shot_time\n\tend", "def shoot arrow\r\n arrow.x+=arrow.vel_x\r\n arrow.y+=arrow.vel_y\r\n end", "def fire_bullet args\n return unless args.inputs.mouse.click # return unless mouse is clicked\n args.state.bullets << args.state.new_entity(:bullet) do |bullet| # new bullet is declared a new entity\n bullet.y = args.inputs.mouse.click.point.y # set to the y value of where the mouse was clicked\n bullet.x = 0 # starts on the left side of the screen\n bullet.size = 10\n bullet.speed = 10 * rand + 2 # speed of a bullet is randomized\n bullet.rect = [bullet.x, bullet.y, bullet.size, bullet.size] # definition is set\n end\nend", "def player_fire_bullet()\r\n # This makes sure that bullets are fired after certain intervals\r\n if Gosu.milliseconds > (@seconds_elapsed * COUNTER)\r\n @seconds_elapsed = Gosu.milliseconds\r\n @bullet_sound.bmp.play()\r\n # Generating a bullet object\r\n @bullets.push Bullet.new((@player.x+ 33), @player.y, 'good')\r\n end \r\n end", "def shoot_1\n if Time.now - @last_shoot_1 > 0.5\n @window.e_bullets << Ennemy_Bullet.new(@window, @player, @x, @y, -2, 4)\n @window.e_bullets << Ennemy_Bullet.new(@window, @player, @x, @y, 0, 4)\n @window.e_bullets << Ennemy_Bullet.new(@window, @player, @x, @y, 2, 4)\n @last_shoot_1 = Time.now\n end\n end", "def shoot_2\n if Time.now - @last_shoot_1 > 0.05\n @window.e_bullets << Ennemy_Bullet.new(@window, @player, @x - 28, @y, 0, 7)\n @window.e_bullets << Ennemy_Bullet.new(@window, @player, @x + 28, @y, 0, 7)\n @last_shoot_1 = Time.now\n end\n end", "def update()\n #checks if it has hit an asteroid\n self.hit()\n #moves the bullet\n self.move()\n end", "def tick!\n rotate_turret\n shoot\n end", "def shoot\n bullet1 = Bullet.new(@x, @y, @angle, @map, @pColor)\n bullet2 = Bullet.new(@x, @y, @angle + Math::PI / 2, @map, @pColor)\n bullet3 = Bullet.new(@x, @y, @angle + Math::PI, @map, @pColor)\n bullet4 = Bullet.new(@x, @y, @angle + Math::PI * 3 / 2, @map, @pColor)\n\n @map.PobjectArray.push(bullet1)\n @map.PobjectArray.push(bullet2)\n @map.PobjectArray.push(bullet3)\n @map.PobjectArray.push(bullet4)\n end", "def add_bullets\n @window.bullets << Vibrant_Bullet.new(@window, @player, @player.x, @player.y - @player.height/2.0)\n end", "def shoot\n @shooting = true\n end", "def turn_left\n @shape.body.t -= 300.0\n end", "def player_shoot\n distance = choose_shot_distance\n room_number = choose_room_target(distance)\n @game.shoot_arrow(room_number)\n animate('>>>--------~>')\n end", "def fire \n\n # Could end up spawning a number of bullets, depending on the weapon\n bullets = []\n\n # For now, we'll just spawn a small green laser bolt!\n bullets << Laser.new( :laser_small_green, @x - 64, @y + 64, false )\n\n # And just hand back that collection of bullets\n bullets\n\n end", "def turn\n @delta.x = -@delta.x\n @delta.y = -@delta.y\n end", "def shoot(window,shot,player)\n\t\tshot << Bullet.new(window, self, player)\n\t\t@reload_end = Gosu::milliseconds\n\tend", "def touched_by bullet\n ([@width, @height].max/3).times do\n p_vx = rand(100)/10.0 - 5\n p_vy = rand(100)/10.0 - 5\n #@window.particles << Particle.new(@window, @x + rand(@width) - @width/2, @y + rand(@height) - @height/2, p_vx, p_vy)\n @window.particles << Live_Particle.new(@window, bullet.x + rand(@width) - @width/2, bullet.y + rand(@height) - @height/2, p_vx, p_vy, @colors.rand_in, 1 + rand)\n end\n damage bullet.damage\n end", "def shoot\n\t\tt = (Rubygame::Time.get_ticks() - @parent.stamp[:p])/1000.0\n\t\tv = Vector.new(1,0).rotate(@parent.angle)\n\t\tv.magnitude += 150\n\t\tp = @parent.project(t)\n\t\t@parent.groups[0].push(@type.new(p,v,@lifespan))\n\tend", "def move\n \n end", "def move\n \n end", "def shoot\n\t\t# Updates last shot distance if it can't shoot\n\t\tif @lastShot <= @SHOT_LAG then\n\t\t\t@lastShot = Gosu::distance(@x, @y, @lastPosX, @lastPosY)\n\t\telse\n\t\t\t# Preps a new bullet and resets last shot distance\n\t\t\t@lastShot = 0\n\t\t\t@lastPosX = @x\n\t\t\t@lastPosY = @y\n\t\t\t# returns a bullet with a velocity 1 greater than the ship's\n\t\t\t# velocity\n\t\t\treturn Bullet.new(@window, @x, @y, 0, @vel+1, false)\n\t\tend\n\tend", "def step\n if @game_over\n game_over!\n @event_handler.update\n else\n # background for playing field and hud\n @screen.fill :black\n @screen.fill [50,50,50], Rect.new(Configuration.screen[:hud_rect])\n\n @event_handler.update\n @hud.update @clock.framerate.ceil, @round, @enemies.length, @money, @lives+1, @round_timer\n\n update_timer\n restock_enemies! if @restock_enemies > 0\n\n @the_path.draw @screen # Draw the enemy path.\n @enemies.draw @screen # Draw the enemies.\n @towers.draw @screen # Draw all set towers.\n @grid_highlighter.draw @screen # Draw the nifty semi-transparent highlighter below the mouse.\n @hud.draw @screen # draw the HUD\n end\n\n @screen.update() # Refresh the screen.\n end", "def move\n self.speed += random_vector(0.5)\n self.position.x -= window.current_speed/4\n bounce_off_border_y\n on_hitting_x { destroy!; return }\n end", "def update\n space.fall(self) if should_fall?\n move\n end", "def kick_bomb(bomb)\n bomb_manager.getBomb(bomb).moveTo(@new_x, @new_y)\n #or bomb.moveTo(:direction)\n end", "def hit_by_bullet\n $p_bullets.delete_if do |b|\n if self.bounding_box_collision?(b)\n @meter.change_width(b.dmg)\n b.destroy\n during(100) { @color.alpha = 100 }.then { @color.alpha = 255 }\n @life -= 1.0\n true\n end\n end\n end", "def game_blade_action\n if tool_canuse?(BladeWeaponId) and not @showing_blade\n @gameblade.direction = @direction\n @gameblade.moveto(@x, @y)\n @showing_blade = true\n @gameblade.action_time = 30\n @tool_anime = @gameblade.action_time\n RPG::SE.new(BladeSoundSe,75, 130).play\n end\n end", "def moving!\n end", "def move\n\n end", "def start_movement\n end", "def shoot\n\t\t\t\t# Project\n\t\t\t\t@current.shoot\n\t\t\t\tself\n\t\t\tend", "def moveLeft(dist)\n @body.p.x -= dist\n end", "def enemy_shoot args\n # generate a random number from 0 to 99\n r = rand(100)\n # is the random number 0? that give a a 1 in 100 chance of shooting\n # is the enemy shooting? Only shoot if not already shooting.\n if r == 1 && args.state.enemy_bullet_shooting == false\n # set the enemy bullet position to the enemy position\n args.state.enemy_bullet_x = args.state.enemy_x + args.state.enemy_w / 2\n args.state.enemy_bullet_y = args.state.enemy_y\n # track state of enemy bullet\n args.state.enemy_bullet_shooting = true\n end\nend", "def move; end", "def move; end", "def moveLeft\n if @x > 1\n call Screen.setColor(false)\n call Screen.drawRectangle((@x + @size) - 1, @y, @x + @size, @y + @size)\n let @x = @x - 2\n call Screen.setColor(true)\n call Screen.drawRectangle(@x, @y, @x + 1, @y + @size)\n end\n end", "def class_update\n if can_drop_bomb? and closest_target\n drop_bomb if on_top_of?(closest_target)\n if facing_right_of?(closest_target)\n turn_left\n end\n if facing_left_of?(closest_target)\n turn_right\n end\n end\n go_forward\n loop_position\n end", "def draw\n @running = @body.v.x.abs >= 1\n\n unless @running or @attacking #set idle sprite unless they're running or attacking\n if @direction == :left\n @sprite = @sprite_left\n else\n @sprite = @sprite_right\n end\n end\n \n if @dmg_cooldown > 0 && @direction == :right \n @sprite = @sprite_damage\n elsif @dmg_cooldown > 0 && @direction == :left\n @sprite = @sprite_damage_left\n end\n if @dead\n @sprite = Gosu::Image.new(\"assets/images/player/death.png\")\n end\n super\n end", "def add_bullet(bullet)\n @bullets << bullet\n end", "def moveDown\n if (@y + @size) < 254\n call Screen.setColor(false)\n call Screen.drawRectangle(@x, @y, @x + @size, @y + 1)\n let @y = @y + 2\n call Screen.setColor(true)\n call Screen.drawRectangle(@x, (@y + @size) - 1, @x + @size, @y + @size)\n end\n end", "def moveUp\n if @y > 1\n call Screen.setColor(false)\n call Screen.drawRectangle(@x, (@y + @size) - 1, @x + @size, @y + @size)\n let @y = @y - 2\n call Screen.setColor(true)\n call Screen.drawRectangle(@x, @y, @x + @size, @y + 1)\n end\n end", "def updatePosition\n super\n\n Bullet.BulletInstances.each { |bullet|\n if collision?(bullet)\n bullet.destroy\n explode\n end\n }\n\n Ship.ShipInstances.each { |ship|\n if collision?(ship)\n ship.destroy\n explode\n end\n }\n end", "def move\n if me\n turn_left if window.button_down? Gosu::KbLeft\n turn_right if window.button_down? Gosu::KbRight\n run if window.button_down? Gosu::KbUp\n run_with_ball\n end\n end", "def player_hit(bullet)\r\n @bullets.delete bullet\r\n @ship_hit_sound.bmp.play\r\n # If the player has lost all the lifeline end the game\r\n if @player.life == 0\r\n # Ending the game\r\n GameOverWindow.new.show\r\n close\r\n end \r\n # Player lost one lifeline\r\n @player.lose_life()\r\n # Plaing a blank heart to represent it\r\n @heart_list[@player.life] = @blank_heart\r\n @heart = @blank_heart \r\n end", "def update_fall\n self.x += @direction\n self.y -= @speed\n @speed -= GRAVITY\n end", "def move\n\t\t@x += 0\n\t\t@y += @vel\n\tend", "def moveInTurret _obj, _args\n \"_obj moveInTurret _args;\" \n end", "def enemy_bullet_collision\n if cr.defeated == false\n $e_bullets.each do |b|\n if self.bounding_box_collision?(b)\n @life -= 1\n $hud.set_lives(life)\n clear_all_bullets\n end\n end\n end\n end", "def draw\n\t\t# \n\t\t# Clear the screen.\n\t\t#\n\t\tprint \"\\e[2J\"\n\n\t\tif not @animate\n\n\t\t\t# \n\t\t\t# Move to upper left and defer to superclass.\t\t\t\n\t\t\t#\n\t\t\tprint \"\\e[H\"\n\t\t\tsuper()\n\n\t\telse\n\t\t\t#\n\t\t\t# If we are animating, clear the screen and start carving!\n\t\t\t#\n\t\t\tcarve_passages\n\t\tend\n\tend", "def moveRight\n if (@x + @size) < 510\n call Screen.setColor(false)\n call Screen.drawRectangle(@x, @y, @x + 1, @y + @size)\n let @x = @x + 2\n call Screen.setColor(true)\n call Screen.drawRectangle((@x + @size) - 1, @y, @x + @size, @y + @size)\n end\n end", "def pile(w)\n w.drag_to(@current)\n w.set_default_refresh_loc('tl')\n @current.x += PILE_OFFSET\n end", "def move_down\n\t\tmove([0,1])\n\tend", "def move!\n\t\tbounce! until !will_bounce? #TODO add surroundedness checking\n\t\t@x += @@target_coords[@direction][:dx]\n\t\t@y += @@target_coords[@direction][:dy]\n\tend", "def move\n\t\t# move 5px to the left\n\t @x = @x - 5\n\t # move up or down based on the Y velocity\n\t @y = @y + @vy\n\tend", "def shoot\n \tuser_shoot\n\tend", "def alien_fire_bullet()\r\n # The aliens will fire bullets at random, \r\n # The randomness is controlled by @alien_fire_rand\r\n @aliens.each { |alien|\r\n if rand(@alien_fire_rand) == 0\r\n @bullets.push Bullet.new(alien.x, alien.y+ 40, 'evil')\r\n end\r\n }\r\n end", "def turnLeft\n if @placed\n @face = @face.turnLeft\n end\n end", "def update_balloon\n if @balloon_duration > 0\n @balloon_duration -= 1\n if @balloon_duration > 0\n @balloon_sprite.x = x\n @balloon_sprite.y = y - oy\n @balloon_sprite.z = z + 200\n sx = balloon_frame_index * 32\n sy = (@balloon_id - 1) * 32\n @balloon_sprite.src_rect.set(sx, sy, 32, 32)\n else\n end_balloon\n end\n end\n end", "def weapons_scroll_up\n guns[selected_gun].off\n @selected_gun -= 1\n if @selected_gun <= -1\n @selected_gun = @guns.length-1\n end\n guns[selected_gun].on\n end", "def moveto(x, y)\r\r\n @x = x % $game_map.width\r\r\n @y = y % $game_map.height\r\r\n @real_x = @x\r\r\n @real_y = @y\r\r\n @prelock_direction = 0\r\r\n straighten\r\r\n update_bush_depth\r\r\n end", "def moveto(x, y)\r\n @x = x % $game_map.width\r\n @y = y % $game_map.height\r\n @real_x = @x\r\n @real_y = @y\r\n @prelock_direction = 0\r\n straighten\r\n update_bush_depth\r\n end", "def update args\n\n # Keep the backdrop scrolling, always...\n @backdropl_spr.source_x += 2\n if @backdropl_spr.source_x > BACKDROP_WIDTH \n @backdropl_spr.source_x = 0\n end\n @backdropr_spr.source_x = @backdropl_spr.source_x\n\n\n # Check to see if the player needs creating\n if @player.nil? && @lives.positive?\n @player = Player.new args\n end\n\n\n # Also, spawn any enemies that are due\n while ( @enemy_idx < @@enemies.length ) && ( args.state.tick_count >= ( @epoch + @@enemies[@enemy_idx][:spawn] ) ) do\n @enemy << Enemy.new( @@enemies[@enemy_idx] )\n @enemy_idx += 1\n end\n\n\n # User input; see if we're moving first off\n horizontal = 0\n vertical = 0\n if args.inputs.keyboard.key_held.up || args.inputs.keyboard.key_held.w || args.inputs.controller_one.key_held.up\n vertical = 1\n end\n if args.inputs.keyboard.key_held.down || args.inputs.keyboard.key_held.s || args.inputs.controller_one.key_held.down\n vertical = -1\n end\n if args.inputs.keyboard.key_held.right || args.inputs.keyboard.key_held.d || args.inputs.controller_one.key_held.right\n horizontal = 1\n end\n if args.inputs.keyboard.key_held.left || args.inputs.keyboard.key_held.a || args.inputs.controller_one.key_held.left\n horizontal = -1\n end\n @player.move horizontal, vertical\n\n\n # If the player is firing, fire the current weapon they have\n if @player_bullets.empty? && ( args.inputs.keyboard.key_held.space || args.inputs.controller_one.key_held.a )\n @player_bullets.concat( @player.fire )\n end\n\n\n # Update the position of any player bullets\n @player_bullets.each { |bullet| bullet.update args }\n\n\n # Allow each enemy to move\n @enemy.each { |ship| ship.move }\n\n\n # Decide if any enemies get to shoot\n\n\n # And update all of their bullets, too\n @enemy_bullets.each { |bullet| bullet.update args }\n\n\n # And purge any bullets now out of scope\n @player_bullets.delete_if { |bullet| bullet.outofbounds? args.grid }\n @enemy_bullets.delete_if { |bullet| bullet.outofbounds? args.grid }\n\n \n # Check to see if any player bullets collided with any enemies\n @player_bullets.each do | bullet |\n\n # Check against each enemy\n @enemy.each do | ship |\n if bullet.collides? ship\n args.outputs.debug << [ 100, 100, \"HIT!\", 5, 1, 255, 0, 0 ].label\n end\n end\n \n end\n\n\n # Everything is fine, stick with this world!\n true\n\n end", "def draw\n\t\t@move_action.draw\n\tend", "def moveInGunner _obj, _args\n \"_obj moveInGunner _args;\" \n end", "def call_idle(sprite, anime)\n $game_player.set_step_anime(anime)\n $game_player.set_graphic(sprite)\n end", "def hook_action\n if tool_canuse?(HweaponId) and not @showing_hook\n unless character_at_playerpos?\n @hookshot.each do |hook| \n hook.direction = @direction\n hook.moveto(@x, @y)\n hook.char_steps = hook.index\n end\n @showing_hook = true\n RPG::SE.new(HookActionSe, 80).play\n @tool_anime = 30\n else\n Sound.play_buzzer\n end\n end\n end", "def fire\n if Gosu::milliseconds - @prev_shot > 60\n self.shots.push(Shot.new(self.game,\"player_shot\",@gfx_shot,@x+8,@y,90,10)) unless @live_shots >= @shots_budget\n @prev_shot = Gosu::milliseconds\n end\n end", "def kick_wall(wall)\n wall.moveTo(@new_x, @new_y)\n #or wall.moveTo(:direction)\n end", "def tick_main_sequence\n @avatar.assign(@tileset.sprite_for(@avatar.cur_tile)) if @avatar.tick\n @camera.start_following(@avatar) if @avatar.walking\n @avatar.reposition(*@camera.follow)\n @map.change_tiles(*@camera.pos)\n end", "def update_move\n self.x = screen_x\n self.y = screen_y\n update_move_arch if @type == Arched\n end", "def draw\n @screen.insert(@frame, 0, 0)\n @screen.draw(0, 0, 0)\n end", "def step\n # Clear the screen.\n @screen.fill( :black )\n \n # Fetch input events, etc. from SDL, and add them to the queue.\n @queue.fetch_sdl_events\n \n # Tick the clock and add the TickEvent to the queue.\n @queue << @clock.tick\n \n # Process all the events on the queue.\n @queue.each do |event|\n handle( event )\n end\n \n # Draw the ship in its new position.\n @ship.draw( @screen )\n \n # Refresh the screen.\n @screen.update()\n end", "def bounce\n self.down\n self.up\n\n true\n end", "def update\n accelerate(0, 1) if should_fall?\n move\n end", "def step\n @queue << UndrawSprites.new( @screen, @background )\n @queue.fetch_sdl_events\n @queue << $game.clock.tick\n @queue << DrawSprites.new( @screen )\n @queue.each do |event|\n handle( event )\n end\n end", "def turn_right\n @shape.body.t += 300.0\n end", "def position_for_next_harvest()\n turn_right()\n move()\n turn_right()\n end", "def command_forge\n make_item\n play_animation\n end", "def finale\n Banner::SweepSound.play\n @posx = 471\n @party_banners.each {|banner| banner.move(@posx,Banner::PosY[0],255,10)}\n end", "def call_idle(sprite, anime)\n $game_player.set_step_anime(anime)\n $game_player.set_graphic(sprite, $game_player.character_index)\n end", "def update\n @player.shape.body.reset_forces\n\n 6.times do\n if button_down? Gosu::KbLeft or button_down? Gosu::GpLeft then\n @player.move_left\n end\n if button_down? Gosu::KbRight or button_down? Gosu::GpRight then\n @player.move_right\n end\n #if button_down? Gosu::KbUp or button_down? Gosu::GpRight then\n # @player.shape.body.a += 0.1\n #\n # puts @player.shape.body.a.inspect\n #end\n #if button_down? Gosu::KbDown or button_down? Gosu::GpRight then\n # @player.shape.body.a -= 0.1\n # puts @player.shape.body.a.inspect\n #end\n\n\n @space.step 1.0/10.0\n end\n end", "def weapons_scroll_down\n guns[selected_gun].off\n @selected_gun += 1\n if @selected_gun >= @guns.length\n @selected_gun = 0\n end\n guns[selected_gun].on\n end", "def start\n ty_ammo_requirements_start\n ty_set_enemy_ammo\n end", "def remove_bullets_of_screen args\n args.state.bullets = args.state.bullets.reject { |bullet| bullet.x > 1280 } # screen width is 1280\nend", "def repos_enemy\n @enemies.each do |i|\n i.x -= @delta_x\n i.y -= @delta_y\n end\n @ground.x -= @delta_x\n @ground.y -= @delta_y\n end", "def move\n @x = (@x + @x_velocity) % Window.width\n @y = (@y + @y_velocity) % Window.height\nend", "def moveto(x, y)\n super\n center(x, y)\n make_encounter_count\n vehicle.refresh if vehicle\n @followers.synchronize(x, y, direction)\n end", "def bullet(name, options={}, &block)\n cur_page.bullet(name, options, &block)\n end", "def move\r\n @x += @x_direction\r\n @y += @y_direction\r\n # Preventing the Alien moving out of the screen\r\n if @x > (SCREEN_WIDTH - GAME_PRESET[\"alien_reach\"]) || @x < 0\r\n @x_direction= -@x_direction\r\n elsif @y > (SCREEN_HEIGHT * @height_limit)\r\n @y_direction = 0\r\n end\r\n end", "def update_screen\n unless self.disposed?\n self.x = screen_x \n self.y = screen_y\n self.z = self.y + 64 + (@is_moving ? 1 : 0)\n end\n end", "def draw\n\tsuper\n\t\n\tif Game.scene.selected_tower\n\t position = grids_to_pixels(Game.scene.selected_tower.position)\n\t \n\t @surface.drawFilledCircle(position[0], position[1], Game.scene.selected_tower.range * Config.part_size[0], Screen.handle.format.mapRGB(0xbb, 0xbb, 0xbb))\n\tend\n\t\n\tposition = Config.monsters_start_at\n\tposition[0] += 1\n\tposition = grids_to_pixels(position)\n\tposition[0] -= 20\n\tposition[1] -= 20\n\tImage.draw(\"images/arrow.png\", @surface, *position)\n\t\n\tposition = Config.monsters_end_at\n\tposition[0] -= 1\n\tposition = grids_to_pixels(position)\n\tposition[0] -= 20\n\tposition[1] -= 20\n\tImage.draw(\"images/arrow.png\", @surface, *position)\n\t\n\tConfig.map_size[1].times do |y|\n Config.map_size[0].times do |x|\n @surface.draw_rect(Config.part_size[0]*x,Config.part_size[1]*y,Config.part_size[0],Config.part_size[1],Screen.handle.format.mapRGB(0x88, 0x88, 0x88))\n end\n end\n\t\n\tGame.scene.get_drawable_objects.each do |i|\n\t position = grids_to_pixels(i.position)\n\t if i.class <= Model::Monster # Drawing HP lines\n\t color = Screen.handle.format.mapRGB(0xaa, 0xaa, 0xaa)\n\t if i.poisoned\n\t color = Screen.handle.format.mapRGB(0xff, 0x00, 0xff)\n\t end\n\t @surface.draw_line(position[0]-12, position[1]-18, position[0]+12, position[1]-18, color)\n\t @surface.draw_line(position[0]-12, position[1]-17, position[0]+12, position[1]-17, color)\n\t \n\t line_len = i.hp * 24 / i.max_hp\n\t \n\t color = Screen.handle.format.mapRGB(0x00, 0xff, 0x00)\n\t if i.frozen\n\t color = Screen.handle.format.mapRGB(0x00, 0xff, 0xff)\n\t end\n\t @surface.draw_line(position[0]-12, position[1]-18, position[0]-12+line_len, position[1]-18, color)\n\t @surface.draw_line(position[0]-12, position[1]-17, position[0]-12+line_len, position[1]-17, color)\n\t end\n\t position[0] -= i.image_size[0]/2\n\t position[1] -= i.image_size[1]/2\n\t \n\t Image.draw(i.image, @surface, *position)\n\tend\n end", "def move_left\n # @dx = -8\n @x -= 8\n end", "def explosion_animation\n sleep 0.15\n system('clear')\n @level1_string[@computer_pos[-1]] = \" \"\n insert_sky\n puts @level1_string\n insert_landscape\n sleep 0.07\n system('clear')\n @level1_string[@computer_pos[-1]] = \"\\u{1f4a5}\"\n insert_sky\n puts @level1_string\n insert_landscape\n end", "def move(direction)\n \n end", "def move\n @x += @vel_x\n @y += @vel_y\n @spin += @vel_spin\n end" ]
[ "0.72474456", "0.7219101", "0.7090387", "0.708837", "0.70361096", "0.70140594", "0.6970675", "0.69470644", "0.69457513", "0.69084144", "0.68800306", "0.67976665", "0.66548663", "0.6641154", "0.6526731", "0.6458217", "0.6372978", "0.63690716", "0.634991", "0.6325225", "0.63155955", "0.63116544", "0.63102674", "0.6284749", "0.6284749", "0.62832564", "0.62764853", "0.6272292", "0.6272033", "0.62624407", "0.61805314", "0.6176403", "0.61514986", "0.60486215", "0.60485995", "0.6044264", "0.60372", "0.602962", "0.60207444", "0.60207444", "0.60064995", "0.5967823", "0.59671676", "0.59483653", "0.59483564", "0.59195596", "0.5902366", "0.58978397", "0.588978", "0.5878623", "0.5867446", "0.5832638", "0.5828105", "0.5827329", "0.5821723", "0.5809074", "0.58073705", "0.58073324", "0.5802253", "0.57898724", "0.5787886", "0.57866263", "0.5786576", "0.57711583", "0.5769193", "0.5737774", "0.57366365", "0.573093", "0.57247084", "0.57213795", "0.571564", "0.57154584", "0.57084596", "0.5696426", "0.5696056", "0.5691096", "0.56872827", "0.56841654", "0.568357", "0.5679916", "0.5678691", "0.56775814", "0.5675233", "0.56591374", "0.5653485", "0.56402177", "0.56381315", "0.5634129", "0.5633115", "0.5631153", "0.5624702", "0.56233746", "0.5621748", "0.5615789", "0.56153333", "0.5613079", "0.56065667", "0.55946124", "0.5594071", "0.5591147" ]
0.69566894
7
Draw function for the bullet class
def draw @image.bmp.draw(@x - @radius, @y- @radius, 1) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bullet\n height = @options[:height].to_f\n @graph_width = @options.has_key?(:width) ? @options[:width].to_f : 100.0\n good_color = @options.has_key?(:good_color) ? @options[:good_color] : '#eeeeee'\n satisfactory_color = @options.has_key?(:satisfactory_color) ? @options[:satisfactory_color] : '#bbbbbb'\n bad_color = @options.has_key?(:bad_color) ? @options[:bad_color] : '#999999'\n bullet_color = @options.has_key?(:bullet_color) ? @options[:bullet_color] : 'black'\n @thickness = height/3.0\n\n create_canvas(@graph_width, height, good_color)\n\n @value = @norm_data\n @good_value = @options[:good].to_f\n\n @graph_height = @options[:height]\n\n qualitative_range_colors = [satisfactory_color, bad_color]\n [:satisfactory, :bad].each_with_index do |indicator, index|\n next unless @options.has_key?(indicator)\n @draw = @draw.fill(qualitative_range_colors[index])\n indicator_width_x = @graph_width * (@options[indicator].to_f / @good_value)\n @draw = @draw.rectangle(0, 0, indicator_width_x.to_i, @graph_height)\n end\n\n if @options.has_key?(:target)\n @draw = @draw.fill(bullet_color)\n target_x = @graph_width * (@options[:target].to_f / @good_value)\n half_thickness = (@thickness / 2.0).to_i\n bar_width = 1.0\n @draw = @draw.rectangle(target_x.to_i, half_thickness, (target_x + bar_width).to_i, @thickness * 2 + half_thickness)\n end\n\n # Value\n @draw = @draw.fill(bullet_color)\n @draw = @draw.rectangle(0, @thickness.to_i, @graph_width * (@data.first.to_f / @good_value), (@thickness * 2.0).to_i)\n\n @draw.draw(@canvas)\n @canvas\n end", "def shoot\n bullet1 = Bullet.new(@x, @y, @angle, @map, @pColor)\n bullet2 = Bullet.new(@x, @y, @angle + Math::PI / 2, @map, @pColor)\n bullet3 = Bullet.new(@x, @y, @angle + Math::PI, @map, @pColor)\n bullet4 = Bullet.new(@x, @y, @angle + Math::PI * 3 / 2, @map, @pColor)\n\n @map.PobjectArray.push(bullet1)\n @map.PobjectArray.push(bullet2)\n @map.PobjectArray.push(bullet3)\n @map.PobjectArray.push(bullet4)\n end", "def render args\n # draw the player's bullet\n render_player_bullet args\n # draw the player\n render_player args\n # draw the enemy bullet\n render_enemy_bullet args\n # draw the enemy\n render_enemy args\n # draw game over\n render_game_over args\nend", "def shoot\n return Bullet.new(@window, @x, @y, 0, -2, true)\n end", "def draw\n\t\t\t\t\n\t\t\tend", "def draw\n end", "def draw\n end", "def draw\n end", "def draw; end", "def draw; end", "def draw\n end", "def draw\n\t\t\n\tend", "def draw\n\t\t\n\tend", "def draw\n\t\t\n\tend", "def draw\n\t\t\n\tend", "def bullet(name, options={}, &block)\n cur_page.bullet(name, options, &block)\n end", "def add_bullet(bullet)\n @bullets << bullet\n end", "def fire_bullet args\n return unless args.inputs.mouse.click # return unless mouse is clicked\n args.state.bullets << args.state.new_entity(:bullet) do |bullet| # new bullet is declared a new entity\n bullet.y = args.inputs.mouse.click.point.y # set to the y value of where the mouse was clicked\n bullet.x = 0 # starts on the left side of the screen\n bullet.size = 10\n bullet.speed = 10 * rand + 2 # speed of a bullet is randomized\n bullet.rect = [bullet.x, bullet.y, bullet.size, bullet.size] # definition is set\n end\nend", "def player_fire_bullet()\r\n # This makes sure that bullets are fired after certain intervals\r\n if Gosu.milliseconds > (@seconds_elapsed * COUNTER)\r\n @seconds_elapsed = Gosu.milliseconds\r\n @bullet_sound.bmp.play()\r\n # Generating a bullet object\r\n @bullets.push Bullet.new((@player.x+ 33), @player.y, 'good')\r\n end \r\n end", "def draw\n\n\t\tend", "def draw\n\t\tend", "def draw\n\tend", "def draw\n raise \"Not implemented\"\n end", "def draw\n framerate_counter.update\n\n draw_background_on self\n poops.each {|poop| poop.draw_on self }\n draw_targets_on self\n boid.draw_on self\n draw_ui_on self\n end", "def draw\n Gosu.draw_rect(@xpos, @ypos, @width, @height, Gosu::Color.argb(0xff_000000))\n for i in 0..2\n if(@text[i] != nil) \n @text[i].draw(@xpos + 10, @ypos + @height - (i + 1)* (@text[i].getImage().height + 2) -3)\n end\n end \n end", "def shoot(dir)\n\t\tx_origin = @x + (@width / 2.0) - (10)\n\t\ty_origin = @y + (@height / 2.0) - (10)\n\t\t@bullets.push(Bullet.new(x_origin, y_origin, 20, 20, @player.bullet_image, @gameWindow, 3, 3, dir)) #fix this.\n\t\t@remaining_time = @shot_time\n\tend", "def draw \n\t\tsuper(\"Lives: #{@lives.to_s}\", X, Y, 5)\n\tend", "def draw\n lines = []\n\n indent = @height - 1\n draw_braches(lines, indent)\n\n lines\n end", "def render_enemy_bullet args\n args.outputs.sprites << {\n x: args.state.enemy_bullet_x,\n y: args.state.enemy_bullet_y,\n w: args.state.enemy_bullet_w,\n h: args.state.enemy_bullet_h,\n path: 'sprites/square/orange.png'\n }\nend", "def render_player_bullet args\n args.outputs.sprites << {\n x: args.state.player_bullet_x,\n y: args.state.player_bullet_y,\n w: args.state.player_bullet_w,\n h: args.state.player_bullet_h,\n path: 'sprites/square/blue.png'\n }\nend", "def draw()\n @ucIcon.draw()\n @cSkillName.draw()\n @cSkillMpCost.draw()\n end", "def draw\r\n draw_background\r\n draw_h(@balls)\r\n end", "def draw\n @player.draw\n if @twoplayer\n @player2.draw\n else\n @bot.draw\n end\n @ball.draw\n @wall.draw\n @score.draw\n @help.draw\n end", "def touched_by bullet\n ([@width, @height].max/3).times do\n p_vx = rand(100)/10.0 - 5\n p_vy = rand(100)/10.0 - 5\n #@window.particles << Particle.new(@window, @x + rand(@width) - @width/2, @y + rand(@height) - @height/2, p_vx, p_vy)\n @window.particles << Live_Particle.new(@window, bullet.x + rand(@width) - @width/2, bullet.y + rand(@height) - @height/2, p_vx, p_vy, @colors.rand_in, 1 + rand)\n end\n damage bullet.damage\n end", "def drawArrow _obj, _args\n \"_obj drawArrow _args;\" \n end", "def drawLine _obj, _args\n \"_obj drawLine _args;\" \n end", "def shoot\n\t\t# Updates last shot distance if it can't shoot\n\t\tif @lastShot <= @SHOT_LAG then\n\t\t\t@lastShot = Gosu::distance(@x, @y, @lastPosX, @lastPosY)\n\t\telse\n\t\t\t# Preps a new bullet and resets last shot distance\n\t\t\t@lastShot = 0\n\t\t\t@lastPosX = @x\n\t\t\t@lastPosY = @y\n\t\t\t# returns a bullet with a velocity 1 greater than the ship's\n\t\t\t# velocity\n\t\t\treturn Bullet.new(@window, @x, @y, 0, @vel+1, false)\n\t\tend\n\tend", "def draw\r\n @game_objects.draw\r\n end", "def draw\n @running = @body.v.x.abs >= 1\n\n unless @running or @attacking #set idle sprite unless they're running or attacking\n if @direction == :left\n @sprite = @sprite_left\n else\n @sprite = @sprite_right\n end\n end\n \n if @dmg_cooldown > 0 && @direction == :right \n @sprite = @sprite_damage\n elsif @dmg_cooldown > 0 && @direction == :left\n @sprite = @sprite_damage_left\n end\n if @dead\n @sprite = Gosu::Image.new(\"assets/images/player/death.png\")\n end\n super\n end", "def draw()\n if visible\n \n case self.align \n when 0 # Left\n x = self.rect.x\n when 1 # Middle\n x = self.rect.x + self.rect.width/2 - self.src_rect.width/2\n when 2 # Right\n x = self.rect.x + self.rect.width - self.src_rect.width\n else\n x = 0\n end\n \n case self.valign \n when 0 # Top\n y = self.rect.y\n when 1 # Middle\n y = self.rect.y + self.rect.height/2 - self.src_rect.height/2\n when 2 # Bottom\n y = self.rect.y + self.rect.height - self.src_rect.height\n else\n y = 0\n end\n\n if !active\n opacity = Font.inactive_alpha()\n else\n opacity = self.opacity\n end\n \n bitmap.blt(x, y, self.img_bitmap, self.src_rect, opacity)\n end\n end", "def draw\n\t\tdraw_background\n\t\t@img.draw(@x+1, \n\t\t\t\t @y+1, \n\t\t\t\t @z, \n\t\t\t\t 1, # Default scale_x \n\t\t\t\t 1, # Default scale_y \n\t\t\t\t @text_colour)\n\tend", "def draw\n @ball.draw\n @player1.draw(@player1_x,@player1_y,0)\n @player2.draw(@player2_x,@player2_y,0)\n @font.draw(\"Score: A #{@player1_score} B #{@player2_score} \", 10, 10, 3, 1.0, 1.0, 0xffffff00)\n end", "def draw\n\t\t#puts \"Node#draw : #{@node_x}, #{@node_y}\"\n\t\t#puts \"Node#draw: str_pos: \" + @str_pos.to_s\n\t\tpushStyle\n\t\t\tno_stroke\n\t\t\tfill 40, 50, 70\n\t\t\tellipse(@node_x, @node_y, @@node_size, @@node_size)\n\t\tpopStyle\n\tend", "def draw()\n if self.actor != nil\n bitmap = Cache.character(self.actor.character_name)\n sign = self.actor.character_name[/^[\\!\\$]./]\n if sign != nil && sign.include?('$')\n cw = bitmap.width / 3\n ch = bitmap.height / 4\n else\n cw = bitmap.width / 12\n ch = bitmap.height / 8\n end\n n = self.actor.character_index\n \n @cCharGraphic.img_bitmap = bitmap\n @cCharGraphic.src_rect = Rect.new((n%4*3+1)*cw, (n/4*4+@direction)*ch, cw, ch)\n @cCharGraphic.draw()\n end\n end", "def draw\n\t\t# Complete the missing code\n\t\tdraw_background()\n\tend", "def draw\n @tip_img.draw(@x, @y, @z)\n @top = @y + @tip_img.height\n while @top <= 600 - @line_img.height\n @line_img.draw(@x, @top, @z)\n @top += @line_img.height\n end\n end", "def draw()\n @ucCharFace.draw()\n @cCharName.draw()\n @ucCharLvl.draw()\n @cHpStatGauge.draw()\n @ucHpStat.draw()\n @cMpStatGauge.draw()\n @ucMpStat.draw()\n end", "def draw()\n @ucCharFace.draw()\n @cCharName.draw()\n @ucCharLvl.draw()\n @cHpStatGauge.draw()\n @ucHpStat.draw()\n @cMpStatGauge.draw()\n @ucMpStat.draw()\n end", "def font_draw\n\t\t@font.draw( \"Debug mode\" , 49, 30 , 1, 1.0, 1.0, 0xfffff000 )\n\t\t@font.draw( (\"x.pos: #{ @ball.xpos } y.pos %.0f\" % [@ball.ypos]), 49, 50 , 1, 1.0, 1.0, 0xfffff000 )\n\n\tend", "def draw_delauney\nend", "def draw(entity)\n case entity\n when Edge then draw_edge entity\n when Box then draw_box entity\n end\n end", "def shoot arrow\r\n arrow.x+=arrow.vel_x\r\n arrow.y+=arrow.vel_y\r\n end", "def draw\n @player.draw\n Graphics.render_tail\n Graphics.draw_tiles(@font)\n Graphics.display_centered_title(@message.join(\"\"), @small_font)\n Graphics.display_lives(@small_font)\n Graphics.show_emoticon(Settings.mailbox, @font) if @message.join(\"\") == @completed \n if Position.collide?(@active_tile, @player)\n Graphics.erase_emoticon\n Graphics.show_emoticon(Settings.failbox, @font) \n end\n end", "def draw\n @img.draw(@x, @y + @dy, 2, 1.0, 1.0, @color)\n end", "def add_bullets\n @window.bullets << Vibrant_Bullet.new(@window, @player, @player.x, @player.y - @player.height/2.0)\n end", "def draw(&proc)\n end", "def draw(&proc)\n end", "def draw(&proc)\n end", "def draw\n # snake head\n Image.new('img/SnakeHead.png',\n x: head[0] * GRID_SIZE,\n y: head[1] * GRID_SIZE)\n # snake tail\n @positions[0..-2].each do |position|\n Circle.new(x: position[0] * GRID_SIZE + GRID_SIZE / 2,\n y: position[1] * GRID_SIZE + GRID_SIZE / 2,\n radius: GRID_SIZE / 2 - 1,\n color: 'blue')\n end\n end", "def move_bullets args\n args.state.bullets.each do |bullet| # perform action on each bullet in collection\n bullet.x += bullet.speed # increment x by speed (bullets fly horizontally across screen)\n\n # By randomizing the value that increments bullet.y, the bullet does not fly straight up and out\n # of the scope of the screen. Try removing what follows bullet.speed, or changing 0.25 to 1.25 to\n # see what happens to the bullet's movement.\n bullet.y += bullet.speed.*(0.25).randomize(:ratio, :sign)\n bullet.rect = [bullet.x, bullet.y, bullet.size, bullet.size] # sets definition of bullet's rect\n end\nend", "def draw size, x_offset, y_offset\n image = @images[0]\n\n px = @x * size\n py = @y * size\n\n if @direction == :left\n image = @images[0]\n # @direction == :right\n else\n image = @images[2]\n end\n\n image.draw(px - x_offset, py - y_offset, 0, size, size)\n drawHealth @health, size, px - x_offset, py - y_offset\n\n end", "def draw_advanced(rect, item) end", "def shoot_1\n if Time.now - @last_shoot_1 > 0.5\n @window.e_bullets << Ennemy_Bullet.new(@window, @player, @x, @y, -2, 4)\n @window.e_bullets << Ennemy_Bullet.new(@window, @player, @x, @y, 0, 4)\n @window.e_bullets << Ennemy_Bullet.new(@window, @player, @x, @y, 2, 4)\n @last_shoot_1 = Time.now\n end\n end", "def drawrect(*)\n super\n end", "def alien_fire_bullet()\r\n # The aliens will fire bullets at random, \r\n # The randomness is controlled by @alien_fire_rand\r\n @aliens.each { |alien|\r\n if rand(@alien_fire_rand) == 0\r\n @bullets.push Bullet.new(alien.x, alien.y+ 40, 'evil')\r\n end\r\n }\r\n end", "def draw\n\t\tsub_face_left = face_left?\n\n\t\tdraw_sub(sub_face_left)\n\t\t@has_moved = false\n\t\t@prawn.draw\n\tend", "def draw()\n @ucIcon.draw()\n @cItemName.draw()\n @cItemPrice.draw()\n @cItemPossess.draw()\n @ucItemNumber.draw()\n end", "def draw\n call Screen.setColor(true)\n call Screen.drawRectangle(@x, @y, @x + @size, @y + @size)\n end", "def draw\n\t\t@player.draw\n\t\t@background_img.draw(0, 0, 0)\n\t\t@stars.each{|star| star.draw}\n\t\t@font.draw(\"Score:#{@player.score}\", 10, 10, ZOrder::UI, 1.0, 1.0, 0xff_ffff00)\n\tend", "def draw\n\t\tif @is_blown\n\t\t\tis_facing_left = face_left?\n\n\t\t\tangle = draw_angle(is_facing_left)\n\t\t\tidx = is_facing_left ? 0 : 1\n\n\t\t\timg = @@tiles[idx]\n\t\t\timg.draw_rot(@x + PARTY_HORN_TILE_WIDTH/2.0, \n\t\t\t\t\t\t @y + PARTY_HORN_TILE_HEIGHT/2.0, \n\t\t\t\t\t\t PARTY_HORN_Z + @player.z, \n\t\t\t\t\t\t angle)\n\t\tend\n\tend", "def draw()\n @ucActStates.draw()\n @cCharImage.draw()\n @cCharName.draw()\n @ucCharLvl.draw()\n @cHpStatGauge.draw()\n @ucHpStat.draw()\n @cMpStatGauge.draw()\n @ucMpStat.draw()\n @cExpGauge.draw()\n @ucExp.draw()\n end", "def draw\n\tsuper\n\t\n\tif Game.scene.selected_tower\n\t position = grids_to_pixels(Game.scene.selected_tower.position)\n\t \n\t @surface.drawFilledCircle(position[0], position[1], Game.scene.selected_tower.range * Config.part_size[0], Screen.handle.format.mapRGB(0xbb, 0xbb, 0xbb))\n\tend\n\t\n\tposition = Config.monsters_start_at\n\tposition[0] += 1\n\tposition = grids_to_pixels(position)\n\tposition[0] -= 20\n\tposition[1] -= 20\n\tImage.draw(\"images/arrow.png\", @surface, *position)\n\t\n\tposition = Config.monsters_end_at\n\tposition[0] -= 1\n\tposition = grids_to_pixels(position)\n\tposition[0] -= 20\n\tposition[1] -= 20\n\tImage.draw(\"images/arrow.png\", @surface, *position)\n\t\n\tConfig.map_size[1].times do |y|\n Config.map_size[0].times do |x|\n @surface.draw_rect(Config.part_size[0]*x,Config.part_size[1]*y,Config.part_size[0],Config.part_size[1],Screen.handle.format.mapRGB(0x88, 0x88, 0x88))\n end\n end\n\t\n\tGame.scene.get_drawable_objects.each do |i|\n\t position = grids_to_pixels(i.position)\n\t if i.class <= Model::Monster # Drawing HP lines\n\t color = Screen.handle.format.mapRGB(0xaa, 0xaa, 0xaa)\n\t if i.poisoned\n\t color = Screen.handle.format.mapRGB(0xff, 0x00, 0xff)\n\t end\n\t @surface.draw_line(position[0]-12, position[1]-18, position[0]+12, position[1]-18, color)\n\t @surface.draw_line(position[0]-12, position[1]-17, position[0]+12, position[1]-17, color)\n\t \n\t line_len = i.hp * 24 / i.max_hp\n\t \n\t color = Screen.handle.format.mapRGB(0x00, 0xff, 0x00)\n\t if i.frozen\n\t color = Screen.handle.format.mapRGB(0x00, 0xff, 0xff)\n\t end\n\t @surface.draw_line(position[0]-12, position[1]-18, position[0]-12+line_len, position[1]-18, color)\n\t @surface.draw_line(position[0]-12, position[1]-17, position[0]-12+line_len, position[1]-17, color)\n\t end\n\t position[0] -= i.image_size[0]/2\n\t position[1] -= i.image_size[1]/2\n\t \n\t Image.draw(i.image, @surface, *position)\n\tend\n end", "def draw\n\t\t@sprite.draw(@x, @y, ZOrder::Enemy)\n\tend", "def draw\n @image.draw(0, 0, 0, Float(@player.health) / 10, 1)\n end", "def draw\n if @dir == :left\n @cur_image = @stand_r\n offs_x = -25\n @offset = :left\n # elsif @vy < 0\n # @cur_image = @jump\n else\n @cur_image = @stand\n offs_x = 25\n end\n @cur_image.draw(@x, @y, 1, 1.0)\n end", "def draw\n intro if @intro_flag\n draw_ruby\n draw_emerald\n @dude.draw(mouse_x - 75, mouse_y - 75, 1)\n hitter\n draw_header\n game_over unless @playing || @intro_flag\n end", "def draw_effect\n end", "def draw\n @font.draw(@text, @x, @y, 0, 1, 1, @color)\n end", "def draw\n @hud = Gosu::Image.from_text(self, stats, Gosu::default_font_name, 30) \n @hud.draw(0, 0, 0)\n\n end", "def draw\n Gosu.scale(@scale[:x], @scale[:y], x, y) do\n Gosu.rotate(@rotation, *get_center.values) do\n Gosu.translate(*get_corner(:left, :top).get_position.values) do\n call_method_on_children :draw\n end\n #draw_debug # TODO: Clean up\n end\n end\n end", "def draw()\n @ucIcon.draw()\n @cItemName.draw()\n @cItemNumber.draw()\n end", "def draw()\n @ucIcon.draw()\n @cItemName.draw()\n @cItemNumber.draw()\n end", "def draw_override(ffi_draw)\n\n # FROM source.txt - this should be documented somewhere :)\n # The argument order for ffi_draw.draw_sprite_3 is:\n # x, y, w, h,\n # path,\n # angle,\n # alpha, red_saturation, green_saturation, blue_saturation\n # flip_horizontally, flip_vertically,\n # tile_x, tile_y, tile_w, tile_h\n # angle_anchor_x, angle_anchor_y,\n # source_x, source_y, source_w, source_h\n\n # Firstly drop in the player ship, centered on the ship\n ffi_draw.draw_sprite_3(\n @x - (@w / 2), @y - (@h / 2), @w, @h,\n 'adrift/sprites/player-ship.png',\n @angle,\n 255, nil, nil, nil,\n nil, nil,\n nil, nil, nil, nil,\n 0.5, 0.5,\n nil, nil, nil, nil\n )\n\n # If we're thrusting, we add on the plume from the engines...\n if @thrusting.positive?\n\n # Draw the flame\n ffi_draw.draw_sprite_3(\n @x - 64 - @angle.vector_x(90), \n @y - 64 - @angle.vector_y(90),\n 128, 128, 'adrift/sprites/thrust.png', @angle + 90,\n 128, nil, nil, nil,\n nil, nil,\n nil, nil, nil, nil,\n 0.5, 0.5,\n (@thrusting / 8).to_i * 128, (@thrusting % 8).to_i * 128,\n 128, 128\n )\n\n end\n\n # Lastly, clear the firing flag; we know this function happens late\n # in the pipeline so it's a safe place to clear it\n @fired = false\n\n end", "def draw()\n if self.enemy != nil\n bitmap = Cache.battler(self.enemy.battler_name, self.enemy.battler_hue)\n @cEnemyGraphic.img_bitmap = bitmap\n @cEnemyGraphic.src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)\n @cEnemyGraphic.draw()\n end\n end", "def draw_advanced(rect, item)\n end", "def bullet\n @bullet ||= load_data.first.bullet\n end", "def draw\n @graphics.draw\n @script.draw\n end", "def draw\n\t\t@image.draw_rot(@x, @y, ZOrder::Enemy, @angle)\n\tend", "def draw_bomb bomb\r\n bomb.cur_image.draw(bomb.x,bomb.y,2)\r\nend", "def draw\n case @status\n when :alive\n @normal_image.draw(@x - @normal_image.width / 2, @y - @normal_image.height / 2, ZOrder::Player)\n when :crashed\n @crash_image.draw(@x - @crash_image.width / 2, @y - @crash_image.height / 2, ZOrder::Player)\n when :resurrecting\n @normal_image.draw(@x - @normal_image.width / 2, @y - @normal_image.height / 2, ZOrder::Player) if (Time.now.to_f * 1000).to_i % 2 == 0\n end\n end", "def draw()\n draw_controls()\n end", "def draw n\n raise NotImplementedError, \"Subclass Responsibility\"\n end", "def draw \n\t\t@image.draw(@x, @y, 1)\n\tend", "def draw\n if @rainbow > 0\n @rainbow_img.draw(@x, @y, PLAYER, @scale, @scale, Gosu::Color.rgba(@color[0], @color[1], @color[2], 150))\n else\n @img.draw(@x, @y, PLAYER, @scale, @scale)\n end\n \n offset = (@img.width - @shield_img.width) / 2\n @shield_img.draw(@x + offset, @scene.height - @shield_img.height, PLAYER, @scale, @scale, Gosu::Color.rgba(255, 255, 255, [@shield, 0].max))\n end", "def draw\n @img.draw(@x, @y, 2, 1.0, 1.0, @color)\n end", "def draw(graphics)\n graphics.set_color @color.native_color\n graphics.draw @line\n end", "def draw(box)\n # Draw in the shadow if we need to.\n unless @shadow_win.nil?\n Draw.drawShadow(@shadow_win)\n end\n\n self.drawTitle(@win)\n\n # Draw in the scrolling list items.\n self.drawList(box)\n end", "def shoot_2\n if Time.now - @last_shoot_1 > 0.05\n @window.e_bullets << Ennemy_Bullet.new(@window, @player, @x - 28, @y, 0, 7)\n @window.e_bullets << Ennemy_Bullet.new(@window, @player, @x + 28, @y, 0, 7)\n @last_shoot_1 = Time.now\n end\n end", "def draw\n draw_background\n draw_ambient\n draw_objects\n draw_ui\n end", "def shoot(window,shot,player)\n\t\tshot << Bullet.new(window, self, player)\n\t\t@reload_end = Gosu::milliseconds\n\tend", "def draw\n\n if @init\n @background.draw(0, 0, -1, 2.5, 2.5)\n end\n\n if not @playing\n @font.draw(\"Game Over\", 300, 300, 3)\n @font.draw(\"Press the Space Bar to Play Again\", 175, 350, 3)\n @visible = 20\n end\n\n @hammer_image.draw(mouse_x-40, mouse_y-10, 2)\n\n if @visible > 0\n @image.draw(@x-@width/2, @y-@height/2, 1)\n end\n\n if @hit == 0\n c = Gosu::Color::NONE\n elsif @hit == 1\n c = Gosu::Color::GREEN\n elsif @hit == -1\n c = Gosu::Color::RED\n end\n @hit = 0\n\n draw_quad(0, 0, c, 800, 0, c, 800, 600, c, 0, 600, c)\n\n @font.draw(@score.to_s, 700, 20, 2)\n @font.draw(@time_left, 20, 20, 2)\n\n end" ]
[ "0.7329271", "0.6924037", "0.69092035", "0.6891286", "0.6854628", "0.67142725", "0.67142725", "0.67142725", "0.6682191", "0.6682191", "0.6609452", "0.6607589", "0.6607589", "0.6607589", "0.6607589", "0.6600639", "0.6598644", "0.6596713", "0.657603", "0.65740335", "0.6545603", "0.6498317", "0.6457467", "0.6447015", "0.6432225", "0.6431311", "0.6387532", "0.6376476", "0.6336278", "0.63247865", "0.6311324", "0.6278844", "0.6277151", "0.6256357", "0.6233218", "0.62194484", "0.62158525", "0.61586547", "0.6153138", "0.6151799", "0.61493397", "0.61379707", "0.61180055", "0.6080592", "0.6078124", "0.60727173", "0.6066491", "0.6066491", "0.60654825", "0.6063013", "0.6062266", "0.6052252", "0.6050485", "0.60192347", "0.6010924", "0.60080844", "0.60080844", "0.60080844", "0.5989733", "0.598731", "0.59780204", "0.5977366", "0.59691334", "0.5961925", "0.5956107", "0.5943526", "0.59372985", "0.5935596", "0.5934636", "0.59279805", "0.59254247", "0.59096116", "0.5908033", "0.5906785", "0.5897706", "0.5891326", "0.58899343", "0.58757067", "0.58714145", "0.58661085", "0.5856595", "0.5856595", "0.5856272", "0.5852773", "0.5852174", "0.5851855", "0.5844951", "0.5822105", "0.5821038", "0.58151585", "0.58047825", "0.57984084", "0.5776254", "0.5770784", "0.57683873", "0.57666093", "0.57661223", "0.5751338", "0.5743621", "0.57418597", "0.5741327" ]
0.0
-1
Procedure to move the Alien
def move @x += @x_direction @y += @y_direction # Preventing the Alien moving out of the screen if @x > (SCREEN_WIDTH - GAME_PRESET["alien_reach"]) || @x < 0 @x_direction= -@x_direction elsif @y > (SCREEN_HEIGHT * @height_limit) @y_direction = 0 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move; end", "def move; end", "def move\n\n end", "def move\n \n end", "def move\n \n end", "def do_the_move(argument)\r\n color, row_s, col_s, row_e, col_e = strip_pos_argument(argument)\r\n start_item = @infosquare[row_s][col_s]\r\n end_item = @infosquare[row_e][col_e]\r\n if movetype == :shortcastle or movetype ==:longcastle\r\n move_castle(start_item, end_item)\r\n elsif movetype == :enpassant\r\n col_enp = end_item.col\r\n row_enp = start_item.row\r\n eated_item = @infosquare[row_enp][col_enp]\r\n eated_item.clear\r\n else\r\n BoardInfoItem.exchange(start_item, end_item)\r\n end\r\n @last_moved_item = end_item\r\n \r\n end", "def moving!\n end", "def move\n move_by a, m\n end", "def move(direction)\n \n end", "def lmove(source, destination, where_source, where_destination); end", "def lmove(source, destination, where_source, where_destination); end", "def move\n\t\t'moved passed'\n\tend", "def move_entity entity; end", "def smove(source, destination, member); end", "def smove(source, destination, member); end", "def move_to(x, y); end", "def move\n case @rover_facing\n when 'N'\n @coordinates[1] += 1\n when 'E'\n @coordinates[0] += 1\n when 'S'\n @coordinates[1] -= 1\n when 'W'\n @coordinates[0] -= 1\n end\n end", "def move(*args)\n \t# Sending destination path\n \tputs \"MOVING\"\n \tmove_entity(*args[0].public_path)\n \tsuper\n end", "def move_onto(a, b)\n reveal(a)\n reveal(b)\n move_single(a, b)\n end", "def move_me\n new_loc = nil\n ploc = @partner[:loc]\n dir = @partner[:dir]\n dist = @partner[:dist]\n if dist == 30\n new_dist = 16\n else\n new_dist = dist / 2\n end\n log \"Moving me. Partner data: #{@partner}\"\n new_loc = [ploc[0] - dir[0] * new_dist, ploc[1] - dir[1] * new_dist]\n log \"Move me to #{new_loc}\"\n \n goto new_loc\n return new_loc\n end", "def moveTo x, y\n\n\tend", "def MOVE\n x,y = Karel.coordinates_after_move_from(karel_instance.direction,*world_instance.karel)\n world_instance.karel=[x,y]\n debug_command('MOVE')\n end", "def move_up\n # TODO: maybe refactor this to use acts-as-list or ranked-model\n aisles = @store.aisles\n\n # first, compact everything back down to 1-n in case a delete or something got it out of whack\n aisles.sort! { |a, b| a.position <=> b.position }\n aisles.each_with_index do |aisle, i|\n aisle.position = i + 1\n aisle.save!\n end\n\n @aisle = aisles.find(params[:id])\n original_position = @aisle.position\n if original_position > 1\n @aisle.position -= 1\n @aisle.save!\n aisles.each do |aisle|\n aisle.position += 1 if aisle != @aisle &&\n aisle.position >= @aisle.position &&\n aisle.position <= original_position\n aisle.save!\n end\n end\n redirect_to(store_aisles_url(@store.id))\n end", "def move\n check_placement\n\n new_position = make_move(current_position, direction)\n position(new_position[0], new_position[1], @table.size)\n end", "def move\n @tail = @location\n closest_food = detect_closest_food\n @location = calculate_next_location(closest_food)\n\n end", "def moveInGunner _obj, _args\n \"_obj moveInGunner _args;\" \n end", "def moveInCommander _obj, _args\n \"_obj moveInCommander _args;\" \n end", "def position_for_next_harvest()\n turn_right()\n move()\n turn_right()\n end", "def smove(*arguments)\n\t\t\t\t\tcall(\"SMOVE\", *arguments)\n\t\t\t\tend", "def move_A\r\n move_down( @deck.index( 'A' ) )\r\n end", "def move\n @coordinates[1] += 1 if @rover_facing == 'N'\n @coordinates[0] += 1 if @rover_facing == 'E'\n @coordinates[1] -= 1 if @rover_facing == 'S'\n @coordinates[0] -= 1 if @rover_facing == 'W'\nend", "def setup_move\n return unless PONY::ERRNO.check_sequence(current_act)\n stop_all_movements\n mx = @map_char.real_x + @acts[1]\n my = @map_char.real_y + @acts[2]\n goto(mx, my, @acts[3], @acts[4], @acts[5] || 0)\n end", "def moves\n\n end", "def move\n\t\treturn \"INVALID COMMANDS, YOU CAN NOT MAKE THE ROBOT FALL OFF THE TABLE\" unless is_valid_move?\n\t\tcase @direction\n\t\twhen \"east\"\n\t\t\t@x_coordinate += 1\n\t\twhen \"west\"\n\t\t\t@x_coordinate -= 1\n\t\twhen \"south\"\n\t\t\t@y_coordinate -= 1\n\t\twhen \"north\"\n\t\t\t@y_coordinate += 1\n\t\telse\n\t\tend\n\t\ttrue\n\tend", "def U\r\n move_method(4) \r\nend", "def move(direction)\n @old = @pos\n @pos += direction\n end", "def aliremove(fabrickey, aliname, *wwn)\n result = @zones.alteralias(fabrickey, 'REMOVE', aliname, *wwn)\n result[1]\n end", "def move\n\t\tif @direction == \"N\"\n\t\t\t@y += 1\n\t\telsif @direction == \"W\"\n\t\t\t@x -= 1\n\t\telsif @direction == \"E\"\n\t\t\t@x += 1\n\t\telsif @direction == \"S\"\n\t\t\t@y -= 1\n\t\tend\n\tend", "def move_dir d\n\t\tmove d.dir( @square)\n\tend", "def move(*args)\n begin\n move_no_cleanup(*args)\n rescue Orp::MovementAlreadyComplete\n warn \"Attempted to complete already completed movement\"\n nil\n rescue\n delete\n raise\n end\n end", "def move\n x_mov, y_mov = MOVEMENT_VECTORS[@direction]\n\n #add vector to current position\n @x_pos += x_mov\n @y_pos += y_mov\n\n throw \"fell off plateau, position: [#{@x_pos}, #{@y_pos}]\" if @x_pos < 0 || @y_pos < 0\n throw \"fell off plateau, position: [#{@x_pos}, #{@y_pos}]\" if @x_pos > @mars_plateau.max_x || @y_pos > @mars_plateau.max_y\n\n [@x_pos, @y_pos]\n end", "def moves\n end", "def update_direction!\n direction.place!(command.arguments[:direction])\n end", "def move\n super\n gravitize\n end", "def moveto(x, y)\n super\n center(x, y)\n make_encounter_count\n vehicle.refresh if vehicle\n @followers.synchronize(x, y, direction)\n end", "def move_to to\n\t\td = Distance.get( @square, to)\n\t\tmove d.dir( @square), to\n\tend", "def move\n case @direction\n when \"N\" then @y += 1 unless @y + 1 > @plateau.y || @@rover_locations.values.include?([@x, @y + 1])\n when \"E\" then @x += 1 unless @x + 1 > @plateau.x || @@rover_locations.values.include?([@x + 1, @y])\n when \"S\" then @y -= 1 unless @y - 1 < 0 || @@rover_locations.values.include?([@x, @y -1])\n when \"W\" then @x -= 1 unless @x - 1 < 0 || @@rover_locations.values.include?([@x -1, @x])\n end\n @@rover_locations[@id.to_sym] = [@x, @y]\n end", "def standard_move\n pos.set(x,y)\n tar = move_towards_player\n sep = seperate_from_enemies\n sep.scalar(5.5, '*')\n tar.scalar(4.0, '*')\n apply_force(sep)\n apply_force(tar)\n if acc.x == 0 and acc.y == 0\n return\n else\n vel.add(acc)\n vel.limit(speed)\n end\n pos.add(vel)\n @x = pos.x\n @y = pos.y\n acc.scalar(0, '*')\n end", "def move(start_peg, end_peg) #nums 0,1,2\n piece = @pegs[start_peg].shift\n @pegs[end_peg].unshift(piece)\n end", "def move_picture picture\n end", "def move \n self.send(@orientation.current.to_sym)\n end", "def move_to who, ox, oy, nx, ny\n @current_level.move_to who, ox, oy, nx, ny\n end", "def move_disambig(direction)\n\t\t\t@north_cmds = [\"n\", \"up\", \"north\"]\n\t\t\t@east_cmds = [\"e\", \"right\", \"east\"]\n\t\t\t@west_cmds = [\"w\", \"left\", \"west\"]\n\t\t\t@south_cmds = [\"s\", \"down\", \"south\"]\n\n\t\t\t\t\txy = $hero.location.xy.split(\", \")\n\t\t\t\t\tx = xy[0].to_i\n\t\t\t\t\ty = xy[1].to_i\n\t\t\t\tif @north_cmds.include?(direction)\n\t\t\t\t\tif $hero.location.exits.include?(\"north\")\n\t\t\t\t\t\tcheck_room(\"north\", x, (y + 1))\n\t\t\t\t\t\tmove(\"north\")\n\t\t\t\t\telse\n\t\t\t\t\t\tputs \"There is no exit to the north!\"\n\t\t\t\t\tend\n\t\t\t\telsif @east_cmds.include?(direction)\n\t\t\t\t\tif $hero.location.exits.include?(\"east\")\n\t\t\t\t\t\tcheck_room(\"east\", (x + 1), y)\n\t\t\t\t\t\tmove(\"east\")\n\t\t\t\t\telse\n\t\t\t\t\t\tputs \"There is no exit to the east!\"\n\t\t\t\t\tend\n\t\t\t\telsif @west_cmds.include?(direction)\n\t\t\t\t\tif $hero.location.exits.include?(\"west\")\n\t\t\t\t\t\tcheck_room(\"west\", (x - 1), y)\n\t\t\t\t\t\tmove(\"west\")\n\t\t\t\t\telse\n\t\t\t\t\t\tputs \"There is no exit to the west!\"\n\t\t\t\t\tend\n\t\t\t\telsif @south_cmds.include?(direction)\n\t\t\t\t\tif $hero.location.exits.include?(\"south\")\n\t\t\t\t\t\tcheck_room(\"south\", x, (y - 1))\n\t\t\t\t\t\tmove(\"south\")\n\t\t\t\t\telse \n\t\t\t\t\t\tputs \"There is no exit to the south!\"\n\t\t\t\t\tend\n\t\t\t\tend\n\t\tend", "def move_it(offs_vector)\n \txlat = Geom::Transformation.new(offs_vector)\n \t\n \tcd = @ci.definition\n \tcd.entities.transform_entities(xlat, @ents_to_move)\n \t\n \t@last_comp_moved = @ci\n end", "def move\n check_placed\n new_position = case facing\n when :north then @position.inc_y\n when :south then @position.dec_y\n when :east then @position.inc_x\n when :west then @position.dec_y\n end\n check_position(new_position)\n @position = new_position\n end", "def move(name, location)\n puts \"This is a story how #{name} life got turned upside down and became the Prince of #{location}.\"\nend", "def move()\n case @mov_dir\n when :right\n if @coord_x == @max_x\n @max_x += 1 # Moving out of bounds. No need to do anything because Ruby rocks! :P\n end\n @coord_x += 1\n \n when :up\n if @coord_y == 0\n @map.unshift [] # Moving out of bounds. Adds a new line to the top\n @max_y += 1\n else\n @coord_y -= 1\n end\n \n when :down\n if @coord_y == @max_y\n @max_y += 1\n @map.push [] # Moving out of bounds. Adds a new line to the bottom\n end\n @coord_y += 1\n \n when :left\n if @coord_x == 0\n @map.each do |a| # Moving out of bounds. Adds a new line to the left\n a.unshift ' ' \n end\n @max_x += 1\n else\n @coord_x -= 1\n end\n end\n end", "def go!\n send_position_to_engine\n move_piece(bestmove)\n end", "def move\n case @direction\n when \"N\"\n @y_coord += 1\n when \"S\"\n @y_coord -= 1\n when \"W\"\n @x_coord += 1\n when \"E\"\n @x_coord -= 1\n end\n end", "def aimPos _args\n \"aimPos _args;\" \n end", "def move(*_)\n dir = direction_compass.to_direction(direction)\n new_value = direction_compass.direction[dir.to_sym]\n\n place(x + new_value[:x], y + new_value[:y])\n end", "def moveInCargo _obj, _args\n \"_obj moveInCargo _args;\" \n end", "def move_east\n @x += 1\n end", "def translate!( *args )\n super( *args )\n reset_positions_inside\n end", "def move_file\n\n end", "def move # takes (x, y, direction) from Rover\n\t\tif direction == \"N\"\n\t\t\t@y += 1\n\t\telsif direction == \"W\"\n\t\t\t@x -= 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\telse \n\t\t\treturn \"The input direction enterned is wrong\"\n\t\tend\n\tend", "def relocate_arena(new_location)\n @arena = new_location\n end", "def move(rover)\n rover.command.each do |m|\n remove_rover(rover)\n rover.move(m)\n place_rover(rover)\n end\n end", "def move\n case @current_rotation\n when ToyEnums::NORTH\n @position_y +=1\n when ToyEnums::SOUTH\n @position_y -=1\n when ToyEnums::EAST\n @position_x +=1\n when ToyEnums::WEST\n @position_x -=1\n else\n\n end\n end", "def moveMan(oldX,oldY,newX,newY)\n @levelArr[newY][newX]='@'\n @levelArr[oldY][oldX]=' '\n #replace the box goals if they were overwritten by the above lines of code\n replenishBoxGoals\nend", "def forward_move\n case @facing\n when 'NORTH'\n @y += 1\n when 'SOUTH'\n @y -= 1\n when 'EAST'\n @x += 1\n when 'WEST'\n @x -= 1\n end\n self\n end", "def move!\n case @facing\n when Direction::NORTH\n @loc[:y] += 1 unless out_of_bounds? @loc[:x], @loc[:y] + 1\n when Direction::EAST\n @loc[:x] += 1 unless out_of_bounds? @loc[:x] + 1, @loc[:y]\n when Direction::SOUTH\n @loc[:y] -= 1 unless out_of_bounds? @loc[:x], @loc[:y] - 1\n when Direction::WEST\n @loc[:x] -= 1 unless out_of_bounds? @loc[:x] - 1, @loc[:y]\n else\n raise %q{Don't know which direction to move}\n end\n end", "def move\n unless moved?\n offset = @deltas.pop\n @moved = true\n end\n end", "def move\n @glade['add_point'].sensitive = false\n @locate_thread = @planning.locate(@start, @finish) {move_finished}\n end", "def commandMove _obj, _args\n \"_obj commandMove _args;\" \n end", "def move(direction)\n @position += direction\n end", "def move(trainer)\n puts \"Which direction? N, W, S or E?\"\n direction = gets.chomp\n case direction.capitalize\n when \"N\"\n delta = [0,1]\n when \"W\"\n delta = [-1,0]\n when \"S\"\n delta = [0,-1]\n when \"E\"\n delta = [1,0]\n else\n return\n end\n trainer.move(delta)\n end", "def move(x,y=@y)\r\n @x2=x+(@x2-@x1)\r\n @y2=y+(@y2-@y1)\r\n @y1=y\r\n @x1=x\r\n end", "def MoveUp()\r\n ret = _invoke(1610743821, [], [])\r\n @lastargs = WIN32OLE::ARGV\r\n ret\r\n end", "def move(args)\n return if !@is_robot_availabe\n case @direction\n when \"NORTH\"\n if @pos_y + STEP <= TABLE_Y\n @pos_y += STEP\n return\n end\n \n when \"EAST\"\n if @pos_x + STEP <= TABLE_X\n @pos_x += STEP\n return\n end\n \n when \"SOUTH\"\n if @pos_y - STEP >= 0\n @pos_y -= STEP\n return\n end\n \n when \"WEST\"\n if @pos_x - STEP >= 0\n @pos_x -= STEP\n return\n end\n \n end\n puts \"Warning: Robot cannot move towards #{@direction} anymore. \"\n # return \"MOVE\" #for test\n end", "def move_card(card, destination)\n card.location = destination\n card.save\n end", "def move\n\t\tif valid_move?\n\t\t\tputs \"\"\n\t\t\tif OS.mac?\n\t\t\t\tcmd = ('say \"roger-roger\"')\n\t\t\t\tsystem cmd\n\t\t\tend\n\t\t\tputs \"Roger, roger I\\'m moving forward one field!\"\n\t\t\tcase @robot_direction\n\t\t\twhen \"EAST\" then @x += 1\n\t\t\twhen \"WEST\" then @x -= 1\n\t\t\twhen \"NORTH\" then @y += 1\n\t\t\twhen \"SOUTH\" then @y -= 1\n\t\t\tend\n\t\telse\n puts \"This is the end of this world and I can't go further in this direction, please change direction\"\n\t\tend\n\tend", "def move\n case @direction\n when \"n\"\n @y_axis += 1\n when \"e\"\n @x_axis += 1\n when \"s\"\n @y_axis -= 1\n when \"w\"\n @x_axis -= 1\n end\n end", "def towerofhanoi(pieces, sourcepeg, destinationpeg, extrapeg)\n if pieces == 0 then\n return \"no pieces to move\"\n end\n towerofhanoi(pieces-1,sourcepeg,extrapeg,destinationpeg)\n puts \"moved #{pieces} from \" + \"#{sourcepeg} to #{destinationpeg}\"\n towerofhanoi(pieces-1,extrapeg,destinationpeg,sourcepeg)\nend", "def FollowingMoveRoute(commands,waitComplete=false)\n $PokemonTemp.dependentEvents.SetMoveRoute(commands,waitComplete)\nend", "def move2end\n iword = $indexy[0]\n $indexy.delete_at(0)\n $indexy.push(iword)\nend", "def move_by a, m\n rad = a * D2R\n self.x += Math.cos(rad) * m\n self.y += Math.sin(rad) * m\n end", "def move\n case @direction\n when \"N\"\n @coord_y += 1\n when \"S\"\n @coord_y -= 1\n when \"E\"\n @coord_x += 1\n else\n @coord_x -= 1\n end #end of case\nend", "def move\n case @facing\n when \"north\"\n @posY += 1 if @posY+1 < @table.width\n when \"east\"\n @posX += 1 if @posX+1 < @table.height\n when \"south\"\n @posY -= 1 if @posY-1 >= 0\n when \"west\"\n @posX -= 1 if @posX-1 >= 0\n end\n end", "def move\n puts \"#{@name}: #{@age} years old, will fly\"\n end", "def move(vpoint)\n @position += vpoint\n end", "def move_rover()\n puts \"DEBUG: moving: #{@orientation}\" if DEBUG\n case @orientation\n when DIRECTION_EAST\n @position[:x] += 1 if @position[:x] < @map.width\n when DIRECTION_WEST\n @position[:x] -= 1 if @position[:x] > 0\n when DIRECTION_NORTH\n @position[:y] += 1 if @position[:y] < @map.height\n when DIRECTION_SOUTH\n @position[:y] -= 1 if @position[:y] > 0\n end\n puts \"DEBUG: position after move: #{@position}\" if DEBUG\n end", "def execute\n return unless @robot.placed?\n\n original_position = @robot.position\n new_position = original_position.dup\n new_position.move\n\n @robot.position = new_position if @table.position_valid?(new_position)\n end", "def move\n\t\t@x += 0\n\t\t@y += @vel\n\tend", "def move_to(xx, yy)\n @x = xx\n @y = yy\n normalize\n end", "def move (animal)\n dir = animal.dir\n x = animal.x\n y = animal.y\n if (dir >= 2 && dir < 5)\n animal.x = (x + 1) % WIDTH\n elsif (dir == 1 || dir == 5)\n animal.x = x % WIDTH\n else\n animal.x = (x - 1) % WIDTH\n end\n if (dir >= 0 && dir < 3)\n animal.y = (y - 1) % HEIGHT\n elsif (dir >= 4 || dir < 7)\n animal.y = (y + 1) % HEIGHT\n else\n animal.y = y % HEIGHT\n end\n animal.energy = animal.energy - 1\nend", "def moveUpAndDown(dis)\n vector = getCurrentDirection\n vector.length = dis\n moveTransformation = Geom::Transformation.translation(vector)\n @@componentInstance.transform! moveTransformation\n updateAvatarLocation\n updateTransformation\n updateViewPort\n\n \n\n end", "def moveInTurret _obj, _args\n \"_obj moveInTurret _args;\" \n end", "def move(player, x, y)\n\n end", "def move\n @leading_x = coordinate_array[0]\n @leading_y = coordinate_array[1]\n end" ]
[ "0.7149363", "0.7149363", "0.70014113", "0.6914599", "0.6914599", "0.6651767", "0.65588886", "0.652299", "0.6512994", "0.6425553", "0.6425553", "0.64027864", "0.63523054", "0.6276716", "0.6276716", "0.627374", "0.62499386", "0.6217407", "0.6216489", "0.6197053", "0.6164005", "0.6113703", "0.6085185", "0.6066674", "0.60665506", "0.6044158", "0.60391545", "0.6013847", "0.60035616", "0.6003227", "0.59916025", "0.5979725", "0.5965669", "0.59548193", "0.5946113", "0.59383065", "0.5932226", "0.59220994", "0.5921232", "0.5899484", "0.58957046", "0.58885807", "0.5886153", "0.58821833", "0.5879861", "0.5871987", "0.5847672", "0.58449554", "0.5829871", "0.58264804", "0.58221775", "0.5820404", "0.58093816", "0.5807872", "0.57687", "0.57542276", "0.5754227", "0.57504004", "0.57497174", "0.5749486", "0.57454807", "0.5741936", "0.5737823", "0.5736072", "0.5734142", "0.5730006", "0.57272947", "0.5720484", "0.57163733", "0.5714189", "0.57130647", "0.57095724", "0.5703659", "0.56908804", "0.5690112", "0.5689475", "0.5685332", "0.568439", "0.5678638", "0.56769496", "0.5675513", "0.56751347", "0.5672274", "0.56597286", "0.5659483", "0.5659475", "0.56514055", "0.5641661", "0.5632828", "0.56181496", "0.56180507", "0.561724", "0.56161237", "0.5614076", "0.560742", "0.5607115", "0.56064874", "0.56057894", "0.5595707", "0.5593753" ]
0.69832593
3
Draw Aliens on the screen
def draw @image.bmp.draw(@x, @y, ZOrder::TOP) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw! 🎮, 📺, color\n translate 📺.solids, 🎮.⛓, [self.x * 🎮.⚖️ + 🎮.🛶 / 2, self.y * 🎮.⚖️ + 🎮.🛶 / 2, 🎮.⚖️ - 🎮.🛶, 🎮.⚖️ - 🎮.🛶, color]\n end", "def draw_ambient\n \n end", "def generate_aliens(position, height)\r\n # Looping until the number of Aliens in a fleet is reached\r\n for i in 0...@alien_count\r\n @aliens.push(Alien.new(i, position, height))\r\n @alien_sound.bmp.play\r\n end\r\n end", "def draw\n\t\tframe_rate 10\n\t\tbackground 0\n\t\tstroke 255\n\t\tstroke_weight 2\n\t\tdx = width/2 - mouse_x\n\t\tdy = height/2 - mouse_y\n\t\tline(width/2, height/2, mouse_x, mouse_y)\n\t\t\n\t\tangle = atan2(dy, dx)\n\t\t#puts \"angle in radians\" + angle.to_s\n\t\tdeg = degrees(angle)\n\t\tputs \"degrees(angle) \" + deg.to_s\n\t\t\n\t\tmapped = north(deg)\n\t\tputs \"mapped = \" + mapped.to_s\n\tend", "def draw_alt_line\n @dim.times do |i|\n if i.even?\n print draw_x\n else\n if @type == \"allx\"\n print draw_x\n elsif @type == \"alt\"\n print draw_dot\n end\n end\n end\n end", "def draw\n Gosu.draw_rect(@xpos, @ypos, @width, @height, Gosu::Color.argb(0xff_000000))\n for i in 0..2\n if(@text[i] != nil) \n @text[i].draw(@xpos + 10, @ypos + @height - (i + 1)* (@text[i].getImage().height + 2) -3)\n end\n end \n end", "def draw_delauney\nend", "def draw\n\t\t@image.draw_rot(@x, @y, ZOrder::Enemy, @angle)\n\tend", "def draw_at(ax, ay)\n DrawTextEx(\n @font,\n @text,\n top_left_position_from_anchor_position(ax, ay),\n @font_size,\n @spacing,\n @color\n )\n end", "def draw\n\t\tdraw_background\n\t\t@img.draw(@x+1, \n\t\t\t\t @y+1, \n\t\t\t\t @z, \n\t\t\t\t 1, # Default scale_x \n\t\t\t\t 1, # Default scale_y \n\t\t\t\t @text_colour)\n\tend", "def draw\n @hud = Gosu::Image.from_text(self, stats, Gosu::default_font_name, 30) \n @hud.draw(0, 0, 0)\n\n end", "def draw\r\n draw_background\r\n draw_h(@balls)\r\n end", "def initialize(x, y, window)\n\t\tsuper(\"images/alien.png\") \n\t\t@x = x\n \t @y = y\n \t\t@window = window\n\tend", "def display\n fill(0)\n stroke(0)\n stroke_weight(1)\n rect_mode(CENTER)\n a = b.get_angle\n push_matrix\n translate(x, y)\n rotate(-a)\n rect(0, 0, w, h)\n pop_matrix\n end", "def font_draw\n\t\t@font.draw( \"Debug mode\" , 49, 30 , 1, 1.0, 1.0, 0xfffff000 )\n\t\t@font.draw( (\"x.pos: #{ @ball.xpos } y.pos %.0f\" % [@ball.ypos]), 49, 50 , 1, 1.0, 1.0, 0xfffff000 )\n\n\tend", "def drawLetter(l)\r\n i = 0\r\n GL.Begin(GL::LINE_STRIP);\r\n while (1) \r\n\tcase (l[i][1])\r\n\t when PT\r\n\t\tGL.Vertex(l[i][0]);\r\n\t when STROKE\r\n\t\tGL.Vertex(l[i][0]);\r\n\t\tGL.End();\r\n\t\tGL.Begin(GL::LINE_STRIP);\r\n\t when END_\r\n\t\tGL.Vertex(l[i][0]);\r\n\t\tGL.End();\r\n\t\tGL.Translate(8.0, 0.0, 0.0);\r\n\t\treturn\r\n\tend\r\n\ti = i + 1\r\n end\r\nend", "def draw\n draw_background\n draw_ambient\n draw_objects\n draw_ui\n end", "def myinit\r\n GL.ShadeModel (GL::FLAT);\r\n\r\n base = GL.GenLists(128);\r\n GL.ListBase(base);\r\n GL.NewList(base+'A'[0], GL::COMPILE); drawLetter(Adata); GL.EndList();\r\n GL.NewList(base+'E'[0], GL::COMPILE); drawLetter(Edata); GL.EndList();\r\n GL.NewList(base+'P'[0], GL::COMPILE); drawLetter(Pdata); GL.EndList();\r\n GL.NewList(base+'R'[0], GL::COMPILE); drawLetter(Rdata); GL.EndList();\r\n GL.NewList(base+'S'[0], GL::COMPILE); drawLetter(Sdata); GL.EndList();\r\n GL.NewList(base+' '[0], GL::COMPILE); GL.Translate(8.0, 0.0, 0.0); GL.EndList();\r\nend", "def draw\n @font.draw(@text, @x, @y, 0, 1, 1, @color)\n end", "def draw\n game_name = \"MAD POKEMONS\"\n height = @game_font.height\n width = @game_font.text_width(game_name, scale_x = 1)\n x = Game::ScreenWidth / 2\n y = Game::ScreenHeight / 3\n @game_font.draw(game_name, x - width/2 ,y - height/2, ZOrder::UI, 1.0, 1.0, Gosu::Color::WHITE)\n \n @buttons.each {|button| button.draw }\n end", "def draw_info_text\n letters = HotKeys::SkillBar\n @text_sprite.bitmap.font.size = 16\n @text_sprite.bitmap.font.color.set(DND::COLOR::White)\n cx = 22\n for i in letters\n name = HotKeys.name(i)\n @text_sprite.bitmap.draw_text(cx, 6, 32, 32, name)\n cx += 32\n end\n end", "def draw\n @osd.draw\n end", "def display\n fill(50, 200, 200, 150)\n stroke(50, 200, 200)\n stroke_weight(2)\n ellipse(x, y, 16, 16)\n end", "def drawLocation _obj, _args\n \"_obj drawLocation _args;\" \n end", "def display\n no_fill\n stroke(127)\n fill(127)\n stroke_weight(1)\n rect_mode(Java::ProcessingCore::PConstants::CENTER)\n a = b.get_angle\n push_matrix\n translate(x, y)\n rotate(-a)\n rect(0, 0, w, h)\n pop_matrix\n end", "def draw\n\t\t\n\tend", "def draw\n\t\t\n\tend", "def draw\n\t\t\n\tend", "def draw\n\t\t\n\tend", "def draw\r\n @font.draw_text(\"No Longer Human!\", 50,50,0)\r\n end", "def draw\n Gosu.scale(@scale[:x], @scale[:y], x, y) do\n Gosu.rotate(@rotation, *get_center.values) do\n Gosu.translate(*get_corner(:left, :top).get_position.values) do\n call_method_on_children :draw\n end\n #draw_debug # TODO: Clean up\n end\n end\n end", "def display\n\t\tstr=map_to_string()\n\t\t(0..@y_length-1).each do |y_counter|\n\t\t\t(0..@x_length-1).each do |x_counter|\n\t\t\t\tprint str[@x_length*y_counter+x_counter]\n\t\t\tend\n\t\t\tprint \"\\n\"\n\t\tend\t\t\n\tend", "def artii_art what\n a = Artii::Base.new :font => 'slant'\n a.asciify(what)\n end", "def draw_text(xp, yp, step, strs, draw, canvas) # xp,yp is X,Y position. draw is the drawing method, canvas is where to draw on\n for str in strs\n yp = yp + step\n draw.annotate(canvas,647,600,xp,yp,str){\n draw.fill = '#ddd'\n draw.stroke = 'transparent'\n draw.pointsize = 20\n # self.font = \"BS.ttf\" \n draw.font = $config[\"fonts\"][3] \n }\n end\n return yp\nend", "def spot_legs\n lines = []\n indent = 0\n spacer = @width - @padding\n\n draw_legs(lines, indent, spacer)\n lines\n end", "def draw\n $code.each { |color| print \"[ #{Rainbow(\"o\").background(color)} ] \" }\n puts \"\\n\\n\"\n end", "def draw\r\n (0..@w).each do |x|\r\n (0..@h).each do |y|\r\n @map[x][y].draw\r\n end\r\n end\r\n end", "def draw\n @image.draw_rot(@x, @y, 1, @angle)\n end", "def draw_face(face_name, face_index, x, y, enabled = true)\n face_name = Revoked::Menu::Equip::FACE_NAME\n bitmap = Cache.face(face_name)\n rect = Rect.new(face_index % 4 * 96, face_index / 4 * 96, 96, 96)\n #drect = Rect.new(0, 0, 64, 64)\n contents.blt(x,y, bitmap, rect, enabled ? 255 : translucent_alpha)\n bitmap.dispose\n end", "def draw\n\t\t# Complete the missing code\n\t\tdraw_background\n\t\tdraw_albums\n if @play > -1\n @font.draw(\"Now playing...\\n#{@albums[@selection].tracks[@play].name}\", 650, 550, ZOrder::UI, 1.0, 1.0, Gosu::Color::BLACK)\n end\n\n\tend", "def draw_enemy_name(x, y, width, height)\n change_color(system_color)\n draw_text(x, y, width, height, enemy.name)\n change_color(normal_color)\n end", "def draw\n puts\n output_to_diplay('', \" | | \", '')\n output_to_diplay('', \" #{squares[1]} | #{squares[2]} | #{squares[3]} \", '')\n output_to_diplay('', \" | | \", '')\n output_to_diplay('', \"-----+-----+-----\", '')\n output_to_diplay('', \" | | \", '')\n output_to_diplay('', \" #{squares[4]} | #{squares[5]} | #{squares[6]} \", '')\n output_to_diplay('', \" | | \", '')\n output_to_diplay('', \"-----+-----+-----\", '')\n output_to_diplay('', \" | | \", '')\n output_to_diplay('', \" #{squares[7]} | #{squares[8]} | #{squares[9]} \", '')\n output_to_diplay('', \" | | \", '')\n puts\n end", "def draw()\n @ucCharFace.draw()\n @cCharName.draw()\n @ucCharLvl.draw()\n @cHpStatGauge.draw()\n @ucHpStat.draw()\n @cMpStatGauge.draw()\n @ucMpStat.draw()\n end", "def draw()\n @ucCharFace.draw()\n @cCharName.draw()\n @ucCharLvl.draw()\n @cHpStatGauge.draw()\n @ucHpStat.draw()\n @cMpStatGauge.draw()\n @ucMpStat.draw()\n end", "def draw_string_array(instructions, start_x, start_y, max_width)\n draw_string_y = start_y\n string_height = 20\n instructions_font = Gosu::Font.new(string_height)\n instructions.each do |instruction|\n wrapped_instruction = wrap_string(instruction, instructions_font, max_width)\n instructions_font.draw_text(wrapped_instruction[0],\n start_x,\n draw_string_y,\n 1)\n draw_string_y += string_height * (wrapped_instruction[1] + 1)\n end\nend", "def display\n fill(127)\n stroke(0)\n stroke_weight(2)\n ellipse(x, y, radius * 2, radius * 2)\n end", "def view\n\t\tcount = 0\n\t\tdark = \"\\u2591\"\n\t\tlight = \"\\u2593\"\n\t\tshade_line_2 = \" \" + (dark*6 + light*6)*4\n\t\tshade_line_1 = \" \" + (light*6 + dark*6)*4\n\t\tbase_letters = \" a b c d e f g h\\n\\n\"\n\t\t(0...@spots.length/8).reverse_each do |i|\n\t\t\tputs count % 2 == 0 ? shade_line_1 : shade_line_2\n\t\t\tprint (i+1).to_s + \" \"\n\t\t\tline = @spots[i*8...(i+1)*8]\n\t\t\tline.each do |spot|\n\t\t\t\tprint count % 2 == 0 ? light*2 : dark*2\n\t\t\t\tif spot[1].img == \" \"\n\t\t\t\t\tprint count % 2 == 0 ? light*2 : dark*2\n\t\t\t\telse\n\t\t\t\t\tprint spot[1].img + \" \"\n\t\t\t\tend\n\t\t\t\tprint count % 2 == 0 ? light*2 : dark*2\n\t\t\t\tcount += 1\n\t\t\tend\n\t\t\tputs \"\"\n\t\t\tputs count % 2 == 0 ? shade_line_1 : shade_line_2\n\t\t\tcount += 1\n\t\tend\n\t\tputs \"\\n\" + base_letters\n\tend", "def drawMistakes(m)\n attron(color_pair(6))\n setpos(13,0)\n addstr(\"Mistakes: #{m}\")\n setpos(0,0)\nend", "def draw\n end", "def draw\n end", "def draw\n end", "def paint_world\r\n show_sun\r\n\tputs ''\r\n count = 0\r\n @height.times do\r\n @width.times do\r\n print @positions[count].symbol\r\n count += 1\r\n end\r\n puts ''\r\n end\r\n puts '------------'\r\n end", "def display\n stroke_weight(2)\n stroke(0)\n fill(135, 206, 250)\n begin_shape\n vertex(width, 0) # extra vertices so we can fill sky\n surface.each do |v|\n vertex(v.x, v.y) # the mountain range\n end\n vertex(0, 0) # extra vertices so we can fill sky\n end_shape\n end", "def draw\n # Mostrar fondo\n @background_image.draw(0, 0, ZOrder::BACKGROUND)\n # Mostrar jugador\n @player.draw\n # Mostrar estrellas\n @agent_array.each { |agent| agent.draw }\n # Mostrar score\n #@font.draw(\"Score: #{@score}\", 10, 10, ZOrder::UI, 1.0, 1.0, Gosu::Color::YELLOW)\n end", "def draw(window)\n color = Gosu::Color::WHITE\n\n window.draw_quad(\n x1, y1, color,\n x1, y2, color,\n x2, y2, color,\n x2, y1, color\n )\n end", "def draw_albums(albums)\n i = 0\n x1 = 50\n y1 = 100\n x2 = 250\n y2 = 300\n while i < albums.length\n if i == 1\n x1 += 220\n x2 += 220\n elsif i == 2\n x1 = 50\n x2 = 250\n y1 += 220\n y2 += 220\n elsif i==3\n x1+=220\n x2+=220\n end \n albums[i].artfile.bmp.draw_as_quad(x1, y1, @image_color, x2, y1, @image_color, x1, y2, @image_color, x2, y2, @image_color,ZOrder::UI)\n i+=1\n end\n end", "def draw \n\t\tsuper(\"Lives: #{@lives.to_s}\", X, Y, 5)\n\tend", "def draw_attributes\n draw_header\n \n change_color(system_color)\n #draw_text(5, 32, self.width, 24, \"Categoria:\")\n draw_text(5, 32, self.width, 24, \"Atributos:\")\n change_color(normal_color)\n \n 8.times do |i|\n draw_text(5, 56 + i * 24, 131, 24, Vocab.param(i))\n end\n\n 8.times do |i|\n change_color(normal_color)\n draw_text(self.width - 108, 54 + i * 24, 64, 24, \"#{@item.params[i].to_i}\")\n draw_text(self.width - 75, 54 + i * 24, 64, 24, \"→\")\n change_color(@enchant[:effects][i] > 0 ? power_up_color : normal_color)\n draw_text(self.width - 54, 54 + i * 24, 64, 24, \"#{(@item.params[i] + @enchant[:effects][i]).to_i}\")\n end\n end", "def draw\n @help.draw(20, 10, 100)\n @return.draw\n end", "def draw\n end", "def draw_for_picking(index, buffer)\n buffer.push_matrix\n buffer.translate @x, @y, @z\n buffer.fill $app.index_to_color(index)\n buffer.rotate_y @longitude_radians\n buffer.rotate_x -@latitude_radians\n buffer.ellipse 0, 0, @size, @size\n buffer.pop_matrix\n end", "def draw; end", "def draw; end", "def display_track(title, ypos)\r\n @track_font.draw(title, TrackLeftX, ypos, ZOrder::PLAYER, 1.0, 1.0, Gosu::Color::BLACK)\r\nend", "def draw\n opacity = 0.4\n @position.reverse.each do |pos|\n opacity *= 0.8\n Square.new(x: pos[0] * GRID_SIZE, y: pos[1] * GRID_SIZE, size: NODE_SIZE, color: @snake_color, z: @z) # the regular snake\n Square.new(x: pos[0] * GRID_SIZE, y: pos[1] * GRID_SIZE, size: NODE_SIZE, color: 'white' , opacity: opacity, z: @z + 1) # a lighting effect\n end\n end", "def draw_ori( image, x_coord, y_coord )\n origin = Magick::Draw.new\n pointsize = @font_size\n\n origin.annotate( image, @text_width * \"ori\".length, @text_height, x_coord, y_coord - @text_height, \"ori\" ) do\n self.gravity = Magick::CenterGravity\n self.font_weight = Magick::BoldWeight\n self.fill = \"black\"\n self.pointsize = pointsize\n end\n\n return image\n end", "def draw_imgui\n\n\t\tend", "def draw\n @font_small.draw_rel(\"Made by\", StartX, StartY, ZOrder::UI, 0.5, 0.5)\n @font_credits.draw_rel(\"Annie Dang\", StartX, StartY + 30, ZOrder::UI, 0.5, 0.5)\n @font_small.draw_rel(\"A Student Of Swinburne University\", StartX, StartY + 60, ZOrder::UI, 0.5, 0.5, 1, 1, 0xfff4cc00)\n @font_small.draw_rel(\"Who always loves to make people laugh\", StartX, StartY + 90, ZOrder::UI, 0.5, 0.5, 1, 1, 0xfff4cc00)\n \n @button.draw\n end", "def drawArrow _obj, _args\n \"_obj drawArrow _args;\" \n end", "def drawVolcanicAsh\n # apply sky tone\n if @sprites[\"sky\"]\n @sprites[\"sky\"].tone.all -= 4 if @sprites[\"sky\"].tone.all > -100\n @sprites[\"sky\"].tone.gray += 16 if @sprites[\"sky\"].tone.gray < 128\n for i in 0..1\n @sprites[\"cloud#{i}\"].tone.all -= 4 if @sprites[\"cloud#{i}\"].tone.all > -100\n @sprites[\"cloud#{i}\"].tone.gray += 16 if @sprites[\"cloud#{i}\"].tone.gray < 128\n end\n end\n for j in 0...72\n next if @sprites[\"w_volc#{j}\"]\n @sprites[\"w_volc#{j}\"] = Sprite.new(@viewport)\n @sprites[\"w_volc#{j}\"].create_rect(5, 5, Color.black)\n @sprites[\"w_volc#{j}\"].default!\n @sprites[\"w_volc#{j}\"].angle = 90\n @sprites[\"w_volc#{j}\"].oy = 2\n @sprites[\"w_volc#{j}\"].opacity = 0\n end\n end", "def draw\n\n puts \"*\" * @side_len\n @side_len.times do\n\n print \"*\" + ( \" \" * ( @side_len - 2) ) + \"* \\n\"\n\n end\n\n puts \"*\" * @side_len\n end", "def print_alias(*) end", "def draw_item(index)\n change_color(normal_color)\n draw_text(item_rect_for_text(index), @targets[index].name)\n end", "def indirect_artsy\n puts \"Congratulations! Your feminist icons are Maya Angelou and Dianne Von Fustenburg!\"\nend", "def setup_gui\n x = x_for_anchor(@anchor).to_i\n y = y_for_anchor(@anchor).to_i\n translate_to(x,y)\n end", "def draw_internal(align)\n return if @text[align].empty?\n self.bitmap.font.color = @window.textColor\n if @highlight[align]\n text_rect = Rect.new(0,0,self.bitmap.text_size(@text[align]).width+2,\n self.bitmap.height)\n text_rect.x = self.viewport.rect.width/2-text_rect.width/2-2 if align == 1\n text_rect.x = self.viewport.rect.width-text_rect.width-2 if align == 2\n self.bitmap.fill_rect(text_rect,@window.textColor)\n self.bitmap.font.color = @window.bgColor\n end\n self.bitmap.draw_text(self.bitmap.rect,@text[align],align)\n end", "def draw_vista_help(x, y, width)\n draw_key_icon(:X, x, y)\n draw_text(x + 24, y, width - 24, line_height, Vocab.formation_vista_change)\n end", "def draw\n @ball.draw\n @player1.draw(@player1_x,@player1_y,0)\n @player2.draw(@player2_x,@player2_y,0)\n @font.draw(\"Score: A #{@player1_score} B #{@player2_score} \", 10, 10, 3, 1.0, 1.0, 0xffffff00)\n end", "def draw\n if @rainbow > 0\n @rainbow_img.draw(@x, @y, PLAYER, @scale, @scale, Gosu::Color.rgba(@color[0], @color[1], @color[2], 150))\n else\n @img.draw(@x, @y, PLAYER, @scale, @scale)\n end\n \n offset = (@img.width - @shield_img.width) / 2\n @shield_img.draw(@x + offset, @scene.height - @shield_img.height, PLAYER, @scale, @scale, Gosu::Color.rgba(255, 255, 255, [@shield, 0].max))\n end", "def draw \n\t\t@image.draw(@x, @y, 1)\n\tend", "def draw\n return if @type == Type[:EMPTY]\n\n @window.mvaddstr(@x, @y, @appearance)\n end", "def add_hl_store_att(locs, opts={})\n @hl_att_points = {}\n options = {:offx=>0,:offy=>0,:hloc=>DISPLAY_TB, :meth=>:default_attack,\n :opacity=>Era::Fade.opacity}.merge(opts)\n offx, offy = options[:offx], options[:offy]\n hloc, meth = options[:hloc], options[:meth]\n opacity = options[:opacity]\n locs.each do |loc| \n x,y = loc.x + offx,loc.y + offy\n @spriteset.add_highlight(:x=>x,:y=>y,:sym=>meth,:hloc=>hloc, :opacity=>opacity) \n @hl_att_points[Vertex.new(x,y)] = 1\n end\n end", "def draw\n\n\t\tend", "def update_arrows(index)\n @arrows[index].x = @arrows[index].enemy.actual_x\n @arrows[index].y = @arrows[index].enemy.actual_y\n end", "def draw\n\tend", "def draw\n @buttonLogin.draw\n @buttonClassicAI.draw\n @buttonOttoAI.draw\n @buttonHelp.draw\n\n @buttonHelpLogin.draw\n @buttonHelpClassicAI.draw\n @buttonHelpOttoAI.draw\n end", "def draw\n\t\tend", "def draw()\n if self.actor != nil\n bitmap = Cache.character(self.actor.character_name)\n sign = self.actor.character_name[/^[\\!\\$]./]\n if sign != nil && sign.include?('$')\n cw = bitmap.width / 3\n ch = bitmap.height / 4\n else\n cw = bitmap.width / 12\n ch = bitmap.height / 8\n end\n n = self.actor.character_index\n \n @cCharGraphic.img_bitmap = bitmap\n @cCharGraphic.src_rect = Rect.new((n%4*3+1)*cw, (n/4*4+@direction)*ch, cw, ch)\n @cCharGraphic.draw()\n end\n end", "def draw\n\t\t\t\t\n\t\t\tend", "def draw_letters\n # Letters 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 letter_dist = [9, 2, 2, 4, 12, 2, 3, 2, 9, 1, 1, 4, 2, 6, 8, 2, 1, 6, 4, 6, 4, 2, 2, 1, 2, 1]\n hand_size = 10\n # ASCII table number for a\n letter_a_offset = 65\n \n letter_pool = letter_dist.map.with_index { |dist, index| (index + letter_a_offset).chr * dist }\n return letter_pool.join('').split('').sample(hand_size)\nend", "def draw\n current_image.draw_rot x, y, z_order, angle, center_x, center_y, x_factor, y_factor, color\n end", "def draw\n unless @track_result.nil?\n draw_play()\n end \n draw_btns()\n draw_stuff()\n draw_background()\n draw_albums(@albums)\n display_tracks()\n @info_font.draw(\"mouse_x: #{mouse_x}\", 200, 50, ZOrder::UI, 1.0, 1.0, Gosu::Color::WHITE)\n @info_font.draw(\"mouse_y: #{mouse_y}\", 350, 50, ZOrder::UI, 1.0, 1.0, Gosu::Color::WHITE)\n end", "def draw_text_icon(line, string, graphic_name)\n return if line <= 0\n draw_icon(line, graphic_name)\n y = 32 * line - 32\n self.contents.draw_text(35, y, @width, 32, string)\n end", "def draw\n intro if @intro_flag\n draw_ruby\n draw_emerald\n @dude.draw(mouse_x - 75, mouse_y - 75, 1)\n hitter\n draw_header\n game_over unless @playing || @intro_flag\n end", "def paint_world4\r\n show_sun2\r\n\t@logger.write(\"\") # puts ''\r\n count = 0\r\n @height.times do\r\n @width.times do\r\n @logger.pwrite(\"#{@positions[count].symbol}\") # print @positions[count].symbol\r\n count += 1\r\n end\r\n @logger.write(\"\") # puts ''\r\n end\r\n @logger.write(\"\") # puts '------------'\r\n end", "def drawLink _obj, _args\n \"_obj drawLink _args;\" \n end", "def create_arrows\n bx, by = 80, 16\n bw, bh = 8, 16\n 2.times do |i|\n sprite = Sprite.new(@viewport2)\n sprite.bitmap = Bitmap.new(bw, bh)\n sx = (i == 0 ? bx : (bx + bw + bh)) # 0 for left, 1 for right arrow\n rect = Rect.new(sx, by + bw, bw, bh)\n sprite.bitmap.blt(0, 0, self.windowskin, rect)\n sprite.y = self.y + (window_height - bh) - spacing * 4 \n sprite.x = i == 0 ? self.x + 2 : self.x + window_width - bw\n @arrow_sprites.push(sprite.hide)\n end\n end", "def create_graphic\n y = @enchant_list.bottom_corner\n h = Graphics.height - y - @enchant_window.height\n @graphic = GraphicUnifier.new(0, y, Graphics.width, h)\n @graphic.viewport = @viewport2\n @enchant_window.graphic = @graphic\n @enchant_window.scroll = @enchant_list.item\n end", "def draw\n @img.draw(@x, @y + @dy, 2, 1.0, 1.0, @color)\n end", "def draw *active_index\n\t\t@menu.each_with_index do |item, idx|\n\t\t\tprint \"\\e[2K\"\n\t\t\tif active_index.include? idx\n\t\t\t\tprint \"\\e[45;30m\"\n\t\t\t\tprint item\n\t\t\t\tputs \"\\e[m\"\n\t\t\telse\n\t\t\t\tprint item\n\t\t\t\tputs\n\t\t\tend\n\t\tend\n\tend", "def draw\n if @state == :menu\n i = 0\n for option in @menu_options\n color = option == @menu_options[@menu_selection] ? LIGHT_GREEN : DARK_GREEN\n Gosu::Image.from_text(self, option.to_s, \"Courier New\", 24 * SCALE).draw(100 * SCALE, 50 * i * SCALE + 30 * SCALE, 0, 1, 1, color)\n i += 1\n end\n elsif @state == :instructions\n Gosu::Image.from_text(self, \"Use the arrow keys to move the player left and right.\\nPress control to jump.\\nAlt to toggle the pogo stick.\\nSpace to shoot.\\nUp in a doorway for next level.\\n\\nCollect candy.\\nAvoid enemies.\\nGame over if you run out of lives.\", \"Times New Roman\", 12 * SCALE, 10 * SCALE, 250 * SCALE, :left).draw(50 * SCALE, 25 * SCALE, 0, 1, 1, 0xffffffff)\n elsif @state == :game\n @level.draw SCALE, @player.x * SCALE, @player.y * SCALE\n @player.draw SCALE\n end\n end" ]
[ "0.6143754", "0.6083138", "0.6028044", "0.5929991", "0.5736369", "0.57115287", "0.5680897", "0.5668043", "0.5658883", "0.56421864", "0.56405514", "0.56330854", "0.5623089", "0.55904645", "0.5589936", "0.55661887", "0.5560451", "0.55551445", "0.5546029", "0.5541632", "0.5533224", "0.5522712", "0.5512572", "0.55081856", "0.54913235", "0.54742587", "0.54742587", "0.54742587", "0.54742587", "0.5472801", "0.5439906", "0.54390895", "0.543796", "0.54184353", "0.5408512", "0.5406343", "0.53815335", "0.5375778", "0.5372595", "0.53711355", "0.53708667", "0.53626955", "0.5360619", "0.5360619", "0.5351359", "0.5348609", "0.53471315", "0.5342561", "0.53284955", "0.53284955", "0.53284955", "0.532837", "0.5325101", "0.5319803", "0.53174007", "0.5316468", "0.53162026", "0.53117996", "0.5310364", "0.5304829", "0.5289768", "0.52831316", "0.52831316", "0.52814716", "0.5275472", "0.5273163", "0.5258296", "0.52534735", "0.5247127", "0.5246156", "0.5238771", "0.5236127", "0.52356875", "0.52329516", "0.52275634", "0.52240324", "0.5222325", "0.5215528", "0.52124643", "0.52099884", "0.5205197", "0.5201809", "0.51982385", "0.51956517", "0.51930076", "0.51910555", "0.5182871", "0.51814616", "0.5175087", "0.5173421", "0.51681405", "0.5160732", "0.5159161", "0.5157572", "0.5156494", "0.515201", "0.51517624", "0.5146271", "0.5139133", "0.51378345", "0.51347303" ]
0.0
-1
This procedure increases the difficulty level of the game
def level_up() # Incrementing the level @level += 1 # Incrasing the number of aliens in each fleet if @alien_count <6 @alien_count += 1 end # Reducing the random number to that the events are more likely to occur @random -= 100 @alien_fire_rand -= 100 # Increasing the maximum number of Alien fleets @fleet_limit += 1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def level_advance\n all_lvls = [$lvl_1, $lvl_2, $lvl_3]\n if $current_lvl != all_lvls.last\n puts \"You hve defeated the first wave - prepare for wave #{$level_counter + 2}!\"\n puts \"Here's a reminder of your character's stats\"\n # the hp is not correct here.\n puts $player\n $level_counter += 1\n $no_of_enemies += 5\n $current_lvl = all_lvls[$level_counter]\n if $hide_speed >= 0.4\n $hide_speed -= 0.2\n end\n if $time_limit >= 3\n $time_limit -= 2\n end\n continue()\n system \"clear\"\n next_word()\n else\n puts \"Congratulations!! You have BEATEN THE GAME!!\"\n retry_game\n end\nend", "def level_up!\n if self.character.skill_points > 0\n self.level += 1\n return self.save\n else\n return false\n end\n end", "def start_new_game\n\n if @level == 3 #if max level, choose new type\n @level = 0\n @type = choose_type\n puts \"Great job, #{@player.name}! Now try to evolve a #{@type} type pokémon.\"\n end\n @secret_word = Faker::Pokemon.name.upcase\n @user_progress = Array.new(@secret_word.length,\"_\")\n @character = @@characters[@type][@level]\n @scenes = @@scenes[@type][@level]\n @color = @@colors[@type]\n @current_index = 0\n @bad_guesses = []\n @remaining_guesses = 5\n puts \"You're at level #{@level+1}\"\n end", "def update_level\n new_level_progress = 100 - ((self['level'] * 100) - self['xp'])\n self.update(:level_progress => new_level_progress)\n if self['level_progress'] > 99\n new_level = self['level'] + 1\n self.update(:level => new_level)\n self.update_level\n end\n end", "def levelUp\n @level += 1\n # every level requires a higher score threshhold score to advance\n @threshold += level * 150\n\n # after 9 planes, stop adding planes to make it possible to have\n # somewhere to go to dodge the planes if there is not laser\n game.add_plane if level < 9\n end", "def level_up experience\n if experience > somenumber\n self.level += 1\n end\n end", "def level_up\r\r\n return unless can_level\r\r\n return if @level == @max_level\r\r\n @level += 1\r\r\n if @special == nil then\r\r\n @special = 0\r\r\n end\r\r\n level_update\r\r\n end", "def update_exp_gain()\n if !@complete\n total_remaining = 0\n \n for i in 0 .. $game_party.members.size-1\n actor = $game_party.members[i]\n actor_exp = @actor_remaining_exp[i]\n \n if actor.dead? && !VICTORY_CONFIG::EXP_ON_DEATH\n actor_exp.remaining_exp = 0\n end\n \n total_remaining += actor_exp.remaining_exp\n \n if actor_exp.remaining_exp > 0\n last_level = actor.level\n last_skills = actor.skills\n \n if !@skipped\n \n if actor_exp.remaining_exp > actor_exp.tick_exp\n \n if actor_exp.tick_exp > actor.needed_exp && actor.needed_exp > 0\n \n exp_to_gain = actor.needed_exp\n \n else\n \n exp_to_gain = actor_exp.tick_exp\n \n end\n \n else\n \n exp_to_gain = actor_exp.remaining_exp\n \n end\n \n actor.gain_exp(exp_to_gain, false)\n actor_exp.remaining_exp -= exp_to_gain\n else\n actor.gain_exp(actor_exp.remaining_exp, false)\n actor_exp.remaining_exp = 0\n end\n \n @victory_char_info_windows[i].window_update(actor)\n \n if actor.level > last_level\n actor_exp.tick_exp = determine_tick(actor.next_exp, actor_exp.remaining_exp)\n \n @victory_level_up_windows[i].visible = true\n Sound.play_level_up_se\n wait(30)\n @victory_level_up_windows[i].visible = false\n end\n new_skills = actor.skills - last_skills\n for skill in new_skills\n @victory_new_skill_windows[i].window_update(skill)\n @victory_new_skill_windows[i].visible = true\n Sound.play_new_skill_se\n wait(30)\n @victory_new_skill_windows[i].visible = false\n end\n end\n end\n \n if total_remaining == 0\n @complete = true\n end\n end\n end", "def reward(opponent, groupsize)\n @experience = @experience + opponent.max_health / groupsize\n if @experience >= LEVEL_THRESHOLDS[@level]\n upgrade(@level)\n end\n end", "def improve_skill(player, skillname, point)\n p player.query_skill(skillname)\n skill = player.query_skill(skillname).data\n p \"improve skill #{skill}#{skill.inspect}\"\n skill[:tp] += point\n e = calc_total_exp(player.tmp[:level]) + player.tmp[:exp]\n if ( (skill[:level]+1)*(skill[:level]+1) <= skill[:tp] )\n if (skill[:level] +1) * (skill[:level] +1) *(skill[:level] +1)/10>e\n # error \"You need more battle experience\"\n # return\n else\n skill[:level] += 1\n skill[:tp] = 0\n title = title_from_skill(skillname, skill[:level])\n player.addTitle(title) if title != nil\n \n return true\n end\n end\n # save to db after fight finished\n return false\n end", "def exp_increment(opponent)\n\t\texp_will_change!\n\t\tself.exp += (1+opponent.level/self.level)\n\t\tself.level_increment()\n\t\tself.save!\n\tend", "def next_level\n if @level.level == MAX_LEVEL\n restart_game\n else\n @level.level += 1\n load_level(\"levels/level\" + @level.level.to_s + \".lvl\")\n end\n end", "def increaseLevels(levels)\n @level += levels\n end", "def update_level(win)\n #self.profile.increment!(:gp, win ? WIN_GP : LOSE_GP)\n profile = self.profile\n profile.gp += win ? WIN_GP : LOSE_GP\n profile.save\n new_level = LevelManager.level_for(self.gp)\n level_changed = new_level != self.level\n\n self.profile.update_attribute(:level, new_level) if level_changed\n return level_changed\n end", "def lives_decriment\n\t\tlives_will_change!\n\t\tself.lives -= 1 \n\t\tself.hp = self.level+5\n\t\tself.save!\n\t\tif self.lives <=0 \n\t\t\t# restarts NPC's renders user-wizards unusable\n\t\t\tif self.user_id == 1\n\t\t\t\tself.default_values()\n\t\t\telse\n\t\t\t\tputs \"Game Over for #{self.name}!\"\n\t\t\t\tself.level = 0\n\t\t\tend\n\t\tend\n\tend", "def update\n if @current_level <= @@Level_Number\n if Time.now - @level_beg_t > @@Levels_duration[@current_level]\n set_level(@current_level+1)\n else\n method(@update_method).call \n end\n end\n @current_level > @@Level_Number\n end", "def level_up\n @lives = @lives += 1\n puts \"You got a life! Now you have #{ @lives } lives.\"\n end", "def gain_experience(_xp)\n\t\t@experience += _xp\n\tend", "def winGame\n @victory = true\n if @level == 2\n @win = true\n end\n end", "def levelup?\n if @monster.experience >= @monster.level**3\n @monster.level += 1\n @monster.turns = @monster.level\n @monster.health = 95+(5*@monster.level)\n end\n end", "def increment_game\n change_turn\n @turn += 1 if @player_to_move == \"w\"\n end", "def playLevel (n)\n\t\n\tlvl = ((n - 1) % NUM_LEVELS)\n\n\toldPoints = $points\n\n\t# start = Time.now\n\n\troundPoints = 0\n\n\tputs \"You have #{$timeAvailable} seconds to score at \" \\\n\t\t\"least #{$currLevel} points.\\nGood luck!\"\n\n\tcase lvl\n\twhen 0\n\t\tputs \"Write the color, not the word\"\n\twhen 1\n\t\tputs \"Write the word, not the color\"\n\twhen 2\n\t\tputs \"Write the color, followed by the word\"\n\twhen 3\n\t\tputs \"Write the word, followed by the color\"\n\twhen 4\n\t\tputs \"Write the first color, then the second word\"\n\twhen 5\n\t\tputs \"Write the first word, then the second color\"\n\twhen 6\n\t\tputs \"Write the complement color\"\n\twhen 7\n\t\tputs \"Write the complement word\"\n\telse\n\t\tputs \"ERROR in playLevel directions\"\n\t\treturn\n\tend\n\n\t#start the level timer\n\tstart = Time.now\n\n\twhile (Time.now < (start + $timeAvailable))\n\n\t\tif (((Time.now - start) % 10) == 0)\n\t\t\tputs \"\\t\\t#{ime.now - start} seconds remaining\"\n\t\tend\n\n\t\tcase lvl\n\t\twhen 0\n\t\t\troundPoints += singleColor()\n\t\twhen 1\n\t\t\troundPoints += singleWord()\n\t\twhen 2\n\t\t\troundPoints += colorThenWord()\n\t\twhen 3\n\t\t\troundPoints += wordThenColor()\n\t\twhen 4\n\t\t\troundPoints += firstColorSecondWord()\n\t\twhen 5\n\t\t\troundPoints += firstWordSecondColor()\n\t\twhen 6\n\t\t\troundPoints += complementColor()\n\t\twhen 7\n\t\t\troundPoints += complementWord()\n\t\telse \n\t\t\tputs \"ERROR in playLevel selection\"\n\t\t\treturn\n\t\tend\n\n\t\t#early exit option if points satisfied\n\t\tif (roundPoints == $currLevel)\n\t \t\tputs \"---POINT LEVEL REACHED---\\nSkip ahead? (y/n)\"\n\t \t\tc = gets.chomp\n\t \t\tif (c == \"y\")\n\t \t\t\tbreak\n\t \t\tend\n\t \tend\n\tend\n\n\tputs \"LEVEL OVER\".cyan()\n\n\t# BUG: Write the color, not the word\n\t# cyan\n\t# red\n\t# LEVEL OVER\n\t# Good job!\n\t# Please enter 's' to start or 'q' to quit\n\n\t# Please enter in a valid command!\n\t# Please enter 's' to start or 'q' to quit\n\t\t#maybe I hit enter twice?\n\n\t#Another BUG:\n\t#User keeps on hitting enter\n\n\n\tif ($currLevel > roundPoints)\n\t\tputs \"You lose!\".red()\n\t\t$continue = false\n\telse\n\t\tputs \"Good job!\".green()\n\t\t$currLevel += 1\n\t\t$points += roundPoints\n\t\tif ($timeAvailable > 10)\n\t\t\t$timeAvailable -= 5\n\t\tend\n\tend\n\nend", "def change_level\n if Group::LEVEL_TITLES.include?(params[:level])\n params[:level] = Group::LEVELS[Group::LEVEL_TITLES.index(params[:level])]\n end\n unless Group::LEVELS.include?(params[:level])\n flash[:notice] = 'invalid level'\n render(:update) do |page|\n update_flash(page, flash[:notice])\n end\n return\n end\n\n act_on_members do |gi|\n if gi.level == 'leader' && gi.group.leaders.count == 1\n @member_notices << \"Couldn't change #{gi.person.full_name}'s level from a leader, since that would result in a leaderless group!\"\n else\n @levels_to_update << gi.level # update old\n gi.level = params[:level]\n @levels_to_update << gi.level # update new\n @member_notices << \"#{gi.person.full_name} is now a #{params[:level]}\"\n end\n end\n end", "def level_up\r\n\t\tif @level == 100\r\n\t\t\tputs \"#{@nickname} is at max level\"\r\n\t\telse\r\n\t\t\t@level+= 1\r\n\t\t\tputs \"#{@nickname} grew to level #{@level}!\"\r\n\t\tend\r\n\tend", "def update_score()\r\n @score += GAME_PRESET[\"score_increment\"]\r\n end", "def effective_level\n level + level_bonus\n end", "def w00t!\n @health_score += 15\n puts \"#{@name} was w00ted! Health score has increased to #{@health_score}.\"\n end", "def gain_experience(exp)\n self.experience += exp\n save\n end", "def increment_of_health(user)\n (user.max_health / 15) + 5 * (difficulty - 1).round\n end", "def process\n finish_games\n level_up\n warn_level_up\n start_games\n end", "def gain_points\n @score += 1\n end", "def change_level(kod,iw)\n case kod\n when 'y' # povysit level\n $words[iw].addlevel(1)\n when 'r' # reset level=0\n $words[iw].setlevel(0)\n when 'x' # level +3\n $words[iw].addlevel(3)\n end\nend", "def mineTile(col, row)\r\n\r\n @endGame && return #Returns if the games has already been lost.\r\n @tile[col][row].revealed && return #Returns if the tile is already revealed.\r\n\r\n #Checks if the tile is not an ore.\r\n if (@tile[col][row].tier == 0)\r\n adjacent = @tile[col][row].adjacent\r\n\r\n if (adjacent == 0)\r\n floodFill(col,row) #If the tile has an adjacent value of 0, performs a flood fill to uncover the surrounding tiles.\r\n else\r\n @tile[col][row].revealed = true #Marks the tile as revealed.\r\n @hiddenCount-=1\r\n\r\n #Re-renders the button so it displays the new text.\r\n old = @tile[col][row].btn\r\n newStyle = old.style.dup\r\n old.parent.before(old) do\r\n @tile[col][row].btn = button adjacent.to_s, newStyle###\r\n end\r\n old.remove\r\n end\r\n else #Tile is an ore.\r\n @tile[col][row].revealed = true #Marks the tile as revealed.\r\n @hiddenCount -= 1\r\n tileTier = @tile[col][row].tier\r\n\r\n #Updates the experience\r\n @experienceInt += 2**(tileTier-1)\r\n @experience.clear { para(\"EXP: \" + @experienceInt.to_s, @style_stats) }\r\n\r\n #Gets the amount of experience needed to reach the next tier.\r\n if (@tierInt < @tiers)\r\n if (@tierInt == @tiers - 1)\r\n required = 1 #If the player is on the penultimate tier then 100% of previous ores need to be uncovered.\r\n else\r\n #Interpolates the upper and lower bound to get the required percentage for the next tier.\r\n required = @expLowerBound + (@tierInt * ((@expUpperBound - @expLowerBound) / @tiers))\r\n end\r\n\r\n\r\n #Gets the total amount of available experience for the player's current tier.\r\n expCount = 0\r\n (0..@tierInt-1).each do |tier|\r\n expCount += @tierExp[tier]\r\n end\r\n requiredExperience = (required * expCount).to_i\r\n\r\n #f the player's experience is greaster or equal to the required experience for the next tier, then the player advances a tier.\r\n if (@experienceInt >= requiredExperience)\r\n @tierInt+=1\r\n @tier.clear{ para(\"TIER: \" + @tierInt.to_s, @style_stats) }\r\n end\r\n\r\n end\r\n\r\n #If the ore is a higher tier than the player's tier then the durability decreases depending on the difference in tier values.\r\n if (tileTier > @tierInt)\r\n @durabilityInt -= 2 * (tileTier - @tierInt)\r\n #If the durability is 0 or less then the player loses.\r\n if (@durabilityInt <= 0)\r\n @durabilityInt = 0\r\n @endState.clear { subtitle(\"You Lose!\", @style_endgame) }\r\n @endGame = true\r\n end\r\n @durability.clear { para(\"DUR: \" + @durabilityInt.to_s, @style_stats) }\r\n end\r\n\r\n #Updates the ore count for the mined ore.\r\n reduceOreCount(tileTier-1)\r\n\r\n #Re-renders the button to displays the ore.\r\n old = @tile[col][row].btn\r\n newStyle = old.style.dup\r\n old.parent.before(old) do\r\n @tile[col][row].btn = button(@ore[tileTier-1].to_s, newStyle)###\r\n end\r\n old.remove\r\n\r\n end\r\n\r\n #Checks if all tiles have been uncovered. If so gthe game was been won.\r\n if (@hiddenCount <= 0)\r\n @endState.clear { subtitle(\"You Win!\", @style_endgame) }\r\n @endGame = true\r\n end\r\n\r\nend", "def win\n @score += 1\n end", "def win\n @score += 1\n end", "def update\n if @step_count == 20 # 3 times / s\n @board.step!\n @step_count = 0\n else\n @step_count += 1\n end\n end", "def command_use_point\r\r\n if $game_actors[@actor.id].skill_tree[0] == 0 || confirm_skill_add\r\r\n Sound.play_buzzer\r\r\n @confirm.close\r\r\n @confirm.active = false\r\r\n else\r\r\n @skills_icons[@skill_selected].opacity = 255\r\r\n $game_actors[@actor.id].skill_tree[0] -= 1\r\r\n $game_actors[@actor.id].lose_jp(Actor[@actor.id][@skill_selected]['JP'])\r\r\n $game_actors[@actor.id].skill_mult[Actor[@actor.id][@skill_selected]['Skill_id']] += Actor[@actor.id][@skill_selected]['Multiply']\r\r\n $game_actors[@actor.id].skill_tree[Actor[@actor.id][@skill_selected]['Skill_id']] += 1\r\r\n $game_actors[@actor.id].learn_skill(Actor[@actor.id][@skill_selected]['Skill_id'])\r\r\n @info_window.refresh(@actor, @tree)\r\r\n Audio.se_play(\"Audio/SE/Skill3\",75,100)\r\r\n @confirm.close\r\r\n @confirm.active = false\r\r\n if $game_switches[19] # achievement available?\r\r\n #------------------------------------------------------------------------------- \r\r\n # Trophic: Markspony\r\r\n #-------------------------------------------------------------------------------\r\r\n earn_trophic = true\r\r\n for i in 546..561\r\r\n if !$game_actors[@actor.id].skill_learned?(i) && !$ACH_markspony\r\r\n earn_trophic = false\r\r\n break\r\r\n end\r\r\n end\r\r\n \r\r\n if earn_trophic && !$ACH_markspony\r\r\n $ACH_markspony = true\r\r\n GameJolt.award_trophy(\"53491\")\r\r\n p sprintf(\"Achievement unlock - markspony\")\r\r\n $game_system.earn_achievement(:markspony)\r\r\n end\r\r\n #------------------------------------------------------------------------------- \r\r\n # Trophic: Elementalist\r\r\n #------------------------------------------------------------------------------- \r\r\n earn_trophic = true\r\r\n for i in 563..582\r\r\n next if i == 567 || i == 571 || i == 577 || i == 581 \r\r\n if !$game_actors[@actor.id].skill_learned?(i) && !$ACH_elementalist\r\r\n earn_trophic = false\r\r\n break\r\r\n end\r\r\n end\r\r\n \r\r\n if earn_trophic && !$ACH_elementalist\r\r\n $ACH_elementalist = true\r\r\n GameJolt.award_trophy(\"53485\") \r\r\n p sprintf(\"Achievement unlock - elementalist\")\r\r\n $game_system.earn_achievement(:elementalist)\r\r\n end\r\r\n #---------------------------------------------------\r\r\n end\r\r\n end\r\r\n end", "def update_level_\n end", "def restart_game\n\t\tclear_screen\n\t\tpause_game(@pause)\n\t\t@asteroids_missed = 0\n\t\t@asteroids_hit = 0\n\t\t@asteroids_hit_missles = 0\n\t\t@shots_fired = 0\n\t\t@missles_fired = 0\n\t\t@pause = false\n\t\t@game_done = false\n\t\t@win = false\n\t\t@level = $StartingLevel\n\t\t@level_time = Time.now + $TimeLimit\n\tend", "def update_game_data(removing)\n if removing == 4\n @game_info.score += 1000\n else\n @game_info.score += 100 * removing\n end\n\n @line_count += removing\n if @line_count >= @tnl\n puts \"Next level!\"\n self.next_level\n end\n end", "def hero_win\n puts \"#{monster.name} defeated! You gain #{monster.experience} experience.\"\n hero.update(experience: hero.experience + monster.experience)\n reward\n end", "def increment_win_score\n PlayerModelContracts.invariant(self)\n @score = @score + 1\n end", "def skill_power(skillname, player, usage)\n p \"==>calc #{player.name} skill power of #{skillname} for #{usage}:\"\n skill = player.query_skill(skillname)\n if (skill == nil)\n #logger.info(\"user #{player[:id]}-#{player.ext[:name]} doesn't have skill '#{skillname}'\")\n return 1\n end\n # p = skill.power(context)\n level = skill.data[:level]\n p \"=>level=#{level} apply_attack=#{player.tmp[:apply_attack]} apply_dodge=#{player.tmp[:apply_dodge]}\"\n \n if (usage == \"attack\" && player.tmp[:apply_attack] != nil)\n level += player.tmp[:apply_attack]\n end\n \n if (usage == \"dodge\" && player.tmp[:apply_dodge] != nil)\n # level += player.tmp[:apply_dodge]\n level = level * ( (100 + player.tmp[:apply_dodge]/10 ).to_f / 100 )\n end \n \n # if (usage == \"parry\" && player.tmp[:apply_defense] != nil)\n # level += player.tmp[:apply_dodge]\n # end \n jingli_bonus = 50 + player.tmp[:jingli]/ (player.tmp[:max_jl]+1) * 50\n if (jingli_bonus > 150)\n jingli_bonus = 150\n end\n \n total_exp = calc_total_exp(player.tmp[:level])\n p \"level=#{level} jingli_bonus=#{jingli_bonus}, total exp #{total_exp}\"\n if( level<1 ) \n return (total_exp/20.0 * (jingli_bonus/10) ).to_i\n end\n\n \n p =level**3/3 \n str = player.tmp[:str]\n dext = player.tmp[:dext]\n # p \"===>#{player.tmp.inspect}\"\n \n p \"==>p=#{p}, level=#{level} str=#{str} dext=#{dext} \"\n if (usage == \"attack\" || usage == \"parry\")\n p = (p + total_exp +1) / 30 * (( str+1)/10)\n else\n p = (p + total_exp +1) / 30 * (( dext+1)/10)\n end\n \n p = p.to_i\n p \"==>skill power=#{p}\"\n \n if p <= 1\n return 1\n else\n return p\n end\n end", "def level=(new_lvl)\n @level = new_lvl\n $game_party.quests.add_to_sort_array(:level, @id) if $game_party && \n $game_party.quests\n end", "def add_score\n transaction do\n self.player.points = self.player.points + 1\n if self.player.save\n self.player.team.score = self.player.team.score + 1\n self.player.team.save\n end\n self.player.inc_score_stats\n end\n end", "def incement_score\r\n\t\t \t @score += 2000\r\n\t\t end", "def level_up\n @lives += 1\n end", "def victory\n @wins += 1\n end", "def gain_a_point\n\n self.score += 1\n\n end", "def gain_point\n @score += 1\n end", "def set_games_won()\n @score_count.set_games_won()\n end", "def set_other_games_won()\n @score_count.set_other_games_won()\n end", "def restart_game\n @level = 0\n @level = Level.new(self)\n @player = Player.new(self, @level.start_x, @level.start_y)\n\n @menu_options = [\n :Play,\n :Instructions,\n :\"Save/Load\",\n :Quit\n ]\n\n @menu_selection = 0\n\n @state = :menu\n @paused = false\n end", "def level=(level)\n # Check up and down limits\n level = [[level, $data_actors[@actor_id].final_level].min, 1].max\n # Change EXP\n self.exp = @exp_list[level]\n end", "def get_difficulty\n if self.power < 3\n difficulty = 1\n elsif self.power >= 3 && self.power < 6\n difficulty = 2\n else\n difficulty = 3\n end\n end", "def run_quest\n original_power = @todays_hero.power\n system \"clear\"\n subtitle_print('Start Quest')\n power_update = Quest.find_new\n @todays_hero.increase_power_by(power_update)\n system \"clear\"\n if @todays_hero.power > original_power\n puts \"Congrats! Your power increased by #{power_update}.\"\n puts \"Your power is now #{@todays_hero.power}.\"\n elsif @todays_hero.power == original_power\n puts \"Evil doesn't wait for the slow and idle.\"\n puts \"Your power remains at #{@todays_hero.power}.\"\n elsif @todays_hero.power < original_power\n puts \"The world weeps for the strong and courageous.\"\n puts \"Your power has decreased to #{@todays_hero.power}.\"\n end\n @todays_hero.save\n end", "def display_level_up(new_skills)\n $game_message.new_page\n $game_message.add(sprintf(Vocab::LevelUp, @name, Vocab::level, @level))\n new_skills.each do |skill|\n $game_message.add(sprintf(Vocab::ObtainSkill, skill.name))\n end\n end", "def increment_player_stat\n @team.increment_player_stat(@stat_type, @player)\n\n redirect_to team_path(@team)\n end", "def update\n if @state == :game\n @player.update\n @level.update\n end\n end", "def win_pts\n self.score += 1\n end", "def xp!(n)\n unless @level == (Levels.size - 1)\n @experience += n\n level_up! if @experience >= xp_required\n end\n end", "def update_score\n if @round_won\n @player.increment_rounds_won\n else\n @player.increment_rounds_lost\n end\n end", "def update\n super\n if BattleManager.in_turn?\n process_event\n process_action\n end\n BattleManager.judge_win_loss unless BattleManager.victory_phase?\n if BattleManager.victory_phase?\n if @victory_score.done and @victory_score.active\n sfx = CP::VICTORY::IMAGE_SFX\n vol = CP::VICTORY::SFX_VOL\n pit = CP::VICTORY::SFX_PIT\n RPG::SE.new(sfx, vol, pit).play unless sfx.nil?\n @victory_score.active = false\n @victory_item.active = true\n end\n end\n end", "def incrementLevels(l)\n @level += l\n \n if(@level > @@MAXLEVEL)\n @level = 10\n end\n end", "def increase_steps\r\n @steps = [@steps + 1, 9999999].min\r\n end", "def mine!(difficulty = 4)\n @nonce += 1 until valid?(difficulty)\n end", "def turn_game\n\t\t@player_1.new_question\n\t\tcheck_score\n\t\t@player_2.new_question\n\t\tcheck_score\n\t\tcheck_status\n\t\tputs '------------NEW-TURN-------------'\n\t\tturn_game\n\tend", "def match_check(enteredWord, time)\n if enteredWord == $current_word\n $word_count += 1\n # congratulate\n puts \"Well done - that is correct\"\n # delete word\n $current_lvl.delete($current_word)\n update_score(time)\n puts \"Your current score: #{$player_score}\"\n sleep(3)\n next_level_check \n elsif enteredWord == \"\"\n if $player.passes > 0\n $word_count += 1\n puts \"You have used a pass power!!\"\n $used_passes += 1\n $player.passes -= 1\n puts \"You have #{$player.passes} left!\"\n sleep(2)\n next_level_check \n else\n puts \"You have no passes left!\"\n puts \"You have lost a life.\"\n $player.hp -= 1\n # check if alive or dead\n game_over_check\n end\n elsif enteredWord == \"1\"\n # $player.class\n if $player.class == ThiefClass\n thief_guess = $player.power\n match_check(thief_guess, time)\n else\n $player.power\n if $player.hp < 1\n game_over_check\n else\n next_level_check\n end\n end\n else\n # indicate wrong answer\n system \"clear\"\n puts \"Oh dear, enemy gets a hit in.\"\n # decrease lives by one\n $player.hp -= 1\n # check if alive or dead\n game_over_check\n end\nend", "def change_hp(value, enable_death)\r\n if !enable_death && @hp + value <= 0\r\n self.hp = 1\r\n else\r\n self.hp += value\r\n end\r\n end", "def on_hand=(new_level)\n if Spree::Config[:track_inventory_levels]\n new_level = new_level.to_i\n\n # increase Inventory when\n if new_level > on_hand\n # fill backordered orders before creating new units\n inventory_units.with_state('backordered').slice(0, new_level).each do |iu|\n iu.fill_backorder\n new_level -= 1\n end\n end\n\n self.count_on_hand = new_level\n else\n raise 'Cannot set on_hand value when Spree::Config[:track_inventory_levels] is false'\n end\n end", "def pick_difficulty\n user_diff = $prompt.select(\"Pick a difficulty level\", [\"Easy\", \"Medium\", \"Hard\"])\n case user_diff\n when \"Easy\"\n $hide_speed = 3 \n $time_limit = 7\n when \"Medium\"\n $hide_speed = 2\n $time_limit = 6\n when \"Hard\"\n $hide_speed = 1.5\n $time_limit = 5\n end \n pre_game\nend", "def add_to_player_score (player)\r\n\tplayer.player_wins += 1\r\n\t@total_number_of_plays += 1\r\n\tend", "def do_battle\n @health_points = @health_points -= 1\n puts \"Battle! You lost a health point. You're down to #{ @health_points }.\"\n if @health_points <= 0\n @lives = @lives -= 1\n puts \"You lost a life! You now have #{ @lives } lives.\"\n if @lives <= 0\n puts \"You ran out of lives! Restarting game now.\"\n restart\n end #if-lives\n end #if health_points\n end", "def restart\n @lives == 5\n @gold_coins == 0\n @health_points == 10\n end", "def summons_level(level)\n set_summons\n for summon in @summons\n $game_actors[summon.id].level += level\n end\n end", "def level_up\n @level += 1\n @maxhp = 100 + @level * 12\n @hp = @maxhp\n @connections[@level/5] = nil if @level % 5 == 0\n end", "def attack(troops)\n troops + self.level * troops\n end", "def increment_loss\n self.games_lost += 1\n increment_games_played\n end", "def display_level_up(new_skills)\n $game_message.new_page\n if CXJ::CLASS_EXTENSIONS::SHOW_CLASS_EXP_GAIN[:charlevel]\n $game_message.add(sprintf(Vocab::LevelUp, @name, Vocab::level, @level))\n else\n $game_message.add(sprintf(CXJ::CLASS_EXTENSIONS::VOCAB::CHARACTER_LEVELED_UP, @name))\n end\n return if CXJ::CLASS_EXTENSIONS::USE_PERSISTENT_CLASS_LEVEL\n new_skills.each do |skill|\n $game_message.add(sprintf(Vocab::ObtainSkill, skill.name))\n end\n end", "def player_win\n @player_win += 1\n end", "def update\n\n #Print player current life and life total to formatted string\n @life_text.text = sprintf(\"%03d/%03d\", @player.health, 100)\n\n #Print rubies gathered and rubies total to formatted string\n @score_text.text = sprintf(\"%03d/%03d\", @player.rubies_gathered, @rubies_total)\n\n #Victory! Stop timers\n if @player.state == :won then\n stop_timers()\n end\n\n #Print time limit and kill player if time has run out\n if @time_limit <= 0 && @player.state != :dead\n stop_timers()\n @player.take_damage(100)\n else\n #Print time remaining\n @time_text.text = sprintf(\"%02d:%02d\", @time_limit/60, @time_limit - (@time_limit/60)*60)\n end\n\n end", "def increment_win\n self.games_won += 1 \n increment_games_played\n end", "def essence_to_life\n if not r_pause\n if essence >= new_life\n @essence -= new_life\n @life += 1\n $hud.set_lives(life)\n $sm.play_sound(\"regain1\",1.0,1.0,false)\n @r_pause = true\n else\n $sm.play_sound(\"error\",0.5,1.0,false)\n @r_pause = true\n end\n end\n end", "def set_level(level) # Sets both level and exp\n kendrick_actor_skill_progression_data_progress_set_level(level)\n @exp = exp_for_level\n end", "def level_up_stat_refresh\n st = $game_temp.in_battle\n $game_temp.in_battle = false\n list0 = [max_hp, atk_basis, dfe_basis, ats_basis, dfs_basis, spd_basis]\n @level += 1 if @level < $pokemon_party.level_max_limit\n self.exp = exp_list[@level] if @exp < exp_list[@level].to_i\n self.exp = exp # Fix the exp amount\n hp_diff = list0[0] - @hp\n list1 = [max_hp, atk_basis, dfe_basis, ats_basis, dfs_basis, spd_basis]\n self.hp = (max_hp - hp_diff) if @hp > 0\n $game_temp.in_battle = st\n return [list0, list1]\n end", "def update_score\n \t\tuser.score += 10\n user.save\n\tend", "def calculateSkillPointsInMenu(subject, item)\n\n calcStuff = false;\n #term shown when actor learns a new skill\n learnNewSkillMsg = \" lernt \";\n\n skillTypeList = SKILLINFO::SKILL_CLASS_MEMBERS[item.id];\n skillTypeList.each{|currentSkill|\n\n #prevents power leveling with friendly skills\n if ((subject.skillTypeLevels[currentSkill] <= subject.level) && (subject.skillTypeLevels[currentSkill] <= SKILLINFO::SK_MAXLEVEL))\n if ($skillSystem.learnedSkillTypes[subject.id][currentSkill] == 1)\n #skillpoint formula for actors\n subject.skillExp[currentSkill] += (SKILLINFO::SK_XPPOINTS * SKILLINFO::SK_ACTOR_MODIFIER);\n calcStuff = true;\n end\n end\n if (calcStuff == true)\n if (subject.skillExp[currentSkill] >= SKILLINFO::SK_LEVEL)\n # Level up!\n subject.skillExp[currentSkill] -= SKILLINFO::SK_LEVEL;\n subject.skillTypeLevels[currentSkill] += 1;\n newLevel = subject.skillTypeLevels[currentSkill];\n # will character learn a new skill?\n if ($skillSystem.skillsLearned[currentSkill][newLevel].include?(subject.id))\n skillString = SKILLINFO::SKILL_CLASSES[currentSkill][0];\n lastValue = nil;\n requirements = nil;\n #search for possible new skills\n $skillSystem.actorSkills[subject.id].each{|elements|\n elements.each_with_index{|elem, i|\n if ((i != 0) && (i % 2 == 0))\n if (lastValue == skillString)\n if(newLevel == elem)\n requirements = elements;\n skillToLearn = requirements[0]\n lastReq = nil;\n learnSkill = false;\n #does character know the skill already?\n if (not subject.skill_learn?(skillToLearn))\n requirements.each_with_index{|x, ix|\n if ((ix != 0) && (ix % 2 == 0))\n if(subject.skillTypeLevels[lastReq] == x)\n learnSkill = true;\n else\n learnSkill = false;\n end\n end\n lastReq = x;\n }\n end\n if (learnSkill == true)\n subject.learn_skill(skillToLearn);\n #does not work...\n #$game_message.add(subject.name() + learnNewSkillMsg + $data_skills[skillToLearn].name+\"!\");\n end\n end\n end\n end\n lastValue = elem;\n }\n }\n end\n end\n end\n }\n end", "def leveled_up_message(user, current_level, points)\n if user.total_level > current_level\n flash[:success] = \"You are now level #{user.total_level}!\"\n else\n flash[:success] = \"#{points} exp gained for associated skills!\"\n end\n end", "def xpinc\r\n\t\t@xp += 50\r\n\tend", "def xpinc\r\n\t\t@xp += 50\r\n\tend", "def advance_player!(player)\n<<<<<<< HEAD\n # lanzo el dado\n if not_advance_more_than_lenght?(player)\n @race_progress[player] += @die.roll\n if somebody_is_winner?(player)\n @finished = true \n end\n end\n end", "def level=(lvl)\n return if lvl == @level\n\n lvl = lvl.clamp(1, $pokemon_party.level_max_limit)\n @exp = exp_list[lvl]\n @exp_rate = 0\n @level = lvl\n end", "def set_exp(amount)\n old = @exp\n return if old == amount\n self.exp = amount\n # If exp gain exceeds multiple level requirements, loop until it doesn't\n old > @exp ? exp_decrease : exp_increase\n end", "def change_health(amount)\n self.health += amount\n if(self.health > self.max_health)\n self.health = self.max_health\n end\n self.save!\n self.owner.check_for_death\n end", "def manage_codebreaker_winning_guess\n @winner = 'codebreaker'\n if @human.role.to_s == 'codebreaker'\n @human.score += 1\n else @machine.score += 1\n end\n end", "def update_lifes\n\n if !compare_answer\n @current_responder.lose_life\n end\n\n puts \"#{@player1.print_life} vs #{@player2.print_life}\"\n\n end", "def turn\n\t\toutputStatus\n\t\tif @guesses_left < 10\n\t\t\tsaveGame if save?\n\t\tend\n\t\tletter = getLetter\n\t\tif checkLetter(letter)\n\t\t\treplaceLetter(letter)\n\t\telse\n\t\t\twrongGuess(letter)\n\t\tend\n\tend", "def play_codebreaker(difficulty = 'hard')\n difficulty == 'easy' ? print_codebreaker_intro_easy : print_codebreaker_intro_hard\n @mastermind_code = Code.new\n num_turns = difficulty == 'easy' ? NUM_TURNS_EASY : NUM_TURNS_HARD\n num_turns.times do\n @computer_score += 1\n break if @won\n\n play_turn(difficulty)\n end\n end_game_codebreaker\n end", "def AddPoints(score)\n\tscore = score + 100\nend", "def update_skill\n if Input.trigger?(Input::B)\n $game_system.se_play($data_system.cancel_se)\n return_scene\n return\n end\n if Input.trigger?(Input::R)\n $game_system.se_play($data_system.cursor_se)\n @actor_index += 1\n @actor_index %= $game_party.actors.size\n $scene = Scene_Combo.new(@actor_index)\n return\n end\n if Input.trigger?(Input::L)\n $game_system.se_play($data_system.cursor_se)\n @actor_index += $game_party.actors.size - 1\n @actor_index %= $game_party.actors.size\n $scene = Scene_Combo.new(@actor_index)\n return\n end\n end" ]
[ "0.7028764", "0.6820263", "0.66927797", "0.6586084", "0.64771", "0.6422956", "0.64000636", "0.6358226", "0.6346046", "0.63272655", "0.62809396", "0.62729263", "0.62316424", "0.62168604", "0.6187699", "0.61872613", "0.6145355", "0.61216545", "0.61120665", "0.61010516", "0.608409", "0.6020403", "0.6016789", "0.5994858", "0.5982918", "0.59603953", "0.59595466", "0.59567094", "0.5953162", "0.5934261", "0.59318006", "0.5922422", "0.59220403", "0.5901917", "0.5901917", "0.5895296", "0.58908033", "0.58842343", "0.5882744", "0.5877614", "0.5875791", "0.58568656", "0.58460945", "0.58342415", "0.5829155", "0.5820428", "0.58139163", "0.5801831", "0.57934976", "0.57783765", "0.57780105", "0.57746804", "0.5774317", "0.5770349", "0.5758175", "0.5751901", "0.57444644", "0.5739971", "0.5732152", "0.57301974", "0.5726142", "0.57236856", "0.57154536", "0.57126987", "0.57031745", "0.56980675", "0.5696342", "0.56835616", "0.5662778", "0.56620276", "0.5657795", "0.56469893", "0.5634493", "0.5631922", "0.56298506", "0.5628269", "0.56253785", "0.56247187", "0.5612783", "0.56008476", "0.55973506", "0.5588634", "0.5568179", "0.55602545", "0.5557969", "0.555371", "0.5553475", "0.5545237", "0.55369407", "0.55369407", "0.5525969", "0.551515", "0.55094695", "0.5506318", "0.5505416", "0.5505375", "0.55050874", "0.5500475", "0.5498838", "0.54954636" ]
0.5811577
47
Returns the score of the Game
def get_score() return @player.score() end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def score(game)\n if game.winner.nil?\n 0\n elsif game.winner == game.computer_player\n 1\n else\n -1\n end\n end", "def score\n return @score\n end", "def total_score\n sum = self.games.sum{|game|game.points}\n sum.to_i / self.games.count\n end", "def score_game\n self.score = frames.reduce(0) { |sum, frame| sum + score_frame(frame) } \n end", "def score\n @result.to_i\n end", "def get_score(num)\n return @game[num]\n end", "def score\n calculator.score\n end", "def game_score\n previous_hands = self.game_player.hand_players.joins(:hand).where(\n \"hands.position <= ?\", self.hand.position\n )\n gs = 0\n for h in previous_hands\n gs += h.hand_score\n end\n return gs\n end", "def calculateScore\n\t\tif @game\n @score += [@gridPick.associatedTimer-@game.time,0].max\n\t\telse\n\t\t\t@score = 0\n\t\tend\n\tend", "def score\n @score\n end", "def score\n 2 * won + drawn + noresult\n end", "def game_score\n \n if (@player1.points > 3 || @player2.points > 3) && (@player2.points - @player1.points > 1 || @player1.points - @player2.points > 1)\n return \"#{@player1.score}\"\n elsif (@player1.points >= 3 && @player2.points >= 3) && (@player2.points - @player1.points == 1 || @player1.points - @player2.points == 1)\n return \"#{@player1.score}\"\n elsif @player1.points >= 3 && @player2.points - @player1.points == 0\n return \"#{@player1.score}\"\n elsif @player1.points == @player2.points && @player1.points < 3 \n return \"#{@player1.score} all\"\n elsif @player1.points != @player2.points && @player1.points <= 3 && @player2.points <= 3 \n return \"#{@player1.score}: #{@player2.score}\"\n else\n return \"this is an unfamiliar scoring situation\"\n end\n end", "def get_score\n\t\tscore = ((360000/((@end_time - @start_time).to_f + @save_time.to_f))*((@number_of_correct-@number_of_hint).fdiv(@number_of_correct+1))).truncate(2)\n\t\tif score < 0\n\t\t\treturn 0\n\t\telse\n\t\t\treturn score\n\t\tend\n\tend", "def get_score()\n score = Hash.new(0)\n players.each {|player| score[player.name] = player.score}\n score\n end", "def total_score\n return @plays.reduce(0) { |memo, word| memo + Scrabble::Scoring.score(word) }\n end", "def score\n properties['score']\n end", "def get_games_won()\n return @score_count.get_games_won()\n end", "def score\n #When the player doesn't have enough points to win the game\n return 'love' if @points == 0\n return 'fifteen' if @points == 1\n return 'thirty' if @points == 2\n \n #When the player has exactly enough points to potentially end the game\n if @points == 3 \n if deuce?\n return 'deuce' \n else\n return 'forty'\n end\n end\n\n #When player has more than enough point to end a game deuce/advantage \n if @points > 3\n if deuce?\n 'deuce'\n elsif advantage?\n 'advantage'\n elsif disadvantage?\n 'disadvantage'\n elsif won_game?\n 'won game' \n else\n 'lost game'\n end\n end \n end", "def score\n puts \"\\n---PLAYER 1: #{self.players_score} -- DEALER: #{self.dealers_score}---\"\n end", "def score\n \n case @points\n when 0 \n @player_score[@points] = 'Love'\n return @player_score[@points]\n when 1 \n @player_score[@points] = 'Fifteen'\n return @player_score[@points]\n when 2 \n @player_score[@points] = 'Thirty'\n return @player_score[@points]\n when 3 \n @player_score[@points] = 'Forty'\n return @player_score[@points]\n else \n return @points \n end\n end", "def score(player)\n @score[player]\n end", "def gen_score\n ## Calculate the score here!\n\n total_score = victories + coins/3 + blues + yellows + purples + leaders + blacks\n ## Greens\n greens = [tablets, compasses, gears]\n total_score += (greens.min*7) + greens[0]**2 + greens[1]**2 + greens[2]**2\n self.score = total_score\n end", "def scores\n return Game.score(self.card_numbers self.user_id), Game.score(self.card_numbers nil)\n end", "def score\n @score || calculate_score\n end", "def get_total_score\n\t\tquestion_scores = Question_score.for_game_record(self.id)\n\t\tscore = 0\n\t\tquestion_scores.length.times do |i|\n\t\t\tscore += question_scores[i].score\n\t\tend\n\t\tscore\n\tend", "def game_score(score)\n end", "def total_score\n total_score = 0\n plays.each do |word|\n total_score += Scrabble::Scoring.score(word)\n end\n return total_score\n end", "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 && opponent.points != 3 # Three points scored by each side and a player has 1 more point than his/her opponent.\n return 'advantage' if @points > 3 && @points == opponent.points + 1 # Three points scored by each side and a player has 1 more point than his/her opponent.\n return 'deuce' if @points >= 3 && @points == opponent.points # Both players score at least 3 points and the scores are equal.\n return 'win' if @points > 3 && @points == opponent.points + 2 # The first player to have at least 4 points total and at least 2 more points than opponent.\n end", "def score\n @scores[ result.key ]\n end", "def to_i\n return self.score\n end", "def find_score \n player = self.find_winner\n if player == 1\n return @player_1.life\n end\n return @player_2.life\n end", "def score\n p_score = player_hand.collect{|x| x.value}.inject(:+)\n c_score = computer_hand.collect{|x| x.value}.inject(:+)\n puts \"You have #{player_hand.collect{|x| \"#{x.face}#{x.suit}\"}.join(\" & \")}, for a total of #{p_score}\"\n puts \"The computer has #{computer_hand.collect{|x| \"#{x.face}#{x.suit}\"}.join(\" & \")}, for a total of #{c_score}\"\n puts \" \"\n end", "def score\n return 'love' if @points == 0\n return 'fifteen' if @points == 1\n return 'thirty' if @points == 2\n return 'duece' if @points == 3 && @opponent.points == 3\n return 'forty' if @points == 3\n game_won?\n end", "def score\n @score ||= (\n total = 0\n words.each do |word, rank|\n total += score_word(word, rank)\n end\n total\n )\n end", "def score(board, player)\n winner = board.find_winner\n return 1000000 if winner && winner == player\n return -1000000 if winner && winner == opponent(player)\n score_for(board, player) - score_for(board, opponent(player))\n end", "def result(result)\n @score += 3 if result == \"win\"\n @score += 1 if result == \"draw\"\n return score\n end", "def score\n return nil if won?\n return super if tie_break?\n return 'Deuce' if deuce?\n\n case advantage\n when 1 then \"Advantage #{player1}\"\n when 2 then \"Advantage #{player2}\"\n else game_score\n end\n end", "def score\n p1_score = players.first.score \n p2_score = players[1].score\n\n if p1_score == p2_score\n score_word = SCORE_NUMBER_TO_WORD_MAP[0..-2][p1_score]\n return score_word ? score_word + \"-All\" : \"Deuce\"\n elsif p1_score <= 3 && p2_score <= 3\n return players.map{|player| SCORE_NUMBER_TO_WORD_MAP[player.score] }.join(\"-\")\n else\n winning_player = players.sort{|a, b| a.score <=> b.score}.last\n return (p1_score - p2_score).abs == 1 ? \"Advantage #{winning_player.name}\" : \"Win for #{winning_player.name}\"\n end\n end", "def total_score\n plays.inject(0) { |sum, word| sum + Scoring.score(word) }\n end", "def score\n end", "def player_score()\n\t\tparams.each do |name, guess| #recieves guess from form on guess.slim\n\t\t\tsession[:player].each do |z|\n\t\t\t\tif z.name == name\n\t\t\t\t\tz.guess = guess.to_i\n\t\t\t\t\tz.round_score = (z.guess - session[:movie][session[:round_count]].ratings['critics_score'].to_i).abs\n\t\t\t\t\tz.total_score += (z.guess - session[:movie][session[:round_count]].ratings['critics_score'].to_i).abs\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "def calculate_score\n #set default user score value to 0 in the database but to prevent any errors and remove database dependencies i am including this line in the model as well\n score || 0\n self.games.each do |game|\n score+=game.points\n end\n score\n end", "def score\n puts \"---#{player.name.upcase}: #{player.score} -- #{dealer.name.upcase}: #{dealer.score}---\"\n end", "def formulate_score()\n @player_score = @player_score.sort!().reverse!().join().to_i()\n p \"#{@players[0].get_name}'s score is #{@player_score}\"\n check_score()\n end", "def score; end", "def score\n @scoreTotal = @jogadas[0].down_pin + @jogadas[1].down_pin\n end", "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 && @opponent.points != 3\n return 'deuce!' if @points >= 3 && @points == @opponent.points \n return 'advantage' if @points > 3 && @points == @opponent.points + 1\n return 'winner' if @points > 3 && @points == @opponent.points + 2\n end", "def score\n score_list = [self.wins.size, self.losses.size, self.tie.size]\n return score_list\n end", "def get_score\n @score ||= calculate_score\n end", "def score\n @cards.map(&:value).inject(:+)\n end", "def total_score\n @all_games.map do |games|\n games[\"home_goals\"].to_i + games[\"away_goals\"].to_i\n end\n end", "def score\n rate.score\n end", "def current_score\n\t\treturn @game_stack\n\tend", "def score\n w = 0.3\n time = diff_time()\n sum_goods = goods()\n sum_bads = bads()\n total = sum_goods + sum_bads\n (w * sum_goods * (sum_goods/total.to_f)**3 * (total/time)).floor\n end", "def get_score\n \"#{@name} #{@lives}/3\"\n end", "def total_score\n Scrabble::Scoring.make_array_of_scores(@plays_array)\n @total_score_instance = Scrabble::Scoring.return_array_of_scores.inject(0, :+)\n end", "def calculate_score(user_id)\n Game.score(self.card_numbers user_id)\n end", "def score\n return 'win' if (@points >= 4 && @points >= opponent.points + 2)\n return 'deuce' if (@points >= 3 && @points == opponent.points)\n return 'advantage' if (@points >= 3 && @points == opponent.points + 1)\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 end", "def evaluate\r\n score = 0\r\n # Evaluate score for each wining combination\r\n WIN_COMBINATIONS.each do |combo|\r\n score += evaluate_combo(combo)\r\n end\r\n\r\n score\r\n end", "def score(depth)\n # print depth\n # If state has already been calculated as win or loss,\n # Return score\n if @score != nil\n return @score\n end\n # If @game is over, return appropriate score\n if won?\n best_score = self.class::MAX_SCORE - depth # player won\n elsif lost?\n best_score = -self.class::MAX_SCORE + depth # player lost\n elsif done?\n best_score = 0 # draw\n elsif depth > self.class::MAX_DEPTH && !force_analysis\n # If too deep, use game-specific scoring\n # Default is just to give score of 1 (slightly better than draw)\n # print \".\"\n best_score = heuristic_score\n else\n # Otherwise find and score best move for opponent\n best_score = best_move_with_score(depth + 1)[1]\n end\n # Add score to master list and return it\n if best_score == self.class::MAX_SCORE || best_score == -self.class::MAX_SCORE\n @score = best_score\n end\n # print best_score\n best_score\n end", "def player1_score\n player_hand.inject(0){|sum,n| sum + n.value }\n end", "def total_score\n\t\t0 + score_one.to_i + score_two.to_i + score_three.to_i + score_four.to_i\n\tend", "def get_score (cards)\n\t\tscore = 0\n\t\tcards.each do |card|\n\t\t\tmeasure = card[0]\n\t\t\tscore += @score[measure]\n\t\tend\n\t\tscore\n\tend", "def highest_total_score\n @game_manager.highest_total_score\n end", "def score\n last_30_score\n end", "def score\n GreatSchools::Score.for_school(state, id)\n end", "def get_score\n flush = is_flush?\n straight = is_straight?\n pairs = pairs?\n\n return 45 if pairs.size == 1 && pairs[0][1] == 5\n return 44 if flush && straight\n return 31 + pairs[0][0] - 2 if pairs.size == 1 && pairs[0][1] == 4\n return 30 if pairs.size == 2 && (pairs[0][1] + pairs[1][1]) == 5\n return 29 if flush\n return 28 if straight\n return 15 + pairs[0][0] - 2 if pairs.size == 1 && pairs[0][1] == 3\n return 14 if pairs.size == 2\n return 1 + pairs[0][0] - 2 if pairs.size == 1\n -14 + high_card #high card return\n end", "def score\n # add score caching\n total = 0\n self.votes.each do |vote|\n total += vote.value\n end\n total\n end", "def get_other_games_won()\n @score_count.get_other_games_won()\n end", "def formulate_score()\n @player_score = @player_score.sort!().reverse!().join().to_i()\n p \"#{@players_joined[0]}'s score is #{@player_score}\"\n check_score()\n end", "def get_score\n\t\t# ruby is rounding here\n\t\tthis_score = 2.3 * self.imdb_score\n\t\t# had to add this if/else because some movies are missing years\n\t\tif self.year == nil\n\t\t\tthat_score = 0\n\t\telse\n\t\t\tthat_score = self.year / 2000\n\t\tend\n\t\tthe_score = this_score - that_score\n\t\treturn the_score + self.sci_fi_bonus\n\tend", "def score\n Dictionary.db.zscore(@key, @value).to_i\n end", "def score\n @grpc.score\n end", "def score\n # puts\n # p @frames\n\n raise RuntimeError, 'Score cannot be taken until the end of the game' unless game_over?\n\n base_rolls = @frames[0..9].flatten.size\n arr = @frames.flatten\n # p arr\n arr.map!.with_index do |elem, ndx|\n if ndx < base_rolls\n # p \"elem == #{elem}\"\n\n # should split the bonus calc off into a separate method\n # calc the bonus for the 1st subsequent roll\n bonus = arr[ndx + 1] == 'X' ? 10 : arr[ndx + 1] if elem == 'X' || elem == '/'\n if elem == 'X'\n # add the bonus for the 2nd subsequent roll\n bonus += if arr[ndx + 2] == 'X'\n 10\n elsif arr[ndx + 2] == '/'\n 10 - arr[ndx + 1]\n else\n arr[ndx + 2]\n end\n\n # p \"bonus == #{bonus}\"\n 10 + bonus\n elsif elem == '/'\n # p \"bonus == #{bonus}\"\n (10 - arr[ndx - 1]) + bonus\n else\n elem\n end\n end\n end\n # p arr\n # p arr[0...base_rolls]\n arr[0...base_rolls].sum\n end", "def score\n @word = params[:word || \"\"].upcase\n @grid = session[:letters]\n start_time = Time.parse(session[:start_time])\n end_time = Time.now\n time_taken = (end_time - start_time).to_f\n\n session[:scores] = @word.size * (60 - time_taken) # how to computed all scores ???\n\n @result = Game.run_game(@word, @grid, time_taken)\n end", "def score\n @total_score = 0\n @current_roll = 0\n @frame = 1\n\n while rolls?\n set_roll_logic\n if @frame > 10\n return @total_score\n else\n score_frame\n end\n end\n return @total_score\n end", "def score\n populate_frames.inject(0) {|a,v| a+ v.frame_total}\n end", "def total_score\n score || 0 #pos - neg\n end", "def updateScore(score, result)\n\tif result == \"P1 wins!\"\n\t\tscore[\"Player 1\"] += 1\n\telsif result == \"P2 wins!\"\n\t\tscore[\"Player 2\"] += 1\n\tend\n\tputs result\n\tputs \"Current score:\\n Player 1: \" + score[\"Player 1\"].to_s + \" Player 2: \" + score[\"Player 2\"].to_s + \"\\n\\n\"\n\treturn score\nend", "def score\n suit_score = [\n Suit.spades,\n Suit.clubs,\n Suit.diamonds,\n Suit.hearts,\n Suit.none\n ].index(suit) * 20 + 40\n\n (number - 6) * 100 + suit_score\n end", "def score(state)\n position = state[:position]\n # If state has already been calculated as win or loss,\n # Return score\n if @state_scores.has_key?(state)\n return @state_scores[state]\n end\n # If @game is over, return appropriate score\n if won?(state)\n best_score = @max_score - @depth # player won\n elsif lost?(state)\n best_score = -@max_score + @depth # player lost\n elsif done?(state)\n best_score = 0 # draw\n elsif @depth > @max_depth && !force_analysis(state)\n # If too deep, use game-specific scoring\n # Default is just to give score of 1 (slightly better than draw)\n # print \".\"\n best_score = heuristic_score(state)\n else\n # Otherwise find and score best move for opponent\n # print @depth\n @depth += 1\n best_score = best_move_with_score(state)[1]\n @depth -= 1\n end\n # Add score to master list and return it\n if best_score == @max_score || best_score == -@max_score\n @state_scores[state] = best_score\n end\n best_score\n end", "def call_score\n if @player1.points == @player2.points\n tie_score\n elsif advantage?\n advantage \n else \n \"#{current_server.score} #{current_server.opponent.score}\"\n end\n end", "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 end", "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 end", "def board_score\n my_points = @game.my_faction.unit_points\n score = 99999\n (@game.factions-[@game.my_faction]).each { |f|\n diff = my_points - f.unit_points\n score = diff if diff < score\n }\n score\n end", "def score_p1(game)\n oc, mc = game[0], game[1]\n r = (mc - oc + 1) % 3\n return 3 * r + mc + 1\nend", "def score\n 3*@tally + 5*@strength + 2*@wealth + @food + 30*@monsters_killed\n end", "def score\n return 0 unless valid?\n 100 * card_value_decimal * 15 ** 5\n end", "def player_win_percentage\n (games_won/user_games)\n end", "def score\n unless self.opponent.points > 3 \n return 'love' if @points == 0\n return 'fifteen' if @points == 1\n return 'thirty' if @points == 2\n end\n if @points == 3 && (self.opponent.points < 3)\n return 'forty' \n elsif @points - self.opponent.points == 0 \n return 'deuce'\n elsif @points - self.opponent.points == 1\n return \"advantage: #{self.name}\"\n elsif self.opponent.points - @points == 1\n return \"advantage: #{self.opponent.name}\"\n elsif @points - self.opponent.points >= 2\n return \"game: #{self.name}\"\n else \n return \"game: #{self.opponent.name}\"\n end\n\n end", "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 end", "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 end", "def heuristic_score(state)\n pieces = state[:pieces]\n player = state[:player]\n total_value(pieces[player]) - total_value(pieces[opponent(player)])\n end", "def score(cells)\n if winner(cells) == 2\n return 10\n elsif winner(cells) == 1\n return -10\n else\n return 0\n end\n end", "def score\n @score = [straight_flush, four_of_a_kind, full_house, flush, straight, three_of_a_kind, two_pair, one_pair, high_card]\n end", "def score\n\n # Initialise local counters\n scoreCounter = 0\n rollIndex = 0\n frameIndex = 0\n\n # Block to run over all frames\n @rolls.each do |roll|\n if frameIndex < 10\n if strike?(rollIndex)\n # A strike means a special score and the frame is cleared in one roll\n scoreCounter += strikeScore(rollIndex)\n rollIndex += 1\n elsif spare?(rollIndex)\n # A strike means a special score and the frame is cleared in two rolls\n scoreCounter += spareScore(rollIndex)\n rollIndex += 2\n else\n # A strike means a regular score and the frame is cleared in two rolls\n scoreCounter += regularScore(rollIndex)\n rollIndex += 2\n end\n frameIndex += 1\n end\n end\n\n # Return value\n scoreCounter\n\n end", "def score\n @subject.score\n end", "def score\n \"#{score1}-#{score2}\"\n end", "def score\n # raise\n # binding.pry\n @lettres = params[:grid]\n @attempt = params[:games]\n if included?(@attempt.upcase, @lettres)\n if english_word?(@attempt)\n @score = compute_score(@attempt)\n @result = [@score, \"Congrats! #{@attempt} is a valid English word\"]\n else\n @result = [0, \"Sorry, but #{@attempt} isn't a valid English word\"]\n end\n else\n @result = [0, \"Sorry, but #{@attempt} can't be build out of #{@lettres}\"]\n end\n end", "def updateScore(score, result)\n\tif result == \"Player 1 wins this round!\"\n\t\tscore[0] += 1\n\telsif result == \"Player 2 wins this round!\"\n\t\tscore[1] += 1\n\telsif result == \"Tie!\"\n\t\tscore[2] += 1\n\tend\n\treturn score\nend" ]
[ "0.8222461", "0.7991709", "0.79298407", "0.7864132", "0.7749373", "0.7735888", "0.77311563", "0.76271975", "0.7601157", "0.75438535", "0.751995", "0.7510693", "0.7493977", "0.74937433", "0.74776304", "0.7466759", "0.74565023", "0.7433489", "0.7420655", "0.7398368", "0.7388757", "0.73696786", "0.73515683", "0.7321943", "0.73076427", "0.7302643", "0.72966725", "0.7290803", "0.7273709", "0.7271776", "0.724293", "0.7220485", "0.72162783", "0.7210676", "0.7188099", "0.7166976", "0.71606547", "0.7146529", "0.7145092", "0.71152425", "0.7112451", "0.7101582", "0.71002895", "0.70971996", "0.70941067", "0.7067665", "0.7060485", "0.70600533", "0.7055432", "0.7051209", "0.7045486", "0.7033202", "0.70208925", "0.7016947", "0.7013767", "0.70003045", "0.6999471", "0.69840986", "0.69807756", "0.69623965", "0.6961277", "0.69591016", "0.6949301", "0.69442904", "0.69430953", "0.6942759", "0.6932334", "0.6917776", "0.691694", "0.6916045", "0.6908789", "0.6906588", "0.6906338", "0.6903852", "0.690303", "0.6880723", "0.6867184", "0.6865044", "0.686383", "0.68592596", "0.684323", "0.6836355", "0.68288046", "0.68288046", "0.6822858", "0.6821432", "0.68178105", "0.68156564", "0.68148303", "0.68084353", "0.6797459", "0.67944616", "0.6793334", "0.678817", "0.67567027", "0.675026", "0.6743897", "0.67428416", "0.6736181", "0.6734517" ]
0.82753354
0
Returns the time of the Gameplay
def get_game_play_time() return @game_play_time end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gametime\n \"#{self.gametime_maths/60} minutes\"\n end", "def play_time\n sum = 0\n @tracks.each {|n| sum += n.total_time}\n return Time.at(sum/1000.0).strftime('%R:%S')\n end", "def current_play_time\n time = $trainer.update_play_time\n hours = time / 3600\n minutes = (time - 3600 * hours) / 60\n format('%<hours>02d %<sep>s %<mins>02d', hours: hours, sep: text_get(25, 6), mins: minutes)\n end", "def time\n [self.game_begins, [self.game_ends, Time.now].min].max\n end", "def time\n return @time\n end", "def time\n @time\n end", "def play_time_text\n time = @play_time\n hours = time / 3600\n minutes = (time - 3600 * hours) / 60\n return format(TIME_FORMAT, hours, minutes)\n end", "def get_time_running\n\tu = get_unix_time\n\tt = -9\n\tif @TIME > 0\n\t\tt = u - @TIME\n\tend\nend", "def time()\n return self._request([\n 'time',\n '0'\n ])[0]\n end", "def time\n @robot.time\n end", "def time()\n return _request([\n 'time',\n '0'\n ])[0]\n end", "def time\n send_message!(Protocol::Device::GetTime.new, wait_for: Protocol::Device::StateTime) do |payload|\n Time.at(payload.time.to_f / NSEC_IN_SEC)\n end\n end", "def time\n end_time - start_time\n end", "def time\n end", "def time\n @status == 'running' ? Time.now - @sw_start : @sw_time\n end", "def time\n Time.at(messaging['time'] / 1000)\n end", "def time\n Time.now.to_f\n end", "def update_play_time\n @play_time += time_counter\n load_time\n return @play_time\n end", "def thisTime\n Gosu::milliseconds - @initTime/@delay\n end", "def thisTime\n Gosu::milliseconds - @initTime/@delay\n end", "def thisTime\n Gosu::milliseconds - @initTime/@delay\n end", "def thisTime\n Gosu::milliseconds - @initTime/@delay\n end", "def thisTime\n Gosu::milliseconds - @initTime/@delay\n end", "def thisTime\n Gosu::milliseconds - @initTime/@delay\n end", "def thisTime\n Gosu::milliseconds - @initTime/@delay\n end", "def thisTime\n Gosu::milliseconds - @initTime/@delay\n end", "def thisTime\n Gosu::milliseconds - @initTime/@delay\n end", "def thisTime\n Gosu::milliseconds - @initTime/@delay\n end", "def thisTime\n Gosu::milliseconds - @initTime/@delay\n end", "def thisTime\n Gosu::milliseconds - @initTime/@delay\n end", "def thisTime\n Gosu::milliseconds - @initTime/@delay\n end", "def thisTime\n Gosu::milliseconds - @initTime/@delay\n end", "def thisTime\n Gosu::milliseconds - @initTime/@delay\n end", "def thisTime\n Gosu::milliseconds - @initTime/@delay\n end", "def thisTime\n Gosu::milliseconds - @initTime/@delay\n end", "def thisTime\n Gosu::milliseconds - @initTime/@delay\n end", "def thisTime\n Gosu::milliseconds - @initTime/@delay\n end", "def thisTime\n Gosu::milliseconds - @initTime/@delay\n end", "def thisTime\n Gosu::milliseconds - @initTime/@delay\n end", "def thisTime\n Gosu::milliseconds - @initTime/@delay\n end", "def thisTime\n Gosu::milliseconds - @initTime/@delay\n end", "def thisTime\n Gosu::milliseconds - @initTime/@delay\n end", "def thisTime\n Gosu::milliseconds - @initTime/@delay\n end", "def thisTime\n Gosu::milliseconds - @initTime/@delay\n end", "def thisTime\n Gosu::milliseconds - @initTime/@delay\n end", "def thisTime\n Gosu::milliseconds - @initTime/@delay\n end", "def thisTime\n Gosu::milliseconds - @initTime/@delay\n end", "def thisTime\n Gosu::milliseconds - @initTime/@delay\n end", "def time\n Integer(connection.write(\"get_time\", false))\n rescue ArgumentError\n 0\n end", "def time\n Integer(connection.write(\"get_time\", false))\n rescue ArgumentError\n 0\n end", "def time\n Integer(connection.write(\"get_time\", false))\n rescue ArgumentError\n 0\n end", "def puttime\n if gameover?\n return\n end\n setpos(TIMELINE,0)\n addstr( (Time.now.to_i - @start).to_s + \" sec\")\n end", "def puttime\n return if gameover?\n\n setpos(TIMELINE, 0)\n addstr(\"#{Time.now.to_i - @start} sec\")\n end", "def getTimer\n return @chrono.getTime()\n #return @chrono.to_s()\n end", "def time\n @time ||= Time.at( timestamp / 1_000_000.0 )\n end", "def time\n #Parse the raw time into a binary time structure...\n time = send_request(Packets::RequestTime.new)\n\n #And convert that to a ruby time.\n time.to_time()\n end", "def time; end", "def time; end", "def time; end", "def time; end", "def time; end", "def time; end", "def time; end", "def time; end", "def time; end", "def get_time\n Process.clock_gettime(Process::CLOCK_MONOTONIC)\n end", "def time\r\n\t\t@usr_time\r\n\tend", "def game_time()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = TimeSpanRef.new(Native.Time_game_time(@handle.ptr))\n if result.handle.ptr == nil\n return nil\n end\n result\n end", "def get_time\n\t\tsynchronized do\n\t\t\t@vlc.puts \"get_time\"\n\t\t\t@vlc.gets.to_i\n\t\tend\n\tend", "def update_time\n delta = Gosu.milliseconds - @last_ms\n @last_ms = Gosu.milliseconds\n delta\n end", "def time\n\n end", "def start_time\n if ev = start_event.last\n ev.time\n end\n end", "def start_time\n if ev = start_event.last\n ev.time\n end\n end", "def sec() time[2] end", "def time_sec; Time.now.sec; end", "def get_time\n\t\t@time.inspect\n\tend", "def time\n\t\tresponse = self.request( :time )\n\t\treturn nil if response.empty?\n\t\treturn Time.at( response.first[:time].to_i )\n\tend", "def start_time\n start\n end", "def time\n start.try(:to_time).try(:strftime, '%-l:%M %P')\n end", "def current_time\r\n return @owner.timestamp.to_i - @start.to_i\r\n end", "def prep_time_passed\n return \"7:34\"\n end", "def now\n @clock\n end", "def minute\n if self.in_play?\n return self.round.minute\n else\n if self.finished?\n return MINUTES\n else\n return 0\n end\n end\n end", "def fetchSimulationTime()\n com = Sumo::Traci::Command_GetVariable.new(:sim, :timeStep, \"\") ;\n execCommands(com) ;\n time = com.responseValue() ;\n return time ;\n end", "def draw_playtime(x, y, width)\n #draw_bg_rect(x, y, width, line_height)\n desc = Vocab::pi_playtime\n text = sprintf(desc, player.hours, player.minutes)\n draw_text(x, y, width, line_height, text, 1)\n end", "def time\n DateTime.now.strftime(TIME_FORMAT)\n end", "def clock_time\n Process.clock_gettime(Process::CLOCK_MONOTONIC)\n end", "def time\n\tTime.new.strftime(\"%k:%M\")\nend", "def timestamp\n ((Time.now.to_f - StartTime)*1000).round\n end", "def current_time\n clock.now.to_f\n end", "def time\n (route[:time].to_i / 60).ceil\n end", "def end_time\n if ev = stop_event.last\n ev.time\n end\n end", "def end_time\n if ev = stop_event.last\n ev.time\n end\n end", "def time\n result = veeamconfig('schedule', 'show', '--jobId', get_job_id).lines\n # get the time\n t = result[1].strip.split(': ')[1]\n # split hours and minutes (will use these to pad first)\n bits = t.split(':')\n # pad both the hour and the minute with a zero if needed\n bits[0] = \"%02d\" % bits[0]\n bits[1] = \"%02d\" % bits[1]\n\n # return the joined value (HH:MM)\n bits.join(':')\n end", "def time\n a=[1, 1000, 60000, 3600000]*2\n ms = duration\n \"%02d\" % (ms / a[3]).to_s << \":\" << \n \"%02d\" % (ms % a[3] / a[2]).to_s << \":\" << \n \"%02d\" % (ms % a[2] / a[1]).to_s #<< \".\" << \n #\"%03d\" % (ms % a[1]).to_s\n end", "def calc_play_seconds\n @time_days.to_i * 86400 + @time_hours.to_i * 3600 + @time_minutes.to_i * 60\n end", "def start_time\n\t\t\treturn @start_time.strftime('%H:%M')\n\t\tend", "def frame_time; motion.frame_time; end", "def run_time\n ((Time.now - start_time) * 1000).round\n end", "def hold_time\n game_type == 'zones' ? config.time || 99999999 : nil\n end" ]
[ "0.7788315", "0.7620484", "0.74139893", "0.7297721", "0.7272682", "0.7245473", "0.7144879", "0.7115967", "0.71093667", "0.7103704", "0.70830953", "0.70655817", "0.7063819", "0.7044452", "0.6992768", "0.6963224", "0.69628036", "0.6941735", "0.6926208", "0.6926208", "0.6926208", "0.6926208", "0.6926208", "0.6926208", "0.6926208", "0.6926208", "0.6926208", "0.6926208", "0.6926208", "0.6926208", "0.6926208", "0.6926208", "0.6926208", "0.6926208", "0.6926208", "0.6926208", "0.6926208", "0.6926208", "0.6926208", "0.6926208", "0.6926208", "0.6926208", "0.6926208", "0.6926208", "0.6926208", "0.6926208", "0.6926208", "0.6926208", "0.6925501", "0.6925501", "0.6925501", "0.6917273", "0.6900563", "0.6876241", "0.6860246", "0.6846757", "0.68223906", "0.68223906", "0.68223906", "0.68223906", "0.68223906", "0.68223906", "0.68223906", "0.68223906", "0.68223906", "0.6796341", "0.6786691", "0.67847174", "0.6768707", "0.67632675", "0.67113245", "0.66981786", "0.66981786", "0.66834635", "0.668268", "0.6659318", "0.66496897", "0.66334546", "0.66171503", "0.6610809", "0.66033256", "0.6585792", "0.6569382", "0.65615237", "0.65609854", "0.6555428", "0.65408176", "0.65264887", "0.6522584", "0.6513615", "0.65061104", "0.6498439", "0.6498439", "0.6495333", "0.6483478", "0.6479114", "0.64779", "0.6471926", "0.646985", "0.6465951" ]
0.86502063
0
Removing the bullets which have moved pass the screen
def remove_unused_bullets() # All the bullet objects are looped through @bullets.dup.each { |bullet| # Determines if a bullet is outside the screen bullet.x > SCREEN_HEIGHT || bullet.x < 0 } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_bullets_of_screen args\n args.state.bullets = args.state.bullets.reject { |bullet| bullet.x > 1280 } # screen width is 1280\nend", "def hit_by_bullet\n $p_bullets.delete_if do |b|\n if self.bounding_box_collision?(b)\n @meter.change_width(b.dmg)\n b.destroy\n during(100) { @color.alpha = 100 }.then { @color.alpha = 255 }\n @life -= 1.0\n true\n end\n end\n end", "def cleanup \n @bullets.each do |bullet|\n if bullet.exploding\n @bullets.delete bullet\n end\n end\n end", "def kill()\n #this removes the bullet object from the bullets array\n @bullets.delete(self)\n #this removes the model so it is no longer displayed on the window\n @model.remove\n end", "def updatePosition\n super\n\n Bullet.BulletInstances.each { |bullet|\n if collision?(bullet)\n bullet.destroy\n explode\n end\n }\n\n Ship.ShipInstances.each { |ship|\n if collision?(ship)\n ship.destroy\n explode\n end\n }\n end", "def enemy_bullet_collision\n if cr.defeated == false\n $e_bullets.each do |b|\n if self.bounding_box_collision?(b)\n @life -= 1\n $hud.set_lives(life)\n clear_all_bullets\n end\n end\n end\n end", "def removeSprites *sprites\n @game_actors -= sprites\n end", "def move_bullets args\n args.state.bullets.each do |bullet| # perform action on each bullet in collection\n bullet.x += bullet.speed # increment x by speed (bullets fly horizontally across screen)\n\n # By randomizing the value that increments bullet.y, the bullet does not fly straight up and out\n # of the scope of the screen. Try removing what follows bullet.speed, or changing 0.25 to 1.25 to\n # see what happens to the bullet's movement.\n bullet.y += bullet.speed.*(0.25).randomize(:ratio, :sign)\n bullet.rect = [bullet.x, bullet.y, bullet.size, bullet.size] # sets definition of bullet's rect\n end\nend", "def cleanupSprites\n # remove from actors list\n @game_actors -= @clean_up_sprites\n\n # reset the clean up sprites\n @clean_up_sprites.clear\n end", "def remove_from_list\n return unless in_list?\n decrement_positions_on_lower_items\n set_my_position nil\n end", "def remove_from_list\n if in_list?\n decrement_positions_on_lower_items\n set_my_position nil\n end\n end", "def shoot_2\n if Time.now - @last_shoot_1 > 0.05\n @window.e_bullets << Ennemy_Bullet.new(@window, @player, @x - 28, @y, 0, 7)\n @window.e_bullets << Ennemy_Bullet.new(@window, @player, @x + 28, @y, 0, 7)\n @last_shoot_1 = Time.now\n end\n end", "def update\n if Gosu.milliseconds - @creation_milliseconds >= SLIME_TIME * 2\n @window.level.enemies.delete(self)\n end\n end", "def player_hit(bullet)\r\n @bullets.delete bullet\r\n @ship_hit_sound.bmp.play\r\n # If the player has lost all the lifeline end the game\r\n if @player.life == 0\r\n # Ending the game\r\n GameOverWindow.new.show\r\n close\r\n end \r\n # Player lost one lifeline\r\n @player.lose_life()\r\n # Plaing a blank heart to represent it\r\n @heart_list[@player.life] = @blank_heart\r\n @heart = @blank_heart \r\n end", "def checkCollide(playerBullets)\n\t\t# Removes the bullet that shot the ship\n\t\tplayerBullets.reject! do |bullet|\n\t\t\tif Gosu::distance(@x, @y, bullet.x, bullet.y) <= 10 then\n\t\t\t\ttrue\n\t\t\telse\n\t\t\t\tfalse\n\t\t\tend\n\t\tend\n\tend", "def remove_sprite(animation=nil)\n events=$PokemonGlobal.dependentEvents\n for i in 0...events.length\n if events[i] && events[i][8]==\"Dependent\"\n events[i][6]=sprintf(\"nil\")\n @realEvents[i].character_name=sprintf(\"nil\")\n if animation==true\n $scene.spriteset.addUserAnimation(Animation_Come_In,@realEvents[i].x,@realEvents[i].y)\n pbWait(10)\n end\n $game_variables[Current_Following_Variable]=$Trainer.party[0]\n $game_variables[Walking_Time_Variable]=0\n end\n end\n end", "def shoot_1\n if Time.now - @last_shoot_1 > 0.5\n @window.e_bullets << Ennemy_Bullet.new(@window, @player, @x, @y, -2, 4)\n @window.e_bullets << Ennemy_Bullet.new(@window, @player, @x, @y, 0, 4)\n @window.e_bullets << Ennemy_Bullet.new(@window, @player, @x, @y, 2, 4)\n @last_shoot_1 = Time.now\n end\n end", "def addSpritesToBeRemoved *sprites\n @clean_up_sprites += sprites\n end", "def add_bullets\n @window.bullets << Vibrant_Bullet.new(@window, @player, @player.x, @player.y - @player.height/2.0)\n end", "def remove_all\n @list.each_key do |key|\n @list[key].each do |o|\n if o\n o.sprite.remove\n @list[key].delete(o)\n end\n end\n @list.delete(key)\n end\n end", "def without_bullet\n old_bullet_enable = Bullet.enable?\n Bullet.enable = false\n yield\n ensure\n Bullet.enable = old_bullet_enable\n end", "def remove_from_list\n # if in_list?\n # decrement_positions_on_lower_items\n # update_attribute position_column, nil\n # end \n return unless in_list?\n decrement_positions_on_lower_items\n update_attribute position_column, nil \n end", "def move_pos_off\n @move_pos_selecting = false\n remove_show_hls\n # @spriteset.remove_group(DISPLAY_TB) # @spriteset.dispose_highlights_tb\n end", "def update\n @live_shots = self.shots.length\n self.shots.each do |shot|\n shot.update\n end\n self.shots.delete_if do |shot|\n shot.deleted?\n end\n\n self.game.objects.each do |object|\n if object.tags.include? \"enemy_shot\"\n if Gosu::distance(object.x,object.y,@x,@y) < 10\n @health -= 1\n object.delete\n end\n end\n end\n end", "def cleanupSprites\n @spriteManager.cleanupSprites\n end", "def checkCollide(enemyBullets)\n enemyBullets.each do |bullet|\n if Gosu::distance(bullet.x, bullet.y, @x, @y) < 5\n @isKill = true\n end\n end\n end", "def clear_lines\n @items.each { |item| @scene.removeItem item }\n @items.clear\n end", "def remove_from_list\n if in_list?\n decrement_positions_on_lower_items\n set_list_position(nil)\n end\n end", "def update()\n #checks if it has hit an asteroid\n self.hit()\n #moves the bullet\n self.move()\n end", "def stop_all_movements\n @move_obj.clear_move_info\n @shadow_point.clear_move_info\n end_smooth_slide\n @shadow_point.end_smooth_slide\n end", "def check_pops\n sprites = @damage_sprites.delete_if {|sprite| sprite.cancellable?}\n end", "def remove_unicode_bullets_from_list_items!\n path = WordToMarkdown.soffice.major_version == '5' ? 'li span span' : 'li span'\n @document.tree.search(path).each do |span|\n span.inner_html = span.inner_html.gsub(/^([#{UNICODE_BULLETS.join}]+)/, '')\n end\n end", "def clear_dmg_preview\n @attacker = nil\n @type = nil\n @skill = nil \n self.contents.clear_rect(0, self.contents.height - WLH, width, WLH) \n return unless @preview\n for sp in @preview\n sp.dispose\n end\n @preview.clear\n end", "def touched_by bullet\n ([@width, @height].max/3).times do\n p_vx = rand(100)/10.0 - 5\n p_vy = rand(100)/10.0 - 5\n #@window.particles << Particle.new(@window, @x + rand(@width) - @width/2, @y + rand(@height) - @height/2, p_vx, p_vy)\n @window.particles << Live_Particle.new(@window, bullet.x + rand(@width) - @width/2, bullet.y + rand(@height) - @height/2, p_vx, p_vy, @colors.rand_in, 1 + rand)\n end\n damage bullet.damage\n end", "def move_enemy_bullet args\n # don't update the position if the bullet isn't in action\n if args.state.enemy_bullet_shooting\n # go see if the bullet hit the player\n check_player_hit args\n # update the bullet y position\n args.state.enemy_bullet_y -= 10\n # has the bullet gone off the bottom of the screen?\n if args.state.enemy_bullet_y < 0 - args.state.enemy_bullet_h\n # don't bother updating it\n args.state.enemy_bullet_shooting = false\n end\n end\nend", "def clean\n # dispose all damage sprites\n @damages.each {|sprite| sprite.dispose if sprite.is_a?(Sprite)}\n # dispose all beam sprites\n @beams.each {|ary| ary[0].dispose}\n # create new damage sprite buffer and new projectile buffer\n @damages, @remotes, @beams = [], [], []\n # unfreeze all actor's actions\n $BlizzABS.battlers.each {|actor| actor.freeze_action = false}\n # clear observation and path request data\n $BlizzABS.AI = BlizzABS::AI.new\n end", "def remove_life \r\n @lives -= 1 # this is part of class and objects above\r\n end", "def update\n @live_shots = shots.length\n shots.each &:update\n shots.delete_if &:deleted?\n\n game.objects.each do |object|\n if object.tags.include? \"enemy_shot\"\n if Gosu::distance(object.x,object.y,@x,@y) < 10\n @health -= 1\n object.delete\n end\n end\n end\n end", "def delete_all_sprites\n self.sprites.each{|sprite|\n sprite.visible = false\n sprite.dispose\n }\n @sprites = []\n end", "def clear_shot? warrior\n\t\tlook = warrior.look :forward\n\t\tdistance_to_enemy2 = look.index { |space| space.enemy? == true } || MAX_LOOK\n\t\tdistance_to_captive2 = look.index { |space| space.captive? == true } || MAX_LOOK\n\t\t@direction = :forward if distance_to_enemy2 < distance_to_captive2\n\t\tlook = warrior.look :backward\n\t\tdistance_to_enemy = look.index { |space| space.enemy? == true } || MAX_LOOK\n\t\tdistance_to_captive = look.index { |space| space.captive? == true } || MAX_LOOK\n\t\t@direction = :backward if distance_to_enemy < distance_to_captive\n\t\t!@took_damage && ((distance_to_enemy < distance_to_captive) || (distance_to_enemy2 < distance_to_captive2)) \n\tend", "def move_player_bullet args\n # don't update the position if the bullet isn't in action\n if args.state.player_bullet_shooting\n # go see if the bullet hit the enemy\n check_enemy_hit args\n # update the bullet y position\n args.state.player_bullet_y += 10\n # has the bullet gone off the top of the screen?\n if args.state.player_bullet_y > 720\n # don't bother updating it\n args.state.player_bullet_shooting = false\n end\n end\nend", "def shoot\n bullet1 = Bullet.new(@x, @y, @angle, @map, @pColor)\n bullet2 = Bullet.new(@x, @y, @angle + Math::PI / 2, @map, @pColor)\n bullet3 = Bullet.new(@x, @y, @angle + Math::PI, @map, @pColor)\n bullet4 = Bullet.new(@x, @y, @angle + Math::PI * 3 / 2, @map, @pColor)\n\n @map.PobjectArray.push(bullet1)\n @map.PobjectArray.push(bullet2)\n @map.PobjectArray.push(bullet3)\n @map.PobjectArray.push(bullet4)\n end", "def move()\n #first it checks if it is on an edge\n if (\n @model.x >= Window.width-@size ||\n @model.x <= 0 ||\n @model.y >= Window.height-@size ||\n @model.y <= 0\n )\n #if the bullet is on the edge then it will die\n self.kill()\n end\n #this moves the bullet by the velocity of the bullet\n @pos.x += @vel.x\n @pos.y += @vel.y\n #moves the bullets model\n @model.x = @pos.x\n @model.y = @pos.y\n end", "def discardVisibleTreasure(t)\n \n end", "def repos_enemy\n @enemies.each do |i|\n i.x -= @delta_x\n i.y -= @delta_y\n end\n @ground.x -= @delta_x\n @ground.y -= @delta_y\n end", "def shoot\n return Bullet.new(@window, @x, @y, 0, -2, true)\n end", "def remove_object(gameobject)\n @monsters.delete gameobject\n @towers.delete_if { |a,b| b == gameobject }\n @bullets.delete gameobject\n end", "def removeMagazinesTurret _obj, _args\n \"_obj removeMagazinesTurret _args;\" \n end", "def player_fire_bullet()\r\n # This makes sure that bullets are fired after certain intervals\r\n if Gosu.milliseconds > (@seconds_elapsed * COUNTER)\r\n @seconds_elapsed = Gosu.milliseconds\r\n @bullet_sound.bmp.play()\r\n # Generating a bullet object\r\n @bullets.push Bullet.new((@player.x+ 33), @player.y, 'good')\r\n end \r\n end", "def drop_all_the_way\n if @game.is_running?\n ran = @current_block.drop_by_one\n ran2 = @current_block2.drop_by_one\n @current_pos1.each{|block| block.remove}\n @current_pos2.each{|block| block.remove}\n while ran\n @score += 1\n ran = @current_block.drop_by_one\n end\n while ran2\n @score += 1\n ran2 = @current_block2.drop_by_one\n end\n draw\n store_current\n if !game_over?\n next_piece\n next_piece2\n end\n @game.update_score\n draw\n end\n end", "def weapons_scroll_down\n guns[selected_gun].off\n @selected_gun += 1\n if @selected_gun >= @guns.length\n @selected_gun = 0\n end\n guns[selected_gun].on\n end", "def summon_removal\n # remove all expired pets\n @pets.clone.each {|p| @pets.delete(p) if p.terminate}\n # remove all expired monsters\n @monsters.clone.each {|m| @monsters.delete(m) if m.terminate}\n end", "def ExcludeNonEnemies()\n\n $enemies = $enemies - $non_enemies\n\n $enemy_images = $enemy_images - [[0]]\n\nend", "def discard_effect\n @game.discard_pile_cards << \"lock_down\"\n end", "def remove_marked\n @objects.remove_marked\n end", "def update_projectiles\n\t\t@projectiles.delete_if do |projectile|\n\t\t\tprojectile.move\n\t\t\tprojectile.out_of_bounds\n\t\tend\n\tend", "def remove_items_from_cart\n line_items.each { |i| i.cart = nil }\n end", "def kill_player\r\n @enemies.each do |player|\r\n if (player.life_points <= 0)\r\n @enemies.delete(player)\r\n puts \"#{player.name} vient d'être éliminé !\"\r\n end\r\n end \r\n end", "def discardHiddenTreasure(t)\n \n end", "def remove_from_list *list\n @show = @show - TinyPng::Path.get_all(list)\n end", "def remove!(jumped_pos)\n board[jumped_pos] = nil\n end", "def mark_children_for_removal\n work_graphics.each do |work_graphic|\n work_graphic.destroy\n end\n end", "def update()\r\n\t\tto_remove = []\r\n for i in 0..@units.length-1\r\n @units[i].main()\r\n\t\t\tif @units[i].vie <= 0\r\n\t\t\t\tto_remove << @units[i]\r\n\t\t\t\t@units[i].die()\r\n\t\t\tend\r\n end\r\n\t\t@units -= to_remove\r\n end", "def revome_unused_faces\n actors_ids = []\n for actor in $game_party.actors\n actors_ids << actor.id\n end\n for i in 0..@battler_face.size\n next if @battler_face[i].nil? or actors_ids.include?(i)\n @battler_face[i].dispose\n @battler_face[i] = nil\n end\n end", "def update_bubbles\n @bubbles.each do |bubble|\n if bubble.position.y >= BubbleHeight or rand<BubbleDissapearChance\n @bubbles.delete(bubble)\n @bubbles.compact!\n else\n bubble.move\n end\n end\n add_bubble if rand <= Bubble_Spawn_Chance\n end", "def remove_dead_actors\n for battler in tactics_all\n if (battler.actor? && battler.death_state? &&\n $game_party.all_members.include?(battler) &&\n !GTBS::Prevent_Actor_Leave_List.include?(battler.id))\n $game_party.remove_actor(battler.id) \n end\n end\n end", "def stopShootLaser\n @laserFiring = false\n end", "def removeWeapon _obj, _args\n \"_obj removeWeapon _args;\" \n end", "def shoot(dir)\n\t\tx_origin = @x + (@width / 2.0) - (10)\n\t\ty_origin = @y + (@height / 2.0) - (10)\n\t\t@bullets.push(Bullet.new(x_origin, y_origin, 20, 20, @player.bullet_image, @gameWindow, 3, 3, dir)) #fix this.\n\t\t@remaining_time = @shot_time\n\tend", "def dispose_actors\n for sprite in @actor_sprites\n sprite.dispose\n end\n end", "def removeMagazines _obj, _args\n \"_obj removeMagazines _args;\" \n end", "def remove_tower\n end", "def call_off\n @cards.each do |card, init_pos|\n Animation.call_off(card, init_pos)\n end\n end", "def spc_stop_bouncing_animation\n @parallel_animations[Battle::Visual::IdlePokemonAnimation]&.remove\n end", "def setup_unfocus\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n sprset = get_spriteset\n sprset.focus_bg.fadeout(@acts[1])\n batch = sprset.battler_sprites.select do |spr|\n !spr.battler.nil? # Select avalaible battler\n end\n batch.each do |spr|\n spr.fadein(@acts[1]) if spr.battler.alive? || spr.battler.actor?\n end\n end", "def collapse\n @posx = 471\n for i in 0...@party_banners.size\n @party_banners[i].move(@posx,Banner::PosY[i],255,10)\n end\n @removed.reverse_each do |j|\n $game_party.remove_actor($game_party.members[j].id)\n end\n end", "def move\r\n # Move bullet fired by the Spaceship up the screen \r\n if @type == 'good'\r\n @y -= @SPEED\r\n # Move bullet fired by the Aliens down the screen \r\n elsif @type == 'evil'\r\n @y += @SPEED\r\n end\r\n end", "def remove(rect)\n\t\t@squares.delete(rect)\n\tend", "def discardWeapon(w)\n if @nWeapons > 0\n @nWeapons -= 1\n end\n end", "def clear_drawings\n execute_script(%(\n var elements = window.document.body.querySelectorAll('[id*=\"rudra_\"]');\n for (var i = 0; i < elements.length; i++) {\n elements[i].remove();\n }\n window.rudraTooltipSymbol = 9311;\n window.rudraTooltipLastPos = { x: 0, y: 0 };\n ))\n end", "def event_removal\n # iterate through all events on the map\n $game_map.events.values.each {|event|\n # if event is Map_Enemy\n if event.is_a?(Map_Enemy)\n # if event is actually on the map\n if event.precondition\n # start removing the enemy if he's dead\n remove_enemy(event) if !event.valid? || event.battler.dead?\n # if enemy spriteset missing\n if event.character_name == '' && event.tile_id < 384\n # remove completely\n $game_map.events.delete(event.id)\n end\n end\n # if event is dropped item and either item taken or stay time expired\n elsif event.dropped? && event.terminate\n # remove completely\n $game_map.events.delete(event.id)\n end}\n end", "def shoot\n\t\t# Updates last shot distance if it can't shoot\n\t\tif @lastShot <= @SHOT_LAG then\n\t\t\t@lastShot = Gosu::distance(@x, @y, @lastPosX, @lastPosY)\n\t\telse\n\t\t\t# Preps a new bullet and resets last shot distance\n\t\t\t@lastShot = 0\n\t\t\t@lastPosX = @x\n\t\t\t@lastPosY = @y\n\t\t\t# returns a bullet with a velocity 1 greater than the ship's\n\t\t\t# velocity\n\t\t\treturn Bullet.new(@window, @x, @y, 0, @vel+1, false)\n\t\tend\n\tend", "def removeMagazineTurret _obj, _args\n \"_obj removeMagazineTurret _args;\" \n end", "def clear_tr_sprites\n @spriteset.dispose_tile_sprites\n clear_r_sprites\n end", "def drop_item1\n return enemy.drop_item1\n end", "def remove_from_gamespace\n # remove it from the room it's in.\n self.from_room \n self.recycle \n # Possibly in the future return all switches. I.e. an admin taking over an NPC body.\n end", "def unclick\n # Reset dragging slider\n @dragging_slider = false if @dragging_slider\n # Reset buttons\n @button_down_sprite.set_rect_div(0, 0, 1, 2) unless @button_down_sprite.src_rect.y == 0\n @button_up_sprite.set_rect_div(0, 0, 1, 2) unless @button_up_sprite.src_rect.y == 0\n @button_slider_sprite.set_rect_div(0, 0, 1, 2) unless @button_slider_sprite.src_rect.y == 0\n end", "def kill_player(input_user)\n @enemies_in_sight.delete(input_user)\n end", "def cancel_move\n @cursor.active = true\n @active_battler.moveto(@pre_x, @pre_y)\n clear_tr_sprites\n draw_ranges(@active_battler, 3)\n end", "def weapons_scroll_up\n guns[selected_gun].off\n @selected_gun -= 1\n if @selected_gun <= -1\n @selected_gun = @guns.length-1\n end\n guns[selected_gun].on\n end", "def dispose_enemies\n for sprite in @enemy_sprites\n sprite.dispose\n end\n end", "def remove_states_battle\n for actor in members\n actor.remove_states_battle\n end\n end", "def remove_ranges\n $spriteset.show_ranges(false)\n end", "def detonate\n if (Enemies.include?warrior.look(:forward)[0].unit.to_s.to_sym and \n Enemies.include?warrior.look(:forward)[1].unit.to_s.to_sym) or\n (Enemies.include?warrior.look(:left)[0].unit.to_s.to_sym and \n Enemies.include?warrior.look(:right)[0].unit.to_s.to_sym and \n !Captives.include?warrior.look(:forward)[2].unit.to_s.to_sym) or \n (Enemies.include?warrior.look(:forward)[0].unit.to_s.to_sym and \n Enemies.include?warrior.look(:backward)[0].unit.to_s.to_sym) and\n warrior.health > 4 and @bombs_used < 4 and !captives_close\n @bombs_used += 1\n return warrior.detonate!:forward\n end\n end", "def remove_sprite(tile)\n @source_sprites.delete(tile)\n end", "def prune_free_list\n i = 0\n while i < @free_rectangles.size\n j = i + 1\n while j < @free_rectangles.size\n if is_contained_in?(@free_rectangles[i], @free_rectangles[j])\n @free_rectangles.delete_at(i)\n i -= 1\n break\n end\n if is_contained_in?(@free_rectangles[j], @free_rectangles[i])\n @free_rectangles.delete_at(j)\n else\n j += 1\n end\n end\n i += 1\n end\n end", "def alien_hit(alien, bullet)\r\n # Deleting the alien and the bullet object\r\n @aliens.delete alien\r\n @bullets.delete bullet\r\n @explode = true\r\n @player.update_score()\r\n # Setting the coordinates for the explosion\r\n @explode_x = alien.x\r\n @explode_y = alien.y\r\n @explosion_sound.bmp.play \r\n end", "def remove_from_hot_list\n self.update_attribute(:added_to_hot_list, nil)\n end", "def clean_up_battle\n for window in @windows.values\n next if window == nil #skill all already disposed items.\n window.visible = false#hide all windows\n window.active = false #disable all windows\n end\n \n for battler in tactics_all\n battler.clear_tbs_actions #clear actions\n battler.tbs_battler = false #clear in battle flag\n add_remove_invited(battler) #check and add 'invited' actors to the team\n remove_dead_actors if GTBS::Dead_Actors_Leave\n end\n end", "def alien_fire_bullet()\r\n # The aliens will fire bullets at random, \r\n # The randomness is controlled by @alien_fire_rand\r\n @aliens.each { |alien|\r\n if rand(@alien_fire_rand) == 0\r\n @bullets.push Bullet.new(alien.x, alien.y+ 40, 'evil')\r\n end\r\n }\r\n end" ]
[ "0.7979599", "0.7443645", "0.7413888", "0.7027271", "0.6901875", "0.67119205", "0.66250396", "0.6540389", "0.64774126", "0.63767713", "0.6344758", "0.6327287", "0.6307901", "0.6238692", "0.62229186", "0.6170551", "0.6143313", "0.6118596", "0.6087417", "0.60821563", "0.60795194", "0.60528964", "0.6050389", "0.5998107", "0.59960186", "0.5992057", "0.59643877", "0.5950194", "0.5905082", "0.58861536", "0.58660287", "0.58655053", "0.586275", "0.5848925", "0.5833997", "0.5817754", "0.5817681", "0.5810523", "0.5798885", "0.57904273", "0.5787443", "0.57834464", "0.57712436", "0.57472205", "0.57219845", "0.57211703", "0.57166666", "0.56931555", "0.568975", "0.56617296", "0.56614774", "0.56612116", "0.56462973", "0.5644475", "0.56429154", "0.56325173", "0.5559877", "0.5547624", "0.554593", "0.55430835", "0.5516591", "0.55120087", "0.5500102", "0.5480456", "0.547807", "0.547423", "0.5471371", "0.5469829", "0.5466939", "0.5447801", "0.5439006", "0.54367083", "0.5429078", "0.5420926", "0.54194576", "0.54068494", "0.53940755", "0.5383164", "0.5378645", "0.5372305", "0.5363557", "0.53605175", "0.5352272", "0.53509635", "0.5347048", "0.53456306", "0.5339957", "0.53375727", "0.5331111", "0.5311536", "0.53034353", "0.5287157", "0.52849597", "0.5284311", "0.52841103", "0.52737826", "0.52734965", "0.52729446", "0.5268352", "0.5268142" ]
0.8526866
0
Procedure for the aliens to fire bullets
def alien_fire_bullet() # The aliens will fire bullets at random, # The randomness is controlled by @alien_fire_rand @aliens.each { |alien| if rand(@alien_fire_rand) == 0 @bullets.push Bullet.new(alien.x, alien.y+ 40, 'evil') end } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fire \n\n # Could end up spawning a number of bullets, depending on the weapon\n bullets = []\n\n # For now, we'll just spawn a small green laser bolt!\n bullets << Laser.new( :laser_small_green, @x - 64, @y + 64, false )\n\n # And just hand back that collection of bullets\n bullets\n\n end", "def alien_hit(alien, bullet)\r\n # Deleting the alien and the bullet object\r\n @aliens.delete alien\r\n @bullets.delete bullet\r\n @explode = true\r\n @player.update_score()\r\n # Setting the coordinates for the explosion\r\n @explode_x = alien.x\r\n @explode_y = alien.y\r\n @explosion_sound.bmp.play \r\n end", "def player_fire_bullet()\r\n # This makes sure that bullets are fired after certain intervals\r\n if Gosu.milliseconds > (@seconds_elapsed * COUNTER)\r\n @seconds_elapsed = Gosu.milliseconds\r\n @bullet_sound.bmp.play()\r\n # Generating a bullet object\r\n @bullets.push Bullet.new((@player.x+ 33), @player.y, 'good')\r\n end \r\n end", "def fire_bullet args\n return unless args.inputs.mouse.click # return unless mouse is clicked\n args.state.bullets << args.state.new_entity(:bullet) do |bullet| # new bullet is declared a new entity\n bullet.y = args.inputs.mouse.click.point.y # set to the y value of where the mouse was clicked\n bullet.x = 0 # starts on the left side of the screen\n bullet.size = 10\n bullet.speed = 10 * rand + 2 # speed of a bullet is randomized\n bullet.rect = [bullet.x, bullet.y, bullet.size, bullet.size] # definition is set\n end\nend", "def shoot\n bullet1 = Bullet.new(@x, @y, @angle, @map, @pColor)\n bullet2 = Bullet.new(@x, @y, @angle + Math::PI / 2, @map, @pColor)\n bullet3 = Bullet.new(@x, @y, @angle + Math::PI, @map, @pColor)\n bullet4 = Bullet.new(@x, @y, @angle + Math::PI * 3 / 2, @map, @pColor)\n\n @map.PobjectArray.push(bullet1)\n @map.PobjectArray.push(bullet2)\n @map.PobjectArray.push(bullet3)\n @map.PobjectArray.push(bullet4)\n end", "def update()\n #checks if it has hit an asteroid\n self.hit()\n #moves the bullet\n self.move()\n end", "def shoot_1\n if Time.now - @last_shoot_1 > 0.5\n @window.e_bullets << Ennemy_Bullet.new(@window, @player, @x, @y, -2, 4)\n @window.e_bullets << Ennemy_Bullet.new(@window, @player, @x, @y, 0, 4)\n @window.e_bullets << Ennemy_Bullet.new(@window, @player, @x, @y, 2, 4)\n @last_shoot_1 = Time.now\n end\n end", "def player_hit(bullet)\r\n @bullets.delete bullet\r\n @ship_hit_sound.bmp.play\r\n # If the player has lost all the lifeline end the game\r\n if @player.life == 0\r\n # Ending the game\r\n GameOverWindow.new.show\r\n close\r\n end \r\n # Player lost one lifeline\r\n @player.lose_life()\r\n # Plaing a blank heart to represent it\r\n @heart_list[@player.life] = @blank_heart\r\n @heart = @blank_heart \r\n end", "def shoot_2\n if Time.now - @last_shoot_1 > 0.05\n @window.e_bullets << Ennemy_Bullet.new(@window, @player, @x - 28, @y, 0, 7)\n @window.e_bullets << Ennemy_Bullet.new(@window, @player, @x + 28, @y, 0, 7)\n @last_shoot_1 = Time.now\n end\n end", "def shoot\n \tuser_shoot\n\tend", "def enemy_bullet_collision\n if cr.defeated == false\n $e_bullets.each do |b|\n if self.bounding_box_collision?(b)\n @life -= 1\n $hud.set_lives(life)\n clear_all_bullets\n end\n end\n end\n end", "def forceWeaponFire _obj, _args\n \"_obj forceWeaponFire _args;\" \n end", "def touched_by bullet\n ([@width, @height].max/3).times do\n p_vx = rand(100)/10.0 - 5\n p_vy = rand(100)/10.0 - 5\n #@window.particles << Particle.new(@window, @x + rand(@width) - @width/2, @y + rand(@height) - @height/2, p_vx, p_vy)\n @window.particles << Live_Particle.new(@window, bullet.x + rand(@width) - @width/2, bullet.y + rand(@height) - @height/2, p_vx, p_vy, @colors.rand_in, 1 + rand)\n end\n damage bullet.damage\n end", "def shootLaser\n if laser.canFire && !laserFiring\n @laserFiring = true\n startLaserCountdown\n end\n end", "def game_fire_action\n if tool_canuse?(FweaponId) and not @showing_fire\n if actor.mp >= FlameMpCost\n @gamefire.direction = @direction\n @gamefire.moveto(@x, @y)\n @gamefire.char_steps = 2\n @gamefire.action_time = FlameDuration\n @showing_fire = true\n RPG::SE.new(FlameSoundSe,80).play\n #actor.mp -= FlameMpCost\n @tool_anime = FlameDuration\n else\n Sound.play_buzzer\n end\n end\n end", "def bullet(name, options={}, &block)\n cur_page.bullet(name, options, &block)\n end", "def shoot(window,shot,player)\n\t\tshot << Bullet.new(window, self, player)\n\t\t@reload_end = Gosu::milliseconds\n\tend", "def melee_weapon; end", "def tick!\n rotate_turret\n shoot\n end", "def shoot arrow\r\n arrow.x+=arrow.vel_x\r\n arrow.y+=arrow.vel_y\r\n end", "def on_player_walk\n for actor in members\n if actor.slip_damage?\n actor.hp -= 1 if actor.hp > 1 # Poison damage\n $game_map.screen.start_flash(Color.new(255,0,0,64), 4)\n end\n if actor.auto_hp_recover and actor.hp > 0\n actor.hp += 1 # HP auto recovery\n end\n end\n end", "def add_bullet(bullet)\n @bullets << bullet\n end", "def enemy_shoot args\n # generate a random number from 0 to 99\n r = rand(100)\n # is the random number 0? that give a a 1 in 100 chance of shooting\n # is the enemy shooting? Only shoot if not already shooting.\n if r == 1 && args.state.enemy_bullet_shooting == false\n # set the enemy bullet position to the enemy position\n args.state.enemy_bullet_x = args.state.enemy_x + args.state.enemy_w / 2\n args.state.enemy_bullet_y = args.state.enemy_y\n # track state of enemy bullet\n args.state.enemy_bullet_shooting = true\n end\nend", "def shoot\n\t\t# Updates last shot distance if it can't shoot\n\t\tif @lastShot <= @SHOT_LAG then\n\t\t\t@lastShot = Gosu::distance(@x, @y, @lastPosX, @lastPosY)\n\t\telse\n\t\t\t# Preps a new bullet and resets last shot distance\n\t\t\t@lastShot = 0\n\t\t\t@lastPosX = @x\n\t\t\t@lastPosY = @y\n\t\t\t# returns a bullet with a velocity 1 greater than the ship's\n\t\t\t# velocity\n\t\t\treturn Bullet.new(@window, @x, @y, 0, @vel+1, false)\n\t\tend\n\tend", "def shoot\n @shooting = true\n end", "def a2(in_entity, in_float)\n\t\t\t\tarrow = NMS::EntityArrow.new self.world, self, in_entity, 1.6, 14 - self.world.difficulty.int_value * 4\n\t\t\t\ti = NMS::EnchantmentManager.get_enchantment_level NMS::Enchantment.ARROW_DAMAGE.id, self.be\n\t\t\t\tj = NMS::EnchantmentManager.get_enchantment_level NMS::Enchantment.ARROW_KNOCKBACK.id, self.be\n\n\t\t\t\tarrow.b((in_float * 2) + self.random.next_gaussian * 0.25 + (self.world.diffculty.int_value * 0.11))\n\t\t\t\tarrow.b(arrow.e + i * 0.5 + 0.5) if i > 0\n\t\t\t\tarrow.a(j) if j > 0\n\t\t\t\tarrow.on_fire = 100 if NMS::EnchantmentManager.get_enchantment_level(NMS::Enchantment.ARROW_FIRE.id, self.be) > 0 or self.skeleton_type == 1\n\t\t\t\tself.make_sound self.remote_entity.get_sound(RemoteEntities::EntitySound::ATTACK), 1.0, 1.0 / self.random.next_float * 0.4 + 0.8\n\t\t\t\tself.world.add_entity arrow\n\t\t\tend", "def shoot\n return Bullet.new(@window, @x, @y, 0, -2, true)\n end", "def attacks (player)\n damage = compute_damage\n\n puts \">>> Le joueur #{self.name} attaque le joueur #{player.name}\"\n\n puts \">>> Il lui inflige #{damage} points de dommages\"\n\n # Give damages to the \"player\" in argument\n player.gets_damage(damage)\n end", "def hit_by_bullet\n $p_bullets.delete_if do |b|\n if self.bounding_box_collision?(b)\n @meter.change_width(b.dmg)\n b.destroy\n during(100) { @color.alpha = 100 }.then { @color.alpha = 255 }\n @life -= 1.0\n true\n end\n end\n end", "def shoot(dir)\n\t\tx_origin = @x + (@width / 2.0) - (10)\n\t\ty_origin = @y + (@height / 2.0) - (10)\n\t\t@bullets.push(Bullet.new(x_origin, y_origin, 20, 20, @player.bullet_image, @gameWindow, 3, 3, dir)) #fix this.\n\t\t@remaining_time = @shot_time\n\tend", "def enemy; end", "def handgunWeapon _args\n \"handgunWeapon _args;\" \n end", "def drop_item1\n return enemy.drop_item1\n end", "def move_bullets args\n args.state.bullets.each do |bullet| # perform action on each bullet in collection\n bullet.x += bullet.speed # increment x by speed (bullets fly horizontally across screen)\n\n # By randomizing the value that increments bullet.y, the bullet does not fly straight up and out\n # of the scope of the screen. Try removing what follows bullet.speed, or changing 0.25 to 1.25 to\n # see what happens to the bullet's movement.\n bullet.y += bullet.speed.*(0.25).randomize(:ratio, :sign)\n bullet.rect = [bullet.x, bullet.y, bullet.size, bullet.size] # sets definition of bullet's rect\n end\nend", "def attack(direction)\n @weapon.attack(direction)\n end", "def check_collision()\r\n # Looping through all the aliens in the game\r\n @aliens.each { |alien|\r\n # Looping through all the bulletss in the game\r\n @bullets.each { |bullet|\r\n # Distance between the bullet and the alien\r\n distance = Gosu.distance(alien.x, alien.y, bullet.x, bullet.y)\r\n # Distance between the bullet and the player\r\n hit_distance = Gosu.distance(@player.x, @player.y, bullet.x, bullet.y)\r\n # Bullets fired by the Player fit the Alien\r\n if distance < alien.radius + bullet.radius and bullet.type == 'good'\r\n alien_hit(alien, bullet)\r\n # Bullets fired by the Alien hit the Player\r\n elsif hit_distance < @player.radius + bullet.radius and bullet.type == 'evil'\r\n player_hit(bullet)\r\n end\r\n }\r\n }\r\n end", "def weapon; end", "def weapon; end", "def weapon; end", "def hook_action\n if tool_canuse?(HweaponId) and not @showing_hook\n unless character_at_playerpos?\n @hookshot.each do |hook| \n hook.direction = @direction\n hook.moveto(@x, @y)\n hook.char_steps = hook.index\n end\n @showing_hook = true\n RPG::SE.new(HookActionSe, 80).play\n @tool_anime = 30\n else\n Sound.play_buzzer\n end\n end\n end", "def fire(hook, *args); end", "def attacks(player)\n puts \"#{@name} attaque #{player.name}\"\n damage = compute_damage\n puts \" il lui inflige #{damage} points dommages\"\n player.gets_damage(damage)\n end", "def generate_aliens(position, height)\r\n # Looping until the number of Aliens in a fleet is reached\r\n for i in 0...@alien_count\r\n @aliens.push(Alien.new(i, position, height))\r\n @alien_sound.bmp.play\r\n end\r\n end", "def ranged_weapon; end", "def attacks(player)\n \tputs \"Le joueur #{@name} attaque le joueur #{player.name}\"\n \tdamage = compute_damage\n \tputs \"Il lui inflige #{damage} points de dommage\"\n \tplayer.gets_damage(damage)\n end", "def fire_torpedo\n\t\tx = (@x + @@tiles[0].width/2) - Torpedo::IMG_WIDTH / 2\n\t\ty = (@y + @@tiles[0].height/2)\n\n\t\ttorpedo = Torpedo.new(x, y, @angle)\n\t\ttorpedo.player = @player\n\t\t@game_state.add_entity(torpedo)\n\t\t@torpedo_launched = Time.new\n\n\t\t@@fire_torpedo_sound.play\n\tend", "def attacks(player)\r\n puts \"#{@name} attaque le joueur #{player.name}\"\r\n player.gets_damage(compute_damage)\r\n end", "def draw\n @running = @body.v.x.abs >= 1\n\n unless @running or @attacking #set idle sprite unless they're running or attacking\n if @direction == :left\n @sprite = @sprite_left\n else\n @sprite = @sprite_right\n end\n end\n \n if @dmg_cooldown > 0 && @direction == :right \n @sprite = @sprite_damage\n elsif @dmg_cooldown > 0 && @direction == :left\n @sprite = @sprite_damage_left\n end\n if @dead\n @sprite = Gosu::Image.new(\"assets/images/player/death.png\")\n end\n super\n end", "def shoot\n\t\tt = (Rubygame::Time.get_ticks() - @parent.stamp[:p])/1000.0\n\t\tv = Vector.new(1,0).rotate(@parent.angle)\n\t\tv.magnitude += 150\n\t\tp = @parent.project(t)\n\t\t@parent.groups[0].push(@type.new(p,v,@lifespan))\n\tend", "def start\n ty_ammo_requirements_start\n ty_set_enemy_ammo\n end", "def add_bullets\n @window.bullets << Vibrant_Bullet.new(@window, @player, @player.x, @player.y - @player.height/2.0)\n end", "def perform_damage_effect\n end", "def perform_damage_effect\n end", "def attacks(player)\n\t\tputs \"#{@name} attaque #{player.name} !\"\n\t\tdamage = compute_damage\n player.gets_damage(damage)\n \n\t\tif player.life_points > 0\n\t\tputs \"#{@name} lui inflige #{damage} points de dommage.\\n\\n\"\n\t\telse \n\t\t\tputs \"Oups, #{player.name} c'est fait décapité...\\n\\n\"\n end\n\n end", "def drop_item2\n return enemy.drop_item2\n end", "def attacks(player)\n \tputs \"Le joueur #{@name} attaque le joueur #{player.name}.\"\n # On récupère le nombre de points de dommage correspondant au lancer de dé via la méthode compute_damage\n damage_points = compute_damage\n puts \"Il lui inflige #{damage_points} points de dommage.\"\n # Ces points de dommage sont infligés à player. Si player n'a plus de points de vie, le programme affiche qu'il est mort.\n player.get_damage(damage_points)\n end", "def update args\n\n # Keep the backdrop scrolling, always...\n @backdropl_spr.source_x += 2\n if @backdropl_spr.source_x > BACKDROP_WIDTH \n @backdropl_spr.source_x = 0\n end\n @backdropr_spr.source_x = @backdropl_spr.source_x\n\n\n # Check to see if the player needs creating\n if @player.nil? && @lives.positive?\n @player = Player.new args\n end\n\n\n # Also, spawn any enemies that are due\n while ( @enemy_idx < @@enemies.length ) && ( args.state.tick_count >= ( @epoch + @@enemies[@enemy_idx][:spawn] ) ) do\n @enemy << Enemy.new( @@enemies[@enemy_idx] )\n @enemy_idx += 1\n end\n\n\n # User input; see if we're moving first off\n horizontal = 0\n vertical = 0\n if args.inputs.keyboard.key_held.up || args.inputs.keyboard.key_held.w || args.inputs.controller_one.key_held.up\n vertical = 1\n end\n if args.inputs.keyboard.key_held.down || args.inputs.keyboard.key_held.s || args.inputs.controller_one.key_held.down\n vertical = -1\n end\n if args.inputs.keyboard.key_held.right || args.inputs.keyboard.key_held.d || args.inputs.controller_one.key_held.right\n horizontal = 1\n end\n if args.inputs.keyboard.key_held.left || args.inputs.keyboard.key_held.a || args.inputs.controller_one.key_held.left\n horizontal = -1\n end\n @player.move horizontal, vertical\n\n\n # If the player is firing, fire the current weapon they have\n if @player_bullets.empty? && ( args.inputs.keyboard.key_held.space || args.inputs.controller_one.key_held.a )\n @player_bullets.concat( @player.fire )\n end\n\n\n # Update the position of any player bullets\n @player_bullets.each { |bullet| bullet.update args }\n\n\n # Allow each enemy to move\n @enemy.each { |ship| ship.move }\n\n\n # Decide if any enemies get to shoot\n\n\n # And update all of their bullets, too\n @enemy_bullets.each { |bullet| bullet.update args }\n\n\n # And purge any bullets now out of scope\n @player_bullets.delete_if { |bullet| bullet.outofbounds? args.grid }\n @enemy_bullets.delete_if { |bullet| bullet.outofbounds? args.grid }\n\n \n # Check to see if any player bullets collided with any enemies\n @player_bullets.each do | bullet |\n\n # Check against each enemy\n @enemy.each do | ship |\n if bullet.collides? ship\n args.outputs.debug << [ 100, 100, \"HIT!\", 5, 1, 255, 0, 0 ].label\n end\n end\n \n end\n\n\n # Everything is fine, stick with this world!\n true\n\n end", "def attacks(player)\n dice = compute_damage\n puts \"#{@name} attaque #{player.name} : Il lui inflige #{dice} points de dommages\"\n player.life_points = player.life_points - dice\n end", "def fire(object, *args); end", "def move\r\n # Move bullet fired by the Spaceship up the screen \r\n if @type == 'good'\r\n @y -= @SPEED\r\n # Move bullet fired by the Aliens down the screen \r\n elsif @type == 'evil'\r\n @y += @SPEED\r\n end\r\n end", "def game_blade_action\n if tool_canuse?(BladeWeaponId) and not @showing_blade\n @gameblade.direction = @direction\n @gameblade.moveto(@x, @y)\n @showing_blade = true\n @gameblade.action_time = 30\n @tool_anime = @gameblade.action_time\n RPG::SE.new(BladeSoundSe,75, 130).play\n end\n end", "def attacks(enemy)\n puts \"#{@name} attaque #{enemy.name}\"\n damage = compute_damage\n puts \"il lui inflige #{damage} points de dommages\"\n enemy.gets_damage(damage)\n end", "def attacks(victime_name)\n @degat = compute_damage\n puts \"le joueur #{name} fait #{coup} sur le joueur #{victime_name.name}!\"\n victime_name.gets_damage(@degat)\n end", "def dog_eat(items)\n \t items.each do |item|\n \t\t puts \"My puppy likes #{item}\"\n \t end\n end", "def move_enemy_bullet args\n # don't update the position if the bullet isn't in action\n if args.state.enemy_bullet_shooting\n # go see if the bullet hit the player\n check_player_hit args\n # update the bullet y position\n args.state.enemy_bullet_y -= 10\n # has the bullet gone off the bottom of the screen?\n if args.state.enemy_bullet_y < 0 - args.state.enemy_bullet_h\n # don't bother updating it\n args.state.enemy_bullet_shooting = false\n end\n end\nend", "def add_alien_fleet()\r\n # Only generate new fleet of aliens if the current count of fleets is less than @fleet_limit\r\n if rand(@random) == 0 and @fleet < @fleet_limit\r\n @fleet +=1\r\n position = rand(SCREEN_WIDTH/2)\r\n @height -= GAME_PRESET[\"space_fleet\"]\r\n # Calling the procedure to generate aliens\r\n generate_aliens(position, @height)\r\n end\r\n # If the aliens reach the top level of the screen bring then down\r\n if @height < 0.3\r\n @height = GAME_PRESET[\"initial_height\"]\r\n end \r\n end", "def handle_victory(entity)\n type(\"You defeated the #{entity.name}!\\n\")\n super(entity)\n print \"\\n\"\n end", "def fire(time); end", "def fire(time); end", "def updatePosition\n super\n\n Bullet.BulletInstances.each { |bullet|\n if collision?(bullet)\n bullet.destroy\n explode\n end\n }\n\n Ship.ShipInstances.each { |ship|\n if collision?(ship)\n ship.destroy\n explode\n end\n }\n end", "def %( enemy )\n lettuce = rand( charisma )\n puts \"[Healthy lettuce gives you #{ lettuce } life points!!]\"\n @life += lettuce\n fight( enemy, 0 )\n end", "def %( enemy )\n lettuce = rand( charisma )\n puts \"[Healthy lettuce gives you #{ lettuce } life points!!]\"\n @life += lettuce\n fight( enemy, 0 )\n end", "def spell; end", "def weaponsTurret _obj, _args\n \"_obj weaponsTurret _args;\" \n end", "def render args\n # draw the player's bullet\n render_player_bullet args\n # draw the player\n render_player args\n # draw the enemy bullet\n render_enemy_bullet args\n # draw the enemy\n render_enemy args\n # draw game over\n render_game_over args\nend", "def attacks(victim)\n #AFFICHE LE JOUEUR ATTAQUANT SA VICTIME\n puts \"le joueur #{self.names} attaque le joueur #{victim.names}\"\n\n #DAMAGE_COMPUTED PREND LA VALEUR DU NOMBRE OBTENU ALEATOIREMENT\n damage_computed = compute_damage\n\n #AFFICHE LE NOMBRE DE DOMMAGES INFLIGES\n puts \"il lui inflige #{damage_computed} points de dommages\"\n\n #VICTIM RECOIS LES DOMMAGES\n victim.gets_damage(damage_computed)\n end", "def enemies_attack\r\n puts \"Les ennemies vous attaquent\"\r\n @enemies.each{|player| player.attacks(@human_player)}\r\n end", "def heal()\r\n @warrior.rest!\r\n end", "def heal()\r\n @warrior.rest!\r\n end", "def heal()\r\n @warrior.rest!\r\n end", "def heal()\r\n @warrior.rest!\r\n end", "def bullet\n @bullet ||= load_data.first.bullet\n end", "def fire_employee\n employees.each { |employee| employee.active = \"false\" }\n employees.each(&:pink_slip)\n end", "def attack()\r\n @warrior.attack!\r\n end", "def attack()\r\n @warrior.attack!\r\n end", "def hit!(enemy)\n unless invincible?\n $window.audio_manager.play! :hurt\n hp!(0 - enemy.damage)\n invincible!(InvincibleTime)\n enemy.damage!(enemy.damage)\n end\n \n enemy.jump_back!\n end", "def call_idle(sprite, anime)\n $game_player.set_step_anime(anime)\n $game_player.set_graphic(sprite)\n end", "def spawn_enemy_balls\n # TODO\n end", "def fire\n if Gosu::milliseconds - @prev_shot > 60\n self.shots.push(Shot.new(self.game,\"player_shot\",@gfx_shot,@x+8,@y,90,10)) unless @live_shots >= @shots_budget\n @prev_shot = Gosu::milliseconds\n end\n end", "def setup_damage\n return if item_in_use.nil?\n item = copy(item_in_use) \n # Copy item. In case if you want to modify anything\n \n # ----- Evaluate skill ------- #\n if @acts[1].is_a?(String) # Change formula? No prob ~\n item.damage.formula = @acts[1]\n elsif @acts[1].is_a?(Integer) # Skill link? No prob ~\n item = $data_skills[@acts[1]]\n elsif @acts[1].is_a?(Float) # Rescale damage? No prob ~\n item.damage.formula = \"(#{item.damage.formula}) * #{@acts[1]}\"\n end\n \n # ------- Check target scope ------- #\n if area_flag && target_array\n # Damage to all targets ~\n target_array.uniq.each do |target|\n get_scene.tsbs_invoke_item(target, item, self)\n # Check animation guard\n if !item.ignore_anim_guard? && item.parallel_anim?\n target.anim_guard = target.anim_guard_id\n target.anim_guard_mirror = target.flip\n end\n end\n elsif target\n # Damage to single target\n get_scene.tsbs_invoke_item(target, item, self)\n # Check animation guard\n if !item.ignore_anim_guard? && item.parallel_anim?\n target.anim_guard = target.anim_guard_id\n target.anim_guard_mirror = target.flip\n end\n end\n end", "def breathe_fire\n puts @fiery_sfx\n end", "def %(enemy)\n lettuce = rand(charisma)\n puts \"[healthy lettuce gives you #{lettuce} life points]\"\n @life +=lettuce\n fight(enemy, 0)\n end", "def adventuring() skill(:adventuring) end", "def move_player_bullet args\n # don't update the position if the bullet isn't in action\n if args.state.player_bullet_shooting\n # go see if the bullet hit the enemy\n check_enemy_hit args\n # update the bullet y position\n args.state.player_bullet_y += 10\n # has the bullet gone off the top of the screen?\n if args.state.player_bullet_y > 720\n # don't bother updating it\n args.state.player_bullet_shooting = false\n end\n end\nend", "def calc args\n #get out of this method if the game is over\n return if args.state.game_state != \"playing\"\n # move the player's bullet\n move_player_bullet args\n # move the enemy\n move_enemy args\n # randomly fire enemy bullet\n enemy_shoot args\n # move the enemy's bullet\n move_enemy_bullet args\nend", "def call_idle(sprite, anime)\n $game_player.set_step_anime(anime)\n $game_player.set_graphic(sprite, $game_player.character_index)\n end", "def %(enemy)\n lettuce = rand(charisma)\n puts \"[Healthy lettuce gives you #{lettuce} life points!!]\"\n @life += lettuce\n fight(enemy, 0)\n end", "def summoner_spell; end", "def villains_fought\n self.battles.map do |villain|\n villain.alter_ego\n end\n end", "def enemies_attack\n @enemies.each do |enemy|\n if enemy.life_points > 0\n enemy.attacks(@human_player)\n break if @human_player.life_points <= 0\n end\n end\n \n # Show end message\n def _end\n message = \"La partie est finie\"\n if @human_player.life_points > 0 && @enemies.length == 0\n puts message\n puts \"BRAVOOOO! TU AS GAGNE!\"\n elsif @human_player.life_points <= 0\n puts message\n puts \"YOUUU LOOOOSE! Tu as perdu!\"\n end\n end\n \n end" ]
[ "0.78516734", "0.736843", "0.7359826", "0.72630507", "0.6600291", "0.64875835", "0.6484551", "0.6447797", "0.6353175", "0.62963086", "0.6233595", "0.6233384", "0.6197353", "0.6188431", "0.6146357", "0.6132934", "0.6097139", "0.60820276", "0.60766965", "0.60751086", "0.6005284", "0.60028636", "0.5956911", "0.59553224", "0.5953044", "0.59438854", "0.5941808", "0.5875323", "0.58721715", "0.5871718", "0.5846726", "0.5836989", "0.58309627", "0.581346", "0.581117", "0.5804086", "0.57845527", "0.57845527", "0.57845527", "0.57587516", "0.57393664", "0.5734244", "0.57265145", "0.57221425", "0.56899613", "0.5682475", "0.56713766", "0.5659733", "0.56575465", "0.5650378", "0.56484455", "0.56460726", "0.56460726", "0.56417865", "0.5639873", "0.56386036", "0.5635804", "0.5629959", "0.5614253", "0.56076974", "0.5605706", "0.56053007", "0.5567876", "0.5564686", "0.55611175", "0.55518615", "0.55467194", "0.554413", "0.554413", "0.5540849", "0.55404764", "0.55404764", "0.5534038", "0.55335665", "0.55322576", "0.5531206", "0.5527374", "0.5523957", "0.5523957", "0.5523957", "0.5523957", "0.5523931", "0.5511635", "0.5484304", "0.5484304", "0.5480056", "0.54725575", "0.5465606", "0.54587865", "0.54515433", "0.54463786", "0.54445326", "0.54374456", "0.54371315", "0.54284036", "0.5423774", "0.54111767", "0.541032", "0.5406988", "0.5406751" ]
0.81691897
0
Procedure allows the player to fire bullets
def player_fire_bullet() # This makes sure that bullets are fired after certain intervals if Gosu.milliseconds > (@seconds_elapsed * COUNTER) @seconds_elapsed = Gosu.milliseconds @bullet_sound.bmp.play() # Generating a bullet object @bullets.push Bullet.new((@player.x+ 33), @player.y, 'good') end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fire \n\n # Could end up spawning a number of bullets, depending on the weapon\n bullets = []\n\n # For now, we'll just spawn a small green laser bolt!\n bullets << Laser.new( :laser_small_green, @x - 64, @y + 64, false )\n\n # And just hand back that collection of bullets\n bullets\n\n end", "def fire_bullet args\n return unless args.inputs.mouse.click # return unless mouse is clicked\n args.state.bullets << args.state.new_entity(:bullet) do |bullet| # new bullet is declared a new entity\n bullet.y = args.inputs.mouse.click.point.y # set to the y value of where the mouse was clicked\n bullet.x = 0 # starts on the left side of the screen\n bullet.size = 10\n bullet.speed = 10 * rand + 2 # speed of a bullet is randomized\n bullet.rect = [bullet.x, bullet.y, bullet.size, bullet.size] # definition is set\n end\nend", "def alien_fire_bullet()\r\n # The aliens will fire bullets at random, \r\n # The randomness is controlled by @alien_fire_rand\r\n @aliens.each { |alien|\r\n if rand(@alien_fire_rand) == 0\r\n @bullets.push Bullet.new(alien.x, alien.y+ 40, 'evil')\r\n end\r\n }\r\n end", "def player_hit(bullet)\r\n @bullets.delete bullet\r\n @ship_hit_sound.bmp.play\r\n # If the player has lost all the lifeline end the game\r\n if @player.life == 0\r\n # Ending the game\r\n GameOverWindow.new.show\r\n close\r\n end \r\n # Player lost one lifeline\r\n @player.lose_life()\r\n # Plaing a blank heart to represent it\r\n @heart_list[@player.life] = @blank_heart\r\n @heart = @blank_heart \r\n end", "def shoot_1\n if Time.now - @last_shoot_1 > 0.5\n @window.e_bullets << Ennemy_Bullet.new(@window, @player, @x, @y, -2, 4)\n @window.e_bullets << Ennemy_Bullet.new(@window, @player, @x, @y, 0, 4)\n @window.e_bullets << Ennemy_Bullet.new(@window, @player, @x, @y, 2, 4)\n @last_shoot_1 = Time.now\n end\n end", "def shoot(window,shot,player)\n\t\tshot << Bullet.new(window, self, player)\n\t\t@reload_end = Gosu::milliseconds\n\tend", "def alien_hit(alien, bullet)\r\n # Deleting the alien and the bullet object\r\n @aliens.delete alien\r\n @bullets.delete bullet\r\n @explode = true\r\n @player.update_score()\r\n # Setting the coordinates for the explosion\r\n @explode_x = alien.x\r\n @explode_y = alien.y\r\n @explosion_sound.bmp.play \r\n end", "def game_fire_action\n if tool_canuse?(FweaponId) and not @showing_fire\n if actor.mp >= FlameMpCost\n @gamefire.direction = @direction\n @gamefire.moveto(@x, @y)\n @gamefire.char_steps = 2\n @gamefire.action_time = FlameDuration\n @showing_fire = true\n RPG::SE.new(FlameSoundSe,80).play\n #actor.mp -= FlameMpCost\n @tool_anime = FlameDuration\n else\n Sound.play_buzzer\n end\n end\n end", "def shoot\n bullet1 = Bullet.new(@x, @y, @angle, @map, @pColor)\n bullet2 = Bullet.new(@x, @y, @angle + Math::PI / 2, @map, @pColor)\n bullet3 = Bullet.new(@x, @y, @angle + Math::PI, @map, @pColor)\n bullet4 = Bullet.new(@x, @y, @angle + Math::PI * 3 / 2, @map, @pColor)\n\n @map.PobjectArray.push(bullet1)\n @map.PobjectArray.push(bullet2)\n @map.PobjectArray.push(bullet3)\n @map.PobjectArray.push(bullet4)\n end", "def shoot_2\n if Time.now - @last_shoot_1 > 0.05\n @window.e_bullets << Ennemy_Bullet.new(@window, @player, @x - 28, @y, 0, 7)\n @window.e_bullets << Ennemy_Bullet.new(@window, @player, @x + 28, @y, 0, 7)\n @last_shoot_1 = Time.now\n end\n end", "def update()\n #checks if it has hit an asteroid\n self.hit()\n #moves the bullet\n self.move()\n end", "def shoot\n \tuser_shoot\n\tend", "def tick!\n rotate_turret\n shoot\n end", "def forceWeaponFire _obj, _args\n \"_obj forceWeaponFire _args;\" \n end", "def shootLaser\n if laser.canFire && !laserFiring\n @laserFiring = true\n startLaserCountdown\n end\n end", "def shoot\n\t\t# Updates last shot distance if it can't shoot\n\t\tif @lastShot <= @SHOT_LAG then\n\t\t\t@lastShot = Gosu::distance(@x, @y, @lastPosX, @lastPosY)\n\t\telse\n\t\t\t# Preps a new bullet and resets last shot distance\n\t\t\t@lastShot = 0\n\t\t\t@lastPosX = @x\n\t\t\t@lastPosY = @y\n\t\t\t# returns a bullet with a velocity 1 greater than the ship's\n\t\t\t# velocity\n\t\t\treturn Bullet.new(@window, @x, @y, 0, @vel+1, false)\n\t\tend\n\tend", "def fire\n if Gosu::milliseconds - @prev_shot > 60\n self.shots.push(Shot.new(self.game,\"player_shot\",@gfx_shot,@x+8,@y,90,10)) unless @live_shots >= @shots_budget\n @prev_shot = Gosu::milliseconds\n end\n end", "def shoot\n return Bullet.new(@window, @x, @y, 0, -2, true)\n end", "def shoot(dir)\n\t\tx_origin = @x + (@width / 2.0) - (10)\n\t\ty_origin = @y + (@height / 2.0) - (10)\n\t\t@bullets.push(Bullet.new(x_origin, y_origin, 20, 20, @player.bullet_image, @gameWindow, 3, 3, dir)) #fix this.\n\t\t@remaining_time = @shot_time\n\tend", "def shoot\n @shooting = true\n end", "def bullet(name, options={}, &block)\n cur_page.bullet(name, options, &block)\n end", "def touched_by bullet\n ([@width, @height].max/3).times do\n p_vx = rand(100)/10.0 - 5\n p_vy = rand(100)/10.0 - 5\n #@window.particles << Particle.new(@window, @x + rand(@width) - @width/2, @y + rand(@height) - @height/2, p_vx, p_vy)\n @window.particles << Live_Particle.new(@window, bullet.x + rand(@width) - @width/2, bullet.y + rand(@height) - @height/2, p_vx, p_vy, @colors.rand_in, 1 + rand)\n end\n damage bullet.damage\n end", "def enemy_bullet_collision\n if cr.defeated == false\n $e_bullets.each do |b|\n if self.bounding_box_collision?(b)\n @life -= 1\n $hud.set_lives(life)\n clear_all_bullets\n end\n end\n end\n end", "def hit_by_bullet\n $p_bullets.delete_if do |b|\n if self.bounding_box_collision?(b)\n @meter.change_width(b.dmg)\n b.destroy\n during(100) { @color.alpha = 100 }.then { @color.alpha = 255 }\n @life -= 1.0\n true\n end\n end\n end", "def shoot\n\t\tt = (Rubygame::Time.get_ticks() - @parent.stamp[:p])/1000.0\n\t\tv = Vector.new(1,0).rotate(@parent.angle)\n\t\tv.magnitude += 150\n\t\tp = @parent.project(t)\n\t\t@parent.groups[0].push(@type.new(p,v,@lifespan))\n\tend", "def fire(time); end", "def fire(time); end", "def hook_action\n if tool_canuse?(HweaponId) and not @showing_hook\n unless character_at_playerpos?\n @hookshot.each do |hook| \n hook.direction = @direction\n hook.moveto(@x, @y)\n hook.char_steps = hook.index\n end\n @showing_hook = true\n RPG::SE.new(HookActionSe, 80).play\n @tool_anime = 30\n else\n Sound.play_buzzer\n end\n end\n end", "def fire_torpedo\n\t\tx = (@x + @@tiles[0].width/2) - Torpedo::IMG_WIDTH / 2\n\t\ty = (@y + @@tiles[0].height/2)\n\n\t\ttorpedo = Torpedo.new(x, y, @angle)\n\t\ttorpedo.player = @player\n\t\t@game_state.add_entity(torpedo)\n\t\t@torpedo_launched = Time.new\n\n\t\t@@fire_torpedo_sound.play\n\tend", "def on_player_walk\n for actor in members\n if actor.slip_damage?\n actor.hp -= 1 if actor.hp > 1 # Poison damage\n $game_map.screen.start_flash(Color.new(255,0,0,64), 4)\n end\n if actor.auto_hp_recover and actor.hp > 0\n actor.hp += 1 # HP auto recovery\n end\n end\n end", "def start\n ty_ammo_requirements_start\n ty_set_enemy_ammo\n end", "def shoot arrow\r\n arrow.x+=arrow.vel_x\r\n arrow.y+=arrow.vel_y\r\n end", "def fire\n if shot_elapsed > 60\n shots.push(new_shot) unless @live_shots >= @shots_budget\n end\n end", "def enemy_shoot args\n # generate a random number from 0 to 99\n r = rand(100)\n # is the random number 0? that give a a 1 in 100 chance of shooting\n # is the enemy shooting? Only shoot if not already shooting.\n if r == 1 && args.state.enemy_bullet_shooting == false\n # set the enemy bullet position to the enemy position\n args.state.enemy_bullet_x = args.state.enemy_x + args.state.enemy_w / 2\n args.state.enemy_bullet_y = args.state.enemy_y\n # track state of enemy bullet\n args.state.enemy_bullet_shooting = true\n end\nend", "def shoot\n\t\t\t\t# Project\n\t\t\t\t@current.shoot\n\t\t\t\tself\n\t\t\tend", "def game_blade_action\n if tool_canuse?(BladeWeaponId) and not @showing_blade\n @gameblade.direction = @direction\n @gameblade.moveto(@x, @y)\n @showing_blade = true\n @gameblade.action_time = 30\n @tool_anime = @gameblade.action_time\n RPG::SE.new(BladeSoundSe,75, 130).play\n end\n end", "def fire(object, *args); end", "def add_bullet(bullet)\n @bullets << bullet\n end", "def move_player_bullet args\n # don't update the position if the bullet isn't in action\n if args.state.player_bullet_shooting\n # go see if the bullet hit the enemy\n check_enemy_hit args\n # update the bullet y position\n args.state.player_bullet_y += 10\n # has the bullet gone off the top of the screen?\n if args.state.player_bullet_y > 720\n # don't bother updating it\n args.state.player_bullet_shooting = false\n end\n end\nend", "def move\r\n # Move bullet fired by the Spaceship up the screen \r\n if @type == 'good'\r\n @y -= @SPEED\r\n # Move bullet fired by the Aliens down the screen \r\n elsif @type == 'evil'\r\n @y += @SPEED\r\n end\r\n end", "def update args\n\n # Keep the backdrop scrolling, always...\n @backdropl_spr.source_x += 2\n if @backdropl_spr.source_x > BACKDROP_WIDTH \n @backdropl_spr.source_x = 0\n end\n @backdropr_spr.source_x = @backdropl_spr.source_x\n\n\n # Check to see if the player needs creating\n if @player.nil? && @lives.positive?\n @player = Player.new args\n end\n\n\n # Also, spawn any enemies that are due\n while ( @enemy_idx < @@enemies.length ) && ( args.state.tick_count >= ( @epoch + @@enemies[@enemy_idx][:spawn] ) ) do\n @enemy << Enemy.new( @@enemies[@enemy_idx] )\n @enemy_idx += 1\n end\n\n\n # User input; see if we're moving first off\n horizontal = 0\n vertical = 0\n if args.inputs.keyboard.key_held.up || args.inputs.keyboard.key_held.w || args.inputs.controller_one.key_held.up\n vertical = 1\n end\n if args.inputs.keyboard.key_held.down || args.inputs.keyboard.key_held.s || args.inputs.controller_one.key_held.down\n vertical = -1\n end\n if args.inputs.keyboard.key_held.right || args.inputs.keyboard.key_held.d || args.inputs.controller_one.key_held.right\n horizontal = 1\n end\n if args.inputs.keyboard.key_held.left || args.inputs.keyboard.key_held.a || args.inputs.controller_one.key_held.left\n horizontal = -1\n end\n @player.move horizontal, vertical\n\n\n # If the player is firing, fire the current weapon they have\n if @player_bullets.empty? && ( args.inputs.keyboard.key_held.space || args.inputs.controller_one.key_held.a )\n @player_bullets.concat( @player.fire )\n end\n\n\n # Update the position of any player bullets\n @player_bullets.each { |bullet| bullet.update args }\n\n\n # Allow each enemy to move\n @enemy.each { |ship| ship.move }\n\n\n # Decide if any enemies get to shoot\n\n\n # And update all of their bullets, too\n @enemy_bullets.each { |bullet| bullet.update args }\n\n\n # And purge any bullets now out of scope\n @player_bullets.delete_if { |bullet| bullet.outofbounds? args.grid }\n @enemy_bullets.delete_if { |bullet| bullet.outofbounds? args.grid }\n\n \n # Check to see if any player bullets collided with any enemies\n @player_bullets.each do | bullet |\n\n # Check against each enemy\n @enemy.each do | ship |\n if bullet.collides? ship\n args.outputs.debug << [ 100, 100, \"HIT!\", 5, 1, 255, 0, 0 ].label\n end\n end\n \n end\n\n\n # Everything is fine, stick with this world!\n true\n\n end", "def fire(hook, *args); end", "def add_bullets\n @window.bullets << Vibrant_Bullet.new(@window, @player, @player.x, @player.y - @player.height/2.0)\n end", "def move_enemy_bullet args\n # don't update the position if the bullet isn't in action\n if args.state.enemy_bullet_shooting\n # go see if the bullet hit the player\n check_player_hit args\n # update the bullet y position\n args.state.enemy_bullet_y -= 10\n # has the bullet gone off the bottom of the screen?\n if args.state.enemy_bullet_y < 0 - args.state.enemy_bullet_h\n # don't bother updating it\n args.state.enemy_bullet_shooting = false\n end\n end\nend", "def bullet\n @bullet ||= load_data.first.bullet\n end", "def update\n #Updates invulnerability timing.\n updateTime\n #If the XShooter has rotated long enough, and has nearly achieved the desired angle, shoots.\n if @shootTime > 100 and (@angle - @shootAngle).abs < 0.2\n #Sets the XShooter's angle to the shooting angle (which is 0 initially) and shoots four bullets.\n @angle = @shootAngle\n shoot\n #Increases the shoot angle so that the XShooter will change its shape the next time it shoots.\n @shootAngle += Math::PI / 4\n #Ensures the angle does not become too high.\n @shootAngle = @shootAngle % (Math::PI * 2)\n #Resets the shoot time and the reset time. This temporarily freezes the XShooter and resets the cooldown for its next\n #shot.\n @shootTime = 0\n @resetTime = 0\n end\n #If the XShooter has remained frozen for long enough, will rotate the XShooter. Note the use of rotateTime. This is to\n #ensure the XShooter does not rotate too quickly.\n if @resetTime > 30 and @rotateTime > 1\n rotate\n @rotateTime = 0\n end\n #Increments all the different timings.\n @shootTime += 1\n @resetTime += 1\n @rotateTime += 1\n end", "def melee_weapon; end", "def perform_damage_effect\n end", "def perform_damage_effect\n end", "def move_bullets args\n args.state.bullets.each do |bullet| # perform action on each bullet in collection\n bullet.x += bullet.speed # increment x by speed (bullets fly horizontally across screen)\n\n # By randomizing the value that increments bullet.y, the bullet does not fly straight up and out\n # of the scope of the screen. Try removing what follows bullet.speed, or changing 0.25 to 1.25 to\n # see what happens to the bullet's movement.\n bullet.y += bullet.speed.*(0.25).randomize(:ratio, :sign)\n bullet.rect = [bullet.x, bullet.y, bullet.size, bullet.size] # sets definition of bullet's rect\n end\nend", "def attack(player)\n player.receive_damage\n end", "def tick!\n if target = acquire_target\n shoot_at(target)\n else\n scan_for_targets\n end\n end", "def weaponsTurret _obj, _args\n \"_obj weaponsTurret _args;\" \n end", "def drop_item1\n return enemy.drop_item1\n end", "def doFire _obj, _args\n \"_obj doFire _args;\" \n end", "def attacks (player)\n damage = compute_damage\n\n puts \">>> Le joueur #{self.name} attaque le joueur #{player.name}\"\n\n puts \">>> Il lui inflige #{damage} points de dommages\"\n\n # Give damages to the \"player\" in argument\n player.gets_damage(damage)\n end", "def receive_damage\n @hit_points-= 10\n end", "def player_shoot\n distance = choose_shot_distance\n room_number = choose_room_target(distance)\n @game.shoot_arrow(room_number)\n animate('>>>--------~>')\n end", "def draw\n @running = @body.v.x.abs >= 1\n\n unless @running or @attacking #set idle sprite unless they're running or attacking\n if @direction == :left\n @sprite = @sprite_left\n else\n @sprite = @sprite_right\n end\n end\n \n if @dmg_cooldown > 0 && @direction == :right \n @sprite = @sprite_damage\n elsif @dmg_cooldown > 0 && @direction == :left\n @sprite = @sprite_damage_left\n end\n if @dead\n @sprite = Gosu::Image.new(\"assets/images/player/death.png\")\n end\n super\n end", "def game_bomb_action\n if tool_canuse?(BweaponId) and not @showing_bomb\n if $game_party.has_item?($data_items[BcostItemId]) \n $game_party.consume_item($data_items[BcostItemId])\n @gamebomb.direction = @direction\n @gamebomb.moveto(@x, @y)\n @gamebomb.jump_passable?(1)?@gamebomb.start_jump(1) :@gamebomb.jump(0,0)\n @gamebomb.action_time = BombDuration * 60\n @showing_bomb = true\n @gamebomb.through = false\n RPG::SE.new(BombActionSe,90).play\n @tool_anime = 20\n else\n Sound.play_buzzer\n end\n end\n end", "def attacks(player)\r\n puts \"#{@name} attaque le joueur #{player.name}\"\r\n player.gets_damage(compute_damage)\r\n end", "def taking_damage_action\n if @warrior.feel(:backward).empty? && @health < 10\n @warrior.walk!(:backward)\n elsif @warrior.feel.empty?\n @warrior.walk!\n elsif @warrior.feel.enemy?\n @warrior.attack!\n end\n end", "def fire_shot(x, y)\n opponent_board.take_shot(x, y)\n opponent_board.fire_shot_on_board(player_board)\n end", "def attacks(player)\n \tputs \"Le joueur #{@name} attaque le joueur #{player.name}\"\n \tdamage = compute_damage\n \tputs \"Il lui inflige #{damage} points de dommage\"\n \tplayer.gets_damage(damage)\n end", "def calc args\n #get out of this method if the game is over\n return if args.state.game_state != \"playing\"\n # move the player's bullet\n move_player_bullet args\n # move the enemy\n move_enemy args\n # randomly fire enemy bullet\n enemy_shoot args\n # move the enemy's bullet\n move_enemy_bullet args\nend", "def drop_item2\n return enemy.drop_item2\n end", "def handgunWeapon _args\n \"handgunWeapon _args;\" \n end", "def shoot(coords)\n x = coords[0]\n y = coords[1]\n\n # Check that there is a ship at [x, y]\n if @field[x][y]\n # Check that ship is killed\n if (res = @field[x][y].explode)\n refresh\n \"killed #{res}\"\n else\n 'wounded'\n end\n else\n 'miss'\n end\n end", "def fly\n @health -= 10\n self\n end", "def attacks(player)\n \tputs \"Le joueur #{@name} attaque le joueur #{player.name}.\"\n # On récupère le nombre de points de dommage correspondant au lancer de dé via la méthode compute_damage\n damage_points = compute_damage\n puts \"Il lui inflige #{damage_points} points de dommage.\"\n # Ces points de dommage sont infligés à player. Si player n'a plus de points de vie, le programme affiche qu'il est mort.\n player.get_damage(damage_points)\n end", "def look_forwards()\n if enemy_check?\n @warrior.shoot! @movement_direction\n else\n check_forwards\n end\n end", "def weapon; end", "def weapon; end", "def weapon; end", "def prepare_bullet_data\n [\"*\", self]\n end", "def move()\n #first it checks if it is on an edge\n if (\n @model.x >= Window.width-@size ||\n @model.x <= 0 ||\n @model.y >= Window.height-@size ||\n @model.y <= 0\n )\n #if the bullet is on the edge then it will die\n self.kill()\n end\n #this moves the bullet by the velocity of the bullet\n @pos.x += @vel.x\n @pos.y += @vel.y\n #moves the bullets model\n @model.x = @pos.x\n @model.y = @pos.y\n end", "def updatePosition\n super\n\n Bullet.BulletInstances.each { |bullet|\n if collision?(bullet)\n bullet.destroy\n explode\n end\n }\n\n Ship.ShipInstances.each { |ship|\n if collision?(ship)\n ship.destroy\n explode\n end\n }\n end", "def heal()\r\n @warrior.rest!\r\n end", "def heal()\r\n @warrior.rest!\r\n end", "def heal()\r\n @warrior.rest!\r\n end", "def heal()\r\n @warrior.rest!\r\n end", "def attacks(player)\n\t\tputs \"#{@name} attaque #{player.name} !\"\n\t\tdamage = compute_damage\n player.gets_damage(damage)\n \n\t\tif player.life_points > 0\n\t\tputs \"#{@name} lui inflige #{damage} points de dommage.\\n\\n\"\n\t\telse \n\t\t\tputs \"Oups, #{player.name} c'est fait décapité...\\n\\n\"\n end\n\n end", "def give_bonus player\n player.add_weapon(Vibrant_Weapon.new(@window, player))\n end", "def take_damage amt, name, sym, message\n @hp -= amt\n @last_hit_by = name\n @kill_type = sym\n hear_line message\n # check if you died?\n end", "def checkCollide(enemyBullets)\n enemyBullets.each do |bullet|\n if Gosu::distance(bullet.x, bullet.y, @x, @y) < 5\n @isKill = true\n end\n end\n end", "def turn\n puts display\n # User shooting at NPC board.\n user_shot_location = user_shot_turn\n @npc.board.board_hash[user_shot_location].fire_upon\n # NPC shooting at user board.\n npc_shot_location = npc_shot_turn\n @user_board.board_hash[npc_shot_location].fire_upon\n # Print the results of combat.\n print results(user_shot_location, npc_shot_location)\n end", "def fire\n\t\treturn @ammoPower\n\tend", "def blow\n\t\tif !@is_blown\n\t\t\t@is_blown = @has_changed = true\n\t\t\t@start_time = Gosu::milliseconds\n\t\t\t@@sound.play\n\t\tend\n\tend", "def setParticleFire _obj, _args\n \"_obj setParticleFire _args;\" \n end", "def stopShootLaser\n @laserFiring = false\n end", "def execute_damage(user)\n fulfill_conditional if hp - @result.hp_damage <= 0\n mrts_conditional_drops_execute_damage(user) \n end", "def play\n @hungry = true\n #p \"play method called\" #print notification to console\n end", "def collision(damage)\n end", "def attack(direction)\n @weapon.attack(direction)\n end", "def shoot(at_coordinates, opponent_board)\n end", "def hit!(enemy)\n unless invincible?\n $window.audio_manager.play! :hurt\n hp!(0 - enemy.damage)\n invincible!(InvincibleTime)\n enemy.damage!(enemy.damage)\n end\n \n enemy.jump_back!\n end", "def command_use_point\r\r\n if $game_actors[@actor.id].skill_tree[0] == 0 || confirm_skill_add\r\r\n Sound.play_buzzer\r\r\n @confirm.close\r\r\n @confirm.active = false\r\r\n else\r\r\n @skills_icons[@skill_selected].opacity = 255\r\r\n $game_actors[@actor.id].skill_tree[0] -= 1\r\r\n $game_actors[@actor.id].lose_jp(Actor[@actor.id][@skill_selected]['JP'])\r\r\n $game_actors[@actor.id].skill_mult[Actor[@actor.id][@skill_selected]['Skill_id']] += Actor[@actor.id][@skill_selected]['Multiply']\r\r\n $game_actors[@actor.id].skill_tree[Actor[@actor.id][@skill_selected]['Skill_id']] += 1\r\r\n $game_actors[@actor.id].learn_skill(Actor[@actor.id][@skill_selected]['Skill_id'])\r\r\n @info_window.refresh(@actor, @tree)\r\r\n Audio.se_play(\"Audio/SE/Skill3\",75,100)\r\r\n @confirm.close\r\r\n @confirm.active = false\r\r\n if $game_switches[19] # achievement available?\r\r\n #------------------------------------------------------------------------------- \r\r\n # Trophic: Markspony\r\r\n #-------------------------------------------------------------------------------\r\r\n earn_trophic = true\r\r\n for i in 546..561\r\r\n if !$game_actors[@actor.id].skill_learned?(i) && !$ACH_markspony\r\r\n earn_trophic = false\r\r\n break\r\r\n end\r\r\n end\r\r\n \r\r\n if earn_trophic && !$ACH_markspony\r\r\n $ACH_markspony = true\r\r\n GameJolt.award_trophy(\"53491\")\r\r\n p sprintf(\"Achievement unlock - markspony\")\r\r\n $game_system.earn_achievement(:markspony)\r\r\n end\r\r\n #------------------------------------------------------------------------------- \r\r\n # Trophic: Elementalist\r\r\n #------------------------------------------------------------------------------- \r\r\n earn_trophic = true\r\r\n for i in 563..582\r\r\n next if i == 567 || i == 571 || i == 577 || i == 581 \r\r\n if !$game_actors[@actor.id].skill_learned?(i) && !$ACH_elementalist\r\r\n earn_trophic = false\r\r\n break\r\r\n end\r\r\n end\r\r\n \r\r\n if earn_trophic && !$ACH_elementalist\r\r\n $ACH_elementalist = true\r\r\n GameJolt.award_trophy(\"53485\") \r\r\n p sprintf(\"Achievement unlock - elementalist\")\r\r\n $game_system.earn_achievement(:elementalist)\r\r\n end\r\r\n #---------------------------------------------------\r\r\n end\r\r\n end\r\r\n end", "def circle(list, loc, frameCount, divisor=18, speed=3.0, frequency=30.0)\n if frameCount > @bullet_pause+frequency\n $sm.play_sound(\"circle\",0.1,1.0,false)\n x = loc[0]\n y = loc[1]\n angle = 0.0\n degree = 360.0/divisor\n for i in 1..divisor\n angle += degree\n list << Bullet.create(:x=>x, :y=>y, :speed=>speed, :angle=>Gosu.degrees_to_radians(angle),:list=>list)\n end\n @bullet_pause = frameCount\n end\n end", "def render args\n # draw the player's bullet\n render_player_bullet args\n # draw the player\n render_player args\n # draw the enemy bullet\n render_enemy_bullet args\n # draw the enemy\n render_enemy args\n # draw game over\n render_game_over args\nend", "def initialize(message = {})\n super(message)\n @type = 'bullet'\n end" ]
[ "0.8171409", "0.7454516", "0.7333679", "0.6954393", "0.6928069", "0.68463326", "0.6845657", "0.6830427", "0.6787185", "0.6743746", "0.67229474", "0.6687603", "0.66550285", "0.6642569", "0.66419464", "0.65892076", "0.6567191", "0.65120614", "0.64631444", "0.6458526", "0.63488805", "0.6297518", "0.61828935", "0.6135324", "0.61191636", "0.6104662", "0.6104662", "0.6103598", "0.6047404", "0.6046664", "0.60417527", "0.603509", "0.60345465", "0.6015554", "0.60064054", "0.6001884", "0.5999043", "0.5985744", "0.5972469", "0.59258914", "0.59113675", "0.59092474", "0.59080845", "0.58717245", "0.58510464", "0.58263546", "0.5810095", "0.58081216", "0.58081216", "0.578955", "0.57772964", "0.571299", "0.56970793", "0.56572986", "0.5649381", "0.5637824", "0.5611082", "0.55989593", "0.5592867", "0.5592797", "0.5535139", "0.5515585", "0.5512369", "0.5504698", "0.5501588", "0.54669875", "0.546605", "0.5461383", "0.5457351", "0.5449866", "0.5446129", "0.54343045", "0.54343045", "0.54343045", "0.54313916", "0.54278374", "0.54168504", "0.54093856", "0.54093856", "0.54093856", "0.54093856", "0.5405548", "0.5395373", "0.5391103", "0.53905517", "0.53905165", "0.53898424", "0.5389505", "0.53851926", "0.53773457", "0.53671074", "0.5362288", "0.53606194", "0.53553414", "0.5345174", "0.53422165", "0.5341673", "0.53356516", "0.53327096", "0.5320463" ]
0.83281463
0
Introcusing a new fleet of aliens in the game
def add_alien_fleet() # Only generate new fleet of aliens if the current count of fleets is less than @fleet_limit if rand(@random) == 0 and @fleet < @fleet_limit @fleet +=1 position = rand(SCREEN_WIDTH/2) @height -= GAME_PRESET["space_fleet"] # Calling the procedure to generate aliens generate_aliens(position, @height) end # If the aliens reach the top level of the screen bring then down if @height < 0.3 @height = GAME_PRESET["initial_height"] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_aliens(position, height)\r\n # Looping until the number of Aliens in a fleet is reached\r\n for i in 0...@alien_count\r\n @aliens.push(Alien.new(i, position, height))\r\n @alien_sound.bmp.play\r\n end\r\n end", "def eat\n inventory[:fish] -= @daily_appetite = 10\n\n if inventory[:fish] < 0\n @alive = false\n inventory[:fish] = 0\n end\n end", "def enemy_fleet()\n enemy_fleet = Array.new\n for count in 1..6 do \n enemy_fleet.push(Ship.new(generateHull, generateFirepower, generateAccuracy))\n end\n return enemy_fleet\nend", "def init_equips(equips)\n @equips = Array.new(equip_slots.size) { Game_BaseItem.new }\n equips.each_with_index do |item_id, i|\n break if i > @equips.size - 1\n @equips[i].set_equip(item_id < 0, item_id.abs)\n end\n refresh\n end", "def make\n @spaces.each { |position| position.occupied = true }\n # pp \"made ship: #{@spaces}\"\n end", "def eat(food)\n @foods_eaten << food\n end", "def add_food\n srand\n self << FishFood.new(Position.new([randomFloatSigned*2,1,randomFloatSigned]))\n end", "def level_up()\r\n # Incrementing the level\r\n @level += 1\r\n # Incrasing the number of aliens in each fleet \r\n if @alien_count <6\r\n @alien_count += 1\r\n end \r\n # Reducing the random number to that the events are more likely to occur \r\n @random -= 100\r\n @alien_fire_rand -= 100\r\n # Increasing the maximum number of Alien fleets \r\n @fleet_limit += 1\r\n end", "def new_game\n my_board = EdenPlayer.new_board\n ships = [5, 4, 3, 3, 2]\n probs = positional_probabilities my_board\n ship_pos = ships.map do |ship|\n laid = nil\n until laid\n rand_branch = rand(999) % 3\n # 1/3rd of the time, don't lay the ship in lowest probability spot\n # near edge, this gives a grouping formation that gives a few ships\n # a great area that they may be found in\n pos = rand(999) % 3 == 1 ? [rand(10), rand(10)] : draw_next_min(probs)\n laid = lay_ship({ship_length: ship, board: my_board, pos: pos})\n end\n laid\n end\n end", "def train_peasant\n if can_train_peasant?\n @gold -= 90\n @food -= 5\n Peasant.new\n end\n end", "def setupEnemyBoard\n ships = Ship.find(:all, :order => \"id\")\n ships.each do |ship|\n placed = false\n while !placed\n coords = []\n bow = findRandomBow\n coords << getIndex(bow[0], bow[1])\n if ship.length == 1\n placeShip(ship.id, coords, \"enemy\")\n placed = true\n else\n direction = rand(4)\n if placementClear(ship.length, direction, coords, \"enemy\")\n self.placeShip(ship.id, coords, \"enemy\")\n placed = true\n end\n end\n end\n end\n end", "def spawn \n\t\tputs \"Greetings, adventurer! What is your name?\" \n\t\t@name = gets.chomp\n\t\tputs \"What race will you be? [E]lven [H]uman [D]warven\"\n\t\tcase gets.chomp.downcase \n\t\t\twhen \"d\" \n\t\t\t\t@race = \"Dwarf\" \n\t\t\t\t@inventory = [\"Axe\", \"Plate Armor\"]\n\t\t\t\t@hit_points = 14\n\t\t\t\t@symbol = \"@\"\n\t\t\twhen \"h\" \n\t\t\t\t@race = \"Human\"\n\t\t\t\t@inventory = [\"Mace\", \"Chainmail\"]\n\t\t\t\t@hit_points = 12 \n\t\t\t\t@symbol = \"@\"\n\t\t\twhen \"e\" \n\t\t\t\t@race = \"Elf\" \n\t\t\t\t@inventory = [\"Sword\", \"Scale Armor\"]\n\t\t\t\t@hit_points = 10 \n\t\t\t\t@symbol = \"@\"\n\t\tend\n\t\tfly(5, 5, @symbol)\n\tend", "def add(name, weapon)\n gladiators.push(Gladiator.new(name, weapon)) if (gladiators.size < 2)\n end", "def add_to_game\n @ennemies.each { |e| @window.ennemies.push(e) }\n end", "def train_siege_engine\n if can_train_siege_engine?\n @gold -= 200\n @food -= 3\n @lumber -= 60\n SiegeEngine.new\n end\n end", "def map_change\n i = 0\n while i < $Enemies.length \n $Enemies[i] = Enemy.new\n $Enemies[i].set_index(i)\n i += 1\n end\n end", "def behavior_hungry\n @world.food.each do |food|\n if distance_from_point(food.position) < (food.quantity + ROID_SIZE*5)\n @delta -= self.position - food.position\n end \n if distance_from_point(food.position) <= food.quantity + 5\n eat food\n end \n end \n end", "def set_fleet\n @fleet = Fleet.find(params[:id])\n end", "def update_food\n @food.each do |food|\n if food.position.y <= FoodHeight and rand<FoodDissapearChance\n @food.delete(food)\n @food.compact!\n else\n food.move\n end\n end\n # randomly add food\n add_food if rand <= Food_Spawn_Chance\n end", "def add_new_enemies_if_needed args\n return if args.state.enemies.length >= 10 # if 10 or more enemies, enemies are not added\n return unless args.state.bullets.length == 0 # if user has not yet shot bullet, no enemies are added\n\n args.state.enemies += (10 - args.state.enemies.length).map do # adds enemies so there are 10 total\n args.state.new_entity(:enemy) do |e| # each enemy is declared as a new entity\n e.x = 640 + 500 * rand # each enemy is given random position on screen\n e.y = 600 * rand + 50\n e.rect = [e.x, e.y, 130, 30] # sets definition for enemy's rect\n end\n end\nend", "def initialize(name_to_update,life_points_to_update=10)\n @name = name_to_update\n @life_points = life_points_to_update\n @degat = 0 # j'initialise une variable de classe degat afin de m'en servir dans toute la classe\n @weapon_level = 1\n end", "def createEnemyStarShip\n loot = createLoot\n damage1 = createDamageNumeric\n damage2 = createDamageSpecific\n \n enemy1 = EnemyStarShip.new(\"E1\",5,6,loot[0],damage1[0])\n enemy2 = EnemyStarShip.new(\"E2\",10,20,loot[1],damage2[1])\n enemy3 = EnemyStarShip.new(\"E3\",50,100,loot[2],damage2[4])\n \n enemies = [enemy1,enemy2,enemy3]\n return enemies\n end", "def add_fixed_dwarf(seat)\n quad_from_seat(seat).fixed_dwarves += 1\n end", "def eat(food)\n @foods_eaten.push(food)\n end", "def generate_individual_ships\n # for each ship type, create it and then assign it to its accessor\n %w|carrier battleship submarine warship destroyer|.each do |type|\n ship = Ship.new(type)\n case type\n when \"carrier\"\n then @carrier = ship\n when \"battleship\"\n then @battleship = ship\n when \"submarine\"\n then @submarine = ship\n when \"warship\"\n then @warship = ship\n when \"destroyer\"\n then @destroyer = ship\n end\n @fleet << ship # for fleet-building\n end\n end", "def equip(entity)\n prev_item = entity.outfit[@type]\n\n entity.outfit[@type] = self\n alter_stats(entity, true)\n\n if prev_item\n prev_item.alter_stats(entity, false)\n entity.add_item(prev_item)\n end\n\n print \"#{entity.name} equips #{@name}!\\n\\n\"\n end", "def catch_fish\n inventory[:fish] += @skills[:fish]\n end", "def spawn_enemy_balls\n # TODO\n end", "def eat(food)\n food.eat 1\n @energy += METABOLISM\n end", "def facilitate_adoption\n puts \"Choose the adopting client by their number.\"\n display_all_clients\n adopting_client_index = gets.chomp.to_i - 1\n adopting_client = clients[adopting_client_index]\n puts \"Choose the animal #{adopting_client.name} wants to adopt.\"\n display_all_animals\n animal_index = gets.chomp.to_i - 1\n animal = animals[animal_index]\n # I want to give the animal to the client, and remove the animal from the shelter\n adopting_client.add_pet(animal)\n animals.delete_at(animal_index)\n puts \"Great, #{adopting_client.name} has given #{animal.name} a new home.\"\n end", "def build_inventory\n add_to_inventory(\"cats\", 4, 50.0)\n add_to_inventory(\"dogs\", 10, 150.0)\n add_to_inventory(\"unicorn\", 1, 1000.0)\nend", "def alien_fire_bullet()\r\n # The aliens will fire bullets at random, \r\n # The randomness is controlled by @alien_fire_rand\r\n @aliens.each { |alien|\r\n if rand(@alien_fire_rand) == 0\r\n @bullets.push Bullet.new(alien.x, alien.y+ 40, 'evil')\r\n end\r\n }\r\n end", "def update_ships\n # A data structure to store the ships in\n\n ships = [\n [\"Brittana\", [\"Brittany P.\", \"Santana L.\"]],\n [\"Faberry\", [\"Quinn F.\", \"Rachel B.\"]],\n [\"Flanamotta\", [\"Rory F.\", \"Sugar\"]],\n [\"Sory\", [\"Rory F.\", \"Sam E.\"]],\n [\"Seblaine\", [\"Sebastian S.\", \"Blaine A.\"]],\n [\"Santofsky\", [\"D. Karofsky\", \"Santana L.\"]],\n [\"Bartie\", [\"Brittany P.\", \"Artie A.\"]],\n [\"Tike\", [\"Mike C.\", \"Tina C.\"]],\n [\"Pezberry\", [\"Santana L.\", \"Rachel B.\"]],\n [\"Pizes\", [\"Lauren Z.\", \"Puck\"]],\n [\"St. Berry\", [\"Jesse sJ.\", \"Rachel B.\"]],\n [\"Kill\", [\"Kurt H.\", \"Will S.\"]],\n [\"Puckurt\", [\"Kurt H.\", \"Puck\"]],\n [\"Artina\", [\"Tina C.\", \"Artie A.\"]],\n [\"Partie\", [\"Puck\", \"Artie A.\"]],\n [\"Blainofskyve\", [\"Blaine A.\", \"D. Karofsky\"]],\n [\"Klaine\", [\"Kurt H.\", \"Blaine A.\"]],\n [\"Hummelberry\", [\"Kurt H.\", \"Rachel B.\"]],\n [\"Furt\", [\"Kurt H.\", \"Finn H.\"]],\n [\"Pinn\", [\"Puck\", \"Finn H.\"]],\n [\"Samcedes\", [\"Sam E.\", \"Mercedes J.\"]],\n [\"Artcedes\", [\"Artie A.\", \"Mercedes J.\"]],\n [\"Finchel\", [\"Finn H.\", \"Rachel B.\"]],\n [\"Puckleberry\", [\"Puck\", \"Rachel B.\"]],\n [\"Wemma\", [\"Will S.\", \"Emma P.\"]]\n ]\n\n ships.each do |ship_data|\n ship = Ship.find_by_name(ship_data[0])\n\n # Make sure the ship doesn't already exist\n if !ship\n\n # create a new ship\n ship = Ship.new()\n ship.name = ship_data[0]\n ship.save\n\n # For each character in the ship\n ship_characters = ship_data[1]\n generate_log(\"Generating New Ship: #{ship_data[0]} between #{ship_data[1]}\")\n ship_characters.each do |ship_character|\n character = generate_character(ship_character)\n # Save the relationship\n relationship = Relationship.new()\n relationship.ship = ship\n relationship.character = character\n relationship.save\n\n end\n else\n ship.update_attributes(:name => ship_data[0])\n ship.save\n generate_log(\"Updating: #{ship_data[0]} between #{ship_data[1]}\")\n\n\n end\n end\nend", "def new_game!\n write_to_engine('ucinewgame')\n reset_board!\n set_startpos!\n @fen = nil\n end", "def add_a_ship_to_fleet(a_size, a_origin, a_direction)\n\tnew_ship = Ship.new(a_size, a_origin, a_direction)\n\tnew_ship.check_is_out_of_board(width, long)\n\tnew_ship.check_for_collisions(ships)\n\tadd_ship(new_ship)\n end", "def place_fleet(pos_list)\n # Try to set all ships on the field\n res = pos_list.inject(true) do |a, l|\n a && @all_ships[l[0]].set!(l[1], l[2], l[3])\n end\n\n # If success, check something???\n res = @all_ships.inject(true) { |a, ship| a && ship.coord } if res\n\n # Remove all ships otherwise\n @all_ships.each { |ship| ship.kill if ship.coord } if !res\n\n res\n end", "def spot_food(food)\n @fish.direction = @fish.move_towards(food)\n @fish.status = Pursuing\n @fish.target = food\n end", "def new_game\n @shots = []\n boats = []\n\n BOAT_SIZES.each do |size|\n boats << place_boat(size, boats)\n end\n boats\n end", "def create_Ant_Room\n @rooms.each do |room|\n if food > 0\n myAnt = Ant.new\n myAnt.x = room.x\n myAnt.y = room.y\n myAnt.anthill = self\n\n if room.type == \"foreger\"\n myAnt = create_Forager(myAnt)\n elsif room.type == \"builder\"\n myAnt = create_Builder(myAnt)\n else\n myAnt = create_Warrior(myAnt)\n end\n\n Meadow.instance.add_AntToCell(myAnt, @x, @y)\n @food -= 1 \n else\n break\n end\n\n end\n\n end", "def train_footman\n if can_train_footman?\n @gold -= 135\n @food -= 2\n Footman.new\n end\n end", "def perform\n puts \"------------------------------------------------\"\n puts \"|Bienvenue sur 'ILS VEULENT TOUS MA POO' ! |\"\n puts \"|Le but du jeu est d'être le dernier survivant !|\"\n puts \"------------------------------------------------\"\n\n puts \"Quel est ton prénom?\"\n prenom = gets.chomp.to_s #initialize\n user = HumanPlayer.new(\"#{prenom}\") #user\n\n #initialize array of players\n player1 = Player.new(\"José\")\n player2 = Player.new(\"Josiane\")\n enemies = Array.new\n enemies << player1 \n enemies << player2\n\n #loop of the game\n while user.life_points > 0 && (enemies[0].life_points > 0 || enemies[1].life_points > 0)\n display_state(user, enemies)\n puts \"Appuyez sur entrée pour continuer:\"\n gets.chomp\n puts \"______________________________________________________\"\n display_user_options(enemies)\n puts \"______________________________________________________\"\n get_user_input(user, enemies)\n puts \"______________________________________________________\"\n if enemies[0].life_points > 0 && enemies[1].life_points > 0\n puts \"Les autres joueurs t'attaquent !\"\n gets.chomp\n puts \"______________________________________________________\"\n enemies.each do |player|\n if player.life_points > 0\n player.attack(user)\n puts \"______________________________________________________\"\n puts \"\"\n end\n end\n end\n puts \"Appuyez sur entrée pour continuer:\"\n gets.chomp\n end\n \n #display the end of the game with the winner\n puts \"La partie est finie\"\n if user.life_points > 0\n puts \"BRAVO ! TU AS GAGNE !\"\n else\n puts \"Loser ! Tu as perdu !\"\n end\nend", "def add_defeated_enemies\n $game_troop.dead_members.each { |enemy| $game_party.add_enemy_defeated(enemy.enemy_id) }\n end", "def update_eggs\n @eggs.each do |egg|\n if egg.position.y <= EggNestHeight and rand<EggHatchChance\n self << egg.hatch\n @eggs.delete(egg)\n @eggs.compact!\n elsif egg.position.y > EggNestHeight\n egg.move\n end\n end\n end", "def update_fish\n @dead_fish.each do |dead_fish|\n if dead_fish.position.y >= FishDeathbed and rand<=DecomposeChance\n puts \"decomposed!!\"\n @dead_fish.delete(dead_fish)\n @dead_fish.compact!\n elsif dead_fish.position.y <= FishDeathbed\n dead_fish.move\n end\n end\n @fish.each do |fish|\n case fish.status\n when Idle || Turning\n unless check_walls(fish)\n look_for_food(fish)\n look_for_mate(fish) unless (fish.target or fish.sex==Female or fish.virility<200)\n end\n when Avoiding\n when Pursuing\n case fish.target\n when FishFood\n look_for_food(fish)\n when SalmonObject\n look_for_mate(fish)\n when Shark\n end\n when Dead\n @fish.delete(fish) \n @fish.compact!\n @dead_fish << fish\n return\n end\n fish.move\n end\n end", "def buy_fish(name)\n#knows about its fishes\n pets[:fishes] << Fish.new(name)\n end", "def place_ships\n create_ships\n @computer_details[:ship_location] << COORDINATES.sample(5)\n p @computer_details[:ship_location]\n loop do\n i = 0\n loop do\n puts \"Enter the no. #{i + 1} attack coordinate.\"\n input = gets.chomp\n if COORDINATES.include?(input)\n unless @computer_details[:attack_coordinates].include?(input)\n @your_details[:attack_coordinates] << input\n x1 = input[0]\n y1 = input[1]\n x = 250 + X[x1]\n y = 10 + Y[y1]\n @screen.draw_line [x,y], [x + 20,y + 20], 'red'\n @screen.draw_line [x + 20,y], [x,y + 20], 'red'\n @screen.flip\n i +=1\n @computer_details[:ships_alive] -= 1 if @computer_details[:ship_location].include?(input)\n break if i >= @your_details[:ships_alive]\n else\n puts \"Already choosed this Coordinate\"\n end\n else\n puts \"This is not a valid Coordinate\"\n end\n end\n\n puts \"Now Computer Playing.....\" \n inputs = (COORDINATES - @computer_details[:attack_coordinates]).sample(@computer_details[:ships_alive])\n inputs.each do |input| \n @your_details[:attack_coordinates] << input\n x1 = input[0]\n y1 = input[1]\n x = 250 + X[x1]\n y = 250 + Y[y1]\n @screen.draw_line [x,y], [x + 20,y + 20], 'white'\n @screen.draw_line [x + 20,y], [x,y + 20], 'white'\n @your_details[:ships_alive] -= 1 if @your_details[:ship_location].include?(input)\n @screen.flip\n end\n p @computer_details[:ships_alive]\n if @computer_details[:ships_alive] == 0\n puts \"YOU WON !!!!!\"\n break\n elsif @your_details[:ships_alive] == 0\n puts \"COMPUTER WON !!!!!\"\n x1 = input[0]\n y1 = input[1]\n x = 10 + X[x1]\n y = 10 + Y[y1]\n 10.times do\n @screen.draw_line [x, y +=2], [ x + 20,y], 'white'\n end\n @screen.flip\n break\n end\n end\n p @your_details\n gets\n #@ship = Ship.new( @screen.w/2, @screen.h/2 , 'red')\n \n # Make event hook to pass all events to @ship#handle().\n #make_magic_hooks_for( @ship, { YesTrigger.new() => :handle } )\n end", "def aide3()\n\n @indiceFortFlag = TRUE\n @timer.add(120)\n end", "def setup_players\n @players = []\n @players << add(Spaceship, 400, 320)\n @players << add(Tank, width/2, height-100)\n end", "def fleet\r\n FleetController.instance\r\n end", "def give_pet_up_to_shelter(animal_name, animal_instance_name, shelter_instance_name)\n @number_of_pets = @number_of_pets - 1\n @pets.delete(animal_name)\n shelter_instance_name.animals[animal_name] = animal_instance_name\n end", "def main()\n \n for i in 0...$enemy_info.length do\n \n EditImage(\n $enemy_info[i][0],\n $enemy_info[i][2][0],\n $enemy_info[i][2][1],\n $enemy_info[i][2][2],\n $enemy_info[i][2][3],\n $enemy_info[i][3]\n )\n \n end \n\n\nend", "def villains_fought\n self.battles.map do |villain|\n villain.alter_ego\n end\n end", "def initialize(players, die) #name, position, colour, players\n @players = players\n @die = die\n end", "def battle\n # Runden auf 0 setzen, continue auf true (Für die Schleife)\n round = 0\n continue = true\n victory = false\n # Bilde Arrays mit allen nötigen Werten für den Kampf\n turn_fleet = build_array(@attacker, @attacker_fleet)\n target_fleet = build_array(@defender, @defender_fleet)\n emp_phase(@attacker)\n emp_phase(@defender)\n # Angreifer beginnt\n turn_user = @attacker\n target_user = @defender\n while (round < 1000 && continue ) do\n round = round + 1\n if target_user == @defender\n @fight_shield = @defender_shield\n else\n @fight_shield = @attacker_shield\n end\n # Damit alle Gruppen in einer Runde nur auf das Schild feuern können\n shield = @fight_shield\n # Für die Ausgabe der Runden-Berichte\n turn_fleet.each do |fleet|\n # Nur Einheiten mit Anzahl > 0 und Schaden > 0 können kämpfen\n if fleet[1] > 0 && fleet[2] > 0 \n # Bestimme Ziel anhand von id.\n # -2 ist Miss\n # -1 ist Schild\n target = hit(target_fleet, turn_user)\n if(target==-1)\n mult = 1\n # Falls Ionenwaffe, wird Schaden an Schild erhöht\n if fleet[3] == 2\n mult = DamageType.find(fleet[3]).shield_mult\n end\n damage = fleet[2] * mult\n # Abzug des Schilds. Übernahme erst bei nächster Runde\n @fight_shield = @fight_shield - damage\n else\n mult = 1\n # Falls Laserwaffe, wird Schaden an Hülle erhöht\n # TABELLE DAMAGETYPE EINFÜGEN\n if (fleet[3] == 1)\n mult = DamageType.find(fleet[3]).shell_mult\n end \n if fleet[3] == 3 and !fleet[6]\n mult = DamageType.find(fleet[3]).station_mult\n end\n if fleet[3] == 4 and fleet[0] == @plattform_id\n mult = DamageType.find(fleet[3]).plattform_mult\n end \n # Bestimme welche Einheit getroffen wurde\n victim = target_fleet[target]\n # Schadensberechnung\n damage = fleet[2] * mult\n # Berechne neue HP\n hit_points = victim[-2]\n victim[-2] = hit_points-damage\n # Berechne Anzahl und Schaden neu\n update_ship_group(victim, target_user)\n end\n end \n end\n # Füge Runden-Bericht ein\n # Testet, ob Spieler noch Truppen besitzt\n if (defeat(target_fleet))\n continue = false\n if turn_user == @attacker\n victory = true \n end\n else\n # Falls Schild unter 0, wird er auf 0 gesetzt\n if @fight_shield < 0\n @fight_shield = 0\n end\n # Kampf-Schild für nächste Runde\n if target_user == @attacker\n @attacker_shield = @fight_shield\n else\n @defender_shield = @fight_shield\n end\n # Tausche Rolle des Angreifers aus\n tmp_fleet = turn_fleet\n tmp_user = turn_user\n turn_fleet = target_fleet\n turn_user = target_user\n target_fleet = tmp_fleet\n target_user = tmp_user\n end\n # Füge alle Runden-Berichte hinzu\n end\n if continue\n @report << \"Unentschieden! \"\n @report << \"Es konnte kein Sieger ermittelt werden \"\n else \n @report << \"Die Flotte von #{target_user.username} unterlag. \"\n @report << \" #{turn_user.username} war siegreich! \"\n end\n # Generiere Verlustrechnung\n attacker_fleet_ary = []\n defender_fleet_ary = []\n if turn_user == @attacker\n lost_report(turn_fleet, @attacker) \n lost_report(target_fleet, @defender) \n attacker_fleet_ary = turn_fleet\n defender_fleet_ary = target_fleet\n else\n lost_report(target_fleet, @attacker) \n lost_report(turn_fleet, @defender) \n\n attacker_fleet_ary = target_fleet\n defender_fleet_ary = turn_fleet\n end\n update_fighting_fleet(@attacker_fleet, attacker_fleet_ary)\n update_fighting_fleet(@defender_fleet, defender_fleet_ary)\n ary = [@attacker_fleet, @defender_fleet] \n return [@report, @spy_report]\n end", "def coolingtower\n\n end", "def spawn_fish(n=20)\n for i in 0..n-1\n type = Aqua::Salmon\n srand\n sex = rand(2) == 0 ? Aqua::Male : Aqua::Female\n fish_desc = {\n 'type' => type,\n 'sex' => sex,\n 'speed' => Aqua::DefaultSpeed, # the following 3 can be lumped into one constant\n 'world_perception' => Aqua::DefaultWorldVision,\n 'food_perception' => Aqua::DefaultFoodPerception,\n 'mate_perception' => Aqua::DefaultMatePerception,\n 'position' => Aqua::Position.new([randomFloatSigned, 0, randomFloatSigned]),\n 'direction_change_factor' => Aqua::DefaultChangeFactor\n };\n self << Aqua::SalmonObject.new(fish_desc)\n end\n end", "def evilTeam(viewport = nil, trainerid = -1)\n @viewport = viewport if !@viewport && !viewport.nil?\n @sprites = {} if !@sprites\n @viewport.color = Color.new(0, 0, 0, 0)\n # fades viewport to black\n 8.delta_add.times do\n @viewport.color.alpha += 32/self.delta\n pbWait(1)\n end\n @viewport.color.alpha = 255\n bitmaps = [\n \"Graphics/EBDX/Transitions/EvilTeam/background\",\n \"Graphics/EBDX/Transitions/EvilTeam/swirl\",\n \"Graphics/EBDX/Transitions/EvilTeam/ray0\",\n \"Graphics/EBDX/Transitions/EvilTeam/ray1\",\n \"Graphics/EBDX/Transitions/EvilTeam/logo0\",\n \"Graphics/EBDX/Transitions/EvilTeam/logo1\",\n \"Graphics/EBDX/Transitions/EvilTeam/ring0\",\n \"Graphics/EBDX/Transitions/EvilTeam/ring1\"\n ]\n # try resolve the bitmaps\n bitmaps = checkForTrainerVariant(bitmaps, GameData::TrainerType.get(trainerid))\n # creates background graphic\n @sprites[\"bg\"] = Sprite.new(@viewport)\n @sprites[\"bg\"].bitmap = pbBitmap(bitmaps[0])\n @sprites[\"bg\"].color = Color.black\n # creates background swirl\n @sprites[\"bg2\"] = Sprite.new(@viewport)\n @sprites[\"bg2\"].bitmap = pbBitmap(bitmaps[1])\n @sprites[\"bg2\"].ox = @sprites[\"bg2\"].bitmap.width/2\n @sprites[\"bg2\"].oy = @sprites[\"bg2\"].bitmap.height/2\n @sprites[\"bg2\"].x = @viewport.width/2\n @sprites[\"bg2\"].y = @viewport.height/2\n @sprites[\"bg2\"].visible = false\n # sets up all particles\n speed = []\n for j in 0...16\n @sprites[\"e1_#{j}\"] = Sprite.new(@viewport)\n bmp = pbBitmap(bitmaps[2])\n @sprites[\"e1_#{j}\"].bitmap = Bitmap.new(bmp.width,bmp.height)\n w = bmp.width/(1 + rand(3))\n @sprites[\"e1_#{j}\"].bitmap.stretch_blt(Rect.new(0,0,w,bmp.height),bmp,Rect.new(0,0,bmp.width,bmp.height))\n @sprites[\"e1_#{j}\"].oy = @sprites[\"e1_#{j}\"].bitmap.height/2\n @sprites[\"e1_#{j}\"].angle = rand(360)\n @sprites[\"e1_#{j}\"].opacity = 0\n @sprites[\"e1_#{j}\"].x = @viewport.width/2\n @sprites[\"e1_#{j}\"].y = @viewport.height/2\n speed.push(4 + rand(5))\n end\n # creates logo\n @sprites[\"logo\"] = Sprite.new(@viewport)\n @sprites[\"logo\"].bitmap = pbBitmap(bitmaps[4])\n @sprites[\"logo\"].ox = @sprites[\"logo\"].bitmap.width/2\n @sprites[\"logo\"].oy = @sprites[\"logo\"].bitmap.height/2\n @sprites[\"logo\"].x = @viewport.width/2\n @sprites[\"logo\"].y = @viewport.height/2\n @sprites[\"logo\"].memorize_bitmap\n @sprites[\"logo\"].bitmap = pbBitmap(bitmaps[5])\n @sprites[\"logo\"].zoom_x = 2\n @sprites[\"logo\"].zoom_y = 2\n @sprites[\"logo\"].z = 50\n # creates flash ring graphic\n @sprites[\"ring\"] = Sprite.new(@viewport)\n @sprites[\"ring\"].bitmap = pbBitmap(bitmaps[6])\n @sprites[\"ring\"].ox = @sprites[\"ring\"].bitmap.width/2\n @sprites[\"ring\"].oy = @sprites[\"ring\"].bitmap.height/2\n @sprites[\"ring\"].x = @viewport.width/2\n @sprites[\"ring\"].y = @viewport.height/2\n @sprites[\"ring\"].zoom_x = 0\n @sprites[\"ring\"].zoom_y = 0\n @sprites[\"ring\"].z = 100\n # creates secondary particles\n for j in 0...32\n @sprites[\"e2_#{j}\"] = Sprite.new(@viewport)\n bmp = pbBitmap(bitmaps[3])\n @sprites[\"e2_#{j}\"].bitmap = bmp\n @sprites[\"e2_#{j}\"].oy = @sprites[\"e2_#{j}\"].bitmap.height/2\n @sprites[\"e2_#{j}\"].angle = rand(360)\n @sprites[\"e2_#{j}\"].opacity = 0\n @sprites[\"e2_#{j}\"].x = @viewport.width/2\n @sprites[\"e2_#{j}\"].y = @viewport.height/2\n @sprites[\"e2_#{j}\"].z = 100\n end\n # creates secondary flash ring\n @sprites[\"ring2\"] = Sprite.new(@viewport)\n @sprites[\"ring2\"].bitmap = pbBitmap(bitmaps[7])\n @sprites[\"ring2\"].ox = @sprites[\"ring2\"].bitmap.width/2\n @sprites[\"ring2\"].oy = @sprites[\"ring2\"].bitmap.height/2\n @sprites[\"ring2\"].x = @viewport.width/2\n @sprites[\"ring2\"].y = @viewport.height/2\n @sprites[\"ring2\"].visible = false\n @sprites[\"ring2\"].zoom_x = 0\n @sprites[\"ring2\"].zoom_y = 0\n @sprites[\"ring2\"].z = 100\n # first phase of animation\n for i in 0...32.delta_add\n @viewport.color.alpha -= 8/self.delta if @viewport.color.alpha > 0\n @sprites[\"logo\"].zoom_x -= (1/32.0)/self.delta\n @sprites[\"logo\"].zoom_y -= (1/32.0)/self.delta\n for j in 0...16\n next if j > i/4.delta_add\n if @sprites[\"e1_#{j}\"].ox < -(@viewport.width/2)\n speed[j] = 4 + rand(5)\n @sprites[\"e1_#{j}\"].opacity = 0\n @sprites[\"e1_#{j}\"].ox = 0\n @sprites[\"e1_#{j}\"].angle = rand(360)\n bmp = pbBitmap(bitmaps[3])\n @sprites[\"e1_#{j}\"].bitmap.clear\n w = bmp.width/(1 + rand(3))\n @sprites[\"e1_#{j}\"].bitmap.stretch_blt(Rect.new(0,0,w,bmp.height),bmp,Rect.new(0,0,bmp.width,bmp.height))\n end\n @sprites[\"e1_#{j}\"].opacity += speed[j]/self.delta\n @sprites[\"e1_#{j}\"].ox -= [1, speed[j]/self.delta].max\n end\n pbWait(1)\n end\n # configures logo graphic\n @sprites[\"logo\"].color = Color.white\n @sprites[\"logo\"].restore_bitmap\n @sprites[\"ring2\"].visible = true\n @sprites[\"bg2\"].visible = true\n @viewport.color = Color.white\n # final animation of background and particles\n for i in 0...144.delta_add\n if i >= 128.delta_add\n @viewport.color.alpha += 16/self.delta\n else\n @viewport.color.alpha -= 16/self.delta if @viewport.color.alpha > 0\n end\n @sprites[\"logo\"].color.alpha -= 16/self.delta if @sprites[\"logo\"].color.alpha > 0\n @sprites[\"bg\"].color.alpha -= 8/self.delta if @sprites[\"bg\"].color.alpha > 0\n for j in 0...16\n if @sprites[\"e1_#{j}\"].ox < -(@viewport.width/2)\n speed[j] = 4 + rand(5)\n @sprites[\"e1_#{j}\"].opacity = 0\n @sprites[\"e1_#{j}\"].ox = 0\n @sprites[\"e1_#{j}\"].angle = rand(360)\n bmp = pbBitmap(bitmaps[2])\n @sprites[\"e1_#{j}\"].bitmap.clear\n w = bmp.width/(1 + rand(3))\n @sprites[\"e1_#{j}\"].bitmap.stretch_blt(Rect.new(0,0,w,bmp.height),bmp,Rect.new(0,0,bmp.width,bmp.height))\n end\n @sprites[\"e1_#{j}\"].opacity += speed[j]/self.delta\n @sprites[\"e1_#{j}\"].ox -= [1, speed[j]/self.delta].max\n end\n for j in 0...32\n next if j > (i*2).delta_add\n @sprites[\"e2_#{j}\"].ox -= 16/self.delta\n @sprites[\"e2_#{j}\"].opacity += 16/self.delta\n end\n @sprites[\"ring\"].zoom_x += 0.1/self.delta\n @sprites[\"ring\"].zoom_y += 0.1/self.delta\n @sprites[\"ring\"].opacity -= 8/self.delta\n @sprites[\"ring2\"].zoom_x += 0.2/self.delta if @sprites[\"ring2\"].zoom_x < 3\n @sprites[\"ring2\"].zoom_y += 0.2/self.delta if @sprites[\"ring2\"].zoom_y < 3\n @sprites[\"ring2\"].opacity -= 16/self.delta\n @sprites[\"bg2\"].angle += 2/self.delta if $PokemonSystem.screensize < 2\n pbWait(1)\n end\n # disposes all sprites\n pbDisposeSpriteHash(@sprites)\n # fades viewport\n 8.delta_add.times do\n @viewport.color.red -= (255/8.0)/self.delta\n @viewport.color.green -= (255/8.0)/self.delta\n @viewport.color.blue -= (255/8.0)/self.delta\n pbWait(1)\n end\n @viewport.color = Color.black\n EliteBattle.set(:colorAlpha, 255)\n return true\n end", "def initialize\n @width = 800\n @width_tiles = @width / 32\n @height = 640\n @height_tiles = @height / 32\n @keys = []\n super(@width, @height, fullscreen = false)\n self.caption = \"Aetheris\"\n\n @spell = Gosu::Image.new(Utils.image_path_for(\"explosion\"), rect: [0, 0, 32 * 3, 32 * 3])\n @spell_cooldown = 0\n @game_name = Gosu::Image.from_text(\"Aetheris\", 100)\n @player = Player.new(self)\n @npc = NPC.new\n @player.warp(300, 200)\n @visibility = { fog: 3 }\n @map = Gosu::Image.new(\"images/map.jpg\")\n @low_grass = @map.subimage(32, 32 * 2, 22, 22)\n @camera = Camera.new(x: 0, y: 0, width: WIDTH, height: HEIGHT)\n @interacting = false\n @spell_avalanche_of_fire = nil\n end", "def command_333\n iterate_enemy_index(@params[0]) do |enemy|\n already_dead = enemy.dead?\n if @params[1] == 0\n enemy.add_state(@params[2], enemy) # changed here\n else\n enemy.remove_state(@params[2])\n end\n enemy.perform_collapse_effect if enemy.dead? && !already_dead\n end\n end", "def create_random_Ant\n\n myAnt = Ant.new\n\n myAnt.x = @x\n myAnt.y = @y\n myAnt.anthill = self\n rand_number = rand(3)\n if rand_number == 0\n myAnt = create_Forager(myAnt)\n elsif rand_number == 1\n myAnt = create_Builder(myAnt)\n else\n myAnt = create_Warrior(myAnt)\n \n end\n\n Meadow.instance.add_AntToCell(myAnt, @x, @y)\n @food -= 1 \n end", "def get_fleet_by_ship(ship_id_defender)\n fleet = FightingFleet.create(user: get_user_by_ship_id(ship_id_defender))\n fleet.ship_groups.each do |group|\n instance = Ship.find_by(:id => ship_id_defender).get_unit_instance(group.unit)\n group.number = instance.amount\n group.save\n end\n fleet.save\n return fleet\n end", "def update\n\t\t#ship movement\n\t\tif button_down?(Gosu::KbLeft)\n\t\t\t@ship.move_left\n\t\telsif button_down?(Gosu::KbRight)\n\t\t\t@ship.move_right\n\t\tend\n\t\t#missle tracking\n\t\tif @missles.length > 0\n\t\t\t@missles.each do |missle|\n\t\t\t\tif !missle.tracking\n\t\t\t\t\tasteroid = nil\n\t\t\t\t\t@asteroids.each do |a|\n\t\t\t\t\t\tif a.tracked == false\n\t\t\t\t\t\t\tif asteroid == nil\n\t\t\t\t\t\t\t\tasteroid = a\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tif asteroid.y - missle.y < a.y - missle.y\n\t\t\t\t\t\t\t\t\tasteroid = a\n\t\t\t\t\t\t\t\tend\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\t\tif asteroid != nil\n\t\t\t\t\t\tasteroid.track(true)\n\t\t\t\t\t\tmissle.track(asteroid)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t#asteroid creation\n\t\t\n\t\tif @asteroid_delay < Time.now and !@game_done and !@pause and @level_time - 7 >= Time.now\n\t\t\t@asteroids.push Asteroid.new(self, @level)\n\t\t\t#delay till next asteroid\n\t\t\t@asteroid_delay = Time.now + rand*2 + 0.1\n\t\tend\n\t\t#powerup creation\n\t\tif @level != 1\n\t\t\tif @powerup_delay < Time.now and !@game_done and !@pause\n\t\t\t\t@powerups.push PowerUp.new(self, @level)\n\t\t\t\t#delay till next powerup\n\t\t\t\t@powerup_delay = Time.now + 5\n\t\t\tend\n\t\tend\n\t\t#collision detection for asteroids\n\t\t@asteroids.each do |a|\n\t\t\t#collision detection for lasers\n\t\t\t@lasers.each do |laser|\n\t\t\t\tif are_touching?(laser, a)\n\t\t\t\t\ta.hit\n\t\t\t\t\t@asteroids.delete(a)\n\t\t\t\t\t@explosions.push Explosion.new(self, laser.x, laser.y)\n\t\t\t\t\t@lasers.delete(laser)\n\t\t\t\t\t@asteroids_hit += 1\n\t\t\t\tend\n\t\t\tend\n\t\t\t#collision detection for missles\n\t\t\t@missles.each do |missle|\n\t\t\t\tif are_touching?(missle, a)\n\t\t\t\t\ta.hit\n\t\t\t\t\t@asteroids.delete(a)\n\t\t\t\t\t@explosions.push Explosion.new(self, a.x, a.y)\n\t\t\t\t\tmissle.destroyed\n\t\t\t\t\t@missles.delete(missle)\n\t\t\t\t\t@asteroids_hit_missles += 1\n\t\t\t\tend\n\t\t\tend\n\t\t\t#collision detection for the ship\n\t\t\tif are_touching?(a, @ship)\n\t\t\t\t@explosions.push Explosion.new(self, a.x+5, a.y)\n\t\t\t\ta.hit\n\t\t\t\t@asteroids.delete(a)\n\t\t\t\tcheck = @ship.destroy\n\t\t\t\t#game over, all lives lost, and ship destroyed\n\t\t\t\tif check == -1\n\t\t\t\t\t@explosions.push Explosion.new(self, @ship.x+5, @ship.y)\n\t\t\t\t\t@game_done = true\n\t\t\t\t#loss of life\n\t\t\t\telsif check == 1\n\t\t\t\t\t@explosions.push Explosion.new(self, @ship.x+5, @ship.y)\n\t\t\t\t\t#creates a delay so you can see that you lost a life\n\t\t\t\t\t@sleep_clear = 1\n\t\t\t\tend\n\t\t\t\t#if check == 0 then ship simply lost shield powerup\n\t\t\tend\n\t\t\t#collision detection for buildings\n\t\t\t@buildings.each do |b|\n\t\t\t\tif are_touching?(a, b)\n\t\t\t\t\t@buildings.delete(b)\n\t\t\t\t\t#@asteroids.delete(a)\n\t\t\t\t\t@explosions.push Explosion.new(self, a.x+5, a.y)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t#collision detection for powerups\n\t\t@powerups.each do |p|\n\t\t\tif are_touching?(p, @ship)\n\t\t\t\t@powerups.delete(p)\n\t\t\t\t@ship.powerup(p.laser, p.is_shield)\n\t\t\tend\n\t\tend\n\t\t#game timer\n\t\tif @level_time < Time.now and !@pause and !@game_done\n\t\t\tif @level == $MaxLevel\n\t\t\t\t@game_done = true\n\t\t\t\t@win = true\n\t\t\telse\n\t\t\t\t@level += 1\n\t\t\t\t#restarts the timer for the next level\n\t\t\t\t@level_time = Time.now + $TimeLimit\n\t\t\t\tnext_level\n\t\t\t\t@display_new_level_timer = Time.now + 1\n\t\t\tend\n\t\t\t\t\n\t\tend\n\t\t#end game if you've missed too many asteroids\n\t\tif @asteroids_missed == $AsteroidDeath\n\t\t\t@game_done = true\n\t\tend\n\t\tif @buildings.empty?\n\t\t\t@game_done = true\n\t\tend\n\t\tif !@pause\n\t\t\t@total_time_played = Time.now - @start_time\n\t\tend\n\tend", "def %( enemy )\n lettuce = rand( charisma )\n puts \"[Healthy lettuce gives you #{ lettuce } life points!!]\"\n @life += lettuce\n fight( enemy, 0 )\n end", "def %( enemy )\n lettuce = rand( charisma )\n puts \"[Healthy lettuce gives you #{ lettuce } life points!!]\"\n @life += lettuce\n fight( enemy, 0 )\n end", "def add_nova_entidade\r\n\t\tif (Gosu::milliseconds - @ultimo_tempo ) / rand(20 ... 2500) == 1 \r\n\t\t\ttipo_proj = rand(0 ... Meteoros.length )\r\n\t\t\timg_size = Gosu::Image.new(Meteoros[rand(0 ... Meteoros.length )]).width\r\n\t\t\t@entidades << Projetil.new( rand(4 ... (Std_Width_Game-(2*img_size))) , 1, 0, Gosu::Image.new(Meteoros[tipo_proj]), rand(50 ... 300), Meteoros[tipo_proj])\r\n\t\t\t@ultimo_tempo = Gosu::milliseconds\r\n\t\tend\r\n\tend", "def generate_ocean\n @ships.each do |ship|\n @ocean[ship.coords[0]][ship.coords[1]] = \"S\" \n end\n end", "def %(enemy)\n lettuce = rand(charisma)\n puts \"[healthy lettuce gives you #{lettuce} life points]\"\n @life +=lettuce\n fight(enemy, 0)\n end", "def openShop\n @n_bidders.times{\n name = \"\"\n rand(5..9).times{\n name << @name_chars[rand(36)]\n }\n @punters[name] = if rand() > 0.49 then [@wealth + rand((@spread/3)).ceil, nil]\n else [@wealth - rand((2*@spread)).floor, nil]\n end\n }\n newItem\n print \"Shop's open!\\n\"\n end", "def aide2()\n indice = IndiceMoyen.create(@map)\n res = indice.envoyerIndice.indice.split(\"-\")\n\n x=res[0].to_i\n y=res[1].to_i\n if res[2]==\"0\"\n @map.putAt!(x,y,Case.create(2))\n changeImage(@buttonTab[x][y],\"../images/cases/croix.png\")\n else\n @map.putAt!(x,y,Case.create(1))\n @map.accessAt(x,y).color=1;\n changeImage(@buttonTab[x][y],\"../images/cases/noir.png\")\n end\n @timePress[x][y]+=1\n @timer.add(60)\n if @map.compare\n victoire()\n end\n end", "def buy_fish(name) # expect(owner.pets[:fishes].count).to eq(0)\n new_fish = Fish.new(name) # owner.buy_fish(\"Bubbles\")\n self.pets[:fishes] << new_fish # owner.pets[:fishes].each { |fish| expect(fish).to be_a(Fish)}\n new_fish # expect(owner.pets[:fishes].count).to eq(1)\n # = knows about its fishes; Owner knows all about its pets - Owner sets name of pet, the pet can\\'t change its name\n # owner.buy_fish(\"Bubbles\")\n # expect(owner.pets[:fishes][0].name).to eq(\"Bubbles\")\n end", "def restart\n\t\t@x = $Width/2 - 15 #centers the ship\n\t\t@y = $Height - 100\n\t\t@exists = true\n\t\t@powerup_name = \"\"\n\t\t@laser_timeout = Time.now\n\t\t@shields = 0\n\t\t@missles = 0\n\tend", "def attacks(player)\n dice = compute_damage\n puts \"#{@name} attaque #{player.name} : Il lui inflige #{dice} points de dommages\"\n player.life_points = player.life_points - dice\n end", "def create_tower event\n if @money >= @tower_price\n ghost = GhostTower.new( Grid.screenp_to_elementp(event.pos) )\n if nice_place_for_tower?(ghost) \n @money -= @tower_price\n tower = Tower.new(@event_handler, Grid.screenp_to_elementp(event.pos), @enemies)\n @towers << tower\n end\n end\n end", "def %(enemy)\n lettuce = rand(charisma)\n puts \"[Healthy lettuce gives you #{lettuce} life points!!]\"\n @life += lettuce\n fight(enemy, 0)\n end", "def buy_fish(name)\n new_fish = Fish.new(name)\n self.pets[:fishes] << new_fish \n end", "def initialize(x, y, width, height, actor)\n super(x, y, width, height)\n @ucEquipItemsList = []\n window_update(actor)\n self.index = 0\n end", "def enemy_attack\n if enemies_in_sight.size!=0\n puts \"Les autres joueurs t'attaquent !\"\n puts \"\\n\"\n end\n\n enemies_in_sight.each do |enemy| enemy.attack(player1) \n gets.chomp\n end \n #player1.show_state\n end", "def show\n\t @lawyers = Lawyer.all\n @states = State.all\n\n @NumLaw = 0 # Contador de posições do vetor @AvailableLawyers\n @AvailableLawyers = []\n\n for i in 0..@lawyers.length-1 \n if ((@client.state).upcase).split == (@lawyers[i].state).split # Verificador Estado do cliente \n # = Estado do advogado \n @AvailableLawyers[@NumLaw] = @lawyers[i]\n @NumLaw += 1 \n end \n end \n\n if @AvailableLawyers.empty? # Se estiver vazio, retorna 0 e exibe na tela:\n #\"Desculpe, não possuímos nenhum advogado cadastrado no seu estado.\"\n @IdealLawyer = 0 \n \n else \n\n for j in 0..@states.length-1\n\n if @AvailableLawyers[0].state == @states[j].name\n\n save = j # Salva a posição do estado em questão\n break\n\n end \n end\n\n for i in 0..@AvailableLawyers.length-1\n\n if (@states[save].interaction ).to_i > @AvailableLawyers.length \n\n @states[save].interaction = \"1\" # Caso o número de interações exceder o limite, dá reset\n\n end \n\n if @AvailableLawyers[i].order == @states[save].interaction\n \n @IdealLawyer = @AvailableLawyers[i] # Retorno do advogado na mesma ordem da interação\n break\n\n end\n end \n \n @states[save].interaction = ((@states[save].interaction).to_i + 1).to_s # Crescendo a fila\n @states[save].save\n\n end\n end", "def unequip!\n self.slot = EquipSlot::Inventory\n self.save!\n end", "def add_to_inventory(item)\n @items << item\n equip(item)\n items_weight\n end", "def newGameSetup\r\n @experienceInt = 0 #Starting experience.\r\n @experience.clear { para(\"EXP: \" + @experienceInt.to_s, @style_stats) }\r\n @tierInt = 1 #Starting tier.\r\n @tier.clear{ para(\"TIER: \" + @tierInt.to_s, @style_stats) }\r\n @durability.clear { para(\"DUR: \" + @durabilityInt.to_s, @style_stats) }\r\n\r\n @oreTotal = Array.new(@tiers, 0) #Total number of ores for each tier.\r\n @oreRemaining = Array.new(@tiers, 0) #Remaining number of ores for each tier.\r\n @tierExp = Array.new(@tiers) #Total experience available for each tier of ore.\r\n @tile = Array.new(@columns){Array.new(@rows)} #Declares the 2D array to represent the grid.\r\n @hiddenCount = @columns * @rows\r\n @endState.clear\r\n\r\n #Generates the grid of buttons\r\n @board.clear do\r\n stack(width: (@columns * @tile_size)) do\r\n background(\"#000000\") #Sets the background to black.\r\n border(\"#CE8\", strokewidth: 1)\r\n\r\n (0..@rows-1).each do |row|\r\n flow(width: 1.0) do\r\n (0..@columns-1).each do |col|\r\n @btn = button(width: @tile_size, height: @tile_size) {\r\n mineTile(col,row)\r\n }\r\n @tile[col][row] = Tile.new(@btn)\r\n end\r\n end\r\n end\r\n end\r\n end\r\n\r\n @endGame = false\r\n\r\n generateOres #Generates the ores into the grid.\r\n calculateAdjacent #Calculates all adjacent values of every tile.\r\n\r\nend", "def buy_fish(name)\n pets[:fishes] << Fish.new(name)\n end", "def hatch\n @status = Idle\n @target = nil\n @virility = 0\n babies = []\n rand(MaxBabiesFromEgg).to_i.times {babies << baby_salmon}\n babies\n end", "def create_new_player\n @player = Player.new(self, nil, ServerConfig.start_room, @new_name, [], \"a typical person\", \"This is a normal, everyday kind of person.\", \"person\", @sex)\n @player.word_wrap = nil\n\n # TODO remove following lines\n require 'aethyr/extensions/objects/clothing_items' #why not\n require 'aethyr/extensions/objects/sword'\n shirt = Shirt.new\n pants = Pants.new\n undies = Underwear.new\n sword = Sword.new\n\n $manager.add_object(shirt)\n $manager.add_object(undies)\n $manager.add_object(pants)\n $manager.add_object(sword)\n\n @player.inventory << shirt\n @player.inventory << pants\n @player.inventory << undies\n @player.inventory << sword\n\n @player.wear(undies)\n @player.wear(pants)\n @player.wear(shirt)\n\n if @player.name.downcase == ServerConfig.admin.downcase\n @player.instance_variable_set(:@admin, true)\n end\n\n $manager.add_player(@player, @new_password)\n\n File.open(\"logs/player.log\", \"a\") { |f| f.puts \"#{Time.now} - #{@player.name} logged in.\" }\n\n @state = nil\n\n output(\"Type HELP HELP for help.\")\n end", "def ship; end", "def expand\n return false if legs.length < 2\n \n trip = device.trips.create\n trip.legs << legs.last\n trip.tags = self.tags\n trip.update_precalc_fields\n \n self.legs.reload\n self.update_precalc_fields\n \n trip\n end", "def create_starting_items\n items.create name: \"Starter item\", attack: 5, defense: 5, life: 10, experience_bonus: 0\n end", "def setup(troop_id)\n # Set array of enemies who are set as troops\n @enemies = []\n troop = $data_troops[troop_id]\n for i in 0...troop.members.size\n enemy = $data_enemies[troop.members[i].enemy_id]\n if enemy != nil\n @enemies.push(Game_Enemy.new(troop_id, i))\n end\n end\n end", "def continue\n\n inventory_with_leisure = expected_inventory.dup\n inventory_with_leisure[:leisure] = 1\n\n inventory_with_fishing = expected_inventory.dup\n # TODO: DRY up this logic with Person#catch_fish\n inventory_with_fishing[:fish] += @skills[:fish]\n\n #p '@'*88\n #p inventory_with_fishing\n #p rank_potential_inventory(inventory_with_fishing)\n #p '@'*88\n #p inventory_with_leisure\n #p rank_potential_inventory(inventory_with_leisure)\n #p '@'*88\n if rank_potential_inventory(inventory_with_fishing) < rank_potential_inventory(inventory_with_leisure)\n catch_fish\n @last_activity = :catch_fish\n else\n @last_activity = :leisure\n end\n\n\n eat # or starve\n end", "def create\n @expedition = Expedition.new(expedition_params)\n @userFuelFactor = 1 + (0.1 * current_user.science_instances.find_by(:science_id => Science.find_by(:name => \"Triebwerke\").id).level)\n\n if(params[Unit.find_by_name(\"Expeditionsschiff\").id.to_s].to_i < 1)\n redirect_to expeditions_url, alert: 'Mindestens 1 Expeditionsschiff wird benötigt.'\n return\n end\n\n Unit.all.each do |unit|\n instance = current_user.active_ship.get_unit_instance(unit)\n if instance.amount < params[unit.id.to_s].to_i\n redirect_to expeditions_url, alert: 'Nicht genügend Schiffe.'\n return \n end\n end\n\n fuelcost = 0\n\n Unit.all.each do |unit|\n fuelcost += (unit.shell + unit.cargo) * params[unit.id.to_s].to_i\n end\n\n fuelcost = (fuelcost * params[:exp_time].to_i/@userFuelFactor)\n\n userShip = current_user.active_ship\n\n if(userShip.fuel < fuelcost)\n string = \"Nicht genügend Treibstoff um diese\n Flotte loszuschicken. Benötigt wird: \" + fuelcost.to_i.to_s + \" Treibstoff\"\n redirect_to expeditions_url, alert: string\n return\n end\n\n @expedition.ship_id = userShip.id\n @expedition.explore_time = params[:exp_time].to_i\n @expedition.arrival_time = Time.now + 3600 * (2 + @expedition.explore_time) \n\n @expedition.fighting_fleet= FightingFleet.create(user: current_user)\n Unit.all.each do |unit|\n ship_group = @expedition.fighting_fleet.ship_groups.find_by(:unit_id => unit.id)\n ship_group.number = params[unit.id.to_s].to_i\n ship_group.save\n\n instance = current_user.active_ship.get_unit_instance(unit)\n instance.amount -= ship_group.number\n instance.save\n end\n\n userShip.fuel -= fuelcost\n userShip.save\n\n respond_to do |format|\n if @expedition.save\n ExpeditionInstance.create(user: current_user, expedition_id: @expedition.id)\n format.html { redirect_to @expedition, notice: 'Expedition was successfully created.' }\n format.json { render :show, status: :created, location: @expedition }\n else\n format.html { render :new }\n format.json { render json: @expedition.errors, status: :unprocessable_entity }\n end\n end\n end", "def spawnAnt\n\t\tant = Ant.new(@anthill)\n\t\tcase @type\n\t\twhen \"builder\"\n\t\t\tclass << ant\n\t\t\t\tdef setAnt\n\t\t\t\t\t@ant_type = \"builder\"\n\t\t\t\tend\n\t\t\t\tdef execute(room_type)\n\t\t\t\t\tanthill.food -= 1 #builder ant consumes 1 piece of food to create a new room\n\t\t\t\t\troom = Room.new(@anthill, room_type) #creates a room based on the room_type (determined by the anthill strategy)\n\t\t\t\t\t@alive = false #dies after the room is created\n\t\t\t\t\t@anthill.builders_count -= 1\n\t\t\t\t\troom\n\t\t\t\tend\n\t\t\tend\n\t\t\tant.setAnt\n\t\twhen \"warrior\"\n\t\t\tclass << ant\n\t\t\t\tdef setAnt\n\t\t\t\t\t@ant_type = \"warrior\"\n\t\t\t\t\t@symbol = \"^\".colorize(:background => @anthill.color)\n\t\t\t\tend\n\t\t\t\tdef execute(cell)\n\t\t\t\t\tif(cell.hill == nil)\n\t\t\t\t\t\tif(cell.ants.length > 0)\n\t\t\t\t\t\t\tcell.ants.each{|ant|\n\t\t\t\t\t\t\t\tif(ant.anthill != self.anthill && ant.alive == true)\n\t\t\t\t\t\t\t\t\tif(ant.ant_type == \"warrior\")\n\t\t\t\t\t\t\t\t\t\t#If the warrior kills the other warrior, it gains +2 xp, otherwise the other ant gains xp\n\t\t\t\t\t\t\t\t\t\tresult = interactWarrior(ant)\n\t\t\t\t\t\t\t\t\t\tif(result == 1)\n\t\t\t\t\t\t\t\t\t\t\tant.alive = false\n\t\t\t\t\t\t\t\t\t\t\tcell.ants.delete(ant)\n\t\t\t\t\t\t\t\t\t\t\tant.anthill.warriors_count -= 1\n\t\t\t\t\t\t\t\t\t\t\t@xp += 2\n\t\t\t\t\t\t\t\t\t\telsif(result == 2)\n\t\t\t\t\t\t\t\t\t\t\tself.alive = false\n\t\t\t\t\t\t\t\t\t\t\tcell.ants.delete(self)\n\t\t\t\t\t\t\t\t\t\t\t@anthill.warriors_count -= 1\n\t\t\t\t\t\t\t\t\t\t\tant.xp += 2\n\t\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\t#If the warrior kills the forager, it gains +1 xp, otherwise the forager gains xp\n\t\t\t\t\t\t\t\t\tif(ant.ant_type == \"forager\")\n\t\t\t\t\t\t\t\t\t\tresult = interactForager(ant)\n\t\t\t\t\t\t\t\t\t\tif(result == 1)\n\t\t\t\t\t\t\t\t\t\t\tant.alive = false\n\t\t\t\t\t\t\t\t\t\t\tcell.ants.delete(ant)\n\t\t\t\t\t\t\t\t\t\t\tant.anthill.foragers_count -= 1\n\t\t\t\t\t\t\t\t\t\t\t@xp += 1\n\t\t\t\t\t\t\t\t\t\telsif\n\t\t\t\t\t\t\t\t\t\t\tant.xp += 1\n\t\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\tend\n\t\t\t\t\t#If the warrior destroys an anthill, it gets the food and color(not as main color) of it\n\t\t\t\t\telsif(cell.hill != @anthill)\n\t\t\t\t\t\tresult = interactAnthill(cell)\n\t\t\t\t\t\tif(result == 1)\n\t\t\t\t\t\t\t@symbol = \"^\".colorize(:color => cell.hill.color,:background => @anthill.color).underline\n\t\t\t\t\t\t\t@anthill.food += cell.hill.food\n\t\t\t\t\t\t\tcell.hill.isAlive = false\n\t\t\t\t\t\t\tcell.hill = nil\n\t\t\t\t\t\t\t@xp += 5\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tself.alive = false\n\t\t\t\t\t\t\tcell.ants.delete(self)\n\t\t\t\t\t\t\t@anthill.warriors_count -= 1\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tdef interactWarrior(warrior)\n\t\t\t\t\thit1 = rand(self.xp * self.xp)\n\t\t\t\t\thit2 = rand(warrior.xp * warrior.xp)\n\t\t\t\t\t#The warrior with the greatest hit wins\n\t\t\t\t\tif (hit1 > hit2)\n\t\t\t\t\t\treturn 1\n\t\t\t\t\telsif (hit2 > hit1)\n\t\t\t\t\t\treturn 2\n\t\t\t\t\telse\n\t\t\t\t\t\treturn 0\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\tdef interactForager(forager)\n\t\t\t\t\tchance = rand(2)\n\t\t\t\t\t#The forager has 50% chance of living\n\t\t\t\t\tif (chance == 1)\n\t\t\t\t\t\treturn 1\n\t\t\t\t\tend\n\t\t\t\t\treturn 0\n\t\t\t\tend\n\n\t\t\t\tdef interactAnthill(cell)\n\t\t\t\t\tanthill = cell.hill\n\t\t\t\t\thit = rand(5)\n\t\t\t\t\t#The warrior has 20% chance of destroying the anthill\n\t\t\t\t\tif (hit == 4)\n\t\t\t\t\t\treturn 1\n\t\t\t\t\tend\n\t\t\t\t\treturn 0\n\t\t\t\tend\n\t\t\tend\n\t\t\tant.setAnt\n\t\twhen \"forager\"\n\t\t\tclass << ant\n\t\t\t\tdef setAnt\n\t\t\t\t\t@ant_type = \"forager\"\n\t\t\t\t\t@symbol = \"~\".colorize(:background => @anthill.color)\n\t\t\t\tend\n\t\t\t\tdef execute(cell)\n\t\t\t\t\tif(cell.ants.length > 0)\n\t\t\t\t\t\tcell.ants.each{|ant|\n\t\t\t\t\t\t\tif(ant.anthill != self.anthill && ant.alive == true)\n\t\t\t\t\t\t\t\tif(ant.ant_type == \"warrior\")\n\t\t\t\t\t\t\t\t\t#If forager escapes the warrior, it gains +1 xp, otherwise it dies\n\t\t\t\t\t\t\t\t\tresult = interactWarrior(ant)\n\t\t\t\t\t\t\t\t\tif(result == 1)\n\t\t\t\t\t\t\t\t\t\t@xp += 1\n\t\t\t\t\t\t\t\t\telsif(result == 2)\n\t\t\t\t\t\t\t\t\t\tself.alive = false\n\t\t\t\t\t\t\t\t\t\tcell.ants.delete(self)\n\t\t\t\t\t\t\t\t\t\t@anthill.foragers_count -= 1\n\t\t\t\t\t\t\t\t\t\tant.xp += 1\n\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t}\n\t\t\t\t\t\t#If the forager manages to collect 2 or more foods, each food it collects will be counted double\n\t\t\t\t\t\tif(cell.food == 1)\n\t\t\t\t\t\t\tif(@xp >= 2)\n\t\t\t\t\t\t\t\t@anthill.food += 2\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t@anthill.food += 1\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tcell.food = 0\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tdef interactWarrior(warrior)\n\t\t\t\t\tchance = rand(2)\n\t\t\t\t\t#The forager has 50% chance of living\n\t\t\t\t\tif (chance == 1)\n\t\t\t\t\t\treturn 1\n\t\t\t\t\tend\n\t\t\t\t\treturn 0\n\t\t\t\tend\n\t\t\tend\n\t\t\tant.setAnt\n\t\tend\n\t\tant\n\tend", "def adopt_pet_from_shelter(animal_name, animal_instance_name, shelter_instance_name)\n @number_of_pets = @number_of_pets + 1\n @pets[animal_name] = animal_instance_name\n shelter_instance_name.animals.delete(animal_name)\n end", "def alien_hit(alien, bullet)\r\n # Deleting the alien and the bullet object\r\n @aliens.delete alien\r\n @bullets.delete bullet\r\n @explode = true\r\n @player.update_score()\r\n # Setting the coordinates for the explosion\r\n @explode_x = alien.x\r\n @explode_y = alien.y\r\n @explosion_sound.bmp.play \r\n end", "def fleet_params\n params.require(:fleet).permit(:credit, :ressource_capacity, :ore, :crystal, :storage_factor, :velocity_factor, :offense, :defense, :user_id, :mission_id, :departure_time, :arrival_time, :start_planet, :target_planet)\n end", "def offices\n \n end", "def new_game\n\n enter_name\n nter_name\n user_name = gets.chomp\n current_user = find_or_add_user(user_name)\n space\n element = prompt.select('What is your element?', [\"Water\", \"Earth\", \"Air\"])\n current_user.update(element: element)\n space\n space\n\n ### intro method ###\n\nend", "def aliens\n self.populations.map do |pop|\n pop.alien\n end\n end", "def buy_fish(name)\n @pets[:fishes] << Fish.new(name)\n end", "def create_item(index)\n item = @data[index]\n rect = item_rect(index, true)\n\n case index\n when 0\n if @actor.two_swords_style\n kindDesc = Vocab::weapon1\n else\n kindDesc = Vocab::weapon\n end\n when 1\n if @actor.two_swords_style\n kindDesc = Vocab::weapon2\n else\n kindDesc = Vocab::armor1\n end\n when 2\n kindDesc = Vocab::armor2\n when 3\n kindDesc = Vocab::armor3\n when 4\n kindDesc = Vocab::armor4\n end\n \n rect.y += WLH*index \n equipItem = UCEquipItem.new(self, item, rect, kindDesc)\n \n f = Font.new()\n f.color = system_color\n equipItem.cEquipKind.font = f\n return equipItem\n end", "def consume_item(type, id)\n action = eval(type + '_Need_Items.dup')\n equipment = eval(type + '_Need_Equiped.dup')\n if action.include?(id)\n for need in action[id]\n $game_party.lose_item(need[1], need[2]) if need[0] == 'i' \n $game_party.lose_armor(need[1], need[2]) if need[0] == 'a' \n $game_party.lose_weapon(need[1], need[2]) if need[0] == 'w' \n end\n end\n if equipment.include?(id)\n if $atoa_script['Atoa Multi Slot']\n for need in equipment[id]\n equipments = armors.dup if need[0] == 'a'\n equipments = weapons.dup if need[0] == 'w'\n for i in 0...equips.size\n if action_id(equip[i]) == need[1]\n equip(i, 0)\n $game_party.lose_armor(need[1], need[2]) if need[0] == 'a'\n $game_party.lose_weapon(need[1], need[2]) if need[0] == 'w'\n equip(i, equip[i].id)\n end\n end\n end\n else\n for need in equipment[id]\n equipments = armors.dup if need[0] == 'a'\n equipments = weapons.dup if need[0] == 'w'\n for equip in equipments\n if equip.type_name == 'Weapon'\n type = 0\n else\n type = 1 if equip.id == @armor1_id\n type = 2 if equip.id == @armor2_id\n type = 3 if equip.id == @armor3_id\n type = 4 if equip.id == @armor4_id\n end\n if action_id(equip) == need[1]\n equip(type, 0)\n $game_party.lose_armor(need[1], need[2]) if need[0] == 'a'\n $game_party.lose_weapon(need[1], need[2]) if need[0] == 'w'\n equip(type, equip.id)\n end\n end\n end\n end\n end\n end" ]
[ "0.6533823", "0.5957225", "0.5903877", "0.5743698", "0.5684314", "0.56683844", "0.56669354", "0.56624097", "0.5655215", "0.5651407", "0.5649855", "0.5638109", "0.5629744", "0.55864453", "0.55712163", "0.5549444", "0.55309695", "0.55247116", "0.5504321", "0.54954064", "0.54801226", "0.54748046", "0.5457747", "0.5451017", "0.5445209", "0.54406166", "0.54236877", "0.5416388", "0.5407012", "0.53969574", "0.5392336", "0.5357659", "0.5350763", "0.53367126", "0.533259", "0.533154", "0.5316153", "0.53085274", "0.5307529", "0.5299675", "0.52983105", "0.5289053", "0.5276872", "0.5271363", "0.52710986", "0.52680814", "0.5262539", "0.52621555", "0.52607715", "0.52595377", "0.52587426", "0.52464026", "0.5245297", "0.52441674", "0.5241945", "0.5236479", "0.5235908", "0.52346134", "0.522827", "0.5218372", "0.5215109", "0.52007914", "0.5199558", "0.5199558", "0.51942796", "0.5190873", "0.5185218", "0.5184177", "0.5181402", "0.5181116", "0.51794547", "0.5179347", "0.5179295", "0.5176492", "0.51717997", "0.5167238", "0.5161755", "0.5160095", "0.5159046", "0.5158608", "0.5152873", "0.51454794", "0.5143138", "0.51410735", "0.5138114", "0.5136001", "0.5127119", "0.51269215", "0.512124", "0.5119294", "0.51187205", "0.51141435", "0.5108809", "0.51054347", "0.5097443", "0.5089257", "0.5089238", "0.50856864", "0.50827783", "0.50814945" ]
0.8170831
0
Procedure to generate aliens
def generate_aliens(position, height) # Looping until the number of Aliens in a fleet is reached for i in 0...@alien_count @aliens.push(Alien.new(i, position, height)) @alien_sound.bmp.play end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def alias_generator(agent)\n\n# changes vowels into array and uses .reverse method to account \n# for edge cases\n\tvowels = \"aeiou\"\n\tnew_vowels = \"aeiou\".split('').reverse\n\n# changes consonants into array and uses .reverse method to account\n# for edge cases\n\tconsonants = \"bcdfghjklmnpqrstvwxyz\"\n\tnew_consonants = \"bcdfghjklmnpqrstvwxyz\".split('').reverse\n\n# defines variables for user input and parameter\n\treal_name = agent\n\n# swaps first and last names and turns them into arrays \n\treversed_real_name = real_name.downcase.split(' ').reverse\n \talias_name_array = reversed_real_name.join(' ').split('')\n\n # maps the new array through the indices of the vowel and consonant arrays\n \taltered_name = alias_name_array.map do |char| \n if vowels.include?(char)\n # if there is a vowel, it will map to the next vowel\n new_vowels[new_vowels.index(char)-1]\n elsif consonants.include?(char)\n # if there is a consonant, it will map to the next consonant\n new_consonants[new_consonants.index(char)-1]\n else\n # accounts for space or another character\n char\n end\n end \n\n# takes the newly mapped array, joins it back together and capitalizes it\n\tnew_alias = altered_name.join.split.map!{ |name| name.capitalize }.join(\" \")\nend", "def alias_generator(name)\n\nname = name.downcase\n\nvowels_lowcase = %w(a e i o u)\nvowels = vowels_lowcase\nconsonants_lowcase = (\"a\"..\"z\").to_a - vowels\nconsonants = consonants_lowcase\n\n# original = (vowels + consonants)\n# new_letters = (vowels.rotate + consonants.rotate)\n\nname_array = name.split\nname_reverse = name_array.reverse\n\nname_reverse.map! do |word|\n word_split = word.split(\"\")\n # name_reverse[1].split(\"\")\n\n word_split.map! do |letter|\n if vowels.include? letter\n index = vowels.index(letter)\n if letter == vowels.last\n letter = vowels.first\n else\n letter = vowels[index + 1]\n end\n else\n index = consonants.index(letter)\n if letter == consonants.last\n letter = consonants.first\n else\n letter = consonants[index + 1]\n end\n end\n end\n\n word_split[0] = word_split[0].upcase\n word_split.join('')\nend\n\nname_reverse.join(' ')\n# # p name_reverse.tr(original,new_letters)\n\n\n\nend", "def alias_generator(name)\n name_ord_reversed = name.split(' ').reverse\n name_ord_reversed = name_ord_reversed.join(\" \")\n name_ord_reversed = name_ord_reversed.split('')\n p name_ord_reversed\n vowels = \"aeiou\"\n vowels_array = vowels.split('')\n p vowels_array\n consonants = \"bcdfghjklmnpqrstvwxyz\"\n consonants_array = consonants.split('')\n p consonants_array\n index = 0 \n until index >= name.length do\n new_alias = []\n letter = name_ord_reversed[index]\n if letter == \" \"\n new_alias << letter\n elsif vowels.include? letter\n new_letter = vowels[index+1]\n new_alias << new_letter\n elsif consonants.include? letter\n new_letter = consonants[index+1]\n new_alias << new_letter\n end \n index += 1 \n end \n \n \n \n\n \nend", "def alias_creator(name)\n name.downcase!\n name_array = name.split(' ')\n name_array.reverse!\n # insert method for changing vowels here\n post_vowels = next_vowel(name_array)\n # insert method for changing consonants here#\n new_name = next_consonant(post_vowels)\n # re-capitalize the first letter of each name\n new_name.map! {|word| word.capitalize}\n # take our array and turn it into a string\n puts \"Your automatically generated alias is:\"\n p new_name * \" \"\nend", "def fake_identities(real_name)\n\n # input is downcase, split, and has reverse positions\n new_alias = real_name.downcase.split(' ').reverse\n # use map! to mutate name\n new_alias.map! {|name_info| name_info.split('')}\n\n new_alias.map! do |name_info|\n name_info.map! do |vowel|\n\n if vowel == \"z\"\n vowel = \"a\"\n elsif next_vowels(vowel) == vowel\n vowel.next!\n if next_vowels(vowel) != vowel\n vowel.next!\n end\n vowel\n else\n next_vowels(vowel)\n end\n end\n # returns a string and capitalizes first letter\n name_info.join('').capitalize\n end\n new_alias.join(' ') # keeps blank space here, otherwise it doesnt work\nend", "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", "def secret_alias_maker(secret_name)\n reverse_name = swapping_names(secret_name)\n char = reverse_name.split('')\n char_swapped_vowels = swapping_vowels(char)\n added_to_array = swapping_consonents(char_swapped_vowels)\n added_to_array.join('')\nend", "def alias_genrator\n done = false\n real_names = []\n spy_names = []\n\n puts \"Welcome to the super secret alias name generator. What is your full name?\"\n real_name = gets.chomp.downcase\n\n until done\n done = false\n\n real_name_array = real_name.split(' ') # Turn name into array\n\n real_first_name = real_name_array[0].capitalize # Gets and capitalizes first string in real_first_name\n real_last_name = real_name_array.last.capitalize # Gets and capitalizes last string in real_first_name\n\n real_names << real_first_name + \" \" + real_last_name # Stores real name to an array\n\n name_letters = real_name.split('') # Turns user input into array of letters\n\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n consonants = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\", \"y\", \"z\" ]\n\n index = 0\n name_letters.each do |letter| # Checks each letter in name_letters to see if the letter is in the vowels array\n if letter == \"u\"\n name_letters[index] = \"a\"\n elsif\n if vowels.include?(letter) # If it is, store the index of the vowel plus one\n vowel_index = vowels.index(letter)+1\n name_letters[index] = vowels[vowel_index] # Store the new letter in the corresponding index of name_letters\n end\n end\n index+=1\n end\n\n index = 0\n name_letters.each do |letter| # Checks each letter in name_letters to see if the letter is in the consonants array\n if letter == \"z\"\n name_letters[index] = \"b\"\n elsif\n if consonants.include?(letter) # If it is, store the index of the consonants plus one\n consonant_index = consonants.index(letter)+1\n name_letters[index] = consonants[consonant_index] # Store the new letter in the corresponding index of name_letters\n end\n end\n index+=1\n end\n\n new_full_name = name_letters.join('').split(' ') # Joins the new letters of name_letters and splits it into two strings\n\n # In case spy's real name includes a middle name\n first_name = new_full_name[0].capitalize # Gets and capitalizes first string in new_full_name\n last_name = new_full_name.last.capitalize # Gets and capitalizes last string in new_full_name\n\n alias_name = last_name + \" \" + first_name\n\n spy_names << alias_name # Stores alias into an array\n\n p \"Great, your cool new alias is #{alias_name}! Enter another name or type 'done' to exit.\"\n answer = gets.chomp.downcase\n\n if answer == \"done\" # Checks if user is done\n done = true\n else\n real_name = answer\n end\n end\n\n num_of_spies = real_names.length # Gets the number of spies\n counter = 0\n\n while counter < num_of_spies\n p \"#{spy_names[counter]} is really #{real_names[counter]}\" # Prints spies real names and aliases\n counter+=1\n end\nend", "def create_alias(real_name)\n\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n consonants = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\",\n \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\",\n \"v\", \"w\", \"x\", \"y\", \"z\"]\n\n # takes the real name, splits into words, reverses the order, joins into string again, and lowercases\n reversed_lowcase_str = real_name.split(\" \").reverse.join(\" \").downcase\n name_char_array = reversed_lowcase_str.chars\n fake_name_char_arr = name_char_array.map! do |letter|\n if letter == \" \"\n letter\n elsif letter == \"u\"\n letter = \"a\"\n elsif letter == \"z\"\n letter = \"b\"\n elsif vowels.include?(letter)\n letter = vowels[vowels.index(letter) + 1] # assigns the letter to be the next vowel\n elsif consonants.include?(letter)\n letter = consonants[consonants.index(letter) + 1]\n end\n end\n\n# rejoins the character array into one string, splits it into word array,\n# capitalizes each word, rejoins into string\n fake_name = fake_name_char_arr.join(\"\").split(\" \").map!{|name| name.capitalize}.join(\" \")\nend", "def aliens\n self.populations.map do |pop|\n pop.alien\n end\n end", "def alias_creator (str)\n# downcase all characters incase the name had initial caps.\nstr = str.downcase\t\n\n# create vowel string for cross checking each character (I ADDED 3 REPEATING VOWEL SEGMENTS TO PREVENT EDGE CASE FROM BREAKING WHEN ENCODING A VOEWEL AT THE END OF THE STRING LIKE U in \"AEIOU\") \nvowels = \"aeiouaeiouaeiou\"\n# create consonant string for cross checking each character\nconsonants = \"bcdfghjklmnpqrstvwxz\"\n# create empty strings that encoded first and last names will be stored in.\nname_alias = \"\"\n# create empty string to create an encoded full name \nspy_alias = \"\"\n=begin encoding names \n 1.taking the first name string and iterate through each character \n 2. check if vowels string includes current character in first name string\n 3. if it does access the letter in vowels string by its index, increment that index by one\n add that new letter to the alias string. \n 4. if the current character is a consonant it will go through the same process but using the consonants string\n 5. if the current character is a space a space will be added to the encoded string. \n=end\n \n str.each_char do |char| \n \tif char == \" \"\n name_alias+= \" \"\n\n \telsif vowels.include?(char)\n \t\tname_alias += vowels[vowels.index(char).next]\n \n elsif consonants.include?(char)\n \tname_alias += consonants[consonants.index(char).next]\n\n \n\n end \n \t\n end\n # check if the string that was encoded was a full name or just a first or last name\n # if it is a full name. sperate the first and last name and reverse the order (Lastname Firstname)\n \n if name_alias.include?(\" \")\n swap_name = name_alias.split(\" \")\n spy_alias = swap_name[1] + \" \" +swap_name[0]\n else spy_alias = name_alias\n end \n \n \n return spy_alias\n\n\nend", "def create_alias(word)\n vowels_lower = ['a','e','i','o','u']\n vowels_upper = vowels_lower.map(&:upcase)\n consonants_lower = ['b','c','d','f','g','h','j','k','l','m','n','p','q','r','s','t','v','w','x','y','z']\n consonants_upper = consonants_lower.map(&:upcase)\n \nupdated_vowels = word.map do |char|\n case\n when vowels_lower.include?(char)\n vowels_lower.rotate(1)[vowels_lower.index(char)]\n when vowels_upper.include?(char)\n vowels_upper.rotate(1)[vowels_upper.index(char)]\n when consonants_lower.include?(char)\n consonants_lower.rotate(1)[consonants_lower.index(char)]\n when consonants_upper.include?(char)\n consonants_upper.rotate(1)[consonants_upper.index(char)]\n else (char)\nend\nend\nend", "def aliasMaker(name)\r\n\tnewName = []\r\n\tnewName2 = []\r\n\tvowels = [\"a\",\"e\",\"i\",\"o\",\"u\"]\r\n\tconsonants = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\", \"y\", \"z\"]\r\n\tstep1 = name.split(\" \")\r\n\ti = 0\r\n\tj = 0\r\n\r\n\twhile i <= step1.length\r\n\t\tnewName.push(step1[i])\r\n\t\ti += 1\r\n\tend\r\n\tnewName = newName.reverse\r\n\tnewName = newName.join(\" \")\r\n\tstep2 = newName\r\n\twhile j <= step2.length\r\n\t\tif isConsonant(step2[j]) == true\r\n\t\t\tnewName2.push(nextConsonant(step2[j]))\r\n\t\telsif isVowel(step2[j]) == true\r\n\t\t\tnewName2.push(nextVowel(step2[j]))\r\n\t\telse newName2.push(step2[j])\r\n\t\tend\r\n\t\tj += 1\r\n\tend\r\n\tanswer = newName2.join(\"\")\r\n\r\nend", "def synthesize(protein)\n adn = ''\n for a in (0..protein.length-1)\n aminoacido = protein[a,1]\n entropy = rand(100-10) + 10\n \n \n if (@aminoacidos.include?(aminoacido))\n \n adn = adn + @codons[aminoacido][entropy % (@codons[aminoacido].length)]\n end\n \n end\n @synthesize = adn\n end", "def generate(name); end", "def generate; end", "def generate; end", "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", "def alias\n puts \"Hello Agent, what is your name?\"\n original_name = gets.chomp.downcase\n\n# split first and last name into two arrays\n#swap first name and last name \n\n split_name = original_name.split\n reverse_name = split_name.reverse!\n \n #join back together in a string with a space\n new_name = reverse_name.join(\" \")\n \n\n# each character into it's own array\n\n letters = new_name.each_char.to_a\n#vowel logic\n#if a charcters = vowel then change to next vowel\n\n\n\n vowels = %w(a e i o u a)\n consonant = %w(b c d f g h j k l m n p q r s t v w x y z b)\n new_alias = letters.map do |letter|\n letter.next \n end\nputs new_alias.join('')\nend", "def aliass(full_name)\n\talphabet = \"bcdfghjklmnpqrstvwxyz\"\n\tvowels = \"aeiou\"\n\tnew_string = \"\"\n\n\t#break input word into array and iterate through each letter\n\t#if the letter is a vowel, take it and change it to next_vowel\n\t#if the letter is a consonant, take it and change it to consonant\n\t#else just add with no modification\n\tfull_name.split('').each do |letter|\n\t\tif vowels.include?(letter)\n\t\t\tnew_string += vowel(letter)\n\t\telsif alphabet.include?(letter)\n\t\t\tnew_string += consonant(letter)\n\t\telse\n\t\t\tnew_string += letter\n\t\tend\n\tend\n\t#transform this new string into an array\n\tnew_word = new_string.split(' ')\n\t#swap first and second word in array\n\tnew_word.reverse!\n\t#turn new word into string\n\tnew_word.map {|names| names.capitalize!}\n\tnew_string = new_word.join(\" \")\nend", "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", "def spy_alias2 full_name\n alphabet = {\n vowels: ['a','e','i','o','u'],\n consonants: ['b','c','d','f','g','h','j','k','l','m','n','p','q','r','s','t','v','w','x','y','z']\n }\n alias_name = full_name.downcase.split(' ').reverse!.join(' ').split(//)\n alias_name.map! do |letter|\n next_letter=letter\n if alphabet[:vowels].include?(letter)\n index=alphabet[:vowels].index(letter)\n if letter==alphabet[:vowels][-1]\n next_letter=alphabet[:vowels][0]\n else\n next_letter=alphabet[:vowels][index+1]\n end\n elsif alphabet[:consonants].include?(letter)\n index = alphabet[:consonants].index(letter)\n if letter==alphabet[:consonants][-1]\n next_letter=alphabet[:consonants][0]\n else\n next_letter=alphabet[:consonants][index+1]\n end\n end\n next_letter\n end\n alias_name=alias_name.join('').split(' ').map! {|name| name.capitalize}.join(' ')\nend", "def alias_creator(name_split)\r\n vowels = \"aeiou\"\r\n consonants = \"bcdfghjklmnpqrstvwxy\"\r\n\r\n name_split.map! do |string|\r\n if vowels.index(string) != nil\r\n new_vowel = vowels.index(string) + 1\r\n string = vowels[new_vowel]\r\n elsif consonants.index(string) != nil\r\n new_consonant = consonants.index(string) + 1\r\n string = consonants[new_consonant]\r\n else\r\n string = string\r\n end\r\n end\r\nend", "def aliass(full_name)\n alphabet = \"bcdfghjklmnpqrstvwxyz\"\n vowels = \"aeiou\"\n new_string = \"\"\n \n #break input word into array and iterate through each letter\n #if the letter is a vowel, take it and change it to next_vowel\n #if the letter is a consonant, take it and change it to consonant\n #else just add with no modification\n full_name.split('').each do |letter|\n if vowels.include?(letter)\n new_string += vowel(letter)\n elsif alphabet.include?(letter)\n new_string += consonant(letter)\n else\n new_string += letter\n end\n end\n #transform this new string into an array\n new_word = new_string.split(' ')\n #swap first and second word in array\n new_word.reverse!\n #turn new word into string\n new_word.map {|names| names.capitalize!}\n new_string = new_word.join(\" \")\n end", "def kid_generator; end", "def kid_generator; end", "def kid_generator; end", "def generate_identifier(sample)\n # Here, I will include every 'location adjective' and 'discovery' beginning with a vowel. These must all be preceeded by 'an'.\n if [\"alternative-timeline\", \"alternate-history\", \"ancient\", \"anachronistic\", \"arcane prophecy\", \"alien artifact\", \"enchanted sword\", \"otherworldly portal\", \"encrypted data feed\", \"exiled angel\"].include?(sample)\n \"an\"\n else\n \"a\"\n end\nend", "def alias_maker(fullname)\r\n\tfullname= fullname.downcase\r\n\treverse_name = fullname.split(' ').reverse!.join(' ')\r\n\tletter_array = reverse_name.split('') \r\n\tletter_array.map! do |char|\r\n\t\tif char == \"a\"\r\n\t\t\tchar = \"e\"\r\n\t\telsif char == \"e\"\r\n\t\t\tchar = \"i\"\r\n\t\telsif char == \"i\"\r\n\t\t\tchar = \"o\"\r\n\t\telsif char == \"o\"\r\n\t\t\tchar = \"u\"\r\n\t\telsif char == \"u\"\r\n\t\t\tchar =\"a\"\r\n\t\telsif char == \" \"\r\n\t\t\tchar = \" \"\r\n\t\telse\r\n\t\t\tif char.next == \"a\"\r\n\t\t\tchar = char.next!.next!\r\n\t\t\telsif char.next == \"e\"\r\n\t\t\tchar = char.next!.next!\r\n\t\t\telsif char.next == \"i\"\r\n\t\t\tchar = char.next!.next!\r\n\t\t\telsif char.next == \"o\"\r\n\t\t\tchar = char.next!.next!\r\n\t\t\telsif char.next == \"u\"\r\n\t\t\tchar = char.next!.next!\r\n\t\t\telse\t\r\n\t\t\t\tchar = char.next!\r\n\t\t\tend\r\n\t\tend\r\n\tend\r\n\tnew_name = letter_array.join\r\n\tfull_alias = new_name.split.map(&:capitalize).join(\" \")\r\nend", "def generate\n end", "def generating_ipa\n puts\n generating = \"Generating IPA\"\n puts bold(generating)\n puts generating.length.times.map {\"=\"}.join\n puts\n end", "def to_alias_chars(name_chars)\nname_chars.map! do |character|\n\tcharacter = character.downcase\n\tif character == \"a\"\n\t\tnext_vowel(character)\n\telsif character == \"e\"\n\t\tnext_vowel(character)\n\telsif character == \"i\"\n\t\tnext_vowel(character)\n\telsif character == \"o\"\n\t\tnext_vowel(character)\n\telsif character == \"u\"\n\t\tnext_vowel(character)\n\telse \n\t\tnext_consonant(character)\n\tend\nend\nend", "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", "def gen_rings\n ind = 0\n word = @full_key.dup\n CODE_WORD[@type].each do |i|\n CODE_WORD[@type].each do |j|\n c = word[ind]\n @alpha[c.chr] = \"#{i}#{j}\"\n @ralpha[\"#{i}#{j}\"] = c.chr\n ind += 1\n end\n end\n end", "def encrypt_name(name)\n\n\t\tvowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n\t\tconsonants = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"i\", \"j\", \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\", \"y\", \"z\"]\n\t\talias_name = \"\"\n\t\t\t\n\t\t\tname.each_char do |letter|\n\t\t\t# if the letter is inside the array called vowels\n\t\t\t\tif vowels.include?(letter)\n\t\t\t\t\t# replace the letter with the next vowel in the array\n\t\t\t\t\t# put it into alias_name\n\t\t\t\t\talias_name << vowels[vowels.index(letter)+1]\n\t\t\t\t# replace the letter with the next consonant in the array\n\t\t\t\t# put it into alias_name\n\t\t\t\telsif consonants.include?(letter)\n\t\t\t\t\talias_name << consonants[consonants.index(letter)+1]\n\t\t\t\t# put letter into alias_name\n\t\t\t\t# this is for the spaces\t\n\t\t\t\telse\n\t\t\t\t\talias_name << letter\t\n\t\t\t\tend\n\t\t\tend\n\t\t\n\t\talias_name.split.reverse.map(&:capitalize)*' '\n\nend", "def add_alien_fleet()\r\n # Only generate new fleet of aliens if the current count of fleets is less than @fleet_limit\r\n if rand(@random) == 0 and @fleet < @fleet_limit\r\n @fleet +=1\r\n position = rand(SCREEN_WIDTH/2)\r\n @height -= GAME_PRESET[\"space_fleet\"]\r\n # Calling the procedure to generate aliens\r\n generate_aliens(position, @height)\r\n end\r\n # If the aliens reach the top level of the screen bring then down\r\n if @height < 0.3\r\n @height = GAME_PRESET[\"initial_height\"]\r\n end \r\n end", "def aliass(full_name)\n\talphabet = \"bcdfghjklmnpqrstvwxyz\"\n\tvowels = \"aeiou\"\n\tnew_string = \"\"\n\n full_name.split('').each do |letter|\n \t\tif vowels.include?(letter)\n \t\t\tnew_string += vowel(letter)\n \t\telsif alphabet.include?(letter)\n \t\t\tnew_string += consonant(letter)\n \t\telse\n \t\t\tnew_string += letter\n \t\tend\nend\n#Transform this new string into an array\n#Swap first and second word in array\n#Turn new word into string\n#Create empty array outside of loop\nnew_word = new_string.split(' ')\n new_word.reverse!\n\nnew_word.map {|names| names.capitalize!}\nnew_string = new_word.join(\" \")\nend", "def alias_maker(name)\n \n consonants = \"bcdfghjklmnpqrstvwxz\"\n next_cons = \"cdfghjklmnpqrstvwxzb\"\n \n name.downcase.tr(consonants,next_cons)\n .tr('aeiouy', 'eiouya')\n .split.reverse.each {|word| word.capitalize!}\n .join(' ')\n\n # Separated methods on lines 24-27 for readability\n # First .tr changes all consonants to next\n # Second .tr changes all vowels to next vowel\n # Split names to reverse and capitalize them\n # Rejoin to a single string\n\nend", "def kid_generator=(_arg0); end", "def kid_generator=(_arg0); end", "def output_idmap(refseq_data, up)\n taxid = refseq_data[:taxid]\n gene_label_url = URI.escape(refseq_data[:gene_label])\n up = up.split(\"-\").first if up.index(\"-\") # with \"-\" means isoform's ID. expect to protein's ID\n\n unless $gene_up_list[\"#{refseq_data[:gene_rsrc]}:#{up}\"]\n $output_ttl.puts triple(\"<http://togogenome.org/gene/#{taxid}:#{gene_label_url}>\", \"rdfs:seeAlso\", \"upid:#{up}\")\n $output_ttl.puts triple(\"upid:#{up}\", \"rdf:type\", \"<http://identifiers.org/uniprot>\")\n $output_ttl.puts triple(\"upid:#{up}\", \"rdfs:seeAlso\", \"up:#{up}\")\n $output_ttl.puts triple(\"up:#{up}\", \"dct:publisher\", \"<http://identifirs.org/miriam.resource/MIR:00100134>\") # UniProt (www.uniprot.org)\n $output_ttl.puts triple(\"upid:#{up}\", \"rdfs:seeAlso\", \"tax:#{taxid}\")\n $gene_up_list[\"#{refseq_data[:gene_rsrc]}:#{up}\"] = true # to prevent duplicate output\n $taxid_list[taxid] = true\n end\nend", "def generate\n end", "def create_onfidoers(filename)\n\tlines = get_lines_from(filename)\n\t# iterate over each line and create a new onfidoer with the params\n\tlines.map do | line |\n params = get_params_from(line)\n onfidoer = Onfidoer.new(*params) # Have you ever seen this? It's called splat operator\n \"#{onfidoer.first_name} #{onfidoer.last_name}\"\n end\nend", "def next_consonants(vowel_name)\r\n\tconsonants = ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z']\r\n\tvowel_name = vowel_name.split('')\r\n\tconsonant_name = vowel_name.map do |consonant|\r\n\t if consonants.include?(consonant)\r\n\t consonants.rotate(1)[consonants.index(consonant)]\r\n\t else\r\n\t consonant\r\n\t end\r\n \tend\r\n consonant_name.join\r\nend", "def create_alias(name)\n reversed_name = name.split(' ').reverse.join(' ')\n aliased_array = reversed_name.chars.map { |letter| increment_letter(letter) }\n capitalize_all(aliased_array.join)\nend", "def user_interface\n\tputs \"Hello, agent. Enter the name you would like to scramble below.\"\n\tagent_name = gets.chomp\n\n\talias_generator(agent_name)\nend", "def alias_modifier(full_name)\n low_vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n up_vowels = [\"A\", \"E\", \"I\", \"O\", \"U\"]\n low_consonants = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\", \"y\", \"z\"]\n up_consonants = [\"B\", \"C\", \"D\", \"F\", \"G\", \"H\", \"J\", \"K\", \"L\", \"M\", \"N\", \"P\", \"Q\", \"R\", \"S\", \"T\", \"V\", \"W\", \"X\", \"Y\", \"Z\"]\n full_name = full_name.split('')\n updated_name = full_name.map do |char|\n if low_vowels.include?(char)\n low_vowels.rotate[low_vowels.index(char)]\n elsif up_vowels.include?(char)\n up_vowels.rotate[up_vowels.index(char)]\n elsif low_consonants.include?(char)\n low_consonants.rotate[low_consonants.index(char)]\n elsif up_consonants.include?(char)\n up_consonants.rotate[up_consonants.index(char)]\n else\n char\n end\n end\n updated_name.join\nend", "def create_spy_alias(name)\n swapped_name = name_swapper(name) #-> 'Torres Felicia'\n swapped_vowels = vowel_swapper(swapped_name) #-> 'Turris Femidia'\n swapped_consonants = consonatn_swapper(swapped_vowels) #=> 'Vussit Gimodoe'\n swapped_consonants\nend", "def create_onfidoers(filename)\n\tlines = get_lines_from(filename)\n\t#iterate over each line and create new Onfidoer with the params \n\tlines.map do | line | \n\t\tparams = get_params_from(line)\n\t\tonfidoer = Onfidoer.new(*params) # * is a splat operator\n\t\t\"#{onfidoer.first_name} #{onfidoer.last_name}\"\n\tend\nend", "def santa_generator\r\n# Santa arrays\r\nsantas = []\r\nsanta_genders = [\"male\", \"female\", \"agender\", \"intersex\", \"N/A\", \"gender fluid\", \"bigender\", \"XXY\", \"XXX\", \"neuter\"]\r\nsanta_ethnicities = [\"Caucasian\", \"Latina\", \"Asian\", \"Unicorn\", \"N/A\", \"Black\", \"Middle-Eastern\", \"Native American\", \"Aboriginal\", \"Alien\"]\r\n\r\n#santa_genders.length.times do |i|\r\n#\tsantas << Santa.new(santa_genders[i], santa_genders[i])\r\n#end\r\n\r\ncount = 0\r\nwhile count < 100\r\n\tsantas << Santa.new(santa_genders[rand(10)], santa_ethnicities[rand(10)])\r\n\tcount += 1\r\nend\r\n\r\nsantas.each {|i|\r\n\ti.age = rand(141)\r\n\tputs \"Santa #{count} is #{i.gender}, #{i.ethnicity}, and #{i.age} years old.\"\r\n}\r\n\r\nend", "def fake_name(letters)\r\n\tvowel_arr = ['a', 'e', 'i', 'o', 'u']\r\n\tletters.map! do |letter|\r\n\t\tif vowel_arr.include?(letter.downcase)\r\n\t\t\tif letter.upcase! == nil\r\n\t\t\t\t\tif letter.downcase == vowel_arr[4]\r\n\t\t\t\t\t\tletter = vowel_arr[0].upcase\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\tnumber = vowel_arr.index(letter.downcase)\r\n\t\t\t\t\t\tnumber = number + 1\r\n\t\t\t\t\t\tletter = vowel_arr[number].upcase\r\n\t\t\t\t\tend\r\n\t\t\telse\r\n\t\t\t\tnumber = vowel_arr.index(letter.downcase)\r\n\t\t\t\t\tif number == 4\r\n\t\t\t\t\t\tletter = vowel_arr[0]\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\tnumber = number + 1\r\n\t\t\t\t\t\tletter = vowel_arr[number]\r\n\t\t\t\t\tend\r\n\t\t\tend\r\n\t\telsif \"abcdefghijklmnopqrstuvwxyz\".include?(letter.downcase) == false\r\n\t\t\tletter = letter\r\n\t\telse \r\n\t\t\t\tif letter.downcase == 'z'\r\n\t\t\t\t\tletter = (letter.chr.ord - 24). chr\r\n\t\t\t\telsif vowel_arr.include?(letter.next.downcase) == false\r\n\t\t\t\t\tletter = letter.next\r\n\t\t\t\telse\r\n\t\t\t\t\tletter = letter.next.next\r\n\t\t\t\tend\r\n\t\tend\r\n\tend\r\nletters.join(\"\")\r\nend", "def generar_llave\n cadena = [('a'..'z'), ('A'..'Z')].map { |i| i.to_a }.flatten\n llave = (0...6).map{ cadena[rand(cadena.length)] }.join\n llave\n end", "def genera_incertae_sedis_in\n Genus.incertae_sedis_in_family\n end", "def make_unique_names\n @enemies.each do |enemy|\n next unless enemy.alive?\n next unless enemy.letter.empty?\n n = @enemy_names_count[enemy.original_name] || 0\n enemy.letter = letter_table[n % letter_table.size]\n @enemy_names_count[enemy.original_name] = n + 1\n end\n @enemies.each do |enemy|\n n = @enemy_names_count[enemy.original_name] || 0\n enemy.plural = true if n >= 2\n end\n end", "def generate\n horizontal_words + vertical_words\n end", "def generate_sentence\n # Splitting into an array is required for easily preventing duplicate vals\n sent = Drama::Constants::SENTENCES.sample.split(/\\s/)\n sent.each do |w|\n num = sent.index(w)\n sent[num] = w % {\n things: Drama::Constants::THINGS.sample,\n sites: Drama::Constants::SITES.sample,\n people: Drama::Constants::PEOPLE.sample,\n says: Drama::Constants::SAYS.sample,\n badsoft: Drama::Constants::BADSOFT.sample,\n function: Drama::Constants::FUNCTIONS.sample,\n adj: Drama::Constants::ADJECTIVES.sample,\n enormous: Drama::Constants::SIZES.sample,\n price: Drama::Constants::PRICES.sample,\n ac1: Drama::Constants::BADVERBS.sample,\n packs: Drama::Constants::PACKS.sample,\n drama: Drama::Constants::DRAMA.sample,\n code: Drama::Constants::CODE.sample,\n ban: Drama::Constants::BANS.sample,\n activates: Drama::Constants::ACTIVATES.sample\n }\n end\n\n # add_a_drama\n sent.join(' ')\n end", "def alias_manager\nname = \"\"\nvowels = \"aeiou\"\nconsonants = \"bcdfghjklmnpqrstvwxyz\"\ninput = \"\"\nuser_input = []\ncapitalized_name_storage = []\ncounter = 0\n\nwhile input != \"quit\"\nputs \"What is your first and last name? Please separate with a space. Type 'quit' to exit.\"\ninput = gets.chomp\nif input == \"quit\"\n puts \"Thanks for using Alias Manager.\"\nelse\n user_input << input\n name = input.downcase.split(' ').reverse.join(' ')\n reverse_name = name\n split_reverse = reverse_name.chars\n new_name = \"\"\n split_reverse.map! do |letter|\n if letter == \" \"\n new_name += \" \"\n elsif letter.scan(/[aeiou]/).join == \"a\" ||\n letter.scan(/[aeiou]/).join == \"e\" ||\n letter.scan(/[aeiou]/).join == \"i\" ||\n letter.scan(/[aeiou]/).join == \"o\"\n index = vowels.index(letter)\n new_name += vowels[index + 1]\n elsif letter.scan(/[aeiou]/).join == \"u\"\n index = vowels.index(letter)\n new_name += \"a\"\n elsif letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"b\" || letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"c\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"d\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"f\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"g\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"h\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"j\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"k\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"l\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"m\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"n\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"p\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"q\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"r\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"s\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"t\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"v\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"w\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"x\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"y\"\n index = consonants.index(letter)\n new_name += consonants[index + 1]\n elsif letter == \"z\"\n new_name += \"b\"\n else\n p \"ERROR, UNRECOGNIZED CHARACTER\"\n end\n end\n\n capitalized_name_array = new_name.split(' ').map! {|name| name. capitalize}\n p capitalized_name = capitalized_name_array.join(' ')\n capitalized_name_storage << capitalized_name\nend\nend\nputs \"Summary:\"\nuser_input.each do |name|\n puts \"Name converted: #{name} is now #{capitalized_name_storage[counter]}.\"\n counter += 1\nend\nend", "def generate_aasequences\n (0..self.sequence.length-1).each do |i|\n AAsequence.create(:seq_id=> self.seq_id,\n :amino_acid=>self.sequence[i],\n :original_position=>i)\n end\n end", "def next_letter (name)\n vowels = \"aeiou\".split('')\nalphabet = ('a'..'z').to_a\nconsonants = alphabet - vowels\nname_array = name.split('')\nname_array.map! { |letter|\n if letter == \"u\"\n \"a\"\n elsif letter == \"z\"\n \"b\"\n elsif consonants.include? letter\n consonants[consonants.index(letter) + 1]\n elsif vowels.include? letter\n vowels[vowels.index(letter) + 1]\n else\n letter\n end\n}\nname_array.join('')\nend", "def meal_generator(food)\n food\nend", "def gen_acrostic(options)\r\n acrostic(options)\r\n end", "def generate\n @letters = alphabet\n include_letters\n exclude_letters\n shuffle_alphabet_maybe\n reverse_alphabet_maybe\n @letters.split('').join(' ')\n end", "def batch_badge_creator( attendees )\n attendees.map do |attendee|\n \"Hello, my name is #{attendee}.\"\n end\nend", "def change_name(name)\r\n\t#store new name in new variable, downcase, split in an array and reverse order\r\n\tnew_name = name.downcase.split(' ').reverse.join(' ')\r\n\t#return the array of all the letters\r\n\t#p new_name\r\n\t#puts new_name.length\r\n\t#p new_name\r\n\talias_and_real_name = []\r\n\tindex = 0\r\n\tvowel_list = \"aeiou\"\r\n\tconsonant_list = \"bcdfghjklmnpqrstvwxyz\"\r\n\twhile index < new_name.length\r\n\t\t#[index] takes and integer and retunrs char, .index takes a char\r\n\t\t#and returns integer**\r\n\t\t#Does the letter at the # index of new_name match the vowel_list string\r\n\t\tif vowel_list.include?(new_name[index])\r\n\t\t\t#next_vowel_index is a #\r\n\t\t\t#it equals the vowel string at the letter index \r\n\t\t\t#from new_name's # index\r\n\t\t\t#Then get the next number\r\n\t\t\tnext_vowel_index = vowel_list.index(new_name[index]).next\r\n\t\t\t#new_name at that index # now equal this new # \r\n\t\t\t#Equals the vowel list at index of the next #\r\n\t\t\tnew_name[index] = vowel_list[next_vowel_index]\r\n\t\t\t\t#Solve for edge cases\r\n\t\t\t\t#If the letter is the name is going to be the last letter \r\n\t\t\t\t#in the vowel string, change it automatically to \r\n\t\t\t\t#the first on\r\n\t\t\r\n\t\t\t\r\n\t\telsif consonant_list.include?(new_name[index])\r\n\t\t\tnext_consonant_index = consonant_list.index(new_name[index]).next\r\n\t\t\tnew_name[index] = consonant_list[next_consonant_index]\r\n\r\n\t\tend #End if statement\r\n\t\t#Incriment outside of if statment but inside while loop\r\n\t\tindex += 1\r\n\t\r\n\tend #End While loop\r\n\r\n\t#return the new alias name\r\n\tnew_name\r\n\t\r\n\t#Take the alias name and stoe it in an array, new name first and real \r\n\t#name second\r\n\talias_and_real_name << new_name << name\r\n\t\r\n#End method\t\t\r\nend", "def\n \nend\n\n\n# 6. sentence_maker refactored solution", "def seed_with_adjectives\n words = AdjectiveSeed::get_adjective_list\n\n words.each do |word|\n word = word.downcase.squish.strip # Remove unnecessary whitespace\n Adjective.create(word: word)\n puts word\n end\nend", "def random_alias\n 12.times.map { (SecureRandom.random_number(26) + 97).chr }.join\n end", "def add_astericx (g)\n g.each do |x| puts \"*#{x}\"\n end\nend", "def new_alias(full_name)\r\n\tnames = full_name.split(\" \")\r\n\tnames.reverse!\r\n\tnames.map! {|each_name| each_name.split(\"\")}\r\n\tnames.map! do |namearray|\r\n\t namearray.map! do |letter|\r\n\t if letter == \"z\"\r\n\t letter = \"a\"\r\n\t else letter.next!\r\n\t end\r\n\tend\r\n\tnames = namearray.join(\"\")\r\n\tend\r\nend", "def make_up_name(name)\nchanged_name = [] #empty array to push letters from name into when it goes through iteration\nvowels = \"aeiou\"\n\nconsonant = \"bcdfghjklmnpqrstvwxyz\"\n\n\n#if the index of the name provided is a consonant then change it to the next letter.\n\nindex = 0 #start at 0\n \n while index < name.length\n \t\tletter = name[index] #takes every index of every letter in name and stores it in a variable\n \t\tif vowels.include?(letter) #deals with edge case\n \t\t\tif letter == \"u\"\n \t\t\t\tchanged_name.push(\"a\")\n \t\t\telse #need to make it so every other vowel changes to next vowel letter.next\n \t\t\tend\n \t\telsif consonant.inlcude?(letter)\n \t\t\tif letter == \"z\" #deals with edge case\n \t\t\t\tchanged_name.push(\"b\")\n \t\t\telse #everything else will need to be next letter using letter.next \t\t \t\t\n \t\t\tend\n \t\telsif letter == \" \"\n \t\t\t\tchanged_name.push(\" \")\n \t\t\tend\n \t\t \t index += 1\n \tend\nnew_name_array = changed_name.join('') #takes all the letters in the array above and puts it in a new array\nnew_name_array.each {|name| p name.capitalize}\nend", "def generate(passes=5, n=:unigrams)\n unigramsOn = (n == :unigrams)\n index = rand(@sentences.length)\n tikis = @sentences[index]\n used = [index] # Sentences we've already used\n verbatim = [tikis] # Verbatim sentences to avoid reproducing\n\n (1..passes).each do |passno|\n log \"Generating... pass ##{passno}/#{passes}\"\n varsites = {} # Map bigram start site => next tiki alternatives\n\n tikis.each_with_index do |tiki, i|\n next_tiki = tikis[i+1]\n next if i == 0\n break if next_tiki.nil?\n\n alternatives = unigramsOn ? @unigrams[next_tiki] : @bigrams[tiki][next_tiki]\n # Filter out suffixes from previous sentences\n alternatives = alternatives.reject { |a| a[1] == -1 || used.include?(a[0]) }\n alternatives = alternatives.sample(10000)\n varsites[i] = alternatives unless alternatives.empty?\n end\n\n variant = nil\n ia = 0\n varsites.to_a.shuffle.each do |site|\n \n start = site[0]\n ib = 0\n site[1].each do |alt|\n puts \"Site #{start}/#{varsites.length} alt #{ib}/#{site[1].length}\" if (ib % 1000) == 0\n ib += 1\n alts = @sentences[alt[0]]\n verbatim << alts\n suffix = alts[alt[1]..-1]\n puts \"Zero length!\" if suffix.length < 1\n potential = tikis[0..start+1] + suffix\n\n # Ensure we're not just rebuilding some segment of another sentence\n unless verbatim.find { |v| v.length > 1 && SuffixGenerator.subseq?(v, potential) }\n used << alt[0]\n variant = potential\n break\n end\n raise(\"Wargh\") if ib > 100000 # got stuck. still don't know what causes this...\n end\n ia += 1\n break if variant\n end\n\n tikis = variant if variant\n end\n\n tikis\n end", "def keygens; end", "def aliasFasta(fasta, ali, out, outgroup = nil)\n outFile = File.new(out, \"w\")\n aliFile = File.new(ali, \"w\") if (!ali.nil?)\n aliHash = Hash.new\n orfNum = \"SID0000001\"\n Bio::FlatFile.new(Bio::FastaFormat, File.new(fasta)).each do |seq|\n newName = orfNum\n name = seq.definition.split(\" \").first\n newName = \"SID0000000\" if (outgroup == name)\n aliFile.printf(\"%s\\t%s\\n\", newName, seq.definition) if (ali)\n aliHash[newName] = seq.definition.tr(\"(),:\",\"_\")\n seq.definition = newName\n outFile.print seq\n orfNum = orfNum.succ if (outgroup != name)\n end\n outFile.close\n aliFile.close if (ali)\n return aliHash\nend", "def aliasFasta(fasta, ali, out, outgroup = nil)\n outFile = File.new(out, \"w\")\n aliFile = File.new(ali, \"w\") if (!ali.nil?)\n aliHash = Hash.new\n orfNum = \"SID0000001\"\n Bio::FlatFile.new(Bio::FastaFormat, File.new(fasta)).each do |seq|\n newName = orfNum\n name = seq.definition.split(\" \").first\n newName = \"SID0000000\" if (outgroup == name)\n aliFile.printf(\"%s\\t%s\\n\", newName, seq.definition) if (ali)\n aliHash[newName] = seq.definition.tr(\"(),:\",\"_\")\n seq.definition = newName\n outFile.print seq\n orfNum = orfNum.succ if (outgroup != name)\n end\n outFile.close\n aliFile.close if (ali)\n return aliHash\nend", "def fasta\n chars = 60\n lines = (length / chars.to_f).ceil\n defline = \">#{accession} #{title}\"\n seqlines = (1..lines).map {|i| to_s[chars * (i - 1), chars]}\n [defline].concat(seqlines).join(\"\\n\")\n end", "def generate_villain_name\n buffer\n villain = Villain.new\n line\n puts \"What is your villain's given name?\"\n line\n choice = gi_string\n villain.name = choice\n line\n puts \"#{villain.name} is the name you chose. If this is correct, press 1? Press 2 if not. Press 3 to go back.\"\n line\n choice = gi_integer\n if choice == 1\n generate_villain_alter_ego(villain)\n elsif choice == 2\n generate_villain_name\n elsif choice == 3\n villain_setup\n else line\n puts \"Your input was not recognized. Please begin this step again.\"\n line\n generate_villain_name\n end\n end", "def trans_enemies\n b = []\n a = \"\"\n for i in $data_enemies\n if i != nil and i.name != nil\n oldname = i.name.split(/\\//)[0]\n oldname = oldname.gsub(\"【data】\", \"\").gsub(\"【fix】\",\"\") if oldname.is_a?(String)\n if oldname!= \"\" and oldname!= nil #and oldname.translation_check != i.UK_name\n a = \"when \" + i.id.to_s + \" \\#\" + oldname + \"\\n\"\n b.push(a)\n a = \" return \\\"\" + i.UK_name + \"\\\"\"\n a = a + \" ***TODO\" if oldname == i.UK_name\n a = a + \"\\n\"\n b.push(a)\n end\n end\n end\n open(\"zzz.txt\",\"a+\") do |log|\n log.puts b\n end\nend", "def mutations_effect(a_anno, a_gen)\n\n if $locus[a_anno[10]] && a_anno[3].length == a_anno[4].length\n $cdna.pos = $locus[a_anno[10]]\n transcript = original()\n exon_starts = a_gen[9].split(',')\n exon_ends = a_gen[10].split(',')\n mutation_position,exon_num = position_on_transcript(a_anno[1],a_gen[3],exon_starts,exon_ends,a_gen[6],a_gen[7])\n a_anno[12] = \"exon#{exon_num}\"\n start_triplet = (mutation_position/3 * 3) - 1\n if start_triplet >= 0\n code = transcript[start_triplet..start_triplet+2]\n pos_in_triplet = mutation_position%3\n original_aa = $codes[code]\n code[pos_in_triplet] = a_anno[4]\n mutated_aa = $codes[code[0..2]]\n if original_aa != mutated_aa\n a_anno[13] = pos_in_triplet + 1\n a_anno[14] = original_aa[:name]\n a_anno[15] = mutated_aa[:name]\n puts a_anno.join(\"\\t\")\n else\n a_anno[13] = \"same_AA\"\n STDERR.puts a_anno.join(\"\\t\")\n end\n end\n else\n if $locus_non_coding[a_anno[10]]\n a_anno[13] = \"ncrna\"\n STDERR.puts a_anno.join(\"\\t\")\n else\n if (a_anno[3].length > a_anno[4].length || a_anno[3].length < a_anno[4].length)\n a_anno[13] = \"indel\"\n puts a_anno.join(\"\\t\")\n else\n a_anno[13] = \"?\"\n STDERR.puts a_anno.join(\"\\t\")\n end\n end\n end\n\nend", "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", "def generate_accessCode\n return ((0..9).to_a + (\"a\"..\"z\").to_a).shuffle[0..5].join(\"\")\n end", "def add_asterik(argument)\n argument.each do |individual_grocery_items|\n asterik_individual_grocery_items = \"*#{individual_grocery_items}\"\n puts asterik_individual_grocery_items\n end\nend", "def obfuscate(name, seed = nil)\n rnd = Random.new(seed || @seed)\n vowels = %w(A E I O U)\n consonants = ('A'..'Z').to_a - vowels\n digits = ('0'..'9').to_a\n dict = Hash[(vowels + consonants + digits).zip(vowels.shuffle(random: rnd) +\n consonants.shuffle(random: rnd) +\n digits.shuffle(random: rnd))]\n name.upcase.split(//).map { |s| dict[s] || s }.join\n end", "def alias_generator (full_name)\n\treturn splitter(full_name.downcase)\nend", "def generate_tables\n create_characters\n create_kiosks\n create_traps\n create_buttons\n end", "def probe_ship_gen(probe_count, probe_array)\n text = \"\"\n probe_count.times.with_index do |v|\n temp = (\"a\"..\"zz\").to_a[v]\n text += \"var author_probe_#{temp} = new Ship({\n material: new THREE.SpriteMaterial({map: probe_texture, color: 0xffffff, fog: true}),\n dis_at_end: true,\n name: \\\"author_probe_#{temp}\\\"\n});\nscene.add(author_probe_#{temp}.spr);\nauthor_probe_#{temp}.spr.visible = false;\nprobes[probes.length] = author_probe_#{temp};\nauthor_probe_#{temp}.spr.scale.set(2,2,2);\\n\\n\"\n probe_array.push(\"author_probe_#{temp}\")\n end\n return text\nend", "def toonify |accent, sentence|\n\n\nend", "def namecoder\n valid_input = false\n until valid_input\n secret_name_database = []\n \n puts \"Whats your first name?\"\n fname = gets.chomp.downcase.split('')\n puts \"What's your last name?\"\n lname = gets.chomp.downcase.split('')\n original_name = [fname,\" \", lname].join\n fullname = [fname,\" \", lname].reverse.flatten\n # p fullname\n \n fullalphabet = \"abcdefghijklmnopqrstuvwxyz\"\n consonants = ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z']\n alpha = ['a', 'b', 'c', 'd', 'e', 'u', 'z']\n vowels = ['a', 'e', 'i', 'o', 'u']\n \n # vowel_code(original_name)\n vowels = ['a', 'e', 'i', 'o', 'u']\n fn_vowel = fullname.map do |vowel|\n if vowels.include?(vowel)\n vowels.rotate(1)[vowels.index(vowel)]\n else\n vowel\n end\n end\n # p fn_vowel \n # name_vowels_changed.join\n \n # def cons_code(name_vowels_changed)\n # name_vowels_changed = name_vowels_changed.split('')\n name_both_changed = fn_vowel.map do |cons|\n if consonants.include?(cons)\n consonants.rotate(1)[consonants.index(cons)]\n else\n cons\n end\n end\n # p name_both_changed\n secret_name = name_both_changed.join\n orig_fullname = fullname.join.capitalize\n secret_name_database << [original_name, secret_name]\n p original_name\n p secret_name\n \n puts \"Press enter if you'd like to do another name. Otherwise, type 'quit'.\"\n continue = gets.chomp\n if continue == \"quit\"\n puts \"Thank you for using the program. Here is your list of names:\"\n secret_name_database.each do |orig, secret|\n puts \"#{orig}'s secret name is #{secret}.\"\n end \n valid_input = true\n else\n puts \"Time to add another name...\"\n end \n end\nend", "def alien_fire_bullet()\r\n # The aliens will fire bullets at random, \r\n # The randomness is controlled by @alien_fire_rand\r\n @aliens.each { |alien|\r\n if rand(@alien_fire_rand) == 0\r\n @bullets.push Bullet.new(alien.x, alien.y+ 40, 'evil')\r\n end\r\n }\r\n end", "def generate_characters(story_characters, story)\n if story_characters\n story_characters.each do |story_character|\n\n character =generate_character(story_character)\n # create a new protagnist link\n protagnist = Protagnist.new()\n protagnist.character = character\n protagnist.story = story\n protagnist.save\n end\n end\n\n generate_ship(story_characters, story)\nend", "def batch_badge_creator(attendees)\n#use map to return the names with the string as a new array\n attendees.map do |attendee|\n \"Hello, my name is #{attendee}.\"\n end\nend", "def generate(num = 100)\n\t\tresults = []\n\t\t1.upto(num) { results << mangle_word(pick_a_word) }\n\t\tresults\n\tend", "def anagram_manager\n\n if array_vowel_check() == true\n\n concat_anagram_check()\n\n else \"One or more words in your entry phrases does not contain a vowel\"\n\n end\n end", "def make_primer_aliquots\n show do\n title \"Make fragment stock aliquots\"\n\n check \"Pipette #{operations.running.first.temporary[:dilution_vol] } uL #{STOCK} into each #{DILUTED_STOCK} tube using the following table.\"\n\n table operations.running.start_table\n .output_item(STOCK, heading: \"#{STOCK} (#{operations.running.first.temporary[:dilution_vol]} uL)\")\n .output_item(DILUTED_STOCK, checkable: true)\n .end_table\n \n check \"Vortex each tube after the DNA has been added.\"\n end\n end", "def generate\n ('a'..'z').to_a.shuffle[0, length].join.capitalize\n end", "def acronymize(sentence)\n # TODO: Build an acronym from the sentence\n words = sentence.split\n\n letters = []\n words.each do |word|\n letters << word[0].upcase\n end\n\n # letters = words.map do |word|\n # word[0].upcase\n # end\n#. do end\n\n letters.join\nend", "def fake_name (full_name)\n words_array = full_name.split (\" \")\n swap_name_array = words_array.reverse\n swap_name = swap_name_array.join(\" \")\n letters = swap_name.chars\n fake_letters = []\n letters.each do |letter|\n vowel = %w[a A e E i I o O u U]\n if vowel.include?(letter)\n fake_letters << next_vowel(letter)\n elsif letter == \" \"\n fake_letters << \" \"\n else\n fake_letters << next_unvowel(letter)\n end\nend\n return fake_letters.join (\"\")\nend", "def aleatorio(arr)\n puts \"Cadena aleatoria: #{(65+rand(26)).chr*5}\"\n \nend", "def generate_username6a\n\tputs \"Give me your info in this format please:\"\n puts \"['Connor', 'Slakey', 1993]\"\n input = gets\n generate_username5(inputs)\nend", "def generate_name\n @seed ||= 0\n @seed += 1\n \"_anon_#{@seed}\"\n end", "def alias_creator(name)\n puts \"Your name backwards is #{name.split(' ').rotate!.join(' ')}.\"\nend" ]
[ "0.67415905", "0.67098373", "0.6628147", "0.65566397", "0.6149982", "0.61312085", "0.6122917", "0.6062984", "0.6040096", "0.59317064", "0.5923171", "0.5914449", "0.5912977", "0.58781105", "0.5877148", "0.581815", "0.581815", "0.5815876", "0.5802117", "0.5714952", "0.5690303", "0.5676955", "0.56692743", "0.5654205", "0.56485116", "0.56485116", "0.56485116", "0.5606837", "0.55927956", "0.55328596", "0.5521607", "0.5491647", "0.54869837", "0.5481266", "0.54618454", "0.5453011", "0.54251397", "0.5413031", "0.5412941", "0.5412941", "0.54129106", "0.5398643", "0.5392598", "0.53843004", "0.5382384", "0.53821576", "0.5360997", "0.53519017", "0.5346442", "0.5331291", "0.5327543", "0.53227043", "0.53056103", "0.5303762", "0.5294081", "0.5282274", "0.5277956", "0.5276337", "0.52587473", "0.5250372", "0.5242035", "0.5241317", "0.52396756", "0.52231264", "0.521579", "0.5211868", "0.52045184", "0.52042586", "0.51981485", "0.5186013", "0.5185972", "0.5185262", "0.51832145", "0.51832145", "0.5177925", "0.5177417", "0.51758295", "0.5171098", "0.516449", "0.5158987", "0.5143986", "0.5135655", "0.51349384", "0.5133063", "0.5130702", "0.5130412", "0.51304024", "0.5124278", "0.5122352", "0.5120237", "0.511929", "0.51179266", "0.5115047", "0.5105167", "0.5097629", "0.5093659", "0.5092521", "0.50921744", "0.50898826", "0.50891256" ]
0.7044341
0
Procedure to handle collision between Alien and the bullet
def alien_hit(alien, bullet) # Deleting the alien and the bullet object @aliens.delete alien @bullets.delete bullet @explode = true @player.update_score() # Setting the coordinates for the explosion @explode_x = alien.x @explode_y = alien.y @explosion_sound.bmp.play end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enemy_bullet_collision\n if cr.defeated == false\n $e_bullets.each do |b|\n if self.bounding_box_collision?(b)\n @life -= 1\n $hud.set_lives(life)\n clear_all_bullets\n end\n end\n end\n end", "def check_collision()\r\n # Looping through all the aliens in the game\r\n @aliens.each { |alien|\r\n # Looping through all the bulletss in the game\r\n @bullets.each { |bullet|\r\n # Distance between the bullet and the alien\r\n distance = Gosu.distance(alien.x, alien.y, bullet.x, bullet.y)\r\n # Distance between the bullet and the player\r\n hit_distance = Gosu.distance(@player.x, @player.y, bullet.x, bullet.y)\r\n # Bullets fired by the Player fit the Alien\r\n if distance < alien.radius + bullet.radius and bullet.type == 'good'\r\n alien_hit(alien, bullet)\r\n # Bullets fired by the Alien hit the Player\r\n elsif hit_distance < @player.radius + bullet.radius and bullet.type == 'evil'\r\n player_hit(bullet)\r\n end\r\n }\r\n }\r\n end", "def update()\n #checks if it has hit an asteroid\n self.hit()\n #moves the bullet\n self.move()\n end", "def collide(target, arrow, flag)\r\n \r\n if arrow.x>840 and arrow.x<920\r\n \r\n if arrow.y>(target.y+20) and arrow.y<(target.y+40) || arrow.y>(target.y+120) and arrow.y<(target.y+140) #arrow hits the outter rim/band\r\n target.score+=1\r\n arrow.count-=1\r\n target.yay.play\r\n sleep(2)\r\n arrow.x=180\r\n arrow.y=320\r\n arrow.end=true\r\n flag=0\r\n\r\n elsif arrow.y>(target.y+40) and arrow.y<(target.y+60) || arrow.y>(target.y+100) and arrow.y<(target.y+120) #arrow hits the middle rim/band\r\n target.score+=2\r\n arrow.count-=1\r\n target.yay.play\r\n \r\n sleep(2)\r\n arrow.x=180\r\n arrow.y=320\r\n arrow.end=true\r\n flag=0\r\n \r\n elsif arrow.y>(target.y+60) and arrow.y<(target.y+100) #arrow hits the bullseye or innermost band\r\n target.score+=3\r\n arrow.count-=1\r\n target.yay.play\r\n sleep(2)\r\n arrow.x=180\r\n arrow.y=320\r\n arrow.end=true\r\n flag=0\r\n \r\n end\r\n\r\n end\r\n\r\n if arrow.x>WIDTH+40 || arrow.y<0 || arrow.y>HEIGHT #misses target\r\n arrow.count-=1\r\n target.ohno.play\r\n sleep(2)\r\n arrow.x=180\r\n arrow.y=320\r\n arrow.end=true\r\n flag=0\r\n \r\n end\r\n\r\n return flag\r\n end", "def handleCollision spriteA, spriteB\n false\n end", "def check_collision\n colliding_enemies = @game_state.enemies.select { |enemy| enemy.collides?(self) && !enemy.hit_by.index(self) }\n if colliding_enemies.any?\n enemy = colliding_enemies.first\n enemy.damage!(@damage)\n enemy.hit_by << self\n enemy.jump_back! unless enemy.dead?\n die!\n $window.audio_manager.play! :hit\n end\n end", "def collision(damage)\n end", "def hit_by_bullet\n $p_bullets.delete_if do |b|\n if self.bounding_box_collision?(b)\n @meter.change_width(b.dmg)\n b.destroy\n during(100) { @color.alpha = 100 }.then { @color.alpha = 255 }\n @life -= 1.0\n true\n end\n end\n end", "def detectCollision\n oldX = @x\n oldY = @y\n @x += @velX\n if isBlocked?\n @x = oldX\n @velX = 0\n death\n return\n end\n @y += @velY\n if isBlocked?\n @y = oldY\n @velY = 0\n death\n return\n end\n end", "def move_enemy_bullet args\n # don't update the position if the bullet isn't in action\n if args.state.enemy_bullet_shooting\n # go see if the bullet hit the player\n check_player_hit args\n # update the bullet y position\n args.state.enemy_bullet_y -= 10\n # has the bullet gone off the bottom of the screen?\n if args.state.enemy_bullet_y < 0 - args.state.enemy_bullet_h\n # don't bother updating it\n args.state.enemy_bullet_shooting = false\n end\n end\nend", "def player_hit(bullet)\r\n @bullets.delete bullet\r\n @ship_hit_sound.bmp.play\r\n # If the player has lost all the lifeline end the game\r\n if @player.life == 0\r\n # Ending the game\r\n GameOverWindow.new.show\r\n close\r\n end \r\n # Player lost one lifeline\r\n @player.lose_life()\r\n # Plaing a blank heart to represent it\r\n @heart_list[@player.life] = @blank_heart\r\n @heart = @blank_heart \r\n end", "def catch_collisions\n beam_collide_enemy = [:beam, :enemy]\n enemy_collide_spaceship = [:spaceship, :enemy]\n\n Constants::SPACE.add_collision_func(*beam_collide_enemy) do |beam_shape, enemy_shape|\n add_collided_shape(beam_shape, beam_collide_enemy)\n add_collided_shape(enemy_shape, beam_collide_enemy)\n end\n Constants::SPACE.add_collision_func(*enemy_collide_spaceship) do |spaceship_shape, enemy_shape|\n add_collided_shape(enemy_shape, enemy_collide_spaceship)\n add_collided_shape(spaceship_shape, enemy_collide_spaceship)\n end\n end", "def move_player_bullet args\n # don't update the position if the bullet isn't in action\n if args.state.player_bullet_shooting\n # go see if the bullet hit the enemy\n check_enemy_hit args\n # update the bullet y position\n args.state.player_bullet_y += 10\n # has the bullet gone off the top of the screen?\n if args.state.player_bullet_y > 720\n # don't bother updating it\n args.state.player_bullet_shooting = false\n end\n end\nend", "def collision obj\n\t\tend", "def handleCollision spriteA, spriteB\n if spriteA.collide spriteB\n spriteA.implode self\n spriteB.implode self\n getSpriteManager.addSpritesToBeRemoved spriteA, spriteB\n true\n end\n end", "def detectCollision\n oldX = @x\n oldY = @y\n @x += @velX\n if isBlocked?\n @x = oldX\n @velX = 0\n @map.PobjectArray.delete(self)\n return\n end\n @y += @velY\n if isBlocked?\n @y = oldY\n @velY = 0\n @map.PobjectArray.delete(self)\n return\n end\n end", "def updatePosition\n super\n\n Bullet.BulletInstances.each { |bullet|\n if collision?(bullet)\n bullet.destroy\n explode\n end\n }\n\n Ship.ShipInstances.each { |ship|\n if collision?(ship)\n ship.destroy\n explode\n end\n }\n end", "def collides\n 'collision'\nend", "def collisions\n collider.detect(self)\n end", "def collide_obstacles(block, arrow, target, flag)\r\n # if arrow.y>(block.y) and arrow.y<(target.y+40) and (arrow.x+40)>(block.x) and (arrow.x+40)<(block.x+50)\r\n if Gosu.distance(arrow.x, arrow.y, block.x, block.y) <30\r\n target.score-=1\r\n arrow.count-=1\r\n target.ohno.play\r\n sleep(1)\r\n arrow.x=180\r\n arrow.y=320\r\n arrow.end=true\r\n flag=0\r\n \r\n return flag\r\n end\r\n\r\n if (arrow.x+20)>(block.x+40)\r\n flag=1\r\n return flag\r\n end\r\n \r\n end", "def checkCollide(enemyBullets)\n enemyBullets.each do |bullet|\n if Gosu::distance(bullet.x, bullet.y, @x, @y) < 5\n @isKill = true\n end\n end\n end", "def player_fire_bullet()\r\n # This makes sure that bullets are fired after certain intervals\r\n if Gosu.milliseconds > (@seconds_elapsed * COUNTER)\r\n @seconds_elapsed = Gosu.milliseconds\r\n @bullet_sound.bmp.play()\r\n # Generating a bullet object\r\n @bullets.push Bullet.new((@player.x+ 33), @player.y, 'good')\r\n end \r\n end", "def collide(other_ball)\n # puts \"COLLISION between #{self} and #{other_ball}\"\n\n # Calculate in a rotated frame of reference where the line between the\n # balls' centers is the x axis.\n # Math lifted from http://hoomanr.com/Demos/Elastic2/\n\n m1 = self.mass\n u1 = self.total_velocity\n d1 = self.current_angle\n m2 = other_ball.mass\n u2 = other_ball.total_velocity\n d2 = other_ball.current_angle\n\n # Collision angle (radians from vertical)\n a = Math.atan2(other_ball.x - self.x, self.y - other_ball.y)\n # puts \"collision angle a = #{a}\"\n\n # X/Y velocities in rotated frame\n v1_x = u1 * Math.cos(d1 - a)\n v1_y = u1 * Math.sin(d1 - a) * -1\n v2_x = u2 * Math.cos(d2 - a)\n v2_y = u2 * Math.sin(d2 - a) * -1\n\n # puts \"v1_x = #{v1_x}\"\n # puts \"v1_y = #{v1_y}\"\n # puts \"v2_x = #{v2_x}\"\n # puts \"v2_y = #{v2_y}\"\n\n # New X-velocities (Y-velocities do not change)\n f1_x = ((v1_x * (m1 - m2)) + (2 * m2 * v2_x)) / (m1 + m2)\n f2_x = ((v2_x * (m1 - m2)) + (2 * m1 * v1_x)) / (m1 + m2)\n # puts \"f1_x = #{f1_x}\"\n # puts \"f2_x = #{f2_x}\"\n\n f1_x = bounce(f1_x)\n f2_x = bounce(f2_x)\n\n # convert back to original frame of reference\n # New total velocity\n v1 = Math.sqrt(f1_x**2 + v1_y**2)\n v2 = Math.sqrt(f2_x**2 + v2_y**2)\n # puts \"v1 = #{v1}\"\n # puts \"v2 = #{v2}\"\n\n # New direction\n begin\n e1 = Math.atan2(f1_x, v1_y) + a\n rescue\n e1 = a\n end\n begin\n e2 = Math.atan2(f2_x, v2_y) + a\n rescue\n e2 = -1 * a\n end\n # puts \"e1 = #{e1}\"\n # puts \"e2 = #{e2}\"\n\n # New velocity components\n v1_x = v1 * Math.cos(e1) * -1\n v1_y = v1 * Math.sin(e1) * -1\n v2_x = v2 * Math.cos(e2) * -1\n v2_y = v2 * Math.sin(e2) * -1\n\n # puts \"v1_x = #{v1_x}\"\n # puts \"v1_y = #{v1_y}\"\n # puts \"v2_x = #{v2_x}\"\n # puts \"v2_y = #{v2_y}\"\n\n # Update objects' velocity components\n self.vel_x = v1_x\n self.vel_y = v1_y\n other_ball.vel_x = v2_x\n other_ball.vel_y = v2_y\n end", "def collision(other)\n\t\tif other.is_a?(Torpedo)\n\t\t\tother.collision(self)\n\t\tend\n\tend", "def alien_fire_bullet()\r\n # The aliens will fire bullets at random, \r\n # The randomness is controlled by @alien_fire_rand\r\n @aliens.each { |alien|\r\n if rand(@alien_fire_rand) == 0\r\n @bullets.push Bullet.new(alien.x, alien.y+ 40, 'evil')\r\n end\r\n }\r\n end", "def notifycollision(obj); end", "def notifycollision(obj); end", "def touched_by bullet\n ([@width, @height].max/3).times do\n p_vx = rand(100)/10.0 - 5\n p_vy = rand(100)/10.0 - 5\n #@window.particles << Particle.new(@window, @x + rand(@width) - @width/2, @y + rand(@height) - @height/2, p_vx, p_vy)\n @window.particles << Live_Particle.new(@window, bullet.x + rand(@width) - @width/2, bullet.y + rand(@height) - @height/2, p_vx, p_vy, @colors.rand_in, 1 + rand)\n end\n damage bullet.damage\n end", "def move\r\n # Move bullet fired by the Spaceship up the screen \r\n if @type == 'good'\r\n @y -= @SPEED\r\n # Move bullet fired by the Aliens down the screen \r\n elsif @type == 'evil'\r\n @y += @SPEED\r\n end\r\n end", "def scratch_collision args\n # x collision\n ball = args.state.cueball\n baulk_line = args.state.tableleft + (args.state.table_width / 5) - args.state.ball_diameter\n if ball[:x] > baulk_line\n ball[:x] = baulk_line\n ball[:velX] = 0\n end\nend", "def check_enemy_hit args\n # define a rectangle around the enemy\n enemy_hitbox = [\n args.state.enemy_x,\n args.state.enemy_y,\n args.state.enemy_w,\n args.state.enemy_h\n ]\n # define a rect around the player's bullet\n player_bullet_hitbox = [\n args.state.player_bullet_x,\n args.state.player_bullet_y,\n args.state.player_bullet_w,\n args.state.player_bullet_h\n ]\n\n # draw the hitbox rects\n args.outputs.debug << {\n x: enemy_hitbox.x,\n y: enemy_hitbox.y,\n w: enemy_hitbox.w,\n h: enemy_hitbox.h,\n r: 255,\n g: 0,\n b: 0\n }.border\n\n args.outputs.debug << {\n x: player_bullet_hitbox.x,\n y: player_bullet_hitbox.y,\n w: player_bullet_hitbox.w,\n h: player_bullet_hitbox.h,\n r: 255,\n g: 0,\n b: 0\n }.border\n\n # check to see if the rects overlap\n if enemy_hitbox.intersect_rect? player_bullet_hitbox\n # the enemy has been hit\n game_over args, \"win\"\n end\nend", "def collisions args\n num_balls = args.state.balls.length\n if num_balls > 1\n (0..num_balls - 1).each do |i|\n ball1 = args.state.balls[i]\n ((i + 1)..num_balls - 1).each do |j|\n ball2 = args.state.balls[j]\n dist = (((ball1[:x] - ball2[:x]) ** 2) + ((ball1[:y] - ball2[:y]) ** 2)) ** (1/2)\n if dist < args.state.ball_diameter\n args.state.collision_data = resolve_bump ball1, ball2, dist, args\n if i == 0 and args.state.first_collision_type == 3\n args.state.first_collision_type = ball2[:type]\n end\n args.state.balls_collided = true\n end\n end\n end\n end\nend", "def collide_with!(immovable_object)\r\n r = @pos - immovable_object.pos\r\n return if r.abs > @radius + immovable_object.radius\r\n\r\n normal = r/r.abs\r\n v_normal = @speed.scalar_mult normal\r\n if v_normal < 0\r\n mult = 1 + immovable_object.elasticity\r\n @speed += normal*(-mult*v_normal)\r\n end\r\n end", "def shoot_2\n if Time.now - @last_shoot_1 > 0.05\n @window.e_bullets << Ennemy_Bullet.new(@window, @player, @x - 28, @y, 0, 7)\n @window.e_bullets << Ennemy_Bullet.new(@window, @player, @x + 28, @y, 0, 7)\n @last_shoot_1 = Time.now\n end\n end", "def i_hit(others, velocity); end", "def collidesWithPlayer\n for x in @x.round..(@x + @width).round\n for y in (@y - @height).round..@y.round\n if @map.player.containsPoint?(x, y)\n @map.player.loseHealth\n death\n return\n end\n end\n end\n end", "def collidesWithPlayer\n for x in @x.round..(@x + @width).round\n for y in (@y - @height).round..@y.round\n if @map.player.containsPoint?(x, y)\n @map.player.loseHealth\n end\n end\n end\n end", "def handle_collisions\n @collisions.map do |shape, collision_context|\n game_entity = @entity_manager.find_by_shape(shape)\n game_entity.on_collide(@entity_manager, collision_context) if game_entity\n end\n @collisions = []\n end", "def tryMove\n if @enemy\n collidesWithPlayer\n else\n collidesWithEnemy\n end\n detectCollision\n end", "def check_boundary_collision(ball) \n ball.velocity.x *= -1 unless (ball.r..width - ball.r).include? ball.position.x \n ball.velocity.y *= -1 unless (ball.r..height - ball.r).include? ball.position.y \nend", "def collidesWithPlayer\n for x in @x.round..(@x + @width).round\n for y in (@y - @height).round..@y.round\n if @map.player.containsPoint?(x, y)\n @map.PobjectArray.delete(self)\n @map.player.loseHealth\n end\n end\n end\n end", "def calculate_collisions args\n args.state.bullets.each do |bullet| # perform action on every bullet and enemy in collections\n args.state.enemies.each do |enemy|\n # if bullet has not exploded yet and the bullet hits an enemy\n if !bullet.exploded && bullet.rect.intersect_rect?(enemy.rect)\n bullet.exploded = true # bullet explodes\n enemy.dead = true # enemy is killed\n end\n end\n end\n\n # All exploded bullets are rejected or removed from the bullets collection\n # and any dead enemy is rejected from the enemies collection.\n args.state.bullets = args.state.bullets.reject(&:exploded)\n args.state.enemies = args.state.enemies.reject(&:dead)\nend", "def enforce_bounds\n sorted_flakes = @flakes.sort_by { |flake| flake.position }\n\n sorted_flakes.each_with_index do |flake, idx|\n break if idx == sorted_flakes.size - 1\n next_flake = sorted_flakes[idx + 1]\n\n if collides_exact?(flake, next_flake)\n flake.switch_direction\n next_flake.switch_direction\n end\n end\n\n super\n end", "def collidesWithEnemy\n for x in @x.round..(@x + @width).round\n for y in (@y - @height).round..@y.round\n if @map.enemyContainsPoint?(x, y)\n @map.PobjectArray.delete(self)\n return\n end\n end\n end\n end", "def shoot_1\n if Time.now - @last_shoot_1 > 0.5\n @window.e_bullets << Ennemy_Bullet.new(@window, @player, @x, @y, -2, 4)\n @window.e_bullets << Ennemy_Bullet.new(@window, @player, @x, @y, 0, 4)\n @window.e_bullets << Ennemy_Bullet.new(@window, @player, @x, @y, 2, 4)\n @last_shoot_1 = Time.now\n end\n end", "def collisions\n [collided_bombs, collided_rubies]\n end", "def shoot\n bullet1 = Bullet.new(@x, @y, @angle, @map, @pColor)\n bullet2 = Bullet.new(@x, @y, @angle + Math::PI / 2, @map, @pColor)\n bullet3 = Bullet.new(@x, @y, @angle + Math::PI, @map, @pColor)\n bullet4 = Bullet.new(@x, @y, @angle + Math::PI * 3 / 2, @map, @pColor)\n\n @map.PobjectArray.push(bullet1)\n @map.PobjectArray.push(bullet2)\n @map.PobjectArray.push(bullet3)\n @map.PobjectArray.push(bullet4)\n end", "def enableCollisionWith _obj, _args\n \"_obj enableCollisionWith _args;\" \n end", "def collision_tollerance\n 0.0\n end", "def battler_collide(battler)\r\r\n return if self.erased\r\r\n self.hp -= 1\r\r\n battler.hp -= 1\r\r\n @dying = true\r\r\n if self.hp <= 0\r\r\n die\r\r\n end\r\r\n end", "def projectile_collide(projectile)\r\r\n return if self.erased\r\r\n return if projectile.erased\r\r\n return if projectile.owner == self.owner\r\r\n return if projectile.projectile.id == self.projectile.id\r\r\n kill_judgement projectile\r\r\n @move_speed -= 0.1\r\r\n #puts self.hp\r\r\n self.hp -= 1\r\r\n if self.hp <= 0\r\r\n die\r\r\n end\r\r\n #@move_speed = ori_speed\r\r\n end", "def hit()\n #first it runs through all the asteroids and checks if itself is inside one\n for k in GameManager.getAsteroids()\n if Intersect.new([@model.x,@model.y,@size],[k.pos.x,k.pos.y,k.size]).calculate()\n #if it detects it is in an asteroid it calls that asteroids split function and then kills itself\n #it sends the ship that shot it its powerup value and tint so the ship can interpret it\n @ship.powerUp(k.type,k.tint[k.type])\n k.split()\n @ship.points += @ship.pointAdd\n if @ship.pierce == false\n self.kill()\n end\n end\n end\n end", "def update\n @ballA.update\n if @ballA.collide?(@ballB)\n @ball.reflect_horizontal\n # increase_speed\n elsif @ball.collide?(@enemy)\n # play sound\n @ball.reflect_horizontal\n @blip_sound.play\n increase_speed\n elsif @ball.x <= 0\n @ball.reflect_horizontal #add\n score[1] += 1\n elsif @ball.right >= self.width\n @ball.reflect_horizontal #add\n score[0] += 1\n\n end\n\n @ball.reflect_vertical if @ball.y < 0 || @ball.bottom > self.height\n end", "def fire_bullet args\n return unless args.inputs.mouse.click # return unless mouse is clicked\n args.state.bullets << args.state.new_entity(:bullet) do |bullet| # new bullet is declared a new entity\n bullet.y = args.inputs.mouse.click.point.y # set to the y value of where the mouse was clicked\n bullet.x = 0 # starts on the left side of the screen\n bullet.size = 10\n bullet.speed = 10 * rand + 2 # speed of a bullet is randomized\n bullet.rect = [bullet.x, bullet.y, bullet.size, bullet.size] # definition is set\n end\nend", "def collisions(obj)\n return projectile_collisions(obj) if obj.is_a?(Projectile) && obj.keep?\n return powerup_collision(obj) if obj.is_a?(Powerup)\n return unless obj.is_a?(Ball) && obj.keep?\n player_collision(obj)\n #balls_collisions(obj)\n end", "def enemy_shoot args\n # generate a random number from 0 to 99\n r = rand(100)\n # is the random number 0? that give a a 1 in 100 chance of shooting\n # is the enemy shooting? Only shoot if not already shooting.\n if r == 1 && args.state.enemy_bullet_shooting == false\n # set the enemy bullet position to the enemy position\n args.state.enemy_bullet_x = args.state.enemy_x + args.state.enemy_w / 2\n args.state.enemy_bullet_y = args.state.enemy_y\n # track state of enemy bullet\n args.state.enemy_bullet_shooting = true\n end\nend", "def collision_rect\r\r\n #return @custom_collision if @custom_collision.size > 0\r\r\n return super\r\r\n end", "def draw\n @running = @body.v.x.abs >= 1\n\n unless @running or @attacking #set idle sprite unless they're running or attacking\n if @direction == :left\n @sprite = @sprite_left\n else\n @sprite = @sprite_right\n end\n end\n \n if @dmg_cooldown > 0 && @direction == :right \n @sprite = @sprite_damage\n elsif @dmg_cooldown > 0 && @direction == :left\n @sprite = @sprite_damage_left\n end\n if @dead\n @sprite = Gosu::Image.new(\"assets/images/player/death.png\")\n end\n super\n end", "def handle_hit_obstacle(object)\n end", "def move()\n #first it checks if it is on an edge\n if (\n @model.x >= Window.width-@size ||\n @model.x <= 0 ||\n @model.y >= Window.height-@size ||\n @model.y <= 0\n )\n #if the bullet is on the edge then it will die\n self.kill()\n end\n #this moves the bullet by the velocity of the bullet\n @pos.x += @vel.x\n @pos.y += @vel.y\n #moves the bullets model\n @model.x = @pos.x\n @model.y = @pos.y\n end", "def checkCollisions\n # check other sprite's collisions\n @spriteManager.resetCollisionsToCheck\n\n # check each sprite against other sprite objects.\n @spriteManager.getCollisionsToCheck.each do |spriteA|\n @spriteManager.getAllSprites.each do |spriteB|\n # The break helps optimize the collisions\n # The break statement means one object only hits another\n # object as opposed to one hitting many objects.\n # To be more accurate comment out the break statement.\n break if handleCollision spriteA, spriteB\n end\n end\n end", "def calc args\n add_new_enemies_if_needed args\n move_bullets args\n calculate_collisions args\n remove_bullets_of_screen args\nend", "def handleUpdate sprite\n\n if sprite.is_a? Atom\n sphere = sprite.node\n\n #advance the spheres velocity\n sprite.update\n\n # bounce off the walls when outside of boundaries\n sprite.vX *= -1 if sphere.getTranslateX > getGameSurface.getWidth - sphere.getBoundsInParent.getWidth or\n sphere.getTranslateX < 0\n sprite.vY *= -1 if sphere.getTranslateY > getGameSurface.getHeight - sphere.getBoundsInParent.getHeight or\n sphere.getTranslateY < 0\n end\n end", "def colliding?(x, y, dir)\n @mapobjects.collide?(x, y, dir)\n end", "def move_bullets args\n args.state.bullets.each do |bullet| # perform action on each bullet in collection\n bullet.x += bullet.speed # increment x by speed (bullets fly horizontally across screen)\n\n # By randomizing the value that increments bullet.y, the bullet does not fly straight up and out\n # of the scope of the screen. Try removing what follows bullet.speed, or changing 0.25 to 1.25 to\n # see what happens to the bullet's movement.\n bullet.y += bullet.speed.*(0.25).randomize(:ratio, :sign)\n bullet.rect = [bullet.x, bullet.y, bullet.size, bullet.size] # sets definition of bullet's rect\n end\nend", "def collide_with_characters?(x, y)\r\n collide_with_events?(x, y) || collide_with_vehicles?(x, y)\r\n end", "def notify_collision(another_box)\n @box.overlaps_with?(another_box)\n end", "def fire \n\n # Could end up spawning a number of bullets, depending on the weapon\n bullets = []\n\n # For now, we'll just spawn a small green laser bolt!\n bullets << Laser.new( :laser_small_green, @x - 64, @y + 64, false )\n\n # And just hand back that collection of bullets\n bullets\n\n end", "def checkCollide(playerBullets)\n\t\t# Removes the bullet that shot the ship\n\t\tplayerBullets.reject! do |bullet|\n\t\t\tif Gosu::distance(@x, @y, bullet.x, bullet.y) <= 10 then\n\t\t\t\ttrue\n\t\t\telse\n\t\t\t\tfalse\n\t\t\tend\n\t\tend\n\tend", "def update args\n\n # Keep the backdrop scrolling, always...\n @backdropl_spr.source_x += 2\n if @backdropl_spr.source_x > BACKDROP_WIDTH \n @backdropl_spr.source_x = 0\n end\n @backdropr_spr.source_x = @backdropl_spr.source_x\n\n\n # Check to see if the player needs creating\n if @player.nil? && @lives.positive?\n @player = Player.new args\n end\n\n\n # Also, spawn any enemies that are due\n while ( @enemy_idx < @@enemies.length ) && ( args.state.tick_count >= ( @epoch + @@enemies[@enemy_idx][:spawn] ) ) do\n @enemy << Enemy.new( @@enemies[@enemy_idx] )\n @enemy_idx += 1\n end\n\n\n # User input; see if we're moving first off\n horizontal = 0\n vertical = 0\n if args.inputs.keyboard.key_held.up || args.inputs.keyboard.key_held.w || args.inputs.controller_one.key_held.up\n vertical = 1\n end\n if args.inputs.keyboard.key_held.down || args.inputs.keyboard.key_held.s || args.inputs.controller_one.key_held.down\n vertical = -1\n end\n if args.inputs.keyboard.key_held.right || args.inputs.keyboard.key_held.d || args.inputs.controller_one.key_held.right\n horizontal = 1\n end\n if args.inputs.keyboard.key_held.left || args.inputs.keyboard.key_held.a || args.inputs.controller_one.key_held.left\n horizontal = -1\n end\n @player.move horizontal, vertical\n\n\n # If the player is firing, fire the current weapon they have\n if @player_bullets.empty? && ( args.inputs.keyboard.key_held.space || args.inputs.controller_one.key_held.a )\n @player_bullets.concat( @player.fire )\n end\n\n\n # Update the position of any player bullets\n @player_bullets.each { |bullet| bullet.update args }\n\n\n # Allow each enemy to move\n @enemy.each { |ship| ship.move }\n\n\n # Decide if any enemies get to shoot\n\n\n # And update all of their bullets, too\n @enemy_bullets.each { |bullet| bullet.update args }\n\n\n # And purge any bullets now out of scope\n @player_bullets.delete_if { |bullet| bullet.outofbounds? args.grid }\n @enemy_bullets.delete_if { |bullet| bullet.outofbounds? args.grid }\n\n \n # Check to see if any player bullets collided with any enemies\n @player_bullets.each do | bullet |\n\n # Check against each enemy\n @enemy.each do | ship |\n if bullet.collides? ship\n args.outputs.debug << [ 100, 100, \"HIT!\", 5, 1, 255, 0, 0 ].label\n end\n end\n \n end\n\n\n # Everything is fine, stick with this world!\n true\n\n end", "def calc args\n #get out of this method if the game is over\n return if args.state.game_state != \"playing\"\n # move the player's bullet\n move_player_bullet args\n # move the enemy\n move_enemy args\n # randomly fire enemy bullet\n enemy_shoot args\n # move the enemy's bullet\n move_enemy_bullet args\nend", "def check_enemies\n colliding_enemies = @game_state.enemies.select { |enemy| enemy.alive? && enemy.collides?(self) }\n self.hit!(colliding_enemies[0]) if colliding_enemies.any?\n end", "def collision?(thing)\n thing.y == @y\n end", "def update\n if idle?\n if Gosu.distance(@hb.x,@hb.y,$WINDOW.player.hb.x, $WINDOW.player.hb.y) < 150\n # If distance is 150 or less, behaviour changes to approaching\n change_state(GameStates::States::WALKING)\n @vect_v = 1\n @vect_angle = Gosu.angle(@hb.x, @hb.y, $WINDOW.player.hb.x, $WINDOW.player.hb.y)\n end\n elsif walking?\n # While walking, wolf tries to approach the main character\n @vect_angle = Gosu.angle(@hb.x, @hb.y, $WINDOW.player.hb.x, $WINDOW.player.hb.y)\n if @una_check_tiks <= 0\n # When next attack check counter reaches 0, wolf can attack.\n dieroll = Random.rand\n if dieroll <= ATTACK_PROBABILITY\n # If random is within attack probability, the wolf changes behaviour to attack\n change_state(GameStates::States::ATTACKING)\n @event_tiks =60\n @vect_v = 0\n else\n #If random is not within attack probability, next attack check counter is reset to 30.\n @una_check_tiks = 30\n end\n end\n check_change_dir\n elsif attacking?\n # If attacking, wolf waits for a little while, then charges in a straight line. Then waits a little while.\n if @event_tiks > 20\n check_change_dir\n elsif @event_tiks == 20\n @vect_angle = Gosu.angle(@hb.x, @hb.y, $WINDOW.player.hb.x, $WINDOW.player.hb.y)\n @vect_v = 3.5\n elsif @event_tiks == 10\n @venct_v = 0\n elsif @event_tiks <= 0\n change_state(GameStates::States::IDLE)\n @una_check_tiks = 100\n end\n end\n\n if normal? && $WINDOW.player.inv_frames <= 0 && !$WINDOW.player.recoiling? && @hb.check_brute_collision($WINDOW.player.hb)\n # If it connects with player, player is set to impacted.\n $WINDOW.player.impacted(@hb.center, @attack_dmg)\n end\n\n if !idle? && Gosu.distance(@hb.x,@hb.y,$WINDOW.player.hb.x, $WINDOW.player.hb.y) > 250\n #If distance surpasses 250, the wolf turns back to idle.\n change_state(GameStates:States::IDLE)\n end\n\n super\n @una_check_tiks -= 1 unless idle? || @una_check_tiks <= 0\n end", "def shoot arrow\r\n arrow.x+=arrow.vel_x\r\n arrow.y+=arrow.vel_y\r\n end", "def check_collision_x\n\tif $ball.left <= 0\n\t\tscore($p2)\t\t\t\t\t\t\t\t# Player 2 scores\n\telsif $ball.left <= $p1.right && $ball.bottom > $p1.top && $ball.top < $p1.bottom\n\t\tchange_direction_at($p1)\t# Collision with Player 1\n\telsif $ball.right >= $p2.left && $ball.bottom > $p2.top && $ball.top < $p2.bottom\n\t\tchange_direction_at($p2)\t# Collision with Player 2\n\telsif $ball.right >= 800\n\t\tscore($p1)\t\t\t\t\t\t\t\t# Player 2 scores\n\tend\n\nend", "def collides?(object2); radius_collision?(object2); end", "def collide_with_characters?(x, y)\n super || (normal_priority? && $game_player.collide?(x, y))\n end", "def disableCollisionWith _obj, _args\n \"_obj disableCollisionWith _args;\" \n end", "def collides?(other)\n !(\n @pos.x + width <= other.pos.x ||\n @pos.x >= other.pos.x + other.width ||\n @pos.y + height <= other.pos.y ||\n @pos.y >= other.pos.y + other.height\n )\n end", "def hit!(enemy)\n unless invincible?\n $window.audio_manager.play! :hurt\n hp!(0 - enemy.damage)\n invincible!(InvincibleTime)\n enemy.damage!(enemy.damage)\n end\n \n enemy.jump_back!\n end", "def collide_with_player_characters?(x, y)\r\r\n normal_priority? && $game_player.collide_rect?(x, y, collision_rect)\r\r\n end", "def collision?(direction)\r\n\t\t# do something\r\n\t\treturn false # just for now\r\n\tend", "def collide_with_characters?(x, y)\n return false if allow_overlap?\n rme_collide_with_characters?(x, y)\n end", "def handleUpdate(sprite) end", "def walking_collisions args\n num_balls = args.state.balls.length\n if num_balls > 1\n (0..num_balls - 1).each do |i|\n if i != 0\n ball1 = args.state.balls[i]\n ((i + 1)..num_balls - 1).each do |j|\n ball2 = args.state.balls[j]\n dist = (((ball1[:x] - ball2[:x]) ** 2) + ((ball1[:y] - ball2[:y]) ** 2)) ** (1/2)\n if dist < args.state.ball_diameter\n args.state.collision_data = resolve_bump ball1, ball2, dist, args\n args.state.num_collisions += 1\n args.state.balls_collided = true\n end\n end\n end\n end\n end\nend", "def collision?(other)\n Gosu::distance(@x, @y, other.x, other.y) < @radius * @size + other.radius * other.size\n end", "def collide?(piece)\n return true if boarder_collide?(piece)\n return true if piece_collide?(piece)\n end", "def set_collision\n @collision = Collision.find(params[:id])\n end", "def update\n updateTime\n if (@x - @spawnX).abs > 50\n @velX *= -1\n end\n tryMove\n collidesWithPlayer\n end", "def shoot\n\t\t# Updates last shot distance if it can't shoot\n\t\tif @lastShot <= @SHOT_LAG then\n\t\t\t@lastShot = Gosu::distance(@x, @y, @lastPosX, @lastPosY)\n\t\telse\n\t\t\t# Preps a new bullet and resets last shot distance\n\t\t\t@lastShot = 0\n\t\t\t@lastPosX = @x\n\t\t\t@lastPosY = @y\n\t\t\t# returns a bullet with a velocity 1 greater than the ship's\n\t\t\t# velocity\n\t\t\treturn Bullet.new(@window, @x, @y, 0, @vel+1, false)\n\t\tend\n\tend", "def move\n if @vect_acc > 0 || @vect_acc < 0\n if (@vect_acc > 0 && @vect_v < @max_v) || (@vect_acc < 0 && @vect_v > @max_v)\n @vect_v += @vect_acc\n else\n @vect_v = @max_v\n @vect_acc = 0\n end\n end\n vel_x = Gosu.offset_x(@vect_angle, @vect_v)\n vel_y = Gosu.offset_y(@vect_angle, @vect_v)\n can_move_x = true\n can_move_y = true\n new_hitbox = HitBox.new(@hb.x+vel_x, @hb.y, @hb.w, @hb.h)\n $WINDOW.current_map.solid_tiles.each do |tile|\n if tile.hb.check_brute_collision(new_hitbox)\n can_move_x = false\n end\n end\n\n new_hitbox = HitBox.new(@hb.x, @hb.y+vel_y, @hb.w, @hb.h)\n $WINDOW.current_map.solid_tiles.each do |tile|\n if tile.hb.check_brute_collision(new_hitbox)\n can_move_y = false\n end\n end\n\n @hb.y += vel_y if can_move_x || @floater\n @hb.x += vel_x if can_move_y || @floater\n end", "def update\n # Kill can only be true for one frame\n @kill = false if @kill\n\n # Check the state of the blast\n if @state == :initial\n elsif @state == :moving\n if @direction == :left\n @x -= SPEED\n elsif @direction == :right\n @x += SPEED\n elsif @direction == :down\n @y += SPEED\n end\n \n # check if blast has collided with anything\n # create a rectangle next to the blast\n # if it intersects with any of the platforms, collision\n can_move = true\n bx = @x\n by = @y\n bx += 10 if @direction == :left \n offset_rect = Rectangle.new(bx/SCALE, by/SCALE, @width, @height)\n #check platforms for collision\n @window.level.platforms.each do |p|\n if offset_rect.intersect?(p)\n can_move = false \n break\n end\n end\n #check enemies for collision\n @window.level.enemies.each do |e|\n if offset_rect.intersect?(e) && !e.dead?\n can_move = false\n #Recognize Enemy Types\n if !e.invincible?\n e.health -= 1\n @kill = true\n end\n break\n end\n end\n if !can_move\n @state = :collision\n @start_milliseconds = Gosu.milliseconds\n end\n elsif @state == :collision\n if Gosu.milliseconds - @start_milliseconds > EXPLOSION_TIME\n @state = :finished\n end\n end\n end", "def collide?(object)\n return false if object == self\n\n hitbox_a = case @direction\n when :down\n hitbox(0, rad_y)\n when :up\n hitbox(0, -rad_y)\n when :right\n hitbox(rad_x, 0)\n when :left\n hitbox(-rad_x, 0)\n end\n hitbox_b = object.hitbox\n\n # Return true if the hitboxes overlap\n (hitbox_a[0] & hitbox_b[0]).any? &&\n (hitbox_a[1] & hitbox_b[1]).any?\n end", "def spawn_enemy_balls\n # TODO\n end", "def collide_rect?(x, y, rect)\r\r\n !@through && (pos_rect?(x, y, rect) || followers.collide_rect?(x, y, rect))\r\r\n end", "def bounce_off_walls\n change_direction(:x) if hit_wall?(:left) || hit_wall?(:right)\n change_direction(:y) if hit_wall?(:top) #|| hit_wall?(:bottom)\n end", "def tick!\n rotate_turret\n shoot\n end", "def are_colliding?(obj1, obj2)\n obj1.center_x == obj2.center_x && obj1.center_y == obj2.center_y\n end", "def shoot\n @shooting = true\n end" ]
[ "0.77033585", "0.754493", "0.7323366", "0.69026935", "0.68877876", "0.6863643", "0.67645335", "0.6682174", "0.6529876", "0.65003633", "0.6456657", "0.6448624", "0.64131373", "0.6374127", "0.63211805", "0.63211626", "0.62875324", "0.6274564", "0.62529844", "0.6244736", "0.62249786", "0.62216043", "0.6220173", "0.6208566", "0.61712056", "0.6134218", "0.6134218", "0.6123467", "0.61161834", "0.60826254", "0.60393876", "0.60124075", "0.6001795", "0.59910196", "0.5990636", "0.5985583", "0.59831053", "0.5979413", "0.5956552", "0.5954518", "0.5949709", "0.5904939", "0.5890596", "0.58895826", "0.58866644", "0.5869948", "0.5864113", "0.58550334", "0.5823827", "0.5819698", "0.581453", "0.5809812", "0.5802683", "0.5794901", "0.57872164", "0.57577306", "0.57539845", "0.57489914", "0.57381296", "0.5737865", "0.5719815", "0.57159346", "0.57119375", "0.5686978", "0.56521285", "0.564561", "0.56414634", "0.5637617", "0.5636882", "0.5625225", "0.56211716", "0.5615871", "0.561337", "0.56054133", "0.5559148", "0.5558048", "0.55578077", "0.55541945", "0.5548987", "0.5514723", "0.5510096", "0.55090976", "0.55048853", "0.54783547", "0.547036", "0.5467627", "0.5451101", "0.5446967", "0.543698", "0.54346097", "0.5429516", "0.54235965", "0.53910154", "0.53844553", "0.537864", "0.53508246", "0.5349585", "0.53386074", "0.5338569", "0.53371227" ]
0.7371643
2
Procedure to handle collision between Player and the bullet
def player_hit(bullet) @bullets.delete bullet @ship_hit_sound.bmp.play # If the player has lost all the lifeline end the game if @player.life == 0 # Ending the game GameOverWindow.new.show close end # Player lost one lifeline @player.lose_life() # Plaing a blank heart to represent it @heart_list[@player.life] = @blank_heart @heart = @blank_heart end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enemy_bullet_collision\n if cr.defeated == false\n $e_bullets.each do |b|\n if self.bounding_box_collision?(b)\n @life -= 1\n $hud.set_lives(life)\n clear_all_bullets\n end\n end\n end\n end", "def update()\n #checks if it has hit an asteroid\n self.hit()\n #moves the bullet\n self.move()\n end", "def check_collision()\r\n # Looping through all the aliens in the game\r\n @aliens.each { |alien|\r\n # Looping through all the bulletss in the game\r\n @bullets.each { |bullet|\r\n # Distance between the bullet and the alien\r\n distance = Gosu.distance(alien.x, alien.y, bullet.x, bullet.y)\r\n # Distance between the bullet and the player\r\n hit_distance = Gosu.distance(@player.x, @player.y, bullet.x, bullet.y)\r\n # Bullets fired by the Player fit the Alien\r\n if distance < alien.radius + bullet.radius and bullet.type == 'good'\r\n alien_hit(alien, bullet)\r\n # Bullets fired by the Alien hit the Player\r\n elsif hit_distance < @player.radius + bullet.radius and bullet.type == 'evil'\r\n player_hit(bullet)\r\n end\r\n }\r\n }\r\n end", "def collision(damage)\n end", "def handleCollision spriteA, spriteB\n false\n end", "def check_collision\n colliding_enemies = @game_state.enemies.select { |enemy| enemy.collides?(self) && !enemy.hit_by.index(self) }\n if colliding_enemies.any?\n enemy = colliding_enemies.first\n enemy.damage!(@damage)\n enemy.hit_by << self\n enemy.jump_back! unless enemy.dead?\n die!\n $window.audio_manager.play! :hit\n end\n end", "def collisions\n collider.detect(self)\n end", "def hit_by_bullet\n $p_bullets.delete_if do |b|\n if self.bounding_box_collision?(b)\n @meter.change_width(b.dmg)\n b.destroy\n during(100) { @color.alpha = 100 }.then { @color.alpha = 255 }\n @life -= 1.0\n true\n end\n end\n end", "def detectCollision\n oldX = @x\n oldY = @y\n @x += @velX\n if isBlocked?\n @x = oldX\n @velX = 0\n death\n return\n end\n @y += @velY\n if isBlocked?\n @y = oldY\n @velY = 0\n death\n return\n end\n end", "def move_player_bullet args\n # don't update the position if the bullet isn't in action\n if args.state.player_bullet_shooting\n # go see if the bullet hit the enemy\n check_enemy_hit args\n # update the bullet y position\n args.state.player_bullet_y += 10\n # has the bullet gone off the top of the screen?\n if args.state.player_bullet_y > 720\n # don't bother updating it\n args.state.player_bullet_shooting = false\n end\n end\nend", "def collidesWithPlayer\n for x in @x.round..(@x + @width).round\n for y in (@y - @height).round..@y.round\n if @map.player.containsPoint?(x, y)\n @map.player.loseHealth\n death\n return\n end\n end\n end\n end", "def collide(target, arrow, flag)\r\n \r\n if arrow.x>840 and arrow.x<920\r\n \r\n if arrow.y>(target.y+20) and arrow.y<(target.y+40) || arrow.y>(target.y+120) and arrow.y<(target.y+140) #arrow hits the outter rim/band\r\n target.score+=1\r\n arrow.count-=1\r\n target.yay.play\r\n sleep(2)\r\n arrow.x=180\r\n arrow.y=320\r\n arrow.end=true\r\n flag=0\r\n\r\n elsif arrow.y>(target.y+40) and arrow.y<(target.y+60) || arrow.y>(target.y+100) and arrow.y<(target.y+120) #arrow hits the middle rim/band\r\n target.score+=2\r\n arrow.count-=1\r\n target.yay.play\r\n \r\n sleep(2)\r\n arrow.x=180\r\n arrow.y=320\r\n arrow.end=true\r\n flag=0\r\n \r\n elsif arrow.y>(target.y+60) and arrow.y<(target.y+100) #arrow hits the bullseye or innermost band\r\n target.score+=3\r\n arrow.count-=1\r\n target.yay.play\r\n sleep(2)\r\n arrow.x=180\r\n arrow.y=320\r\n arrow.end=true\r\n flag=0\r\n \r\n end\r\n\r\n end\r\n\r\n if arrow.x>WIDTH+40 || arrow.y<0 || arrow.y>HEIGHT #misses target\r\n arrow.count-=1\r\n target.ohno.play\r\n sleep(2)\r\n arrow.x=180\r\n arrow.y=320\r\n arrow.end=true\r\n flag=0\r\n \r\n end\r\n\r\n return flag\r\n end", "def move_enemy_bullet args\n # don't update the position if the bullet isn't in action\n if args.state.enemy_bullet_shooting\n # go see if the bullet hit the player\n check_player_hit args\n # update the bullet y position\n args.state.enemy_bullet_y -= 10\n # has the bullet gone off the bottom of the screen?\n if args.state.enemy_bullet_y < 0 - args.state.enemy_bullet_h\n # don't bother updating it\n args.state.enemy_bullet_shooting = false\n end\n end\nend", "def checkCollide(enemyBullets)\n enemyBullets.each do |bullet|\n if Gosu::distance(bullet.x, bullet.y, @x, @y) < 5\n @isKill = true\n end\n end\n end", "def player_fire_bullet()\r\n # This makes sure that bullets are fired after certain intervals\r\n if Gosu.milliseconds > (@seconds_elapsed * COUNTER)\r\n @seconds_elapsed = Gosu.milliseconds\r\n @bullet_sound.bmp.play()\r\n # Generating a bullet object\r\n @bullets.push Bullet.new((@player.x+ 33), @player.y, 'good')\r\n end \r\n end", "def collidesWithPlayer\n for x in @x.round..(@x + @width).round\n for y in (@y - @height).round..@y.round\n if @map.player.containsPoint?(x, y)\n @map.player.loseHealth\n end\n end\n end\n end", "def collision(other)\n\t\tif other.is_a?(Torpedo)\n\t\t\tother.collision(self)\n\t\tend\n\tend", "def collidesWithPlayer\n for x in @x.round..(@x + @width).round\n for y in (@y - @height).round..@y.round\n if @map.player.containsPoint?(x, y)\n @map.PobjectArray.delete(self)\n @map.player.loseHealth\n end\n end\n end\n end", "def checkCollide(playerBullets)\n\t\t# Removes the bullet that shot the ship\n\t\tplayerBullets.reject! do |bullet|\n\t\t\tif Gosu::distance(@x, @y, bullet.x, bullet.y) <= 10 then\n\t\t\t\ttrue\n\t\t\telse\n\t\t\t\tfalse\n\t\t\tend\n\t\tend\n\tend", "def collision obj\n\t\tend", "def collide_with!(immovable_object)\r\n r = @pos - immovable_object.pos\r\n return if r.abs > @radius + immovable_object.radius\r\n\r\n normal = r/r.abs\r\n v_normal = @speed.scalar_mult normal\r\n if v_normal < 0\r\n mult = 1 + immovable_object.elasticity\r\n @speed += normal*(-mult*v_normal)\r\n end\r\n end", "def alien_hit(alien, bullet)\r\n # Deleting the alien and the bullet object\r\n @aliens.delete alien\r\n @bullets.delete bullet\r\n @explode = true\r\n @player.update_score()\r\n # Setting the coordinates for the explosion\r\n @explode_x = alien.x\r\n @explode_y = alien.y\r\n @explosion_sound.bmp.play \r\n end", "def detectCollision\n oldX = @x\n oldY = @y\n @x += @velX\n if isBlocked?\n @x = oldX\n @velX = 0\n @map.PobjectArray.delete(self)\n return\n end\n @y += @velY\n if isBlocked?\n @y = oldY\n @velY = 0\n @map.PobjectArray.delete(self)\n return\n end\n end", "def tryMove\n if @enemy\n collidesWithPlayer\n else\n collidesWithEnemy\n end\n detectCollision\n end", "def projectile_collide(projectile)\r\r\n return if self.erased\r\r\n return if projectile.erased\r\r\n return if projectile.owner == self.owner\r\r\n return if projectile.projectile.id == self.projectile.id\r\r\n kill_judgement projectile\r\r\n @move_speed -= 0.1\r\r\n #puts self.hp\r\r\n self.hp -= 1\r\r\n if self.hp <= 0\r\r\n die\r\r\n end\r\r\n #@move_speed = ori_speed\r\r\n end", "def collide_with_player_characters?(x, y)\r\r\n normal_priority? && $game_player.collide_rect?(x, y, collision_rect)\r\r\n end", "def handleCollision spriteA, spriteB\n if spriteA.collide spriteB\n spriteA.implode self\n spriteB.implode self\n getSpriteManager.addSpritesToBeRemoved spriteA, spriteB\n true\n end\n end", "def update\n updateTime\n if (@x - @spawnX).abs > 50\n @velX *= -1\n end\n tryMove\n collidesWithPlayer\n end", "def handle_collisions\n @collisions.map do |shape, collision_context|\n game_entity = @entity_manager.find_by_shape(shape)\n game_entity.on_collide(@entity_manager, collision_context) if game_entity\n end\n @collisions = []\n end", "def collisions(obj)\n return projectile_collisions(obj) if obj.is_a?(Projectile) && obj.keep?\n return powerup_collision(obj) if obj.is_a?(Powerup)\n return unless obj.is_a?(Ball) && obj.keep?\n player_collision(obj)\n #balls_collisions(obj)\n end", "def updatePosition\n super\n\n Bullet.BulletInstances.each { |bullet|\n if collision?(bullet)\n bullet.destroy\n explode\n end\n }\n\n Ship.ShipInstances.each { |ship|\n if collision?(ship)\n ship.destroy\n explode\n end\n }\n end", "def check_collision_x\n\tif $ball.left <= 0\n\t\tscore($p2)\t\t\t\t\t\t\t\t# Player 2 scores\n\telsif $ball.left <= $p1.right && $ball.bottom > $p1.top && $ball.top < $p1.bottom\n\t\tchange_direction_at($p1)\t# Collision with Player 1\n\telsif $ball.right >= $p2.left && $ball.bottom > $p2.top && $ball.top < $p2.bottom\n\t\tchange_direction_at($p2)\t# Collision with Player 2\n\telsif $ball.right >= 800\n\t\tscore($p1)\t\t\t\t\t\t\t\t# Player 2 scores\n\tend\n\nend", "def touched_by bullet\n ([@width, @height].max/3).times do\n p_vx = rand(100)/10.0 - 5\n p_vy = rand(100)/10.0 - 5\n #@window.particles << Particle.new(@window, @x + rand(@width) - @width/2, @y + rand(@height) - @height/2, p_vx, p_vy)\n @window.particles << Live_Particle.new(@window, bullet.x + rand(@width) - @width/2, bullet.y + rand(@height) - @height/2, p_vx, p_vy, @colors.rand_in, 1 + rand)\n end\n damage bullet.damage\n end", "def notifycollision(obj); end", "def notifycollision(obj); end", "def catch_collisions\n beam_collide_enemy = [:beam, :enemy]\n enemy_collide_spaceship = [:spaceship, :enemy]\n\n Constants::SPACE.add_collision_func(*beam_collide_enemy) do |beam_shape, enemy_shape|\n add_collided_shape(beam_shape, beam_collide_enemy)\n add_collided_shape(enemy_shape, beam_collide_enemy)\n end\n Constants::SPACE.add_collision_func(*enemy_collide_spaceship) do |spaceship_shape, enemy_shape|\n add_collided_shape(enemy_shape, enemy_collide_spaceship)\n add_collided_shape(spaceship_shape, enemy_collide_spaceship)\n end\n end", "def touch?(player=@player)\n if (player.getCollisionMask.intersects_with?(getCollisionMask)) and player.status == :alive\n player.touched\n true\n else\n false\n end\n end", "def collision_players(player)\n @age>(60*5) && local && Gosu::distance(@x, @y, player.x, player.y) < (7+player.r) \n end", "def check_boundary_collision(ball) \n ball.velocity.x *= -1 unless (ball.r..width - ball.r).include? ball.position.x \n ball.velocity.y *= -1 unless (ball.r..height - ball.r).include? ball.position.y \nend", "def collides\n 'collision'\nend", "def collide(other_ball)\n # puts \"COLLISION between #{self} and #{other_ball}\"\n\n # Calculate in a rotated frame of reference where the line between the\n # balls' centers is the x axis.\n # Math lifted from http://hoomanr.com/Demos/Elastic2/\n\n m1 = self.mass\n u1 = self.total_velocity\n d1 = self.current_angle\n m2 = other_ball.mass\n u2 = other_ball.total_velocity\n d2 = other_ball.current_angle\n\n # Collision angle (radians from vertical)\n a = Math.atan2(other_ball.x - self.x, self.y - other_ball.y)\n # puts \"collision angle a = #{a}\"\n\n # X/Y velocities in rotated frame\n v1_x = u1 * Math.cos(d1 - a)\n v1_y = u1 * Math.sin(d1 - a) * -1\n v2_x = u2 * Math.cos(d2 - a)\n v2_y = u2 * Math.sin(d2 - a) * -1\n\n # puts \"v1_x = #{v1_x}\"\n # puts \"v1_y = #{v1_y}\"\n # puts \"v2_x = #{v2_x}\"\n # puts \"v2_y = #{v2_y}\"\n\n # New X-velocities (Y-velocities do not change)\n f1_x = ((v1_x * (m1 - m2)) + (2 * m2 * v2_x)) / (m1 + m2)\n f2_x = ((v2_x * (m1 - m2)) + (2 * m1 * v1_x)) / (m1 + m2)\n # puts \"f1_x = #{f1_x}\"\n # puts \"f2_x = #{f2_x}\"\n\n f1_x = bounce(f1_x)\n f2_x = bounce(f2_x)\n\n # convert back to original frame of reference\n # New total velocity\n v1 = Math.sqrt(f1_x**2 + v1_y**2)\n v2 = Math.sqrt(f2_x**2 + v2_y**2)\n # puts \"v1 = #{v1}\"\n # puts \"v2 = #{v2}\"\n\n # New direction\n begin\n e1 = Math.atan2(f1_x, v1_y) + a\n rescue\n e1 = a\n end\n begin\n e2 = Math.atan2(f2_x, v2_y) + a\n rescue\n e2 = -1 * a\n end\n # puts \"e1 = #{e1}\"\n # puts \"e2 = #{e2}\"\n\n # New velocity components\n v1_x = v1 * Math.cos(e1) * -1\n v1_y = v1 * Math.sin(e1) * -1\n v2_x = v2 * Math.cos(e2) * -1\n v2_y = v2 * Math.sin(e2) * -1\n\n # puts \"v1_x = #{v1_x}\"\n # puts \"v1_y = #{v1_y}\"\n # puts \"v2_x = #{v2_x}\"\n # puts \"v2_y = #{v2_y}\"\n\n # Update objects' velocity components\n self.vel_x = v1_x\n self.vel_y = v1_y\n other_ball.vel_x = v2_x\n other_ball.vel_y = v2_y\n end", "def collision_rect\r\r\n #return @custom_collision if @custom_collision.size > 0\r\r\n return super\r\r\n end", "def move\r\n # Move bullet fired by the Spaceship up the screen \r\n if @type == 'good'\r\n @y -= @SPEED\r\n # Move bullet fired by the Aliens down the screen \r\n elsif @type == 'evil'\r\n @y += @SPEED\r\n end\r\n end", "def collide_obstacles(block, arrow, target, flag)\r\n # if arrow.y>(block.y) and arrow.y<(target.y+40) and (arrow.x+40)>(block.x) and (arrow.x+40)<(block.x+50)\r\n if Gosu.distance(arrow.x, arrow.y, block.x, block.y) <30\r\n target.score-=1\r\n arrow.count-=1\r\n target.ohno.play\r\n sleep(1)\r\n arrow.x=180\r\n arrow.y=320\r\n arrow.end=true\r\n flag=0\r\n \r\n return flag\r\n end\r\n\r\n if (arrow.x+20)>(block.x+40)\r\n flag=1\r\n return flag\r\n end\r\n \r\n end", "def shoot_2\n if Time.now - @last_shoot_1 > 0.05\n @window.e_bullets << Ennemy_Bullet.new(@window, @player, @x - 28, @y, 0, 7)\n @window.e_bullets << Ennemy_Bullet.new(@window, @player, @x + 28, @y, 0, 7)\n @last_shoot_1 = Time.now\n end\n end", "def battler_collide(battler)\r\r\n return if self.erased\r\r\n self.hp -= 1\r\r\n battler.hp -= 1\r\r\n @dying = true\r\r\n if self.hp <= 0\r\r\n die\r\r\n end\r\r\n end", "def draw\n @running = @body.v.x.abs >= 1\n\n unless @running or @attacking #set idle sprite unless they're running or attacking\n if @direction == :left\n @sprite = @sprite_left\n else\n @sprite = @sprite_right\n end\n end\n \n if @dmg_cooldown > 0 && @direction == :right \n @sprite = @sprite_damage\n elsif @dmg_cooldown > 0 && @direction == :left\n @sprite = @sprite_damage_left\n end\n if @dead\n @sprite = Gosu::Image.new(\"assets/images/player/death.png\")\n end\n super\n end", "def collide_with_characters?(x, y)\n super || (normal_priority? && $game_player.collide?(x, y))\n end", "def move()\n #first it checks if it is on an edge\n if (\n @model.x >= Window.width-@size ||\n @model.x <= 0 ||\n @model.y >= Window.height-@size ||\n @model.y <= 0\n )\n #if the bullet is on the edge then it will die\n self.kill()\n end\n #this moves the bullet by the velocity of the bullet\n @pos.x += @vel.x\n @pos.y += @vel.y\n #moves the bullets model\n @model.x = @pos.x\n @model.y = @pos.y\n end", "def scratch_collision args\n # x collision\n ball = args.state.cueball\n baulk_line = args.state.tableleft + (args.state.table_width / 5) - args.state.ball_diameter\n if ball[:x] > baulk_line\n ball[:x] = baulk_line\n ball[:velX] = 0\n end\nend", "def shoot_1\n if Time.now - @last_shoot_1 > 0.5\n @window.e_bullets << Ennemy_Bullet.new(@window, @player, @x, @y, -2, 4)\n @window.e_bullets << Ennemy_Bullet.new(@window, @player, @x, @y, 0, 4)\n @window.e_bullets << Ennemy_Bullet.new(@window, @player, @x, @y, 2, 4)\n @last_shoot_1 = Time.now\n end\n end", "def collides?(other)\n !(\n @pos.x + width <= other.pos.x ||\n @pos.x >= other.pos.x + other.width ||\n @pos.y + height <= other.pos.y ||\n @pos.y >= other.pos.y + other.height\n )\n end", "def collide_rect?(x, y, rect)\r\r\n !@through && (pos_rect?(x, y, rect) || followers.collide_rect?(x, y, rect))\r\r\n end", "def shoot\n\t\t# Updates last shot distance if it can't shoot\n\t\tif @lastShot <= @SHOT_LAG then\n\t\t\t@lastShot = Gosu::distance(@x, @y, @lastPosX, @lastPosY)\n\t\telse\n\t\t\t# Preps a new bullet and resets last shot distance\n\t\t\t@lastShot = 0\n\t\t\t@lastPosX = @x\n\t\t\t@lastPosY = @y\n\t\t\t# returns a bullet with a velocity 1 greater than the ship's\n\t\t\t# velocity\n\t\t\treturn Bullet.new(@window, @x, @y, 0, @vel+1, false)\n\t\tend\n\tend", "def collision_tollerance\n 0.0\n end", "def colliding?(x, y, dir)\n @mapobjects.collide?(x, y, dir)\n end", "def calculate_collisions args\n args.state.bullets.each do |bullet| # perform action on every bullet and enemy in collections\n args.state.enemies.each do |enemy|\n # if bullet has not exploded yet and the bullet hits an enemy\n if !bullet.exploded && bullet.rect.intersect_rect?(enemy.rect)\n bullet.exploded = true # bullet explodes\n enemy.dead = true # enemy is killed\n end\n end\n end\n\n # All exploded bullets are rejected or removed from the bullets collection\n # and any dead enemy is rejected from the enemies collection.\n args.state.bullets = args.state.bullets.reject(&:exploded)\n args.state.enemies = args.state.enemies.reject(&:dead)\nend", "def check_enemy_hit args\n # define a rectangle around the enemy\n enemy_hitbox = [\n args.state.enemy_x,\n args.state.enemy_y,\n args.state.enemy_w,\n args.state.enemy_h\n ]\n # define a rect around the player's bullet\n player_bullet_hitbox = [\n args.state.player_bullet_x,\n args.state.player_bullet_y,\n args.state.player_bullet_w,\n args.state.player_bullet_h\n ]\n\n # draw the hitbox rects\n args.outputs.debug << {\n x: enemy_hitbox.x,\n y: enemy_hitbox.y,\n w: enemy_hitbox.w,\n h: enemy_hitbox.h,\n r: 255,\n g: 0,\n b: 0\n }.border\n\n args.outputs.debug << {\n x: player_bullet_hitbox.x,\n y: player_bullet_hitbox.y,\n w: player_bullet_hitbox.w,\n h: player_bullet_hitbox.h,\n r: 255,\n g: 0,\n b: 0\n }.border\n\n # check to see if the rects overlap\n if enemy_hitbox.intersect_rect? player_bullet_hitbox\n # the enemy has been hit\n game_over args, \"win\"\n end\nend", "def shoot\n bullet1 = Bullet.new(@x, @y, @angle, @map, @pColor)\n bullet2 = Bullet.new(@x, @y, @angle + Math::PI / 2, @map, @pColor)\n bullet3 = Bullet.new(@x, @y, @angle + Math::PI, @map, @pColor)\n bullet4 = Bullet.new(@x, @y, @angle + Math::PI * 3 / 2, @map, @pColor)\n\n @map.PobjectArray.push(bullet1)\n @map.PobjectArray.push(bullet2)\n @map.PobjectArray.push(bullet3)\n @map.PobjectArray.push(bullet4)\n end", "def collides?(object2); radius_collision?(object2); end", "def collide?(piece)\n return true if boarder_collide?(piece)\n return true if piece_collide?(piece)\n end", "def checkCollisions\n # check other sprite's collisions\n @spriteManager.resetCollisionsToCheck\n\n # check each sprite against other sprite objects.\n @spriteManager.getCollisionsToCheck.each do |spriteA|\n @spriteManager.getAllSprites.each do |spriteB|\n # The break helps optimize the collisions\n # The break statement means one object only hits another\n # object as opposed to one hitting many objects.\n # To be more accurate comment out the break statement.\n break if handleCollision spriteA, spriteB\n end\n end\n end", "def calc_player\n state.dy += state.gravity # what goes up must come down because of gravity\n calc_box_collision\n calc_edge_collision\n state.y += state.dy # Since velocity is the change in position, the change in y increases by dy\n state.x += state.dx # Ditto line above but dx and x\n state.dx *= 0.8 # Scales dx down\n end", "def update\n # Kill can only be true for one frame\n @kill = false if @kill\n\n # Check the state of the blast\n if @state == :initial\n elsif @state == :moving\n if @direction == :left\n @x -= SPEED\n elsif @direction == :right\n @x += SPEED\n elsif @direction == :down\n @y += SPEED\n end\n \n # check if blast has collided with anything\n # create a rectangle next to the blast\n # if it intersects with any of the platforms, collision\n can_move = true\n bx = @x\n by = @y\n bx += 10 if @direction == :left \n offset_rect = Rectangle.new(bx/SCALE, by/SCALE, @width, @height)\n #check platforms for collision\n @window.level.platforms.each do |p|\n if offset_rect.intersect?(p)\n can_move = false \n break\n end\n end\n #check enemies for collision\n @window.level.enemies.each do |e|\n if offset_rect.intersect?(e) && !e.dead?\n can_move = false\n #Recognize Enemy Types\n if !e.invincible?\n e.health -= 1\n @kill = true\n end\n break\n end\n end\n if !can_move\n @state = :collision\n @start_milliseconds = Gosu.milliseconds\n end\n elsif @state == :collision\n if Gosu.milliseconds - @start_milliseconds > EXPLOSION_TIME\n @state = :finished\n end\n end\n end", "def collidesWithEnemy\n for x in @x.round..(@x + @width).round\n for y in (@y - @height).round..@y.round\n if @map.enemyContainsPoint?(x, y)\n @map.PobjectArray.delete(self)\n return\n end\n end\n end\n end", "def handleUpdate sprite\n\n if sprite.is_a? Atom\n sphere = sprite.node\n\n #advance the spheres velocity\n sprite.update\n\n # bounce off the walls when outside of boundaries\n sprite.vX *= -1 if sphere.getTranslateX > getGameSurface.getWidth - sphere.getBoundsInParent.getWidth or\n sphere.getTranslateX < 0\n sprite.vY *= -1 if sphere.getTranslateY > getGameSurface.getHeight - sphere.getBoundsInParent.getHeight or\n sphere.getTranslateY < 0\n end\n end", "def collision?(other)\n Gosu::distance(@x, @y, other.x, other.y) < @radius * @size + other.radius * other.size\n end", "def update args\n\n # Keep the backdrop scrolling, always...\n @backdropl_spr.source_x += 2\n if @backdropl_spr.source_x > BACKDROP_WIDTH \n @backdropl_spr.source_x = 0\n end\n @backdropr_spr.source_x = @backdropl_spr.source_x\n\n\n # Check to see if the player needs creating\n if @player.nil? && @lives.positive?\n @player = Player.new args\n end\n\n\n # Also, spawn any enemies that are due\n while ( @enemy_idx < @@enemies.length ) && ( args.state.tick_count >= ( @epoch + @@enemies[@enemy_idx][:spawn] ) ) do\n @enemy << Enemy.new( @@enemies[@enemy_idx] )\n @enemy_idx += 1\n end\n\n\n # User input; see if we're moving first off\n horizontal = 0\n vertical = 0\n if args.inputs.keyboard.key_held.up || args.inputs.keyboard.key_held.w || args.inputs.controller_one.key_held.up\n vertical = 1\n end\n if args.inputs.keyboard.key_held.down || args.inputs.keyboard.key_held.s || args.inputs.controller_one.key_held.down\n vertical = -1\n end\n if args.inputs.keyboard.key_held.right || args.inputs.keyboard.key_held.d || args.inputs.controller_one.key_held.right\n horizontal = 1\n end\n if args.inputs.keyboard.key_held.left || args.inputs.keyboard.key_held.a || args.inputs.controller_one.key_held.left\n horizontal = -1\n end\n @player.move horizontal, vertical\n\n\n # If the player is firing, fire the current weapon they have\n if @player_bullets.empty? && ( args.inputs.keyboard.key_held.space || args.inputs.controller_one.key_held.a )\n @player_bullets.concat( @player.fire )\n end\n\n\n # Update the position of any player bullets\n @player_bullets.each { |bullet| bullet.update args }\n\n\n # Allow each enemy to move\n @enemy.each { |ship| ship.move }\n\n\n # Decide if any enemies get to shoot\n\n\n # And update all of their bullets, too\n @enemy_bullets.each { |bullet| bullet.update args }\n\n\n # And purge any bullets now out of scope\n @player_bullets.delete_if { |bullet| bullet.outofbounds? args.grid }\n @enemy_bullets.delete_if { |bullet| bullet.outofbounds? args.grid }\n\n \n # Check to see if any player bullets collided with any enemies\n @player_bullets.each do | bullet |\n\n # Check against each enemy\n @enemy.each do | ship |\n if bullet.collides? ship\n args.outputs.debug << [ 100, 100, \"HIT!\", 5, 1, 255, 0, 0 ].label\n end\n end\n \n end\n\n\n # Everything is fine, stick with this world!\n true\n\n end", "def update\n\n # Check if the player is colliding with a deadly tile. If so: Lose!\n if Position.collide?(@active_tile, @player)\n timer = Time.new\n until Time.now - timer > 3\n @player.move(:none)\n end\n Game.lose_level\n Game.lose_life\n new_level\n end\n\n # Periodically activate a deadly tile in order of decreasing rarity\n if @player.direction != :none\n if Time.now - @enemy_timer > Settings.enemy_spawn_rate\n eligable_tiles = []\n Grid.tiles.each do |tile|\n if !@target.include?(tile.contents) &&\n tile.is_deadly == false &&\n tile.contents != :empty &&\n tile.contents != \" \"\n eligable_tiles << tile.contents\n end\n end\n @enemy_tile = Grid.characters.detect{|tile| eligable_tiles.include? (tile)}\n Grid.tiles.each do |tile|\n tile.is_deadly = true if tile.contents == @enemy_tile\n end\n @enemy_timer = Time.new\n end\n end\n\n # Align the player's position to the closest tile on the grid\n if Position.within_bounds?(@player)\n @player.x, @player.y = @player.x.round_to(Settings.tile_size), @player.y.round_to(Settings.tile_size)\n end\n\n # Wrap the player around the screen if they reach the edge\n Position.wrap(@player)\n\n # Respond to Keypresses\n if button_down? KbEscape\n close\n puts \"You reached level #{Game.current_level}. Goodbye!\"\n exit\n end\n Moving.parts.each {|part| part.move :none if button_down? KbSpace}\n @player.move(:left) if button_down?(KbLeft) && Position.within_bounds?(@player) && (@player.direction != :right)\n @player.move(:right) if button_down?(KbRight) && Position.within_bounds?(@player) && (@player.direction != :left)\n @player.move(:up) if button_down?(KbUp) && Position.within_bounds?(@player) && (@player.direction != :down)\n @player.move(:down) if button_down?(KbDown) && Position.within_bounds?(@player) && (@player.direction != :up)\n\n # Move all the movable objects in the game\n @player.move(@player.direction)\n Moving.all_move\n \n # Update the player's location on the grid\n if Position.within_bounds?(@player)\n @active_tile = Grid.tiles\n .find {|tile| tile.x == @player.x\n .round_to(Settings.tile_size) && tile.y == @player.y\n .round_to(Settings.tile_size)}\n end\n\n # Have the invisible spacer tile track the player's position\n @head.x, @head.y, @head.direction = @player.path.last[0], @player.path.last[1], @player.path.last[2] \n \n # Update all the tail sections so the previous location of the section in front\n # becomes their current location\n Moving.parts.each_with_index do |section, index|\n section.path << [section.x.round_to(Settings.tile_size), section.y.round_to(Settings.tile_size), section.direction]\n leader = Moving.parts[index-1].path.last if index > 0\n section.x, section.y, section.direction = leader[0], leader[1], leader[2] if index > 0\n section.path.drop(1) if section.path.size > @message.size + 1\n end\n \n # If the player moves over a target tile create a new tail section\n if @active_tile.is_edible\n lastpath = Moving.parts.last.path.last\n image = Image.from_text(@active_tile.contents, Settings.tile_size, options={font: Settings.font, bold: true})\n Tail.new(lastpath[0], lastpath[1], lastpath[2], image)\n @completed << @active_tile.contents.to_s\n Grid.subtract_character(@active_tile.contents)\n @active_tile.contents = :empty\n @target = @target.drop(1)\n Grid.tiles.each {|tile| tile.is_edible = false}\n end\n\n # Set the target letter\n Grid.tiles.each {|tile| tile.is_edible = true if tile.contents == @target[0]}\n\n # Check if the player has collected all the target letters and in the case that\n # they have, check if they have arrived at the mailbox. If so: Level up!\n if @message.join(\"\") == @completed\n if @active_tile.y.between?(Settings.margin_bottom + Settings.tile_size / 2, Settings.margin_bottom + Settings.tile_size * 2) &&\n @active_tile.x.between?(Settings.margin_left, Settings.margin_left + Settings.tile_size)\n @player.move(:none)\n sleep 2\n Game.add_life\n new_level\n end\n end\n end", "def collision_rect\r\r\n return @collisionbox\r\r\n end", "def enableCollisionWith _obj, _args\n \"_obj enableCollisionWith _args;\" \n end", "def collision?(direction)\r\n\t\t# do something\r\n\t\treturn false # just for now\r\n\tend", "def collides?(collider)\r\n @collisions.include?(collider) #this method checks if given object is currently colliding with the collider (in that case, it's in the array)\r\n end", "def tryMove\n #Resets the angle continuously to provide accurate data.\n @angle = Math.atan2(@y - @map.player.y, @x - @map.player.x) - Math::PI / 2\n #Sets axis of acceleration with relation to the direction.\n if @direction == 1\n @aceY = Math.sin(@angle - Math::PI / 2) / 4\n else\n @aceX = Math.cos(@angle - Math::PI / 2) / 4\n end\n #Adds acceleration to velocity.\n @velX += @aceX\n @velY += @aceY\n #Terminal velocity is 3.\n if @velX > 3\n velX = 3\n elsif @velX < -3\n velX = -3\n end\n #Checks for collision and moves the missile.\n collidesWithPlayer\n detectCollision\n end", "def collision?(thing)\n thing.y == @y\n end", "def collisions args\n num_balls = args.state.balls.length\n if num_balls > 1\n (0..num_balls - 1).each do |i|\n ball1 = args.state.balls[i]\n ((i + 1)..num_balls - 1).each do |j|\n ball2 = args.state.balls[j]\n dist = (((ball1[:x] - ball2[:x]) ** 2) + ((ball1[:y] - ball2[:y]) ** 2)) ** (1/2)\n if dist < args.state.ball_diameter\n args.state.collision_data = resolve_bump ball1, ball2, dist, args\n if i == 0 and args.state.first_collision_type == 3\n args.state.first_collision_type = ball2[:type]\n end\n args.state.balls_collided = true\n end\n end\n end\n end\nend", "def update\n if idle?\n if Gosu.distance(@hb.x,@hb.y,$WINDOW.player.hb.x, $WINDOW.player.hb.y) < 150\n # If distance is 150 or less, behaviour changes to approaching\n change_state(GameStates::States::WALKING)\n @vect_v = 1\n @vect_angle = Gosu.angle(@hb.x, @hb.y, $WINDOW.player.hb.x, $WINDOW.player.hb.y)\n end\n elsif walking?\n # While walking, wolf tries to approach the main character\n @vect_angle = Gosu.angle(@hb.x, @hb.y, $WINDOW.player.hb.x, $WINDOW.player.hb.y)\n if @una_check_tiks <= 0\n # When next attack check counter reaches 0, wolf can attack.\n dieroll = Random.rand\n if dieroll <= ATTACK_PROBABILITY\n # If random is within attack probability, the wolf changes behaviour to attack\n change_state(GameStates::States::ATTACKING)\n @event_tiks =60\n @vect_v = 0\n else\n #If random is not within attack probability, next attack check counter is reset to 30.\n @una_check_tiks = 30\n end\n end\n check_change_dir\n elsif attacking?\n # If attacking, wolf waits for a little while, then charges in a straight line. Then waits a little while.\n if @event_tiks > 20\n check_change_dir\n elsif @event_tiks == 20\n @vect_angle = Gosu.angle(@hb.x, @hb.y, $WINDOW.player.hb.x, $WINDOW.player.hb.y)\n @vect_v = 3.5\n elsif @event_tiks == 10\n @venct_v = 0\n elsif @event_tiks <= 0\n change_state(GameStates::States::IDLE)\n @una_check_tiks = 100\n end\n end\n\n if normal? && $WINDOW.player.inv_frames <= 0 && !$WINDOW.player.recoiling? && @hb.check_brute_collision($WINDOW.player.hb)\n # If it connects with player, player is set to impacted.\n $WINDOW.player.impacted(@hb.center, @attack_dmg)\n end\n\n if !idle? && Gosu.distance(@hb.x,@hb.y,$WINDOW.player.hb.x, $WINDOW.player.hb.y) > 250\n #If distance surpasses 250, the wolf turns back to idle.\n change_state(GameStates:States::IDLE)\n end\n\n super\n @una_check_tiks -= 1 unless idle? || @una_check_tiks <= 0\n end", "def collide_with_characters?(x, y)\r\n collide_with_events?(x, y) || collide_with_vehicles?(x, y)\r\n end", "def set_collision\n @collision = Collision.find(params[:id])\n end", "def collisions\n [collided_bombs, collided_rubies]\n end", "def handle_hit_obstacle(object)\n end", "def hit?(x, y)\n @rect.collide_point?(x, y)\n end", "def update\r\n\r\n # Left-Arrow button pressed\r\n if $window.button_down?(Gosu::KbLeft) then\r\n\r\n # Sanity check, make sure this can grab the needed tile\r\n if ![1,2].include?(get_tile_info(@player.get_x,\r\n @player.get_y,\r\n :left)) then\r\n\r\n # Call the move_left function\r\n @player.move_left\r\n\r\n end\r\n end\r\n\r\n # Right-Arrow button pressed\r\n if $window.button_down?(Gosu::KbRight) then\r\n\r\n # Sanity check, make sure this can grab the needed tile\r\n if ![1,2].include?(get_tile_info(@player.get_x,\r\n @player.get_y,\r\n :right)) then\r\n\r\n # Call the move_right function\r\n @player.move_right\r\n\r\n end \r\n end\r\n\r\n # Update the player object\r\n @player.update\r\n\r\n # Functionalize the list of entities\r\n @entities.each{|en| \r\n en.update\r\n\r\n # Compare the player coords with the entity coords, in the event\r\n # the player has reached an item / entity location\r\n dist = Gosu::distance(@player.get_x,\r\n @player.get_y(:center),\r\n en.get_x,\r\n en.get_y)\r\n\r\n # Player closely approaches an entity...\r\n if dist < 20 then\r\n\r\n # get_score() returns a -1 in the event of invulnerability\r\n if en.get_score < 0 then\r\n @player.invulnerable\r\n @entities.delete(en)\r\n\r\n # Otherwise add this to the score and remove the item from\r\n # the map\r\n else\r\n @score += en.get_score\r\n @entities.delete(en)\r\n end\r\n end\r\n }\r\n\r\n # Handle the player falling when the down sprite is being used\r\n if [0,2,4].include?(get_tile_info(@player.get_x, @player.get_y,:down)) then\r\n\r\n # Call the fall() routine\r\n @player.fall \r\n\r\n # Handle the player respawn event\r\n if get_tile_info(@player.get_x, @player.get_y,:down) == 4 then\r\n @player.respawn\r\n end\r\n\r\n # Otherwise the the acceleration back to 0, since the player has\r\n # safely hit the ground\r\n else\r\n @player.reset_acceleration\r\n end\r\n\r\n # While jumping, move the player upwards\r\n while ![0,2].include?(get_tile_info(@player.get_x,\r\n @player.get_y - 1,\r\n :down)) do\r\n\r\n # Call the move_up() function\r\n @player.move_up\r\n end\r\n\r\n # Check if the player is current jumping\r\n if @player.is_jumping? then\r\n\r\n # Determine if the up sprite is being used\r\n if get_tile_info(@player.get_x, @player.get_y,:up) != 0 then\r\n\r\n # In which case, reset the jump event, since it has\r\n # already occurred\r\n @player.reset_jump\r\n end\r\n end\r\n\r\n # Check if the player is \"down and facing right\"\r\n if get_tile_info(@player.get_x, @player.get_y,:down) == 5 then\r\n @player.slide_left\r\n\r\n # Check if the player is \"down and facing left\"\r\n elsif get_tile_info(@player.get_x, @player.get_y,:down) == 6 then\r\n @player.slide_right\r\n end\r\n\r\n # Check if the player is inside of a hidden location\r\n if in_hidden_entrance then\r\n\r\n # Initialize the hidden tiles array\r\n @hidden_tiles = []\r\n\r\n # Cycle thru the y coords ...\r\n for y in 0...@level[1].size\r\n\r\n # ... and the x coords\r\n for x in 0...@level[1][y].size\r\n\r\n # Set the current X / Y coords\r\n curx = (x * 16) + 8\r\n cury = (y * 16) + 8\r\n\r\n # Determine the distance between the player and the\r\n # current location\r\n dist = Gosu::distance(@player.get_x,\r\n @player.get_y(:center),\r\n curx,\r\n cury)\r\n\r\n # Append the current location to the hidden tiles array\r\n if dist < 32 then\r\n @hidden_tiles << [x,y]\r\n end\r\n end\r\n end\r\n\r\n # Empty the hidden tiles array since the player is not in a hidden\r\n # location\r\n else\r\n @hidden_tiles = []\r\n end\r\n\r\n # Set the camera coords\r\n @camera_x = [[@player.get_x - 320, 0].max,\r\n @level[0][0].size * 16 - 640].min\r\n\r\n @camera_y = [[@player.get_y - 240, 0].max,\r\n @level[0].size * 16 - 480].min\r\n end", "def ball_collision(ball, direction)\n if direction == :v\n if ball.y < @pos_y &&\n ball.y + ball.radius >= @pos_y\n top_wall_collide(ball)\n return hit!\n elsif ball.y > @pos_y + BLOCK_SIZE &&\n ball.y - ball.radius <= @pos_y + BLOCK_SIZE\n bottom_wall_collide(ball)\n return hit!\n end\n elsif direction == :h\n if ball.x < @pos_x &&\n ball.x + ball.radius >= @pos_x\n left_wall_collide(ball)\n return hit!\n elsif ball.x > @pos_x + BLOCK_SIZE &&\n ball.x - ball.radius <= @pos_x + BLOCK_SIZE\n right_wall_collide(ball)\n return hit!\n end\n elsif direction == :d\n [@pos_x, @pos_x + BLOCK_SIZE]\n .product([@pos_y, @pos_y + BLOCK_SIZE])\n .each do |x, y|\n next unless Math.hypot(ball.x - x, ball.y - y) <= ball.radius\n # possibly set bounce\n ball.angle = (ball.angle + 180) % 360\n return hit!\n end\n end\n false\n end", "def calc_player\n\n # Since acceleration is the change in velocity, the change in y (dy) increases every frame.\n # What goes up must come down because of gravity.\n state.dy += state.gravity\n\n # Calls the calc_box_collision and calc_edge_collision methods.\n calc_box_collision\n calc_edge_collision\n\n # Since velocity is the change in position, the change in y increases by dy. Same with x and dx.\n state.y += state.dy\n state.x += state.dx\n\n # Scales dx down.\n state.dx *= 0.8\n end", "def move_bullets args\n args.state.bullets.each do |bullet| # perform action on each bullet in collection\n bullet.x += bullet.speed # increment x by speed (bullets fly horizontally across screen)\n\n # By randomizing the value that increments bullet.y, the bullet does not fly straight up and out\n # of the scope of the screen. Try removing what follows bullet.speed, or changing 0.25 to 1.25 to\n # see what happens to the bullet's movement.\n bullet.y += bullet.speed.*(0.25).randomize(:ratio, :sign)\n bullet.rect = [bullet.x, bullet.y, bullet.size, bullet.size] # sets definition of bullet's rect\n end\nend", "def enemy_shoot args\n # generate a random number from 0 to 99\n r = rand(100)\n # is the random number 0? that give a a 1 in 100 chance of shooting\n # is the enemy shooting? Only shoot if not already shooting.\n if r == 1 && args.state.enemy_bullet_shooting == false\n # set the enemy bullet position to the enemy position\n args.state.enemy_bullet_x = args.state.enemy_x + args.state.enemy_w / 2\n args.state.enemy_bullet_y = args.state.enemy_y\n # track state of enemy bullet\n args.state.enemy_bullet_shooting = true\n end\nend", "def are_colliding?(obj1, obj2)\n obj1.center_x == obj2.center_x && obj1.center_y == obj2.center_y\n end", "def collision_left!\n return unless state.dx < 0 # return unless player is moving left\n player_rect = [state.x - 0.1, state.y, state.tile_size, state.tile_size]\n\n # Goes through world_collision_rects to find all intersections beween the player's left side and the\n # right side of a world_collision_rect.\n left_side_collisions = state.world_collision_rects\n .find_all { |r| r[:left_right].intersect_rect?(player_rect, collision_tollerance) }\n .first\n\n return unless left_side_collisions # return unless collision occurred\n\n # player's x is set to the value of the x of the collided rect's right side\n state.x = left_side_collisions[:left_right].right\n state.dx = 0 # player isn't moving left because its path is blocked\n end", "def collide_point?(point)\n distance = Math.hypot(point[0]-@rect.center[0],point[1]-@rect.center[1])\n distance < @rect.w/2\n end", "def collision_floor!\n return unless state.dy <= 0 # return unless player is going down or is as far down as possible\n player_rect = [state.x, state.y - 0.1, state.tile_size, state.tile_size] # definition of player\n\n # Goes through world_collision_rects to find all intersections between the bottom of player's rect and\n # the top of a world_collision_rect (hence the \"-0.1\" above)\n floor_collisions = state.world_collision_rects\n .find_all { |r| r[:top].intersect_rect?(player_rect, collision_tollerance) }\n .first\n\n return unless floor_collisions # return unless collision occurred\n state.y = floor_collisions[:top].top # player's y is set to the y of the top of the collided rect\n state.dy = 0 # if a collision occurred, the player's rect isn't moving because its path is blocked\n end", "def collide(block)\n return (block.x == @x && block.y == @y)\n end", "def collision_between obj1, obj2\n\t\t\tif obj1.y + obj1.height < obj2.y ; return false ; end\n\t\t\tif obj1.y > obj2.y + obj2.height ; return false ; end\n\t\t\tif obj1.x + obj1.width < obj2.x ; return false ; end\n\t\t\tif obj1.x > obj2.x + obj2.width ; return false ; end\n\t\t\treturn true\n\t\tend", "def collide_rect?(other_rect)\n !intersects(other_rect).empty?\n end", "def update\n #Updates invulnerability timing.\n updateTime\n #If the XShooter has rotated long enough, and has nearly achieved the desired angle, shoots.\n if @shootTime > 100 and (@angle - @shootAngle).abs < 0.2\n #Sets the XShooter's angle to the shooting angle (which is 0 initially) and shoots four bullets.\n @angle = @shootAngle\n shoot\n #Increases the shoot angle so that the XShooter will change its shape the next time it shoots.\n @shootAngle += Math::PI / 4\n #Ensures the angle does not become too high.\n @shootAngle = @shootAngle % (Math::PI * 2)\n #Resets the shoot time and the reset time. This temporarily freezes the XShooter and resets the cooldown for its next\n #shot.\n @shootTime = 0\n @resetTime = 0\n end\n #If the XShooter has remained frozen for long enough, will rotate the XShooter. Note the use of rotateTime. This is to\n #ensure the XShooter does not rotate too quickly.\n if @resetTime > 30 and @rotateTime > 1\n rotate\n @rotateTime = 0\n end\n #Increments all the different timings.\n @shootTime += 1\n @resetTime += 1\n @rotateTime += 1\n end", "def checkCollision?(other)\n refresh()\n other.refresh()\n \n xMin = @center_left[X]\n xMax = @center_right[X]\n yMin = @center_bottom[Y]\n yMax = @center_top[Y]\n\n xMax > other.center_left[X] && xMin < other.center_right[X] && \n yMin > other.center_top[Y] && yMax < other.center_bottom[Y]\n end", "def update\n # Compute the passage of time.\n @new = Gosu.milliseconds\n @old ||= @new\n delta = @new - @old\n @old = @new\n\n #Update for gravity.\n @vy += @gravity\n\n # Compute the drag\n @vx *= @drag\n @vy *= @drag\n\n # Compute the new proposed position.\n @x += @vx * delta\n @y += @vy * delta\n\n # Compute the boundary limits.\n top = @y\n bottom = @y + @ball.height\n left = @x\n right = @x + @ball.width\n\n # Check for collision with the left and right walls.\n if left < 0\n @vx *= -1\n @x = -left\n elsif right > self.width\n @vx *= -1\n @x -= 2 * (right-self.width)\n end\n\n # Check for collision with the top and bottom walls.\n if top < 0\n @vy *= -1\n @y = -top\n elsif bottom > self.height\n @vy *= -1\n @y -= 2 * (bottom-self.height)\n end\n end", "def disableCollisionWith _obj, _args\n \"_obj disableCollisionWith _args;\" \n end", "def collision_rect\r\r\n collision = CXJ::FREE_MOVEMENT::DEFAULT_COLLISION\r\r\n return Rect.new(collision[0], collision[1], collision[2] - 1, collision[3] - 1)\r\r\n end", "def fire_bullet args\n return unless args.inputs.mouse.click # return unless mouse is clicked\n args.state.bullets << args.state.new_entity(:bullet) do |bullet| # new bullet is declared a new entity\n bullet.y = args.inputs.mouse.click.point.y # set to the y value of where the mouse was clicked\n bullet.x = 0 # starts on the left side of the screen\n bullet.size = 10\n bullet.speed = 10 * rand + 2 # speed of a bullet is randomized\n bullet.rect = [bullet.x, bullet.y, bullet.size, bullet.size] # definition is set\n end\nend" ]
[ "0.76419073", "0.7166491", "0.702482", "0.691303", "0.67995703", "0.67876697", "0.6663708", "0.66525656", "0.6638903", "0.6630048", "0.6535482", "0.65276384", "0.65263957", "0.65241474", "0.65043557", "0.645825", "0.64322376", "0.64170486", "0.6413933", "0.64106196", "0.6377433", "0.63661397", "0.63532895", "0.6277879", "0.62709177", "0.6267572", "0.6204515", "0.6198753", "0.61985713", "0.6189689", "0.6182616", "0.61574316", "0.6140907", "0.61171216", "0.61171216", "0.6101448", "0.6099544", "0.6098857", "0.60891306", "0.60866714", "0.6016655", "0.6007647", "0.60068065", "0.59890616", "0.59848297", "0.5978586", "0.59781927", "0.59686726", "0.59496725", "0.5861239", "0.5852938", "0.58409536", "0.5837634", "0.5831129", "0.58106834", "0.57598203", "0.57486165", "0.5740643", "0.5737019", "0.5728313", "0.5674439", "0.56584", "0.56509686", "0.564847", "0.5644699", "0.5639626", "0.56217784", "0.5614257", "0.56003064", "0.55967796", "0.55948323", "0.5590402", "0.5582255", "0.55748653", "0.5548445", "0.554161", "0.5528372", "0.5520922", "0.55097044", "0.54883164", "0.5471526", "0.547086", "0.5462115", "0.5461105", "0.5447138", "0.5443866", "0.5442967", "0.54420966", "0.54403836", "0.54279417", "0.5427306", "0.542588", "0.54242784", "0.5418438", "0.54052216", "0.54049164", "0.5402554", "0.539891", "0.5395112", "0.53882486" ]
0.6525702
13
Precdure which takes care of the collions in the game
def check_collision() # Looping through all the aliens in the game @aliens.each { |alien| # Looping through all the bulletss in the game @bullets.each { |bullet| # Distance between the bullet and the alien distance = Gosu.distance(alien.x, alien.y, bullet.x, bullet.y) # Distance between the bullet and the player hit_distance = Gosu.distance(@player.x, @player.y, bullet.x, bullet.y) # Bullets fired by the Player fit the Alien if distance < alien.radius + bullet.radius and bullet.type == 'good' alien_hit(alien, bullet) # Bullets fired by the Alien hit the Player elsif hit_distance < @player.radius + bullet.radius and bullet.type == 'evil' player_hit(bullet) end } } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def collisions\n [collided_bombs, collided_rubies]\n end", "def collisions\n collider.detect(self)\n end", "def update\n super\n\n # Cuando un pez encuentra comida\n Pez.each_collision(Comida) do |pez, comida|\n pez.comer\n comida.destroy\n end # each\n\n #Cuando se generan las burbujas\n if (Time.now - @tiempo_burbuja) > 1\n Burbuja.create\n @tiempo_burbuja = Time.now\n end # if\n\n\n\n\n\n # Cuando ha pasado el tiempo necesario, se genera comida\n if (Time.now - @comida_inicio) > @comida_tasa\n Comida.create\n @comida_inicio = Time.now\n end # if\n\n # Cuando un pez encuentra otro pez\n Pez.each_collision(Pez) do |pez1, pez2|\n # print rand(10).to_s + \"Colision: pez1.rep=#{pez1.puede_reproducir?}, pez2.rep=#{pez1.puede_reproducir?}\\n\"\n if pez1.puede_reproducir? && pez2.puede_reproducir? && pez1.get_genero != pez2.get_genero\n pez1.reproducirse\n pez2.reproducirse\n reproducir_veces = $configuracion[2][1].to_i\n pez_vida_tiempo = $configuracion[3][1].to_i\n pez_reproducir_tiempo = $configuracion[6][1].to_i\n Pez.create.definir_parametros2(pez1.get_x, pez2.get_y, rand(2)+1, pez_vida_tiempo, reproducir_veces, pez_reproducir_tiempo)\n end # if\n end # each\n\n # Cuando un tiburon encuentra con un pez\n Tiburon.each_collision(Pez) do |tiburon, pez|\n tiburon.comer_pez(pez)\n pez.destroy\n end # each\n\n # Los peces buscan particulas de comida y pareja al azar\n Pez.each do |pez|\n if pez.get_libre\n # 50 % de probabilidad de ir a buscar comida o buscar pareja\n pareja = rand(2)\n\n contador = 0\n if pareja == 1\n # los peces macho son la segunda mitad, por lo tanto si el pez\n # ... es hembra debe buscar solo los peces de la segunda mitad\n tam_pez = Pez.size / 2\n sumar = pez.get_genero == 1 ? tam_pez : 0\n elegido = rand(tam_pez) + sumar\n Pez.each do |pez2|\n if contador == elegido\n pez.buscar(pez2.get_x, pez2.get_y)\n end # if\n contador += 1\n end # each\n else\n elegido = rand(Comida.size)\n Comida.each do |comida|\n if contador == elegido\n pez.buscar(comida.get_x, comida.get_y)\n end # if\n contador += 1\n end # each\n end #if\n end # if\n\n # El pez tiende a evitar un tiburon al azar\n contador = 0\n elegido = rand(Tiburon.size)\n Tiburon.each do |tiburon|\n if contador == elegido\n pez.evitar(tiburon.get_x, tiburon.get_y)\n end # if\n contador += 1\n end # each\n end # each\n\n # Los tiburones buscan peces al azar\n Tiburon.each do |tiburon|\n contador = 0\n if tiburon.get_libre\n elegido = rand(Pez.size)\n Pez.each do |pez|\n if contador == elegido\n tiburon.buscar(pez.get_x, pez.get_y)\n end # if\n contador += 1\n end # each\n end #if\n end # each\n\n $window.caption = \"FPS: #{$window.fps} - Objetos: #{current_game_state.game_objects.size} - Peces: #{Pez.size} - Tiburones: #{Tiburon.size}\"\n end", "def collision obj\n\t\tend", "def initialize(game_container)\n @game_container = game_container\n\n @collisions = {\n # origin type => targets types\n :enemy_moved => [ :plazors, :player ] ,\n :elazor_moved => [ :player ],\n :powerup_moved => [ :player ]\n }\n end", "def setup_collisions\n self.collisions.each { |collision| collision.install_on(environment) }\n end", "def collision_rect\r\r\n #return @custom_collision if @custom_collision.size > 0\r\r\n return super\r\r\n end", "def catch_collisions\n beam_collide_enemy = [:beam, :enemy]\n enemy_collide_spaceship = [:spaceship, :enemy]\n\n Constants::SPACE.add_collision_func(*beam_collide_enemy) do |beam_shape, enemy_shape|\n add_collided_shape(beam_shape, beam_collide_enemy)\n add_collided_shape(enemy_shape, beam_collide_enemy)\n end\n Constants::SPACE.add_collision_func(*enemy_collide_spaceship) do |spaceship_shape, enemy_shape|\n add_collided_shape(enemy_shape, enemy_collide_spaceship)\n add_collided_shape(spaceship_shape, enemy_collide_spaceship)\n end\n end", "def collision(damage)\n end", "def collides\n 'collision'\nend", "def projectile\n end", "def handle_collisions\n @collisions.map do |shape, collision_context|\n game_entity = @entity_manager.find_by_shape(shape)\n game_entity.on_collide(@entity_manager, collision_context) if game_entity\n end\n @collisions = []\n end", "def calculate_collisions args\n args.state.bullets.each do |bullet| # perform action on every bullet and enemy in collections\n args.state.enemies.each do |enemy|\n # if bullet has not exploded yet and the bullet hits an enemy\n if !bullet.exploded && bullet.rect.intersect_rect?(enemy.rect)\n bullet.exploded = true # bullet explodes\n enemy.dead = true # enemy is killed\n end\n end\n end\n\n # All exploded bullets are rejected or removed from the bullets collection\n # and any dead enemy is rejected from the enemies collection.\n args.state.bullets = args.state.bullets.reject(&:exploded)\n args.state.enemies = args.state.enemies.reject(&:dead)\nend", "def collision_tollerance\n 0.0\n end", "def scratch_collision args\n # x collision\n ball = args.state.cueball\n baulk_line = args.state.tableleft + (args.state.table_width / 5) - args.state.ball_diameter\n if ball[:x] > baulk_line\n ball[:x] = baulk_line\n ball[:velX] = 0\n end\nend", "def enemy_bullet_collision\n if cr.defeated == false\n $e_bullets.each do |b|\n if self.bounding_box_collision?(b)\n @life -= 1\n $hud.set_lives(life)\n clear_all_bullets\n end\n end\n end\n end", "def main\n # fade in scene\n 16.times do\n self.update\n @viewport.color.alpha -= 16\n Graphics.update\n end\n # hide silhouette\n h = (@sprites[\"sil\"].bitmap.height/32.0).ceil\n 32.times do\n self.update\n @sprites[\"sil\"].src_rect.height -= h\n Graphics.update\n end\n # play cry\n GameData::Species.cry_filename_from_pokemon(@pokemon)\n # begin loop\n loop do\n Graphics.update\n Input.update\n self.update\n break if Input.trigger?(Input::C)\n end\n # moves Pokemon sprite to middle of screen\n w = (@viewport.width/2 - @sprites[\"poke\"].x)/32\n 32.times do\n @sprites[\"contents\"].color.alpha += 16\n @sprites[\"bg\"].color.alpha += 16\n @sprites[\"highlight\"].color.alpha += 16\n @sprites[\"poke\"].x += w\n @sprites[\"color\"].opacity += 8\n for i in 1..3\n @sprites[\"c#{i}\"].opacity += 8\n end\n self.update\n Graphics.update\n end\n @sprites[\"poke\"].x = @viewport.width/2\n Graphics.update\n end", "def coll_1\n am_ents = Sketchup.active_model.entities\n s = 300\n f1 = [ 0, 0, 0 ] , [ 0, s, 0 ] , [ s, s, 0 ] , [ s, 0, 0 ]\n f2 = [ 0, 0, s ] , [ 0, s, s ] , [ s, s, s ] , [ s, 0, s ]\n puts \"am_ents.length = #{am_ents.length}\"\n am_ents.add_face( f1 )\n puts \"am_ents.length = #{am_ents.length}\"\n am_ents.add_face( f2 )\n puts \"am_ents.length = #{am_ents.length}\"\n end", "def collided_rubies\n ruby_layers.map do |ruby|\n ruby if ruby.collide_with?(GameData.player_layer.rect_version)\n end.compact\n end", "def hit_objects\n game_state.game_object_map.collisions_with(self)\n #[game_state.game_object_map.from_game_object(self)]\n end", "def calc_player\n\n # Since acceleration is the change in velocity, the change in y (dy) increases every frame.\n # What goes up must come down because of gravity.\n state.dy += state.gravity\n\n # Calls the calc_box_collision and calc_edge_collision methods.\n calc_box_collision\n calc_edge_collision\n\n # Since velocity is the change in position, the change in y increases by dy. Same with x and dx.\n state.y += state.dy\n state.x += state.dx\n\n # Scales dx down.\n state.dx *= 0.8\n end", "def calc_player\n state.dy += state.gravity # what goes up must come down because of gravity\n calc_box_collision\n calc_edge_collision\n state.y += state.dy # Since velocity is the change in position, the change in y increases by dy\n state.x += state.dx # Ditto line above but dx and x\n state.dx *= 0.8 # Scales dx down\n end", "def detectCollision\n oldX = @x\n oldY = @y\n @x += @velX\n if isBlocked?\n @x = oldX\n @velX = 0\n @map.PobjectArray.delete(self)\n return\n end\n @y += @velY\n if isBlocked?\n @y = oldY\n @velY = 0\n @map.PobjectArray.delete(self)\n return\n end\n end", "def gameflow\n \n end", "def calc args\n add_new_enemies_if_needed args\n move_bullets args\n calculate_collisions args\n remove_bullets_of_screen args\nend", "def touched_by bullet\n ([@width, @height].max/3).times do\n p_vx = rand(100)/10.0 - 5\n p_vy = rand(100)/10.0 - 5\n #@window.particles << Particle.new(@window, @x + rand(@width) - @width/2, @y + rand(@height) - @height/2, p_vx, p_vy)\n @window.particles << Live_Particle.new(@window, bullet.x + rand(@width) - @width/2, bullet.y + rand(@height) - @height/2, p_vx, p_vy, @colors.rand_in, 1 + rand)\n end\n damage bullet.damage\n end", "def collided_bombs\n bomb_layers.map do |bomb|\n bomb if bomb.collide_with?(GameData.player_layer.rect_version)\n end.compact\n end", "def affichage_player\n\n\n end", "def collision_players(player)\n @age>(60*5) && local && Gosu::distance(@x, @y, player.x, player.y) < (7+player.r) \n end", "def resolve_horizontal_collision\n unless colliding_blocks.empty?\n x_resolutions = colliding_blocks.map do |block|\n pos = block.x2 - x1\n neg = block.x1 - x2\n\n pos < neg.abs ? pos : neg\n end\n\n z_resolutions = colliding_blocks.map do |block|\n pos = block.z2 - z1\n neg = block.z1 - z2\n\n pos < neg.abs ? pos : neg\n end\n\n pos_x, neg_x = x_resolutions.partition{|x| x > 0 }\n pos_z, neg_z = z_resolutions.partition{|z| z > 0 }\n\n dx = if pos_x.size > neg_x.size\n pos_x.min\n elsif pos_x.size < neg_x.size\n neg_x.max\n elsif pos_z.size == neg_z.size\n x_resolutions.min_by(&:abs)\n else\n 1.0/0\n end\n\n dz = if pos_z.size > neg_z.size\n pos_z.min\n elsif pos_z.size < neg_z.size\n neg_z.max\n elsif pos_x.size == neg_x.size\n z_resolutions.min_by(&:abs)\n else\n 1.0/0\n end\n\n if dx.abs < dz.abs\n @x += dx\n else\n @z += dz\n end\n end\n end", "def play\n $game.surface.+$game.white.get('Ant')\n $game.surface.+$game.black.get('Beetle')\n $game.surface.+($game.white.get('Ant'), $game.surface.bug(Hive::Color[:white], Bug::Type[:ant1]), Side::Face[:bottom_left])\n #$game.surface.+($game.black.get('Grasshopper'), $game.surface.bug(Hive::Color[:black], Bug::Type[:beetle1]), Side::Face[:bottom_left])\n $game.surface.+($game.black.get('Grasshopper'), $game.surface.bug(Hive::Color[:black], Bug::Type[:beetle1]), Side::Face[:top_right])\n $game.surface.+($game.white.get('Ant'), $game.surface.bug(Hive::Color[:white], Bug::Type[:ant2]), Side::Face[:bottom_right])\n $game.surface.+($game.black.get('Queen'), $game.surface.bug(Hive::Color[:black], Bug::Type[:grasshopper1]), Side::Face[:top_right])\n $game.surface.+($game.white.get('Queen'), $game.surface.bug(Hive::Color[:white], Bug::Type[:ant3]), Side::Face[:bottom_right])\n $game.surface.+($game.black.get('Grasshopper'), $game.surface.bug(Hive::Color[:black], Bug::Type[:queen1]), Side::Face[:top_right])\n $game.surface.+($game.white.get('Spider'), $game.surface.bug(Hive::Color[:white], Bug::Type[:queen1]), Side::Face[:bottom_center])\n $game.surface.bug(Hive::Color[:black], Bug::Type[:grasshopper2]).move(Hive::Color[:black], Bug::Type[:beetle1], Side::Face[:bottom_left])\n $game.surface.bug(Hive::Color[:white], Bug::Type[:ant2]).move(Hive::Color[:black], Bug::Type[:queen1], Side::Face[:bottom_center])\n $game.surface.+($game.black.get('Grasshopper'), $game.surface.bug(Hive::Color[:black], Bug::Type[:beetle1]), Side::Face[:top_center])\n \n # Try putting a $game.list_moves after any move directive\n\n puts \"\\n\\n=====PROOF SECTION=======================\"\n $game.surface.bug(Hive::Color[:black], Bug::Type[:beetle1]).describe\n $game.surface.bug(Hive::Color[:black], Bug::Type[:grasshopper1]).describe\n $game.surface.bug(Hive::Color[:black], Bug::Type[:grasshopper2]).describe\n $game.surface.bug(Hive::Color[:black], Bug::Type[:grasshopper3]).describe\n $game.surface.bug(Hive::Color[:black], Bug::Type[:queen1]).describe\n \n $game.surface.bug(Hive::Color[:white], Bug::Type[:ant1]).describe\n $game.surface.bug(Hive::Color[:white], Bug::Type[:ant2]).describe\n $game.surface.bug(Hive::Color[:white], Bug::Type[:ant3]).describe\n $game.surface.bug(Hive::Color[:white], Bug::Type[:queen1]).describe\n $game.surface.bug(Hive::Color[:white], Bug::Type[:spider1]).describe\n end", "def new_turn args\n # only need to reset sprites if shot called (shot not called only on break)\n if !args.state.break\n reset_sprites args\n end\n # see if the first ball the cueball collided with is valid (after, set the first ball data to a nonsensical value)\n first_collision_good = first_collision args\n args.state.first_collision_type = 3\n count_pocketed_balls args, first_collision_good\n\n # set back to cue mode and reset face if not result of scratch <---- not sure why this || is here\n if !first_collision_good #|| (args.state.table_open && !args.state.sunk)\n args.state.movement_mode = \"scratch\"\n args.state.cueball[:x] = args.state.cueball_start_x\n args.state.cueball[:y] = args.state.cueball_start_y\n args.state.cueball[:velX] = 0\n args.state.cueball[:velY] = 0\n end\n\n # set to call mode unless the shot was a scratch \n if !(args.state.movement_mode == \"scratch\")\n args.state.movement_mode = \"cue\"\n args.state.cueball[:path] = \"sprites/cueball.png\"\n args.state.called_shot = false\n # if it's a scratch, put the ball back on the table\n else\n cueball = args.state.cueball\n cueball[:x] = args.state.cueball_start_x\n cueball[:y] = args.state.cueball_start_y\n cueball[:path] = \"sprites/cueball.png\"\n end\n\n # switch players if ball not sunk on break, if unsucessful called shot, or if not collided with first \n if (args.state.break && !args.state.sunk) || !args.state.successful_call || !first_collision_good\n args.state.player = (args.state.player + 1) % args.state.num_players\n end\n\n # if grouping not set, make player 1's type so that calling ball is always first solid\n if args.state.table_open\n if args.state.player == 0\n args.state.player1_type = 0\n else\n args.state.player1_type = 1\n end\n end\n\n # always happen after shot\n args.state.break = false\n args.state.angle_chosen = false\n args.state.angle_locked = false\n\nend", "def check_encompassed_area\n @set_upper_area_sprite = false\n top_left, bot_right = get_edge_corner_dis\n last_x, last_y, copy_region = nil, nil, 0\n map_xd, map_yd = $game_map.display_x * 32, $game_map.display_y * 32\n ##total_height = (self.height + @character.jump_height).round\n total_height = (self.oy).round\n self.width.times do |x|\n xp = map_xd.to_i + top_left[0] + x\n unless xp / 32 == last_x\n last_x = xp / 32\n last_y, copy_region = nil, 0\n total_height.times do |y|\n yp = map_yd.to_i + bot_right[1] + @character.jump_height - y\n next if yp.to_i / 32 == last_y\n last_y = yp.to_i / 32\n if last_y == (@character.screen_y + map_yd).to_i / 32\n#~ if last_y == (@character.screen_y + @character.jump_height +\n#~ map_yd).to_i / 32\n break if $game_map.terrain_tag(last_x, last_y) == UpperTerrain\n next\n end\n next if $game_map.terrain_tag(last_x, last_y) != UpperTerrain\n copy_region = [self.height, total_height - y + 1].min\n set_upper_sprite\n break\n end\n end\n next if copy_region == 0\n rect = Rect.new(src_rect.x + x, src_rect.y, 1, copy_region)\n @upper_area_sprite.bitmap.blt(x, 0, self.bitmap, rect)\n self.bitmap.clear_rect(rect)\n end\n if !@set_upper_area_sprite && @upper_area_sprite\n @upper_area_sprite.visible = false\n end\n end", "def calc\n calc_in_game\n calc_sprite_selection\n end", "def collins_set_can_be_altered!\n self.collins_osc_state = nil\n end", "def collidesWithPlayer\n for x in @x.round..(@x + @width).round\n for y in (@y - @height).round..@y.round\n if @map.player.containsPoint?(x, y)\n @map.PobjectArray.delete(self)\n @map.player.loseHealth\n end\n end\n end\n end", "def handle_projectile_player_colision\n\t\twinner = false\n\n\t\t@players.each do |player|\n\t\t\tbreak if winner\n\t\t\t@projectiles.each do |projectile|\n\t\t\t\tbreak if winner\n\t\t\t\tif Game.colision?(player, projectile) && player != projectile.player\n\t\t\t\t\twinner = projectile.player\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\t@winner = winner\n\tend", "def collisions args\n num_balls = args.state.balls.length\n if num_balls > 1\n (0..num_balls - 1).each do |i|\n ball1 = args.state.balls[i]\n ((i + 1)..num_balls - 1).each do |j|\n ball2 = args.state.balls[j]\n dist = (((ball1[:x] - ball2[:x]) ** 2) + ((ball1[:y] - ball2[:y]) ** 2)) ** (1/2)\n if dist < args.state.ball_diameter\n args.state.collision_data = resolve_bump ball1, ball2, dist, args\n if i == 0 and args.state.first_collision_type == 3\n args.state.first_collision_type = ball2[:type]\n end\n args.state.balls_collided = true\n end\n end\n end\n end\nend", "def updatePosition\n super\n\n Bullet.BulletInstances.each { |bullet|\n if collision?(bullet)\n bullet.destroy\n explode\n end\n }\n\n Ship.ShipInstances.each { |ship|\n if collision?(ship)\n ship.destroy\n explode\n end\n }\n end", "def current_player_effect\n # Retire 1 au nombre de cartes a piocher du joueur en cours\n if @current_player.draw_card_count >= 1\n @current_player.draw_card_count -= 1\n end\n # Enleve une carte mixed de la main du joueur en cours\n @current_player.cards.delete_at(@current_player.cards.index(\"lock_down\"))\n end", "def check_collisions!\n 1000.times do\n @particles.values.map(&:tick)\n position_groups = @particles.values.group_by(&:position)\n collisions = position_groups.select { |pos, particles| particles.size > 1 }\n collisions.values.flatten.collect(&:num).map { |num| @particles.delete(num) }\n end\n @particles\n end", "def game; end", "def game; end", "def game; end", "def game; end", "def game; end", "def game; end", "def game; end", "def main_spriteset ; end", "def put_in_foundation\n if can_put_in_foundation?\n add_to_pile_beneath(@card_to_drop)\n @pile.cards.last.face_up unless @pile.empty?\n else\n call_off\n end\n end", "def grass_init\n #Herbe du fond\n @layer1 = Sprite.new(@viewport)\n @layer1.bitmap = RPG::Cache.transition(\"ecd_poke03\")\n @layer1.y = 240 - 128\n @layer11 = Sprite.new(@viewport)\n @layer11.bitmap = @layer1.bitmap\n #Herbe de devant\n @layer2 = Sprite.new(@viewport)\n @layer2.bitmap = RPG::Cache.transition(\"ecd_poke01\")\n @layer22 = Sprite.new(@viewport)\n @layer22.bitmap = RPG::Cache.transition(\"ecd_poke02\")\n @layer22.x = @layer11.x = 256\n @layer22.y = @layer2.y = @layer11.y = @layer1.y\n @layer2.ox = @layer22.ox = 512\n @layer11.ox = @layer1.ox = -320\n #>Fond noir qui se déplace\n @black = Sprite.new(@viewport)\n @black.bitmap = Bitmap.new(448, 240)\n @black.bitmap.fill_rect(128,0,320,240, Color.new(0,0,0))\n bmp = RPG::Cache.transition(\"ecd_z01\")\n @black.bitmap.blt(0,0, bmp, bmp.rect)\n @black.ox = 128\n\n @black.z = 99999\n @layer1.z = 101\n @layer11.z = 102\n @layer2.z = 103\n @layer22.z = 104\n @black.visible = @layer2.visible = @layer22.visible = @layer1.visible = \n @layer11.visible = false\n end", "def colliBall_h(balls)\r\n for molecule, mol_col_chk in balls.combination(2)\r\n if mol_col_chk.collide?(molecule) && (! molecule.noCollideList.include?(mol_col_chk))\r\n if @crn.reactions.key?([molecule.species, mol_col_chk.species]) \r\n @balls += split(@balls, [molecule, mol_col_chk], @crn.reactions[[molecule.species, mol_col_chk.species]][1])\r\n else \r\n #bounce around when it is not a reaction\r\n temp = Marshal.load(Marshal.dump(molecule.v))\r\n molecule.v = Marshal.load(Marshal.dump(mol_col_chk.v))\r\n mol_col_chk.v = temp\r\n end #no coList\r\n else\r\n molecule.noCollideList = molecule.noCollideList - [mol_col_chk]\r\n mol_col_chk.noCollideList = mol_col_chk.noCollideList - [molecule]\r\n end # if collide\r\n end #for\r\n end", "def release_pieces\n @game_world.release_active\n end", "def respawn_parallax(actor_name, system, time, layer)\n if system.length < 3 && system.first.x < viewport.width / 2\n actor = spawn_parallax_actor(actor_name, system, layer)\n start_parallax_actor(actor, time)\n system << actor\n end\n\n if system.first.x <= -viewport.width\n dead = system.shift\n dead.remove\n end\nend", "def resetCollisionsToCheck\n @check_collision_list.clear\n @check_collision_list += @game_actors\n end", "def setup\n super\n @background = Image['Bg level1.png']\n viewport.lag = 0\n viewport.game_area = [0, 0, 3000, 1000]\n @gilbert = Gilbert.create(x: 50, y: 900, limited: viewport.game_area.width)\n @level = File.join(ROOT, 'levels', self.filename + '.yml')\n load_game_objects(file: @level)\n\n @plataformas = Plataforma2.all\n @music = Song.new('media/Songs/Music Level1.mp3')\n @loser_song = Song.new('media/Songs/gameover.ogg')\n\n @moneda = Moneda.all.first\n\n @meta_on = false\n\n @marco_name = Image['MarcoName.png']\n @marco_score = Image['MarcoPoint.png']\n\n @score = 0\n @msj_name = Chingu::Text.new(@player_name, x: 85, y: 25, size: 30, color: Gosu::Color::WHITE)\n @msj_score = Chingu::Text.new(@score.to_s, x: $window.width - 130, y: 30, size: 35)\n @mensaje = Chingu::Text.new('Has encontrado todas las monedas', x: 320, y: 20, size: 25, color: Gosu::Color::GREEN)\n @mensaje2 = Chingu::Text.new('Encuentra la Meta', x: @msj_name.x, y: 45, size: 30, color: Gosu::Color::YELLOW)\n\n @music.play(true) if @sonido\n end", "def unclip\n loop do\n must_do = false\n $WINDOW.current_map.solid_game_objects.each do |ob|\n next if ob.id == 1 || ob.id == self.id\n if ob.hb.check_brute_collision(@hb)\n must_do = true\n clipping = true\n while (clipping)\n angle = Gosu.angle(ob.hb.x, ob.hb.y, @hb.x, @hb.y)\n add_x = Gosu.offset_x(angle, 1)\n add_y = Gosu.offset_y(angle, 1)\n place(@hb.x+add_x, @hb.y+add_y)\n if !ob.hb.check_brute_collision(@hb)\n clipping = false\n end\n end\n end\n end\n break if !must_do\n end\n end", "def levelUp\n @level += 1\n # every level requires a higher score threshhold score to advance\n @threshold += level * 150\n\n # after 9 planes, stop adding planes to make it possible to have\n # somewhere to go to dodge the planes if there is not laser\n game.add_plane if level < 9\n end", "def i_hit(others, velocity); end", "def detectCollision\n oldX = @x\n oldY = @y\n @x += @velX\n if isBlocked?\n @x = oldX\n @velX = 0\n death\n return\n end\n @y += @velY\n if isBlocked?\n @y = oldY\n @velY = 0\n death\n return\n end\n end", "def collidesWithEnemy\n for x in @x.round..(@x + @width).round\n for y in (@y - @height).round..@y.round\n if @map.enemyContainsPoint?(x, y)\n @map.PobjectArray.delete(self)\n return\n end\n end\n end\n end", "def collisions(obj)\n return projectile_collisions(obj) if obj.is_a?(Projectile) && obj.keep?\n return powerup_collision(obj) if obj.is_a?(Powerup)\n return unless obj.is_a?(Ball) && obj.keep?\n player_collision(obj)\n #balls_collisions(obj)\n end", "def collision_rect\r\r\n collision = CXJ::FREE_MOVEMENT::DEFAULT_COLLISION\r\r\n return Rect.new(collision[0], collision[1], collision[2] - 1, collision[3] - 1)\r\r\n end", "def render\n\n # Sets a black background on the screen (Comment this line out and the background will become white.)\n # Also note that black is the default color for when no color is assigned.\n outputs.solids << grid.rect\n\n # The position, size, and color (white) are set for borders given to the world collection.\n # Try changing the color by assigning different numbers (between 0 and 255) to the last three parameters.\n outputs.borders << state.world.map do |x, y|\n [x * state.tile_size,\n y * state.tile_size,\n state.tile_size,\n state.tile_size, 255, 255, 255]\n end\n\n # The top, bottom, and sides of the borders for collision_rects are different colors.\n outputs.borders << state.world_collision_rects.map do |e|\n [\n [e[:top], 0, 170, 0], # top is a shade of green\n [e[:bottom], 0, 100, 170], # bottom is a shade of greenish-blue\n [e[:left_right], 170, 0, 0], # left and right are a shade of red\n ]\n end\n\n # Sets the position, size, and color (a shade of green) of the borders of only the player's\n # box and outputs it. If you change the 180 to 0, the player's box will be black and you\n # won't be able to see it (because it will match the black background).\n outputs.borders << [state.x,\n state.y,\n state.tile_size,\n state.tile_size, 0, 180, 0]\n end", "def collides_with_field?\n end", "def projectile_collide(projectile)\r\r\n return if self.erased\r\r\n return if projectile.erased\r\r\n return if projectile.owner == self.owner\r\r\n return if projectile.projectile.id == self.projectile.id\r\r\n kill_judgement projectile\r\r\n @move_speed -= 0.1\r\r\n #puts self.hp\r\r\n self.hp -= 1\r\r\n if self.hp <= 0\r\r\n die\r\r\n end\r\r\n #@move_speed = ori_speed\r\r\n end", "def update\n super\n if BattleManager.in_turn?\n process_event\n process_action\n end\n BattleManager.judge_win_loss unless BattleManager.victory_phase?\n if BattleManager.victory_phase?\n if @victory_score.done and @victory_score.active\n sfx = CP::VICTORY::IMAGE_SFX\n vol = CP::VICTORY::SFX_VOL\n pit = CP::VICTORY::SFX_PIT\n RPG::SE.new(sfx, vol, pit).play unless sfx.nil?\n @victory_score.active = false\n @victory_item.active = true\n end\n end\n end", "def cure\n @all_ships.each(&:cure)\n end", "def create_player()\n box_vertices = polygon_vertices(NUM_SIDES, EDGE_SIZE)\n @image = init_player_on_window(box_vertices)\n @body = CP::Body.new(1, CP::moment_for_poly(10.0, box_vertices, CP::Vec2.new(0, 0))) # mass, moment of inertia\n @body.p = CP::Vec2.new(@player_x, @player_y)\n shape = CP::Shape::Poly.new(@body, box_vertices, CP::Vec2.new(0, 0))\n shape.e = 0.0\n shape.u = 0.0\n shape.collision_type = :player\n @body.a = (3*Math::PI/2.0) # angle in radians; faces towards top of screen\n @space.add_body(@body)\n @space.add_shape(shape) \n end", "def calc args\n\n # Since velocity is the change in position, the change in x increases by dx. Same with y and dy.\n args.state.player.x += args.state.player.dx\n args.state.player.y += args.state.player.dy\n\n # Since acceleration is the change in velocity, the change in y (dy) increases every frame\n args.state.player.dy += args.state.gravity\n\n # player's y position is either current y position or y position of top of\n # bridge, whichever has a greater value\n # ensures that the player never goes below the bridge\n args.state.player.y = args.state.player.y.greater(args.state.bridge_top)\n\n # player's x position is either the current x position or 0, whichever has a greater value\n # ensures that the player doesn't go too far left (out of the screen's scope)\n args.state.player.x = args.state.player.x.greater(0)\n\n # player is not falling if it is located on the top of the bridge\n args.state.player.falling = false if args.state.player.y == args.state.bridge_top\n args.state.player.rect = [args.state.player.x, args.state.player.y, args.state.player.h, args.state.player.w] # sets definition for player\n\n args.state.enemy.x += args.state.enemy.dx # velocity; change in x increases by dx\n args.state.enemy.y += args.state.enemy.dy # same with y and dy\n\n # ensures that the enemy never goes below the bridge\n args.state.enemy.y = args.state.enemy.y.greater(args.state.bridge_top)\n\n # ensures that the enemy never goes too far left (outside the screen's scope)\n args.state.enemy.x = args.state.enemy.x.greater(0)\n\n # objects that go up must come down because of gravity\n args.state.enemy.dy += args.state.gravity\n\n args.state.enemy.y = args.state.enemy.y.greater(args.state.bridge_top)\n\n #sets definition of enemy\n args.state.enemy.rect = [args.state.enemy.x, args.state.enemy.y, args.state.enemy.h, args.state.enemy.w]\n\n if args.state.enemy.y == args.state.bridge_top # if enemy is located on the top of the bridge\n args.state.enemy.dy = 0 # there is no change in y\n end\n\n # if 60 frames have passed and the enemy is not moving vertically\n if args.state.tick_count.mod_zero?(args.state.enemy_jump_interval) && args.state.enemy.dy == 0\n args.state.enemy.dy = args.state.enemy_jump_power # the enemy jumps up\n end\n\n # if 40 frames have passed or 5 frames have passed since the game ended\n if args.state.tick_count.mod_zero?(args.state.hammer_throw_interval) || args.state.game_over_at.elapsed_time == 5\n # rand will return a number greater than or equal to 0 and less than given variable's value (since max is excluded)\n # that is why we're adding 1, to include the max possibility\n volley_dx = (rand(args.state.hammer_launch_power_default) + 1) * -1 # horizontal movement (follow order of operations)\n\n # if the horizontal distance between the player and enemy is less than 128 pixels\n if (args.state.player.x - args.state.enemy.x).abs < 128\n # the change in x won't be that great since the enemy and player are closer to each other\n volley_dx = (rand(args.state.hammer_launch_power_near) + 1) * -1\n end\n\n # if the horizontal distance between the player and enemy is greater than 300 pixels\n if (args.state.player.x - args.state.enemy.x).abs > 300\n # change in x will be more drastic since player and enemy are so far apart\n volley_dx = (rand(args.state.hammer_launch_power_far) + 1) * -1 # more drastic change\n end\n\n (rand(args.state.max_hammers_per_volley) + 1).map_with_index do |i|\n args.state.enemy.hammer_queue << { # stores hammer values in a hash\n x: args.state.enemy.x,\n w: args.state.hammer_size,\n h: args.state.hammer_size,\n dx: volley_dx, # change in horizontal position\n # multiplication operator takes precedence over addition operator\n throw_at: args.state.tick_count + i * args.state.gap_between_hammers\n }\n end\n end\n\n # add elements from hammer_queue collection to the hammers collection by\n # finding all hammers that were thrown before the current frame (have already been thrown)\n args.state.enemy.hammers += args.state.enemy.hammer_queue.find_all do |h|\n h[:throw_at] < args.state.tick_count\n end\n\n args.state.enemy.hammers.each do |h| # sets values for all hammers in collection\n h[:y] ||= args.state.enemy.y + 130\n h[:dy] ||= args.state.hammer_upward_launch_power\n h[:dy] += args.state.gravity # acceleration is change in gravity\n h[:x] += h[:dx] # incremented by change in position\n h[:y] += h[:dy]\n h[:rect] = [h[:x], h[:y], h[:w], h[:h]] # sets definition of hammer's rect\n end\n\n # reject hammers that have been thrown before current frame (have already been thrown)\n args.state.enemy.hammer_queue = args.state.enemy.hammer_queue.reject do |h|\n h[:throw_at] < args.state.tick_count\n end\n\n # any hammers with a y position less than 0 are rejected from the hammers collection\n # since they have gone too far down (outside the scope's screen)\n args.state.enemy.hammers = args.state.enemy.hammers.reject { |h| h[:y] < 0 }\n\n # if there are any hammers that intersect with (or hit) the player,\n # the reset_player method is called (so the game can start over)\n if args.state.enemy.hammers.any? { |h| h[:rect].intersect_rect?(args.state.player.rect) }\n reset_player args\n end\n\n # if the enemy's rect intersects with (or hits) the player,\n # the reset_player method is called (so the game can start over)\n if args.state.enemy.rect.intersect_rect? args.state.player.rect\n reset_player args\n end\nend", "def collider\n @collider ||= Skej::Appointments::Collider.new(session)\n end", "def collision_rect\r\r\n return @collisionbox\r\r\n end", "def tick(args)\n \n # SETUP :\n setup(args) unless args.state.setup_done\n\n # MAIN LOOP :\n \n # 1. GAME LOGIC :\n\n #args.state.scene.bodies.each do |body|\n # body.rotate_absolute( { :x => args.state.angle, :y => 2*args.state.angle, :z => 1.5*args.state.angle } )\n\n # args.state.camera.rotate_y args.state.camera_angle\n # args.state.angle += 0.01\n #end\n\n args.state.scene.bodies[0].translate(0.0, 0.0, 0.25)\n if args.state.scene.bodies[0].z >= -46.0 then\n args.state.scene.bodies[0].move_to(0.0, -6.0, -50.0)\n end\n\n\n # 2. RENDERING :\n args.outputs.solids << [0, 0, 1280, 306, 0, 0, 231]\n args.outputs.solids << [0, 306, 1280, 719, 180, 180, 231]\n\n render_list = []\n args.state.scene.bodies.each do |body|\n body.vertices.each { |vertex| vertex.compute_world_coordinates(body.world_matrix) }\n\n args.state.renderer.project_vertices(body.vertices)\n render_list << body.vertices.select { |vertex| vertex.in_frustum }\n end\n\n ordered_render_list = render_list.flatten.sort_by { |v| v.view.z }.reverse\n\n ordered_render_list.each do |vertex|\n #sprite_width = ( SPRITE_SCALE * vertex.width / vertex.view.z.abs ).to_i \n #sprite_height = ( SPRITE_SCALE * vertex.height / vertex.view.z.abs ).to_i \n #sprite_x_offset = sprite_width / 2\n #sprite_y_offset = sprite_height / 2\n #args.outputs.sprites << [vertex.screen_x - sprite_x_offset,\n # vertex.screen_y - sprite_y_offset,\n # sprite_width,\n # sprite_height,\n # vertex.file]\n vertex.update(SPRITE_SCALE)\n args.outputs.sprites << vertex\n end\n\n #args.outputs.sprites << ordered_render_list.map { |vertex| vertex.update(SPRITE_SCALE); vertex }\n\n # DEBUG :\n args.outputs.labels << [10, 30, \"FPS: #{args.gtk.current_framerate.to_s.to_i}\", 0, 0, 0, 255]\n #args.state.frame_counter -= 1\nend", "def check_collision\n colliding_enemies = @game_state.enemies.select { |enemy| enemy.collides?(self) && !enemy.hit_by.index(self) }\n if colliding_enemies.any?\n enemy = colliding_enemies.first\n enemy.damage!(@damage)\n enemy.hit_by << self\n enemy.jump_back! unless enemy.dead?\n die!\n $window.audio_manager.play! :hit\n end\n end", "def update\n return if self.disposed?\n @viewport.color.alpha -= 8 if @viewport.color.alpha > 0\n @sprites[\"bg\"].update\n @sprites[\"streak\"].update\n @sprites[\"shine\"].opacity += 16/self.delta if @sprites[\"shine\"].opacity < 255\n @sprites[\"shine\"].angle += 8/self.delta if $PokemonSystem.screensize < 2\n @sprites[\"shine\"].zoom_x -= 0.04*@sprites[\"shine\"].toggle/self.delta\n @sprites[\"shine\"].zoom_y -= 0.04*@sprites[\"shine\"].toggle/self.delta\n @sprites[\"shine\"].toggle *= -1 if @sprites[\"shine\"].zoom_x <= 0.8 || @sprites[\"shine\"].zoom_x >= 1.2\n return if !@started\n @sprites[\"vs\"].x += @sprites[\"vs\"].toggle\n @sprites[\"vs\"].y += @sprites[\"vs\"].toggle\n @sprites[\"vs\"].toggle *= -1 if (@sprites[\"vs\"].x - 92).abs >= 2*self.delta\n end", "def collide(target, arrow, flag)\r\n \r\n if arrow.x>840 and arrow.x<920\r\n \r\n if arrow.y>(target.y+20) and arrow.y<(target.y+40) || arrow.y>(target.y+120) and arrow.y<(target.y+140) #arrow hits the outter rim/band\r\n target.score+=1\r\n arrow.count-=1\r\n target.yay.play\r\n sleep(2)\r\n arrow.x=180\r\n arrow.y=320\r\n arrow.end=true\r\n flag=0\r\n\r\n elsif arrow.y>(target.y+40) and arrow.y<(target.y+60) || arrow.y>(target.y+100) and arrow.y<(target.y+120) #arrow hits the middle rim/band\r\n target.score+=2\r\n arrow.count-=1\r\n target.yay.play\r\n \r\n sleep(2)\r\n arrow.x=180\r\n arrow.y=320\r\n arrow.end=true\r\n flag=0\r\n \r\n elsif arrow.y>(target.y+60) and arrow.y<(target.y+100) #arrow hits the bullseye or innermost band\r\n target.score+=3\r\n arrow.count-=1\r\n target.yay.play\r\n sleep(2)\r\n arrow.x=180\r\n arrow.y=320\r\n arrow.end=true\r\n flag=0\r\n \r\n end\r\n\r\n end\r\n\r\n if arrow.x>WIDTH+40 || arrow.y<0 || arrow.y>HEIGHT #misses target\r\n arrow.count-=1\r\n target.ohno.play\r\n sleep(2)\r\n arrow.x=180\r\n arrow.y=320\r\n arrow.end=true\r\n flag=0\r\n \r\n end\r\n\r\n return flag\r\n end", "def update\r\n update_h(@balls)\r\n colliBall_h(@balls)\r\n colliWall_h(@balls)\r\n end", "def drawVolcanicAsh\n # apply sky tone\n if @sprites[\"sky\"]\n @sprites[\"sky\"].tone.all -= 4 if @sprites[\"sky\"].tone.all > -100\n @sprites[\"sky\"].tone.gray += 16 if @sprites[\"sky\"].tone.gray < 128\n for i in 0..1\n @sprites[\"cloud#{i}\"].tone.all -= 4 if @sprites[\"cloud#{i}\"].tone.all > -100\n @sprites[\"cloud#{i}\"].tone.gray += 16 if @sprites[\"cloud#{i}\"].tone.gray < 128\n end\n end\n for j in 0...72\n next if @sprites[\"w_volc#{j}\"]\n @sprites[\"w_volc#{j}\"] = Sprite.new(@viewport)\n @sprites[\"w_volc#{j}\"].create_rect(5, 5, Color.black)\n @sprites[\"w_volc#{j}\"].default!\n @sprites[\"w_volc#{j}\"].angle = 90\n @sprites[\"w_volc#{j}\"].oy = 2\n @sprites[\"w_volc#{j}\"].opacity = 0\n end\n end", "def update\n return if self.disposed?\n @sprites[\"bg\"].update\n @sprites[\"streak\"].update\n @sprites[\"shine\"].angle += 8.delta_sub if $PokemonSystem.screensize < 2\n @sprites[\"shine\"].zoom_x -= (0.04*@sprites[\"shine\"].toggle).delta_sub(true)\n @sprites[\"shine\"].zoom_y -= (0.04*@sprites[\"shine\"].toggle).delta_sub(true)\n @sprites[\"shine\"].toggle *= -1 if @sprites[\"shine\"].zoom_x <= 0.8 || @sprites[\"shine\"].zoom_x >= 1.2\n # skips the animation that is not called before the end of the whole animation\n return if !@started\n @viewport.color.alpha -= 16.delta_sub if @viewport.color.alpha > 0\n @sprites[\"trainer_a\"].x -= 1 if @i < 12\n @sprites[\"vs\"].x += @sprites[\"vs\"].toggle\n @sprites[\"vs\"].y += @sprites[\"vs\"].toggle\n @sprites[\"vs\"].toggle *= -1 if (@sprites[\"vs\"].x - 140).abs >= 2\n @i += 1 if @i < 128\n end", "def checkCollide(playerBullets)\n\t\t# Removes the bullet that shot the ship\n\t\tplayerBullets.reject! do |bullet|\n\t\t\tif Gosu::distance(@x, @y, bullet.x, bullet.y) <= 10 then\n\t\t\t\ttrue\n\t\t\telse\n\t\t\t\tfalse\n\t\t\tend\n\t\tend\n\tend", "def repos_enemy\n @enemies.each do |i|\n i.x -= @delta_x\n i.y -= @delta_y\n end\n @ground.x -= @delta_x\n @ground.y -= @delta_y\n end", "def initialize\n @width = 800\n @width_tiles = @width / 32\n @height = 640\n @height_tiles = @height / 32\n @keys = []\n super(@width, @height, fullscreen = false)\n self.caption = \"Aetheris\"\n\n @spell = Gosu::Image.new(Utils.image_path_for(\"explosion\"), rect: [0, 0, 32 * 3, 32 * 3])\n @spell_cooldown = 0\n @game_name = Gosu::Image.from_text(\"Aetheris\", 100)\n @player = Player.new(self)\n @npc = NPC.new\n @player.warp(300, 200)\n @visibility = { fog: 3 }\n @map = Gosu::Image.new(\"images/map.jpg\")\n @low_grass = @map.subimage(32, 32 * 2, 22, 22)\n @camera = Camera.new(x: 0, y: 0, width: WIDTH, height: HEIGHT)\n @interacting = false\n @spell_avalanche_of_fire = nil\n end", "def deuce?\n @points >= 3 && @points == @opponent.points\n end", "def deuce?\n @points >= 3 && @points == @opponent.points\n end", "def evilTeam(viewport = nil, trainerid = -1)\n @viewport = viewport if !@viewport && !viewport.nil?\n @sprites = {} if !@sprites\n @viewport.color = Color.new(0, 0, 0, 0)\n # fades viewport to black\n 8.delta_add.times do\n @viewport.color.alpha += 32/self.delta\n pbWait(1)\n end\n @viewport.color.alpha = 255\n bitmaps = [\n \"Graphics/EBDX/Transitions/EvilTeam/background\",\n \"Graphics/EBDX/Transitions/EvilTeam/swirl\",\n \"Graphics/EBDX/Transitions/EvilTeam/ray0\",\n \"Graphics/EBDX/Transitions/EvilTeam/ray1\",\n \"Graphics/EBDX/Transitions/EvilTeam/logo0\",\n \"Graphics/EBDX/Transitions/EvilTeam/logo1\",\n \"Graphics/EBDX/Transitions/EvilTeam/ring0\",\n \"Graphics/EBDX/Transitions/EvilTeam/ring1\"\n ]\n # try resolve the bitmaps\n bitmaps = checkForTrainerVariant(bitmaps, GameData::TrainerType.get(trainerid))\n # creates background graphic\n @sprites[\"bg\"] = Sprite.new(@viewport)\n @sprites[\"bg\"].bitmap = pbBitmap(bitmaps[0])\n @sprites[\"bg\"].color = Color.black\n # creates background swirl\n @sprites[\"bg2\"] = Sprite.new(@viewport)\n @sprites[\"bg2\"].bitmap = pbBitmap(bitmaps[1])\n @sprites[\"bg2\"].ox = @sprites[\"bg2\"].bitmap.width/2\n @sprites[\"bg2\"].oy = @sprites[\"bg2\"].bitmap.height/2\n @sprites[\"bg2\"].x = @viewport.width/2\n @sprites[\"bg2\"].y = @viewport.height/2\n @sprites[\"bg2\"].visible = false\n # sets up all particles\n speed = []\n for j in 0...16\n @sprites[\"e1_#{j}\"] = Sprite.new(@viewport)\n bmp = pbBitmap(bitmaps[2])\n @sprites[\"e1_#{j}\"].bitmap = Bitmap.new(bmp.width,bmp.height)\n w = bmp.width/(1 + rand(3))\n @sprites[\"e1_#{j}\"].bitmap.stretch_blt(Rect.new(0,0,w,bmp.height),bmp,Rect.new(0,0,bmp.width,bmp.height))\n @sprites[\"e1_#{j}\"].oy = @sprites[\"e1_#{j}\"].bitmap.height/2\n @sprites[\"e1_#{j}\"].angle = rand(360)\n @sprites[\"e1_#{j}\"].opacity = 0\n @sprites[\"e1_#{j}\"].x = @viewport.width/2\n @sprites[\"e1_#{j}\"].y = @viewport.height/2\n speed.push(4 + rand(5))\n end\n # creates logo\n @sprites[\"logo\"] = Sprite.new(@viewport)\n @sprites[\"logo\"].bitmap = pbBitmap(bitmaps[4])\n @sprites[\"logo\"].ox = @sprites[\"logo\"].bitmap.width/2\n @sprites[\"logo\"].oy = @sprites[\"logo\"].bitmap.height/2\n @sprites[\"logo\"].x = @viewport.width/2\n @sprites[\"logo\"].y = @viewport.height/2\n @sprites[\"logo\"].memorize_bitmap\n @sprites[\"logo\"].bitmap = pbBitmap(bitmaps[5])\n @sprites[\"logo\"].zoom_x = 2\n @sprites[\"logo\"].zoom_y = 2\n @sprites[\"logo\"].z = 50\n # creates flash ring graphic\n @sprites[\"ring\"] = Sprite.new(@viewport)\n @sprites[\"ring\"].bitmap = pbBitmap(bitmaps[6])\n @sprites[\"ring\"].ox = @sprites[\"ring\"].bitmap.width/2\n @sprites[\"ring\"].oy = @sprites[\"ring\"].bitmap.height/2\n @sprites[\"ring\"].x = @viewport.width/2\n @sprites[\"ring\"].y = @viewport.height/2\n @sprites[\"ring\"].zoom_x = 0\n @sprites[\"ring\"].zoom_y = 0\n @sprites[\"ring\"].z = 100\n # creates secondary particles\n for j in 0...32\n @sprites[\"e2_#{j}\"] = Sprite.new(@viewport)\n bmp = pbBitmap(bitmaps[3])\n @sprites[\"e2_#{j}\"].bitmap = bmp\n @sprites[\"e2_#{j}\"].oy = @sprites[\"e2_#{j}\"].bitmap.height/2\n @sprites[\"e2_#{j}\"].angle = rand(360)\n @sprites[\"e2_#{j}\"].opacity = 0\n @sprites[\"e2_#{j}\"].x = @viewport.width/2\n @sprites[\"e2_#{j}\"].y = @viewport.height/2\n @sprites[\"e2_#{j}\"].z = 100\n end\n # creates secondary flash ring\n @sprites[\"ring2\"] = Sprite.new(@viewport)\n @sprites[\"ring2\"].bitmap = pbBitmap(bitmaps[7])\n @sprites[\"ring2\"].ox = @sprites[\"ring2\"].bitmap.width/2\n @sprites[\"ring2\"].oy = @sprites[\"ring2\"].bitmap.height/2\n @sprites[\"ring2\"].x = @viewport.width/2\n @sprites[\"ring2\"].y = @viewport.height/2\n @sprites[\"ring2\"].visible = false\n @sprites[\"ring2\"].zoom_x = 0\n @sprites[\"ring2\"].zoom_y = 0\n @sprites[\"ring2\"].z = 100\n # first phase of animation\n for i in 0...32.delta_add\n @viewport.color.alpha -= 8/self.delta if @viewport.color.alpha > 0\n @sprites[\"logo\"].zoom_x -= (1/32.0)/self.delta\n @sprites[\"logo\"].zoom_y -= (1/32.0)/self.delta\n for j in 0...16\n next if j > i/4.delta_add\n if @sprites[\"e1_#{j}\"].ox < -(@viewport.width/2)\n speed[j] = 4 + rand(5)\n @sprites[\"e1_#{j}\"].opacity = 0\n @sprites[\"e1_#{j}\"].ox = 0\n @sprites[\"e1_#{j}\"].angle = rand(360)\n bmp = pbBitmap(bitmaps[3])\n @sprites[\"e1_#{j}\"].bitmap.clear\n w = bmp.width/(1 + rand(3))\n @sprites[\"e1_#{j}\"].bitmap.stretch_blt(Rect.new(0,0,w,bmp.height),bmp,Rect.new(0,0,bmp.width,bmp.height))\n end\n @sprites[\"e1_#{j}\"].opacity += speed[j]/self.delta\n @sprites[\"e1_#{j}\"].ox -= [1, speed[j]/self.delta].max\n end\n pbWait(1)\n end\n # configures logo graphic\n @sprites[\"logo\"].color = Color.white\n @sprites[\"logo\"].restore_bitmap\n @sprites[\"ring2\"].visible = true\n @sprites[\"bg2\"].visible = true\n @viewport.color = Color.white\n # final animation of background and particles\n for i in 0...144.delta_add\n if i >= 128.delta_add\n @viewport.color.alpha += 16/self.delta\n else\n @viewport.color.alpha -= 16/self.delta if @viewport.color.alpha > 0\n end\n @sprites[\"logo\"].color.alpha -= 16/self.delta if @sprites[\"logo\"].color.alpha > 0\n @sprites[\"bg\"].color.alpha -= 8/self.delta if @sprites[\"bg\"].color.alpha > 0\n for j in 0...16\n if @sprites[\"e1_#{j}\"].ox < -(@viewport.width/2)\n speed[j] = 4 + rand(5)\n @sprites[\"e1_#{j}\"].opacity = 0\n @sprites[\"e1_#{j}\"].ox = 0\n @sprites[\"e1_#{j}\"].angle = rand(360)\n bmp = pbBitmap(bitmaps[2])\n @sprites[\"e1_#{j}\"].bitmap.clear\n w = bmp.width/(1 + rand(3))\n @sprites[\"e1_#{j}\"].bitmap.stretch_blt(Rect.new(0,0,w,bmp.height),bmp,Rect.new(0,0,bmp.width,bmp.height))\n end\n @sprites[\"e1_#{j}\"].opacity += speed[j]/self.delta\n @sprites[\"e1_#{j}\"].ox -= [1, speed[j]/self.delta].max\n end\n for j in 0...32\n next if j > (i*2).delta_add\n @sprites[\"e2_#{j}\"].ox -= 16/self.delta\n @sprites[\"e2_#{j}\"].opacity += 16/self.delta\n end\n @sprites[\"ring\"].zoom_x += 0.1/self.delta\n @sprites[\"ring\"].zoom_y += 0.1/self.delta\n @sprites[\"ring\"].opacity -= 8/self.delta\n @sprites[\"ring2\"].zoom_x += 0.2/self.delta if @sprites[\"ring2\"].zoom_x < 3\n @sprites[\"ring2\"].zoom_y += 0.2/self.delta if @sprites[\"ring2\"].zoom_y < 3\n @sprites[\"ring2\"].opacity -= 16/self.delta\n @sprites[\"bg2\"].angle += 2/self.delta if $PokemonSystem.screensize < 2\n pbWait(1)\n end\n # disposes all sprites\n pbDisposeSpriteHash(@sprites)\n # fades viewport\n 8.delta_add.times do\n @viewport.color.red -= (255/8.0)/self.delta\n @viewport.color.green -= (255/8.0)/self.delta\n @viewport.color.blue -= (255/8.0)/self.delta\n pbWait(1)\n end\n @viewport.color = Color.black\n EliteBattle.set(:colorAlpha, 255)\n return true\n end", "def spawned; end", "def spawned; end", "def opponent_effect_sources\n []\n end", "def collide?(piece)\n return true if boarder_collide?(piece)\n return true if piece_collide?(piece)\n end", "def finalize_game\n\n end", "def initialize args\n\n # Build the scrolling backdrop - for now, the backdrop is split in half because of Reasons.\n divide = args.grid.center_x.div( BACKDROP_WIDTH ) * BACKDROP_WIDTH\n @backdropl_spr = AhnSprite.new \"backdrop\", divide, args.grid.h\n 0.step( args.grid.h, BACKDROP_HEIGHT ).each do |row|\n 0.step( ( divide ) + BACKDROP_WIDTH, BACKDROP_WIDTH ).each do |col|\n @backdropl_spr.sprites << { x: col, y: row, w: BACKDROP_WIDTH, h: BACKDROP_HEIGHT, path: \"sprites/backdrop.png\" }\n end\n end\n @backdropl_spr.x = 0\n\n @backdropr_spr = AhnSprite.new \"backdrop\", args.grid.w - divide, args.grid.h\n 0.step( args.grid.h, BACKDROP_HEIGHT ).each do |row|\n 0.step( ( args.grid.w - divide ) + BACKDROP_WIDTH, BACKDROP_WIDTH ).each do |col|\n @backdropr_spr.sprites << { x: col, y: row, w: BACKDROP_WIDTH, h: BACKDROP_HEIGHT, path: \"sprites/backdrop.png\" }\n end\n end\n @backdropr_spr.x = divide\n\n # Set up the world; leave the player empty, update will spawn him/her\n @player = nil\n @lives = 3\n @player_bullets = []\n\n # Remember the epoch we started at, to trigger enemies at the right time\n @epoch = args.state.tick_count\n @enemy_idx = 0\n @enemy = []\n @enemy_bullets = []\n\n end", "def check_surf(animation=nil)\n events=$PokemonGlobal.dependentEvents\n for i in 0...events.length\n if events[i] && events[i][8]==\"Dependent\"\n events[i][6]=sprintf(\"nil\")\n @realEvents[i].character_name=sprintf(\"nil\")\n else\n if $Trainer.party[0].hp>0 && !$Trainer.party[0].egg?\n if $Trainer.party[0].hasType?(:WATER)\n else\n remove_sprite\n pbWait(20)\n end\n elsif $Trainer.party[0].hp<=0 \n end\n end\n end\n end", "def enableCollisionWith _obj, _args\n \"_obj enableCollisionWith _args;\" \n end", "def main_sprite ; end", "def enforce_bounds\n sorted_flakes = @flakes.sort_by { |flake| flake.position }\n\n sorted_flakes.each_with_index do |flake, idx|\n break if idx == sorted_flakes.size - 1\n next_flake = sorted_flakes[idx + 1]\n\n if collides_exact?(flake, next_flake)\n flake.switch_direction\n next_flake.switch_direction\n end\n end\n\n super\n end", "def start_phase4\n @a_remaining_pk.visible = false\n @e_remaining_pk.visible = false if $game_temp.trainer_battle\n @phase = 4\n $game_temp.battle_turn += 1\n for index in 0...$data_troops[@troop_id].pages.size\n page = $data_troops[@troop_id].pages[index]\n if page.span == 1\n $game_temp.battle_event_flags[index] = false\n end\n end\n @enemy_actions.clear\n @actor_actions.clear\n #Test IA\n @seed = @magneto.get_action\n @actor_actions += @magneto.get_action\n @enemy_actions += @magneto.get_action\n pc \"New seed : #{@seed}\"\n srand(@seed)\n #>Sécurité\n BattleEngine::set_actors(@actors)\n BattleEngine::set_enemies(@enemies)\n @actions = BattleEngine::_make_action_order(@actor_actions, @enemy_actions, @actors, @enemies)\n @phase4_step = 0\n launch_phase_event(4,true)\n end", "def ravel; end", "def handleUpdate(sprite) end", "def notifycollision(obj); end", "def notifycollision(obj); end", "def collide(object)\n\t\t# reverse direction of velocity\n\t\tdirection = (object.direction+Math::PI)%(2*Math::PI)\n\t\t\n\t\t# length of projection\n\t\tx_overlap = min(@x+SIZE, object.x+object.width)-max(@x, object.x);\n\t\ty_overlap = min(@y+SIZE, object.y+object.height)-max(@y, object.y);\n\t\t\n\t\tw = x_overlap.abs\n\t\th = y_overlap.abs\n\t\t\n\t\tif(direction>$DIR_RIGHT and direction<$DIR_DOWN)\n\t\t\t#first quadrant\n\t\t\tdiv = Math.atan2(h, w)\n\t\t\t\n\t\t\tif(direction>div)\n\t\t\t\tlength = (h/2)/Math.sin(direction)\n\t\t\telse\n\t\t\t\tlength = (w/2)/Math.cos(direction)\n\t\t\tend\n\t\t\t\n\t\t\tlength *= 2\n\t\telsif(direction>$DIR_DOWN and direction<$DIR_LEFT)\n\t\t\t#second quadrant\n\t\t\tdiv = Math.atan2(w, h)\n\t\t\tadj_angle = direction-Math::PI/2\n\t\t\t\n\t\t\tif(adj_angle>div)\n\t\t\t\tlength = (w/2)/Math.sin(adj_angle)\n\t\t\telse\n\t\t\t\tlength = (h/2)/Math.cos(adj_angle)\n\t\t\tend\n\t\t\t\n\t\t\tlength *= 2\n\t\telsif(direction>$DIR_LEFT and direction<$DIR_UP)\n\t\t\t#third quadrant\n\t\t\tdiv = Math.atan2(h, w)\n\t\t\tadj_angle = direction-Math::PI\n\t\t\t\n\t\t\tif(adj_angle>div)\n\t\t\t\tlength = (h/2)/Math.sin(adj_angle)\n\t\t\telse\n\t\t\t\tlength = (w/2)/Math.cos(adj_angle)\n\t\t\tend\n\t\t\t\n\t\t\tlength *= 2\n\t\telsif(direction>$DIR_UP and direction<2*Math::PI)\n\t\t\t#fourth quadrant\n\t\t\tdiv = Math.atan2(w, h)\n\t\t\tadj_angle = direction-3*Math::PI/2\n\t\t\t\n\t\t\tif(adj_angle>div)\n\t\t\t\tlength = (w/2)/Math.sin(adj_angle)\n\t\t\telse\n\t\t\t\tlength = (h/2)/Math.cos(adj_angle)\n\t\t\tend\n\t\t\t\n\t\t\tlength *= 2\n\t\telsif(direction==$DIR_RIGHT or direction==$DIR_LEFT)\n\t\t\tlength = w\n\t\telsif(direction==$DIR_DOWN or direction==$DIR_UP)\n\t\t\tlength = h\n\t\tend\n\t\t\n\t\t# correct position\n\t\tobject.x += length*Math.cos(direction)\n\t\tobject.y += length*Math.sin(direction)\n\t\t\n\t\t# calculate surface normal\n\t\tdir = ($DIR_UP-Math.atan2(midx-object.midx, midy-object.midy))+Math::PI/4\n\t\tnormal = (dir/(Math::PI/2)).floor*(Math::PI/2)\n\t\t@last_norm = normal\n\t\treturn normal\n\tend" ]
[ "0.6228185", "0.6215297", "0.6119634", "0.61191005", "0.6048972", "0.60473704", "0.60404915", "0.5999571", "0.59610826", "0.5938988", "0.5888978", "0.587969", "0.58630925", "0.5861626", "0.578402", "0.5681111", "0.56485826", "0.5647796", "0.5643066", "0.5591072", "0.5560614", "0.55563384", "0.5538494", "0.55273795", "0.5516111", "0.54997545", "0.54893875", "0.5460021", "0.54351336", "0.5376042", "0.53695995", "0.53683776", "0.5355618", "0.5354295", "0.5353337", "0.53512627", "0.53488314", "0.5345369", "0.53212225", "0.5310535", "0.53105086", "0.53067255", "0.53067255", "0.53067255", "0.53067255", "0.53067255", "0.5306279", "0.5306279", "0.5299606", "0.5294796", "0.5284745", "0.5283784", "0.5275741", "0.52675873", "0.52673507", "0.52646697", "0.52615464", "0.5251736", "0.52388364", "0.5235662", "0.5229519", "0.5229022", "0.5227962", "0.52252", "0.5220383", "0.5217537", "0.52171016", "0.52157766", "0.5194792", "0.5185185", "0.5178237", "0.51719165", "0.51698107", "0.51674", "0.51610714", "0.5154672", "0.5136274", "0.51332426", "0.5128874", "0.5106972", "0.5104682", "0.5104574", "0.5097369", "0.5097369", "0.5094952", "0.5091525", "0.5091525", "0.5089578", "0.5075761", "0.50741", "0.50720215", "0.5063542", "0.50618416", "0.5061744", "0.50533676", "0.50479573", "0.5045422", "0.5044738", "0.50424355", "0.50424355", "0.50423056" ]
0.0
-1
procedure to create sound effects in the game
def play_track(path) @song = Gosu::Song.new(path) @song.play(false) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_sound\n @effects = EffectsSystem.new(@window)\n @effects.add_effect(:thud, \"assets/sand2.ogg\")\n end", "def sound; end", "def setup_sound\n return unless PONY::ERRNO::check_sequence(current_act)\n name = @acts[1]\n vol = @acts[2] || 100\n pitch = @acts[3] || 100\n RPG::SE.new(name,vol,pitch).play\n end", "def setup_sound\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n name = @acts[1]\n vol = @acts[2] || 100\n pitch = @acts[3] || 100\n RPG::SE.new(name,vol,pitch).play\n end", "def make_a_sound\n\t\tputs \"ROARRRR!!!\"\n\tend", "def setSoundEffect _obj, _args\n \"_obj setSoundEffect _args;\" \n end", "def play_sound\n case @type\n when 1; Sound.play_forge_item\n when 2; Sound.play_forge_weapon\n when 3; Sound.play_forge_armor\n else; Sound.play_use_item\n end\n end", "def effectiveness_sound(effectiveness)\n if effectiveness == 1\n Audio.se_play('Audio/SE/hit')\n elsif effectiveness > 1\n Audio.se_play('Audio/SE/hitplus')\n else\n Audio.se_play('Audio/SE/hitlow')\n end\n end", "def buz; Sound.play_buzzer; end", "def play\n @sound += 1\n @sound %= @overlap\n `#{@sounds[@sound]}.play()`\n end", "def fadeSound _obj, _args\n \"_obj fadeSound _args;\" \n end", "def audio_gen(slide)\n term = slide['term']\n kind = slide['kind'] || nil\n index = slide['index'] || nil\n file_name = file_name_gen(slide, \".WAV\")\n say = command_arg('[[slnc 1000]]' + slide['script'] + '[[slnc 1000]]')\n output = command_arg(file_name)\n `say -v Jill #{say} -o #{output}`\n slide['audio'] = file_name\nend", "def make_sound()\n\n if @type == \"Guitar\"\n return \"Twing Twang...\"\n elsif @type == \"Piano\"\n return \"Plink Plonk...\"\n end #End of if statement\n\n end", "def playLushSounds\n in_thread do\n sleep 2\n with_fx :reverb, room: 0.9, amp: 1.4 do\n with_fx :hpf, cutoff: 80 do\n sample :ambi_glass_hum, attack: 3\n sleep 1\n sample :ambi_glass_hum, attack: 1, rate: 2, amp: 0.7, pan: -0.9\n sample :ambi_glass_hum, attack: 1, rate: -2, amp: 0.7, pan: 0.9\n end\n end\n end\nend", "def playSound _args\n \"playSound _args;\" \n end", "def audio; end", "def play\r\n\t\t[FOLD]\r\n\tend", "def main_audio\r\n super\r\n # Stop BGM and BGS\r\n $game_system.bgm_play(nil)\r\n $game_system.bgs_play(nil)\r\n # Play game over ME\r\n $game_system.me_play($data_system.gameover_me)\r\n end", "def setup_audio!\n self.gun_sound = AudioNode.new($asset_manager, \"Sound/Effects/Gun.wav\", false)\n gun_sound.positional = false\n gun_sound.looping = false\n gun_sound.volume = 3\n root_node.attach_child(gun_sound)\n\n self.ambient_noise = AudioNode.new(asset_manager, \"assets/sound/lost.ogg\", false)\n ambient_noise.looping = true\n ambient_noise.positional = true\n ambient_noise.local_translation = Vector3f::ZERO.clone\n ambient_noise.volume = 2\n root_node.attach_child(ambient_noise)\n ambient_noise.play\n end", "def main_audio ; end", "def gulag\n @soviet_sound.stop\n @gulag.play\n puts `clear`\n puts '\n ███ ▄█ █▄ ▄████████ ▄██████▄ ███ █▄ ▄█ ▄████████ ▄██████▄ \n ▀█████████▄ ███ ███ ███ ███ ███ ███ ███ ███ ███ ███ ███ ███ ███ \n ▀ ███▀▀██ ███ ███ ███ █▀ ███ █▀ ███ ███ ███ ███ ███ ███ █▀ \n ███ ▀ ▄███▄▄▄▄███▄▄ ▄███▄▄▄ ▄███ ███ ███ ███ ███ ███ ▄███ \n ███ ▀▀███▀▀▀▀███▀ ▀▀███▀▀▀ ▀▀███ ████▄ ███ ███ ███ ▀███████████ ▀▀███ ████▄ \n ███ ███ ███ ███ █▄ ███ ███ ███ ███ ███ ███ ███ ███ ███ \n ███ ███ ███ ███ ███ ███ ███ ███ ███ ███▌ ▄ ███ ███ ███ ███ \n ▄████▀ ███ █▀ ██████████ ████████▀ ████████▀ █████▄▄██ ███ █▀ ████████▀ \n ▀ \n '.colorize(:red) \n puts \" Welcome to the Gulag, a fight for survival where winning your Gunfight will grant you a second chance…\n While losing your Gunfight results in possible elimination.\"\n \n puts \" YOUR FATE IS IN THE HANDS OF THE RUBY SAMPLE METHOD\n +--^----------,--------,-----,--------^-, \n | ||||||||| `--------' | O \n `+---------------------------^----------| \n `\\_,---------,---------,--------------'\n / XXXXXX /'| /'\n / XXXXXX / `\\ /'\n / XXXXXX /`-------'\n / XXXXXX /\n / XXXXXX /\n (________( \n `------' \n\n \"\n egg1 = [@easter_egg[2]]\n result_egg1 = @prompt.collect do\n key(:answer).select(\"Press Enter:\", egg1)\n end\n\n puts `clear`\n\n egg_result = result_egg1.values.join \n \n if egg_result = @easter_egg[2]\n moving_anim()\n end\n \n \n arr = [method(:final_straw_lose), method(:final_straw_win)]\n\n didIwin = arr.sample\n didIwin.call\n end", "def commandnewgame_audio\r\n # Play decision SE\r\n $game_system.se_play($data_system.decision_se)\r\n # Stop BGM\r\n Audio.bgm_stop\r\n end", "def bark \n\t\tputs @sound\n\tend", "def main_audio\r\n super\r\n # Play title BGM\r\n $game_system.bgm_play($data_system.title_bgm)\r\n # Stop playing ME and BGS\r\n Audio.me_stop\r\n Audio.bgs_stop\r\n end", "def sound\n raise NotImplementedError\n end", "def play_random_clip()\n 0.upto(8){\n\tid = rand($full_sample_filelist.size)\n=begin\t\n\t# Theses variables are used by the sample playing - affected to the last line of knobs\n\t$sample_volume = 1.0\n\t$sample_speed = 1.0\n\t$sample_reverse = false\n\t$sample_sampling_rate = 44100\n\t$sample_start_pos = 0.0\n\t$sample_phaser = [ false, 0.95, 0.95, 3, 0.6, 2, \"-t\" ] # active gain-in gain-out delay decay speed [-s(inusoid)|-t(riangle)]\n\t$sample_flanger = [ false, 3, 9.5, 0, 70, 2, \"sin\", 100, \"quadratic\" ] # [active, delay depth regen width speed shape phase interp]\n\t$sample_reverb = [ false, 99, 99, 100, 100, 0, 0, ] # active, reverb, HF-damping, room-scale, stereo-depth, pre-delay, wet-gain\n=end\n\tcmd = \"play -v #{$sample_volume} \\\"#{$full_sample_filelist[id]}\\\" \"\n\tcmd += \"rate #{$sample_sampling_rate} \"\n\tcmd += \"speed #{$sample_speed} \"\n\tcmd += \"#{$sample_reverse == true ? \"reverse\" : \"\"} \"\n\tcmd += \"trim =0.0 \"\n\t\n\tcmd += $sample_phaser[0] == true ? \"phaser #{$sample_phaser[1].round(2)} #{$sample_phaser[2].round(2)} #{$sample_phaser[3].round(2)} #{$sample_phaser[4].round(2)} #{$sample_phaser[5].round(2)} #{$sample_phaser[6]} \" : \"\"\n\tcmd += $sample_flanger[0] == true ? \"flanger #{$sample_flanger[1].round(2)} #{$sample_flanger[2].round(2)} #{$sample_flanger[3].round(2)} #{$sample_flanger[4].round(2)} #{$sample_flanger[5].round(2)} #{$sample_flanger[6]} #{$sample_flanger[7].round(2)} #{$sample_flanger[8]} \" : \"\"\n\tcmd += $sample_reverb[0] == true ? \"reverb #{$sample_reverb[1].round(2)} #{$sample_reverb[2].round(2)} #{$sample_reverb[3].round(2)} #{$sample_reverb[4].round(2)} #{$sample_reverb[5].round(2)} #{$sample_reverb[6].round(2)} \" : \"\"\n\t\n\tcmd += \" > /dev/null 2>&1\" #[ false, 3, 9.5, 0, 70, 2, \"sin\", 100, \"quadratic\" ]\n\n\tputs cmd\n \tThread.new(){\n\t\tif(rand(2) < 1) then # thread it and jump to next sample instantly\n\t\t\tThread.new(){\n\t\t\t\tsystem(cmd)\n\t\t\t}\n\t\telse\n\t\t\tsystem(cmd)\n\t\tend\n \t####sleep(rand(1.0))\n \t}\n\n }\nend", "def emit_sound(reference, volume = 1.0, pitch = 1.0)\n game_state.manager(:sound).play_sound(reference, volume, pitch)\n end", "def play_random_clip_fx_random()\n 0.upto(8){\n\tid = rand($full_sample_filelist.size)\n\t# Theses variables are used by the sample playing - affected to the last line of knobs\n\t$my_sample_volume = 0.2 + rand() * 0.8\n\tif($my_sample_volume > $sample_volume) then\n\t\t$my_sample_volume = $sample_volume\n\tend\n\n\t$my_sample_speed = 0.1 + rand(0.9)\n\t$my_sample_reverse = rand(2) < 1 ? false : true\n\t$my_sample_sampling_rate = 44100\n\t$my_sample_start_pos = 0.0 + rand(0.0..1.0)\n\t$my_sample_phaser = [ rand(2) < 1 ? false : true, \n\t\t\t\t0.95, 0.95, 3, 0.6, 2, \"-t\" ] # active gain-in gain-out delay decay speed [-s(inusoid)|-t(riangle)]\n\t$my_sample_flanger = [ rand(2) < 1 ? false : true, \n\t\t\t\t3, 9.5, 0, 70, 2, \"sin\", 100, \"quadratic\" ] # [active, delay depth regen width speed shape phase interp]\n\t$my_sample_reverb = [ rand(2) < 1 ? false : true, \n\t\t\t\t99, 99, 100, 100, 0, 0, ] # active, reverb, HF-damping, room-scale, stereo-depth, pre-delay, wet-gain\n\n\tcmd = \"play -v #{$my_sample_volume * 0.2} \\\"#{$full_sample_filelist[id]}\\\" \"\n\tcmd += \"rate #{$my_sample_sampling_rate} \"\n\tcmd += \"speed #{$my_sample_speed.round(2)} \"\n\tcmd += \"#{$my_sample_reverse == true ? \"reverse\" : \"\"} \"\n#=begin \n## TODO fix trim\n\tlength = get_sample_length($full_sample_filelist[id])\n\tputs \"l: #{length}\"\n\tputs \"sample_start_pos: #{$my_sample_start_pos}\"\n\tstart_pos = $my_sample_start_pos.round(2) * length.round(2)\n\tstart_pos_HMS = Time.at(start_pos).utc.strftime(\"%H:%M:%S.%L\")\n\tcmd += \"trim =#{start_pos_HMS} \"\n#=end\t\n\tcmd += $my_sample_phaser[0] == true ? \"phaser #{$my_sample_phaser[1].round(2)} #{$my_sample_phaser[2].round(2)} #{$my_sample_phaser[3].round(2)} #{$my_sample_phaser[4].round(2)} #{$my_sample_phaser[5].round(2)} #{$my_sample_phaser[6]} \" : \"\"\n\tcmd += $my_sample_flanger[0] == true ? \"flanger #{$my_sample_flanger[1].round(2)} #{$my_sample_flanger[2].round(2)} #{$my_sample_flanger[3].round(2)} #{$my_sample_flanger[4].round(2)} #{$my_sample_flanger[5].round(2)} #{$my_sample_flanger[6]} #{$my_sample_flanger[7].round(2)} #{$my_sample_flanger[8]} \" : \"\"\n\tcmd += $my_sample_reverb[0] == true ? \"reverb #{$my_sample_reverb[1].round(2)} #{$my_sample_reverb[2].round(2)} #{$my_sample_reverb[3].round(2)} #{$my_sample_reverb[4].round(2)} #{$my_sample_reverb[5].round(2)} #{$my_sample_reverb[6].round(2)} \" : \"\"\n\n\tcmd += \" > /dev/null 2>&1\" #[ false, 3, 9.5, 0, 70, 2, \"sin\", 100, \"quadratic\" ]\n\n\tputs cmd\n\tThread.new(){\n\t\tif(rand(2) < 1) then # thread it and jump to next sample instantly\n\t\t\tThread.new(){\n\t\t\t\tsystem(cmd)\n\t\t\t}\n\t\telse\n\t\t\tsystem(cmd)\n\t\tend\n \t####sleep(rand(1.0))\n\t}\n\n }\nend", "def play_sound \n system\"play #{@sound_file}\"\n end", "def process_ok\n Sound.play_ok\n super\n end", "def setMusicEffect _obj, _args\n \"_obj setMusicEffect _args;\" \n end", "def nameSound _args\n \"nameSound _args;\" \n end", "def play_title_music\r\n\r\n$data_system.title_bgm.play\r\n\r\nRPG::BGS.stop\r\n\r\nRPG::ME.stop\r\n\r\nend", "def preloadSound _args\n \"preloadSound _args;\" \n end", "def play; end", "def pbToneChangeAll(tone,duration)\n $game_screen.start_tone_change(tone,duration*2)\n for picture in $game_screen.pictures\n picture.start_tone_change(tone,duration*2) if picture\n end\nend", "def play_music\n $game_system.bgm_memorize2\n Audio.bgm_stop\n Audio.bgm_play(Evolve::EVOLVE_MUSIC)\n end", "def pbToneChangeAll(tone, duration)\n $game_screen.start_tone_change(tone,duration * 2)\n for picture in $game_screen.pictures\n picture.start_tone_change(tone,duration * 2) if picture\n end\nend", "def update\n en_ee_ge_u\n if @sound.nil? && @page && !@page.sound.empty?\n @sound = RPG::BGS.new(@page.sound[0], volume(*@page.sound[1..2]), 100)\n @sound.play\n end\n if @sound\n @sound.volume = volume(@page.sound[1], @page.sound[2]) and @sound.play\n end\n end", "def playSound3D _args\n \"playSound3D _args;\" \n end", "def midisynth (synthName=:beep, midiArray=\" \", amp: 1.0, amp_slide: 1, pan: 0, pan_slide: 1, attack: -1, decay: -1, sustain: -1, release: -1, attack_level: -1, decay_level: -1, sustain_level: -1, env_curve: -1, slide: -1, pitch: -1)\r\n #add case statement for each synth to set parameters\r\n use_synth synthName\r\n numofnotes = midiArray.length\r\n numofnotes.times do |i|\r\n if i.to_i < (numofnotes.to_i - 1)\r\n msleep = midiArray[i+1].split(\",\")[2].to_i/120.to_f #time until next note plays\r\n msleep = msleep.round(2)\r\n else\r\n msleep = 1\r\n end\r\n noterelease = midiArray[i].split(\",\")[4].to_f/120\r\n noteToPlay = midiArray[i].split(\",\")[5].to_f\r\n play noteToPlay, amp: amp\r\n sleep msleep\r\n end\r\nend", "def play \n end", "def setNameSound _obj, _args\n \"_obj setNameSound _args;\" \n end", "def pbPlayBuzzerSE()\n if $data_system && $data_system.respond_to?(\"buzzer_se\") &&\n $data_system.buzzer_se && $data_system.buzzer_se.name!=\"\"\n pbSEPlay($data_system.buzzer_se)\n elsif $data_system && $data_system.respond_to?(\"sounds\") &&\n $data_system.sounds && $data_system.sounds[3] && $data_system.sounds[3].name!=\"\"\n pbSEPlay($data_system.sounds[3])\n elsif FileTest.audio_exist?(\"Audio/SE/GUI sel buzzer\")\n pbSEPlay(\"GUI sel buzzer\",80)\n end\nend", "def play\n \n end", "def effect\r\n particle_count = rand(15) + 50\r\n particle_count.times.collect do\r\n # inherit speed from asteroid, and add random velocity\r\n particle_speed = rand * 10 - 5\r\n life = rand(60) + 120\r\n random_speed = speed_delta(rand * 360, particle_speed)\r\n random_speed.y *= 0.5\r\n speed = random_speed + @speed\r\n # create a new single particle\r\n Effect.new @window, life , @vector, speed\r\n end\r\n end", "def fadeMusic _obj, _args\n \"_obj fadeMusic _args;\" \n end", "def drum_sounds max_amp=0.5, layers =1\n tot = count\n amp = max_amp.to_f / tot #out of total drums\n tot.times do |i| \n this_amp = amp\n wei = (i+1).to_f/(tot+1)\n# this_amp = max_amp if wei < 0.4 # if bass-ish\n range = 0.0\n seqs= 1\n if wei > 0.7 # if hihat-ish\n this_amp /= 3 \n mapee(i).drum(wei, this_amp, 0.04, 1, layers)\n mapee(i)[0].snd.toneseq.tonepart(0).do_all {|tone| tone.saturations.start = 0.5 + rand(3).to_f/10}\n mapee(i)[0].snd.toneseq.do_all{|tp| tp.do_all {|tone|\n tone.detail = 10000\n tone.amp.exp = 0.12\n } }\n else\n if wei > 0.35 && wei < 0.65\n range = 0.5\n seqs= 2+rand(2)\n end\n mapee(i).drum(wei, this_amp, range, seqs, layers)\n end\n end\n end", "def speech; end", "def call\n context.sound = Sound[context.sound_id]\n raise SoundNotFoundError unless context.sound\n\n rescue SoundNotFoundError\n context.fail!(error: :sound_not_found)\n\n end", "def play\n end", "def play\n end", "def play\n end", "def play\n end", "def save(snd)\n snd_name = file_name(snd)\n set_sound_property(:current_file_time, file_write_date(snd_name), snd)\n @sound_funcs.each do |prop|\n set_sound_property(prop, snd_func(prop, snd), snd)\n end\n props = (sound_properties(snd) or [])\n if reject = sound_property(:save_state_ignore, snd)\n props.reject! do |k, v| reject.member?(k) end\n end\n res = format(\"let(find_sound(%s)) do |snd_s|\\n\", snd_name.inspect)\n res += format(\" set_sound_properties(%s, snd_s)\\n\", props.inspect)\n channels(snd).times do |chn|\n @channel_funcs.each do |prop|\n if prop == :transform_type\n set_channel_property(prop, transform2integer(snd_func(prop, snd, chn)), snd, chn)\n else\n set_channel_property(prop, snd_func(prop, snd, chn), snd, chn)\n end\n end\n props = (channel_properties(snd, chn) or [])\n if reject = channel_property(:save_state_ignore, snd, chn)\n props.reject! do |k, v| reject.member?(k) end\n end\n res += format(\" if channels(snd_s) > %d\\n\", chn)\n res += format(\" set_channel_properties(%s, snd_s, %d)\\n\", props.inspect, chn)\n res += \" end\\n\"\n end\n res += \"end\\n\"\n res += marks2string(snd)\n with_db do |db|\n db[snd_name] = res\n end\n end", "def create_sound_sound(filename, flags = nil)\n Yuki::ElapsedTime.start(:audio_load_sound)\n if (file_data = @sound_cache[filename])\n @sound_count[filename] += 1\n else\n file_data = File.binread(filename)\n Yuki::ElapsedTime.show(:audio_load_sound, 'Loading sound from disk took')\n end\n gm_filename = filename.include?('.mid') && File.exist?('gm.dls') ? 'gm.dls' : nil\n sound_info = FMOD::SoundExInfo.new(file_data.bytesize, nil, nil, nil, nil, nil, gm_filename)\n sound = FMOD::System.createSound(file_data, create_sound_get_flags(flags), sound_info)\n sound.instance_variable_set(:@extinfo, sound_info)\n Yuki::ElapsedTime.show(:audio_load_sound, 'Creating sound object took')\n return sound\n rescue Errno::ENOENT\n log_error(\"Failed to load sound : #{filename}\")\n return nil\n end", "def waves \n \"waves\" \n end", "def update_tone\n end", "def play\n end", "def bubble_sound\n pid = fork{exec 'afplay', \"lib/Large_bubble_sound.mp3\"}\n end", "def play\n\tend", "def lightning_crash!\n # Thunder!\n OMX.play('thunder_crash.mp3', :overlap => true)\n\n # Lightning\n OUTPUTS[:r1].off\n sleep 0.55\n OUTPUTS[:r1].on\n\n # Wait for the audio to finish\n sleep 19\n\n # SCARY!\nend", "def load_tsbs\n @sprite_name = \"\"\n @collapsound = $data_system.sounds[11]\n super\n end", "def play what\n case Avalon::Config[:alert_sounds]\n when false, :none, :no\n when Hash\n tunes = [Avalon::Config[:alert_sounds][what] || what].compact.flatten\n\n tunes.each do |tune|\n file = find_file( tune, \"../../../sound/#{tune}\",\n \"~/.avalon/sound/#{tune}\", \"/System/Library/Sounds/#{tune}\")\n case system\n when 'Darwin'\n `afplay #{file}`\n when 'Linux'\n raise 'Please install sox package: sudo apt-get install sox' if `which sox`.empty?\n `play -q #{file}`\n end\n end\n end\n end", "def process_x\n if current_item_enabled?\n Sound.play_ok\n super\n else\n Sound.play_buzzer\n end\n end", "def initialize_sounds(sound_array, debug=false)\n initialize_sound_manager(debug) do |soundman|\n sound_array.each do |id, url| \n soundman.create_sound(id, url)\n end\n end\n end", "def onload_function\n output = \"soundManager.onload = function() {\\n\"\n \n @sounds.each do |sound|\n output += %Q{\\tsoundManager.createSound(\"#{sound.id}\", \"#{sound.url}\");\\n}\n end\n \n output += \"}\"\n end", "def sound(soundfile, opts = {}, &blk)\n Shoes::Sound.new self.gui, soundfile, opts, &blk\n end", "def play_sound(index)\n Audio.me_play(ME_TO_PLAY) if index == 0\n end", "def blow\n\t\tif !@is_blown\n\t\t\t@is_blown = @has_changed = true\n\t\t\t@start_time = Gosu::milliseconds\n\t\t\t@@sound.play\n\t\tend\n\tend", "def fadeSpeech _obj, _args\n \"_obj fadeSpeech _args;\" \n end", "def make\n App.out.make_audio_file\nend", "def bass_intro\n play :f2, sustain: 3\n sleep 3.66\n play :g2, sustain: 0.66\n sleep 0.66\n play :a2, sustain: 0.66\n sleep 0.93\n play :c3, sustain: 3.5\n sleep 4.4\n play :D3, sustain: 0.66\n sleep 0.66\n play :e3, sustain: 0.66\n sleep 0.93\n play :d3, sustain: 3.5\n sleep 4.4\n play :e3, sustain: 0.66\n sleep 0.66\n play :f3, sustain: 0.66\n sleep 0.93\n play :bb2, sustain: 3.5\n sleep 4.4\n play :e3, sustain: 0.66\n sleep 0.66\n play :f3, sustain: 0.66\n sleep 0.93\n play :f2, sustain: 3.5\n sleep 4.4\n play :g2, sustain: 0.66\n sleep 0.66\n play :a2, sustain: 0.66\n sleep 0.93\n play :c3, sustain: 3.5\n sleep 4.4\n play :d3, sustain: 0.66\n sleep 0.66\n play :f3, sustain: 0.66\n sleep 0.93\n play :a2, sustain: 4\n sleep 5.4\n play :a2, sustain: 0.66\n sleep 0.66\n play :bb2, sustain: 3.5\n sleep 4.4\n play :E3, sustain: 0.66\n sleep 0.66\n play :f3, sustain: 0.66\n sleep 1.66\nend", "def pbPlayDecisionSE()\n if $data_system && $data_system.respond_to?(\"decision_se\") &&\n $data_system.decision_se && $data_system.decision_se.name!=\"\"\n pbSEPlay($data_system.decision_se)\n elsif $data_system && $data_system.respond_to?(\"sounds\") &&\n $data_system.sounds && $data_system.sounds[1] && $data_system.sounds[1].name!=\"\"\n pbSEPlay($data_system.sounds[1])\n elsif FileTest.audio_exist?(\"Audio/SE/GUI sel decision\")\n pbSEPlay(\"GUI sel decision\",80)\n end\nend", "def wave_display\n font_big = TTY::Font.new(:doom)\n font_col = Pastel.new\n case $current_lvl\n when $lvl_1\n puts font_col.red(font_big.write(\"WAVE 1\"))\n when $lvl_2\n puts font_col.red(font_big.write(\"WAVE 2\"))\n when $lvl_3\n puts font_col.red(font_big.write(\"WAVE 3\"))\n end\nend", "def pause\n `#{@sound}.pause()`\n end", "def sound(id, global = false, ext = '.wav')\n a = global ? @global_sounds : @sounds\n return a[id] if a[id]\n s = @prefix + @sound_dir + id.to_s.split(@separator).join('/') + ext\n sound = Gosu::Sample.new s\n a[id] = sound\n end", "def play_song(id)\n @pause_play = \"pause\" # Resets pause button\n @song_settings.stop rescue nil # Makes sure no other song is playing\n begin\n path = @data_array[@selected_album].songs[id.to_i].location\n wave = WaveInfo.new(path) # Uses wave info gem to grab info from wav\n @song_length = wave.duration # Broadcasts song duration\n @tick = Gosu.milliseconds # Resets ticker so that @count_up starts at 0\n @currently_playing = id # Broadcasts currently playing song\n @playing_album_name = @data_array[@selected_album].title.upcase\n @playing_song_name = @data_array[@selected_album].songs[id].name.upcase\n @playing_thumbnail = @data_array[@selected_album].cover\n song = Gosu::Sample.new(path) # Sample plays wav file from path\n @song_settings = song.play(100,1,false)\n @show_playbar = true\n rescue\n @show_player = false\n stop_song()\n puts \"SONG WAS NOT FOUND\".red\n end\nend", "def create_sound(sound_id, url)\n @sounds << Sound.new(sound_id, url)\n end", "def play_sound(soundName)\r\n\t\texec(\"playback\", soundName)\r\n\tend", "def update_screen_tone\r\n weather_type = @type\r\n weather_max = @max\r\n fraction = 1\r\n tone_red = 0\r\n tone_green = 0\r\n tone_blue = 0\r\n tone_gray = 0\r\n # Get base tone\r\n if @fading\r\n if @type == @target_type # Just changing max\r\n if @fade_time >= [FADE_NEW_TONE_START - @time_shift, 0].max &&\r\n @fade_time < [FADE_NEW_TONE_END - @time_shift, 0].max\r\n weather_max = @target_max\r\n fract = (@fade_time - [FADE_NEW_TONE_START - @time_shift, 0].max) / (FADE_NEW_TONE_END - FADE_NEW_TONE_START)\r\n tone_red = @target_tone.red + (1 - fract) * (@old_tone.red - @target_tone.red)\r\n tone_green = @target_tone.green + (1 - fract) * (@old_tone.green - @target_tone.green)\r\n tone_blue = @target_tone.blue + (1 - fract) * (@old_tone.blue - @target_tone.blue)\r\n tone_gray = @target_tone.gray + (1 - fract) * (@old_tone.gray - @target_tone.gray)\r\n else\r\n tone_red = @viewport.tone.red\r\n tone_green = @viewport.tone.green\r\n tone_blue = @viewport.tone.blue\r\n tone_gray = @viewport.tone.gray\r\n end\r\n elsif @time_shift < 2 && @fade_time >= FADE_OLD_TONE_START && @fade_time < FADE_OLD_TONE_END\r\n weather_max = @old_max\r\n fraction = ((@fade_time - FADE_OLD_TONE_START) / (FADE_OLD_TONE_END - FADE_OLD_TONE_START)).clamp(0, 1)\r\n fraction = 1 - fraction\r\n tone_red = @old_tone.red\r\n tone_green = @old_tone.green\r\n tone_blue = @old_tone.blue\r\n tone_gray = @old_tone.gray\r\n elsif @fade_time >= [FADE_NEW_TONE_START - @time_shift, 0].max\r\n weather_type = @target_type\r\n weather_max = @target_max\r\n fraction = ((@fade_time - [FADE_NEW_TONE_START - @time_shift, 0].max) / (FADE_NEW_TONE_END - FADE_NEW_TONE_START)).clamp(0, 1)\r\n tone_red = @target_tone.red\r\n tone_green = @target_tone.green\r\n tone_blue = @target_tone.blue\r\n tone_gray = @target_tone.gray\r\n end\r\n else\r\n base_tone = get_weather_tone(weather_type, weather_max)\r\n tone_red = base_tone.red\r\n tone_green = base_tone.green\r\n tone_blue = base_tone.blue\r\n tone_gray = base_tone.gray\r\n end\r\n # Modify base tone\r\n if weather_type == :Sun\r\n @sun_magnitude = weather_max if @sun_magnitude != weather_max && @sun_magnitude != -weather_max\r\n @sun_magnitude *= -1 if (@sun_magnitude > 0 && @sun_strength > @sun_magnitude) ||\r\n (@sun_magnitude < 0 && @sun_strength < 0)\r\n @sun_strength += @sun_magnitude.to_f * Graphics.delta_s / 0.4 # 0.4 seconds per half flash\r\n tone_red += @sun_strength\r\n tone_green += @sun_strength\r\n tone_blue += @sun_strength / 2\r\n end\r\n # Apply screen tone\r\n @viewport.tone.set(tone_red * fraction, tone_green * fraction,\r\n tone_blue * fraction, tone_gray * fraction)\r\n end", "def sound(soundfile, opts = {}, &blk)\n playable_sound = Shoes::Sound.new(gui_container, soundfile, opts, &blk)\n end", "def play_sound(type)\r\n @log.debug(\"Play sound #{type}, os: #{$g_os_type}\")\r\n sound = get_sound_source(type)\r\n \r\n #p @sound_enabled\r\n @linux_sound_stoppped[type] = false\r\n if sound and @sound_enabled == true\r\n Thread.new{\r\n if $g_os_type == :win32_system\r\n Sound.play(sound, @duration_win[type] )\r\n end\r\n if $g_os_type == :linux\r\n while !@linux_sound_stoppped[type]\r\n system(\"aplay -q \" + sound)\r\n break if @duration_linux[type] != :loop\r\n end\r\n end \r\n }\r\n end\r\n end", "def play_se_for_item\n # Don't play the sound\n end", "def set_sound\n @sound = Sound.find(params[:id])\n end", "def update\r\n if @duration >= 1\r\n d = @duration\r\n @x = (@x * (d - 1) + @target_x) / d\r\n @y = (@y * (d - 1) + @target_y) / d\r\n @zoom_x = (@zoom_x * (d - 1) + @target_zoom_x) / d\r\n @zoom_y = (@zoom_y * (d - 1) + @target_zoom_y) / d\r\n @opacity = (@opacity * (d - 1) + @target_opacity) / d\r\n @duration -= 1\r\n end\r\n if @tone_duration >= 1\r\n d = @tone_duration\r\n @tone.red = (@tone.red * (d - 1) + @tone_target.red) / d\r\n @tone.green = (@tone.green * (d - 1) + @tone_target.green) / d\r\n @tone.blue = (@tone.blue * (d - 1) + @tone_target.blue) / d\r\n @tone.gray = (@tone.gray * (d - 1) + @tone_target.gray) / d\r\n @tone_duration -= 1\r\n end\r\n if @rotate_speed != 0\r\n @angle += @rotate_speed / 2.0\r\n while @angle < 0\r\n @angle += 360\r\n end\r\n @angle %= 360\r\n end\r\n end", "def create_music(varname, filename)\n @music.add_music(varname, filename)\n end", "def load_bgm(filename)\n @bgm = Audio::Sound.new(File.join(MAIN_DIR, \"/Resources/bgm/#{filename}\"))\n end", "def add_weapon_effect(effect)\n @stat_per = @stat_per.clone\n @element_set = @element_set.clone\n @state_set = @state_set.clone\n @minus_state_set = @minus_state_set.clone\n @element_amplify = @element_amplify.clone\n @magic_states_plus = @magic_states_plus.clone\n @heal_states_plus = @heal_states_plus.clone\n value = effect[1]\n id = effect[2] ? effect[2] : 0\n case effect[0]\n when :mhp\n @stat_per[:maxhp] += value\n when :mmp\n @stat_per[:maxmp] += value\n when :atk\n @stat_per[:atk] += value\n when :def\n @stat_per[:def] += value\n when :spi\n @stat_per[:spi] += value\n when :agi\n @stat_per[:agi] += value\n when :cri\n @cri += value\n when :hit\n @hit += value\n when :eva\n @eva += value\n when :odd\n @odds += value\n when :ele\n @element_set.push(value)\n when :sta\n @state_set.push(value)\n when :stm\n @minus_state_set.push(value)\n when :esc\n @escape_bonus += value\n when :ela\n @element_amplify[id] = value\n when :atd\n @normal_attack_bonus = value\n when :hea\n @heal_amplify = value\n when :rec\n @recharge_value = value\n when :chb\n @charge_bonus = value\n when :atb\n @atb_base = value\n when :vmp\n @vampire_rate += value\n when :mpr\n @mp_rate += value / 100.0\n when :its\n @item_save += value / 100.0\n when :anm\n @animation_id = value\n when :mst\n @magic_states_plus.push(value)\n when :hst\n @heal_states_plus.push(value)\n when :inc\n @incentive += value\n when :snd\n @sin_durab += value\n when :snb\n @sin_bonus += value / 100.0\n when :dmb\n @dom_bonus += value / 100.0\n when :stl\n @steal_bonus += value\n when :ico\n @icon_index = value\n when :lhm\n setmhplow(effect)\n when :lhp\n setmhplowp(effect)\n when :ira\n @anger_bonus += value\n when :iri\n @anger_init += value\n when :ref\n @physical_reflect += value\n when :pls\n @state_inf_bon += value\n when :sid\n @state_inf_dur += value\n when :mat\n @magic_attack += value\n when :amp\n @mp_on_attack += value\n when :ats\n @spirit_attack += value.to_f / 100\n when :ira\n @anger_bonus += value.to_i\n when :sir\n @anger_init += value.to_i\n when :kir\n @anger_kill += value.to_i\n when :pnt\n @qualities.push(:ignore_defense)\n when :duk\n @qualities.push(:parry)\n else\n # niente\n end\n end", "def play\n beats = list.to_string\n `say -r #{rate} -v #{voice} #{beats}`\n end", "def mov_macros_2s(amp=0.1)\n use_bpm 70\n with_fx :level, amp: amp do\n in_thread do\n 2.times do |i|\n s = :elec_tick\n\n n = [2, 4, 8].choose\n pan = rrand(-1, 0)\n with_fx :echo, phase: 0.5 / n, mix: rrand(0.8,1) do\n sample s, pan: -pan, rate: rrand(1,4), amp: 1\n end\n\n pan = rrand(-1,1)\n rate = 2\n amp = 0.5\n n = [2, 4].choose\n with_fx :echo, phase: 0.5 / 8, mix: rrand(0.8,1) do\n sample s, pan: -pan, rate: rate, amp: amp\n end\n\n sleep 0.125\n sleep 0.125\n\n with_fx :echo, phase: 0.5 / n, mix: rrand(0.8,1) do\n sample s, pan: -pan, rate: rate, amp: amp\n end\n sleep 0.125\n sleep 0.125\n\n use_synth :cnoise\n play :e5, release: 0.125, amp: 1\n with_fx :echo, phase: 0.5 / n, mix: rrand(0.8,1) do\n sample s, pan: -pan, rate: rate, amp: amp\n end\n sleep 0.125\n sleep 0.125\n\n with_fx :echo, phase: 0.5 / 8, mix: rrand(0.8,1) do\n sample s, pan: -pan, rate: rate, amp: 1\n end\n\n n = [4, 4, 4, 8].choose\n pan = 0\n with_fx :echo, phase: 0.5 / n, mix: rrand(0.8,1) do\n sample :drum_cymbal_closed, pan: -pan, rate: rrand(1,4), amp: 1\n end\n sleep 0.125\n sleep 0.125\n end\n end\n end\nend", "def command_forge\n make_item\n play_animation\n end", "def draw_effect\n end", "def play_sweet_riff\n puts \"You played a face melting riff!\"\n take_a_drink\n end", "def final_effect(_effects); end", "def on_save_success\r\n Sound.play_save\r\n return_scene\r\n end", "def change_mode(mode)\n\n @mode = mode\n\n # Create new effect and volume modifier\n case mode\n when 'normal', ''\n @effect = @fx_nil\n\n when 'cave'\n @effect = @fx_cave\n \n end\n\n #@sfx.each{ |s| s = nil }\n #@sfx = []\n #GC.start\n\n @sfx.each{ |e| e.feed(@effect,0) }\n \n end", "def play_sound(sound: 0, duration: 1)\n @logger.debug \"Playing sound: #{sound}\"\n sound_number = 0\n case sound\n when String\n sound_number = Sounds.index(sound) || 0\n when Fixnum\n sound_number = sound\n end\n @logger.debug \"sound number: #{sound_number}\"\n send_command 0x6, sound_number % 106, duration & 0xFF\n sleep(duration)\n end", "def play_sound(sequence=[1, 30])\n sequence= [sequence] unless sequence.kind_of?(Array)\n @protocol.send(:play_sound, sequence)\n end", "def alarm message, sound=:failure\n puts message\n play sound \n end", "def play_title_music\n $data_system.title_bgm.play\n RPG::BGS.stop\n RPG::ME.stop\n end" ]
[ "0.79877365", "0.7642193", "0.72487634", "0.7248202", "0.7104432", "0.7094595", "0.69634074", "0.6949179", "0.687545", "0.6809261", "0.68022484", "0.67602926", "0.6754538", "0.6617844", "0.6616225", "0.66032827", "0.65959567", "0.65881276", "0.6571879", "0.65717506", "0.6571083", "0.6534203", "0.6531387", "0.65156305", "0.6494866", "0.6479381", "0.6470163", "0.6429016", "0.6410276", "0.64005166", "0.63796985", "0.6374898", "0.63455683", "0.6315801", "0.62934524", "0.62870485", "0.62735605", "0.6255945", "0.62314606", "0.6222202", "0.6202306", "0.6171854", "0.613546", "0.61239564", "0.61162215", "0.61134607", "0.6093984", "0.6074354", "0.6031181", "0.6024644", "0.6017053", "0.6017053", "0.6017053", "0.6017053", "0.6000329", "0.59823376", "0.59780806", "0.5974029", "0.5966428", "0.59615254", "0.5960469", "0.595212", "0.5941297", "0.5936679", "0.59342647", "0.59276783", "0.59276474", "0.5923742", "0.59158427", "0.59008294", "0.5877633", "0.5875734", "0.58549607", "0.58306235", "0.5828524", "0.5828294", "0.58234036", "0.58198", "0.58183926", "0.5798369", "0.5789945", "0.5786205", "0.5784522", "0.57834077", "0.5775875", "0.5769062", "0.5764177", "0.5760807", "0.5750386", "0.57355833", "0.57348984", "0.5729524", "0.57278115", "0.5726315", "0.5716171", "0.5706514", "0.5697447", "0.5683575", "0.56760836", "0.5665375", "0.5657589" ]
0.0
-1
Procedure to represent the lifeline of the player
def draw_heart(heart_list) for i in 1..heart_list.length() heart_list[i-1].bmp.draw( SCREEN_WIDTH - (i*30), 10, ZOrder::TOP ) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw \n\t\tsuper(\"Lives: #{@lives.to_s}\", X, Y, 5)\n\tend", "def board_visualization\n @players.each do |racer|\n in_front = @length - @position[racer]\n # track = \"|\" * 30\n # p track.insert(@position[racer, racer.to_s)\n p \" |\" * @position[racer] + racer.to_s + \"|\" + \" |\" * in_front\n end\n end", "def elevator_pitch\n puts \"%s, %s\" % [@name, @description]\n end", "def board_visualization\n @players.each do |player|\n before = 0\n after = @length\n puts \" | \"*(before += @position[player]) + \"#{player}\" + \" | \"*(after -= @position[player])\n end\n nil\n end", "def player_position_look_update; end", "def player; end", "def player; end", "def player; end", "def player; end", "def player; end", "def player; end", "def player; end", "def label\n \tif !player.nil? && !opponent.nil?\n \t\t\"#{player_name}\\n#{opponent_name}\"\n \telsif !player.nil? && opponent.nil?\n \t\t\"#{player_name}\\n-----\"\n \telse\n \t\t\"----\\n----\"\n \tend\n end", "def show_players\r\n puts \"Tu as #{human_player.life_points}\"\r\n puts \"il reste #{@enemies.length} bots, courage!!\"\r\n end", "def player_lives_status(player, num_lives)\n \"\\n#{player_name(player)} has #{num_lives} lives/life left.\\n\"\nend", "def view_current\n system('clear')\n @level1_string[@player_pos[-1]] = @player\n @level1_string[@player_pos[-1]+1] = \"\\u{1f4b0}\"\n @level1_string[@computer_pos[-1]] = @computer\n insert_sky\n puts @level1_string\n insert_landscape\n end", "def lendl\n return @lendl if defined?(@lendl)\n @lendl = TennisStats::Player.new(\"Ivan Lendl\")\n end", "def elevator_pitch\r\n \"#{@name}, #{@description}\"\r\n end", "def print_board \n for i in 0..@players.length-1\n lane = (' |'*(@length))\n lane[@player_positions[i]*2] = @players[i] #It doesnt matter if the player reached goal, it will auto extend the string by one.\n puts lane\n end\n end", "def show_players\n puts \"Il reste #{players_left} enemies\"\n player1.show_state\n puts \"\\n\"\n end", "def draw\n # clear the terminal\n system(\"clear\")\n # draw the top rail\n puts '-' * self.length\n # draw each horse in it's own lane\n self.horses.each do |horse|\n # draw .......all the way up to the position of the horse\n print '.' * horse.position + horse.print\n puts\n # draw the bottom rail\n puts '-' * self.length\n end\n end", "def status(player)\n puts player\n linebreak\n puts \"Dealer showing #{@dealer.hand.public_show}\"\n linebreak\n end", "def show_lives\n puts \"Lives remaining: #{@players[0].name}: #{@players[0].life}/3 - #{@players[1].name}: #{@players[1].life}/3\"\n end", "def test_left_wrap\n rover = MarsRover.new(0,0,'N', world=World.new(5,5))\n rover.command('LF')\n assert_equal([4,0,'W'], rover.position)\n end", "def playerSide \n \"playerSide\" \n end", "def print_track\n clear_screen!\n puts \"RACE! GO FAST!!!111one\"\n liner = \"________________\"\n @length.times do\n liner += \"__\"\n end\n puts liner\n @players.times do |x_position|\n print \"Player #{x_position} \"\n @length.times do |y_position|\n print @track[x_position][y_position] + \"|\"\n end\n puts \"| FINISH\"\n end\n puts liner\n end", "def show_player\n if @position == 1\n puts \"le joueur #{@position} : #{@name.capitalize} #{@avatar} a le symbol #{symbol} il débutera la partie\"\n else\n puts \"le joueur #{@position} : #{@name.capitalize} #{@avatar} a le symbol #{symbol}\"\n end\n end", "def draw_basic_info(x, line, width)\n draw_player_name(x, line)\n draw_player_title(x, line, width)\n end", "def all_player_status\n linebreak\n @players.each{ |p| puts p; linebreak; }\n puts \"Dealer showing #{@dealer.hand.public_show}\"\n linebreak\n end", "def draw\n @headers[@game_state_model::players[@game_state_model.player_turn_state]::player_color].draw(@x, @y, 35)\n\n if @game_state_model.player_turn_state == 0\n @ico_one.draw(@x + 143, @y + 20, 35)\n elsif @game_state_model::players[@game_state_model.player_turn_state]::ai == nil\n @ico_two.draw(@x + 143, @y + 20, 35)\n else \n @ico_ai.draw(@x + 143, @y + 20, 35)\n end\n\n @tiles[@game_state_model::players[0]::player_color].draw(@x + 10, @y + 8, 35)\n @tiles[@game_state_model::players[1]::player_color].draw(@x + 10, @y + 48, 35)\n # @block_purple.draw(@x + 10, @y + 5, 1)\n # @block_green.draw(@x + 10, @y + 45, 1)\n @question.draw\n @cancel.draw\n @font.draw(\"#{@game_state_model::players[0]::name}\", 50, @y + 7, 35, 1.0, 1.0, 0xff_ffffff)\n @font.draw(\"Wins: #{@game_state_model::players[0]::score}\", 50, @y + 22, 35, 1.0, 1.0, 0xff_ffffff)\n @font.draw(\"#{@game_state_model::players[1]::name}\", 50, @y + 47, 35, 1.0, 1.0, 0xff_ffffff)\n @font.draw(\"Wins: #{@game_state_model::players[1]::score}\", 50, @y + 62, 35, 1.0, 1.0, 0xff_ffffff)\n end", "def ladder\n $nbl_league.print_ladder\nend", "def draw_actor_status\n x = 104 + 120\n draw_actor_hp(actor, x, 0, contents_width - x)\n draw_actor_mp(actor, x, line_height, contents_width - x)\n draw_actor_ap(actor, x, line_height * 2, (contents_width - x) / 2)\n draw_actor_exp(actor, x + (contents_width - x) / 2, line_height * 2, contents_width - x / 2)\n end", "def displayPlayer()\n puts \"*** Player Info ***\"\n puts \"Name: #{@name}\"\n puts\n end", "def show_volume_lines(view, entities)\n # get rays to the 4 corners of the viewing area\n transform = CameraRep.get_transform_from_view(view).inverse\n #length = self.distance_to_back(view)\n #pts = []\n for i in 0..3\n ray = view.pickray(view.corner(i))\n dir = ray[1].transform(transform)\n line = entities.add_cline ORIGIN, dir, \"...\"\n line.start = ORIGIN\n #pts[i] = ORIGIN.offset dir, length\n #entities.add_cline ORIGIN, pts[i], \"...\"\n #if( i > 0 )\n # entities.add_cline pts[i-1], pts[i], \"...\"\n #end\n end\n #entities.add_cline pts[3], pts[0], \"...\"\nend", "def gamelog(line)\r\nend", "def displayPosition\n print \"New rover position is (#{@currentPos.x}, #{@currentPos.y}) facing \"\n\n case @currentDir\n when :north\n print \"North\\n\"\n when :south\n print \"South\\n\"\n when :east\n print \"East\\n\"\n when :west\n print \"West\\n\"\n end\n end", "def show_flops\n players.each do |player|\n player.display_flop\n end\n end", "def output\n @rovers.each do |rover|\n puts '%d %d %s' %rover.position if @map.rover_inside_plateu?(rover)\n end\n end", "def print_trail_info\n puts \"Rating: #{self.rating}\"\n puts \"Distance: #{self.distance} mi\"\n puts \"Surface Type(s): #{self.surface}\"\n puts \"Brief Description: #{self.info}\\n\"\n puts \"--------------------------------------------------------------------------------\\n\"\n end", "def affichage_player\n\n\n end", "def draw_winner\n case @winner_direction\n when :horizontal\n line_x1_1 = Utility.c_to_x(@winner_c)\n line_y1_1 = Utility.r_to_y(@winner_r) + 20\n line_x1_2 = Utility.c_to_x(@winner_c + 5)\n line_y1_2 = Utility.r_to_y(@winner_r) + 20\n\n line_x2_1 = line_x1_1\n line_y2_1 = line_y1_1 + 1\n line_x2_2 = line_x1_2\n line_y2_2 = line_y1_2 + 1\n\n line_x3_1 = line_x1_1\n line_y3_1 = line_y1_1 + 2\n line_x3_2 = line_x1_2\n line_y3_2 = line_y1_2 + 2\n when :vertical\n line_x1_1 = Utility.c_to_x(@winner_c) + 20\n line_y1_1 = Utility.r_to_y(@winner_r)\n line_x1_2 = Utility.c_to_x(@winner_c) + 20\n line_y1_2 = Utility.r_to_y(@winner_r + 5)\n\n line_x2_1 = line_x1_1 + 1\n line_y2_1 = line_y1_1\n line_x2_2 = line_x1_2 + 1\n line_y2_2 = line_y1_2\n\n line_x3_1 = line_x1_1 + 2\n line_y3_1 = line_y1_1\n line_x3_2 = line_x1_2 + 2\n line_y3_2 = line_y1_2\n when :diagonal_up\n line_x1_1 = Utility.c_to_x(@winner_c)\n line_y1_1 = Utility.r_to_y(@winner_r + 1)\n line_x1_2 = Utility.c_to_x(@winner_c + 5)\n line_y1_2 = Utility.r_to_y(@winner_r - 4)\n\n line_x2_1 = line_x1_1\n line_y2_1 = line_y1_1 + 1\n line_x2_2 = line_x1_2 + 1\n line_y2_2 = line_y1_2\n\n line_x3_1 = line_x1_1 + 1\n line_y3_1 = line_y1_1 + 1\n line_x3_2 = line_x1_2 + 1\n line_y3_2 = line_y1_2 + 1\n when :diagonal_down\n line_x1_1 = Utility.c_to_x(@winner_c)\n line_y1_1 = Utility.r_to_y(@winner_r)\n line_x1_2 = Utility.c_to_x(@winner_c + 5)\n line_y1_2 = Utility.r_to_y(@winner_r + 5)\n\n line_x2_1 = line_x1_1 + 1\n line_y2_1 = line_y1_1\n line_x2_2 = line_x1_2\n line_y2_2 = line_y1_2 - 1\n\n line_x3_1 = line_x1_1\n line_y3_1 = line_y1_1 + 1\n line_x3_2 = line_x1_2 - 1\n line_y3_2 = line_y1_2\n end\n\n # Render the three lines\n draw_line(line_x1_1, line_y1_1, Gosu::Color.argb(0xffff0000),\n line_x1_2, line_y1_2, Gosu::Color.argb(0xffff0000), 2, :default)\n draw_line(line_x2_1, line_y2_1, Gosu::Color.argb(0xffff0000),\n line_x2_2, line_y2_2, Gosu::Color.argb(0xffff0000), 2, :default)\n draw_line(line_x3_1, line_y3_1, Gosu::Color.argb(0xffff0000),\n line_x3_2, line_y3_2, Gosu::Color.argb(0xffff0000), 2, :default)\n end", "def render args\n if (args.state.player.dx < 0.01) && (args.state.player.dx > -0.01)\n args.state.player.dx = 0\n end\n\n #move list\n (args.layout.rect_group row: 0, col_from_right: 8, drow: 0.3,\n merge: { vertical_alignment_enum: 0, size_enum: -2 },\n group: [\n { text: \"move: WASD\" },\n { text: \"jump: Space\" },\n { text: \"attack forwards: J (while on ground\" },\n { text: \"attack upwards: K (while on groud)\" },\n { text: \"attack backwards: J (while on ground and holding A)\" },\n { text: \"attack downwards: K (while in air)\" },\n { text: \"dash attack: J, K in quick succession.\" },\n { text: \"shield: hold J, K at the same time.\" },\n { text: \"dash backwards: A, A in quick succession.\" },\n ]).into args.outputs.labels\n\n # registered moves\n args.outputs.labels << { x: 0.to_layout_col,\n y: 0.to_layout_row,\n text: \"input history\",\n size_enum: -2,\n vertical_alignment_enum: 0 }\n\n (args.state.inputlist.take(5)).map do |s|\n { text: s, size_enum: -2, vertical_alignment_enum: 0 }\n end.yield_self do |group|\n (args.layout.rect_group row: 0.3, col: 0, drow: 0.3, group: group).into args.outputs.labels\n end\n\n\n #sprites\n player = [args.state.player.x, args.state.player.y,\n args.state.player.w, args.state.player.h,\n \"sprites/square/white.png\",\n args.state.player.r]\n\n playershield = [args.state.player.x - 20, args.state.player.y - 10,\n args.state.player.w + 20, args.state.player.h + 20,\n \"sprites/square/blue.png\",\n args.state.player.r,\n 0]\n\n playerjab = [args.state.player.x + 32, args.state.player.y,\n args.state.player.w, args.state.player.h,\n \"sprites/isometric/indigo.png\",\n args.state.player.r,\n 0]\n\n playerupper = [args.state.player.x, args.state.player.y + 32,\n args.state.player.w, args.state.player.h,\n \"sprites/isometric/indigo.png\",\n args.state.player.r+90,\n 0]\n\n if ((args.state.tick_count - args.state.lastpush) <= 15)\n if (args.state.inputlist[0] == \"<<\")\n player = [args.state.player.x, args.state.player.y,\n args.state.player.w, args.state.player.h,\n \"sprites/square/yellow.png\", args.state.player.r]\n end\n\n if (args.state.inputlist[0] == \"shield\")\n player = [args.state.player.x, args.state.player.y,\n args.state.player.w, args.state.player.h,\n \"sprites/square/indigo.png\", args.state.player.r]\n\n playershield = [args.state.player.x - 10, args.state.player.y - 10,\n args.state.player.w + 20, args.state.player.h + 20,\n \"sprites/square/blue.png\", args.state.player.r, 50]\n end\n\n if (args.state.inputlist[0] == \"back-attack\")\n playerjab = [args.state.player.x - 20, args.state.player.y,\n args.state.player.w - 10, args.state.player.h,\n \"sprites/isometric/indigo.png\", args.state.player.r, 255]\n end\n\n if (args.state.inputlist[0] == \"forward-attack\")\n playerjab = [args.state.player.x + 32, args.state.player.y,\n args.state.player.w, args.state.player.h,\n \"sprites/isometric/indigo.png\", args.state.player.r, 255]\n end\n\n if (args.state.inputlist[0] == \"up-attack\")\n playerupper = [args.state.player.x, args.state.player.y + 32,\n args.state.player.w, args.state.player.h,\n \"sprites/isometric/indigo.png\", args.state.player.r + 90, 255]\n end\n\n if (args.state.inputlist[0] == \"dair\")\n playerupper = [args.state.player.x, args.state.player.y - 32,\n args.state.player.w, args.state.player.h,\n \"sprites/isometric/indigo.png\", args.state.player.r + 90, 255]\n end\n\n if (args.state.inputlist[0] == \"dash-attack\")\n playerupper = [args.state.player.x, args.state.player.y + 32,\n args.state.player.w, args.state.player.h,\n \"sprites/isometric/violet.png\", args.state.player.r + 90, 255]\n\n playerjab = [args.state.player.x + 32, args.state.player.y,\n args.state.player.w, args.state.player.h,\n \"sprites/isometric/violet.png\", args.state.player.r, 255]\n end\n end\n\n args.outputs.sprites << playerjab\n args.outputs.sprites << playerupper\n args.outputs.sprites << player\n args.outputs.sprites << playershield\n\n args.outputs.solids << 20.map_with_index do |i| # uses 20 squares to form bridge\n [i * 64, args.state.bridge_top - 64, 64, 64]\n end\nend", "def position\n\t\treturn \"#{@x} #{@y} #{PlanetModel::ORIENTATIONS.invert[@angle.abs % 360].to_s}#{if @lost == true then ' LOST' end}\"\t\n\tend", "def light_room(use_torch=true)\n if use_torch && @torch_power == 0\n clear_message_box\n @ui.place_text(MSG_DARK.ljust(20),1,2)\n else\n area = use_torch ? 3 : 1\n (@cur_x-area..@cur_x+area).each do |row|\n (@cur_y-area..@cur_y+area).each do |col|\n if (row >= 0 && row <= 14) && (col >= 0 and col <= 14) && !(row == @cur_x && col == @cur_y)\n draw_map(row,col)\n end\n end\n end\n @torch_power -= 1 if use_torch\n end\n end", "def screen_y\n n_split = [($game_party.actors.length * 0.5).ceil, 4].min\n case n_split\n when 1\n n_index = self.index * 2\n when 2\n if self.index < ($game_party.actors.length - 2)\n n_index = 0.5 + (2 * self.index)\n else\n if $game_party.actors.length == 3 then\n n_index = (self.index * 2) + 2\n elsif $game_party.actors.length == 4 then\n n_index = self.index * 2\n end\n end\n when 3\n n_index = self.index + (0.25 * (self.index + 1))\n if $game_party.actors.length == 5\n if self.index < 2\n n_index = self.index + (0.25 * (self.index + 1))\n else\n n_index = self.index + (0.25 * (self.index + 2)) + 1\n end\n end\n when 4\n n_index = self.index\n if $game_party.actors.length == 7\n if self.index < 3\n n_index = self.index\n else\n n_index = self.index + 1\n end\n end\n end\n return (n_index - ((n_index / 4).floor) * 4) * ((160 / (4)) * 1.6) + 270 - ((n_index / 4).floor * (110 - (4 * 20)))\nend", "def add_point(player)\n end", "def line\n @line = line_cell.split(' ').last.to_f\n if opponent_cell['@']\n @line *= -1\n end\n @line\n end", "def draw(eol = \"\\n\")\n player_positions = {}\n players.each do |p| \n unless p.state == 'quit'\n player_positions[p.x_pos] ||= {}\n player_positions[p.x_pos][p.y_pos] = p\n end\n end\n buf = \"\"\n start = 0\n size = board_size - 1\n for x in 0..size do\n for y in 0..size do\n start += 1\n if p = (player_positions[x] && player_positions[x][y])\n klass = ' occupied'\n spot = \"#{p.id}#{FACINGS_VISUAL[p.facing]}\"\n else\n klass = nil\n spot = '.'\n end\n buf += \"<span class='space#{klass}'>#{spot}</span>\"\n end\n buf+=eol\n end\n buf\n end", "def show_state\n puts \"#{@name} a #{@life_points} points de vie.\"\n # Si la méthode show_state est appliqué à l'instance player1 (Josiane), le programme sait que la variable @nom est \"Josiane\" et @life_points est le nombre de points de vie de Josiane\n end", "def display_villains\n line\n i = 1\n Villain.all.each do |villain| \n puts \"#{i}. \" + villain.alter_ego\n i +=1\n end\n line\n end", "def draw_line; draw_horizontal_line(@draw_y + (line_height / 2) - 1, 2); end", "def board_visualization\n\n tracks = player_positions.collect { |player, position| player_on_track(position, player).join(\" |\") }\n puts tracks.join(\"\\n\")\n\n end", "def board_visualization\n @players.each do|x|\n print_lane\n x.print_progress\n end\n return nil\n end", "def show_winner(player)\n puts \"Winner: #{player.name} #{player.identity} CONGRATULATIONS!!!\"\nend", "def line\n end", "def line\n end", "def left\n @left ||= Film::Timeline::TIMELINE_LEFT + film.timeline.secondes_to_pixels(real_time)\n end", "def L\r\n return \"ROOM\"\r\nend", "def tb_hl_follow(rel_points)\n p = $game_player\n x, y = p.real_x, p.real_y\n \n return unless x != @tlx || y != @tly\n \n ok = !@tlx.nil? && !@tly.nil?\n @spriteset.remove_group(TB_AOE)\n rel_points.each{ |v| @spriteset.add_highlight_tb(x+v.x,y+v.y,nil,false,:attack_2, TB_AOE) } \n @tlx, @tly = x, y\n end", "def league; end", "def end_row(player)\n player == :human ? 0 : 7\n end", "def draw_life_info(actor, x, y, width)\n draw_actor_hp(actor, x, y, width)\n draw_actor_mp(actor, x, y + line_height, width)\n draw_actor_exp(actor, x, y + line_height * 2, width)\n draw_actor_ap(actor, x, y + line_height * 3, width)\n end", "def draw_player_pieces args\n #$gtk.log \"INFO: RENDERING GAME PIECES...\"\n args.state.player.pieces.each do |p|\n if p[:onboard]\n args.outputs.primitives << {\n x: args.state.board.x + args.state.tiles[p[:tile]][:x],\n y: args.state.board.y + args.state.tiles[p[:tile]][:y],\n w: 100,\n h: 100,\n path: \"sprites/circle-indigo.png\"\n }.sprite\n \n args.outputs.primitives << {\n x: args.state.board.x + args.state.tiles[p[:tile]][:x] + 35,\n y: args.state.board.y + args.state.tiles[p[:tile]][:y] + 75,\n text: p[:order],\n size_enum: 16,\n alignment_enum: 0,\n r: 0,\n g: 0,\n b: 0,\n a: 255\n }.label\n end\n end\nend", "def game_over(player)\n if @@tab[0][0].status == player && @@tab[0][1].status == player && @@tab[0][2].status == player # verifie si des points sont alignés au 1er lignes\n true\n elsif @@tab[1][0].status == player && @@tab[1][1].status == player && @@tab[1][2].status == player # verifie si des points sont alignés au 2é lignes\n true\n elsif @@tab[2][0].status == player && @@tab[2][1].status == player && @@tab[2][2].status == player # verifie si des points sont alignés au 3é lignes\n true\n elsif @@tab[0][0].status == player && @@tab[1][1].status == player && @@tab[2][2].status == player # verifie si des points sont alignés en oblique\n true\n elsif @@tab[0][2].status == player && @@tab[1][1].status == player && @@tab[2][0].status == player # verifie si des points sont alignés en oblique\n true\n elsif @@tab[0][0].status == player && @@tab[1][0].status == player && @@tab[2][0].status == player # verifie si des points sont alignés en vertical sur la colonne 1\n true\n elsif @@tab[0][1].status == player && @@tab[1][1].status == player && @@tab[2][1].status == player # verifie si des points sont alignés en vertical sur la colonne 2\n true\n elsif @@tab[0][2].status == player && @@tab[1][2].status == player && @@tab[2][2].status == player # verifie si des points sont alignés en vertical sur la colonne 3\n true\n else\n false\n end\n end", "def game_over(player)\n if @@tab[0][0].status == player && @@tab[0][1].status == player && @@tab[0][2].status == player # verifie si des points sont alignés au 1er lignes\n true\n elsif @@tab[1][0].status == player && @@tab[1][1].status == player && @@tab[1][2].status == player # verifie si des points sont alignés au 2é lignes\n true\n elsif @@tab[2][0].status == player && @@tab[2][1].status == player && @@tab[2][2].status == player # verifie si des points sont alignés au 3é lignes\n true\n elsif @@tab[0][0].status == player && @@tab[1][1].status == player && @@tab[2][2].status == player # verifie si des points sont alignés en oblique\n true\n elsif @@tab[0][2].status == player && @@tab[1][1].status == player && @@tab[2][0].status == player # verifie si des points sont alignés en oblique\n true\n elsif @@tab[0][0].status == player && @@tab[1][0].status == player && @@tab[2][0].status == player # verifie si des points sont alignés en vertical sur la colonne 1\n true\n elsif @@tab[0][1].status == player && @@tab[1][1].status == player && @@tab[2][1].status == player # verifie si des points sont alignés en vertical sur la colonne 2\n true\n elsif @@tab[0][2].status == player && @@tab[1][2].status == player && @@tab[2][2].status == player # verifie si des points sont alignés en vertical sur la colonne 3\n true\n else\n false\n end\n end", "def distance_preceding_leader\r\r\n sx = distance_x_from($game_player.x)\r\r\n sy = distance_y_from($game_player.y)\r\r\n return Math.hypot(sx, sy)\r\r\n end", "def draw_hadouken\n # left\n if @player.push_hadouken\n @hadouken_img.draw(@player.player_x - @mov, @center_y, 1, -1) if @player.player2?\n # right\n @hadouken_img.draw(@player.player_x + @mov, @center_y, 1) unless @player.player2?\n\n # calcula novamente o valor de X\n @center_x = @player.player_x - @mov if @player.player2?\n @center_x = @player.player_x + @mov unless @player.player2?\n end\n end", "def bet_line\n game = Game.find(self.game_id)\n type = self.bet_type\n if over_under?\n line = game.over_under\n else\n line = game.spread\n end\n return line.abs\n end", "def display_lost_round_message\n puts \"#{current_player.name} lost and their score is now #{current_player.score}\".red\n\n end", "def render_player\n state.player_sprite = [state.player.x,\n state.player.y,\n 4 * 3,\n 8 * 3, \"sprites/player-#{animation_index(state.player.created_at_elapsed)}.png\"] # string interpolation\n outputs.sprites << state.player_sprite\n\n # Outputs a small red square that previews the angles that the player can attack in.\n # It can be moved in a perfect circle around the player to show possible movements.\n # Change the 60 in the parenthesis and see what happens to the movement of the red square.\n outputs.solids << [state.player.x + state.player.attack_angle.vector_x(60),\n state.player.y + state.player.attack_angle.vector_y(60),\n 3, 3, 255, 0, 0]\n end", "def winner\n @players.each do |current_player|\n if current_player.position >= length\n #puts \"#{current_player.name} JUST WON!!!\"\n return \"#{current_player.name}\"\n end\n end\n end", "def leaders\n scores = '```User: Wins:'\n @@trivia_db.execute('SELECT id, rank FROM score ORDER BY rank DESC LIMIT 5') do |row| # Get the top 5, add to the printed string\n scores += \"\\n\" + name(row['id']).ljust(33) + row['rank'].to_s # Usernames can be 32 chars, so ljust by 33\n end\n scores += '```'\n @event.respond(scores)\n open_channel\n end", "def viewed_from_side; current_player_side || :white; end", "def pbLedge(xOffset,yOffset)\n if PBTerrain.isLedge?(Kernel.pbFacingTerrainTag)\n if Kernel.pbJumpToward(2,true)\n $scene.spriteset.addUserAnimation(DUST_ANIMATION_ID,$game_player.x,$game_player.y,true,1)\n $game_player.increase_steps\n $game_player.check_event_trigger_here([1,2])\n end\n return true\n end\n return false\nend", "def player_action\n @players.each{ |p|\n linebreak('-')\n p.hands.each_with_index{ |hand, index|\n hit = true\n double = p.wallet >= hand.bet\n while hit\n splittable = hand.pair? && p.wallet >= hand.bet\n status(p)\n hit, split = player_decision(p, hand, index, double, splittable)\n double = false unless split\n linebreak\n end\n }\n }\n end", "def calc_player\n state.dy += state.gravity # what goes up must come down because of gravity\n calc_box_collision\n calc_edge_collision\n state.y += state.dy # Since velocity is the change in position, the change in y increases by dy\n state.x += state.dx # Ditto line above but dx and x\n state.dx *= 0.8 # Scales dx down\n end", "def pbLedge(xOffset,yOffset)\n if PBTerrain.isLedge?(Kernel.pbFacingTerrainTag)\n if Kernel.pbJumpToward(2,true)\n $scene.spriteset.addUserAnimation(DUST_ANIMATION_ID,$game_player.x,$game_player.y,true)\n $game_player.increase_steps\n $game_player.check_event_trigger_here([1,2])\n end\n return true\n end\n return false\nend", "def show_flop\r\n show_hand\r\n end", "def show_current_description\n\t\tputs find_room_in_dungeon(@player.location).full_description\n\tend", "def player_position\n @ole.PlayerPosition\n end", "def fold_hand\r\n @folded = true\r\n (padding,pronoun) = self.is_a?(User) ? [28,\"You\"] : [32,\"Player ##{player_id+1}\"]\r\n puts \"\\n%#{padding}s\\n\" % \"#{pronoun} folded.\"\r\n @bet = \"---\"\r\n end", "def player \n \"player\" \n end", "def spawn_player player; end", "def switch_player\n\t\tputs \"\\n\"\n\t\tif @player == @player1\n\t\t\t@player = @player2\n\t\t\t@other_player = @player1\n\t\telse\n\t\t\t@player = @player1\n\t\t\t@other_player = @player2\n\t\tend\n\t\t\n\t\t#Matt easter egg\n\t\tif @player.name.downcase == 'matt'\n\t\t\tdescriptors = [' the Amazing', ' the Hero', ' the Incroyable', \n\t\t\t\t\t\t ' the Handsome', ' the Clever', ' the Wonderful', ' the Indominable']\n\t\t\t@player.name = @player.name + descriptors.sample\n\t\tend\n\n\t\t@player.stench -= 1\n\t\t@player.stench = 4 if @player.location == :Rubbisher\n\t\t@player.beans -= 1\n\t\t@player.pills += 1 if @player.pills > 0\n\t\tif @player.location == :free && @other_player.location == :free\n\t\t\t@escape_artists = @escape_artists.upcase\n\t\t\tif @player.stench > 0 || @player.beans > 0 || @other_player.stench > 0 || @other_player.beans > 0\n\t\t\t\t@stinky = @stinky.upcase\n\t\t\tend\n\t\t\tif (@player.stench > 0 && @other_player.beans > 0) || (@player.beans > 0 && @other_player.stench > 0)\n\t\t\t\t@double_stink = @double_stink.upcase\n\t\t\tend\n\t\t\tputs \"\\nYou've both escaped! Congratulations!\"\n\t\t\tif @player.dead\n\t\t\t\tputs @player.name + \" is dead.\"\n\t\t\t\t@dead_and_free = @dead_and_free.upcase\n\t\t\tend\n\t\t\tputs \"\\nSomething smells awful... the magic in those beans doesn't\\nseem to be good for your digestion.\\n\" if @player.beans > 0 && @player.location != :Rubbisher\n\t\t\tputs \"\\nSomething smells awful... the stench from the Rubbisher lingers on you.\\n\" if @player.stench > 0 && @player.location != :Rubbisher\n\t\t\tif @other_player.dead\n\t\t\t\tputs @other_player.name + \" is dead.\"\n\t\t\t\t@dead_and_free = @dead_and_free.upcase\n\t\t\tend\n\t\t\tputs \"\\nSomething smells awful... the magic in those beans doesn't\\nseem to be good for your digestion.\\n\" if @other_player.beans > 0\n\t\t\tputs \"\\nSomething smells awful... the stench from the Rubbisher lingers on you.\\n\" if @other_player.stench > 0\n\t\t\tshow_achievements\n\t\t\t@game = false\n\t\t\treturn\n\t\tend\n\t\tif @player.location == :free && @other_player.dead\n\t\t\tputs \"\\nYou've escaped, but you've left your friend behind to rot.\\n\"\\\n\t\t\t\t \"Way to go, hero.\"\n\t\t\t@game = false\n\t\tend\n\t\tif @player.location == :free\n\t\t\tputs \"\\n\" + @player.name + \" is free!\"\n\t\tend\n\t\tif @player.dead\n\t\t\tputs \"\\n\" + @player.name + \" is dead.\"\n\t\tend\n\t\tshow_current_description unless @player.location == :free\n\t\tputs \"\\nThe world swims before your eyes.\" if @player.pills == 2\n\t\tputs \"\\nIn the corners of your vision, colorful phantasms\\nflicker in and out of being.\" if @player.pills == 3\n\t\tputs \"\\nYou can see a spirit world overlaying the real one.\\nYour stomach hurts.\" if @player.pills == 4\n\t\tputs \"\\nYou can see a spirit world overlaying the real one.\\nYour entire body is starting to hurt.\" if @player.pills == 5\n\t\tif [4, 5].include?(@player.pills) && @player.location == :Lair && find_room_in_dungeon(:Lair).connections[:north] == nil\n\t\t\tputs \"\\nThe creature's image in the spirit world is far stronger than\\n\"\\\n\t\t\t\t \"in the real. In the spirit world, you can see the ideas holding\\n\"\\\n\t\t\t\t \"the creature together... you reach out your hand and you can\\n\"\\\n\t\t\t\t \"feel them, too. You twist your fingers and those ideas shift.\\n\"\\\n\t\t\t\t \"The creature blurs and disappears. In it's place, a mouse falls\\n\"\\\n\t\t\t\t \"to the floor and scampers away. Without the creature there, you\\n\"\\\n\t\t\t\t \"can see an exit to the north.\" \n\t\t\twin_door(:Lair, :north)\n\t\tend\t\n\t\tif @player.pills == 6\n\t\t\tputs \"\\nYour entire body feels like tiny rats are eating you from inside your veins,\\n\"\\\n\t\t\t\"and the rats are on fire. You can't do anything but lie on the floor and moan.\"\n\t\t\t@player.dead = true\n\t\t\t@overdose = @overdose.upcase\n\t\t\tswitch_player\n\t\t\treturn\n\t\tend\n\t\tputs \"\\nSomething smells awful... the magic in those beans doesn't\\nseem to be good for your digestion.\\n\" if @player.beans > 0\n\t\tputs \"\\nSomething smells awful... the stench from the Rubbisher lingers on you.\\n\" if @player.stench > 0 && @player.location != :Rubbisher\n\t\tif @player.location == :Lair && (@player.stench > 0 || @player.beans > 0) && find_room_in_dungeon(:Lair).connections[:north] == nil\n\t\t\tputs \"\\nThe creature takes a step back, and wrinkles its already wrinkly nose. As it\\n\"\\\n\t\t\t\"glides to the side and disappears through the wall, you think you hear it\\n\"\\\n\t\t\t\"mutter something about the disadvantages of an enhanced sense of smell.\\n\"\\\n\t\t\t\"Without the creature there, you can see an exit to the north.\"\n\t\t\twin_door(:Lair, :north)\n\t\tend\n\t\tif @player.location == :free && @other_player.dead\n\t\t\treturn\n\t\tend\n\t\tif @player.location == :free\n\t\t\tswitch_player\n\t\t\treturn\n\t\tend\n\t\tif @player.dead\n\t\t\tswitch_player\n\t\t\treturn\n\t\tend\n\n\t\t#Matt easter egg\n\t\tif ['matt the amazing', 'matt the hero', 'matt the incroyable', \n\t\t\t'matt the handsome', 'matt the clever', 'matt the wonderful', \n\t\t\t'matt the indominable'].include?(@player.name.downcase)\n\t\t\t@player.name = @player.name.slice(0, 4)\n\t\tend\n\t\n\tend", "def custom_player_label\n \"#{self.name} - #{self.text}\"\nend", "def phase_1(player)\r\n puts \" ----------------------- \"\r\n puts \" -- SANTE / ARME -- \"\r\n puts \" ----------------------- \"\r\n puts \"\"\r\n player.show_state\r\n puts \"\"\r\nend", "def view_position\n @player.position\n end", "def print_player_hands()\n puts \"--- Player #{@position} --- \"\n @hands.each do |hand| # The player might have multiple hands, if splitting was used\n puts hand.to_s() # Print the details of the hand\n end\n end", "def display\n type == :pawn ? \"\\u2727\" : \"\\u272A\" # ✧ / ✪ - Ⓞ Ⓚ ⓵\n end", "def horloges_parties\n cmd = []\n cmd << %Q{-stroke gray50 -fill -pointsize 6.5 -strokewidth 2}\n # Pour le paradigme absolu\n decs = [0,30,60,90,120] # on en aura besoin ci-dessous\n decs.each do |dec|\n h = Horloge.new(horloge:realtime(dec).to_horloge, top:self.class.top_horloge_part_absolue, left:realpos(dec), bgcolor:'gray50', color:'gray90')\n cmd << h.magick_code\n end\n\n # Pour le paradigme propre au film\n [ne(:dv), ne(:d2)||ne(:cv), ne(:dn)].each_with_index do |neu, idx|\n next if neu.nil?\n dec = decs[idx+1]\n leftpos = realpos(dec)\n top = self.class.top_horloge_part_relative\n h = Horloge.new(horloge:neu.time.to_i.to_horloge, top:top, left:leftpos, bgcolor:'gray20', color:'white')\n cmd << h.magick_code\n # Pour le décalage\n leftdec = realpos(dec + 2.5)\n diff = neu.time.to_i - realtime(dec)\n pref = diff > 0 ? '+' : '−'\n cmd << %Q{-stroke black -fill black -draw \"text #{leftdec},#{top+LINE_HEIGHT/5} '#{pref}#{diff.abs.to_horloge}'\"}\n end\n\n return cmd.join(' ')\nend", "def show_players\n\t\tputs @human_player.show_state\n\t\tputs \"Il reste #{@enemies.length} ennemies !\"\n\tend", "def roster **players_with_positions\n\tplayers_with_positions.each do |player, position|\n\t\tputs \"Player: #{player}\"\n\t\tputs \"Position: #{position}\"\n\t\tputs \"\\n\"\n\tend\nend", "def line_up_starters(match)\n players = LineUp.where(:club_id => self.id, :match_general_id => match, :position => (1..11)).map do |lu|\n lu.player\n end\n return players\n end", "def spot_legs\n lines = []\n indent = 0\n spacer = @width - @padding\n\n draw_legs(lines, indent, spacer)\n lines\n end", "def witcher; end", "def loser\n losing_players\n end", "def beginning_of_game\n\tputs \"------------------------------------------------------------\"\n\tputs \"| Bienvenue sur 'ILS VEULENT TOUS MA POO ! \"\n\tputs \"| Le but du jeu est d'être le dernier survivant ! \"\n\tputs \"------------------------------------------------------------\"\nend", "def paddle_y\n @cr[9]\n end", "def threatened_line\n mark = @board.other_player.mark\n sorted_lines = sort_by_mark(mark)\n most_threatened_line = sorted_lines[0]\n most_threatened_line if most_threatened_line.marks(mark) == @board.size - 1\n end", "def board_visualization\n puts @player_1.join\n puts @player_2.join\n end", "def move_lower_left\n unless @direction_fix\n @direction = (@direction == 6 ? 4 : @direction == 8 ? 2 : @direction)\n end\n if (passable?(@x, @y, 2) && passable?(@x, @y + 1, 4)) ||\n (passable?(@x, @y, 4) && passable?(@x - 1, @y, 2)) # 8 a la place de 2 sur les deux lignes\n move_follower_to_character\n @x -= 1\n @y += 1\n if @follower && $game_variables[Yuki::Var::FM_Sel_Foll] == 0\n @memorized_move = :move_lower_left\n @follower.direction = @direction\n end\n movement_process_end(true)\n increase_steps\n end\n end" ]
[ "0.6160505", "0.6146861", "0.6143239", "0.6137708", "0.6093414", "0.60488904", "0.60488904", "0.60488904", "0.60488904", "0.60488904", "0.60488904", "0.60488904", "0.604517", "0.6012326", "0.5943281", "0.5889474", "0.5874558", "0.5862535", "0.58457184", "0.581171", "0.58065224", "0.57679665", "0.5765807", "0.5762542", "0.57614404", "0.57587695", "0.5754187", "0.5660029", "0.56463766", "0.56310964", "0.56276435", "0.56079346", "0.5595916", "0.5583378", "0.55789995", "0.5560956", "0.55498767", "0.5546781", "0.55451095", "0.55350846", "0.5532417", "0.5510355", "0.55060166", "0.54974705", "0.5496822", "0.5486935", "0.5469602", "0.54663324", "0.54502875", "0.5449139", "0.54304904", "0.54297155", "0.5428276", "0.54265445", "0.5420458", "0.5420458", "0.5417091", "0.54160994", "0.54118997", "0.54021543", "0.53931636", "0.538627", "0.5384697", "0.5360721", "0.5360721", "0.5354681", "0.5354052", "0.53503925", "0.5348195", "0.5344741", "0.53440773", "0.53402126", "0.5337542", "0.53304374", "0.5330154", "0.53273267", "0.5326745", "0.5325223", "0.532511", "0.53194344", "0.5318386", "0.53143877", "0.53121984", "0.53117824", "0.53106636", "0.53101194", "0.5305767", "0.5304658", "0.5297806", "0.52946085", "0.5288862", "0.52883923", "0.5288146", "0.528524", "0.5284082", "0.52811533", "0.5279525", "0.52792543", "0.52668786", "0.526364", "0.5255461" ]
0.0
-1
Procedure to add the visuals of explosion
def explode() # drawing explosion scene @explosion.bmp.draw(@explode_x, @explode_y, ZOrder::TOP) # Playing the sound of an explosion @explosion_sound.bmp.play @count += 1 # Showing the visual for 20 update() counts if @count == 20 @explode = false @count = 0 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_explosion\n explosion = ParticleFactory.buildParticles(\"big\", 80).set! :emission_direction => Vector3f.new(0, 1, 0),\n :maximum_angle => FastMath::PI, :speed => 1, :minimum_life_time => 600, \n :start_size => 3, :end_size => 7, \n :start_color => ColorRGBA.new(1, 0.312, 0.121, 1), \n :end_color => ColorRGBA.new(1, 0.24313726, 0.03137255, 0), \n :control_flow => false,\n :initial_velocity => 0.02, :particle_spin_speed => 0, :repeat_type => Controller::RT_CLAMP\n\n explosion.warmUp 1000\n explosion.render_state(@ts, @bs, @zstate)\n\n @explosions << explosion\n explosion\n end", "def draw_effect\n end", "def explosion_animation\n sleep 0.15\n system('clear')\n @level1_string[@computer_pos[-1]] = \" \"\n insert_sky\n puts @level1_string\n insert_landscape\n sleep 0.07\n system('clear')\n @level1_string[@computer_pos[-1]] = \"\\u{1f4a5}\"\n insert_sky\n puts @level1_string\n insert_landscape\n end", "def create_graphics\n super()\n create_background\n create_type_background\n create_pokemon_battler_stack\n create_pokemon_text_boxes\n create_congratulation_text_boxes\n create_pokemon_stars_animation\n create_graveyard_anim\n create_turning_ball\n create_party_battler_stack\n create_league_champion_text_box\n create_trainer_infos_text_box\n create_end_stars\n end", "def create_graphics\n super\n draw_wanted_data\n end", "def render\n outputs.solids << [grid.rect, 100, 100, 100]\n render_zombies\n render_killed_zombies\n render_player\n render_flash\n end", "def draw_elements\n draw_header\n \n change_color(system_color)\n draw_text(5, 32, self.width, 24, \"Elementos:\")\n \n change_color(normal_color)\n @enchant[:effects][8].each_with_index do |x, i|\n draw_text(5, 56 + 24 * i, self.width - 5, 24, $data_system.elements[x])\n end\n draw_text(5, 56, self.width, 24, MBS::Equip_Enchantment::EMPTY_TEXT) if @enchant[:effects][8].empty?\n end", "def paint\n if $render_from_base\n\t @app.nostroke\n\t checkSrepIntersection\n\n\t $sreps.each.with_index do |srep, i|\n\t render_srep(srep, @shifts[i] , @shifts[i] , 1.5, true)\n\t end\n\n\t #render extended spokes \n\t $sreps.each.with_index do |srep, i|\n\t \n\t if (srep.getExtendInterpolatedSpokesEnd()).length > 0 and srep.show_extend_spokes\n\t\tspoke_begin = srep.interpolated_spokes_begin \n\t\tspoke_end = srep.getExtendInterpolatedSpokesEnd()\n\n\t\tif ($show_subsetof_extended_spokes) \n\t\t render_subset_extend_interp_spokes(@shifts[i],@shifts[i], srep.color, spoke_begin, spoke_end, srep.index)\n\t\telse\n\t\t render_extend_interp_spokes(@shifts[i],@shifts[i], srep.color, spoke_begin, spoke_end)\n\t\tend\n\t end\n\t #render_extended_interp_spokes(srep, @shifts[i] , @shifts[i] , 1.5, true)\n\t end\n\t \n\t if $show_linking_structure \n\t if $dilateCount != 22\n\t\t render_linking_structure(@shifts)\n\t else \n\t\t refine_fake_linking_structure()\n\t\t render_fake_linkingPts(@shifts)\n\t end\n\t end\n\n\t # render refining windows\n\t if $refine_linking_structure\n\t render_refine_windows()\n\t end\n else\n \n @app.stroke Color.black\n # read stdev 2 data and render \n shift = 300\n data_vector_reader = File.open('data_vector.txt','r')\n\t data_vector = []\n while line = data_vector_reader.gets\n data_vector << line.strip.to_f\n end\n data_vector_reader.close \n \n base_pts = data_vector[0..101*2*3-1]\n base_pts_xy = []\n (base_pts.size / 2).times do |i|\n\t base_pts_xy << [base_pts[i*2], base_pts[i*2+1]] \n end\n base_pts_xy.each do |p|\n @app.oval(p[0]+shift,p[1]+shift,3)\n end\n\n\t offset1 = 101*2*3\n spoke_dir = data_vector[offset1 .. 278*2*3+offset1-1]\n spoke_dir_xy = []\n (spoke_dir.size/2).times do |i|\n spoke_dir_xy << [ spoke_dir[i*2], spoke_dir[i*2+1] ] \n end\n \n offset2 = 278*2*3+offset1\n spoke_len = data_vector[offset2 .. 278*3+offset2-1]\n\n offset3 = 278*3+offset2\n extended_lens = data_vector[offset3 .. 278*3+offset3-1]\n # alert(offset3)\n 99.times do |i|\n @app.stroke Color.black\n extended_len = extended_lens[i]\n spoke = [ spoke_dir_xy[i][0], spoke_dir_xy[i][1] ]\n spoke_len = Math.sqrt(spoke[0]**2 + spoke[1]**2)\n extended = [ spoke[0].to_f * extended_len / spoke_len, spoke[1].to_f * extended_len / spoke_len ]\n if i != 0 \n \t @app.line base_pts_xy[i+1][0]+shift, base_pts_xy[i+1][1]+shift, base_pts_xy[i+1][0] +shift+ spoke_dir_xy[i][0] + extended[0], base_pts_xy[i+1][1]+shift + spoke_dir_xy[i][1] + extended[1]\n\t end\n extended_len = extended_lens[i+139]\n spoke = [ spoke_dir_xy[i+139][0], spoke_dir_xy[i+139][1] ]\n spoke_len = Math.sqrt(spoke[0]**2 + spoke[1]**2)\n extended = [ spoke[0].to_f * extended_len / spoke_len, spoke[1].to_f * extended_len / spoke_len ]\n\t if i != 48 and i != 73 and i != 24 \n \t @app.line base_pts_xy[i+1][0]+shift, base_pts_xy[i+1][1]+shift, base_pts_xy[i+1][0] +shift+ spoke_dir_xy[i+139][0]+extended[0], base_pts_xy[i+1][1]+shift + spoke_dir_xy[i+139][1] + extended[1]\n end\n\t# @app.stroke Color.green\n @app.stroke rgb(0,51,0,1)\n \n @app.line base_pts_xy[i+1+101][0]+shift, base_pts_xy[i+1+101][1]+shift, base_pts_xy[i+1+101][0] +shift+ spoke_dir_xy[i+278][0], base_pts_xy[i+1+101][1]+shift + spoke_dir_xy[i+278][1]\n \n @app.line base_pts_xy[i+1+101][0]+shift, base_pts_xy[i+1+101][1]+shift, base_pts_xy[i+1+101][0] +shift+ spoke_dir_xy[i+139+278][0], base_pts_xy[i+1+101][1]+shift + spoke_dir_xy[i+139+278][1]\n\n @app.stroke Color.red\n \n @app.line base_pts_xy[i+1+202][0]+shift, base_pts_xy[i+1+202][1]+shift, base_pts_xy[i+1+202][0] +shift+ spoke_dir_xy[i+556][0] , base_pts_xy[i+1+202][1]+shift + spoke_dir_xy[i+556][1] \n @app.line base_pts_xy[i+1+202][0]+shift, base_pts_xy[i+1+202][1]+shift, base_pts_xy[i+1+202][0] +shift+ spoke_dir_xy[i+139+556][0], base_pts_xy[i+1+202][1]+shift + spoke_dir_xy[i+139+556][1]\n end\n\n 40.times do |i|\n @app.stroke Color.black\n if i != 0\n @app.line base_pts_xy[1][0]+shift, base_pts_xy[1][1]+shift, base_pts_xy[1][0] +shift+ spoke_dir_xy[i+238][0], base_pts_xy[1][1]+shift + spoke_dir_xy[i+238][1] \n end\n @app.line base_pts_xy[99][0]+shift, base_pts_xy[99][1]+shift, base_pts_xy[99][0] +shift+ spoke_dir_xy[i+99][0], base_pts_xy[99][1]+shift + spoke_dir_xy[i+99][1]\n\n # @app.stroke Color.green\n @app.stroke rgb(0,51,0,1)\n @app.line base_pts_xy[1+101][0]+shift, base_pts_xy[1+101][1]+shift, base_pts_xy[1+101][0] +shift+ spoke_dir_xy[i+238+278][0], base_pts_xy[1+101][1]+shift + spoke_dir_xy[i+238+278][1] \n @app.line base_pts_xy[99+101][0]+shift, base_pts_xy[99+101][1]+shift, base_pts_xy[99+101][0] +shift+ spoke_dir_xy[i+99+278][0], base_pts_xy[99+101][1]+shift + spoke_dir_xy[i+99+278][1]\n \n @app.stroke Color.red\n @app.line base_pts_xy[1+202][0]+shift, base_pts_xy[1+202][1]+shift, base_pts_xy[1+202][0] +shift+ spoke_dir_xy[i+238+556][0], base_pts_xy[1+202][1]+shift + spoke_dir_xy[i+238+556][1] \n @app.line base_pts_xy[99+202][0]+shift, base_pts_xy[99+202][1]+shift, base_pts_xy[99+202][0] +shift+ spoke_dir_xy[i+99+556][0], base_pts_xy[99+202][1]+shift + spoke_dir_xy[i+99+556][1]\n end\n \n \n\n\n end\n end", "def explode_curve\n end", "def explode_curve\n end", "def display\n fill(50, 200, 200, 150)\n stroke(50, 200, 200)\n stroke_weight(2)\n ellipse(x, y, 16, 16)\n end", "def render_srep(*args)\n srep = args[0]\n shiftx = args[1]\n shifty = args[2]\n scale = args[3]\n show_sphere = args[4]\n show_sphere = false\n srep.atoms.each_with_index do |atom, i|\n render_atom(atom.x + shiftx, atom.y + shifty, atom.color)\n if show_sphere\n center_x = atom.x + shiftx - atom.spoke_length[0]\n center_y = atom.y + shifty - atom.spoke_length[0]\n d = atom.spoke_length[0] * 2\n # if (srep.index != 1 or i != 2)\n\t render_circle(center_x, center_y, d, srep.color)\n # else\n # render_circle(center_x+10, center_y+10, 80, srep.color)\n # end\n end\n if srep.show_extend_disk\n center_x = atom.x + shiftx - atom.expand_spoke_length[0]\n center_y = atom.y + shifty - atom.expand_spoke_length[0]\n d = atom.expand_spoke_length[0] * 2 \n render_circle(center_x, center_y, d, srep.color)\n end \n atom_x = atom.x+shiftx\n atom_y = atom.y+shifty\n #render_spokes(atom_x, atom_y, atom.type, atom.spoke_length, atom.spoke_direction, srep.color)\n end\n\n if srep.interpolated_spokes_begin.length > 0 and srep.show_interpolated_spokes\n spoke_begin = srep.interpolated_spokes_begin\n spoke_end = srep.interpolated_spokes_end\n render_interp_spokes(shiftx, shifty, Color.white, spoke_begin, spoke_end, srep.index)\n end\n\n if srep.show_curve\n # display the interpolated curve points\n render_curve($sreps, srep.index, srep, shiftx, shifty)\n end\n end", "def create_graphics\n create_viewport\n create_background\n create_pokemon_sprite\n create_egg_sprite\n end", "def draw\n\tsuper\n\t\n\tif Game.scene.selected_tower\n\t position = grids_to_pixels(Game.scene.selected_tower.position)\n\t \n\t @surface.drawFilledCircle(position[0], position[1], Game.scene.selected_tower.range * Config.part_size[0], Screen.handle.format.mapRGB(0xbb, 0xbb, 0xbb))\n\tend\n\t\n\tposition = Config.monsters_start_at\n\tposition[0] += 1\n\tposition = grids_to_pixels(position)\n\tposition[0] -= 20\n\tposition[1] -= 20\n\tImage.draw(\"images/arrow.png\", @surface, *position)\n\t\n\tposition = Config.monsters_end_at\n\tposition[0] -= 1\n\tposition = grids_to_pixels(position)\n\tposition[0] -= 20\n\tposition[1] -= 20\n\tImage.draw(\"images/arrow.png\", @surface, *position)\n\t\n\tConfig.map_size[1].times do |y|\n Config.map_size[0].times do |x|\n @surface.draw_rect(Config.part_size[0]*x,Config.part_size[1]*y,Config.part_size[0],Config.part_size[1],Screen.handle.format.mapRGB(0x88, 0x88, 0x88))\n end\n end\n\t\n\tGame.scene.get_drawable_objects.each do |i|\n\t position = grids_to_pixels(i.position)\n\t if i.class <= Model::Monster # Drawing HP lines\n\t color = Screen.handle.format.mapRGB(0xaa, 0xaa, 0xaa)\n\t if i.poisoned\n\t color = Screen.handle.format.mapRGB(0xff, 0x00, 0xff)\n\t end\n\t @surface.draw_line(position[0]-12, position[1]-18, position[0]+12, position[1]-18, color)\n\t @surface.draw_line(position[0]-12, position[1]-17, position[0]+12, position[1]-17, color)\n\t \n\t line_len = i.hp * 24 / i.max_hp\n\t \n\t color = Screen.handle.format.mapRGB(0x00, 0xff, 0x00)\n\t if i.frozen\n\t color = Screen.handle.format.mapRGB(0x00, 0xff, 0xff)\n\t end\n\t @surface.draw_line(position[0]-12, position[1]-18, position[0]-12+line_len, position[1]-18, color)\n\t @surface.draw_line(position[0]-12, position[1]-17, position[0]-12+line_len, position[1]-17, color)\n\t end\n\t position[0] -= i.image_size[0]/2\n\t position[1] -= i.image_size[1]/2\n\t \n\t Image.draw(i.image, @surface, *position)\n\tend\n end", "def display_exp_and_gold\n # Does nothing, will be managed in Scene_Victory\n end", "def display_exp_and_gold\n # Does nothing, will be managed in Scene_Victory\n end", "def death\n death1 = Explosion.new(@x, @y, 0, @map, @color)\n death2 = Explosion.new(@x, @y, Math::PI / 2, @map, @color)\n death3 = Explosion.new(@x, @y, Math::PI, @map, @color)\n death4 = Explosion.new(@x, @y, Math::PI * 3 / 2, @map, @color)\n\n @map.EobjectArray.push(death1)\n @map.EobjectArray.push(death2)\n @map.EobjectArray.push(death3)\n @map.EobjectArray.push(death4)\n\n @map.PobjectArray.delete(self)\n end", "def setup\n size 640, 300, P3D\n @lens_d = 160\n @lens_list = []\n @xx, @yy, @dx, @dy = 0, 0, 3, 3\n \n # Create buffered image for lens effect.\n @lens_effect = create_graphics(width, height, P2D)\n \n # Load background image.\n @lens_effect.begin_draw\n @lens_effect.image(load_image('red_smoke.jpg'), 0, 0, width, height)\n @lens_effect.end_draw\n image(@lens_effect, 0, 0, width, height)\n \n # Create buffered image for warping.\n @lens_image = create_graphics(@lens_d, @lens_d, P2D)\n @lens_image2 = create_graphics(@lens_d, @lens_d, P2D)\n \n compute_lens_transformation\nend", "def particle_velocity_screen\n background('images/oscillations_large.png')\n\n # Particle velocity screen header\n flow(:height => 80, :width => 1080, :scroll => false) do\n @back_button = image('images/back_icon_white.png',\n :click => '/title_screen/oscillations_screen')\n @heading = title('Particle velocity = angular velocity x (amplitude', sup('2'),\n ' - particle displacement', sup('2'), ')', sup('0.5'))\n @back_button.style(@@screen_header_image_styles)\n @heading.style(@@screen_header_text_styles)\n end\n\n # Particle velocity screen content\n flow(:height => 640, :width => 1080, :scroll => true) do\n # Left margin offset\n stack(:height => 640, :width => 80) do\n end\n # Content column\n stack(:height => 640, :width => 1000) do\n @heading_edited = @heading.text\n ScreenLabel.new(self, @@font, @heading_edited, 'Angular velocity')\n flow do\n @angular_velocity = ScreenEditLine.new(self, @@font, @heading_edited)\n @angular_velocity_unit = para(strong(' rads'), strong(sup('-1')))\n @angular_velocity_unit.style(@@screen_unit_text_styles)\n end\n\n ScreenLabel.new(self, @@font, @heading_edited, 'Amplitude')\n flow do\n @amplitude = ScreenEditLine.new(self, @@font, @heading_edited)\n @amplitude_unit = para(strong(' m'))\n @amplitude_unit.style(@@screen_unit_text_styles)\n end\n\n ScreenLabel.new(self, @@font, @heading_edited, 'Particle displacement')\n flow do\n @particle_displacement = ScreenEditLine.new(self, @@font, @heading_edited)\n @particle_displacement_unit = para(strong(' m'))\n @particle_displacement_unit.style(@@screen_unit_text_styles)\n end\n\n ScreenLabel.new(self, @@font, @heading_edited, 'Return sign')\n flow do\n @signs = ['-', '+', '±']\n @return_sign = list_box(:width => 500,\n :font => @@font,\n :items => @signs)\n end\n\n @calculate = button('Calculate')\n\n @result_display = flow\n\n @error_display = flow\n\n @calculate.click do\n @result_display.clear do\n @result = Joules.particle_velocity(@angular_velocity.text.to_f,\n @amplitude.text.to_f,\n @particle_displacement.text.to_f,\n @return_sign.text)\n if @return_sign.text == '±'\n @return_sign_result = para('±')\n @return_sign_result.style(@@screen_result_text_styles)\n @particle_velocity = para(@result[0].to_s)\n else\n @particle_velocity = para(@result.to_s)\n end\n @particle_velocity_unit = para(' ms', sup('-1'))\n @particle_velocity.style(@@screen_result_text_styles)\n @particle_velocity_unit.style(@@screen_result_text_styles)\n end\n end\n end\n end\n end", "def create_enemy_window() end", "def update\n if width > Utility::EXPLOSION_SPEED * 30 || height > Utility::EXPLOSION_SPEED * 30\n @decreasing = true\n decrease\n elsif @decreasing && (width > 2 && height > 2)\n decrease\n elsif @decreasing\n level.remove_explosion(self)\n else\n increase\n end\n end", "def create_graphics\n create_viewport\n create_background\n create_buttons\n init_entering\n end", "def start\n super\n if VICTORY_CONFIG::IMAGE_BG != \"\"\n @bg = Sprite.new\n @bg.bitmap = Cache.picture(VICTORY_CONFIG::IMAGE_BG)\n @bg.opacity = VICTORY_CONFIG::IMAGE_BG_OPACITY\n end\n \n @help_window = Window_Info_Help.new(0, 0, 640, 56, Vocab::victory_help_text)\n @help_window.cText.align = 1\n @help_window.cText.font.bold = true\n # Refresh for the text alignment\n @help_window.refresh()\n\n if VICTORY_CONFIG::DIVIDE_EXP\n exp_by_actor = (@exp / $game_party.members.size).to_i\n else\n exp_by_actor = @exp\n end\n \n @actor_remaining_exp = []\n @victory_char_info_windows = []\n @victory_new_skill_windows = []\n @victory_level_up_windows = []\n for i in 0 .. $game_party.members.size-1 \n actor_exp = ActorExp.new(exp_by_actor, determine_tick($game_party.members[i].next_exp, exp_by_actor))\n @actor_remaining_exp.push(actor_exp)\n \n if i%2 == 0 \n x = -320\n else\n x = 640\n end\n victory_char_info_window = Window_Victory_Char_Info.new(x, (i/2).to_i*128+168, 320, 128, $game_party.members[i])\n victory_char_info_window.active = false\n @victory_char_info_windows.push(victory_char_info_window)\n\n victory_new_skill_window = Window_Victory_New_Skill.new((i%2)*320, (i/2).to_i*128+168+128-56, 320, 56, nil)\n victory_new_skill_window.active = false\n victory_new_skill_window.visible = false\n @victory_new_skill_windows.push(victory_new_skill_window)\n\n victory_level_up_window = Window_Victory_Level_Up.new((i%2)*320+200, (i/2).to_i*128+168, 120, 56)\n victory_level_up_window.active = false\n victory_level_up_window.visible = false\n victory_level_up_window.opacity = 0\n @victory_level_up_windows.push(victory_level_up_window)\n end\n\n @victory_item_window = Window_Victory_Item.new(160, 488, 320, 256, @drop_items)\n @victory_item_window.active = false\n @victory_item_window.visible = false\n\n @exp_window = Window_Victory_Exp.new(20, 83, 300, 56, @exp)\n @gold_window = Window_Victory_Gold.new(320, 83, 300, 56, @gold)\n\n [@help_window, @victory_item_window, @exp_window, @gold_window]+\n @victory_char_info_windows+@victory_new_skill_windows.each{\n |w| w.opacity = VICTORY_CONFIG::WINDOW_OPACITY;\n w.back_opacity = VICTORY_CONFIG::WINDOW_BACK_OPACITY\n }\n \n end", "def create_graphics\n create_viewport\n create_base_ui\n create_sub_background\n create_trainer_sprite\n create_badge_sprites\n create_texts\n end", "def draw \n\t\tsuper(\"Lives: #{@lives.to_s}\", X, Y, 5)\n\tend", "def create_graphic\n y = @enchant_list.bottom_corner\n h = Graphics.height - y - @enchant_window.height\n @graphic = GraphicUnifier.new(0, y, Graphics.width, h)\n @graphic.viewport = @viewport2\n @enchant_window.graphic = @graphic\n @enchant_window.scroll = @enchant_list.item\n end", "def create_graphics\n create_viewport\n create_base_ui\n create_pocket_ui\n create_scroll_bar\n create_bag_sprite\n create_item_list\n create_arrow\n create_info\n create_shadow\n create_search\n create_frame # Should always be last\n end", "def draw_life_info(actor, x, y, width)\n draw_actor_hp(actor, x, y, width)\n draw_actor_mp(actor, x, y + line_height, width)\n draw_actor_exp(actor, x, y + line_height * 2, width)\n draw_actor_ap(actor, x, y + line_height * 3, width)\n end", "def draw_overlay_bar_graph(data,data_description,alpha=50)\r\n #Validate the Data and DataDescription array */\r\n data_description=self.validate_data_description(\"draw_overlay_bar_graph\",data_description)\r\n self.validate_data(\"draw_overlay_bar_graph\",data)\r\n layer_width =@g_area_x2-@g_area_x1\r\n layer_height =@g_area_y2-@g_area_y1\r\n graph_id = 0\n @layers = []\r\n data_description[\"values\"].each do |col_name|\r\n id = 0\r\n data_description[\"description\"].each do |keyi,valuei|\r\n color_id = id if (keyi == col_name ) \n id = id+1\n end\n \n \n \r\n @layers[graph_id] = image_create_true_color(layer_width,layer_height)\n c_white = GD2::Color.new(255,255,255)\r\n # c_graph = $this->AllocateColor(@layers[graph_id],@pallette[graph_id][\"r\"],@pallette[graph_id][\"g\"],@pallette[graph_id][\"b\"])\n #c_graph=self.allocate_color(@pallette[graph_id][\"r\"],@pallette[graph_id][\"g\"],@pallette[graph_id][\"b\"])\r\n image_filled_rectangle(@layers[graph_id],0,0,layer_width,layer_height,255,255,255)\r\n \n image_color_transparent(@layers[graph_id],255,255,255)\r\n\r\n xwidth = @division_width.to_f / 4\r\n xpos = @g_area_x_offset.to_f\r\n yzero = layer_height - ((0-@vmin.to_f) * @division_ratio.to_f)\r\n xlast = -1 \n points_count = 2\r\n data.each do |key|\r\n value = key[col_name] if ( !(key[col_name].nil?) )\r\n if ( (value).is_a?(Numeric) )\n \r\n ypos = layer_height - ((value-@vmin.to_f) * @division_ratio.to_f)\n \r\n image_filled_rectangle(@layers[graph_id],xpos-xwidth,ypos,xpos+xwidth,yzero,@palette[graph_id][\"r\"],@palette[graph_id][\"g\"],@palette[graph_id][\"b\"])\r\n\r\n x1 =(xpos - xwidth +@g_area_x1).floor\n y1 = (ypos+@g_area_y1).floor + 0.2\r\n x2 = (xpos + xwidth +@g_area_x1).floor\n y2 =@g_area_y2 - ((0-@vmin.to_f) * @division_ratio.to_f)\r\n x1 =@g_area_x1 + 1 if ( x1 <=@g_area_x1 ) \r\n x2 =@g_area_x2 - 1 if ( x2 >=@g_area_x2 )\r\n\r\n #/* Save point into the image map if option activated */\r\n if ( @build_map )\r\n self.add_to_image_map(x,[y1,y2].min,x2,[y1,y2].min,@data_description[\"description\"][col_name],key[col_name].data_description[\"unit\"][\"y\"],\"obar\")\r\n\r\n self.draw_line(x,y1,x2,y1,@palette[color_id][\"r\"],@palette[color_id][\"g\"],@palette[color_id][\"b\"],true)\r\n end\r\n end\r\n xpos = xpos +@division_width.to_f\r\n end #Do end\r\n \r\n graph_id = graph_id+1\n end #for loop\r\n i1=0\n while i1<=(graph_id-1)\r\n \n if !@layers[i1].nil?\n image_copy_merge(@picture,@layers[i1],@g_area_x1,@g_area_y1,0,0,layer_width,layer_height,alpha)\r\n # imagedestroy(@layers[$i])\n end \n i1= i1+1\r\n end\r\n end", "def display\n fill(127)\n stroke(0)\n stroke_weight(2)\n ellipse(x, y, radius * 2, radius * 2)\n end", "def draw\n # draw the \"background\" translucid energy bar\n super\n \n @energy = Engine::Game.game_state.energy\n # clip the opaque image to draw only the remaining energy\n Engine::Game.instance.clip_to(@x - @image.width / 2, @y - @image.height / 2, @energy * BarWidth, @image.height) do\n @image, @image_full = @image_full, @image # swap transparent and opaque images\n super # draw the \"foreground\" opaque var\n end\n \n @image, @image_full = @image_full, @image # back to normal\n end", "def build_lean(entities,r,t)\n\n\n\n lean_group = entities.add_group\n\n lean_group.entities.add_dimension_linear([0,0,0],[0,$lean_length,0], [-30,0,0]).arrow_type = Sketchup::Dimension::ARROW_SLASH\n lean_group.entities.add_dimension_linear([0,0,0],[$lean_width,0,0], [0,-60,0]).arrow_type = Sketchup::Dimension::ARROW_SLASH\n lean_group.entities.add_text(\"Lean-to\", [$lean_width/2,$lean_length/2,-2])\n\n\n o = Geom::Point3d.new(-$lean_overjet,-$lean_overhang,$lean_height-$lean_overhang*$lean_pitch/12)\n h = Geom::Vector3d.new(0,$lean_length+$lean_overhang, ($lean_length+$lean_overhang)*$lean_pitch/12)\n f = Geom::Vector3d.new(0,0,$facia)\n v = Geom::Vector3d.new($lean_width+2*$lean_overjet,0,0)\n p1 = o\n p2 = o + v\n p3 = o + v + h\n p4 = o + h\n p5 = o + f\n p6 = o + f + v\n p7 = o + f + v + h\n p8 = o + f + h\n\n lean_group.entities.add_face(p5,p6,p7,p8).material = $roofColor\n lean_group.entities.add_face(p1,p4,p8,p5).material = $faciaColor\n lean_group.entities.add_face(p2,p3,p7,p6).material = $faciaColor\n lean_group.entities.add_face(p1,p2,p6,p5).material = $faciaColor\n lean_group.entities.add_face(p1,p2,p3,p4)\n\n lean_group.entities.add_cline([-$lean_overjet,-$lean_overhang,0],[$lean_width+$lean_overjet,-$lean_overhang,0])\n lean_group.entities.add_cline([$lean_width+$lean_overjet,-$lean_overhang,0],[$lean_width+$lean_overjet,$lean_length,0])\n lean_group.entities.add_cline([-$lean_overjet,-$lean_overhang,0],[-$lean_overjet,$lean_length,0])\n\n\n if($lean_wall[0] == 1)\n pl1 = [$lean_width, 0, 0]\n pl2 = [$lean_width, $lean_length,0]\n pl3 = [$lean_width,$lean_length,$lean_height+$lean_length*$lean_pitch/12]\n pl4 = [$lean_width,0,$lean_height]\n lean_group.entities.add_face(pl1,pl2,pl3,pl4).material = $wallColor\n end\n\n if($lean_wall[1] == 1)\n pm1 = [$lean_width,0,0]\n pm2 = [0,0,0]\n pm3 = [0,0,$lean_height]\n pm4 = [$lean_width,0,$lean_height]\n a = lean_group.entities.add_face(pm1,pm2,pm3,pm4)\n a.back_material = $wallColor\n a.material = $wallColor\n end\n\n\n p = 6\n if($lean_wall[1] >= 2)\n c = 7\n #$lean_width = $lean_width-2*$lean_overhang\n lean_group.entities.add_face([0,$lean_length,0],[0,0,0],[$lean_width,0,0],[$lean_width,$lean_length,0],[$lean_width-c,$lean_length,0],[$lean_width-c,c,0],[c,c,0],[c,$lean_length,0],[0,$lean_length,0]).pushpull -3\n lean_group.entities.add_line([0,$lean_length,0],[c,$lean_length,0]).faces[0].erase!\n\n n = $lean_wall[1] \n # entities.add_face([0,0,0,],[0,p,0],[p,p,0],[p,0,0]).pushpull -$lean_height-$facia\n # entities.add_face([$lean_width,0,0],[$lean_width,p,0],[$lean_width-p,p,0],[$lean_width-p,0,0])\n d = ($lean_width - p*n)/(n-2+1)\n for i in 0..n-1 \n a = lean_group.entities.add_face([i*(p+d),0,0,],[i*(p+d),p,0],[i*(p+d)+p,p,0],[i*(p+d)+p,0,0])\n end\n d = $lean_width/(n-1)\n if n>2\n for i in 0..n-2\n lean_group.entities.add_dimension_linear([i*d,0,0],[(i+1)*d,0,0], [0,-30,0]).arrow_type = Sketchup::Dimension::ARROW_SLASH\n end\n end\n\n \n\n\n\n end\n\n if($lean_wall[2] == 1)\n pr1 = [0,0,0]\n pr2 = [0,$lean_length,0]\n pr3 = [0,$lean_length,$lean_height+$lean_length*$lean_pitch/12]\n pr4 = [0,0,$lean_height]\n lean_group.entities.add_face(pr1,pr2,pr3,pr4).back_material = $wallColor\n end\n\n entities.transform_entities r, lean_group\n entities.transform_entities t, lean_group\n \nend", "def draw\n @background.draw(0, -200, 0)\n @marco_name.draw(0, 0, 0)\n @marco_score.draw($window.width - 170, 0, 0)\n super\n @msj_name.draw\n @msj_score.draw\n\n # condiciones para que aparesca o no la meta del nivel\n if @score == 15\n create_meta(ramdon_location) unless @meta_on\n Plataforma2.all.select do |e|\n e.x == @plataforma_meta.x && e.y == @plataforma_meta.y\n end.first.destroy unless @meta_on\n \n @meta_on = true\n @msj_name.y = 15\n @mensaje.draw\n @mensaje2.draw\n end\n end", "def horloges_parties\n cmd = []\n cmd << %Q{-stroke gray50 -fill -pointsize 6.5 -strokewidth 2}\n # Pour le paradigme absolu\n decs = [0,30,60,90,120] # on en aura besoin ci-dessous\n decs.each do |dec|\n h = Horloge.new(horloge:realtime(dec).to_horloge, top:self.class.top_horloge_part_absolue, left:realpos(dec), bgcolor:'gray50', color:'gray90')\n cmd << h.magick_code\n end\n\n # Pour le paradigme propre au film\n [ne(:dv), ne(:d2)||ne(:cv), ne(:dn)].each_with_index do |neu, idx|\n next if neu.nil?\n dec = decs[idx+1]\n leftpos = realpos(dec)\n top = self.class.top_horloge_part_relative\n h = Horloge.new(horloge:neu.time.to_i.to_horloge, top:top, left:leftpos, bgcolor:'gray20', color:'white')\n cmd << h.magick_code\n # Pour le décalage\n leftdec = realpos(dec + 2.5)\n diff = neu.time.to_i - realtime(dec)\n pref = diff > 0 ? '+' : '−'\n cmd << %Q{-stroke black -fill black -draw \"text #{leftdec},#{top+LINE_HEIGHT/5} '#{pref}#{diff.abs.to_horloge}'\"}\n end\n\n return cmd.join(' ')\nend", "def draw\n @graphics.draw\n @script.draw\n end", "def appear\n refresh\n self.visible = true\n self.opacity = 255\n end", "def draw(sx, sy, color=0xffffffff)\n if @type != \"vine_growth\"\n \t @invObj[milliseconds / 60.0 % @invObj.size].draw_rot(@x - sx, @y - sy, @z, (@angle/30).to_i*30, 0.5, 0.5, @size, 1, color)\n \t @glow.draw_rot(@x - sx, @y - 23 - sy, @z + 0.1, 0, 0.5, 0.5, 1, 1, 0xaaff6600, :additive) if @type==\"fire_pickup\"\n \telse\n \t #APICAL MERISTEM...\n \t @invObj[milliseconds / 200 % @invObj.size].draw_rot(@x - sx, @y - @growth_height - sy, @z+0.1, @angle, 0.5, 0.5, @size, 1, color)\n \t \n \t #ZONE OF ELONGATION\n \t @stems.each do |stem|\n \t stem[milliseconds / @speeds[@stems.index(stem)] % stem.size].draw_rot(@x - sx, @y - (@stems.index(stem)*92) - sy, @z, 0, 0.5, 0.5, 1, 1, color)\n end\n \tend\n end", "def touch_end_explosion\n vector = @current_point - @selected.position\n magnitude = Math.sqrt(vector.x**2 + vector.y**2)\n @delegate.explosion = magnitude\n @delegate.close_modal_view\n end", "def draw_particles()\n for particle in @particles do\n colour_fade = Gosu::Color.argb(particle.t -= 5, particle.r, particle.g, particle.b)\n draw_rect(particle.x += particle.direction_x,particle.y += particle.direction_y,particle.size,particle.size,colour_fade,10)\n \n # Removes particle from array therefore\n # preventing it from being redrawn after it's\n # transparecy is below 0 improving performance\n # and indefinite particle array growth\n if particle.t <= 0\n @particles.delete(particle)\n end\n end\nend", "def render_extend_interp_spokes(shiftx, shifty, color, ibegin, iend)\n \n\n iend.each_with_index do |p, i|\n#\tif p.size >= 4 and (p[3].is_a? Integer) and p[3] >= 0 and p[3] < 3 \n#\t @app.stroke $sreps[p[3]].color\n\n\tif p.size >=3 and (p[2].is_a? Integer) and p[2] >= 0 and p[2] < 3 \n\t @app.stroke $sreps[p[2]].color\n\telse \n @app.stroke color\n\tend\n @app.line(ibegin[i][0]+shiftx, ibegin[i][1]+shifty, p[0]+shiftx, p[1]+shifty)\n end\n end", "def display\n stroke(0)\n stroke_weight(1)\n # Brightness is mapped to the accumulated action potential\n b = map1d(sum, (0..1), (255..0))\n fill(b)\n ellipse(location.x, location.y, r, r)\n # Size shrinks down back to original dimensions\n @r = lerp(r, 32, 0.1)\n end", "def draw()\n @cEquipKind.draw()\n @ucIcon.draw()\n @cEquipName.draw()\n end", "def draw_data\r\n self.contents.font.name = AmmoFont\r\n # Loop through every item\r\n for i in 0...[@items.size, @xy_pos.size].min\r\n # Skip drawing the icon if the item is diabled\r\n next if item_disabled(i)\r\n next if not @items[i].methods.include( 'icon_name' )\r\n # Get the bitmap\r\n bitmap = RPGCache.icon(@items[i].icon_name)\r\n # If COG - Extra Frames is being used\r\n if defined(COG_ExtraFrames)\r\n # If the icon name includes the regexp, restrict to the first frame\r\n if @items[i].icon_name[COG_ExtraFramesREGEXP]\r\n rect = Rect.new(0, 0, bitmap.width $1.to_i, bitmap.height)\r\n # If it's a normal item, use its size\r\n else\r\n rect = bitmap.rect\r\n end\r\n else\r\n # Make the graphic's size the icon's size\r\n rect = bitmap.rect\r\n end\r\n x, y = @xy_pos[i][0] - rect.width 2, @xy_pos[i][1] - rect.height 2\r\n #set opacity depending on whether the item is usable\r\n opacity = (item_usable(@items[i]) 255 DisabledOpacity)\r\n # copy the bitmap onto the window\r\n self.contents.blt(x, y, bitmap, rect, opacity)\r\n #if the data is an item\r\n if @items[i].is_a(RPGItem)\r\n #get the id of the consumable used by the item\r\n id = XASITEM_COST[XASXASITEM_ID[@items[i].id]] rescue next\r\n #skip if there is no consumable\r\n next if id.nil\r\n #get the amount of that item\r\n ammount = $game_party.item_number(id)\r\n #check if the amount is capped\r\n if defined(ZeldaHUD_Customization) && \r\n !ZeldaHUD_CustomizationItemCapVar[id].nil\r\n value = $game_variables[ZeldaHUD_CustomizationItemCapVar[id]]\r\n cap = (ammount == value)\r\n else\r\n cap = (ammount == 99)\r\n end\r\n #get the font color\r\n color = cap Color.new(0,255,0,opacity) Color.new(255,255,255,opacity)\r\n self.contents.font.color = color\r\n #draw the ammount of the consumable\r\n self.contents.draw_text(x, y + 16, bitmap.width,\r\n bitmap.height, ammount.to_s, 0)\r\n end\r\n end\r\n #Reset the font details\r\n self.contents.font.name = Font.default_name\r\n self.contents.font.color = Font.default_color\r\n end", "def draw_tactic_overview\n end", "def draw_overview_content\n rectw = 192\n draw_enemy_graphic(0, line_height, rectw, rectw)\n draw_enemy_name(0, rectw + line_height, rectw, line_height * 2)\n draw_enemy_killed(0, rectw + line_height * 3, rectw)\n draw_enemy_info(rectw + 20, line_height, contents.width - rectw - 20)\n draw_enemy_description(0, rectw + line_height * 5, contents.width, contents.height - rectw - line_height * 5)\n draw_enemy_position(rectw + 10, line_height * 6)\n end", "def refresh\n # remove bitmap if already existing\n if self.contents != nil\n self.contents.dispose\n self.contents = nil\n end\n # change width\n self.width = FULL_DISPLAY ? 32 + 160 * $game_party.actors.size : 192\n # create new bitmap\n self.contents = Bitmap.new(self.width - 32, self.height - 32)\n # set font style\n self.contents.font.name = 'Arial'\n self.contents.font.size = 16\n self.contents.font.bold = true\n # initialize data\n @names, @levels, @hps, @sps, @exps = [], [], [], [], []\n # iterate through all actor indices\n $game_party.actors.each_index {|i|\n # get actor depending on FULL_DISPLAY option\n actor = $game_party.actors[(FULL_DISPLAY ? i : $game_system.index)]\n # set style and draw name\n self.contents.font.italic = true\n self.contents.font.size += 2\n self.contents.font.color = system_color\n self.contents.draw_text(i*160, -8, 152, 32, actor.name, 1)\n # reset style\n self.contents.font.italic = false\n if SIMPLE\n # draw other HP, SP and EXP on HUD\n self.contents.font.size -= 2\n draw_actor_hp_hud(actor, i*160, 16, 160)\n draw_actor_sp_hud(actor, i*160, 32, 160)\n draw_actor_exp_hud(actor, i*160, 48, 160)\n else\n # draw other HP, SP and EXP on HUD using Blizz-Art\n draw_actor_hp(actor, i*160, 8, 160)\n draw_actor_sp(actor, i*160, 32, 160)\n draw_actor_exp_alt(actor, i*160, 56, 160)\n self.contents.font.size -= 2\n end}\n # draw gold text\n self.contents.font.color = Color.new(255, 255, 0)\n self.contents.draw_text(0, (SIMPLE ? 56 : 84), 148, 32, $data_system.words.gold)\n self.contents.draw_text(0, (SIMPLE ? 56 : 84), 148, 32, $game_party.gold.to_s, 2)\n # iterate through all party members and add stats to data arrays\n $game_party.actors.each {|actor|\n @names.push(actor.name)\n @levels.push(actor.level)\n @hps.push(actor.hp)\n @sps.push(actor.sp)\n @exps.push(actor.exp)}\n @gold = $game_party.gold\n end", "def draw_delauney\nend", "def visualize\n health_level = @health * 100 / @initial_health\n stars = \"*\" * health_level\n spaces = \" \" * (100 - stars.length)\n @is_tired == true ? tired_or_not = \"tired\" : tired_or_not = \"not_tired\"\n @is_dead == true ? dead_or_alive = \"dead\" : dead_or_alive = \"alive\"\n puts \"#{@name} #{stars}#{spaces} #{tired_or_not} #{dead_or_alive}\"\n end", "def create_walk_particle()\n\n end", "def legionnairs\n\n end", "def create_graphics\n create_viewport\n create_base_ui\n create_credit_payout\n create_bands\n end", "def draw_objectives\n y = @draw_y\n unless QuestData::VOCAB[:objectives].empty?\n draw_heading(:objectives, y)\n y += line_height\n end\n @quest.revealed_objectives.each { |obj_id| y = draw_objective(obj_id, y) }\n end", "def draw_advanced(rect, item) end", "def drawVolcanicAsh\n # apply sky tone\n if @sprites[\"sky\"]\n @sprites[\"sky\"].tone.all -= 4 if @sprites[\"sky\"].tone.all > -100\n @sprites[\"sky\"].tone.gray += 16 if @sprites[\"sky\"].tone.gray < 128\n for i in 0..1\n @sprites[\"cloud#{i}\"].tone.all -= 4 if @sprites[\"cloud#{i}\"].tone.all > -100\n @sprites[\"cloud#{i}\"].tone.gray += 16 if @sprites[\"cloud#{i}\"].tone.gray < 128\n end\n end\n for j in 0...72\n next if @sprites[\"w_volc#{j}\"]\n @sprites[\"w_volc#{j}\"] = Sprite.new(@viewport)\n @sprites[\"w_volc#{j}\"].create_rect(5, 5, Color.black)\n @sprites[\"w_volc#{j}\"].default!\n @sprites[\"w_volc#{j}\"].angle = 90\n @sprites[\"w_volc#{j}\"].oy = 2\n @sprites[\"w_volc#{j}\"].opacity = 0\n end\n end", "def add_bullets\n @window.bullets << Vibrant_Bullet.new(@window, @player, @player.x, @player.y - @player.height/2.0)\n end", "def create_graphics\n create_viewport\n end", "def branch subplot_class = Gamefic::Subplot, introduce: nil, next_cue: nil\n subplot = subplot_class.new(self, introduce: introduce, next_cue: next_cue)\n p_subplots.push subplot\n subplot\n end", "def draw_drops_content\n y = draw_drops\n draw_steals(y)\n if enemy.robbery_amount > 0\n draw_steal_gold(contents_height - line_height)\n end\n end", "def draw()\n draw_controls()\n end", "def content\n @bgs, @gbs = [], []\n img = image(\"#{HH::STATIC}/hhhello.png\")\n img.move 305, 42\n @bgs << img\n @bgs << rect(38, 0, width-38, 35, fill: \"#CDC\")\n @bgs << rect(38, 0, width-38, 38, fill: black.push(0.05)..black.push(0.2))\n @tabs, @tables = [], HH::DB.tables\n @scripts = HH.scripts\n\n hometab \"Programs\", true, 50, 13 do\n @slot.append do\n @homepane.clear{home_scripts}\n flush\n end\n end\n hometab \"Samples\", false, 168, 13 do\n @slot.append do\n @homepane.clear{sample_scripts}\n flush\n end\n end\n @bgs << rect(38, 38, 300, 4, fill: rgb(233, 239, 224))\n\n @slot.append do\n stack(height: 40){}\n @homepane = flow(margin_top: 10){home_scripts}\n flush\n end\n\n=begin\n stack :margin_left => 12 do\n background rgb(233, 239, 224, 0.85)..rgb(233, 239, 224, 0.0)\n image 10, 70\n end\n @bulletin_stack = stack do\n end\n=end\n end", "def draw_actor_exp_hud(actor, x, y, w = 148)\n # calculate fill rate\n rate = (actor.next_exp != 0 ? actor.now_exp.to_f / actor.next_exp : 1)\n # create color depending on fill rate\n if rate < 0.5\n color1 = Color.new(60 * rate, 180, 240, 192) \n elsif rate >= 0.5\n color1 = Color.new(60 + 360 * (rate-0.5), 180 + 120 * (rate-0.5), 240, 192) \n end\n # background color\n color2 = Color.new(80, 80, 80, 192)\n # draw bar\n self.contents.gradient_bar_simple(x + 32, y, w - 48, color1, color2, rate)\n # fix y coordinate\n y -= 9\n self.contents.font.color = system_color\n # draw \"next\"\n self.contents.draw_text_full(x, y, 80, 32, 'next')\n self.contents.font.color = normal_color\n # draw value\n self.contents.draw_text_full(x + 56, y, 84, 32, actor.next_rest_exp_s, 2)\n self.contents.font.color.alpha = 255\n end", "def add(graphic)\n @child_graphics.push(graphic)\n end", "def grass_init\n #Herbe du fond\n @layer1 = Sprite.new(@viewport)\n @layer1.bitmap = RPG::Cache.transition(\"ecd_poke03\")\n @layer1.y = 240 - 128\n @layer11 = Sprite.new(@viewport)\n @layer11.bitmap = @layer1.bitmap\n #Herbe de devant\n @layer2 = Sprite.new(@viewport)\n @layer2.bitmap = RPG::Cache.transition(\"ecd_poke01\")\n @layer22 = Sprite.new(@viewport)\n @layer22.bitmap = RPG::Cache.transition(\"ecd_poke02\")\n @layer22.x = @layer11.x = 256\n @layer22.y = @layer2.y = @layer11.y = @layer1.y\n @layer2.ox = @layer22.ox = 512\n @layer11.ox = @layer1.ox = -320\n #>Fond noir qui se déplace\n @black = Sprite.new(@viewport)\n @black.bitmap = Bitmap.new(448, 240)\n @black.bitmap.fill_rect(128,0,320,240, Color.new(0,0,0))\n bmp = RPG::Cache.transition(\"ecd_z01\")\n @black.bitmap.blt(0,0, bmp, bmp.rect)\n @black.ox = 128\n\n @black.z = 99999\n @layer1.z = 101\n @layer11.z = 102\n @layer2.z = 103\n @layer22.z = 104\n @black.visible = @layer2.visible = @layer22.visible = @layer1.visible = \n @layer11.visible = false\n end", "def solids_tech_demo\n outputs.labels << [ 5, 350, \"Solids (x, y, w, h, r, g, b, a)\"]\n outputs.solids << [ 10, 270, 50, 50]\n outputs.solids << [ 70, 270, 50, 50, 0, 0, 0]\n outputs.solids << [130, 270, 50, 50, 255, 0, 0]\n outputs.solids << [190, 270, 50, 50, 255, 0, 0, 128]\n outputs.solids << [250, 270, 50, 50, 0, 0, 0, 128 + state.tick_count % 128] # transparency changes\n end", "def create_graphics\n create_character_sprite\n create_phrase\n create_inputs\n refresh_chars\n end", "def draw\n\t\t\t\t\n\t\t\tend", "def draw_actor_status\n x = 104 + 120\n draw_actor_hp(actor, x, 0, contents_width - x)\n draw_actor_mp(actor, x, line_height, contents_width - x)\n draw_actor_ap(actor, x, line_height * 2, (contents_width - x) / 2)\n draw_actor_exp(actor, x + (contents_width - x) / 2, line_height * 2, contents_width - x / 2)\n end", "def create_graphics\n create_viewport\n create_base\n create_ui\n end", "def draw\r\n draw_background\r\n draw_h(@balls)\r\n end", "def create_graphics\n create_viewport\n create_spriteset_and_background\n create_action_sprites(@viewport.rect.width / 2)\n create_selection\n end", "def initialize opts = {}\n \n @block=opts[:blk]||nil\n @selected=nil\n @state=:enabled\n @height=opts[:rows]\n @items=opts[:items] \n @headers=opts[:headers]\n @columns=@headers.size\n mult = @items.size > @height ? 1:0\n debug(mult)\n nostroke\n @width=2\n @item=[]\n @headers.each { |x| @width+=(x[1]+1) }\n nostroke\n fill red\n @top=opts[:top]\n @left=opts[:left]\n @rec=rect :top => 0, :left => 0, :width=>@width+mult*12+2, :height=>31*(@height+1)+4 \n @lefty=0 \n\n # tweaks \n @default_color = black\n @default_color = opts[:defaultcolor] if opts[:defaultcolor]\n @color = black\n @color = opts[:color] if opts[:color]\n @predicate = Proc.new {|i| true }\n @predicate = opts[:predicate] unless opts[:predicate].nil?\n\n \n @header=flow do \n @headers.each_with_index do |h,l|\n temp=(l==@headers.size-1 ? h[1]+12*mult : h[1])\n debug(\"#{l} -> #{temp}\")\n flow :top=>2,:left=>@lefty+2,:width=>temp,:height=>29 do\n rect(:top=>0,:left=>1,:width=>temp,:height=>29, :fill=>lightgrey)\n p=para strong(h[0]), :top=>2, :align=>'center'\n @lefty+=h[1]+1\n end\n end \n end\n\n @flot1=stack :width=>@width+mult*12+2, :height=>31*(@height), :scroll=>true, :top=>33, :left=>1 do\n @items.each_with_index do |it, i|\n inscription \" \"\n @item[i]=stack :width=>@width-1, :top=>31*i, :left=>1 do\n @lefty=0\n rr=[]\n @columns.times do |ei|\n rr[ei]=rect(:top=>1, :left=>@lefty+1, :width=>@headers[ei][1]-1,:height=>29, :fill=>white)\n it[ei]=\" \" if not it[ei] or it[ei]==\"\"\n ins = inscription strong(it[ei]), :top=>31*i+3, :left=>@lefty+2, :width=>@headers[ei][1]-1, :align=>'center'\n\n # color tweak\n if @predicate.call(i)\n ins.style(:stroke => @color) \n else\n ins.style(:stroke => @default_color) \n end\n\n @lefty+=@headers[ei][1]+1\n end\n\n hover do\n if @state==:enabled\n @item[i].contents.each{|x| x.style(:fill=>dimgray)}\n end\n end\n leave do\n if @state==:enabled\n if @selected\n if @selected==i\n @item[i].contents.each{|x| x.style(:fill=>salmon)}\n else\n @item[i].contents.each{|x| x.style(:fill=>white)}\n end\n else\n @item[i].contents.each{|x| x.style(:fill=>white)}\n end\n end\n end\n click do\n if @state==:enabled\n if @selected\n if @selected==i\n @item[i].contents.each{|x| x.style(:fill=>white)}\n @selected=nil\n else\n @item[@selected].contents.each{|x| x.style(:fill=>white)} \n @item[i].contents.each{|x| x.style(:fill=>salmon)}\n @selected=i\n end\n else\n @item[i].contents.each{|x| x.style(:fill=>salmon)}\n @selected=i\n end\n @block.call @items[i] if @selected and @block\n end \n end \n end\n end\n end\n end", "def doppelganger( id, colors: )\n ## note: quick hack? - use empty string ('') for original series for now\n ['', 'v2', 'cryptocats'].each do |series|\n designs, design_nums = case series\n when 'v2' then [DESIGNS_V2, [8,9,10,11, 12,13,14,15]]\n when 'cryptocats' then [DESIGNS_CRYPTOCATS, [0,1,2,3]]\n else [DESIGNS, [8,9,10,11, 12,13,14,15]]\n end\n\n\n colors_new = if series == 'cryptocats'\n # change color order\n # note: colors off by one (starting with 0!!)\n colors_new = colors.dup\n colors_new[3] = colors[2] # base\n colors_new[1] = colors[3] # pattern 1\n colors_new[2] = colors[1] # pattern 2\n colors_new\n else\n colors ## use passed in as is 1:1\n end\n\n\n\n design_nums.each do |design_num|\n design = designs[ design_num ]\n\n\n cat_proto = Mooncats::Image.new( design: design,\n colors: colors_new )\n\n name = '%03d' % design_num\n name << series\n\n [1,3].each do |zoom|\n cat = cat_proto\n if zoom > 1\n cat = cat.zoom( zoom )\n name += \"x#{zoom}\"\n end\n cat.save( \"i/#{id}_#{name}.png\" )\n end # each zoom\n end # each design\n end # each series\nend", "def final_effect(_effects); end", "def make_plots(pars,cov_matrix)\n PWA::Dataset.each{|dataset|\n\tnext unless dataset.type == :evt\n\tcind = @canvases.length\n @canvases.push ::TCanvas.new(\"dsigma_canvas_#{cind}\",'',25 + 50*cind,\n 25,500,500)\n\t@canvases.last.cd\n\tgPad.SetLogy if @log\n\tname = \"#{dataset.name}_#{@kv}\"\n\t#\n\t# data histo\n\t#\n\ttitle,num_bins,min,max,bins,bin_errors = dataset.histo_bins([@kv],pars,\n\t\t\t\t\t\t\t\t :unwtd,\n\t\t\t\t\t\t\t\t :data)\n\th_data = TH1F.new(\"h_#{name}_data\",name,num_bins,min,max)\n\th_data.Sumw2\n\tbins.each_index{|b| \n\t h_data.SetBinContent(b+1,bins[b])\n\t h_data.SetBinError(b+1,bin_errors[b])\n\t}\n\th_data.GetXaxis.SetTitle title\n\th_dsigma = TH1F.new(\"h_#{name}_dsigma\",name,num_bins,min,max)\n\th_dsigma.Sumw2\n\tbins.each_index{|b| \n\t h_dsigma.SetBinContent(b+1,bins[b])\n\t h_dsigma.SetBinError(b+1,bin_errors[b])\n\t}\n\th_dsigma.GetXaxis.SetTitle title\n\t#\n\t# acc histo\n\t#\n\tdataset.read_in_amps(PWA::ParIDs.max_id,:acc)\n\tdataset.read_in_norm(:acc)\n\tacc_yield = dataset.calc_yield(pars,'.',:acc)\n\ttitle,num_bins,min,max,bins,bin_errors = dataset.histo_bins([@kv],pars,'.',:acc)\n\th_acc = TH1F.new(\"h_#{name}_acc\",name,num_bins,min,max)\n\th_acc.Sumw2\n\tbins.each_index{|b| \n\t h_acc.SetBinContent(b+1,bins[b])\n\t h_acc.SetBinError(b+1,bin_errors[b])\n\t}\n\th_acc.GetXaxis.SetTitle title\n\tintegral = h_acc.Integral\n\th_acc.Scale(acc_yield/integral) if(integral > 0)\n\t#\n\t# raw histo\n\t#\n\tdataset.read_in_amps(PWA::ParIDs.max_id,:raw)\n\tdataset.read_in_norm(:raw)\n\traw_yield = dataset.calc_yield(pars,'.',:raw)\n\ttitle,num_bins,min,max,bins,bin_errors = dataset.histo_bins([@kv],pars,'.',:raw)\n\th_raw = TH1F.new(\"h_#{name}_raw\",name,num_bins,min,max)\n\th_raw.Sumw2\n\tbins.each_index{|b| \n\t h_raw.SetBinContent(b+1,bins[b])\n\t h_raw.SetBinError(b+1,bin_errors[b])\n\t}\n\th_raw.GetXaxis.SetTitle title\n\tintegral = h_raw.Integral\n\th_raw.Scale(raw_yield/integral) if(integral > 0)\n @histos.push h_acc\n @histos.push h_raw\n #\n\t# get dsigma\n\t#\n\th_dsigma.Divide(h_acc) \n\th_dsigma.Multiply(h_raw)\n\trange = max - min\n\th_dsigma.Scale(num_bins/range)\n #\n # get normalization error\n #\n rel_err_norm = dataset.get_norm_rel_err\n\t#\n\t# make the graph\n\t#\n\tx,y,xerr,yerr = [],[],[],[]\n\tnum_bins = h_dsigma.GetNbinsX\n\tnum_pts = num_bins\n\tnum_pts = @num_pts unless @num_pts.nil?\n\tnum_pts.times{|p|\n\t dsigma,error2,non_zero_bins,centroid = 0,0,0,0\n\t (num_bins/num_pts).times{|b|\n\t bin = (num_bins/num_pts)*p + b + 1\n\t bin_content = h_dsigma.GetBinContent(bin)\n\t bin_error = h_dsigma.GetBinError(bin)\n\t next unless bin_content > 0\n\t non_zero_bins += 1\n\t dsigma += bin_content\n\t error2 += bin_error**2\n\t centroid += h_dsigma.GetBinCenter(bin)\n\t }\n\t next if(non_zero_bins == 0)\n\t x.push centroid/non_zero_bins.to_f\n\t xerr.push 0.5*non_zero_bins*(range/num_bins.to_f)\n\t y.push dsigma/non_zero_bins.to_f\n err2 = error2 + (rel_err_norm*dsigma)**2\n\t yerr.push Math.sqrt(err2)/non_zero_bins.to_f\t \n\t}\n\tgr_sigma = TGraphErrors.new(x.length,x,y,xerr,yerr)\n\twbin = *(dataset.name.match(/Wbin\\d+-\\d+/))\n\tgr_sigma.SetName \"gr_#{name}_#{wbin}\"\n\ttitle = wbin\n\tgr_sigma.SetTitle title\n\tgr_sigma.SetMarkerStyle 20\n\tgr_sigma.Draw 'ap'\n\t@graphs.push gr_sigma\n\tgPad.Update\n }\n end", "def design2image\n\n bkgImg = Image.read(\"#{Rails.root}/public/#{params[:bkg]}\").first\n\n sideTop = 36\n sideLeft = 95\n sideWidth = 216\n sideHeight = 353\n\n side = params[:side]\n if side == 'SLEEVE'\n sideWidth = 162\n sideHeight = 250\n end\n #ART Processing\n arts = params[:art];\n art_tops = params[:art_top];\n art_lefts = params[:art_left];\n \n \n #Image.new(columns, rows) ~ (width, height)\n containSide = Magick::Image.new(sideWidth, sideHeight) do\n self.background_color = 'none'\n end\n\n i=0\n if arts\n clipArt = Image.read(\"#{Rails.root}/public/#{arts[0]}\").first\n clipArtTop = art_tops[i].to_i if art_tops[i]\n clipArtLeft = art_lefts[i].to_i if art_lefts[i]\n containSide = containSide.composite(clipArt, clipArtLeft, clipArtTop, OverCompositeOp)\n end\n\n #TEXT Processing\n texts = params[:text];\n text_tops = params[:text_top];\n text_lefts = params[:text_left];\n\n\n if texts\n textArtTop = text_tops[i].to_i if text_tops[i]\n textArtLeft = text_lefts[i].to_i if text_lefts[i]\n gc = Magick::Draw.new\n textArt = Magick::Image.new(300, 200) do\n self.background_color = 'none'\n end\n gc.annotate(textArt, 0, 0, 0, 0, texts[i]) do\n self.gravity = Magick::NorthWestGravity\n self.pointsize = 22\n self.font_family = \"Times\"\n self.fill = '#0000A9'\n self.stroke = \"none\"\n end\n end\n\n containSide.composite!(textArt, textArtLeft || 0, textArtTop || 0, OverCompositeOp) if textArt\n \n bkgImg.composite!(containSide, sideLeft, sideTop, OverCompositeOp)\n bkgImg.scale!(0.5)\n\n send_data bkgImg.to_blob, :disposition => 'inline', :type => 'image/png'\n\n# output = get_working_image(@session_id)\n# unless File.exist?(output)\n# FileUtils.cp(\"#{RAILS_ROOT}/public/images/#{params[:textart]}.png\", output)\n# img = Image.read(output).first\n# img = img.scale(params[:rs].to_f) unless params[:rs].blank?\n# img = img.level_colors(params[:b] || \"\", params[:w] || \"\", true) if params[:b] || params[:w]\n# img.background_color = \"none\"\n# img = img.rotate(params[:r].to_f) unless params[:r].blank?\n# img.write(output)\n# end\n# img = Image.read(output).first\n# send_data img.to_blob, :disposition => 'inline', :type => 'image/png'\n\n end", "def loadView # preferable to viewDidLoad because not using xib\n action_over_view = UIView.alloc.init\n self.view = action_over_view\n self.view.alpha = 0.0\n location_of_action = [95, 0]\n size_of_action = [@bounds.size.width - 190, @bounds.size.height]\n @button_toys = {}\n setup_sides\n @main_view = @scene_creator_view_controller.main_view\n show_sides\n end", "def render args\n\n\t\t# Might be useful to know the current FPS\n\t\targs.outputs.debug << { x: 10, y: args.grid.top - 30, text: args.gtk.current_framerate }.label\n\n\t\t# Use a solid to make sure the board is the right colour\n\t\targs.outputs.solids << {\n\t\t\tx: @board_x, y: @board_y, w: @board_w, h: @board_h,\n\t\t\tr: 222, g: 222, b: 222,\n\t\t}\n\n\t\t# Draw a nice border around the board\n\t\t(1..10).each do |index|\n\t\t\targs.outputs.borders << { \n\t\t\t\tx: @board_x - index, y: @board_y - index, \n\t\t\t\tw: @board_w + (index*2), h: @board_h + (index*2),\n\t\t\t\tr: 100 + (index*10), g: 100 + (index*10), b: 100 + (index*10),\n\t\t\t}\n\t\tend\n\n\t\t# Do similar work for the labels\n\t\targs.outputs.solids << {\n\t\t\tx: @label_x, y: @label_time_y, w: @label_width, h: @size_time.y,\n\t\t\tr: 222, g: 222, b: 222,\n\t\t}\n\t\targs.outputs.solids << {\n\t\t\tx: @label_x, y: @label_dragon_y, w: @label_width, h: @size_dragon.y,\n\t\t\tr: 222, g: 222, b: 222,\n\t\t}\n\t\targs.outputs.solids << {\n\t\t\tx: @label_x, y: @label_restart_y, w: @label_width, h: @size_restart.y,\n\t\t\tr: 222, g: 222, b: 222,\n\t\t}\n\n\t\t(1..10).each do |index|\n\t\t\targs.outputs.borders << { \n\t\t\t\tx: @label_x - index, y: @label_time_y - index, \n\t\t\t\tw: @label_width + (index*2), h: @size_time.y + (index*2),\n\t\t\t\tr: 100 + (index*10), g: 100 + (index*10), b: 100 + (index*10),\n\t\t\t}\n\t\t\targs.outputs.borders << { \n\t\t\t\tx: @label_x - index, y: @label_dragon_y - index, \n\t\t\t\tw: @label_width + (index*2), h: @size_dragon.y + (index*2),\n\t\t\t\tr: 100 + (index*10), g: 100 + (index*10), b: 100 + (index*10),\n\t\t\t}\n\t\t\targs.outputs.borders << { \n\t\t\t\tx: @label_x - index, y: @label_restart_y - index, \n\t\t\t\tw: @label_width + (index*2), h: @size_restart.y + (index*2),\n\t\t\t\tr: 100 + (index*10), g: 100 + (index*10), b: 100 + (index*10),\n\t\t\t}\n\t\tend\n\n\t\tif @restart_clicked\n\t\t\targs.outputs.borders << {\n\t\t\t\tx: @label_x + 1, y: @label_restart_y + 1, w: @label_width - 2, h: @size_restart.y - 2,\n\t\t\t\tr: 180, g: 180, b: 180,\n\t\t\t}\n\t\t\targs.outputs.borders << {\n\t\t\t\tx: @label_x + 2, y: @label_restart_y + 2, w: @label_width - 4, h: @size_restart.y - 4,\n\t\t\t\tr: 250, g: 250, b: 250,\n\t\t\t}\n\t\telse\n\t\t\targs.outputs.borders << {\n\t\t\t\tx: @label_x + 1, y: @label_restart_y + 1, w: @label_width - 2, h: @size_restart.y - 2,\n\t\t\t\tr: 250, g: 250, b: 250,\n\t\t\t}\n\t\t\targs.outputs.borders << {\n\t\t\t\tx: @label_x + 2, y: @label_restart_y + 2, w: @label_width - 4, h: @size_restart.y - 4,\n\t\t\t\tr: 180, g: 180, b: 180,\n\t\t\t}\n\t\tend\n\n\n\t\t# Exactly what get's rendered next depends on if we're finished or burniating\n\t\tif @victorious\n\n\t\t\t# Set up the end-of-game labels\n\t\t\tsecs_elapsed = ( @end_tick - @start_tick ).to_i / 60\n\t\t\targs.outputs.labels << {\n\t\t\t\tx: @label_x + ( @label_width/2 ), y: @label_time_y + @size_time.y,\n\t\t\t\tsize_enum: @label_size, alignment_enum: 1,\n\t\t\t\ttext: \"%02d:%02d:%02d\" % [(secs_elapsed/3600)%60, (secs_elapsed/60)%60, secs_elapsed%60], \n\t\t\t}\n\t\t\targs.outputs.labels << {\n\t\t\t\tx: @label_x + ( @label_width/2 ), y: @label_dragon_y + @size_dragon.y,\n\t\t\t\tsize_enum: @label_size, alignment_enum: 1,\n\t\t\t\ttext: \"#{@dragon_count} Dragons Found!\", \n\t\t\t}\n\t\t\targs.outputs.labels << {\n\t\t\t\tx: @label_x + ( @label_width/2 ), y: @label_restart_y + @size_restart.y,\n\t\t\t\tsize_enum: @label_size, alignment_enum: 1,\n\t\t\t\ttext: \"Restart\", \n\t\t\t}\n\n\t\t\t# And a shower of money!\n\t\t\tcoins = [ 400, ( args.tick_count - @end_tick ) ].min\n\t\t\t(0..coins).each { |step|\n\n\t\t\t\t# Decide where to put each coin\n\t\t\t\tcoin_x = @board_x + ( ( @board_w - 24 ) * rand )\n\t\t\t\tcoin_y = @board_y + ( ( @board_h - 24 ) * rand )\n\n\t\t\t\targs.outputs.sprites << {\n\t\t\t\t\tx: coin_x, y: coin_y, path: \"sprites/coin.png\",\n\t\t\t\t\tw: 24, h: 24, angle: rand( 360 ),\n\t\t\t\t}\n\t\t\t}\n\n\t\telsif @burniation == -1\n\n\t\t\t# Set up the labels, which yes could possibly be more ... static\n\t\t\tif @spawned\n\t\t\t\tsecs_elapsed = ( args.tick_count - @start_tick ).to_i / 60\n\t\t\t\targs.outputs.labels << {\n\t\t\t\t\tx: @label_x + ( @label_width/2 ), y: @label_time_y + @size_time.y,\n\t\t\t\t\tsize_enum: @label_size, alignment_enum: 1,\n\t\t\t\t\ttext: \"%02d:%02d:%02d\" % [(secs_elapsed/3600)%60, (secs_elapsed/60)%60, secs_elapsed%60], \n\t\t\t\t}\n\t\t\telse\n\t\t\t\targs.outputs.labels << {\n\t\t\t\t\tx: @label_x + ( @label_width/2 ), y: @label_time_y + @size_time.y,\n\t\t\t\t\tsize_enum: @label_size, alignment_enum: 1,\n\t\t\t\t\ttext: \"--:--:--\",\n\t\t\t\t}\n\t\t\tend\n\t\t\targs.outputs.labels << {\n\t\t\t\tx: @label_x + ( @label_width/2 ), y: @label_dragon_y + @size_dragon.y,\n\t\t\t\tsize_enum: @label_size, alignment_enum: 1,\n\t\t\t\ttext: \"#{@dragon_count - @cell_status.count(:status_gold)} Dragons To Find\", \n\t\t\t}\n\t\t\targs.outputs.labels << {\n\t\t\t\tx: @label_x + ( @label_width/2 ), y: @label_restart_y + @size_restart.y,\n\t\t\t\tsize_enum: @label_size, alignment_enum: 1,\n\t\t\t\ttext: \"Restart\", \n\t\t\t}\n\n\t\t\t# Send the board content to the output\n\t\t\targs.outputs.sprites << {\n\t\t\t\tx: @board_x, y: @board_y, w: @board_w, h: @board_h, path: :board,\n\t\t\t\tsource_x: 0, source_y: 0, source_w: @board_w, source_h: @board_h,\n\t\t\t}\n\n\t\telse\n\n\t\t\t# Render slightly different labels then\n\t\t\tsecs_elapsed = ( @end_tick - @start_tick ).to_i / 60\n\t\t\targs.outputs.labels << {\n\t\t\t\tx: @label_x + ( @label_width/2 ), y: @label_time_y + @size_time.y,\n\t\t\t\tsize_enum: @label_size, alignment_enum: 1,\n\t\t\t\ttext: \"%02d:%02d:%02d\" % [(secs_elapsed/3600)%60, (secs_elapsed/60)%60, secs_elapsed%60], \n\t\t\t}\n\t\t\targs.outputs.labels << {\n\t\t\t\tx: @label_x + ( @label_width/2 ), y: @label_dragon_y + @size_dragon.y,\n\t\t\t\tsize_enum: @label_size, alignment_enum: 1,\n\t\t\t\ttext: \"You Poked A Dragon!\", \n\t\t\t}\n\t\t\targs.outputs.labels << {\n\t\t\t\tx: @label_x + ( @label_width/2 ), y: @label_restart_y + @size_restart.y,\n\t\t\t\tsize_enum: @label_size, alignment_enum: 1,\n\t\t\t\ttext: \"Retry\", \n\t\t\t}\n\n\t\t\t# Work out where we are burniating\n\t\t\tcell_y, cell_x = @burniation.divmod( @width )\n\t\t\tcell_x = ( cell_x * @cell_size ) + @board_x\n\t\t\tcell_y = ( cell_y * @cell_size ) + @board_y\n\n\t\t\t# And build up a bunch of flamey things, randomly oriented\n\t\t\t(0..@burn_size).reverse_each { |step| \n\n\t\t\t\t# Work out sizes and positions\n\t\t\t\tflame_size = @cell_size + ( step * 20 )\n\t\t\t\tflame_x = cell_x - (flame_size/2)\n\t\t\t\tflame_y = cell_y - (flame_size/2)\n\n\t\t\t\targs.outputs.sprites << {\n\t\t\t\t\tx: flame_x, y: flame_y, path: \"sprites/burniate.png\",\n\t\t\t\t\tw: flame_size, h: flame_size, \n\t\t\t\t\tangle: ( ( step * 42 ) + args.tick_count ) % 360,\n\t\t\t\t\ta: 100 - (step),\n\t\t\t\t}\n\t\t\t}\n\t\t\t@burn_size = [100, @burn_size+1].min\n\n\t\tend\n\n\tend", "def add_gene(x_start, y_start)\n box_x_start = @box_size + @box_size/2\n box_y_start = @box_size\n box_height = @box_size/3\n\n #Will's testing junk\n @canvas.g.translate(x_start, y_start) do |gene|\n gene.styles(:fill=>'yellow', :stroke_width=>1, :stroke=>'black')\n gene.rect(100, box_height, box_x_start, box_y_start)\n end\n\n end", "def beanplot\n end", "def modeler_description\n return \"Creates overhang shading surfaces for windows on the specified building facade(s) and specified depth/offset. Any existing overhang shading surfaces are removed.\"\n end", "def create_graphics\n create_viewport\n @all_window = UI::SpriteStack.new(@viewport)\n create_background\n create_windows\n @all_window.each { |window| window.visible = false } if @delete_game\n @max_index = @all_window.size - 1\n Graphics.sort_z\n refresh\n end", "def sprites_tech_demo\n outputs.labels << [ 5, 170, \"Sprites (x, y, w, h, path, angle, a)\"]\n outputs.sprites << [ 10, 40, 128, 101, 'dragonruby.png']\n outputs.sprites << [ 150, 40, 128, 101, 'dragonruby.png', state.tick_count % 360] # angle changes\n outputs.sprites << [ 300, 40, 128, 101, 'dragonruby.png', 0, state.tick_count % 255] # transparency changes\n end", "def show_pegs\n white_pegs_as_circle\n red_pegs_as_circle\n puts \"White pegs: #{@white_pegs_as_circle}\"\n puts \"Red pegs: #{@red_peg_as_circle}\"\n end", "def begingraphics(*)\n super\n end", "def draw\n\t\t# draws the background image\n\t\t# @welcome.draw\n\t\t@background_image.draw(0, 0, 0)\n\t\t# go through each star and draw them\n\t\t@stars.each do |star|\n\t\t\tstar.draw\n\t\tend\n\t\t# draw the horse\n\t\t@horse.draw\n\t\t# draw the candy\n\t\t@candy.draw\n\t\t# draw the score\n\t\t@score_text.draw(\"#{@score}\", 0, 0, 1)\n\tend", "def display_levelup(actor)\n # get damage text colors and strings\n colors, damages = self.get_damage_data(Cache::TXTLvlUp)\n # for each existing color\n colors.each_index {|i|\n # create one damage sprite request\n $BlizzABS.cache.damages.push(DamageRequest.new(actor, damages[i],\n colors[i]))}\n end", "def draw\n\t\t\n\tend", "def draw\n\t\t\n\tend", "def draw\n\t\t\n\tend", "def draw\n\t\t\n\tend", "def draw\n end", "def draw; end", "def draw; end", "def drawRect(rect)\n #p \"draw Rect\"\n context = UIGraphicsGetCurrentContext()\n\n # Change Alpha of background if it hasnt been set\n if @alpha_view\n CGContextSetAlpha(context, @alpha_view)\n end\n\n # now draw the added toys\n CGContextBeginTransparencyLayer(context, nil)\n #@toys_in_scene.each { |toy| toy.update_image }\n @toys_in_scene.each { |toy| toy.draw(context) if toy != @selected }\n # Drawing Edges\n @strokes.each { |stroke| stroke.draw(context) if stroke != @selected }\n CGContextEndTransparencyLayer(context)\n\n # Restores Alpha\n if @alpha_view\n CGContextSetAlpha(context, 1.0)\n end\n\n if @secondary_selected\n CGContextBeginTransparencyLayer(context, nil)\n setup_context(context, true)\n @secondary_selected.draw(context)\n CGContextEndTransparencyLayer(context)\n end\n\n # Draws what is selected on top\n if @selected\n CGContextBeginTransparencyLayer(context, nil)\n setup_context(context, true)\n @selected.draw(context)\n CGContextEndTransparencyLayer(context)\n end\n\n # Item currently being drawn\n if @points\n CGContextBeginTransparencyLayer(context, nil)\n setup_context(context)\n draw_partial_thing(context)\n CGContextEndTransparencyLayer(context)\n end\n\n # If an effect needs a visual representation when applying, perform that here\n case @mode\n\n # Displays an arrow from selected to touched position\n when :force\n if @current_point && @selected\n @current_point = round_coordinates(@current_point, @selected.position)\n @current_point = snap_to_45(@current_point, @selected.position)\n draw_force_arrow(context, @selected.position, @current_point)\n end\n\n # Explosion size with radius between selected and finger\n when :explosion\n if @current_point && @selected\n @current_point = round_coordinates(@current_point, @selected.position)\n #draw_force_arrow(context, @selected.position, @current_point)\n length = Math.hypot(@selected.position.x - @current_point.x, @selected.position.y - @current_point.y)\n draw_force_circle(context, @selected.position, length)\n end\n\n # Rotation starting from left side, top implies clockwise, bottom anti-clockwise\n when :rotation\n if @current_point && @selected\n draw_rotate_circle(context, @selected.position, @current_point)\n else\n draw_static_rotate_circle(context, @selected.position)\n end\n\n when :create_new_toy\n if @current_point and @drag\n @selected.position = @current_point\n end\n end\n end", "def draw_advanced(rect, item)\n end", "def render args\n # When you're calling a method that takes no arguments, you can use this & syntax on map.\n # Numbers are being added to x and y in order to keep the text within the enemy's borders.\n args.outputs.borders << args.state.enemies.map(&:rect)\n args.outputs.labels << args.state.enemies.flat_map do |enemy|\n [\n [enemy.x + 4, enemy.y + 29, \"id: #{enemy.entity_id}\", -3, 0],\n [enemy.x + 4, enemy.y + 17, \"created_at: #{enemy.created_at}\", -3, 0] # frame enemy was created\n ]\n end\n\n # Outputs bullets in bullets collection as rectangular solids\n args.outputs.solids << args.state.bullets.map(&:rect)\nend", "def dessin(option)\n tex_file = PREAMBLE\n if (option == 'corrige')\n tex_file = \"\n \\\\begin{animateinline}[final,loop,controls,poster=last]{1}\n \\\\multiframe{8}{iCOUNT=00+01}{\n \" + tex_file\n end\n ## D'abord lentille ou miroir, convergent ou divergent\n tex_file += lentille_miroir\n ## Puis la position de l'objet\n if (option == 'corrige' or option == 'objet') and o.p.abs < 1000\n post_txt = ''\n if option == 'corrige' and o.reverse\n tex_file += '\\ifthenelse{\\iCOUNT > 6}{' #+ \"\\n\"\n post_txt = '}{}' + \"\\n\"\n end\n tex_file += \"\n \\\\draw [->,ultra thick] (#{o.p},0) node [#{below(o.AB)}] {$A$} -- (#{o.p},#{o.AB}) node [#{above(o.AB)}] {$B$} ;\n \" + post_txt\n end\n ## Celle de l'image\n if (option == 'corrige' or option == 'image') and o.pp.abs < 1000\n post_txt = ''\n if option == 'corrige' and not(o.reverse)\n tex_file += '\\ifthenelse{\\iCOUNT > 6}{' #+ \"\\n\"\n post_txt = '}{}' + \"\\n\"\n end\n tex_file += \"\n \\\\draw [->,ultra thick] (#{o.pp},0) node [#{below(o.ApBp)}] {$A'$} -- (#{o.pp},#{o.ApBp}) node [#{above(o.ApBp)}] {$B'$} ;\n \" + post_txt\n end\n ## Enfin le trace des rayons caracteristiques en mode \"corrige\"\n if (option == 'corrige')\n decalage = 0\n decalage+= 1 if o.reverse\n nb = 0\n ## D'abord pour les lentilles\n if o.lentille\n tex_file += \"% Le rayon qui arrive // a l'axe optique\\n\"\n tex_file += enrobage(rayon(o.p,o.AB,0,o.AB),nb+decalage)\n tex_file += \"% ... arrive en passant par le foyer image\\n\"\n tex_file += enrobage(rayon(0,o.AB,o.fp,0,'image'),nb+(decalage+1)%2)\n tex_file += \"% Le rayon qui passe par le centre optique\\n\"\n tex_file += enrobage(rayon(o.p,o.AB,0,0),nb+2+decalage)\n tex_file += \"% ... n'est pas devie\\n\"\n tex_file += enrobage(rayon(o.p,o.AB,0,0,'image'),nb+2+(decalage+1)%2)\n tex_file += \"% Le rayon qui passe par le foyer objet\\n\"\n tex_file += enrobage(rayon(o.p,o.AB,-o.fp,0),nb+4+decalage)\n tex_file += \"% ... ressort // a l'axe optique\\n\"\n tex_file += enrobage(rayon(0,o.ApBp,o.pp,o.ApBp,'image'),nb+4+(decalage+1)%2)\n else\n tex_file += \"% Le rayon qui passe par S\\n\"\n tex_file += rayon(o.p,o.AB,0,0)\n tex_file += \"% ... est \\\"non devie\\\"\\n\"\n tex_file += rayon(o.p,-o.AB,0,0,'miroir')\n tex_file += \"% Celui qui passe par C\\n\"\n tex_file += rayon(o.p,o.AB,-2*o.fp,0)\n tex_file += \"% ... revient sur lui-meme\\n\"\n tex_file += rayon(o.p,o.AB,-2*o.fp,0,'miroir')\n tex_file += \"% Celui qui arrive // a l'axe optique\\n\"\n tex_file += rayon(o.p,o.AB,0,o.AB)\n tex_file += \"% ... repart en passant par le foyer \\n\"\n tex_file += rayon(o.pp,o.ApBp,-o.fp,0,'miroir')\n tex_file += \"%Finalement, celui qui passe par le foyer revient // a l'axe optique\\n\"\n tex_file += rayon(o.p,o.AB,-o.fp,0)\n tex_file += rayon(o.pp,o.ApBp,0,o.ApBp,'miroir')\n end\n end\n tex_file += POSTAMBLE\n if option == 'corrige'\n tex_file += \"}\\n\\\\end{animateinline}\"\n end\n File.open(o.basename + '_' + option + '.tex','w') do |f|\n f.puts tex_file\n end\n end", "def create_effects\n @reflect_sprites = []\n return if not $game_map.use_reflection\n $game_map.events.values.each do |event|\n push_reflect(event.id, event)\n end\n i = 0\n $game_map.vehicles.each do |vehicle|\n id = [:vehicle, i]\n push_reflect(id, vehicle)\n i += 1\n end\n i = 0\n $game_player.followers.reverse_each do |follower|\n id = [:follower, i]\n push_reflect(id, follower)\n i += 1\n end\n push_reflect(0, $game_player)\n end", "def draw()\n if visible \n c1 = self.color1\n c2 = self.color2\n br_c1 = self.br_color1\n br_c2 = self.br_color2\n gradient = (c1 != c2)\n br_gradient = (br_c1 != br_c2)\n if !active\n if gradient\n c1 = Color.inactive_gauge_color1\n c2 = Color.inactive_gauge_color2\n else\n c1 = c2 = Color.gauge_back_color\n end\n \n if br_gradient\n br_c1 = Color.inactive_gauge_color1\n br_c2 = Color.inactive_gauge_color2\n else\n br_c1 = br_c2 = Color.normal_color\n end\n end\n \n if filled\n bitmap.draw_filled_ellipse(self.x, self.y, self.a, self.b, c1, c2)\n end\n \n if border > 0\n bitmap.draw_ellipse(self.x, self.y, self.a, self.b, br_c1, \n self.border, br_c2)\n end\n \n end\n end", "def refresh(actor)\n self.contents.clear\n f_x = Summon_Show_Face ? 124 : 0\n draw_actor_battle_face(actor, 0, 112) if Summon_Show_Face\n draw_actor_name(actor, 4 + f_x, 0)\n draw_actor_level(actor, 4 + f_x, 32)\n draw_actor_state(actor, 136 + f_x, 0)\n draw_actor_hp(actor, 88 + f_x, 32, 172)\n draw_actor_sp(actor, 88 + f_x, 64, 172)\n self.contents.font.size = 16\n self.contents.font.bold = true\n x, y = 24 , 204\n y_adjust = Damage_Algorithm_Type == 2 ? -56 : 4\n draw_actor_parameter(actor, x, y + (20 * 0), 0) unless Damage_Algorithm_Type == 2\n draw_actor_parameter(actor, x, y + (20 * 1), 1) unless Damage_Algorithm_Type == 2\n draw_actor_parameter(actor, x, y + (20 * 2), 2) unless Damage_Algorithm_Type == 2\n draw_actor_parameter(actor, x, y + (20 * 3), 7) unless Damage_Algorithm_Type == 2\n draw_actor_parameter(actor, x, y + y_adjust + (20 * 4), 3)\n draw_actor_parameter(actor, x, y + y_adjust + (20 * 5), 4)\n draw_actor_parameter(actor, x, y + y_adjust + (20 * 6), 5)\n draw_actor_parameter(actor, x, y + y_adjust + (20 * 7), 6)\n self.contents.font.color = system_color\n self.contents.draw_text(212, 96, 80, 32, 'EXP')\n self.contents.draw_text(212, 118, 80, 32, 'Próximo')\n self.contents.font.color = normal_color\n self.contents.draw_text(288, 96, 84, 32, actor.exp_s, 2)\n self.contents.draw_text(288, 118, 84, 32, actor.next_rest_exp_s, 2)\n draw_element_resist(actor, Summon_Status_Element_Position)\n self.contents.font.size = Font.default_size\n self.contents.font.bold = false\n self.contents.font.color = normal_color\n end" ]
[ "0.668308", "0.6274185", "0.6200668", "0.60736775", "0.60326445", "0.58870655", "0.5825537", "0.5759413", "0.5726432", "0.5726432", "0.5723914", "0.57106555", "0.56994885", "0.56796443", "0.5664836", "0.5664836", "0.5603734", "0.5565876", "0.5558513", "0.55577177", "0.5539715", "0.55353653", "0.5524343", "0.55189794", "0.5518899", "0.55147874", "0.5498245", "0.5480084", "0.5475512", "0.5470784", "0.54428494", "0.54377747", "0.5421561", "0.5413217", "0.5411528", "0.541145", "0.5401357", "0.5399187", "0.5391206", "0.5389328", "0.53794897", "0.5372972", "0.537261", "0.53711885", "0.53695875", "0.53605664", "0.5348008", "0.5344713", "0.5337266", "0.5336904", "0.5330153", "0.5313885", "0.531017", "0.53097606", "0.52947307", "0.5294591", "0.52933013", "0.52929044", "0.5284712", "0.52838", "0.5276528", "0.5261395", "0.5253484", "0.5245584", "0.52455306", "0.5244957", "0.52416766", "0.52385354", "0.52379495", "0.5237448", "0.5235388", "0.52251786", "0.5223493", "0.522152", "0.5220938", "0.52157104", "0.5213345", "0.5212578", "0.52113634", "0.520895", "0.52004963", "0.5192265", "0.5189393", "0.5186955", "0.5186279", "0.5183962", "0.5183898", "0.5183898", "0.5183898", "0.5183898", "0.5182181", "0.5182081", "0.5182081", "0.5178858", "0.5174796", "0.5173033", "0.5165165", "0.5165111", "0.5164224", "0.51639694" ]
0.7037201
0
If Esc button is pressed close the game
def button_down(id) if id == Gosu::KB_ESCAPE close else super end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close_game\n show\n Ncurses.mvaddstr(MAXY - 1, 0, 'Press any key to exit')\n Ncurses.getch\n Ncurses.curs_set(1)\n Ncurses.endwin\n end", "def game_exit\n Message.game_quit\n false\n end", "def button_up(key)\n self.close if key == Gosu::KbEscape\n end", "def button_down(id)\r\n if id == Gosu::KB_ESCAPE\r\n close\r\n else\r\n super\r\n end\r\n end", "def button_down(id)\n if id == Gosu::Button::KbEscape\n close\n end\n end", "def mouse_quit\n $game_system.se_play($data_system.cancel_se)\n if display_message(ext_text(8997, 40), 1, ext_text(8997, 33), ext_text(8997, 34)) == 0\n @return_data = false\n @running = false\n end\n end", "def mouse_quit\n $game_system.se_play($data_system.cancel_se)\n if display_message(ext_text(8997, 42), 1, ext_text(8997, 33), ext_text(8997, 34)) == 0\n @return_data = false\n @running = false\n end\n end", "def quit_command()\n @subSceneScan.hide_windows()\n @target_enemy_window.active = true\n end", "def close_game\r\n $window.close\r\n end", "def actions_when_game_is_lost\n puts \"\"\n puts \"GAME OVER\".red\n self.quit_game = true\n end", "def quit\n Rubygame.quit()\n exit\n end", "def keyPressed(key, x, y)\n\n # If escape is pressed, kill everything. \n if (key == 27) \n # shut down our window \n glutDestroyWindow(@window)\n # exit the program...normal termination.\n exit(0) \n end\nend", "def end_game\n\t\tputs \"Goodbye!\"\n\t\texit\n\tend", "def exit_game\n print clear_screen, \"\\n\"\n print \"\\\"What business is it of yours where I'm from, friendo?\\\"\", \"\\n\"\n print '-- Anton Chigurh : No Country for Old Men', \"\\n\\n\"\n throw :exit\n end", "def button_down(id)\r\n case id\r\n when Gosu::KbEscape\r\n close\r\n end\r\n end", "def exit_game_reviews\n system('clear')\n graphic_thanks\n graphic_bottom\n print \"\\n\" + \" \" * 40 + \"Press any key to continue... \"\n STDIN.getch\n puts \"\"\n system('clear')\n exit\nend", "def end_game\r\n @game_over = true\r\n end", "def check_forced_close\n return if @esc_counter > 0 or !open?\n if Input.legacy_trigger?(:B)\n Sound.play_cancel\n close\n end\n end", "def end_game\n\n end", "def close\n @graphic.ungetch(?q.ord)\n end", "def end_of_game\n\t\tputs \"\"\n\t\tputs \"Would you like to play again? [Y]es or [N]o\"\n\t\tinput = gets.chomp.upcase\n\t\tif input == 'Y'\n\t\t\tclear_screen\n\t\t\tinitialize\n\t\telsif input == 'N'\n\t\t\tabort(\">Exiting game<\")\n\t\telse\n\t\t\terror\n\t\t\tend_of_game\n\t\tend\n\tend", "def exit\n @window.pause = true\n @window.close\n end", "def handle_keys\n exit if SDL::Key.press? SDL::Key::ESCAPE\n exit if SDL::Key.press? SDL::Key::Q\n self.paused = !paused if SDL::Key.press? SDL::Key::P\n end", "def end_game\n end", "def button_down(id)\n\t\tcase id\n\t\twhen Gosu::KbEscape\n\t\t\tclose\n\t\tend\n\tend", "def end_game\n @game_run = false\n puts \"Game Over\"\n puts\n end", "def end\n\t\tputs \"----- GAME OVER -----\"\n\t\tputs \"Good bye!\"\n\tend", "def button_down(id)\n case id\n when Gosu::KbEscape\n exit\n end\n end", "def close\r\n pop_game_state\r\n end", "def quit_screen\n system \"clear\"\n d = Artii::Base.new\n # puts\n puts \"--------------------------- HASTALA VISTA ---------------------------\"\n puts\n puts d.asciify(\" GAME OVER !\")\n puts \"------------------------ PRESS ANY KEY TO QUIT --------------------------\"\n STDIN.getch\n print \" \\r\" # extra space to overwrite in case next sentence is short\nend", "def leave!\n @interact=false\n end", "def leave!\n @interact=false\n end", "def end_game\n puts \"Merci, Aur revoir\"\n end", "def quit\n Gamework::App.quit\n end", "def quit_command()\n return_scene\n end", "def quit_command()\n return_scene\n end", "def end?\n\t\twin?(\"x\") || win?(\"o\") || @board.count(\"-\") == 0\n\tend", "def input_esc\n return :exit\n end", "def input_esc\r\n return :exit\r\n end", "def quit_command()\n @command_window.active = false\n $scene = Scene_Menu.new(3)\n end", "def exit_game\n puts \"Goodbye!\"\nend", "def end_rune_selection\n @rune_stack_window.hide\n @rune_window.hide\n #@rune_stack_window = nil\n #@rune_window.help_window = nil\n #@rune_window.dispose\n #@rune_window = nil\n @help_window.hide\n end", "def quitGame ()\n\nend", "def ui_close\n\t\t\t\t#puts \"CursesApp->ui_close\"\n\t\t\t\t\n\t\t\t\traise 'ui already closed' if @ui_closed\n\t\t\t\t@ui_closed = true\n\t\t\t\t\n\t\t\t\t# Curses.setpos(10, 0)\n\t\t\t\t# Curses.addstr('CLOSE ')\n\t\t\t\t# Curses.refresh\n\t\t\t\t# sleep(2)\n\t\t\t\t\n\t\t\t\tCurses.refresh\n\t\t\t\tCurses.stdscr.clear\n\t\t\t\tCurses.stdscr.refresh\n\t\t\t\tCurses.stdscr.close\n\t\t\t\tCurses.close_screen\n\t\t\tend", "def game_close\n @console_delegate.close\n end", "def end_game\n puts \"Thank to play my game. See you again.\"\n end", "def end_game\n\tprint_paragraph(\"You made it out alive and all before lunch.\\nCongratulations on your victory!\")\n\tputs \"Would you like to play again? (Y/N)\"\t\n\tplay_again = gets.chomp\n\tplay_again.downcase!\n\tif play_again == \"y\"\n\t\tgame_start\n\telse\n\t\texit\n\tend\nend", "def quit(player, input)\n \t\tunless input =~ /quit/i\n \t\t\tprint_line \"You must type the entire word 'quit' to quit.\\n\"\n \t \telse\n \t\t\tprint_line \"Until next time...\"\n \t\t\t$win.refresh\n \t\t\tsleep 3\n \t\t\t$win.close\n \t\t\texit\n \t\tend\n\tend", "def exit_game?\n puts \"Would you like to exit game or play again?\"\n decision = gets.chomp\n if decision.downcase == \"exit\"\n exit\n elsif decision.downcase == \"play again\"\n initialize\n end\n end", "def exit(state_manager, game)\n exiting = true\n end", "def quit\n @ui.close\n @player.close\n @logger.close\n exit\n end", "def quit\n @ui.close\n @player.close\n @logger.close\n exit\n end", "def button_down(id)\n if id == Gosu::KbEscape\n close\n end\n if id == Gosu::KbO && (not @twoplayer)\n @twoplayer = true\n @player.second_player_mode\n end\n if id == Gosu::KbR && @game_over\n @ball.reset\n @score.reset\n @game_over = false\n end\n end", "def check_key_delete\n return unless open?\n return if @closing\n if Input.legacy_press?(:B)\n @esc_counter += 1\n if @esc_counter >= 50\n @esc_counter = 0\n selection_ok(nil)\n end\n else\n @esc_counter = 0\n end\n end", "def handle_event event, n\n exit if SDL::Event::Quit === event\n end", "def exit?\n user_input == \"q\" || user_input == \"quit\"\n end", "def close\n @window.destroy if @window\n VER::stop_ncurses\n end", "def close!\n @controller.close! if @controller\n FFI::NCurses.endwin\n Process.exit!\n end", "def update\n\t\tif self.button_down?(Gosu::KbLeft)\n \t\tclose\n \tend\n end", "def onClose(sender, sel, event)\n $app.exit(0)\n end", "def onClose(sender, sel, event)\n $app.exit(0)\n end", "def command_cancel\r\n # Play decision SE\r\n $game_system.se_play($data_system.decision_se)\r\n # Switch to menu screen\r\n $scene = Scene_Menu.new(5)\r\n end", "def play_again?\r\n tab(4, \"Press 'y' to play again.\")\r\n tab(7, \"Press 'q' to quit.\", \"\\n\")\r\n @key = STDIN.getch\r\n end", "def command_shutdown\n Sound.play_decision\n RPG::BGM.fade(800)\n RPG::BGS.fade(800)\n RPG::ME.fade(800)\n $scene = nil\n end", "def exit_tent_house\n puts \"Are you sure you want to Exit [y/n]\"\n key_in = gets.chomp()\n\n if key_in.eql? \"y\"\n @db.close if @db\n\n puts \"Thanks for using 'Tent House Rental'\"\n puts \"Exiting...\"\n\n return\n else\n main\n end\n end", "def command_endgame\r\n # Switch to end game screen\r\n $scene = Scene_End.new\r\n end", "def check_ending(mark)\n return unless @game.result\n print_result\n key = @window.getch\n case key\n when ?Y,?y\n start_new_game(mark)\n when ?N,?n\n Kernel::exit\n else\n check_ending(mark)\n end\n @display.clear_status \n end", "def command_shutdown\r\n # Play decision SE\r\n $game_system.se_play($data_system.decision_se)\r\n # Fade out BGM, BGS, and ME\r\n Audio.bgm_fade(800)\r\n Audio.bgs_fade(800)\r\n Audio.me_fade(800)\r\n # Shutdown\r\n $scene = nil\r\n end", "def end_game\n if @guess_count == 0 && @blanks != @new_word\n puts \"The game is over, Better luck next time :(\"\n @is_over = true\n elsif @blanks == @new_word\n puts \"Congrats you guessed the secret word! :)\"\n @is_over = true\n end \n end", "def exit\n @interface.hide\n # sth to destroy all dat shit??\n # Shut down propeller\n end", "def exit\n\t\t\teditors.each do |ed|\n\t\t\t\tquit ed\n\t\t\tend\n\t\t\t@continue = false\n\t\tend", "def cancel?\n if Input.trigger?(Input::B)\n $scene = Scene_Map.new\n return true\n end\n return false\nend", "def end_game\n puts \"\\n\\n________ GAME OVER ________\"\n puts \"#{@active_player.name}, you've run out of lives.\\nYou're RIGHT DEAD.\\n\\n\"\n switch_player!\n puts \"#{@active_player.name}, you had #{@active_player.lives} #{(@active_player.lives) == 1 ? \"life\" : \"lives\"} remaining and survived for #{(@which_round / 2).to_i} rounds, which means YOU WIN!\\n... By which we mean, you didn't die.\\nRight now.\\n\\nGood...\\n\\n\\n\"\n end", "def exit\n \"Goodbye! Thanks for playing!\"\n end", "def displayEndgame\n \tputs \"\\e[#{SCREEN_Y+1};#{1}HGame over.\\e[#{SCREEN_Y+2};#{1}H\"\nend", "def exit_screen\n @games.pop\n end", "def button_up(id)\n Game.begin_game(@score) if id == Gosu::KbEscape or id == Gosu::KbReturn or Gosu::KbSpace\n end", "def end_of_the_game\n @display.throw(self)\n puts \"THIS IS THE END OF THE GAME\"\n puts ''\n if @current_board.boardcase_array.any? { |boardcase| boardcase.status == nil } == false\n puts 'I am afraid this a DRAW T_T'\n else\n puts \"Wow! #{@player_turn.name} you did win this one\"\n @player_turn == @player_one ? (@score_player_one += 1) : (@score_player_two += 1)\n end\n puts \"#{@player_one.name} :#{@score_player_one} victories\"\n puts \"#{@player_two.name} :#{@score_player_two} victories\"\n puts ''\n puts ''\n print \"DO YOU WANT TO TRY AGAIN? Y/n\"\n choice = gets.chomp\n exit unless choice == \"Y\"\n end", "def close\n return if closed?\n\n nocbreak\n close_screen\n end", "def setup_input\n set_keys(KbEscape => :close,\n KbF1 => [:toggle_text, false],\n KbF2 => [:debug!, false],\n KbF3 => [:pause!, false])\n end", "def exit_star\n stop_music\n abort(\"You're logged out\")\n end", "def ending_screen\n if @winner == @player1\n color = :red\n elsif @winner == @player2\n color = :blue\n else\n color = :green\n end\n puts\n puts \"The game is finished.\"\n if @winner.nil?\n puts \"The game is a draw!\".colorize(color)\n else\n puts \"#{@winner.name} wins the game!\".colorize(color)\n end\n puts\n puts \"Would you like to play again? (Y/N)\"\n print \">> \"\n response = gets.chomp\n reset_board if response.downcase == \"y\"\n end", "def end_game_message(message)\nsystem \"clear\"\nputs \"GAME OVER: #{ message }\"\nlaat_bord_zien\nend", "def key(k, x, y)\n case k\n when 27 # Escape\n exit\n end\n GLUT.PostRedisplay()\n end", "def dat_menu() \n game_states.size == 1 && exit #fires if this is the only gamestate\n Chingu::Text.create 'Now leaving :(', size: 48, x: 200, y: 200, color: Gosu::Color::RED\n after(500) { $window.pop_game_state(setup: false) }\n end", "def new_game\n @display = false\n @window.pause = false\n end", "def command_cancel\n Sound.play_decision\n return_scene\n end", "def close\n abort('Thanks for playing!')\n end", "def end_game\n\t\tputs \"Thank you for playing the Secret Number Game, #{@player}.\"\n\tend", "def return_to_main_Screen\n puts \"\\nAny key to return \"\n print \":>\"\n gets.chomp\n clear_screen\nend", "def cancel_attack\n @windows[Win_Status].clear_dmg_preview\n @cursor.active = true \n end", "def command(action)\n Hangman.save(self) if action == 'save'\n puts '', 'Do you want to leave this game? (y/n)'\n 'exit' if gets.chomp.downcase == 'y'\n end", "def leave(name)\n\t\tputs \"Thanks for playing #{name}, Come back soon!\"\n\t\tsleep(3)\n\t\tprint CLEAR\n\t\texit\n\tend", "def game_end\n if @board.win?\n puts \"\\nBravo ! #{@current_player.name} a gagné ! \"\n else\n puts \"\\nC'est une égalité !\"\n end\n @status = \"game end\"\n\n # Suggests another round\n puts \"Souhaitez-vous refaire une partie ? (o/n)\"\n choice = gets.chomp\n if choice == \"o\"\n new_round\n else\n puts \"A bientôt !\"\n end\n end", "def quit(msg)\n if @started\n msg.reply('Game exited.'.freeze)\n @started = false\n @random_number = nil\n @tries = nil\n else\n msg.reply('There is not game to exit.'.freeze)\n end\n end", "def onsig(sig)\n close_screen\n @exit = true\n end", "def exit_session\n @window.dispose\n @viewport.dispose\n ShellOptions.save\n end", "def play_again\n #forever loop to stay in the menu\n while true\n option = gets.upcase.strip\n case option\n #If the player wants to leave, go to the close method\n when 'Q'\n close\n #if the player wants to play again, clear the screen and reset the game state\n when 'P'\n system('cls')\n reset\n else\n puts ERRORMESSAGE + 'game option.'\n print 'Option:'\n end\n end\n end", "def exit\n stop\n $window.deleteAllWidgets\n $window.createWidgets\n $window.deleteAllImages\n $window.cursor.unforceVisible\n terminate\n end", "def end_game (player)\n if (player.life == 0)\n return false\n end\n return true\n end" ]
[ "0.78833276", "0.75391114", "0.7340862", "0.7240059", "0.72353995", "0.721801", "0.72051865", "0.7191426", "0.7140348", "0.7038638", "0.69708055", "0.69394565", "0.6912984", "0.69090235", "0.6904699", "0.68514955", "0.68308246", "0.67741644", "0.6753222", "0.67340505", "0.673117", "0.6726086", "0.668628", "0.6680287", "0.6644453", "0.6630074", "0.6624109", "0.6619255", "0.6618628", "0.65777516", "0.65647644", "0.65647644", "0.65512073", "0.65461123", "0.65456927", "0.65456927", "0.65326756", "0.6528199", "0.6514163", "0.6480878", "0.6475433", "0.64710927", "0.6469555", "0.6466443", "0.6447156", "0.6427155", "0.640533", "0.6394846", "0.63788515", "0.63337535", "0.63286394", "0.63286394", "0.63250715", "0.629898", "0.6297555", "0.62399364", "0.62260073", "0.6191007", "0.61681855", "0.6164921", "0.6164921", "0.6150107", "0.6147973", "0.61470485", "0.61392516", "0.6133877", "0.61242425", "0.61113685", "0.61043847", "0.61043376", "0.61003155", "0.60957974", "0.6094848", "0.60779595", "0.607682", "0.60609615", "0.60350055", "0.602813", "0.60163003", "0.60021716", "0.5998924", "0.5994427", "0.5992674", "0.59919316", "0.5978384", "0.5975276", "0.59722745", "0.5957617", "0.59555095", "0.59488356", "0.5947471", "0.5938235", "0.5936757", "0.59327453", "0.5920043", "0.5910471", "0.59046113", "0.58955884", "0.58909714", "0.58907664" ]
0.7326926
3
Procedure to place button on the screen
def place_button(x, y, message) Gosu.draw_rect(x, y, 70, 45, Gosu::Color::GREEN, ZOrder::MIDDLE, mode=:default) @button_font.draw_text(message, x+5, y+10, ZOrder::TOP, 1.0, 1.0, Gosu::Color::BLACK) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_the_button\n @theButton = UIButton.buttonWithType(UIButtonTypeRoundedRect)\n @theButton.setTitle('Refresh Weather!', forState:UIControlStateNormal)\n # @theButton.setTitleColor(BW.rgb_color(255, 255, 255), forState:UIControlStateNormal)\n @theButton.backgroundColor = BW.rgb_color(255, 255, 255)\n # @theButton.layer.borderColor = BW.rgb_color(255, 255, 255)\n # @theButton.layer.borderWidth = 0.5\n @theButton.layer.cornerRadius = 10\n @theButton.frame = [[center_h(200), (@view_height - 200)], [200,50]] #[[x-axis, y-axis], [width, height]]\n # @theButton.setTitle('Stop', forState:UIControlStateSelected)\n\n # Add an event for the button when touched\n # 'self' refers to the handler class for the action in which the callback is defined\n # buttonClicked is the method that will be called when the event happens\n # forControlEvents will take the event name\n @theButton.addTarget(self, action:'buttonClicked', forControlEvents:UIControlEventTouchUpInside)\n\n self.view.addSubview(@theButton)\n end", "def buttons; end", "def btn_area_first\n\n\t\t@layer_btns = HBox.new( true, 0 )\n\t\t@layer_btns.set_size_request( 800 , 40 )\n\n\t\t@btn_sintrom = Button.new(\"Sintrom\")\n\t\t@btn_sintrom.set_size_request( 100, 40 )\n\t\t@btn_sintrom.signal_connect( \"clicked\" ) do\n\t\t\tmain_area_sintrom\n\t\tend\n\t\t@btn_agenda = Button.new(\"Agenda\")\n\t\t@btn_agenda.set_size_request( 100, 40 )\n\t\t@btn_agenda.signal_connect( \"clicked\" ) do\n\t\t\ton_exit\n\t\tend\n\t\t@btn_bdays = Button.new(\"Cumpleaños\")\n\t\t@btn_bdays.set_size_request( 100, 40 )\n\t\t@btn_bdays.signal_connect( \"clicked\" ) do\n\t\t\ton_exit\n\t\tend\n\t\t@btn_shifts = Button.new(\"Turnos\")\n\t\t@btn_shifts.set_size_request( 100, 40 )\n\t\t@btn_shifts.signal_connect( \"clicked\" ) do\n\t\t\ton_exit\n\t\tend\n\t\t@btn_exit = Button.new(\"Exit\")\n\t\t@btn_exit.set_size_request( 100, 40 )\n\t\t@btn_exit.signal_connect( \"clicked\" ) do\n\t\t\ton_exit\n\t\tend\n\n\t\t@layer_btns.add( @btn_sintrom )\n\t\t@layer_btns.add( @btn_agenda )\n\t\t@layer_btns.add( @btn_bdays )\n\t\t@layer_btns.add( @btn_shifts )\n\t\t@layer_btns.add( @btn_exit )\n\n\t\t@layer_general.put( @layer_btns, 0, 760 )\n\n\tend", "def create_start_button(x, y)\n\t\tbutton = Button.new(@window, \n\t\t\t\t\t\t\t@window.user_messages.message(:start), \n\t\t\t\t\t\t\tConstants::BT_TEXT_HEIGHT,\n\t\t\t\t\t\t\tConstants::FONT_NAME)\n\n\t\tbutton.add_callback(:release, lambda do\n\t\t\treturn if !ready_to_start?\n\n\t\t\tplayers = entries_to_players\n\t\t\tfactory = GameFactory.new(GameControllerFactory.new)\n\t\t\tgame_over = create_game_over_callable\n\t\t\t@window.state = factory.create_game(@window, game_over, *players)\n\t\tend)\n\n\t\tbutton.x = x\n\t\tbutton.y = y\n\t\tbutton\n\tend", "def hc_modal_button\n @hc_modal_button ||= button(\n :frame => [264, 12, 100, 28],\n :bezel => :textured_square, \n :layout => {:start => false})\n end", "def draw\n # Draw background color\n Gosu.draw_rect(0, 0, WIN_WIDTH, WIN_HEIGHT, @background, ZOrder::BACKGROUND, mode=:default)\n # Draw the button\n Gosu.draw_rect(50, 50, 100, 50, Gosu::Color::GREEN, ZOrder::MIDDLE, mode=:default)\n # Draw the button text\n @button_font.draw(\"Click me\", 65, 65, ZOrder::TOP, 1.0, 1.0, Gosu::Color::BLACK)\n # Draw the mouse position information\n @info_font.draw(\"mouse_x: #{@locs[0]}\", 0, 350, ZOrder::TOP, 1.0, 1.0, Gosu::Color::BLACK)\n end", "def add_buttons\n @p_button = Chingu::Rect.new(510,5,20,20)\n Chingu::Text.create(:text=>\"p\",:x=>513,:y=>5,:factor_x =>1.5)\n @m_button = Chingu::Rect.new(540,5,20,20)\n Chingu::Text.create(:text=>\"m\",:x=>540,:y=>5,:factor_x =>1.5)\n @o_button = Chingu::Rect.new(570,5,20,20)\n Chingu::Text.create(:text=>\"o\",:x=>575,:y=>5,:factor_x =>1.5)\n @save_button = Chingu::Rect.new(5,5,45,20)\n Chingu::Text.create(:text=>\"save\",:x=>5,:y=>5,:factor_x =>1.5)\n @load_button = Chingu::Rect.new(60,5,45,20)\n Chingu::Text.create(:text=>\"load\",:x=>65,:y=>5,:factor_x =>1.5)\n end", "def on_button_up(button_id, point)\n end", "def button_up(id); end", "def create_back_button(x, y)\n\t\tbutton = Button.new(@window, \n\t\t\t\t\t\t\t@window.user_messages.message(:back), \n\t\t\t\t\t\t\tConstants::BT_TEXT_HEIGHT,\n\t\t\t\t\t\t\tConstants::FONT_NAME)\n\t\tbutton.add_callback(:release, lambda {@main.current_menu = @parent})\n\t\tbutton.x = x\n\t\tbutton.y = y\n\t\tbutton\n\tend", "def new_button_prefab x, y, message\n w, h = 300, 50\n button = state.new_entity(:button_with_fade)\n button.label = [x + w.half, y + h.half + 10, message, 0, 1] # '+ 10' keeps label's text within button's borders\n button.border = [x, y, w, h] # sets border definition\n button\n end", "def button_up(id)\r\n $scene.button_up(id)\r\n end", "def _button_4_command(*args)\n\n end", "def on_button(b, evnt, coords)\n #puts \"B#{b} #{evnt}, #{coords}\"\n end", "def show\n @sel.visible = false\n @typeInd.visible = false\n @background.y -= (@background.bitmap.height/8)\n for i in 0...@nummoves\n @button[\"#{i}\"].x += ((i%2 == 0 ? 1 : -1)*@viewport.width/16)\n end\n end", "def button_up(id)\n\n end", "def add_button(window, id, x, y, width, height, **args)\n window_exist?(window)\n button = Button.new(\n self,\n find_window(window),\n id,\n x,\n y,\n width,\n height,\n **args\n )\n @windows[window].add_widget(id, button)\n end", "def render_button\n NfgUi::Components::Elements::Button.new({ **integrated_slat_action_button_component_options, body: (block_given? ? yield : body) }, view_context).render\n end", "def tick_button_prefab button\n outputs.labels << button.label # outputs button's label and border\n outputs.borders << button.border\n\n if button_clicked? button # if button is clicked\n button.clicked_at = inputs.mouse.click.created_at # stores the time that the button was clicked\n end\n\n if button.clicked_at # if clicked_at has a frame value and is not nil\n # button is output; color changes and transparency changes for 0.25 seconds after click occurs\n outputs.solids << [button.border.x, button.border.y, button.border.w, button.border.h,\n 0, 180, 80, 255 * button.clicked_at.ease(0.25.seconds, :flip)] # transparency changes for 0.25 seconds\n end\n end", "def create\r\n super # Create the windows\r\n show(PLACEMENT_SCREEN) # Make the main window appear\r\n end", "def button_up(id)\n end", "def push_button(floor)\n\t\t@buttons[floor] = true\n\tend", "def create\n\t\tsuper\n\t\tshow(PLACEMENT_SCREEN)\n\tend", "def _button_2_command(*args)\n\n end", "def _button_2_command(*args)\n\n end", "def loadView # preferable to viewDidLoad because not using xib\n action_over_view = UIView.alloc.init\n self.view = action_over_view\n self.view.alpha = 0.0\n location_of_action = [95, 0]\n size_of_action = [@bounds.size.width - 190, @bounds.size.height]\n @button_toys = {}\n setup_sides\n @main_view = @scene_creator_view_controller.main_view\n show_sides\n end", "def create\n super\n show(PLACEMENT_SCREEN)\n end", "def main_window\r\n super\r\n # Make command window\r\n s1 = \"To Title\"\r\n s2 = \"Shutdown\"\r\n s3 = \"Cancel\"\r\n @command_window = Window_Command.new(192, [s1, s2, s3])\r\n @command_window.x = 320 - @command_window.width / 2\r\n @command_window.y = 240 - @command_window.height / 2\r\n end", "def add_button_clicked\n\t\t\n\t\t\t# Eventually create browse form\n\t\t\tcreate_browse_form\n\t\t\n\t\t\t# Show and activate the child window\n\t\t\tshow_browse_form\n\t\tend", "def click; end", "def click; end", "def click; end", "def _button_3_command(*args)\n\n end", "def main_window\r\n super\r\n # Make command window\r\n s1 = SDK::Scene_Commands::Scene_End::To_Title\r\n s2 = SDK::Scene_Commands::Scene_End::Shutdown\r\n s3 = SDK::Scene_Commands::Scene_End::Cancel\r\n @command_window = Window_Command.new(192, [s1, s2, s3])\r\n @command_window.x = 320 - @command_window.width / 2\r\n @command_window.y = 240 - @command_window.height / 2\r\n end", "def create\n super\n show(PLACEMENT_SCREEN)\n end", "def draw\r\n @background_image.bmp.draw(0, 0, ZOrder::BACKGROUND)\r\n @function_UI.place_button((SCREEN_WIDTH/3) + 100, 300, \"Start!\")\r\n @function_UI.big_font.draw_text(\"SPACE WAR\", @function_UI.pos- 120, 30, ZOrder::TOP, 1.0, 1.0, Gosu::Color::YELLOW)\r\n @function_UI.big_font.draw_text(\"Instructions: \", @function_UI.pos-100, 100, ZOrder::TOP, 1.0, 1.0, Gosu::Color::RED)\r\n @function_UI.font.draw_text(\"# Press SPACE BAR to fire bullets\", @function_UI.pos-180, 140, ZOrder::TOP, 1.0, 1.0, Gosu::Color::YELLOW)\r\n @function_UI.font.draw_text(\"# Use the ARROW KEYS to navigate the Spaceship\", @function_UI.pos-180, 180, ZOrder::TOP, 1.0, 1.0, Gosu::Color::YELLOW)\r\n @function_UI.font.draw_text(\"# You have 3 Life Lines\", @function_UI.pos-180, 220, ZOrder::TOP, 1.0, 1.0, Gosu::Color::YELLOW)\r\n @function_UI.font.draw_text(\"# Press ESC to leave the Game\", @function_UI.pos-180, 260, ZOrder::TOP, 1.0, 1.0, Gosu::Color::YELLOW)\r\n draw_border((SCREEN_WIDTH/3) + 105, 305)\r\n end", "def how_to_create_buttons args\n # Define a button style\n args.state.button_style = { w: 82, h: 10, }\n\n # Render instructions\n args.state.button_message ||= \"Press a Button!\"\n args.nokia.labels << args.nokia\n .default_label\n .merge(x: 42,\n y: 82,\n text: args.state.button_message,\n alignment_enum: 1)\n\n\n # Creates button one using a border and a label\n args.state.button_one_border = args.state.button_style.merge( x: 1, y: 32)\n args.nokia.borders << args.state.button_one_border\n args.nokia.labels << args.nokia\n .default_label\n .merge(x: args.state.button_one_border.x + 2,\n y: args.state.button_one_border.y + NOKIA_FONT_SM_HEIGHT + 2,\n text: \"Button One\")\n\n # Creates button two using a border and a label\n args.state.button_two_border = args.state.button_style.merge( x: 1, y: 20)\n\n args.nokia.borders << args.state.button_two_border\n args.nokia.labels << args.nokia\n .default_label\n .merge(x: args.state.button_two_border.x + 2,\n y: args.state.button_two_border.y + NOKIA_FONT_SM_HEIGHT + 2,\n text: \"Button Two\")\n\n # Initialize the state variable that tracks which button was clicked to \"\" (empty stringI\n args.state.last_button_clicked ||= \"--\"\n\n # If a click occurs, check to see if either button one, or button two was clicked\n # using the inside_rect? method of the mouse\n # set args.state.last_button_clicked accordingly\n if args.nokia.mouse_click\n if args.nokia.mouse_click.inside_rect? args.state.button_one_border\n args.state.last_button_clicked = \"One Clicked!\"\n elsif args.nokia.mouse_click.inside_rect? args.state.button_two_border\n args.state.last_button_clicked = \"Two Clicked!\"\n else\n args.state.last_button_clicked = \"--\"\n end\n end\n\n # Render the current value of args.state.last_button_clicked\n args.nokia.labels << args.nokia\n .default_label\n .merge(x: 42,\n y: 5,\n text: args.state.last_button_clicked,\n alignment_enum: 1)\nend", "def draw\n @font_small.draw_rel(\"Made by\", StartX, StartY, ZOrder::UI, 0.5, 0.5)\n @font_credits.draw_rel(\"Annie Dang\", StartX, StartY + 30, ZOrder::UI, 0.5, 0.5)\n @font_small.draw_rel(\"A Student Of Swinburne University\", StartX, StartY + 60, ZOrder::UI, 0.5, 0.5, 1, 1, 0xfff4cc00)\n @font_small.draw_rel(\"Who always loves to make people laugh\", StartX, StartY + 90, ZOrder::UI, 0.5, 0.5, 1, 1, 0xfff4cc00)\n \n @button.draw\n end", "def setup_gui\n x = x_for_anchor(@anchor).to_i\n y = y_for_anchor(@anchor).to_i\n translate_to(x,y)\n end", "def create\n super\n show PLACEMENT_SCREEN\n end", "def button_down; end", "def create\n super\n show(PLACEMENT_SCREEN)\n end", "def button(&button_proc)\n @buttons << button_proc\n end", "def button\n @edit = session[:edit] # Restore @edit for adv search box\n @refresh_div = \"main_div\" # Default div for button.rjs to refresh\n\n unless @refresh_partial # if no button handler ran, show not implemented msg\n add_flash(_(\"Button not yet implemented\"), :error)\n @refresh_partial = \"layouts/flash_msg\"\n @refresh_div = \"flash_msg_div\"\n end\n end", "def button\n @edit = session[:edit] # Restore @edit for adv search box\n\n params[:display] = @display if [\"instances\"].include?(@display) # Were we displaying vms/hosts/storages\n params[:page] = @current_page if @current_page.nil? # Save current page for list refresh\n\n if params[:pressed] == \"custom_button\"\n custom_buttons\n return\n end\n\n if params[:pressed].starts_with?(\"instance_\") # Handle buttons from sub-items screen\n pfx = pfx_for_vm_button_pressed(params[:pressed])\n process_vm_buttons(pfx)\n\n # Control transferred to another screen, so return\n return if [\"#{pfx}_policy_sim\", \"#{pfx}_compare\", \"#{pfx}_tag\",\n \"#{pfx}_retire\", \"#{pfx}_protect\", \"#{pfx}_ownership\",\n \"#{pfx}_refresh\", \"#{pfx}_right_size\",\n \"#{pfx}_reconfigure\"].include?(params[:pressed]) &&\n @flash_array.nil?\n\n unless [\"#{pfx}_edit\", \"#{pfx}_miq_request_new\", \"#{pfx}_clone\",\n \"#{pfx}_migrate\", \"#{pfx}_publish\"].include?(params[:pressed])\n @refresh_div = \"main_div\"\n @refresh_partial = \"layouts/gtl\"\n show # Handle VMs buttons\n end\n elsif params[:pressed] == \"make_ot_orderable\"\n make_ot_orderable\n return\n elsif params[:pressed] == \"orchestration_template_copy\"\n orchestration_template_copy\n return\n elsif params[:pressed] == \"orchestration_templates_view\"\n orchestration_templates_view\n return\n else\n params[:page] = @current_page if @current_page.nil? # Save current page for list refresh\n @refresh_div = \"main_div\" # Default div for button.rjs to refresh\n case params[:pressed]\n when \"orchestration_stack_delete\"\n orchestration_stack_delete\n when \"orchestration_stack_retire\"\n orchestration_stack_retire\n when \"orchestration_stack_retire_now\"\n orchestration_stack_retire_now\n return\n when \"orchestration_stack_tag\"\n tag(OrchestrationStack)\n when params[:pressed] == \"custom_button\"\n custom_buttons\n return\n end\n return if %w[orchestration_stack_retire orchestration_stack_tag].include?(params[:pressed]) &&\n @flash_array.nil? # Tag screen showing, so return\n end\n\n check_if_button_is_implemented\n\n if single_delete_test\n single_delete_redirect\n elsif params[:pressed].ends_with?(\"_edit\") || [\"#{pfx}_miq_request_new\", \"#{pfx}_clone\",\n \"#{pfx}_migrate\", \"#{pfx}_publish\"].include?(params[:pressed])\n render_or_redirect_partial(pfx)\n elsif @refresh_div == \"main_div\" && @lastaction == \"show_list\"\n replace_gtl_main_div\n else\n render_flash unless performed?\n end\n end", "def click(id)\n\t\t\th = child(id).handle\n\t\t\t\n\t\t\trectangle = [0, 0, 0, 0].pack 'LLLL'\n\t\t\tget_window_rect h, rectangle\n\t\t\tleft, top, right, bottom = rectangle.unpack 'LLLL'\n\t\t\t\n\t\t\tcenter = [(left + right) / 2, (top + bottom) / 2]\n\t\t\tset_cursor_pos *center\n\t\t\t\n\t\t\tmouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0\n\t\t\tmouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0\n\t\tend", "def create_command_window\n end", "def create_button_up(cache_up_bmp)\n @button_up_sprite = push 0, 0, nil\n @button_up_sprite.set_bitmap(cache_up_bmp).set_rect_div(0, 0, 1, 2)\n end", "def add_button_to_query(button); end", "def on_button_down(button_id, point)\n end", "def create\n super\n show(PLACEMENT_SCREEN)\n end", "def place_command_proceed\n @robot.place(@x_position.to_i, @y_position.to_i, @vector.to_s.strip)\n end", "def main_window\r\n super\r\n # Make command window\r\n s1 = \"New Game\"\r\n s2 = \"Continue\"\r\n s3 = \"Shutdown\"\r\n @command_window = Window_Command.new(192, [s1, s2, s3])\r\n @command_window.back_opacity = 160\r\n @command_window.x = 320 - @command_window.width / 2\r\n @command_window.y = 288\r\n # If continue is enabled, move cursor to \"Continue\"\r\n # If disabled, display \"Continue\" text in gray\r\n if @continue_enabled\r\n @command_window.index = 1\r\n else\r\n @command_window.disable_item(1)\r\n end\r\n end", "def click\r\n start_point = screen.find ident\r\n click_x = start_point.x + offset_x\r\n click_y = start_point.y + offset_y\r\n\r\n screen.click click_x, click_y\r\n end", "def button_down_main_menu_presenter(id, window, state)\n case id\n when Gosu::MsLeft\n navigate_to(window, Presenter::HOW_TO_PRESENTER) if mouse_over_button(state[:buttons][:how_to], window.mouse_x, window.mouse_y)\n navigate_to(window, Presenter::MAZE_PRESENTER, { algorithm: MazeAlgorithm::DEPTH_FIRST}) if mouse_over_button(state[:buttons][:depth_first], window.mouse_x, window.mouse_y)\n navigate_to(window, Presenter::MAZE_PRESENTER, { algorithm: MazeAlgorithm::ITERATIVE_DIVISION}) if mouse_over_button(state[:buttons][:iterative_division], window.mouse_x, window.mouse_y)\n window.close if mouse_over_button(state[:buttons][:quit], window.mouse_x, window.mouse_y)\n end\nend", "def main_window\r\n super\r\n # Make command window\r\n s1 = SDK::Scene_Commands::Scene_Title::New_Game\r\n s2 = SDK::Scene_Commands::Scene_Title::Continue\r\n s3 = SDK::Scene_Commands::Scene_Title::Shutdown\r\n @command_window = Window_Command.new(192, [s1, s2, s3])\r\n @command_window.back_opacity = 160\r\n @command_window.x = 320 - @command_window.width / 2\r\n @command_window.y = 288\r\n # If continue is enabled, move cursor to \"Continue\"\r\n # If disabled, display \"Continue\" text in gray\r\n if @continue_enabled\r\n @command_window.index = 1\r\n else\r\n @command_window.disable_item(1)\r\n end\r\n end", "def init_vars\n self.resize(200,250)\n @new_btn = Gtk::Button.new('')\n @default_size_btn = Gtk::Button.new('')\n @quit_btn = Gtk::Button.new('')\n end", "def touch_alert_button_by_position(position)\n touch query(\"AppCompatButton id:'button#{position}'\")\nend", "def button\n @refresh_div = \"main_div\" # Default div for button.rjs to refresh\n timeprofile_delete if params[:pressed] == \"tp_delete\"\n copy_record if params[:pressed] == \"tp_copy\"\n edit_record if params[:pressed] == \"tp_edit\"\n\n if !@refresh_partial && @flash_array.nil? # if no button handler ran, show not implemented msg\n add_flash(_(\"Button not yet implemented\"), :error)\n @refresh_partial = \"layouts/flash_msg\"\n @refresh_div = \"flash_msg_div\"\n end\n\n if params[:pressed].ends_with?(\"_edit\", \"_copy\")\n javascript_redirect(:action => @refresh_partial, :id => @redirect_id)\n else\n build_tabs\n render :update do |page|\n page << javascript_prologue\n page.replace(\"flash_msg_div\", :partial => \"layouts/flash_msg\")\n page << \"miqScrollTop();\" if @flash_array.present?\n page.replace_html(\"main_div\", :partial => \"ui_4\") # Replace the main div area contents\n page << javascript_reload_toolbars\n end\n end\n end", "def click_button(button = T.unsafe(nil)); end", "def mgs_hops_confirm_button\n $tracer.trace(__method__)\n return ToolTag.new(div.id(\"finish_button\"), __method__, self)\n\tend", "def draw\r\n @background_image.bmp.draw(0, 0, ZOrder::BACKGROUND)\r\n @function_UI.place_button((SCREEN_WIDTH/3) + 100, 300, \"Close\")\r\n draw_border((SCREEN_WIDTH/3) + 105, 305, mouse_x, mouse_y)\r\n @function_UI.big_font.draw_text(\"GAME OVER!\", @function_UI.pos- 120, 30, ZOrder::TOP, 1.0, 1.0, Gosu::Color::YELLOW)\r\n @score_font.draw_text(\"Your Score: #{@score}\", @function_UI.pos-100, 200, ZOrder::TOP, 1.0, 1.0, Gosu::Color::YELLOW)\r\n @score_font.draw_text(\"Time of Game PLay: #{@game_play_time} Seconds\", @function_UI.pos-140, 100, ZOrder::TOP, 1.0, 1.0, Gosu::Color::YELLOW)\r\n end", "def click(*args)\n\t\t\t# if no argument has been provided, click on the\n\t\t\t# window itself\n\t\t\th = (args.length == 0) ? @handle : child(args[0]).handle\n\t\t\t\n\t\t\trectangle = [0, 0, 0, 0].pack 'LLLL'\n\t\t\tget_window_rect h, rectangle\n\t\t\tleft, top, right, bottom = rectangle.unpack 'LLLL'\n\t\t\t\n\t\t\tcenter = [(left + right) / 2, (top + bottom) / 2]\n\t\t\tset_cursor_pos *center\n\t\t\t\n\t\t\tmouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0\n\t\t\tmouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0\n\t\tend", "def create_extra_buttons()\n Rectangle.new(x:5,y:50,width:40,height:40,color:\"white\",z:1)\n Rectangle.new(x:16,y:66,width:18,height:9,color:\"#ff7eec\",z:1)\n Rectangle.new(x:5,y:100,width:40,height:40,color:\"white\",z:1)\n Rectangle.new(x:14,y:110,width:21,height:25,color:'#808080',z:1)\n Rectangle.new(x:14,y:110,width:21,height:5,color:'blue',z:1)\n Rectangle.new(x:5,y:150,width:40,height:40,color:\"white\",z:1)\n Triangle.new(x1:15,x2:35,x3:25,y1:180,y2:180,y3:160,color:\"black\",z:1)\n Rectangle.new(x:5,y:200,width:40,height:40,color:\"white\",z:1)\n Triangle.new(x1:15,x2:35,x3:25,y1:210,y2:210,y3:230,color:\"black\",z:1)\nend", "def question_otto_button_click\n MenuControllerContracts.invariant(self)\n @alert_view = @help_view = Views::OttoInstructionsAlertView.new(@window, self)\n MenuControllerContracts.invariant(self)\n end", "def button_tech_demo\n x, y, w, h = 460, 160, 300, 50\n state.button ||= state.new_entity(:button_with_fade)\n\n # Adds w.half to x and h.half + 10 to y in order to display the text inside the button's borders.\n state.button.label ||= [x + w.half, y + h.half + 10, \"click me and watch me fade\", 0, 1]\n state.button.border ||= [x, y, w, h]\n\n if inputs.mouse.click && inputs.mouse.click.point.inside_rect?(state.button.border) # if mouse is clicked, and clicked inside button's border\n state.button.clicked_at = inputs.mouse.click.created_at # stores the time the click occurred\n end\n\n outputs.labels << state.button.label\n outputs.borders << state.button.border\n\n if state.button.clicked_at # if button was clicked (variable has a value and is not nil)\n\n # The appearance of the button changes for 0.25 seconds after the time the button is clicked at.\n # The color changes (rgb is set to 0, 180, 80) and the transparency gradually changes.\n # Change 0.25 to 1.25 and notice that the transparency takes longer to return to normal.\n outputs.solids << [x, y, w, h, 0, 180, 80, 255 * state.button.clicked_at.ease(0.25.seconds, :flip)]\n end\n end", "def button\n @edit = session[:edit] # Restore @edit for adv search box\n params[:display] = @display if %w[all_vms vms resource_pools].include?(@display) # Were we displaying sub-items\n\n @refresh_div = 'main_div' unless @display # Default div for button.rjs to refresh\n case params[:pressed]\n when 'resource_pool_delete'\n deleteresourcepools\n if @refresh_div == 'main_div' && @lastaction == 'show_list'\n replace_gtl_main_div\n else\n render_flash unless performed?\n end\n when 'resource_pool_protect'\n assign_policies(ResourcePool)\n else\n super\n end\n end", "def create_button_down(cache_down_bmp)\n @button_down_sprite = push 0, 0, nil\n @button_down_sprite.set_bitmap(cache_down_bmp).set_rect_div(0, 0, 1, 2)\n end", "def place_in_layout?; end", "def place_in_layout?; end", "def click_button(button)\n append_to_script \"click_button \\\"#{button}\\\"\"\n end", "def button_comprar_go_to_cart\n\n click_button 'Comprar Ahora'\nend", "def question_classic_button_click\n MenuControllerContracts.invariant(self)\n @alert_view = @help_view = Views::ConnectInstructionsAlertView.new(@window, self)\n MenuControllerContracts.invariant(self)\n end", "def on_click\n\t\tend", "def on_button_push\n @command.execute if @command\n end", "def tk_update\n \"moveto #{id} #{x} #{y}\"\n end", "def add_call(text, command)\n button = Qt::PushButton.new(text)\n button.minimum_height = 50\n add_widget(button)\n connect(button, SIGNAL_CLICKED) { command.call }\n end", "def button_up(id)\n case id\n when Gosu::MsLeft\n if iterate_element() != nil\n element = iterate_element()\n click_event(element)\n end\n end\n end", "def linkwizard_startover_button\n $tracer.trace(__method__)\n return ToolTag.new(form.id(\"StartOver\").button.className(\"/btn/\") ,__method__)\n end", "def generateButtons\n @moves = @battler.moves\n @nummoves = 0\n @oldindex = -1\n @x = []; @y = []\n for i in 0...4\n @button[\"#{i}\"].dispose if @button[\"#{i}\"]\n @nummoves += 1 if @moves[i] && @moves[i].id\n @x.push(@viewport.width/2 + (i%2==0 ? -1 : 1)*(@viewport.width/2 + 99))\n @y.push(@viewport.height - 90 + (i/2)*44)\n end\n for i in 0...4\n @y[i] += 22 if @nummoves < 3\n end\n @button = {}\n for i in 0...@nummoves\n # get numeric values of required variables\n movedata = GameData::Move.get(@moves[i].id)\n category = movedata.physical? ? 0 : (movedata.special? ? 1 : 2)\n type = GameData::Type.get(movedata.type).id_number\n # create sprite\n @button[\"#{i}\"] = Sprite.new(@viewport)\n @button[\"#{i}\"].param = category\n @button[\"#{i}\"].z = 102\n @button[\"#{i}\"].bitmap = Bitmap.new(198*2, 74)\n @button[\"#{i}\"].bitmap.blt(0, 0, @buttonBitmap, Rect.new(0, type*74, 198, 74))\n @button[\"#{i}\"].bitmap.blt(198, 0, @buttonBitmap, Rect.new(198, type*74, 198, 74))\n @button[\"#{i}\"].bitmap.blt(65, 46, @catBitmap, Rect.new(0, category*22, 38, 22))\n @button[\"#{i}\"].bitmap.blt(3, 46, @typeBitmap, Rect.new(0, type*22, 72, 22))\n baseColor = @buttonBitmap.get_pixel(5, 32 + (type*74)).darken(0.4)\n pbSetSmallFont(@button[\"#{i}\"].bitmap)\n pbDrawOutlineText(@button[\"#{i}\"].bitmap, 198, 10, 196, 42,\"#{movedata.real_name}\", Color.white, baseColor, 1)\n pp = \"#{@moves[i].pp}/#{movedata.total_pp}\"\n pbDrawOutlineText(@button[\"#{i}\"].bitmap, 0, 48, 191, 26, pp, Color.white, baseColor, 2)\n pbSetSystemFont(@button[\"#{i}\"].bitmap)\n text = [[movedata.real_name, 99, 4, 2, baseColor, Color.new(0, 0, 0, 24)]]\n pbDrawTextPositions(@button[\"#{i}\"].bitmap, text)\n @button[\"#{i}\"].src_rect.set(198, 0, 198, 74)\n @button[\"#{i}\"].ox = @button[\"#{i}\"].src_rect.width/2\n @button[\"#{i}\"].x = @x[i]\n @button[\"#{i}\"].y = @y[i]\n end\n end", "def button\n @edit = session[:edit] # Restore @edit for adv search box\n params[:display] = @display if %w(vms instances images).include?(@display)\n params[:page] = @current_page unless @current_page.nil? # Save current page for list refresh\n return tag(\"CloudTenant\") if params[:pressed] == 'cloud_tenant_tag'\n if params[:pressed].starts_with?(\"vm_\", # Handle buttons from sub-items screen\n \"miq_template_\",\n \"guest_\",\n \"image_\",\n \"instance_\")\n\n pfx = pfx_for_vm_button_pressed(params[:pressed])\n process_vm_buttons(pfx)\n return if [\"#{pfx}_policy_sim\", \"#{pfx}_compare\", \"#{pfx}_tag\", \"#{pfx}_retire\",\n \"#{pfx}_protect\", \"#{pfx}_ownership\", \"#{pfx}_refresh\", \"#{pfx}_right_size\",\n \"#{pfx}_reconfigure\"].include?(params[:pressed]) &&\n @flash_array.nil?\n\n unless [\"#{pfx}_edit\", \"#{pfx}_miq_request_new\", \"#{pfx}_clone\",\n \"#{pfx}_migrate\", \"#{pfx}_publish\"].include?(params[:pressed])\n @refresh_div = \"main_div\"\n @refresh_partial = \"layouts/gtl\"\n show\n end\n elsif params[:pressed] == \"custom_button\"\n custom_buttons\n # custom button screen, so return, let custom_buttons method handle everything\n return\n end\n render_button_partial(pfx)\n end", "def on_button_osoba_dodaj_clicked()\n @osoby_window.show\n end", "def clicked;end", "def ui x = 20, y = 10, color = Gosu::Color::BLACK, &display\n singleton_class.instance_eval do\n define_method :draw_ui do\n window.font.draw instance_eval(&display), x, y, Layer::UI, 1.0, 1.0, color\n end\n end\n window.register_ui self\n end", "def activate_button\n $tracer.trace(format_method(__method__))\n return ToolTag.new(input.id(\"/redirectImageButton$/\"), format_method(__method__))\n end", "def create_line_item_button\n self.get_element(@browser, 'create')\n end", "def button_up(id)\n Controllers::ControllerSupervisor.dispatch(:button_up, id)\n end", "def button= button\n @button = button\n refresh\n end", "def mouseButton()\n @view__.mouseButton\n end", "def show_button_template\n UI::FBButtonTemplate.new(SampleElements::BUTTON_TEMPLATE_TEXT,\n SampleElements::BUTTON_TEMPLATE_BUTTONS)\n .send(@user)\n end", "def submit_button \n\t\t@browser.button(id: @submit)\n\tend", "def click(btn = 'left')\n compatible_call :click, btn\n end", "def pvp_button_click\n MenuControllerContracts.invariant(self)\n @game_state_model::game_mode = :pvp\n @game_state_model::num_of_players = 2\n @current_view = Views::PlayerMenuView.new(@window, self, @game_state_model)\n MenuControllerContracts.invariant(self)\n end", "def move\n frm.button(:value=>\"Move\").click\n end", "def press(point)\n\t\t\t\t\n\t\t\tend", "def on_button_push\n\t\t@command.before_execute if @command\n\t\t@command.execute if @command\n\t\t@command.after_execute if @command\n\tend", "def button\n options.fetch(:button, false)\n end", "def setPauseOnClick\n @pause.onClick(){\n @pauseScreen.applyOn(@parent)\n }\n end", "def button_up(id)\n\t\t@controller.button_up(id) if @controller\n\tend", "def button_up(id)\n Game.begin_game(@score) if id == Gosu::KbEscape or id == Gosu::KbReturn or Gosu::KbSpace\n end" ]
[ "0.6984616", "0.69546276", "0.68010515", "0.65952176", "0.6562371", "0.654545", "0.64923996", "0.6409502", "0.6349404", "0.625855", "0.6244189", "0.6184829", "0.61752456", "0.6135543", "0.61313856", "0.6125126", "0.61110425", "0.6095421", "0.6092659", "0.60902447", "0.6081898", "0.6072119", "0.605968", "0.605577", "0.605577", "0.6036969", "0.6036831", "0.60332984", "0.6030797", "0.60234493", "0.60234493", "0.60234493", "0.60210633", "0.6004201", "0.59938556", "0.59828603", "0.5982262", "0.5980456", "0.59760165", "0.59729195", "0.59710443", "0.59627646", "0.5959274", "0.59366304", "0.59229946", "0.59220296", "0.5904744", "0.5898622", "0.5897444", "0.5877115", "0.58747256", "0.5869192", "0.5866564", "0.5848545", "0.5838114", "0.5831695", "0.581604", "0.5790797", "0.5781583", "0.5779898", "0.5766464", "0.5758467", "0.57533467", "0.57524496", "0.5752262", "0.57506484", "0.5747191", "0.574665", "0.5744156", "0.5744156", "0.5733229", "0.5724256", "0.57193404", "0.57193184", "0.5710102", "0.5707416", "0.5702734", "0.56958854", "0.5692297", "0.5690191", "0.5680653", "0.5662884", "0.5662821", "0.5658262", "0.5656864", "0.5655868", "0.5648509", "0.564783", "0.564312", "0.5642903", "0.5614929", "0.561347", "0.56091124", "0.5606628", "0.56054217", "0.5603539", "0.5602647", "0.56020904", "0.55799574", "0.55756986" ]
0.7280034
0
Checks if the user hovers over the button
def mouse_over_button(mouse_x, mouse_y) if ((mouse_x >= (SCREEN_WIDTH/3) + 100 and mouse_x <= (SCREEN_WIDTH/3) + 160) and (mouse_y >= 300 and mouse_y <= 345)) return true else return false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n \n if(isOverButton)\n @hover = true\n else\n @hover = false\n end\n \n if(@clicked)\n @clicked = false\n @hover = false\n return true\n end\n \n return false\n end", "def isHover\n return @hover\n end", "def mouse_over_target?\n inputs.mouse.point.inside_rect?(scale_up(state.target))\n end", "def mouse_over?\n\t\tmouse_x = @janela_pai.mouse_x\n\t\tmouse_y = @janela_pai.mouse_y\n\t\tmouse_x > @x and mouse_x < @x + @largura_campo and\n\t\tmouse_y > @y and mouse_y < @y + height\n\tend", "def mouse_over_target2?\n inputs.mouse.point.inside_rect?(move_and_scale_up(state.target))\n end", "def under_mouse?\n @window.mouse_x > x - PADDING and @window.mouse_x < x + WIDTH + PADDING and\n @window.mouse_y > y - PADDING and @window.mouse_y < y + height + PADDING\n end", "def mouse_over_hill2?\n state.hills.each_key do | hill |\n return true if inputs.mouse.point.inside_rect?(move_and_scale_up(hill))\n end\n\n false\n end", "def mouse_over?\n return @window.mouse_x.between?(@x, @x+@width) && @window.mouse_y.between?(@y, @y+@height)\n end", "def mouse_over_star?\n inputs.mouse.point.inside_rect?(scale_up(state.star))\n end", "def mouse_over?\n mx = @window.mouse_x\n my = @window.mouse_y\n (mx >= @x && my >= @y) &&\n (mx <= @x + @font.text_width(@text)) &&\n (my <= @y + @font.height)\n end", "def mouse_over_star2?\n inputs.mouse.point.inside_rect?(move_and_scale_up(state.star))\n end", "def mouse_over_hill?\n state.hills.each_key do | hill |\n return true if inputs.mouse.point.inside_rect?(scale_up(hill))\n end\n\n false\n end", "def mouse_in(e)\n @state = :hover\n end", "def mouse_over?(mouse_x, mouse_y)\n mouse_x >= x - Const::BORDER_GAP &&\n mouse_x <= x + @width + Const::BORDER_GAP &&\n mouse_y >= y - Const::BORDER_GAP &&\n mouse_y <= y + @font.height + Const::BORDER_GAP\n end", "def button_clicked? button\n inputs.mouse.click && inputs.mouse.click.point.inside_rect?(button.border)\n end", "def isAutoHoverOn _args\n \"isAutoHoverOn _args;\" \n end", "def mouse_over_wall?\n state.walls.each_key do | wall |\n return true if inputs.mouse.point.inside_rect?(scale_up(wall))\n end\n\n false\n end", "def mouse_over_wall2?\n state.walls.each_key do | wall |\n return true if inputs.mouse.point.inside_rect?(move_and_scale_up(wall))\n end\n\n false\n end", "def hovering?(slot)\n\t\t\tarea = [(slot.left..(slot.left + slot.width)).to_a, (slot.top..(slot.top + slot.height))]\n\t\t\tpointer = [mouse[1], mouse[2]]\n\t\t\tif area[0].include?(pointer[0]) && area[1].include?(pointer[1])\n\t\t\t\ttrue\n\t\t\telse\n\t\t\t\treturn false\n\t\t\tend\n\t\tend", "def mouse_pressed?\n @declared_fields['mousePressed'].value(java_self)\n end", "def star_clicked?\n inputs.mouse.down && inputs.mouse.point.inside_rect?(scale_up(grid.star))\n end", "def target_clicked?\n inputs.mouse.down && inputs.mouse.point.inside_rect?(scale_up(grid.target))\n end", "def update_mouse_list\n return false unless MOUSE_OVER_ENABLED # Currently not practical at all so disabled\n delta = @item_button_list.mouse_delta_index\n return true if delta == 0 || @last_mouse_delta == delta\n update_mouse_delta_index(delta)\n return false\n ensure\n @last_mouse_delta = delta\n end", "def mouse_over_grid?\n inputs.mouse.point.inside_rect?(scale_up(grid.rect))\n end", "def over?\n if controller.contains?(*controller.translate_absolute(x, y))\n # the event occurred within this component's local space\n @over = true\n end\n end", "def mouse_in(mouse_event)\n end", "def under_point?(mouse_x, mouse_y)\n mouse_x > x - PADDING and mouse_x < x + width + PADDING and\n mouse_y > y - PADDING and mouse_y < y + height + PADDING\n end", "def mouse_over_grid2?\n inputs.mouse.point.inside_rect?(move_and_scale_up(grid.rect))\n end", "def under_point?(mouse_x, mouse_y)\n mouse_x > x - PADDING_X and mouse_x < x + @width + PADDING_X and\n mouse_y > y - PADDING_Y and mouse_y < y + @height + PADDING_Y\n end", "def under_point?(mouse_x, mouse_y)\n border.contains?(mouse_x, mouse_y)\n end", "def button_pressed?(btn)\n @down[btn] and not @prev_down[btn]\n end", "def poll_mouse()\n\t\tmb = Gosu::button_down? Gosu::MsLeft\n\t\tif mb and not @clicked\n\t\t\t@clicked = true\n\t\t\treturn \"click\"\n\t\telsif mb and @clicked\n\t\t\treturn \"hold\"\n\t\telsif not mb and @clicked\n\t\t\t@clicked = false\n\t\t\treturn \"release\"\n\t\telse\n\t\t\treturn \"\"\n\t\tend\n\tend", "def clicked\n @callback.call if mouse_over?\n end", "def mouse_pressed?\n Java.java_to_primitive(java_class.field(\"mousePressed\").value(java_object))\n end", "def mouse_pressed?\n Java.java_to_primitive(java_class.field(\"mousePressed\").value(java_object))\n end", "def mouse?\n instance.options[:mouse]\n end", "def button_released?(btn)\n @prev_down[btn] and not @down[btn]\n end", "def under_point?(mouse_x, mouse_y)\n mouse_x > x - PAD && mouse_x < x + width + PAD && mouse_y > y - PAD && mouse_y < y + height + PAD\n end", "def hover\n root_node.hover\n end", "def button?\n return !button.nil?\n end", "def hover_event(element)\n # replaces element colour with overlay only\n # while mouse over\n element.colour = OVERLAY\nend", "def native_hover\n # original watir-webdriver code for hover\n assert_exists\n assert_has_input_devices_for :hover\n\n driver.action.move_to(@element).perform\n end", "def mouse_inside?\n mouse_location = self.window.mouseLocationOutsideOfEventStream\n hit_view = self.hitTest(self.convertPoint(mouse_location, fromView:nil))\n \n hit_view != nil\n end", "def button_down(id)\n case id\n when Gosu::MsLeft\n @locs = [mouse_x, mouse_y]\n if mouse_over_button(mouse_x, mouse_y)\n @background = Gosu::Color::YELLOW\n elsif mouse_over_button(mouse_x, mouse_y) == false\n @background = Gosu::Color::WHITE\n end\n end\n end", "def hover\n next_btn = page.find('.ytp-play-button')\n mute_btn = page.find('.ytp-mute-button')\n page.driver.browser.action.move_to(next_btn.native).perform\n page.driver.browser.action.move_to(mute_btn.native).perform\nend", "def mouse_button\n mouse_state.image\n end", "def IS_POINTER_FIFTHBUTTON_WPARAM(wParam)\n IS_POINTER_FLAG_SET_WPARAM(wParam, POINTER_MESSAGE_FLAG_FIFTHBUTTON)\n end", "def IS_POINTER_FIRSTBUTTON_WPARAM(wParam)\n IS_POINTER_FLAG_SET_WPARAM(wParam, POINTER_MESSAGE_FLAG_FIRSTBUTTON)\n end", "def over?\n end", "def button_down?(button)\n end", "def mouse_on_window?\n return false unless $mouse.on_screen?\n pos = $mouse.position\n return (pos[0] >= self.x and pos[0] < self.x + self.width and\n pos[1] >= self.y and pos[1] < self.y + self.height)\n end", "def leftClick?(object=nil,width=-1,height=-1)\n if object.nil?\n return Input.triggerex?(Input::Mouse_Left)\n else\n return (self.over?(object,width,height) && Input.triggerex?(Input::Mouse_Left))\n end\n end", "def hover(name, *args)\n widget(name, *args).hover\n end", "def grid_clicked?\n inputs.mouse.down && mouse_inside_grid?\n end", "def button?\n\t\tcan_button? and show_button\n\tend", "def over?\n\n end", "def not_pressed?\n high?\n end", "def clicked?\n return @clicked\n end", "def show_button(player, league_id)\n \tplayer.taken_for?(league_id) ? false : true\n end", "def isClick(x,y)\n @pixel = y * @rowstride + x * @n_channel\n if @tabPixel[@pixel+3] == 255\n @action.call\n end\n return @tabPixel[@pixel+3] == 255\n end", "def update_buttons_input(mouse_x, mouse_y, trigger)\n if @button_up_sprite.simple_mouse_in?(mouse_x, mouse_y)\n scroll(-@scroll_unit)\n @button_up_sprite.set_rect_div(0, 1, 1, 2) if trigger\n return true\n elsif @button_down_sprite.simple_mouse_in?(mouse_x, mouse_y)\n scroll(@scroll_unit)\n @button_down_sprite.set_rect_div(0, 1, 1, 2) if trigger\n return true\n elsif @background_sprite.simple_mouse_in?(mouse_x, mouse_y) && !@button_slider_sprite.simple_mouse_in?(mouse_x, mouse_y)\n comp = @direction.compare_coords(mouse_x, mouse_y, @button_slider_sprite.x, @button_slider_sprite.y)\n scroll((comp ? 1 : -1) * @scroll_unit)\n @button_slider_sprite.set_rect_div(0, 1, 1, 2) if trigger\n return true\n end\n return false\n end", "def pen_up?\n !@pen_is_down\n end", "def mouse_over locator\r\n command 'mouseOver', locator\r\n end", "def mouse_over locator\r\n command 'mouseOver', locator\r\n end", "def mouse_over(x: 1, y: 1)\n Log.debug(\"[GRIDIUM::Element] Triggering mouse over for (#{self})...\")\n if element.enabled?\n $verification_passes += 1\n ElementExtensions.mouse_over(self, x: x, y: y)\n else\n Log.error('[GRIDIUM::Element] Cannot mouse over. Element is not present.')\n end\n end", "def mouse_pressed\n return unless button.clicked(mouse_x, mouse_y)\n\n population.selection\n population.reproduction\nend", "def hover_click(element)\n driver.action.click(element).perform\n end", "def area_clicked(leftX, topY, rightX, bottomY)\n # complete this code\n if ((mouse_x > leftX and mouse_x < rightX) and (mouse_y > topY and mouse_y < bottomY))\n true\n else\n false\n end\nend", "def IS_POINTER_THIRDBUTTON_WPARAM(wParam)\n IS_POINTER_FLAG_SET_WPARAM(wParam, POINTER_MESSAGE_FLAG_THIRDBUTTON)\n end", "def pressed?\n low?\n end", "def check_event_trigger_here(triggers)\n persona_check_event_trigger_here(triggers)\n $persona.set_transparent($game_player.screen_x > 450) if $persona != nil\n end", "def update_mouse(moved)\n @buttons.each_with_index do |button, index|\n next unless button.simple_mouse_in?\n if moved\n last_index = @index\n @index = index\n if last_index != index\n update_buttons\n play_cursor_se\n end\n elsif Mouse.trigger?(:LEFT)\n @index = index\n update_buttons\n play_decision_se\n action\n end\n return false\n end\n return true\n end", "def curatorMouseOver \n \"curatorMouseOver\" \n end", "def update\n @prev_hovering ||= false\n return unless @prev_hovering != hovering?\n\n (hovering? ? hover_handlers : unhover_handlers).each(&:call) if enabled?\n @prev_hovering = hovering?\n end", "def touched_by_mouse?\n\t\t\treturn false if !@shape\n\t\t\treturn SDC.mouse_touching?(@shape)\n\t\tend", "def over?\n draw? || won?\n end", "def over?\r\n won? || draw?\r\n end", "def over?\n self.won? || self.draw?\n end", "def simple_mouse_in?(mouse_x = Mouse.x, mouse_y = Mouse.y)\n return false unless @enabled\n\n return mouse_x.between?(@viewport.rect.x, @viewport.rect.x + @viewport.rect.width) &&\n mouse_y.between?(@viewport.rect.y, @viewport.rect.y + @viewport.rect.height)\n end", "def leftPress?(object=nil,width=-1,height=-1)\n if object.nil?\n return Input.pressed(Input::Mouse_Left)\n else\n return (self.over?(object,width,height) && Input.pressed(Input::Mouse_Left))\n end\n end", "def over?()\n if won?() || draw?()\n return true\n end\n return false\n end", "def within_clickable?(x, y)\n if x >= @px && x <= @qx then\n if y >= @py && y <= @qy then\n return true\n end\n end\n \n false\n end", "def mouse_inside_grid?\n inputs.mouse.point.inside_rect?(scale_up(grid.rect))\n end", "def mouseButton()\n @view__.mouseButton\n end", "def is_over?\n \t!self.is_in_progress?\n end", "def over?\n draw? || won? ? true : false\n end", "def over?\n draw? || won?\n end", "def pen_down?\n @pen_is_down\n end", "def on_hover(&block)\n hover_handlers << block\n self\n end", "def hover\n base.image_for(\"#{name}_hover\")\n end", "def update_mouse(_moved)\n if Mouse.trigger?(:left)\n @mouse_button_cancel.set_press(@mouse_button_cancel.simple_mouse_in?)\n elsif Mouse.released?(:left)\n @running = false if @mouse_button_cancel.simple_mouse_in?\n @mouse_button_cancel.set_press(false)\n end\n return true\n end", "def game_over?\n return false unless @previous_piece\n\n previous_color = @previous_piece.color == :white ? :black : :white\n no_legal_moves_captures?(previous_color)\n end", "def drag?(button); false; end", "def IS_POINTER_FOURTHBUTTON_WPARAM(wParam)\n IS_POINTER_FLAG_SET_WPARAM(wParam, POINTER_MESSAGE_FLAG_FOURTHBUTTON)\n end", "def over?\n \t@game_over = true\n end", "def game_over?\n true\n end", "def update_ctrl_button_mouse\n update_mouse_ctrl_buttons(@base_ui.ctrl, ACTIONS)\n return false\n end", "def menu_relatorios\n relatorios_div.hover\n end", "def over?\n draw? || won?\n end", "def over?\n draw? || won?\n end" ]
[ "0.8068117", "0.75783557", "0.73522335", "0.7145684", "0.7055907", "0.70185745", "0.6994087", "0.69923925", "0.69782305", "0.6934289", "0.6917678", "0.68952733", "0.67863935", "0.6727239", "0.67223144", "0.6643505", "0.6606747", "0.6562269", "0.6561966", "0.6485825", "0.63987535", "0.6390141", "0.6337475", "0.6324003", "0.6297987", "0.6215238", "0.6177737", "0.615588", "0.6148136", "0.6146997", "0.61107373", "0.6106217", "0.6092676", "0.60920185", "0.60920185", "0.60709673", "0.60678977", "0.6059133", "0.6016645", "0.59683156", "0.59546137", "0.5894087", "0.5863792", "0.58460563", "0.58306736", "0.5814529", "0.5813708", "0.5795883", "0.579305", "0.57928", "0.57825893", "0.5768323", "0.5751755", "0.574976", "0.57463473", "0.5721393", "0.5682868", "0.56812865", "0.56710595", "0.56619173", "0.56528556", "0.5635388", "0.5632992", "0.5632992", "0.56224245", "0.5602368", "0.5592024", "0.5590914", "0.55899537", "0.55758846", "0.5569639", "0.5537879", "0.5535133", "0.5532894", "0.552602", "0.54993665", "0.5497363", "0.54897624", "0.54859", "0.54832315", "0.54777074", "0.5469795", "0.54696083", "0.54688185", "0.54679716", "0.54624116", "0.546111", "0.5459242", "0.5454242", "0.5450107", "0.5450067", "0.5431657", "0.5420397", "0.5409489", "0.54066914", "0.54056597", "0.54016745", "0.53920716", "0.5390976", "0.5390976" ]
0.7418596
2
Providing all the instruction to the user before starting the game
def draw @background_image.bmp.draw(0, 0, ZOrder::BACKGROUND) @function_UI.place_button((SCREEN_WIDTH/3) + 100, 300, "Start!") @function_UI.big_font.draw_text("SPACE WAR", @function_UI.pos- 120, 30, ZOrder::TOP, 1.0, 1.0, Gosu::Color::YELLOW) @function_UI.big_font.draw_text("Instructions: ", @function_UI.pos-100, 100, ZOrder::TOP, 1.0, 1.0, Gosu::Color::RED) @function_UI.font.draw_text("# Press SPACE BAR to fire bullets", @function_UI.pos-180, 140, ZOrder::TOP, 1.0, 1.0, Gosu::Color::YELLOW) @function_UI.font.draw_text("# Use the ARROW KEYS to navigate the Spaceship", @function_UI.pos-180, 180, ZOrder::TOP, 1.0, 1.0, Gosu::Color::YELLOW) @function_UI.font.draw_text("# You have 3 Life Lines", @function_UI.pos-180, 220, ZOrder::TOP, 1.0, 1.0, Gosu::Color::YELLOW) @function_UI.font.draw_text("# Press ESC to leave the Game", @function_UI.pos-180, 260, ZOrder::TOP, 1.0, 1.0, Gosu::Color::YELLOW) draw_border((SCREEN_WIDTH/3) + 105, 305) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_initial_commands\n #in the game class\n case \n when play?\n game = Game.new(instream, outstream, display)\n game.start\n \n when instructions?\n display.game_objective1 # give the user instructions\n display.game_objective2\n\n when quit? # run the loop below until the user says to quit\n outstream.puts display.quit.magenta\n\n else # for anything else\n outstream.puts display.invalid_option\n end\n end", "def run\n welcome\n main_menu_selection #choose to create a character or login to pre-existing character\n player_options #a list of options the selected player from 'selection_menu' can accomplish\nend", "def start\n\t\tputs \"Welcome to Mastermind!\"\n\t\tputs \"What is your name?\"\n\t\tname = gets.chomp.capitalize\n\t\tputs \"Welcome #{name}! Here are the instructions for Mastermind\"\n\t\tputs \"---------------------------- \"\n\t\tputs \"-----------------------------\"\n\t\tinstructions\n\t\tplay_game\n\tend", "def start()\r\n\t\t\t@output.puts(\"Welcome to Mastermind!\")\r\n\t\t\t@output.puts(\"Created by: #{created_by} (#{student_id})\")\r\n\t\t\t@output.puts(\"Starting game...\")\r\n\t\t\t@output.puts('Enter \"1\" to run the game in the command-line window or \"2\" to run it in a web browser')\r\n\t\tend", "def main\n include GameStatus\n the_user = User.new\n\n if the_user.prompt_start.downcase.eql? 'y'\n #game continues to begin\n else\n puts(Colors.colorize('Why not tho?', 'cyan_b'))\n exit(0)\n end\n\n Output.print_intro\n the_secret_code = SecretCode.new\n the_user.take_input\n the_user.give_feedback\nend", "def start\r\n\t\t\t@output.puts \"Welcome to Deal or No Deal!\"\r\n\t\t\t@output.puts \"Designed by: #{created_by}\"\r\n\t\t\t@output.puts \"StudentID: #{student_id}\"\r\n\t\t\t@output.puts \"Starting game...\"\r\n\t\tend", "def play\n\t\twelcome\n\t\task_name\n\t\task_name2 \n\t\task_input\n\t\tturns\n\tend", "def start \n\t @output.puts \"Welcome to Noughts and Crosses!\"\n\t @output.puts \"Created by:#{created_by}\"\n\t @output.puts \"StudentID: #{student_id}\"\n\t @output.puts \"Starting game...\"\n\t @output.puts \"Player 1: 0 and Player 2: 1\"\n\n\t\n\tend", "def start \n puts \"Welcome to \" + blue(\"Apeture Science TicTacToe\") + \", were we screen the test \" + blue(\"test subjects\") + \" from the \" + pink(\"cake ingredients\") \n # Get input from player on game mode\n valid = false\n until valid == true\n puts \"To play against another pathetic test \\\"participant\\\", \" + blue(\"press P\") + \". If you dare challenge a cyber god, \" + blue(\"press A\") + \". On a relevant note, \" + pink(\"please don't spill tears into any Apeture Science equipement.\")\n @input = STDIN.gets.chomp.downcase\n\n valid = \"pa\".split(\"\")\n if valid.include?(@input)\n valid = true\n else\n puts \"Seems you could not manage that simple task. Well at least you can rest assured that \" + pink(\"you will burn well.\")\n end\n end\n # Set game mode\n if @input == \"p\"\n @game_mark = \"player\"\n elsif @input == \"a\"\n @AI = AI.new(@game, self) \n @game_mark = \"AI\" \n if @game.current_player == \"X\" \n @AI.make_move\n end\n end\n start_turn \n end", "def perform\n\tgame_menu\n\tgameplay\nend", "def game_setup\n\t\t\tputs \"Would you like to play? [yes|no] \"\n\n\t\t\tinput = gets.chomp.downcase\n\n\t\t\tif input == \"yes\"\n\t\t\t\tname = @ui.get_name()\n\t\t\t\tmark = @ui.get_mark(name)\n\n\t\t\t\t@player = Player.new(name, mark)\n\n\t\t\t\tmark == 'X' ? @ai = AI.new('O', @player, @board) : @ai = AI.new('X',\n\t\t\t\t@player, @board)\n\t\n\t\t\t\tputs \"\\nTo play, you will need to input a number between 1 and 9\"\n\t\t\t\tputs \"representing to locations on the grid with 1 being the\"\n\t\t\t\tputs \"top-left corner and 9 being the bottom right corner,\"\n\t\t\t\tputs \"decreasing from left to right\\n\"\n\t\n\t\t\t\tself.run()\n\n\t\t\telse\n\t\t\t\tputs \"Have a nice day and come play next time.\"\n\t\t\t\texit\n\t\t\tend\n\t\tend", "def game_setup\n end", "def start_game\n @new_prompt.title_screen\n @new_commands.create_new_board(5)\n select_mode\n end", "def ask_for_start\n puts \"Do you want to start the game? y/n\"\n user_input = Info.get_user_input\n if user_input.downcase == \"y\"\n start_game\n elsif user_input.downcase == \"n\"\n puts \"You said no :(\"\n else\n exit_app\n end\n end", "def start_screen()\n puts \"Welcome to Hangman.\"\n puts \"'N' to start a new game, 'L' to load!\"\n choice = gets.chomp.upcase\n if choice == 'N'\n self.play\n elsif choice == 'L'\n load_game\n else\n puts \"Please choose 'N' or 'L' next time.\"\n puts \"For now the culprit's fate is spared. Take care!\"\n end\n end", "def game_start\n\n\tclear_screen\n\n\tprint_paragraph(\"Welcome to Trapped In A Cave.\\nGuess what? You're trapped in a cave...\nCan you make it out alive?\\n(For a list of commands type help at anytime.)\")\n\nstart_room\n\nend", "def start\n set_player_name\n deal_cards\n show_flop\n player_turn\n dealer_turn\n end", "def start\n setPlayers\n question\nend", "def start\n DataManager.create_game_objects\n $game_party.setup_starting_members\n $game_map.setup(Config::Starting_Map_ID)\n $game_player.moveto(Config::X_Pos, Config::Y_Pos)\n $game_player.followers.visible = false\n $game_player.refresh\n $game_player.make_encounter_count\n\n @character_name = $game_player.character_name\n @character_index = $game_player.character_index\n $game_player.set_graphic('', 0)\n\n $game_system.menu_disabled = true\n Graphics.frame_count = 0\n\n super\n create_foreground\n create_background\n create_command_window\n play_title_music\n end", "def start\n\t\t\t@output.puts(\"Welcome to Mastermind!\")\n\t\t\t@output.puts(\"Created by: #{created_by} (#{student_id})\")\n\t\t\t@output.puts(\"Starting game...\")\n\t\t\t@output.puts(\"The game has 12 turns!\")\n\t\t\t@secret = \"XXXX\"\n\t\t\tvalid1 = checksecret(secret)\n\t\tend", "def start\n\n player_loc = 0\n\n game_start = \"start\"\n\n #begin the game\n Mechanics.show_title()\n\n while true\n command = Mechanics.prompt()\n \n if command == \"help\"\n Mechanics.show_help()\n elsif command == \"start\"\n Mechanics.start_game(player_loc)\n elsif command == \"quit\"\n exit(0)\n elsif command.include? 'move'\n direction = Mechanics.check_direction(player_loc, Mechanics.parse_input(command))\n if direction != false\n player_loc = direction\n Mechanics.show_room(player_loc)\n else\n puts \"You can't seem to move that way.\"\n end\n else\n puts \"I don't know what you mean.\"\n end\n end\nend", "def start_game\n game_logo\n game_start_screen\n game_rules\n last_rules\n choice = maker_breaker\n game_maker if choice == 'm'\n game_breaker if choice == 'b'\n end", "def game_start\n opening\n first_menu\n end", "def menu()\n system('clear')\n puts '==================== M E N U ===================='.colorize(:light_blue)\n puts \" Press enter to start\".colorize(:green)\n gets.chomp\n @@support.help\n numberPlayers\n sleep (0)\n game\n return \"Finishing the game\"\n end", "def setup\r\n self.input = { :escape => :close, :return => :load } # exits example on Escape\r\n Chingu::GameObject.create(:x => 200, :y => 100, :image => Image[\"spaceship.png\"])\r\n Chingu::Text.create(\"Press <return> to load game\", :y => 100)\r\nend", "def display_instructions\r\n \r\n Console_Screen.cls #Clear the display area\r\n puts \"INSTRUCTIONS:\\n\\n\" #Display a heading\r\n \r\n #Display the game's instructions\r\n puts \"You will be presented with a series of multiple-choice\" \r\n puts \"questions. To answer a question, type in the letter of\"\r\n puts \"the corresponding answer and press the Enter key. Your\"\r\n puts \"grade will be displayed at the end of the test.\\n\\n\\n\"\r\n puts \"Good luck!\\n\\n\\n\\n\\n\\n\\n\\n\\n\"\r\n print \"Press Enter to continue.\"\r\n \r\n Console_Screen.pause #Pause the game\r\n \r\n end", "def runner\n welcome\n deal_card\n display_card_total\n prompt_user\n get_user_input\nend_game\ninitial_round\nhit\ninvalid_command\nend", "def player_set_up\n\n if @debug == false\n system('clear')\n slow_type(\"Please enter your name and hit enter:\")\n @new_player_name = gets.chomp\n slow_type(\"\\nThank you, #{@new_player_name}\")\n slow_type(\"\\nTime to start the game...\\n\")\n end\n \n end", "def start_game\n begin\n @game_text.intro\n\n # Run the tutorial\n ActionDirector.new(@world, @player).call({command: :talk, target: :jerry})\n\n # The main game\n while @player.alive? && @world.has_hostiles?\n @player.in_battle? ? battle_loop : game_loop\n end\n\n @player.alive? ? @player.win : @player.defeat\n rescue SystemExit, Interrupt # Catpure ctrl+c exit, end gracefully\n @game_text.exit\n end\n end", "def game_start\n game_setup\n @console_delegate.show\n end", "def start!\n puts intro\n get_name\n player.enter_room\n loop {get_option}\n end", "def begin\r\n system(\"clear\")\r\n a = Artii::Base.new(:font => 'slant')\r\n puts\r\n puts\r\n puts a.asciify(' Welcome!')\r\n puts\r\n puts a.asciify(' Trent or not!')\r\n puts\r\n puts \" By\\n\\n\"\r\n puts \" James, Carmen, Nathan, and Olivia\\n\\n\\n\\n\"\r\n puts \" Hello , what is your name?\"\r\n\r\n # accepts input and makes a new player class object with their name\r\n # and a default score of 0.\r\n @user = Player.new(gets.chomp, 0)\r\n @user.randomise\r\n end", "def play\n\n while @game_complete == false\n\n # starting game text to help the player create a mental picture of the environment\n @new_player_name = \"Mr Developer\" if @debug\n player_set_up unless @debug || @starting_game_text == false\n puts starting_game_text unless @debug || @starting_game_text == false\n @starting_game_text = false\n \n slow_type(\"\\nYou are in #{find_room_by_id(@current_room_id).name}\")\n main_menu = TTY::Prompt.new\n\n choices = [\n { name: 'Move Player', value: 1 },\n { name: 'Look At', value: 2 },\n { name: 'Pick Up', value: 3 },\n { name: 'Use Item', value: 4 },\n { name: 'Talk To', value: 5 },\n { name: 'Quit', value: 6 },\n ]\n attr = main_menu.select(slow_type(\"What would you like to do?\"), choices)\n\n # gets user input\n \n if attr == 1\n player_move\n \n elsif attr == 2\n look_at\n\n elsif attr == 3\n pick_up\n\n elsif attr == 4\n use_item\n\n elsif attr == 5\n talk_to\n \n else attr == 6\n @game_complete = true\n end\n\n end\n end", "def run\n choose_game(prompt)\nend", "def start\n puts \"Load game or start new?\"\n puts \"Type 'load' to load a previous save, or type 'new' to start a new game.\"\n game_type = gets.chomp.downcase.strip\n if game_type == \"load\"\n load\n elsif game_type == \"new\"\n load_secret_word\n init_guess_count\n @wrong_guesses = []\n else\n start\n end\n end", "def pre_game\n clear\n mission_directive_text\n clear\n codebreaker_protocol_text\n begin_mission_text\n end", "def start_main_menu \n puts \"[1] Start\\n[2] Measurement Converter\\n[3] How to Use\".colorize(:yellow)\n user_input = gets.chomp.downcase\n if @answers[0][1].include?(user_input)\n self.start_recipe\n elsif @answers[0][2].include?(user_input)\n self.start_convert\n elsif @answers[0][3].include?(user_input)\n start_help() #module method\n self.start_main_menu\n elsif user_input == \"end\"\n exit \n else\n puts puts \"Do you not know how to press 1, 2 or 3 :| ... Try again.\".colorize(:red)\n self.start_main_menu\n end\n end", "def play_game_with_user_as_codemaker\n @display.welcome_message_for_user_as_codemaker\n solve_the_secret_combination\n end", "def instructions\n\t\tputs \"\"\"Mastermind is a code-breaking game that helps develop deductive reasoning and logic by requiring players to deduce secret combinations of colors with minimal clues. After each of these chances, the creator of the code (in this case, the computer) must reveal how many pegs are the correct color in the correct location, or the correct color in the incorrect location, or completely incorrect. With this little information, the code breaker must improve upon his previous guess to crack the code. For this game we'll allow you to have 12 guesses before requiring a forfeit.\"\"\"\n\t\tputs \"Please push Enter to continue\"\n\t\tgets.chomp\n\tend", "def instructions\r\n system(\"clear\")\r\n puts (\"Instructions\").colorize(:white).on_green\r\n puts \"How the game works:\"\r\n puts \"Make 10 is played by taking four numbers, and combining different mathematical operations to solve for a total of 10. Numbers range from 1000 to 9999.\"\r\n puts \" \"\r\n puts \"Rules:\"\r\n puts \"Players are free to use addition(+), subtraction(-), multiplication(*), division(/), parentheses() and exponentials(**).\"\r\n puts \"Players can't change the order of the numbers, and can't use decimals or square root functions.\"\r\n puts \" \"\r\n puts \"Examples:\"\r\n puts \"`1234` can be solved as `1+2+3+4 = 10` and also `(1 * 2 * 3) + 4 = 10`\"\r\n puts \"But you cannot solve it as `4+3+2+1 = 10`\"\r\n puts \" \"\r\n ask_user_start\r\n end", "def main\r\n welcome\r\n process_cmd_line\r\n top_up_players\r\n\r\n play_game\r\n\r\n rescue Interrupt\r\n puts\r\n end", "def run\n #Load the Hero File\n load_hero_file\n #Load dungeon at top level\n load_dungeon_file(@current_level)\n #display the hero's starting spot\n clear_message_box\n #get input either an action or a movement.\n while true\n update_screen\n key = @ui.instr\n case key\n when 'B','b' #turn left\n @hero_direction = POS_TURN.rotate!(-1)[0]\n when 'N','n' #turn right\n @hero_direction = POS_TURN.rotate!(1)[0]\n when 'M','m' #move ahead\n move_hero\n when 'A','a' #attack\n hero_attack if @monster_detected\n when 'C','c' #cast\n if @stats[:aura] > 0 && !@spells.empty?\n cast_spell\n else\n @ui.place_text('FIZZZZ....'.ljust(20),1,2,DungeonOfDoom::C_BLACK_ON_YELLOW)\n @ui.place_text(MSG_NOTHING.ljust(20),1,3,DungeonOfDoom::C_BLACK_ON_YELLOW)\n end\n when 'G','g' #get\n get_object\n when 'P','p' #potion\n drink_potion\n when 'R','r' #reveal\n light_room\n when 'S','s' #save?\n #not implemented yet\n when 'Q','q' #quit\n if ask_question('DO YOU REALLY WANT', 'TO QUIT? (Y/N)') == 'Y'\n break\n else\n clear_message_box\n end\n else\n #do nothing\n end\n #automated game elements\n\n #monster detected\n monster_attack if @monster_detected\n #hero died\n if @stats[:strength] <= 0\n game_over\n break\n end\n #hero gets idol!\n if @idol_found\n win_game\n break\n end\n end\n end", "def start\n begin\n Ui.print_formatted WELCOME_MESSAGE\n loop do\n choice = UserInputHandler.request_input @options_msg.join(\"\\n\")\n execute_choice(choice)\n end\n rescue StandardError => e\n handle_error(e)\n end\n end", "def display_instructions\r\n \r\n Console_Screen.cls #Clear the display area\r\n puts \"INSTRUCTIONS:\\n\\n\" #Display a heading\r\n\r\n #Display the game's instructions\r\n puts \"10 multiple choice questions! can you get them right?\" \r\n puts \"To answer a question type its corresponding letter!\"\r\n puts \"for example you want to enter answer A, so press a/A then Enter key.\"\r\n puts \" Your grade will be presented at the end but 5 or more wrong answers and you fail! \\n\\n\\n\"\r\n puts \"Each question is worth one point!\\n\\n\\n\\n\\n\\n\\n\\n\\n\"\r\n \r\n puts \"if your ready hit any key\"\r\n\tputs (\"\\n\" * 5)\r\n\t \r\n\t\r\n\tanswer = STDIN.gets \r\n\tanswer.chop! \r\n\t\r\n\tif answer == \"i\" \r\n\t\r\n\tputs \"10 out of 10 is a true fan 9 is a fan and 8 is a semi fan 7 is a FF new fan \"\r\n\tputs \"lower than that is failure.\" \r\n\r\n Console_Screen.pause #Pause the game\r\n end \r\n\r\n end", "def main\n # Class Instances\n game = Game.new\n player1 = Player.new(1)\n player2 = Player.new(2)\n # Start of main engine\n #player1.name = prompt_UI.name.....\n player1.get_name\n player2.get_name\n game.display_welcome(player1, player2)\n # Sets the current turn order\n current_player = player1\n # Start of main game loop\n continue = true\n while continue\n # go to game to get, go to UI to present\n game.display_question(current_player)\n current_player.display_score\n if current_player.game_over?\n game.final_score(player1, player2)\n continue = false\n end\n if current_player == player1\n current_player = player2\n else\n current_player = player1\n end\n end\nend", "def pre_game\n puts \n puts \"Get ready for the Horde - Level 1....\"\n puts \"Press enter when you're ready...\"\n gets\n display_word\nend", "def user_interface(game_db)\n\tputs \"Hey welcome to Resdan's Little Numbers Game, where you answer simple '+' '-' and '*' problems! The difficulty and number of problems are determined by you, and if you get all the answers right you might make it onto the leader board!\"\n\tputs \"\\n put 'q' or 'quit' or 'exit' to come back later!\"\n\n \tputs \"\\n To start off, what should your player name be?\"\n \t$name = gets.chomp\n \tquit($name)\n \tplayer_chk($db,$name)\n puts \"\\n Type 'options' to go into the options menu or 'start' to begin a new game\"\n input = gets.chomp\n opt_strt_chk(input)\n \tstart_game\n \tgame_start(lvl.to_i,probs.to_i)\n end", "def game_start\n clear\n warning\n clear\n if @intro\n introduction()\n end\n clear\n countdown\n until @promptarr == []\n game_round() \n end\n @running = game_over(@score)\n end", "def start_game(user = nil)\n super\n # ...\n end", "def display_instructions\r\n \r\n Console_Screen.cls #Clear the display area\r\n puts \"INSTRUCTIONS:\\n\\n\" #Display a heading\r\n\r\n #Display the game's instructions\r\n puts \"This game randomly generates a number from 1 to 1000 and\" \r\n puts \"challenges you to identify it in as few guesses as possible.\"\r\n puts \"After each guess, the game will analyze your input and provide\"\r\n puts \"you with feedback. You have a maximum of 10 turns in\" \r\n puts \"order to guess the game's secret number.\\n\\n\\n\"\r\n puts \"Good luck!\\n\\n\\n\\n\\n\\n\\n\\n\\n\"\r\n print \"Press Enter to continue.\"\r\n\r\n Console_Screen.pause #Pause the game\r\n \r\n end", "def display_instructions\n\n\tConsole_Screen.cls #clear th display area\n\tputs \"Instructions:\\n\\n\" #display a heading\n\n\t#display games instructions\n\tputs \"At the start of each round of play, the game randomly selects\"\n\tputs \"a word that is between minimum four and max ten characters long and\"\n\tputs \"challenges you to guess it. Before submitting your guess, you\"\n\tputs \"must specify five consontants and one vowel. If any of these\"\n\tputs \"are used in the word, they will be revealed on the screen,\"\n\tputs \"thereby making it easier for you to guess the secret word\"\n\tputs \"If a letter you chose is not in the word, then its space will \" +\n\t\" will be replaced by an underscore (_)\\n\\n\\n\"\n\tputs \"Goodluck!\\n\\n\\n\\n\\n\\n\\n\"\n\tprint \"Press Enter to continue.\"\n\n\tConsole_Screen.pause #pause the game\nend", "def start\r\n initialize_game\r\n until @game.over?\r\n take_turn\r\n end\r\n print_outcome\r\n end", "def run\n greet\n menu\n end", "def launch!\n\t\tintroduction\n\t\t\taction = nil\n\t\t\tuntil action == :quit\n\t\t\t# action loop\n\t\t\t# what do you want to do? (list, find, add, quit)\n\t\t\tprint \"> \"\n\t\t\tuser_response = gets.downcase.strip!.split(' ')\n\t\t\t# do that action\n\t\t\taction,args = do_action(user_response[0],user_response[1])\n\t\tend\n\t\tconclusion\n\tend", "def initial_setup_pause\n puts\n say \"Thanks, #{human.name}, I have everything I need to get started.\\n\" \\\n \"Please hit any key when you are ready to begin.\"\n getchar\n end", "def start_menu\n show_instructions\n @player.name = select_player_name\n game_over = false\n until game_over\n puts \"=================================================\"\n puts \"<><>------------ MAIN MENU ------------<><>\"\n puts \"=================================================\"\n game = HangmanGame.new(@player)\n choice = select_game_type\n case choice\n when \"N\"\n puts \"\\nStarting a New Game...\\n \"\n puts \"=================================================\"\n play_game(game)\n when \"L\"\n filename = \"../saved_games/hangman_save.json\"\n if File.exist?(filename)\n game.load_game(filename)\n else\n puts \"\\nSorry, no saved games available. Starting a New Game...\\n \"\n end\n play_game(game)\n when \"C\"\n @player = Player.new(select_player_name)\n when \"Q\"\n puts \"\\nExiting the game...\\n \"\n game_over = true\n else\n puts \"\\nSomehow, an incorrect selection was processed, please try again...\\n \"\n end\n end\n show_game_over\n end", "def start_game(user)\n $game_session = nil\n UserGuess.delete_all\n\n initiate_game(user)\n question_loop\n end_message\n menu(user)\nend", "def display_instructions\r\n \r\n Console_Screen.cls #Clear the display area\r\n puts \"INSTRUCTIONS:\\n\\n\" #Display a heading\r\n\r\n #Display the game's instructions\r\n puts \"This game randomly generates a number from 1 to 1000 and\" \r\n puts \"challenges you to identify it in as few guesses as possible.\"\r\n puts \"After each guess, the game will analyze your input and provide\"\r\n puts \"you with feedback. You may take as many turns as you need in\" \r\n puts \"order to guess the game's secret number.\"\r\n\tputs \"Player gets 10 tries to guess the secret number.\"\r\n\tputs \"If secret number not guessed within 10 tries game terminates.\\n\\n\\n\"\r\n puts \"Good luck!\\n\\n\\n\\n\\n\\n\\n\\n\\n\"\r\n print \"Press Enter to continue.\"\r\n\r\n Console_Screen.pause #Pause the game\r\n \r\n end", "def playGame\n #start the opening of the game\n #introduce the rules, ask for human or computer etc\n self.opening()\n\n end", "def start\n puts \"=====================================================================\"\n puts \"Hello! Welcome to a command line version of the classic Hangman.\"\n print \"Please type 'number of row' you want in your board \"\n choice = gets.chomp\n choose_game(choice)\n end", "def start\n @choice = list[ get_user_input ]\n puts \"You chose #{@choice}.\\n\\n\"\n end", "def start_a_game\n jeopardy_board\n play_game\nend", "def display_instructions\r\n \r\n Console_Screen.cls #Clear the display area\r\n puts \"INSTRUCTIONS:\\n\\n\" #Display a heading\r\n \r\n #Display the game's instructions\r\n puts \"This game pits the player against the computer. To play, you must\"\r\n puts \"enter one of the following moves when prompted: Rock, Paper, or\"\r\n puts \"Scissors.\\n\\n\"\r\n puts \"The game will randomly select a move for the computer, and \"\r\n puts \"the two moves will then be analyzed according to the following\"\r\n puts \"rules: \\n\\n\"\r\n puts \"* Rock crushes Scissors, Rock equals Rock, and Rock is covered by\"\r\n puts \" Paper.\\n\\n\"\r\n puts \"* Paper covers Rock, Paper equals Paper, and Paper is cut by\"\r\n puts \" Scissors.\\n\\n\"\r\n puts \"* Scissors cut Paper, Scissors equals Scissors, and Scissors are\"\r\n puts \" crushed by Rock.\\n\\n\\n\"\r\n puts \"Good luck!\\n\\n\\n\"\r\n print \"Press Enter to continue. \"\r\n Console_Screen.pause #Pause the game\r\n \r\n end", "def display_instructions\r\n \r\n Console_Screen.cls #Clear the display area\r\n \r\n puts \"INSTRUCTIONS:\\n\\n\" #Display a heading\r\n\r\n #Display the game's instructions\r\n puts \"In the Ruby Tic-Tac-Toe game, Player X and \" +\r\n \"Player O try to \"\r\n puts \"outmaneuver each other by placing three Xs or \" +\r\n \"Os in a row \"\r\n puts \"horizontally, vertically, or diagonally. \" +\r\n \"Player X goes first first game, \"\r\n puts \"then starting players cycle. \"\r\n puts \"The game ends when either player claims three \" +\r\n \"squares in a \" \r\n puts \"row or when all nine squares have been claimed \" +\r\n \"without either \"\r\n puts \"player managing to claim three squares in a row.\"\r\n puts \"\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\"\r\n print \"Press Enter to continue, or M for Wikipedia instructions. \"\r\n\r\n userResponse = STDIN.gets #Collect the user's reponse\r\n userResponse.chop! #Remove the end of line marker\r\n userResponse = userResponse.upcase #Convert to uppercase\r\n\r\n if userResponse == \"M\"\r\n Console_Screen.cls #clears screen\r\n #loads wikipedia instructions for user in their browser\r\n system('start http://en.wikipedia.org/wiki/Tic_tac_toe')\r\n end \r\n \r\n end", "def program_start\n\t\tputs \"Let's play a round of Hangman!\"\n\t\tputs \"Would you like to start a new game or do want to load an old saved game lying around? Choose from:\"\n\t\tputs \"- New\"\n\t\tputs \"- Load\"\n\t\tstart_choice = gets.chomp.downcase\n\t\tputs \"\"\n\t\tif (start_choice == \"new\")\n\t\t\tstart_game(new_word)\n\t\telsif (start_choice == \"load\")\n\t\t\tload_game\n\t\telse\n\t\t\tputs \"Your input was invalid, program starting again...\\n\\n\"\n\t\t\tprogram_start\n\t\tend\n\tend", "def start\n\tset\n\tputs \"Let's play a game of Tic Tac Toe!\"\n\tputs \"What is your name Player 1?\"\n\tplayer1 = gets.chomp.capitalize\n\t@player1 = Player.new(player1, \"X\")\n\tputs \"Welcome #{@player1.name}, you'll be #{@player1.symbol} for this game.\"\n\tputs \"What is your name Player 2?\"\n\tplayer2 = gets.chomp.capitalize\n\t@player2 = Player.new(player2, \"O\")\n\tputs \"Welcome #{@player2.name}, you'll be #{@player2.symbol} for this game.\"\n\t@game = Game.new\n\t@game.display\nend", "def display_instructions\n\n\tConsole_Screen.cls #clear the display area\n\tputs \"INSTRUCTIONS:\\n\\n\" #display a heading\n\n\t#display the game's instrucitons\n\tputs \"This game ranomly generates a number from 1 to 1000 and\" \n\tputs \"challenges you to identify it in as few guesses as possible.\" \n\tputs \"After each guess, the game will analyze your input and provide\" \n\tputs \"you with feedback. You may take as many turns as you need in \" \n\tputs \"order to guess the game's secret number.\\n\\n\\n Good luck!\\n\\n\\n\" \n\tprint \"Press Enter to continue.\"\n\n\t Console_Screen.pause\n\n\tend", "def show_start_game(game)\n puts \"#{game.player1.name} is: #{game.player1.identity}\"\n puts \"#{game.player2.name} is: #{game.player2.identity}\"\n puts 'TIC TAC TOE.. start!'\nend", "def instructions\n system \"clear\"\n puts \"\n █░█ █▀█ █░█░█   ▀█▀ █▀█   █▀█ █░░ ▄▀█ █▄█\n █▀█ █▄█ ▀▄▀▄▀   ░█░ █▄█   █▀▀ █▄▄ █▀█ ░█░\".colorize(:red)\n puts \"\\n\\n\"\n puts \"A game will start with 12 red and 12 blue markers.\"\n puts \"Players will take turns moving their markers until 1 player runs out of markers, at which point the \"\n puts \"game is over and the player with markers remaining is the winner.\\n\\n\"\n puts \"Markers can be moved diagonally only. If your marker is blocked by a marked of the opposing player,\"\n puts \"this marker can be jumped providing there is an empty space behind the opposing marker.\"\n puts \"The aim is to jump over all opposing markers to win the game!\\n\\n\"\n puts \"Markers can only move in a forward direction, unless they are a king.\"\n puts \"King markers are represented by a 'K' on the gameboard.\"\n puts \"A king is created should you manage to direct your marker to the final board row in the direction you are moving.\"\n puts \"King markers are able to move both forwards and backwards.\\n\\n\"\n puts \"Players will be prompted to select a marker during their turn, via keyboard input.\"\n puts \"Each position on the gameboard is designated a specific position e.g. a1 or e7\"\n puts \"A marker and move position can be selected by inputting the gameboard position when prompted\"\n puts \"If the move is valid - it will be made and the board updated.\\n\\n\"\n \n # Return to main menu prompt\n return_prompt\nend", "def continue_game\n\t\thandle_no_set\n\t\tuntil @is_end\n\t\t\tshow_progress\n\t\t\tshow_hand\n\t\t\tuser_input = get_user_cards\n\t\t\tupdate user_input\n\t\t\thandle_no_set\n\t\tend\n\tend", "def run\n @user = \"\"\n welcome\n login_or_signup\n say_hi_to_user\n initial_menu \n end", "def start\n puts \"Welcome to Tic Tac Toe!\"\n puts \"\"\n define_players\n play\n end", "def helpdesk_start\n\t# Commented out for initial submission due to guest functionality not fully developed.\n\n\t# Clears terminal screen\n\t# system(\"clear\")\n\t# # Declare new instance of tty-prompt gem class\n\t# prompt = TTY::Prompt.new\n\t# # Declare variable of artii gem class\n\t# a = Artii::Base.new :font => 'slant'\n\t# # Print to screen program title screen with artii and colorize gem customization\n\t# puts a.asciify('OpenDesk').colorize(:green)\n\t# puts \"\\n---------------------------------------------\\n\\nWelcome to OpenDesk - the open source helpdesk app built using Ruby.\"\n\t# # Ask user for chosen input using tty-prompt menu selection\n\t# mode = prompt.select(\"\\nSelect a login option:\") do |menu|\n\t# \tmenu.choice 'Admin', 1\n\t# \tmenu.choice 'Guest', 2\n\t# end\n\t# Call a chosen method dependant on returned menu option\n\t# if mode == 1\n\t\t# admin_login_method\n\t# else\n\t# \tputs \"Guest Mode!\"\n\t# end\nend", "def start_game\n p = super\n cpu_move = pick_rps\n s = p.select(\"Your opponent throws #{cpu_move}. You throw:\", rpsArr) #Prompt Rc/Pp/Sc and wait for input\n winner?(win_hash[cpu_move.to_sym],s)\n end", "def run(name)\n\t\tprint %x{clear}\n\t\tputs \"Hi #{name}! Welcome to my Text Adventure App! There are currently 2 levels to\\nchoose from, Medium or Hard. The Medium option features a nice\\nhouse to walk through with easy questions. The Hard option features\\nan old castle dungeon setting with hard IQ questions.\"\n\t\tprint \"Which level would you like to choose? \"\n\t\tchoice = Input.new.begin_input\n\t\tlevel = @choices[choice]\n\t\tlevel.generate(name)\n\t\tnew_game(name)\n\tend", "def display_instructions\r\n\r\n Console_Screen.cls #Clear the display area\r\n puts \"INSTRUCTIONS:\\n\\n\" #Display a heading\r\n\r\n #Display the game's instructions\r\n puts \"This game pits the player against the computer. To play, you must\"\r\n puts \"enter one of the following moves when prompted: Rock, Paper, or\"\r\n puts \"Scissors.\\n\\n\"\r\n puts \"The game will randomly select a move for the computer, and \"\r\n puts \"the two moves will then be analyzed according to the following\"\r\n puts \"rules: \\n\\n\"\r\n puts \"* Rock crushes Scissors, Rock equals Rock, and Rock is covered by\"\r\n puts \" Paper.\\n\\n\"\r\n puts \"* Paper covers Rock, Paper equals Paper, and Paper is cut by\"\r\n puts \" Scissors.\\n\\n\"\r\n puts \"* Scissors cut Paper, Scissors equals Scissors, and Scissors are\"\r\n puts \" crushed by Rock.\\n\\n\\n\"\r\n puts \"Good luck!\\n\\n\\n\"\r\n print \"Press Enter to continue. \"\r\n Console_Screen.pause #Pause the game\r\n\r\n end", "def intro\n\tputs \"1--Load File\"\n\tputs \"2--New Game\"\n\tchoice = gets.chomp.to_i\n\tcase choice \n\twhen 1\n\t\tload()\n\twhen 2\n\tputs \"Hello Quester, what is your name?\"\n\t@user_name = gets.chomp\n\tputs \"Welcome \" + @user_name.to_s \n\tputs \"You have \" + @coin.to_s + \" coins.\"\n\tend\nend", "def run\n start_key = self.display_instructions\n exit if start_key.downcase == \"q\"\n self.play_round until @board.won? || @board.lost?\n @board.lost? ? self.display_loss : self.display_win\n end", "def instructions\n \n end", "def start_game\n instructions_board = Board.new\n\n puts \"\"\"\n Hello there! Welcome to Tic Tac Toe!\n - Player 1, your mark is 'X'.\n - Player 2, your mark is 'O'.\n\n Rules:\n - You will take turns marking the empty cells in the\n game board with your corresponding mark.\n - When prompted, type in the cell number that you want to\n place your mark in. The board below the instructions\n shows a sample board with the cell numbers.\n - The player that places 3 marks in a row on the board wins!\n\n Options\n - Type 'quit' at any point to quit the game.\n - Type 'restart' at any point to restart the game.\n \"\"\"\n puts\n instructions_board.print_instructions_board\n puts \n\n end", "def display_instructions\r\n\r\n Console_Screen.cls #Clear the display area\r\n puts \"INSTRUCTIONS:\\n\\n\" #Display a heading\r\n\r\n #Display the game's instructions\r\n puts \"This game randomly generates a word that is between five and ten \"\r\n puts \"characters long. It is up to you to guess the secret word! At the \"\r\n puts \"beginning of the game, you will be given the opportunity to choose \"\r\n puts \"five consonants and one vowel. If any of your letters match the \"\r\n puts \"letters in the secret word they will be revealed. All other characters\"\r\n puts \"will be displayed as an underscore. Choose wisely, because you’ll \"\r\n puts \"only get one guess at the secret word!\\n\\n\"\r\n puts \"Good luck!\\n\\n\\n\\n\\n\\n\\n\\n\\n\"\r\n print \"Press Enter to continue.\"\r\n\r\n Console_Screen.pause #Pause the game\r\n\r\n end", "def play_game\r\n\r\n word = select_word #Call on the method that retrieves a random word\r\n\r\n Console_Screen.cls #Clear the display area\r\n\r\n consonants = get_consonants #Call on the method that prompts the player\r\n #to enter a list of consonants\r\n\r\n Console_Screen.cls #Clear the display area\r\n\r\n #Call on the method that prompts the player to enter a vowel\r\n vowel = get_vowel\r\n\r\n #Remove blank spaces from the word to create a short version of the word\r\n shortWord = word.gsub(\" \", \"\")\r\n\r\n #Call the method that processes player guesses\r\n prompt_for_guess(shortWord, word, consonants, vowel)\r\n\r\n Console_Screen.cls #Clear the display area\r\n\r\n end", "def launch_program\n gametype = nil\n puts \"---Welcome to Hang-Man!---\"\n puts \"Anytime during the game you can write\"\n puts \"save\".colorize(:red) + \" or \" + \"quit\".colorize(:red)\n puts \"to either save or quit your game\"\n until gametype == \"newgame\" || gametype == \"load\"\n puts \"For a new game, type \" + \"newgame.\".colorize(:red)\n puts \"To load an old game, type \" + \"load.\".colorize(:red)\n gametype = gets.chomp.downcase\n if gametype == \"newgame\"\n game_start\n else\n load_game\n end\n end\n end", "def game_start\n puts \"Welcome to Blackjack! Please enter your name: \"\n # prompt user for players name\n player_name = gets.chomp\n puts \"hi, #{player_name}! the game started now. happy gaming! \"\n player_name\n end", "def start\n\n gamestart()\n\n puts \"Welcome to Lunar Lander!\"\n puts \"Are you ready to begin your adventure?\"\n puts \"\\n\"\n puts \"- Yes\"\n puts \"- No\"\n puts \"\\n\"\n\n print \"> \"\n start_game = $stdin.gets.chomp\n\n if start_game == \"Yes\" || start_game == \"yes\"\n launch()\n else\n puts \"Fine then.. keep your secrets.\"\n end\nend", "def game_start\n @computer.choose_word\n @board.create_board(@computer.word.length)\n Screen.clear\n game_loop\n end", "def start\n\t\tmessage = get_instructions + \"Enter which cell to shoot: \".cyan.bold\n\t\tmessage_norm = message\n\t\tmessage_arg_error = \"Please, enter only numbers between 1 and 10\".red.bold\n\t\tmessage_alert = message_arg_error + \"\\n\" + message\n\t\tbegin\n\t\t\tloop do\n\t\t\t\tdraw_game_field\n\t\t\t\tprint message\n\t\t\t\tmessage = message_norm\n\t\t\t\tcell = gets.chomp\n\t\t\t\traise Exception if cell == 'q'\n\t\t\t\tcell = Integer(cell)\n\t\t\t\traise ArgumentError unless cell.between?(1, 10)\n\t\t\t\t@human.move(cell, @computer.field)\n\t\t\t\t@computer.move(@human.field)\n\t\t\t\tdraw_game_field\n\t\t\t\tcheck_victory\n\t\t\tend\n\t\trescue ArgumentError => e\n\t\t\tmessage = message_alert\n\t\t\tputs message\n\t\t\tretry\n\t\trescue VictoryError => e\n\t\t\tputs e.message\n\t\t\texit 1\n\t\trescue StandardError => e\n\t\t\tretry\n\t\trescue Exception => e\n\t\t\texit_the_game\n\t\tend\n\tend", "def start\r\n\t\t\t@output.puts('Welcome to Connect 4!')\r\n\t\t\t@output.puts(\"Created by:#{created_by}\")\r\n\t\t\t@output.puts('Game started.')\r\n\t\t\t@output.puts(\"Player 1: O and Player 2: X\")\r\n\t\t\t@output.puts(\"Enter column number to place token.\")\r\n\t\tend", "def start\n puts \"We have new challengers! Welcome #{@player_1.name} and #{@player_2.name}!\"\n turn\n end", "def play\n\t\tputs intro\n\t\tsection_completed = false\n\t\twhile section_completed == false do\n\t\t\tprompt\n\t\t\taction = gets.chomp.downcase #action from users\n\t\t\t\n\t\t\tif action.include? \"overworld\"\n\t\t\t\tsection_completed = true\n\t\t\t\tputs \"You decide to start at Overworld. Good luck Mario!\"\n\t\t\t\tnew_overworld = Overworld.new #create new object of Overworld\n\t\t\t\tnew_overworld.play # call play Overworld!\n\t\t\t\t\n\t\t\telsif action.include? \"suicide\"\n\t\t\t\tputs \"You get nervouse.. It's too big for you to do it all alone!!\"\n\t\t\t\tsuicide\n\t\t\telsif action == \"\"\n\t\t\t\tno_action\n\t\t\telse\n\t\t\t\twrong_input\n\t\t\tend\n\t\t\t\n\t\tend #end of while loop\n\tend", "def launch_battle\n puts \"\\n\"\n puts \"Que le combat commence!\"\n puts \"\\n\"\n end", "def play\r\n display_welcome_message\r\n human_choose_move\r\n computer_choose_move\r\n display_winner\r\n display_goodbye_message\r\nend", "def start\n @win_state = CHECK # clear out win_state for new games\n get_player_name\n deck.deal_hand(players)\n show_flops\n player_turn\n dealer_turn\n check_winner\n play_again?\n end", "def new_game\n\n enter_name\n nter_name\n user_name = gets.chomp\n current_user = find_or_add_user(user_name)\n space\n element = prompt.select('What is your element?', [\"Water\", \"Earth\", \"Air\"])\n current_user.update(element: element)\n space\n space\n\n ### intro method ###\n\nend", "def start_new_game\n\n if @level == 3 #if max level, choose new type\n @level = 0\n @type = choose_type\n puts \"Great job, #{@player.name}! Now try to evolve a #{@type} type pokémon.\"\n end\n @secret_word = Faker::Pokemon.name.upcase\n @user_progress = Array.new(@secret_word.length,\"_\")\n @character = @@characters[@type][@level]\n @scenes = @@scenes[@type][@level]\n @color = @@colors[@type]\n @current_index = 0\n @bad_guesses = []\n @remaining_guesses = 5\n puts \"You're at level #{@level+1}\"\n end", "def intro\r\n clear # execute method clear to clear screen and place logo\r\n puts ' \"I cant stand the rain!!\" '\r\n puts ' Welcome to GK Rainfall collection application'\r\n puts ' Version 0.205'\r\n puts ' Hit enter to continue'\r\n gets\r\n end", "def start_game\n #present the start button and title and image\n @stack = @shoes.stack left: 200 do\n @prompt = @shoes.title( \"Blackjack\",\n stroke: $WHITE,\n align: \"center\")\n @author = @shoes.para( \"By: Thomas Tracy\",\n stroke: $WHITE,\n align: \"center\")\n @toBegin = @shoes.title( \"Click the cards to begin!\",\n stroke: $WHITE,\n align: \"center\")\n @splashImage = @shoes.image(\"View_application/blackjack_splash.png\").move( 350, 250)\n\n #once the start button is clicked, remove the splash and start the game\n @splashImage.click do\n #remove splash\n @stack.clear\n @splashImage.clear\n #create the game view\n newGame = GameView.new(@shoes)\n newGame.create_gameView\n end #end click\n end #end stack\n end", "def play_game_with_user_as_codebreaker\n @display.welcome_message_for_user_as_codebreaker\n generate_secret_code\n collect_first_guess_and_provide_feedback\n let_the_user_provide_successive_guesses_and_provide_feedback\n end", "def main_menu\n menu_options = [\"Start exploring\", \"Check Inventory\", \"Check Your Score\", \"Go to Pokemon Center\", \"Quit\"]\n menu_prompt = Interactivity.mainMenu \n \n if user.pokemon == nil\n menu_options.shift()\n menu_options.unshift(\"Choose a Pokemon and start exploring\")\n elsif self.user_current_location\n menu_options.shift()\n menu_options.unshift(\"Keep Exploring\")\n end\n \n choice = prompt.select(menu_prompt, menu_options) \n if choice == \"Start exploring\" || choice == \"Choose a Pokemon and start exploring\" || choice == \"Keep Exploring\"\n self.trainer_chooses_pokemon if user.pokemon == nil \n self.trainer_chooses_town\n self.exploring_town\n elsif choice == \"Check Inventory\"\n puts \"MANAGE INVENTORY - CHANGE POKEMONS AROUND\"\n elsif choice == \"Go to Pokemon Center\"\n self.pokemon_center\n elsif choice == \"Check Your Score\"\n puts \"CHECK YOUR SCORE\"\n else\n Interactivity.quit\n end\n end", "def start_program\n try_load_students\n interactive_menu\nend", "def init()\n # Splash screen\n splash = ConsoleSplash.new(25,88)\n splash.write_header(\"Flood-It\", \"Huzaifa Ahmed\", \"1.0\")\n splash.write_center(-3, \"<Press enter to continue>\")\n splash.write_horizontal_pattern(\"*\")\n splash.write_vertical_pattern(\"*\")\n splash.splash\n\n # Press enter to continue\n gets\n\n # Load the main menu\n display_menu\nend" ]
[ "0.7556367", "0.74413836", "0.7122011", "0.71200407", "0.7097632", "0.7087768", "0.7079253", "0.7068617", "0.6982634", "0.69703656", "0.69608283", "0.693086", "0.69282895", "0.69154066", "0.69058895", "0.6900777", "0.68729407", "0.6870282", "0.6855094", "0.6850385", "0.680683", "0.6799118", "0.6795291", "0.6792337", "0.6783006", "0.67552876", "0.6749754", "0.674427", "0.67302585", "0.67291796", "0.6706147", "0.66989213", "0.6694071", "0.6672256", "0.66665804", "0.66348475", "0.6631505", "0.66185206", "0.66130567", "0.661087", "0.6606122", "0.65997696", "0.65925777", "0.65907973", "0.65773416", "0.6567563", "0.6550733", "0.65464175", "0.6531546", "0.6523099", "0.6521858", "0.6519917", "0.65191543", "0.65143764", "0.6511745", "0.65013826", "0.64969724", "0.6481703", "0.648151", "0.64796746", "0.6476859", "0.64751256", "0.6473887", "0.647355", "0.6463648", "0.6462711", "0.6447299", "0.64465433", "0.6438342", "0.64324987", "0.64303815", "0.64298457", "0.6425886", "0.6408397", "0.6398648", "0.6388433", "0.6386848", "0.638665", "0.6381837", "0.63697433", "0.6367359", "0.6363158", "0.63612586", "0.63592213", "0.63559943", "0.63523024", "0.6351523", "0.6349339", "0.63359857", "0.63354236", "0.6322646", "0.63197064", "0.63152575", "0.6310703", "0.6308315", "0.6301474", "0.6290867", "0.6289669", "0.62882084", "0.6286436", "0.62852776" ]
0.0
-1
When a user hovers over a button draw a border
def draw_border(x1, y) if @function_UI.mouse_over_button(mouse_x, mouse_y) draw_line(x1, y, Gosu::Color::BLUE, x1+60, y, Gosu::Color::BLUE, ZOrder::TOP, mode=:default) draw_line(x1, y+35, Gosu::Color::BLUE, x1+60, y+35, Gosu::Color::BLUE, ZOrder::TOP, mode=:default) draw_line(x1, y,Gosu::Color::BLUE, x1, y+35, Gosu::Color::BLUE, ZOrder::TOP, mode=:default) draw_line(x1+60, y,Gosu::Color::BLUE, x1+60, y+35, Gosu::Color::BLUE, ZOrder::TOP, mode=:default) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_border(x1, y, mouse_x, mouse_y)\r\n if @function_UI.mouse_over_button(mouse_x, mouse_y)\r\n draw_line(x1, y, Gosu::Color::BLUE, x1+60, y, Gosu::Color::BLUE, ZOrder::TOP, mode=:default)\r\n draw_line(x1, y+35, Gosu::Color::BLUE, x1+60, y+35, Gosu::Color::BLUE, ZOrder::TOP, mode=:default)\r\n draw_line(x1, y,Gosu::Color::BLUE, x1, y+35, Gosu::Color::BLUE, ZOrder::TOP, mode=:default)\r\n draw_line(x1+60, y,Gosu::Color::BLUE, x1+60, y+35, Gosu::Color::BLUE, ZOrder::TOP, mode=:default)\r\n end \r\n end", "def primary_button_hover_border_color\n darken_color(primary_button_border_color, 0.12)\n end", "def bordered; self.border = true; self; end", "def tick_button_prefab button\n outputs.labels << button.label # outputs button's label and border\n outputs.borders << button.border\n\n if button_clicked? button # if button is clicked\n button.clicked_at = inputs.mouse.click.created_at # stores the time that the button was clicked\n end\n\n if button.clicked_at # if clicked_at has a frame value and is not nil\n # button is output; color changes and transparency changes for 0.25 seconds after click occurs\n outputs.solids << [button.border.x, button.border.y, button.border.w, button.border.h,\n 0, 180, 80, 255 * button.clicked_at.ease(0.25.seconds, :flip)] # transparency changes for 0.25 seconds\n end\n end", "def border; end", "def primary_button_active_border_color\n darken_color(primary_button_border_color, 0.12)\n end", "def primary_button_focus_border_color\n darken_color(primary_button_border_color, 0.25)\n end", "def start_border(info = '')\n draw_border(:top, info)\n end", "def update\n \n if(isOverButton)\n @hover = true\n else\n @hover = false\n end\n \n if(@clicked)\n @clicked = false\n @hover = false\n return true\n end\n \n return false\n end", "def primary_button_border_color\n @primary_button_border ||= darken_color(primary_button_background_color, 0.05)\n end", "def button_down(id)\n case id\n when Gosu::MsLeft\n @locs = [mouse_x, mouse_y]\n if mouse_over_button(mouse_x, mouse_y)\n @background = Gosu::Color::YELLOW\n elsif mouse_over_button(mouse_x, mouse_y) == false\n @background = Gosu::Color::WHITE\n end\n end\n end", "def mouse_over?(mouse_x, mouse_y)\n mouse_x >= x - Const::BORDER_GAP &&\n mouse_x <= x + @width + Const::BORDER_GAP &&\n mouse_y >= y - Const::BORDER_GAP &&\n mouse_y <= y + @font.height + Const::BORDER_GAP\n end", "def draw_borders\n if borders.top > 0 # TODO: :none\n options = translate( x: margins.left, y: margins.top ).merge( width: width + margins.width, height: borders.top, foreground: borders.foreground, background: Termbox::RED )\n \n pencil.draw_rectangle( options )\n end\n \n if borders.bottom > 0 # TODO: :none\n options = translate( x: margins.left, y: offsets.top + padding.bottom ).merge( width: width + margins.width, height: borders.bottom, foreground: borders.foreground, background: Termbox::RED )\n \n pencil.draw_rectangle( options )\n end\n end", "def hover_event(element)\n # replaces element colour with overlay only\n # while mouse over\n element.colour = OVERLAY\nend", "def button_tech_demo\n x, y, w, h = 460, 160, 300, 50\n state.button ||= state.new_entity(:button_with_fade)\n\n # Adds w.half to x and h.half + 10 to y in order to display the text inside the button's borders.\n state.button.label ||= [x + w.half, y + h.half + 10, \"click me and watch me fade\", 0, 1]\n state.button.border ||= [x, y, w, h]\n\n if inputs.mouse.click && inputs.mouse.click.point.inside_rect?(state.button.border) # if mouse is clicked, and clicked inside button's border\n state.button.clicked_at = inputs.mouse.click.created_at # stores the time the click occurred\n end\n\n outputs.labels << state.button.label\n outputs.borders << state.button.border\n\n if state.button.clicked_at # if button was clicked (variable has a value and is not nil)\n\n # The appearance of the button changes for 0.25 seconds after the time the button is clicked at.\n # The color changes (rgb is set to 0, 180, 80) and the transparency gradually changes.\n # Change 0.25 to 1.25 and notice that the transparency takes longer to return to normal.\n outputs.solids << [x, y, w, h, 0, 180, 80, 255 * state.button.clicked_at.ease(0.25.seconds, :flip)]\n end\n end", "def border!\n border do\n # adds default border\n end\n end", "def clicked\n @callback.call if mouse_over?\n end", "def add_border_mark(sexp)\n def sexp.inline_border?\n true\n end \n end", "def button_clicked? button\n inputs.mouse.click && inputs.mouse.click.point.inside_rect?(button.border)\n end", "def create_extra_buttons()\n Rectangle.new(x:5,y:50,width:40,height:40,color:\"white\",z:1)\n Rectangle.new(x:16,y:66,width:18,height:9,color:\"#ff7eec\",z:1)\n Rectangle.new(x:5,y:100,width:40,height:40,color:\"white\",z:1)\n Rectangle.new(x:14,y:110,width:21,height:25,color:'#808080',z:1)\n Rectangle.new(x:14,y:110,width:21,height:5,color:'blue',z:1)\n Rectangle.new(x:5,y:150,width:40,height:40,color:\"white\",z:1)\n Triangle.new(x1:15,x2:35,x3:25,y1:180,y2:180,y3:160,color:\"black\",z:1)\n Rectangle.new(x:5,y:200,width:40,height:40,color:\"white\",z:1)\n Triangle.new(x1:15,x2:35,x3:25,y1:210,y2:210,y3:230,color:\"black\",z:1)\nend", "def curatorMouseOver \n \"curatorMouseOver\" \n end", "def mouse_over_button(mouse_x, mouse_y)\r\n if ((mouse_x >= (SCREEN_WIDTH/3) + 100 and mouse_x <= (SCREEN_WIDTH/3) + 160) and (mouse_y >= 300 and mouse_y <= 345)) \r\n return true\r\n else\r\n return false\r\n end\r\n end", "def border(&block)\n return '' unless block_given?\n\n border_on + yield + border_off\n end", "def point_to_rect_tech_demo\n x = 460\n\n outputs.labels << small_label(x, 15, \"Click inside the blue box maybe ---->\")\n\n box = [765, 370, 50, 50, 0, 0, 170] # blue box\n outputs.borders << box\n\n if state.last_mouse_click # if the mouse was clicked\n if state.last_mouse_click.point.inside_rect? box # if mouse clicked inside box\n outputs.labels << small_label(x, 16, \"Mouse click happened inside the box.\")\n else # otherwise, if mouse was clicked outside the box\n outputs.labels << small_label(x, 16, \"Mouse click happened outside the box.\")\n end\n else # otherwise, if was not clicked at all\n outputs.labels << small_label(x, 16, \"Mouse click has not occurred yet.\") # output if the mouse was not clicked\n end\n\n # border around mouse input demo section\n outputs.borders << [455, row_to_px(14), 360, row_to_px(11).shift_up(5) - row_to_px(14)]\n end", "def borders_tech_demo\n outputs.labels << [ 5, 260, \"Borders (x, y, w, h, r, g, b, a)\"]\n outputs.borders << [ 10, 180, 50, 50]\n outputs.borders << [ 70, 180, 50, 50, 0, 0, 0]\n outputs.borders << [130, 180, 50, 50, 255, 0, 0]\n outputs.borders << [190, 180, 50, 50, 255, 0, 0, 128]\n outputs.borders << [250, 180, 50, 50, 0, 0, 0, 128 + state.tick_count % 128] # transparency changes\n end", "def new_button_prefab x, y, message\n w, h = 300, 50\n button = state.new_entity(:button_with_fade)\n button.label = [x + w.half, y + h.half + 10, message, 0, 1] # '+ 10' keeps label's text within button's borders\n button.border = [x, y, w, h] # sets border definition\n button\n end", "def setbordercolorind(*)\n super\n end", "def update\n if mouse_over?\n @color = Const::MENU_ITEM_MO_CLR\n else\n @color = Const::MENU_ITEM_CLR\n end\n end", "def mouse_in(e)\n @state = :hover\n end", "def add_border(element, color=border_color, size=1)\n element.add_renderables(\n create_border(0, 0, element.w, element.h, color, size)\n )\n end", "def create_color_buttons()\n Rectangle.new(x:5,y:450,width:45,height:45,color:'red',z:1)\n Rectangle.new(x:55,y:450,width:45,height:45,color:'orange',z:1)\n Rectangle.new(x:105,y:450,width:45,height:45,color:'yellow',z:1)\n Rectangle.new(x:155,y:450,width:45,height:45,color:'green',z:1)\n Rectangle.new(x:205,y:450,width:45,height:45,color:'blue',z:1)\n Rectangle.new(x:255,y:450,width:45,height:45,color:'#EE82EE',z:1)\n Rectangle.new(x:305,y:450,width:45,height:45,color:'black',z:1)\n Rectangle.new(x:355,y:450,width:45,height:45,color:'#808080',z:1)\n Rectangle.new(x:405,y:450,width:45,height:45,color:'white',z:1)\nend", "def end_border(info = '')\n draw_border(:bottom, info)\n end", "def bottom_border_stroke\n line_stroke(\n settings.border.style.bottom_left,\n settings.border.style.bottom_junc,\n settings.border.style.bottom_right\n ) do\n settings.border.style.bottom_horiz * (dimensions.inner_grid_width + (settings.scrollbar.vert? ? 1 : 0))\n end\n end", "def mouse_button\n mouse_state.image\n end", "def primary_button_hover_background_color\n darken_color(primary_button_background_color, 0.1)\n end", "def prv_print_border_only row, col, height, width, color, att=Ncurses::A_NORMAL\n att ||= Ncurses::A_NORMAL\n case att.to_s.downcase\n when 'normal'\n att = Ncurses::A_NORMAL\n when 'underline'\n att = Ncurses::A_UNDERLINE\n when 'bold'\n att = Ncurses::A_BOLD\n when 'blink'\n att = Ncurses::A_BLINK # unlikely to work\n when 'reverse'\n att = Ncurses::A_REVERSE \n end\n attron(Ncurses.COLOR_PAIR(color) | att)\n mvwaddch row, col, ACS_ULCORNER\n mvwhline( row, col+1, ACS_HLINE, width-2)\n mvwaddch row, col+width-1, Ncurses::ACS_URCORNER\n mvwvline( row+1, col, ACS_VLINE, height-1)\n\n mvwaddch row+height-0, col, Ncurses::ACS_LLCORNER\n mvwhline(row+height-0, col+1, ACS_HLINE, width-2)\n mvwaddch row+height-0, col+width-1, Ncurses::ACS_LRCORNER\n mvwvline( row+1, col+width-1, ACS_VLINE, height-1)\n attroff(Ncurses.COLOR_PAIR(color) | att)\n end", "def repaint # button\n\n #@bgcolor ||= $def_bg_color\n #@color ||= $def_fg_color\n $log.debug(\"BUTTON repaint : #{self} r:#{@row} c:#{@col} , #{@color} , #{@bgcolor} , #{getvalue_for_paint}\" )\n r,c = @row, @col #rowcol include offset for putting cursor\n # NOTE: please override both (if using a string), or else it won't work \n # These are both colorpairs not colors ??? 2014-05-31 - 11:58 \n _highlight_color = @highlight_color || $reversecolor\n _highlight_bgcolor = @highlight_bgcolor || 0\n _bgcolor = bgcolor()\n _color = color()\n if @state == :HIGHLIGHTED\n _bgcolor = @state==:HIGHLIGHTED ? _highlight_bgcolor : _bgcolor\n _color = @state==:HIGHLIGHTED ? _highlight_color : _color\n elsif selected? # only for certain buttons lie toggle and radio\n _bgcolor = @selected_bgcolor || _bgcolor\n _color = @selected_color || _color\n end\n $log.debug \"XXX: button #{text} STATE is #{@state} color #{_color} , bg: #{_bgcolor} \"\n if _bgcolor.is_a?( Integer) && _color.is_a?( Integer)\n # i think this means they are colorpairs not colors, but what if we use colors on the 256 scale ?\n # i don;t like this at all. \n else\n _color = get_color($datacolor, _color, _bgcolor)\n end\n value = getvalue_for_paint\n $log.debug(\"button repaint :#{self} r:#{r} c:#{c} col:#{_color} bg #{_bgcolor} v: #{value} ul #{@underline} mnem #{@mnemonic} datacolor #{$datacolor} \")\n len = @width || value.length\n @graphic = @form.window if @graphic.nil? ## cell editor listbox hack \n @graphic.printstring r, c, \"%-*s\" % [len, value], _color, attr()\n# @form.window.mvchgat(y=r, x=c, max=len, Ncurses::A_NORMAL, bgcolor, nil)\n # in toggle buttons the underline can change as the text toggles\n if @underline || @mnemonic\n uline = @underline && (@underline + @text_offset) || value.index(@mnemonic) || \n value.index(@mnemonic.swapcase)\n # if the char is not found don't print it\n if uline\n y=r #-@graphic.top\n x=c+uline #-@graphic.left\n #\n # NOTE: often values go below zero since root windows are defined \n # with 0 w and h, and then i might use that value for calcaluting\n #\n $log.error \"XXX button underline location error #{x} , #{y} \" if x < 0 or c < 0\n raise \" #{r} #{c} #{uline} button underline location error x:#{x} , y:#{y}. left #{@graphic.left} top:#{@graphic.top} \" if x < 0 or c < 0\n @graphic.mvchgat(y, x, max=1, Ncurses::A_BOLD|Ncurses::A_UNDERLINE, _color, nil)\n end\n end\n end", "def repaint # tabbedbutton\n $log.debug(\"TabbedBUTTon repaint : #{self.class()} r:#{@row} c:#{@col} #{getvalue_for_paint}\" )\n r,c = rowcol\n attribs = @attrs\n @highlight_foreground ||= $reversecolor\n @highlight_background ||= 0\n _state = @state\n _state = :SELECTED if @variable.value == @value \n case _state\n when :HIGHLIGHTED\n $log.debug(\"TabbedBUTTon repaint : HIGHLIGHTED #{bgcolor}, #{color}, v: #{@value}\" )\n bgcolor = @highlight_background\n color = @highlight_foreground\n bgcolor = @bgcolor\n color = @color\n attribs = Ncurses::A_BOLD\n setrowcol r,c # show cursor on highlighted as we tab through\n ## but when tabbing thru selected one, then selected one doesn't show cursor\n when :SELECTED\n $log.debug(\"TabbedBUTTon repaint : SELECTED #{bgcolor}, #{color}\")\n bgcolor = @bgcolor\n color = @color\n attribs = Ncurses::A_REVERSE\n if @state == :HIGHLIGHTED\n setrowcol r,c # show cursor on highlighted as we tab through\n end\n else\n $log.debug(\"TabbedBUTTon repaint : ELSE #{bgcolor}, #{color}\")\n bgcolor = @bgcolor\n color = @color\n end\n #bgcolor = @state==:HIGHLIGHTED ? @highlight_background : @bgcolor\n #color = @state==:HIGHLIGHTED ? @highlight_foreground : @color\n if bgcolor.is_a? String and color.is_a? String\n color = ColorMap.get_color(color, bgcolor)\n end\n value = getvalue_for_paint\n $log.debug(\"button repaint : r:#{r} #{@graphic.top} c:#{c} #{@graphic.left} color:#{color} bg #{bgcolor} v: #{value}, g: #{@graphic} \")\n len = @display_length || value.length\n # paint the tabs name in approp place with attribs\n #@form.window.printstring r, c, \"%-*s\" % [len, value], color, attribs\n #@graphic.printstring r+@graphic.top, c+@graphic.left, \"%-*s\" % [len, value], color, attribs\n #@graphic.printstring r-@graphic.top, c-@graphic.left, \"%-*s\" % [len, value], color, attribs\n @graphic.printstring r, c, \"%-*s\" % [len, value], color, attribs\n @graphic.modified = true\n# @form.window.mvchgat(y=r, x=c, max=len, Ncurses::A_NORMAL, bgcolor, nil)\n # underline for the top tab buttons.\n if @underline != nil\n r -= @graphic.top # because of pad, remove if we go back to windows\n c -= @graphic.left # because of pad, remove if we go back to windows\n @graphic.mvchgat(y=r, x=c+@underline+0, max=1, Ncurses::A_BOLD|Ncurses::A_UNDERLINE, color, nil)\n end\n end", "def border\n puts \"--------------------------------\".center(75)\nend", "def border!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 37 )\n\n type = BORDER\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 367:9: 'border'\n match( \"border\" )\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__, 37 )\n\n end", "def render_border(screen)\n border ? screen.box(abs_x, abs_y, abs_width, abs_height, border.style, border_style) : ''\n end", "def mouse_over locator\r\n command 'mouseOver', locator\r\n end", "def mouse_over locator\r\n command 'mouseOver', locator\r\n end", "def colour_border(x, y, new_colour, border_colour)\n @image.content[x][y] = border_colour if (@image.content[x][y] != new_colour) &&\n (@image.content[x][y] == @background_color)\n end", "def render_mouse_crosshairs args, mouse\n return unless args.state.show_gridlines\n args.labels << [10, 25, \"mouse: #{mouse.x} #{mouse.y}\", 255, 255, 255]\nend", "def draw_border(x, y, border_colour)\n original_colour = @image.content[x-1][y-1]\n temp_colour = '.'\n\n fill_region(x, y, temp_colour, nil, border_colour)\n\n @image.content.map { |column| column.map! { |colour| colour == temp_colour ? original_colour : colour } }\n @image\n end", "def onClick(block=nil)\n temp=@color\n @gtkObject.signal_connect(\"button_release_event\") { |_, event|\n if event.button==Click::LEFT\n Thread.new{\n sleep(0.5)\n if !@gtkObject.mapped?\n @gtkObject.window.set_cursor(Click::CURSOROUT) unless @gtkObject.window == nil\n @color=temp\n apply\n end\n }\n yield\n end\n }\n self\n end", "def draw_outline color: 'red'\n @canvas.rect(\n x: @left,\n y: @top,\n width: width,\n height: height,\n style: \"stroke: #{color}; fill: none\"\n )\n end", "def print_border_mb row, col, height, width, color, attr\n mvwaddch row, col, ACS_ULCORNER\n mvwhline( row, col+1, ACS_HLINE, width-6)\n mvwaddch row, col+width-5, Ncurses::ACS_URCORNER\n mvwvline( row+1, col, ACS_VLINE, height-4)\n\n mvwaddch row+height-3, col, Ncurses::ACS_LLCORNER\n mvwhline(row+height-3, col+1, ACS_HLINE, width-6)\n mvwaddch row+height-3, col+width-5, Ncurses::ACS_LRCORNER\n mvwvline( row+1, col+width-5, ACS_VLINE, height-4)\n end", "def top_border_stroke\n line_stroke(\n settings.border.style.top_left,\n settings.border.style.top_junc,\n settings.border.style.top_right\n ) do\n settings.border.style.top_horiz * (dimensions.inner_grid_width + (settings.scrollbar.vert? ? 1 : 0))\n end\n end", "def on_button(b, evnt, coords)\n #puts \"B#{b} #{evnt}, #{coords}\"\n end", "def setBorderColor\n return if @coloration[:border].nil?\n ciColor = CIColor.alloc.initWithColor(MEalert.getColor(@coloration[:border]))\n cgColor = CGColorCreate(ciColor.colorSpace, ciColor.components)\n @accessory.wantsLayer = true\n @accessory.layer.borderColor = cgColor\n @accessory.layer.borderWidth = 1\n end", "def under_point?(mouse_x, mouse_y)\n border.contains?(mouse_x, mouse_y)\n end", "def border\n '+' + ('-' * @max_y) + '+'\n end", "def left_button_up(sender, selector, event)\n @canvas.ungrab\n @mouse_down = false\n flush_commands\n board_draw\n end", "def mouse_clicked\n super\n ring_size = random(50, 150)\n rings << Ring.new(:x => mouseX, :y => mouseY, :width => ring_size, :height => ring_size, :length => random(24, 48).to_i)\n end", "def draw\n # Draw background color\n Gosu.draw_rect(0, 0, WIN_WIDTH, WIN_HEIGHT, @background, ZOrder::BACKGROUND, mode=:default)\n # Draw the button\n Gosu.draw_rect(50, 50, 100, 50, Gosu::Color::GREEN, ZOrder::MIDDLE, mode=:default)\n # Draw the button text\n @button_font.draw(\"Click me\", 65, 65, ZOrder::TOP, 1.0, 1.0, Gosu::Color::BLACK)\n # Draw the mouse position information\n @info_font.draw(\"mouse_x: #{@locs[0]}\", 0, 350, ZOrder::TOP, 1.0, 1.0, Gosu::Color::BLACK)\n end", "def Pager_SetBorder(hwnd, iBorder) send_pager_message(hwnd, :SETBORDER, lparam: iBorder) end", "def stroke_paint(paint)\n end", "def border?\n name == 'border'\n end", "def setup_border_windows(name, window)\n # Set black and white color pair\n window.attron(Curses.color_pair(8))\n name = name.to_s\n\n # Apply box border to window with pipe and dash symbols\n window.box('|', '-')\n\n # Set curser position to the middle of the top border and add name of box\n window.setpos(0, (window.maxx / 2.0).ceil - (name.length / 2.0).ceil)\n window.addstr(name.upcase)\n\n window.noutrefresh\nend", "def print_border_mb row, col, height, width, color, attr\n # the next is for xterm-256 \n att = get_attrib attr\n len = width\n len = Ncurses.COLS-0 if len == 0\n # print a bar across the screen \n #attron(Ncurses.COLOR_PAIR(color) | att)\n # this works for newmessagebox but not for old one.\n # Even now in some cases some black shows through, if the widget is printing spaces\n # such as field or textview on a messagebox.\n # 2016-01-14 - replacing 1 with space since junk is showing up in some cases.\n space_char = \" \".codepoints.first\n (row-1).upto(row+height-1) do |r|\n # this loop clears the screen, printing spaces does not work since ncurses does not do anything\n mvwhline(r, col, space_char, len)\n end\n #attroff(Ncurses.COLOR_PAIR(color) | att)\n\n mvwaddch row, col, Ncurses::ACS_ULCORNER\n mvwhline( row, col+1, Ncurses::ACS_HLINE, width-6)\n mvwaddch row, col+width-5, Ncurses::ACS_URCORNER\n mvwvline( row+1, col, Ncurses::ACS_VLINE, height-4)\n\n mvwaddch row+height-3, col, Ncurses::ACS_LLCORNER\n mvwhline(row+height-3, col+1, Ncurses::ACS_HLINE, width-6)\n mvwaddch row+height-3, col+width-5, Ncurses::ACS_LRCORNER\n mvwvline( row+1, col+width-5, Ncurses::ACS_VLINE, height-4)\n end", "def draw\n @status_buttons.each do |i|\n i.draw\n end\n end", "def add_border(cell_ref, edges = :all)\n cells = self[cell_ref]\n BorderCreator.new(self, cells, edges).draw\n end", "def draw_edge\n print \"|\"\n end", "def highlight(set_or_clear )\r\n\r\n if set_or_clear == :set\r\n begin\r\n @original_border = @o.border.to_i\r\n if @o.border.to_i==1\r\n @o.border = 2\r\n else\r\n @o.border=1\r\n end\r\n rescue\r\n @original_border = nil\r\n end\r\n else\r\n begin \r\n @o.border= @original_border unless @original_border == nil\r\n @original_border = nil\r\n rescue\r\n # we could be here for a number of reasons...\r\n ensure\r\n @original_border = nil\r\n end\r\n end\r\n super \r\n end", "def on_button_down(button_id, point)\n end", "def highlight\n\t\tpushStyle\n\t\t\tno_stroke\n\t\t\tfill 14, 70, 70\n\t\t\tellipse(@node_x, @node_y, @@node_size + @@expand, @@node_size + @@expand)\n\t\tpopStyle\n\tend", "def gift_card_for_business_button\n\t\t$tracer.trace(__method__)\n\t\treturn ToolTag.new(a.id(\"/blueLinkUnderline/\"), __method__, self)\n end", "def drawarrow(*)\n super\n end", "def game_over\n @scene.window.cursor = true\n x = 0\n y = @scene.height * 0.3\n x1 = 0\n x2 = @scene.width\n y1 = @scene.height * 0.3\n y2 = @scene.height * 0.6\n draw_window(x, y, x1, x2, y1, y2, @game_over_img)\n\n load_gm_btns unless @no_button && @yes_button\n\n @no_button.draw\n @yes_button.draw\n end", "def on_button_up(button_id, point)\n end", "def go\n update\n borders\n display\n end", "def left_button_down(sender, selector, event)\n @canvas.grab\n @mouse_down = true\n end", "def add_border(size=3,r=0,g=0,b=0)\n width = @x_size+2*size\n height = @y_size+2*size\n resampled = image_create_true_color(width,height)\n image_filled_rectangle(resampled,0,0,width,height, r, g, b)\n image_copy(@picture,resampled,size,size,0,0,@x_size,@y_size)\n image_destroy(@picture)\n @x_size = width\n @y_size = height\n @picture = image_create_true_color(@x_size,@y_size)\n image_filled_rectangle(@picture,0,0,@x_size,@y_size,255,255,255)\n image_color_transparent(@picture,255,255,255)\n image_copy(resampled,@picture,0,0,0,0,@x_size,@y_size)\n end", "def place_button(x, y, message)\r\n Gosu.draw_rect(x, y, 70, 45, Gosu::Color::GREEN, ZOrder::MIDDLE, mode=:default)\r\n @button_font.draw_text(message, x+5, y+10, ZOrder::TOP, 1.0, 1.0, Gosu::Color::BLACK)\r\n end", "def highlight_element(element)\n execute_script(\"arguments[0].style.border='3px solid red'\", element)\n end", "def border\n \"#{BORDER}\\n #{self.align_center} \\n#{BORDER}\"\n end", "def buttons; end", "def hover\n root_node.hover\n end", "def TreeView_SetBorder(hwnd, dwFlags, xBorder, yBorder)\r\n send_treeview_message(hwnd, :SETBORDER, wparam: dwFlags, lparam: MAKELPARAM(xBorder, yBorder))\r\n end", "def print_borders #:nodoc:\n width = @width\n height = @height-1 # 2010-01-04 15:30 BUFFERED HEIGHT\n window = @graphic # 2010-01-04 12:37 BUFFERED\n startcol = @col \n startrow = @row \n #@color_pair = get_color($datacolor)\n bordercolor = @border_color || $datacolor\n borderatt = @border_attrib || Ncurses::A_NORMAL\n\n window.print_border startrow, startcol, height, width, bordercolor, borderatt\n print_title\n end", "def border=(_arg0); end", "def brew_button_status; end", "def paint_border(options = HashWithIndifferentAccess.new)\n options.reverse_merge! theme[:border] if theme[:border]\n options[:style] = :none if options[:style].nil?\n return if options[:style] == :none\n\n # first we need a stencil\n d = Magick::Draw.new\n theme.apply_to(d)\n d.fill(\"white\")\n d.stroke(\"transparent\")\n paint_border!(options[:style], d)\n stencil = Magick::Image.new(width, height)\n stencil.matte_reset!\n d.draw(stencil)\n\n # now we place the graphics context over the stencil, causing any areas blocked (transparent pixels) by the stencil\n # to be blocked in the graphics context\n stencil.composite!(graphics_context, 0, 0, AtopCompositeOp)\n\n # then we need to retrace the border, this time using the colors we want\n d = Magick::Draw.new\n theme.apply_to(d)\n d.fill(theme[:background][:color]) if theme[:background] and theme[:background][:color]\n d.stroke(options[:color] || theme[:stroke][:color]) if options[:color] || (theme[:stroke] && theme[:stroke][:color])\n paint_border!(options[:style], d)\n\n # finally, we can composite the stencil (which is now the actual image) back into the graphics context (which is\n # useless), and then commit the border to the finished product.\n graphics_context.composite!(stencil, 0, 0, CopyCompositeOp)\n d.draw(graphics_context)\n end", "def btn_area_first\n\n\t\t@layer_btns = HBox.new( true, 0 )\n\t\t@layer_btns.set_size_request( 800 , 40 )\n\n\t\t@btn_sintrom = Button.new(\"Sintrom\")\n\t\t@btn_sintrom.set_size_request( 100, 40 )\n\t\t@btn_sintrom.signal_connect( \"clicked\" ) do\n\t\t\tmain_area_sintrom\n\t\tend\n\t\t@btn_agenda = Button.new(\"Agenda\")\n\t\t@btn_agenda.set_size_request( 100, 40 )\n\t\t@btn_agenda.signal_connect( \"clicked\" ) do\n\t\t\ton_exit\n\t\tend\n\t\t@btn_bdays = Button.new(\"Cumpleaños\")\n\t\t@btn_bdays.set_size_request( 100, 40 )\n\t\t@btn_bdays.signal_connect( \"clicked\" ) do\n\t\t\ton_exit\n\t\tend\n\t\t@btn_shifts = Button.new(\"Turnos\")\n\t\t@btn_shifts.set_size_request( 100, 40 )\n\t\t@btn_shifts.signal_connect( \"clicked\" ) do\n\t\t\ton_exit\n\t\tend\n\t\t@btn_exit = Button.new(\"Exit\")\n\t\t@btn_exit.set_size_request( 100, 40 )\n\t\t@btn_exit.signal_connect( \"clicked\" ) do\n\t\t\ton_exit\n\t\tend\n\n\t\t@layer_btns.add( @btn_sintrom )\n\t\t@layer_btns.add( @btn_agenda )\n\t\t@layer_btns.add( @btn_bdays )\n\t\t@layer_btns.add( @btn_shifts )\n\t\t@layer_btns.add( @btn_exit )\n\n\t\t@layer_general.put( @layer_btns, 0, 760 )\n\n\tend", "def how_to_create_buttons args\n # Define a button style\n args.state.button_style = { w: 82, h: 10, }\n\n # Render instructions\n args.state.button_message ||= \"Press a Button!\"\n args.nokia.labels << args.nokia\n .default_label\n .merge(x: 42,\n y: 82,\n text: args.state.button_message,\n alignment_enum: 1)\n\n\n # Creates button one using a border and a label\n args.state.button_one_border = args.state.button_style.merge( x: 1, y: 32)\n args.nokia.borders << args.state.button_one_border\n args.nokia.labels << args.nokia\n .default_label\n .merge(x: args.state.button_one_border.x + 2,\n y: args.state.button_one_border.y + NOKIA_FONT_SM_HEIGHT + 2,\n text: \"Button One\")\n\n # Creates button two using a border and a label\n args.state.button_two_border = args.state.button_style.merge( x: 1, y: 20)\n\n args.nokia.borders << args.state.button_two_border\n args.nokia.labels << args.nokia\n .default_label\n .merge(x: args.state.button_two_border.x + 2,\n y: args.state.button_two_border.y + NOKIA_FONT_SM_HEIGHT + 2,\n text: \"Button Two\")\n\n # Initialize the state variable that tracks which button was clicked to \"\" (empty stringI\n args.state.last_button_clicked ||= \"--\"\n\n # If a click occurs, check to see if either button one, or button two was clicked\n # using the inside_rect? method of the mouse\n # set args.state.last_button_clicked accordingly\n if args.nokia.mouse_click\n if args.nokia.mouse_click.inside_rect? args.state.button_one_border\n args.state.last_button_clicked = \"One Clicked!\"\n elsif args.nokia.mouse_click.inside_rect? args.state.button_two_border\n args.state.last_button_clicked = \"Two Clicked!\"\n else\n args.state.last_button_clicked = \"--\"\n end\n end\n\n # Render the current value of args.state.last_button_clicked\n args.nokia.labels << args.nokia\n .default_label\n .merge(x: 42,\n y: 5,\n text: args.state.last_button_clicked,\n alignment_enum: 1)\nend", "def mouse_over_star?\n inputs.mouse.point.inside_rect?(scale_up(state.star))\n end", "def hover(name, *args)\n widget(name, *args).hover\n end", "def mouse_pressed\n # Check to see if the mouse was clicked on the box and if so create\n # a real spring and bind the mouse location to the box with a spring\n return unless box.contains(mouse_x, mouse_y)\n\n @spring = spring.bind(mouse_x, mouse_y, box)\nend", "def is_border?(); @type == GRT_BORDER; end", "def remove_border_mark(sexp)\n def sexp.inline_border?\n false\n end \n end", "def highlight(box)\n @pieces[box[0]][box[1]].stroke = yellow\nend", "def add_the_button\n @theButton = UIButton.buttonWithType(UIButtonTypeRoundedRect)\n @theButton.setTitle('Refresh Weather!', forState:UIControlStateNormal)\n # @theButton.setTitleColor(BW.rgb_color(255, 255, 255), forState:UIControlStateNormal)\n @theButton.backgroundColor = BW.rgb_color(255, 255, 255)\n # @theButton.layer.borderColor = BW.rgb_color(255, 255, 255)\n # @theButton.layer.borderWidth = 0.5\n @theButton.layer.cornerRadius = 10\n @theButton.frame = [[center_h(200), (@view_height - 200)], [200,50]] #[[x-axis, y-axis], [width, height]]\n # @theButton.setTitle('Stop', forState:UIControlStateSelected)\n\n # Add an event for the button when touched\n # 'self' refers to the handler class for the action in which the callback is defined\n # buttonClicked is the method that will be called when the event happens\n # forControlEvents will take the event name\n @theButton.addTarget(self, action:'buttonClicked', forControlEvents:UIControlEventTouchUpInside)\n\n self.view.addSubview(@theButton)\n end", "def mouse_pressed\n flock << Boid.new(mouse_x, mouse_y)\nend", "def border_style ; view.borderStyle ; end", "def borderColor(theColor)\n return if theColor.nil?\n @coloration[:border] = theColor\n end", "def how_to_render_borders args\n # Render a square at 0, 0 with a width and height of 3\n args.nokia.borders << { x: 0, y: 0, w: 3, h: 3, a: 255 }\n\n # Render a square at 3, 3 with a width and height of 3\n args.nokia.borders << { x: 3, y: 3, w: 4, h: 4, a: 255 }\n\n # Render a square at 5, 5 with a width and height of 4\n args.nokia.borders << { x: 7, y: 7, w: 5, h: 5, a: 255 }\nend", "def draw\n # Depending on whether this is the currently selected input or not, change the\n # background's color.\n if @window.text_input == self then\n @drawbox = @box \n else\n @drawbox = @box_hover\n end\n @drawbox.draw(x - PADDING_X, y - PADDING_Y, 100)\n pos_x = x + @font.text_width(self.text[0...self.caret_pos])\n sel_x = x + @font.text_width(self.text[0...self.selection_start]) \n # Draw the caret; again, only if this is the currently selected field.\n if @window.text_input == self then\n @window.draw_line(pos_x, y - PADDING_Y + 5, CARET_COLOR,\n pos_x, y + height - PADDING_Y - 5, CARET_COLOR, 100)\n end\n # Finally, draw the text itself!\n @font.draw(self.text, x, y, 120, 1, 1, 0xff_646464)\n end", "def add_default_styling_selected(button_class)\n button_class ||= \"#3300FF\"\n button_class.insert(0, \"button \")\n end" ]
[ "0.7456075", "0.6786705", "0.66233855", "0.64731586", "0.6234135", "0.6140793", "0.6121853", "0.5982914", "0.59605324", "0.5950647", "0.5891725", "0.5875644", "0.58139837", "0.57779014", "0.577331", "0.573345", "0.5727354", "0.57118994", "0.5699024", "0.5689504", "0.56780535", "0.56679", "0.5658623", "0.56502503", "0.5648689", "0.5645573", "0.56252235", "0.55967516", "0.55959934", "0.5591911", "0.5591029", "0.5541953", "0.5511055", "0.5504221", "0.5474775", "0.5450047", "0.5435478", "0.5428736", "0.5422707", "0.54216534", "0.54156333", "0.5409689", "0.5409689", "0.54093164", "0.5389888", "0.5365058", "0.5341883", "0.53396136", "0.53331393", "0.5331348", "0.53309065", "0.53196424", "0.5307382", "0.53003603", "0.5294124", "0.5287483", "0.52738005", "0.5255085", "0.523585", "0.52332264", "0.52290237", "0.52262384", "0.5222864", "0.52197677", "0.5216135", "0.521147", "0.5209286", "0.5202354", "0.5199823", "0.5184049", "0.51811284", "0.5179514", "0.5172552", "0.5149991", "0.51438415", "0.5141879", "0.5135567", "0.5133048", "0.51289755", "0.51276416", "0.5125818", "0.51226646", "0.5119983", "0.5119359", "0.51189053", "0.51170695", "0.5111542", "0.5102612", "0.51005024", "0.5097504", "0.5095014", "0.50943327", "0.50890654", "0.5087719", "0.5084983", "0.50820637", "0.50818735", "0.5079674", "0.50761074", "0.5075706" ]
0.7579696
0
Showing the information after the game has ended
def draw @background_image.bmp.draw(0, 0, ZOrder::BACKGROUND) @function_UI.place_button((SCREEN_WIDTH/3) + 100, 300, "Close") draw_border((SCREEN_WIDTH/3) + 105, 305, mouse_x, mouse_y) @function_UI.big_font.draw_text("GAME OVER!", @function_UI.pos- 120, 30, ZOrder::TOP, 1.0, 1.0, Gosu::Color::YELLOW) @score_font.draw_text("Your Score: #{@score}", @function_UI.pos-100, 200, ZOrder::TOP, 1.0, 1.0, Gosu::Color::YELLOW) @score_font.draw_text("Time of Game PLay: #{@game_play_time} Seconds", @function_UI.pos-140, 100, ZOrder::TOP, 1.0, 1.0, Gosu::Color::YELLOW) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def end_game\n puts \"Merci, Aur revoir\"\n end", "def finish\n\t\t@frame = @frame + 1\n\t\tdone = false\n\t\tif @frame % 120 == 0 \n\t\t\tdone = !@dialogueText.next\n\t\tend\n\t\tif done\n\t\t\t@frame = 0\n\t\t\t@nextGameState = @map\n\t\telse\n\t\t\t@dialogueText.draw\n\t\tend\n\tend", "def displayEndgame\n \tputs \"\\e[#{SCREEN_Y+1};#{1}HGame over.\\e[#{SCREEN_Y+2};#{1}H\"\nend", "def end_game\n puts \"Thank to play my game. See you again.\"\n end", "def end \n \tif @human_player.life_points == 0\n\t\tputs \" Looser tu as perdu...\"\n\t\telsif @enemies.empty? == true\n\t\tputs \"__________________________________\"\n\t\tputs \" VICTOIRE !!! $$$$ \"\n\t\tputs \" ___________________________________\"\n\t\tend\n\tend", "def finish_game\n\t\tif @check_mate_on == true\n\t\t\tputs \"\\n#{@current_player.name} (#{@current_player.color}) is in CHECKMATE !!!\\n#{@opponent_player.name} (#{@opponent_player.color})WON the game !!!\"\n\t\t\texit\n\t\tend\n\tend", "def main_end\r\n # Refresh map\r\n $game_map.refresh\r\n # If switching to title screen\r\n if $scene.is_a?(Scene_Title)\r\n # Fade out screen\r\n Graphics.transition\r\n Graphics.freeze\r\n end\r\n # If switching from battle test to any screen other than game over screen\r\n if $BTEST and not $scene.is_a?(Scene_Gameover)\r\n $scene = nil\r\n end\r\n end", "def end_game\n\t\tputs \"Thank you for playing the Secret Number Game, #{@player}.\"\n\tend", "def end_game\n puts \"\\n\\n________ GAME OVER ________\"\n puts \"#{@active_player.name}, you've run out of lives.\\nYou're RIGHT DEAD.\\n\\n\"\n switch_player!\n puts \"#{@active_player.name}, you had #{@active_player.lives} #{(@active_player.lives) == 1 ? \"life\" : \"lives\"} remaining and survived for #{(@which_round / 2).to_i} rounds, which means YOU WIN!\\n... By which we mean, you didn't die.\\nRight now.\\n\\nGood...\\n\\n\\n\"\n end", "def end_game\n end", "def end_game\n @game_run = false\n puts \"Game Over\"\n puts\n end", "def end_game\n\n end", "def finalize_game\n\n end", "def end\n if is_still_ongoing? == false\n if @human_player.life_points > 0\n puts \"Bravo tu as gagné la game, t'es fooooort\"\n else\n puts \"t'es nul à chier frère\"\n end #fin if pour Victoire ou défaite\n end #fin premier if\n end", "def end_screen(player)\r\n puts \" ----------------------- \"\r\n puts \"\"\r\n puts \" -- La partie est finie --\"\r\n puts \"\"\r\n puts \" ----------------------- \"\r\n puts \"\"\r\n if player.life_points > 0\r\n puts \"Félicitations, Vous remportez la partie !\"\r\n puts \"\"\r\n puts \" ----------------------- \"\r\n else\r\n puts \"Dommage, Vous avez perdu la partie !\"\r\n puts \"\"\r\n puts \" ----------------------- \"\r\n end\r\nend", "def end\n\t\tputs \"----- GAME OVER -----\"\n\t\tputs \"Good bye!\"\n\tend", "def main_end\r\n # If switching to title screen\r\n if $scene.is_a?(Scene_Title)\r\n # Fade out screen\r\n Graphics.transition\r\n Graphics.freeze\r\n end\r\n end", "def game_complete_text\n slow_type(\"\\nCongratulations, #{@new_player_name}! You have found your way out!\")\n pause(0.3)\n slow_type(\"Written, developed and coded by Adam Vaughan and Danny Smith.\")\n pause(0.3)\n slow_type(\"Stayed tuned for more levels!\")\n end", "def actions_when_game_is_lost\n puts \"\"\n puts \"GAME OVER\".red\n self.quit_game = true\n end", "def end_of_game\n\t\tputs \"\"\n\t\tif @guess_counter == 0\n\t\t\tputs \"Sorry, but you are out of guesses!\"\n\t\t\tputs \"The answer is '#{@answer_array.join}'\"\n\t\telse\n\t\t\tputs \"Yes! You are correct! The answer is '#{@answer_array.join}'!\"\n\t\t\tputs \"Good job!\"\n\t\tend\n\tend", "def game_display\n puts \" \"\n puts \" \"\n puts \"At any time, type 'save' to save and exit\"\n puts \"Guess progress: #{@secret_display}\"\n puts \"Wrong guesses: #{@wrong_guesses}\"\n puts \"Guesses remaining: #{@guess_count}\"\n end", "def goodbye\n\t\tputs \"\\nThanks for playing #{self.player_name}!\\n\"\n\t\tputs \"You finished with #{player_record[\"Wins\"]} wins and #{player_record[\"Losses\"]} losses\"\n\tend", "def finishGame\n if @roundsWon > @roundsLost\n puts \"You won the game!\"\n @gamesWon += 1\n else\n puts \"You lost the game :(\"\n @gamesLost += 1\n end\n puts \"Games Won: #{@gamesWon}. Ganes Lost: #{@gamesLost}\"\n requestNewGame()\n end", "def show_draw\n puts 'No more avalaible spaces, consider it a draw'\n puts 'The game will be re-started'\n puts 'loading................'\n puts 'Press any key to continue'\nend", "def end_game\r\n @game_over = true\r\n end", "def end_of_game_logic\n check_and_manage_winner\n show_winner_and_scores\n new_round?\n end", "def end_game\n @state = 'stop'\n @winner = true\n get_winning_player\n puts \"================ ===================== ===================\"\n puts \"-------------------- GAME OVER! ______________________________________\"\n puts \"____________________ WINNER: #{get_winning_player.try(:name)} --------------------------\"\n puts \"================ ===================== ===================\"\n # write stats/scores to dB ...\n end", "def end_game()\n get_winners()\n end", "def end_game\n\t\tputs \"=========================================================================\"\n\t\tputs \"Game Over ... \\n#{@trader.name}, your total value is: #{@trader.value}.\\n\"\n\t\ttotal_profit = @trader.value.to_f - @starting_cash.to_f\n\t\ttotal_return = 100*((total_profit / @starting_cash))\n\t\tputs \"Your final Profit & Loss account is #{total_profit}.\"\n\t\tputs \"Your return was #{total_return}%\"\n\n\t\toutput = case total_return.to_i \n\t\t\twhen 10..25 then \"Wow... you made a lot of money! You're a SuperStar!\"\n\t\t\twhen 5..9 then \"Nice work... BMW or Mercedes?\"\n\t\t\twhen 1..4 then \"Ok... well at least you didn't lose any money\"\n\t\t\twhen -4..0 then \"You're a Loser!\"\n\t\t\twhen -9..-5 then \"You're in deep... I know a good estate agent..\"\n\t\t\telse \"Remember.. this is just a game!!!!\"\t\n\t\tend\n\t\tputs \"#{@trader.name} ... #{output}\"\n\tend", "def end_game\n puts \"------------------ GAME OVER -----------------\"\n puts @player1.is_dead? ? \"Player 2 wins with a score of #{@player2.lives}/3\" : \"Player 1 wins with a score of #{@player1.lives}/3\"\n puts \"Good bye!\"\n end", "def end_of_the_game\n @display.throw(self)\n puts \"THIS IS THE END OF THE GAME\"\n puts ''\n if @current_board.boardcase_array.any? { |boardcase| boardcase.status == nil } == false\n puts 'I am afraid this a DRAW T_T'\n else\n puts \"Wow! #{@player_turn.name} you did win this one\"\n @player_turn == @player_one ? (@score_player_one += 1) : (@score_player_two += 1)\n end\n puts \"#{@player_one.name} :#{@score_player_one} victories\"\n puts \"#{@player_two.name} :#{@score_player_two} victories\"\n puts ''\n puts ''\n print \"DO YOU WANT TO TRY AGAIN? Y/n\"\n choice = gets.chomp\n exit unless choice == \"Y\"\n end", "def dat_menu() \n game_states.size == 1 && exit #fires if this is the only gamestate\n Chingu::Text.create 'Now leaving :(', size: 48, x: 200, y: 200, color: Gosu::Color::RED\n after(500) { $window.pop_game_state(setup: false) }\n end", "def display_end_game(player)\n if(player.guess == @secret_code)\n if @role == \"computer\"\n puts \"You successfully guessed the code!\"\n else\n puts \"The computer successfully guessed your code in #{player.guess_count} guesses\"\n end\n else\n puts \"You ran out of guesses. The correct code was:\"\n @secret_code.each do |code|\n print code + \" \"\n end\n puts \"\\nPlease try again.\"\n end\n end", "def end_game\n sleep 1\n self.stop = true\n winer = if ((21 - user.hand.total_score) < (21 - dealer.hand.total_score)) && (user.hand.total_score <= 21)\n user.name\n elsif (dealer.hand.total_score <= 21) && (user.hand.total_score <= 21) && (user.hand.total_score == dealer.hand.total_score)\n 'Ничья!'\n elsif dealer.hand.total_score <= 21\n dealer.name\n elsif user.hand.total_score <= 21\n user.name\n else\n 'Все проиграли!'\n end\n interface.show_winner(winer)\n interface.show_user_cards(user)\n interface.show_open_dealer_cards(dealer)\n update_bank(winer)\n end", "def show_games\n puts Rainbow(\"------------------------------\").red\n puts MyCliProject::Game.all.last.description\n puts Rainbow(\"------------------------------\").red\n continue_or_exit\n end", "def game_end\n if @board.win?\n puts \"\\nBravo ! #{@current_player.name} a gagné ! \"\n else\n puts \"\\nC'est une égalité !\"\n end\n @status = \"game end\"\n\n # Suggests another round\n puts \"Souhaitez-vous refaire une partie ? (o/n)\"\n choice = gets.chomp\n if choice == \"o\"\n new_round\n else\n puts \"A bientôt !\"\n end\n end", "def continue_game\n\t\thandle_no_set\n\t\tuntil @is_end\n\t\t\tshow_progress\n\t\t\tshow_hand\n\t\t\tuser_input = get_user_cards\n\t\t\tupdate user_input\n\t\t\thandle_no_set\n\t\tend\n\tend", "def victory_end\n RPG::BGM.fade(500) unless skip?\n 20.times do; Graphics.update; end\n SceneManager.return\n battle_end(0)\n replay_bgm_and_bgs unless skip? || $BTEST\n end", "def ending_screen\n if @winner == @player1\n color = :red\n elsif @winner == @player2\n color = :blue\n else\n color = :green\n end\n puts\n puts \"The game is finished.\"\n if @winner.nil?\n puts \"The game is a draw!\".colorize(color)\n else\n puts \"#{@winner.name} wins the game!\".colorize(color)\n end\n puts\n puts \"Would you like to play again? (Y/N)\"\n print \">> \"\n response = gets.chomp\n reset_board if response.downcase == \"y\"\n end", "def exit_game\n print clear_screen, \"\\n\"\n print \"\\\"What business is it of yours where I'm from, friendo?\\\"\", \"\\n\"\n print '-- Anton Chigurh : No Country for Old Men', \"\\n\\n\"\n throw :exit\n end", "def main_end\r\n super\r\n # If switching to title screen\r\n if $scene.is_a?(Scene_Title)\r\n # Fade out screen\r\n Graphics.transition\r\n Graphics.freeze\r\n end\r\n end", "def end_game_codemaker\n if @won\n puts 'Congratulations! You chose a really difficult code!'\n @player_score += 1\n else\n puts 'Better luck next time!'\n puts \"The computer was able to guess #{@mastermind_code} in #{@turn} turn#{@turn == 1 ? '' : 's'}.\"\n end\n # Give some time for the player's response\n sleep(1)\n end", "def command_endgame\r\n # Switch to end game screen\r\n $scene = Scene_End.new\r\n end", "def finish_turn\n waiting_to_confirm_done = true\n invalid_confirmation = nil\n\n while waiting_to_confirm_done\n DisplayManager.prepare_ingame_display\n show_state\n puts 'Done! Your turn is now over.'\n puts InputManager.input_options({ affirmative: 'Hide my Rack'}, invalid_confirmation)\n invalid_confirmation = nil\n \n response = InputManager.get\n\n if InputManager.affirmative?(response)\n waiting_to_confirm_done = false\n elsif InputManager.negative?(response)\n # do nothing, wait\n else\n invalid_confirmation = response\n end\n end \n\n DisplayManager.prepare_ingame_display\n end", "def display_credits\r\n \r\n Console_Screen.cls #Clear the display area\r\n \r\n #Thank the player and display game information\r\n puts \"\\t\\tThank you for taking the Trivia QUIZ.\\n\\n\\n\\n\"\r\n \r\n\r\n end", "def phase2_display_bag\n $game_system.se_play($data_system.decision_se)\n Graphics.freeze\n @message_window.visible = false\n @player_choice_ui&.visible = false\n #> Appel interne de l'interface\n scene = GamePlay::Battle_Bag.new(@actors)\n scene.main\n return_data = scene.return_data\n #> Retour sur la scène de combat\n if return_data == -1\n @action_selector&.visible = true\n @player_choice_ui&.visible = true\n end\n @message_window.visible = true\n Graphics.transition\n @player_choice_ui&.reset\n #> Action s'il y a bien eu utilisation d'un objet\n if return_data != -1\n @actor_actions.push([1,return_data])\n $bag.remove_item(return_data[0],1)\n update_phase2_next_act\n end\n end", "def after_battle_effect\n case $game_process\n when 0\n framed_narration('After having a quick break in the tent, you felt refreshed.(HP restored)')\n @player[:hp] = 45\n when 1\n framed_narration('You had a BBQ around the campfire and felt energised to move on. (HP restored)')\n @player[:hp] = 45\n when 2\n framed_narration('Donkey Kong fainted, and the illusion of the Jungle was expelled.')\n next_line\n framed_narration('Congrats! you have completed the game!')\n next_line\n framed_narration('Thanks for playing! See you in the future!')\n next_line\n framed_narration('-- Mark Huang')\n exit\n end\n end", "def announce_win(game_data)\n puts \"You won with #{game_data.lives} left!\"\n end", "def end_game\n\t\tputs \"Goodbye!\"\n\t\texit\n\tend", "def display_end_of_series\n if @player_1_score == @player_victory \n puts \"Congratulations #{@player_1_name}\"\n puts \"You have won this match #{@player_1_score} games to #{@player_2_score}.\"\n elsif @player_2_score == @player_victory\n puts \"Congratulations #{@player_2_name}\"\n puts \"You have won this match #{@player_2_score} games to #{@player_1_score}.\"\n end\n end", "def finish_round\n display(\"\\n\\n ---------------- TIME TO SETTLE ---------------- \\n\\n\")\n end", "def show_players\n puts\n @humanplayer.show_state\n puts \"2) #{@ennemies.size} enemies are still fighting\"\n puts\n end", "def print_end\n print_separator_strong\n puts \"GAME OVER!\"\n print_separator_strong\n end", "def status\n output = \"\"\n player = @game.player\n output << \"You won!! you have scaped with life from the castle!!! \"\n output << \"WELL DONE!!\"\n end", "def draw\n @player.draw\n Graphics.render_tail\n Graphics.draw_tiles(@font)\n Graphics.display_centered_title(@message.join(\"\"), @small_font)\n Graphics.display_lives(@small_font)\n Graphics.show_emoticon(Settings.mailbox, @font) if @message.join(\"\") == @completed \n if Position.collide?(@active_tile, @player)\n Graphics.erase_emoticon\n Graphics.show_emoticon(Settings.failbox, @font) \n end\n end", "def battle_end\n log_info('Exiting battle')\n # TODO : battle_end procedure\n $game_temp.in_battle = false\n return_to_last_scene\n end", "def battle_end(result)\n # Clear in battle flag\n $game_temp.in_battle = false\n # Clear entire party actions flag\n $game_party.clear_actions\n # Remove battle states\n for actor in $game_party.actors\n actor.remove_states_battle\n end\n # Clear enemies\n $game_troop.enemies.clear\n # Call battle callback\n if $game_temp.battle_proc != nil\n $game_temp.battle_proc.call(result)\n $game_temp.battle_proc = nil\n end\n # Switch to map screen\n $scene = Scene_Map.new\n end", "def battle_end(result)\r\n # Clear in battle flag\r\n $game_temp.in_battle = false\r\n # Clear entire party actions flag\r\n $game_party.clear_actions\r\n # Remove battle states\r\n for actor in $game_party.actors\r\n actor.remove_states_battle\r\n end\r\n # Clear enemies\r\n $game_troop.enemies.clear\r\n # Call battle callback\r\n if $game_temp.battle_proc != nil\r\n $game_temp.battle_proc.call(result)\r\n $game_temp.battle_proc = nil\r\n end\r\n # Switch to map screen\r\n $scene = Scene_Map.new\r\n end", "def end_game_codebreaker\n if @won\n puts 'Congratulations! You win!'\n else\n puts \"Better luck next time! The code was #{@mastermind_code}.\"\n @computer_score += 1\n end\n # Give some time for the player's response\n sleep(1)\n end", "def battle_end(result)\n if result == 2 and not $game_troop.can_lose\n call_gameover\n else\n Graphics.fadeout(30)\n\n if result == 1 && !VICTORY_CONFIG::LOOT_ON_RUN\n $scene = Scene_Victory.new(nil)\n else\n $scene = Scene_Victory.new($game_troop)\n end\n $game_party.clear_actions\n $game_party.remove_states_battle\n $game_troop.clear\n if $game_temp.battle_proc != nil\n $game_temp.battle_proc.call(result)\n $game_temp.battle_proc = nil\n end\n end\n $game_temp.in_battle = false\n end", "def battle_end(result)\n if result == 2 and not $game_troop.can_lose\n call_gameover\n else\n Graphics.fadeout(30)\n\n if result == 1 && !VICTORY_CONFIG::LOOT_ON_RUN\n $scene = Scene_Victory.new(nil)\n else\n $scene = Scene_Victory.new($game_troop)\n end\n $game_party.clear_actions\n $game_party.remove_states_battle\n $game_troop.clear\n if $game_temp.battle_proc != nil\n $game_temp.battle_proc.call(result)\n $game_temp.battle_proc = nil\n end\n end\n $game_temp.in_battle = false\n end", "def on_game_pause_end\n # Set Game Paused Flag & Graphics Frame Count\n @game_paused = false ; Graphics.frame_count = @pause_frame_count\n end", "def ending_message\n if num_of_guesses == 0\n puts \"You have no more guesses. You lost\"\n elsif round_result == \"equal\"\n puts \"You won!\" \n end\n end", "def game_history\n MyCliProject::Game.all.each do |game|\n puts Rainbow(\"------------------------------\").red\n puts \"#{game.game_name}\"\n puts Rainbow(\"------------------------------\").red\n end\n continue_or_exit \n end", "def show_current_info\n\t\tputs \"--------\"\n\t\tputs \"Hangman!\"\n\t\tputs \"--------\"\n\t\tputs \"Wrong guesses left: #{@guess_counter}\"\n\t\tputs \"Answer does not inlcude: \"\n\t\tputs @incorrect_array.join(', ')\n\t\tputs \"\"\n\t\tputs \"--------------------\"\n\t\tputs @blank_word_array.join(' ')\n\t\tputs \"--------------------\"\n\tend", "def print_out_start_of_game\n\n puts \"Welcome to a new version of the 2 Player Game.\"\n puts \"\"\n\nend", "def show_state\n if @life_points <= 0\n puts \"#{@name} is dead... \\n...Monde de merde...\"\n else\n puts \"#{@name} has #{@life_points} life points left.\"\n end\n end", "def ending\n if winner_player1 == true\n puts (\"#{@player1.name} wins the game!\").blue\n return \"player1 wins\"\n elsif winner_player2 == true\n puts (\"#{@player2.name} wins the game!\").blue\n return \"player2 wins\"\n elsif board.boxes.length < 1\n puts (\"Sorry, it is a draw game!\").blue\n return \"draw game\"\n end\n end", "def go_game\n #RPG::BGM.fade(30)\n #Graphics.fadeout(30)\n #Graphics.frame_count = 0\n DataManager.autosave(true, false)\n SceneManager.goto(Scene_Map)\n #$game_system.on_after_load\n end", "def finish\r\n #\r\n end", "def end_resolution\n resolver_ui.after_resolution\n debug do\n \"Finished resolution (#{@iteration_counter} steps) \" \\\n \"(Took #{(ended_at = Time.now) - @started_at} seconds) (#{ended_at})\"\n end\n debug { 'Unactivated: ' + Hash[activated.vertices.reject { |_n, v| v.payload }].keys.join(', ') } if state\n debug { 'Activated: ' + Hash[activated.vertices.select { |_n, v| v.payload }].keys.join(', ') } if state\n end", "def finish\n #\n end", "def ended msg\n end", "def end_game\n if @guess_count == 0 && @blanks != @new_word\n puts \"The game is over, Better luck next time :(\"\n @is_over = true\n elsif @blanks == @new_word\n puts \"Congrats you guessed the secret word! :)\"\n @is_over = true\n end \n end", "def show_players\n puts \"Il reste #{players_left} enemies\"\n player1.show_state\n puts \"\\n\"\n end", "def finish\n noth\n end", "def declare_win(time_to_finish)\n puts \"\\nVictorious!\"\n puts \"It took you #{@attempts} attempts and #{time_to_finish} seconds to win a #{@board.rows * @board.columns} slot board\\n\"\n end", "def show_desk\n system('clear')\n @game.show_player(@dealer)\n @game.show_player(@gamer)\n end", "def end_game\n self.update_attribute(:finished, true)\n\n s1 = 0\n s2 = 0\n for pw in self.playedWords\n if (pw.player == self.players[0])\n s1 += pw.word.length\n else\n s2 += pw.word.length\n end\n end\n if (s1 > s2)\n players[0].addVictory\n elsif (s1 < s2)\n players[1].addVictory\n end\n end", "def battle_end(result)\n Game_Temp.in_battle = false\n Game_Temp.current_troop = -1\n extender_end(result)\n end", "def finalize\r\n push_game_state(Main) # switch to game state \"Menu\"\r\nend", "def game_exit\n Message.game_quit\n false\n end", "def shows_finished_runs()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = Native.TitleComponentState_shows_finished_runs(@handle.ptr)\n result\n end", "def show_win\n puts \"Congratulations #{@name}, you've won the game!\"\n puts 'Hangman lives to hang another day!'\n puts \"\\n\"\n end", "def end_round\n\t\tshow_hands unless round_over? \n\t\tremaining_hands = players.reject{ |p| p.folded? }\n\t\t.map{|p| p.hand }\n\t\twinner = Hand.highest_hand(remaining_hands)\n\t\twinner.take_winnings(@pot)\n\t\t\n\t\tputs \"This round's winner is #{winner.name}, with a #{winner.hand.rank}.\".colorize(:light_white).colorize(:background => :magenta)\n\t\t\n\tend", "def game_finished\n\tif @skip == true\n \t@game_finished = true\n end\nend", "def show_players\n\t\tputs @human_player.show_state\n\t\tputs \"Il reste #{@enemies.length} ennemies !\"\n\tend", "def finish_commands\n for i in 0..4\n if @mode_rdo[i].selected?\n $glob.game_mode = i - 1\n break\n end \n end\n if $glob.game_mode == -1\n $player = Players.new(Player.new,Player.new)\n else\n $player = Players.new(Player.new,CPU.new)\n end\n if !$player.act_p.human?\n choiced = $player.act_p.turn\n choiced.label_widget.set_markup($player.act_p.mark_markup)\n $player.switch_player\n end\n self.hide\n end", "def show_hands_final\n player.show_hand\n dealer.show_hand_for_turn\n end", "def display_current(game_hash)\n\treset_screen\n\tputs pretty_board(hash_to_array(game_hash))\n\tsleep(0.001)\nend", "def leave\n puts ' ____________________________________________________________ '\n puts '| |'\n puts '| Sorry to see you leave... |'\n puts '| Thank you for using Buda-Bot. See you soon! |'\n puts '|____________________________________________________________|'\nend", "def update_message\n # Show the \"What?\" message\n if @counter == 0\n @message_window.auto_skip = true\n @message_window.stay_visible = true\n display_message(text_get(36, 37))\n elsif @counter == POKEMON_ALPHA_DOWN_END\n @message_window.auto_skip = false\n Audio.bgm_play(Evolve::EVOLVED_MUSIC)\n PFM::Text.set_pkname(@pokemon, 0)\n display_message(text_get(36, 38))\n elsif @counter > POKEMON_ALPHA_DOWN_END\n show_rename_choice\n Audio.bgm_stop\n $game_system.bgm_restore2\n $pokedex.mark_seen(@pokemon.id, @pokemon.form, forced: true)\n $pokedex.mark_captured(@pokemon.id)\n $pokedex.pokemon_fought_inc(@pokemon.id)\n $pokedex.pokemon_captured_inc(@pokemon.id)\n @running = false\n end\n end", "def end_battle(result=0)\n clear_tr_sprites\n @spriteset.update\n RPG::BGM.fade(400) \n BattleManager.battle_end(result)\n @battle_exiting = result\n @cursor.active = false \n clean_up_battle\n if result == 2 and BattleManager.can_lose? == true\n SceneManager.return #return to map\n end\n end", "def show_players\r\n puts \"Tu as #{human_player.life_points}\"\r\n puts \"il reste #{@enemies.length} bots, courage!!\"\r\n end", "def endLoadingScreen \n \"endLoadingScreen\" \n end", "def step\n if @game_over\n game_over!\n @event_handler.update\n else\n # background for playing field and hud\n @screen.fill :black\n @screen.fill [50,50,50], Rect.new(Configuration.screen[:hud_rect])\n\n @event_handler.update\n @hud.update @clock.framerate.ceil, @round, @enemies.length, @money, @lives+1, @round_timer\n\n update_timer\n restock_enemies! if @restock_enemies > 0\n\n @the_path.draw @screen # Draw the enemy path.\n @enemies.draw @screen # Draw the enemies.\n @towers.draw @screen # Draw all set towers.\n @grid_highlighter.draw @screen # Draw the nifty semi-transparent highlighter below the mouse.\n @hud.draw @screen # draw the HUD\n end\n\n @screen.update() # Refresh the screen.\n end", "def window_update()\n if $game_party != nil\n @ucLocation.cValue.text = $game_map.name\n \n @total_sec = Graphics.frame_count / Graphics.frame_rate\n hour = @total_sec / 60 / 60\n min = @total_sec / 60 % 60\n sec = @total_sec % 60\n \n @ucTime.cLabel.text = sprintf(MENU_CONFIG::TIME_PATTERN, hour, min, sec)\n @ucGold.cLabel.text = $game_party.gold\n end\n refresh()\n end", "def window_update()\n if $game_party != nil\n @ucLocation.cValue.text = $game_map.name\n \n @total_sec = Graphics.frame_count / Graphics.frame_rate\n hour = @total_sec / 60 / 60\n min = @total_sec / 60 % 60\n sec = @total_sec % 60\n \n @ucTime.cLabel.text = sprintf(MENU_CONFIG::TIME_PATTERN, hour, min, sec)\n @ucGold.cLabel.text = $game_party.gold\n end\n refresh()\n end", "def tie\n\tgreeting\n puts \"---------------------\"\n show_grid\n puts \"\"\n puts \"G A M E O V E R\"\n puts \"\"\n\tputs \"Tied game!\"\n\tputs \"\"\n\tputs \"---------------------\"\nend", "def finished\n @quick_fire.finished\n winner = @quick_fire.to_hash[:winner]\n rebuy_added = false\n rebuy_used = false\n top_score_achieved = false\n previous_score = @game.score\n if winner[:id] == 1\n @game.score = @game.score * 2\n @game.high_score = @game.score if @game.score > @game.high_score\n rmq(:play).style {|st| st.text = \"Next Hand\" }\n if winner[:rank] == \"Straight Flush\" || winner[:rank] == \"Royal Flush\"\n rebuy_added = true\n add_rebuy(@game.score)\n end\n if @game.score == 64 && !@game.easy_rebuy && @game.difficulty == 0\n add_rebuy(64)\n rebuy_added = true\n @game.easy_rebuy = true\n end\n if @game.score == 1024 && !@game.rebuy_obtained\n add_rebuy(1024)\n rebuy_added = true\n @game.rebuy_obtained = true\n end\n if @game.score == 1048576 && !game.million_rebuy\n applause_sound\n add_rebuy(1048576)\n rebuy_added = true\n @game.million_rebuy = true\n end\n if @game.score >= 274877906944\n applause_sound\n @game.open = false\n top_score_achieved = true\n rmq(:play).style {|st| st.text = \"Game Over\"}\n end\n elsif winner[:id] == 2\n if @game.rebuys.empty?\n @game.open = false\n rmq(:play).style {|st| st.text = \"Play Again?\" }\n else\n rebuy_used = true\n @game.score = @game.rebuys.shift\n end\n end\n opts_hash = {rebuy_added: rebuy_added, rebuy_used: rebuy_used, previous_score: previous_score, top_score_achieved: top_score_achieved}\n OverlayController.new(self, @game, @quick_fire, opts_hash).show\n end", "def status\n output = \"\"\n\n output << \"You are dead!!!\"\n output << \"Game Over\"\n end" ]
[ "0.7369894", "0.73588973", "0.7206889", "0.7180202", "0.71289086", "0.71063846", "0.7094307", "0.70589477", "0.70345706", "0.7011741", "0.69640976", "0.6955177", "0.68831927", "0.6879037", "0.6864914", "0.68223816", "0.6744334", "0.6716894", "0.6638612", "0.66346735", "0.66118306", "0.6602009", "0.6583586", "0.6575477", "0.65574664", "0.6550831", "0.6522293", "0.6501489", "0.647465", "0.6453409", "0.6452658", "0.64489216", "0.64095104", "0.6403486", "0.63874", "0.6379314", "0.63534236", "0.6335408", "0.6328988", "0.63090336", "0.6294339", "0.62567496", "0.62471086", "0.62354743", "0.6227126", "0.6226851", "0.62231064", "0.6218322", "0.6215652", "0.6213683", "0.62052804", "0.6199298", "0.6184262", "0.61688554", "0.6153516", "0.614748", "0.614433", "0.61366487", "0.6136405", "0.61316615", "0.61316615", "0.6129395", "0.6112199", "0.6110127", "0.610528", "0.6083457", "0.6063561", "0.60547495", "0.60535824", "0.6046819", "0.6043085", "0.6035793", "0.60327923", "0.6020553", "0.6018987", "0.59983844", "0.59966373", "0.5995133", "0.5994974", "0.59925836", "0.59891224", "0.59826076", "0.5977652", "0.59757096", "0.5968877", "0.5962194", "0.59617716", "0.59558046", "0.5953506", "0.59464914", "0.59408444", "0.59402925", "0.59318036", "0.5930982", "0.59142274", "0.59105736", "0.5910059", "0.5910059", "0.5909339", "0.5908543", "0.5904497" ]
0.0
-1
When a user hovers over a button draw a border
def draw_border(x1, y, mouse_x, mouse_y) if @function_UI.mouse_over_button(mouse_x, mouse_y) draw_line(x1, y, Gosu::Color::BLUE, x1+60, y, Gosu::Color::BLUE, ZOrder::TOP, mode=:default) draw_line(x1, y+35, Gosu::Color::BLUE, x1+60, y+35, Gosu::Color::BLUE, ZOrder::TOP, mode=:default) draw_line(x1, y,Gosu::Color::BLUE, x1, y+35, Gosu::Color::BLUE, ZOrder::TOP, mode=:default) draw_line(x1+60, y,Gosu::Color::BLUE, x1+60, y+35, Gosu::Color::BLUE, ZOrder::TOP, mode=:default) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_border(x1, y)\r\n if @function_UI.mouse_over_button(mouse_x, mouse_y)\r\n draw_line(x1, y, Gosu::Color::BLUE, x1+60, y, Gosu::Color::BLUE, ZOrder::TOP, mode=:default)\r\n draw_line(x1, y+35, Gosu::Color::BLUE, x1+60, y+35, Gosu::Color::BLUE, ZOrder::TOP, mode=:default)\r\n draw_line(x1, y,Gosu::Color::BLUE, x1, y+35, Gosu::Color::BLUE, ZOrder::TOP, mode=:default)\r\n draw_line(x1+60, y,Gosu::Color::BLUE, x1+60, y+35, Gosu::Color::BLUE, ZOrder::TOP, mode=:default)\r\n end \r\n end", "def primary_button_hover_border_color\n darken_color(primary_button_border_color, 0.12)\n end", "def bordered; self.border = true; self; end", "def tick_button_prefab button\n outputs.labels << button.label # outputs button's label and border\n outputs.borders << button.border\n\n if button_clicked? button # if button is clicked\n button.clicked_at = inputs.mouse.click.created_at # stores the time that the button was clicked\n end\n\n if button.clicked_at # if clicked_at has a frame value and is not nil\n # button is output; color changes and transparency changes for 0.25 seconds after click occurs\n outputs.solids << [button.border.x, button.border.y, button.border.w, button.border.h,\n 0, 180, 80, 255 * button.clicked_at.ease(0.25.seconds, :flip)] # transparency changes for 0.25 seconds\n end\n end", "def border; end", "def primary_button_active_border_color\n darken_color(primary_button_border_color, 0.12)\n end", "def primary_button_focus_border_color\n darken_color(primary_button_border_color, 0.25)\n end", "def start_border(info = '')\n draw_border(:top, info)\n end", "def update\n \n if(isOverButton)\n @hover = true\n else\n @hover = false\n end\n \n if(@clicked)\n @clicked = false\n @hover = false\n return true\n end\n \n return false\n end", "def primary_button_border_color\n @primary_button_border ||= darken_color(primary_button_background_color, 0.05)\n end", "def button_down(id)\n case id\n when Gosu::MsLeft\n @locs = [mouse_x, mouse_y]\n if mouse_over_button(mouse_x, mouse_y)\n @background = Gosu::Color::YELLOW\n elsif mouse_over_button(mouse_x, mouse_y) == false\n @background = Gosu::Color::WHITE\n end\n end\n end", "def mouse_over?(mouse_x, mouse_y)\n mouse_x >= x - Const::BORDER_GAP &&\n mouse_x <= x + @width + Const::BORDER_GAP &&\n mouse_y >= y - Const::BORDER_GAP &&\n mouse_y <= y + @font.height + Const::BORDER_GAP\n end", "def draw_borders\n if borders.top > 0 # TODO: :none\n options = translate( x: margins.left, y: margins.top ).merge( width: width + margins.width, height: borders.top, foreground: borders.foreground, background: Termbox::RED )\n \n pencil.draw_rectangle( options )\n end\n \n if borders.bottom > 0 # TODO: :none\n options = translate( x: margins.left, y: offsets.top + padding.bottom ).merge( width: width + margins.width, height: borders.bottom, foreground: borders.foreground, background: Termbox::RED )\n \n pencil.draw_rectangle( options )\n end\n end", "def hover_event(element)\n # replaces element colour with overlay only\n # while mouse over\n element.colour = OVERLAY\nend", "def button_tech_demo\n x, y, w, h = 460, 160, 300, 50\n state.button ||= state.new_entity(:button_with_fade)\n\n # Adds w.half to x and h.half + 10 to y in order to display the text inside the button's borders.\n state.button.label ||= [x + w.half, y + h.half + 10, \"click me and watch me fade\", 0, 1]\n state.button.border ||= [x, y, w, h]\n\n if inputs.mouse.click && inputs.mouse.click.point.inside_rect?(state.button.border) # if mouse is clicked, and clicked inside button's border\n state.button.clicked_at = inputs.mouse.click.created_at # stores the time the click occurred\n end\n\n outputs.labels << state.button.label\n outputs.borders << state.button.border\n\n if state.button.clicked_at # if button was clicked (variable has a value and is not nil)\n\n # The appearance of the button changes for 0.25 seconds after the time the button is clicked at.\n # The color changes (rgb is set to 0, 180, 80) and the transparency gradually changes.\n # Change 0.25 to 1.25 and notice that the transparency takes longer to return to normal.\n outputs.solids << [x, y, w, h, 0, 180, 80, 255 * state.button.clicked_at.ease(0.25.seconds, :flip)]\n end\n end", "def border!\n border do\n # adds default border\n end\n end", "def clicked\n @callback.call if mouse_over?\n end", "def add_border_mark(sexp)\n def sexp.inline_border?\n true\n end \n end", "def button_clicked? button\n inputs.mouse.click && inputs.mouse.click.point.inside_rect?(button.border)\n end", "def create_extra_buttons()\n Rectangle.new(x:5,y:50,width:40,height:40,color:\"white\",z:1)\n Rectangle.new(x:16,y:66,width:18,height:9,color:\"#ff7eec\",z:1)\n Rectangle.new(x:5,y:100,width:40,height:40,color:\"white\",z:1)\n Rectangle.new(x:14,y:110,width:21,height:25,color:'#808080',z:1)\n Rectangle.new(x:14,y:110,width:21,height:5,color:'blue',z:1)\n Rectangle.new(x:5,y:150,width:40,height:40,color:\"white\",z:1)\n Triangle.new(x1:15,x2:35,x3:25,y1:180,y2:180,y3:160,color:\"black\",z:1)\n Rectangle.new(x:5,y:200,width:40,height:40,color:\"white\",z:1)\n Triangle.new(x1:15,x2:35,x3:25,y1:210,y2:210,y3:230,color:\"black\",z:1)\nend", "def curatorMouseOver \n \"curatorMouseOver\" \n end", "def mouse_over_button(mouse_x, mouse_y)\r\n if ((mouse_x >= (SCREEN_WIDTH/3) + 100 and mouse_x <= (SCREEN_WIDTH/3) + 160) and (mouse_y >= 300 and mouse_y <= 345)) \r\n return true\r\n else\r\n return false\r\n end\r\n end", "def border(&block)\n return '' unless block_given?\n\n border_on + yield + border_off\n end", "def borders_tech_demo\n outputs.labels << [ 5, 260, \"Borders (x, y, w, h, r, g, b, a)\"]\n outputs.borders << [ 10, 180, 50, 50]\n outputs.borders << [ 70, 180, 50, 50, 0, 0, 0]\n outputs.borders << [130, 180, 50, 50, 255, 0, 0]\n outputs.borders << [190, 180, 50, 50, 255, 0, 0, 128]\n outputs.borders << [250, 180, 50, 50, 0, 0, 0, 128 + state.tick_count % 128] # transparency changes\n end", "def point_to_rect_tech_demo\n x = 460\n\n outputs.labels << small_label(x, 15, \"Click inside the blue box maybe ---->\")\n\n box = [765, 370, 50, 50, 0, 0, 170] # blue box\n outputs.borders << box\n\n if state.last_mouse_click # if the mouse was clicked\n if state.last_mouse_click.point.inside_rect? box # if mouse clicked inside box\n outputs.labels << small_label(x, 16, \"Mouse click happened inside the box.\")\n else # otherwise, if mouse was clicked outside the box\n outputs.labels << small_label(x, 16, \"Mouse click happened outside the box.\")\n end\n else # otherwise, if was not clicked at all\n outputs.labels << small_label(x, 16, \"Mouse click has not occurred yet.\") # output if the mouse was not clicked\n end\n\n # border around mouse input demo section\n outputs.borders << [455, row_to_px(14), 360, row_to_px(11).shift_up(5) - row_to_px(14)]\n end", "def new_button_prefab x, y, message\n w, h = 300, 50\n button = state.new_entity(:button_with_fade)\n button.label = [x + w.half, y + h.half + 10, message, 0, 1] # '+ 10' keeps label's text within button's borders\n button.border = [x, y, w, h] # sets border definition\n button\n end", "def setbordercolorind(*)\n super\n end", "def update\n if mouse_over?\n @color = Const::MENU_ITEM_MO_CLR\n else\n @color = Const::MENU_ITEM_CLR\n end\n end", "def mouse_in(e)\n @state = :hover\n end", "def add_border(element, color=border_color, size=1)\n element.add_renderables(\n create_border(0, 0, element.w, element.h, color, size)\n )\n end", "def create_color_buttons()\n Rectangle.new(x:5,y:450,width:45,height:45,color:'red',z:1)\n Rectangle.new(x:55,y:450,width:45,height:45,color:'orange',z:1)\n Rectangle.new(x:105,y:450,width:45,height:45,color:'yellow',z:1)\n Rectangle.new(x:155,y:450,width:45,height:45,color:'green',z:1)\n Rectangle.new(x:205,y:450,width:45,height:45,color:'blue',z:1)\n Rectangle.new(x:255,y:450,width:45,height:45,color:'#EE82EE',z:1)\n Rectangle.new(x:305,y:450,width:45,height:45,color:'black',z:1)\n Rectangle.new(x:355,y:450,width:45,height:45,color:'#808080',z:1)\n Rectangle.new(x:405,y:450,width:45,height:45,color:'white',z:1)\nend", "def end_border(info = '')\n draw_border(:bottom, info)\n end", "def bottom_border_stroke\n line_stroke(\n settings.border.style.bottom_left,\n settings.border.style.bottom_junc,\n settings.border.style.bottom_right\n ) do\n settings.border.style.bottom_horiz * (dimensions.inner_grid_width + (settings.scrollbar.vert? ? 1 : 0))\n end\n end", "def mouse_button\n mouse_state.image\n end", "def primary_button_hover_background_color\n darken_color(primary_button_background_color, 0.1)\n end", "def prv_print_border_only row, col, height, width, color, att=Ncurses::A_NORMAL\n att ||= Ncurses::A_NORMAL\n case att.to_s.downcase\n when 'normal'\n att = Ncurses::A_NORMAL\n when 'underline'\n att = Ncurses::A_UNDERLINE\n when 'bold'\n att = Ncurses::A_BOLD\n when 'blink'\n att = Ncurses::A_BLINK # unlikely to work\n when 'reverse'\n att = Ncurses::A_REVERSE \n end\n attron(Ncurses.COLOR_PAIR(color) | att)\n mvwaddch row, col, ACS_ULCORNER\n mvwhline( row, col+1, ACS_HLINE, width-2)\n mvwaddch row, col+width-1, Ncurses::ACS_URCORNER\n mvwvline( row+1, col, ACS_VLINE, height-1)\n\n mvwaddch row+height-0, col, Ncurses::ACS_LLCORNER\n mvwhline(row+height-0, col+1, ACS_HLINE, width-2)\n mvwaddch row+height-0, col+width-1, Ncurses::ACS_LRCORNER\n mvwvline( row+1, col+width-1, ACS_VLINE, height-1)\n attroff(Ncurses.COLOR_PAIR(color) | att)\n end", "def repaint # button\n\n #@bgcolor ||= $def_bg_color\n #@color ||= $def_fg_color\n $log.debug(\"BUTTON repaint : #{self} r:#{@row} c:#{@col} , #{@color} , #{@bgcolor} , #{getvalue_for_paint}\" )\n r,c = @row, @col #rowcol include offset for putting cursor\n # NOTE: please override both (if using a string), or else it won't work \n # These are both colorpairs not colors ??? 2014-05-31 - 11:58 \n _highlight_color = @highlight_color || $reversecolor\n _highlight_bgcolor = @highlight_bgcolor || 0\n _bgcolor = bgcolor()\n _color = color()\n if @state == :HIGHLIGHTED\n _bgcolor = @state==:HIGHLIGHTED ? _highlight_bgcolor : _bgcolor\n _color = @state==:HIGHLIGHTED ? _highlight_color : _color\n elsif selected? # only for certain buttons lie toggle and radio\n _bgcolor = @selected_bgcolor || _bgcolor\n _color = @selected_color || _color\n end\n $log.debug \"XXX: button #{text} STATE is #{@state} color #{_color} , bg: #{_bgcolor} \"\n if _bgcolor.is_a?( Integer) && _color.is_a?( Integer)\n # i think this means they are colorpairs not colors, but what if we use colors on the 256 scale ?\n # i don;t like this at all. \n else\n _color = get_color($datacolor, _color, _bgcolor)\n end\n value = getvalue_for_paint\n $log.debug(\"button repaint :#{self} r:#{r} c:#{c} col:#{_color} bg #{_bgcolor} v: #{value} ul #{@underline} mnem #{@mnemonic} datacolor #{$datacolor} \")\n len = @width || value.length\n @graphic = @form.window if @graphic.nil? ## cell editor listbox hack \n @graphic.printstring r, c, \"%-*s\" % [len, value], _color, attr()\n# @form.window.mvchgat(y=r, x=c, max=len, Ncurses::A_NORMAL, bgcolor, nil)\n # in toggle buttons the underline can change as the text toggles\n if @underline || @mnemonic\n uline = @underline && (@underline + @text_offset) || value.index(@mnemonic) || \n value.index(@mnemonic.swapcase)\n # if the char is not found don't print it\n if uline\n y=r #-@graphic.top\n x=c+uline #-@graphic.left\n #\n # NOTE: often values go below zero since root windows are defined \n # with 0 w and h, and then i might use that value for calcaluting\n #\n $log.error \"XXX button underline location error #{x} , #{y} \" if x < 0 or c < 0\n raise \" #{r} #{c} #{uline} button underline location error x:#{x} , y:#{y}. left #{@graphic.left} top:#{@graphic.top} \" if x < 0 or c < 0\n @graphic.mvchgat(y, x, max=1, Ncurses::A_BOLD|Ncurses::A_UNDERLINE, _color, nil)\n end\n end\n end", "def repaint # tabbedbutton\n $log.debug(\"TabbedBUTTon repaint : #{self.class()} r:#{@row} c:#{@col} #{getvalue_for_paint}\" )\n r,c = rowcol\n attribs = @attrs\n @highlight_foreground ||= $reversecolor\n @highlight_background ||= 0\n _state = @state\n _state = :SELECTED if @variable.value == @value \n case _state\n when :HIGHLIGHTED\n $log.debug(\"TabbedBUTTon repaint : HIGHLIGHTED #{bgcolor}, #{color}, v: #{@value}\" )\n bgcolor = @highlight_background\n color = @highlight_foreground\n bgcolor = @bgcolor\n color = @color\n attribs = Ncurses::A_BOLD\n setrowcol r,c # show cursor on highlighted as we tab through\n ## but when tabbing thru selected one, then selected one doesn't show cursor\n when :SELECTED\n $log.debug(\"TabbedBUTTon repaint : SELECTED #{bgcolor}, #{color}\")\n bgcolor = @bgcolor\n color = @color\n attribs = Ncurses::A_REVERSE\n if @state == :HIGHLIGHTED\n setrowcol r,c # show cursor on highlighted as we tab through\n end\n else\n $log.debug(\"TabbedBUTTon repaint : ELSE #{bgcolor}, #{color}\")\n bgcolor = @bgcolor\n color = @color\n end\n #bgcolor = @state==:HIGHLIGHTED ? @highlight_background : @bgcolor\n #color = @state==:HIGHLIGHTED ? @highlight_foreground : @color\n if bgcolor.is_a? String and color.is_a? String\n color = ColorMap.get_color(color, bgcolor)\n end\n value = getvalue_for_paint\n $log.debug(\"button repaint : r:#{r} #{@graphic.top} c:#{c} #{@graphic.left} color:#{color} bg #{bgcolor} v: #{value}, g: #{@graphic} \")\n len = @display_length || value.length\n # paint the tabs name in approp place with attribs\n #@form.window.printstring r, c, \"%-*s\" % [len, value], color, attribs\n #@graphic.printstring r+@graphic.top, c+@graphic.left, \"%-*s\" % [len, value], color, attribs\n #@graphic.printstring r-@graphic.top, c-@graphic.left, \"%-*s\" % [len, value], color, attribs\n @graphic.printstring r, c, \"%-*s\" % [len, value], color, attribs\n @graphic.modified = true\n# @form.window.mvchgat(y=r, x=c, max=len, Ncurses::A_NORMAL, bgcolor, nil)\n # underline for the top tab buttons.\n if @underline != nil\n r -= @graphic.top # because of pad, remove if we go back to windows\n c -= @graphic.left # because of pad, remove if we go back to windows\n @graphic.mvchgat(y=r, x=c+@underline+0, max=1, Ncurses::A_BOLD|Ncurses::A_UNDERLINE, color, nil)\n end\n end", "def border\n puts \"--------------------------------\".center(75)\nend", "def border!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 37 )\n\n type = BORDER\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 367:9: 'border'\n match( \"border\" )\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__, 37 )\n\n end", "def render_border(screen)\n border ? screen.box(abs_x, abs_y, abs_width, abs_height, border.style, border_style) : ''\n end", "def colour_border(x, y, new_colour, border_colour)\n @image.content[x][y] = border_colour if (@image.content[x][y] != new_colour) &&\n (@image.content[x][y] == @background_color)\n end", "def mouse_over locator\r\n command 'mouseOver', locator\r\n end", "def mouse_over locator\r\n command 'mouseOver', locator\r\n end", "def render_mouse_crosshairs args, mouse\n return unless args.state.show_gridlines\n args.labels << [10, 25, \"mouse: #{mouse.x} #{mouse.y}\", 255, 255, 255]\nend", "def draw_border(x, y, border_colour)\n original_colour = @image.content[x-1][y-1]\n temp_colour = '.'\n\n fill_region(x, y, temp_colour, nil, border_colour)\n\n @image.content.map { |column| column.map! { |colour| colour == temp_colour ? original_colour : colour } }\n @image\n end", "def onClick(block=nil)\n temp=@color\n @gtkObject.signal_connect(\"button_release_event\") { |_, event|\n if event.button==Click::LEFT\n Thread.new{\n sleep(0.5)\n if !@gtkObject.mapped?\n @gtkObject.window.set_cursor(Click::CURSOROUT) unless @gtkObject.window == nil\n @color=temp\n apply\n end\n }\n yield\n end\n }\n self\n end", "def draw_outline color: 'red'\n @canvas.rect(\n x: @left,\n y: @top,\n width: width,\n height: height,\n style: \"stroke: #{color}; fill: none\"\n )\n end", "def print_border_mb row, col, height, width, color, attr\n mvwaddch row, col, ACS_ULCORNER\n mvwhline( row, col+1, ACS_HLINE, width-6)\n mvwaddch row, col+width-5, Ncurses::ACS_URCORNER\n mvwvline( row+1, col, ACS_VLINE, height-4)\n\n mvwaddch row+height-3, col, Ncurses::ACS_LLCORNER\n mvwhline(row+height-3, col+1, ACS_HLINE, width-6)\n mvwaddch row+height-3, col+width-5, Ncurses::ACS_LRCORNER\n mvwvline( row+1, col+width-5, ACS_VLINE, height-4)\n end", "def top_border_stroke\n line_stroke(\n settings.border.style.top_left,\n settings.border.style.top_junc,\n settings.border.style.top_right\n ) do\n settings.border.style.top_horiz * (dimensions.inner_grid_width + (settings.scrollbar.vert? ? 1 : 0))\n end\n end", "def on_button(b, evnt, coords)\n #puts \"B#{b} #{evnt}, #{coords}\"\n end", "def setBorderColor\n return if @coloration[:border].nil?\n ciColor = CIColor.alloc.initWithColor(MEalert.getColor(@coloration[:border]))\n cgColor = CGColorCreate(ciColor.colorSpace, ciColor.components)\n @accessory.wantsLayer = true\n @accessory.layer.borderColor = cgColor\n @accessory.layer.borderWidth = 1\n end", "def under_point?(mouse_x, mouse_y)\n border.contains?(mouse_x, mouse_y)\n end", "def border\n '+' + ('-' * @max_y) + '+'\n end", "def left_button_up(sender, selector, event)\n @canvas.ungrab\n @mouse_down = false\n flush_commands\n board_draw\n end", "def mouse_clicked\n super\n ring_size = random(50, 150)\n rings << Ring.new(:x => mouseX, :y => mouseY, :width => ring_size, :height => ring_size, :length => random(24, 48).to_i)\n end", "def draw\n # Draw background color\n Gosu.draw_rect(0, 0, WIN_WIDTH, WIN_HEIGHT, @background, ZOrder::BACKGROUND, mode=:default)\n # Draw the button\n Gosu.draw_rect(50, 50, 100, 50, Gosu::Color::GREEN, ZOrder::MIDDLE, mode=:default)\n # Draw the button text\n @button_font.draw(\"Click me\", 65, 65, ZOrder::TOP, 1.0, 1.0, Gosu::Color::BLACK)\n # Draw the mouse position information\n @info_font.draw(\"mouse_x: #{@locs[0]}\", 0, 350, ZOrder::TOP, 1.0, 1.0, Gosu::Color::BLACK)\n end", "def Pager_SetBorder(hwnd, iBorder) send_pager_message(hwnd, :SETBORDER, lparam: iBorder) end", "def stroke_paint(paint)\n end", "def border?\n name == 'border'\n end", "def setup_border_windows(name, window)\n # Set black and white color pair\n window.attron(Curses.color_pair(8))\n name = name.to_s\n\n # Apply box border to window with pipe and dash symbols\n window.box('|', '-')\n\n # Set curser position to the middle of the top border and add name of box\n window.setpos(0, (window.maxx / 2.0).ceil - (name.length / 2.0).ceil)\n window.addstr(name.upcase)\n\n window.noutrefresh\nend", "def print_border_mb row, col, height, width, color, attr\n # the next is for xterm-256 \n att = get_attrib attr\n len = width\n len = Ncurses.COLS-0 if len == 0\n # print a bar across the screen \n #attron(Ncurses.COLOR_PAIR(color) | att)\n # this works for newmessagebox but not for old one.\n # Even now in some cases some black shows through, if the widget is printing spaces\n # such as field or textview on a messagebox.\n # 2016-01-14 - replacing 1 with space since junk is showing up in some cases.\n space_char = \" \".codepoints.first\n (row-1).upto(row+height-1) do |r|\n # this loop clears the screen, printing spaces does not work since ncurses does not do anything\n mvwhline(r, col, space_char, len)\n end\n #attroff(Ncurses.COLOR_PAIR(color) | att)\n\n mvwaddch row, col, Ncurses::ACS_ULCORNER\n mvwhline( row, col+1, Ncurses::ACS_HLINE, width-6)\n mvwaddch row, col+width-5, Ncurses::ACS_URCORNER\n mvwvline( row+1, col, Ncurses::ACS_VLINE, height-4)\n\n mvwaddch row+height-3, col, Ncurses::ACS_LLCORNER\n mvwhline(row+height-3, col+1, Ncurses::ACS_HLINE, width-6)\n mvwaddch row+height-3, col+width-5, Ncurses::ACS_LRCORNER\n mvwvline( row+1, col+width-5, Ncurses::ACS_VLINE, height-4)\n end", "def draw\n @status_buttons.each do |i|\n i.draw\n end\n end", "def add_border(cell_ref, edges = :all)\n cells = self[cell_ref]\n BorderCreator.new(self, cells, edges).draw\n end", "def draw_edge\n print \"|\"\n end", "def highlight(set_or_clear )\r\n\r\n if set_or_clear == :set\r\n begin\r\n @original_border = @o.border.to_i\r\n if @o.border.to_i==1\r\n @o.border = 2\r\n else\r\n @o.border=1\r\n end\r\n rescue\r\n @original_border = nil\r\n end\r\n else\r\n begin \r\n @o.border= @original_border unless @original_border == nil\r\n @original_border = nil\r\n rescue\r\n # we could be here for a number of reasons...\r\n ensure\r\n @original_border = nil\r\n end\r\n end\r\n super \r\n end", "def on_button_down(button_id, point)\n end", "def highlight\n\t\tpushStyle\n\t\t\tno_stroke\n\t\t\tfill 14, 70, 70\n\t\t\tellipse(@node_x, @node_y, @@node_size + @@expand, @@node_size + @@expand)\n\t\tpopStyle\n\tend", "def gift_card_for_business_button\n\t\t$tracer.trace(__method__)\n\t\treturn ToolTag.new(a.id(\"/blueLinkUnderline/\"), __method__, self)\n end", "def drawarrow(*)\n super\n end", "def game_over\n @scene.window.cursor = true\n x = 0\n y = @scene.height * 0.3\n x1 = 0\n x2 = @scene.width\n y1 = @scene.height * 0.3\n y2 = @scene.height * 0.6\n draw_window(x, y, x1, x2, y1, y2, @game_over_img)\n\n load_gm_btns unless @no_button && @yes_button\n\n @no_button.draw\n @yes_button.draw\n end", "def on_button_up(button_id, point)\n end", "def go\n update\n borders\n display\n end", "def left_button_down(sender, selector, event)\n @canvas.grab\n @mouse_down = true\n end", "def add_border(size=3,r=0,g=0,b=0)\n width = @x_size+2*size\n height = @y_size+2*size\n resampled = image_create_true_color(width,height)\n image_filled_rectangle(resampled,0,0,width,height, r, g, b)\n image_copy(@picture,resampled,size,size,0,0,@x_size,@y_size)\n image_destroy(@picture)\n @x_size = width\n @y_size = height\n @picture = image_create_true_color(@x_size,@y_size)\n image_filled_rectangle(@picture,0,0,@x_size,@y_size,255,255,255)\n image_color_transparent(@picture,255,255,255)\n image_copy(resampled,@picture,0,0,0,0,@x_size,@y_size)\n end", "def place_button(x, y, message)\r\n Gosu.draw_rect(x, y, 70, 45, Gosu::Color::GREEN, ZOrder::MIDDLE, mode=:default)\r\n @button_font.draw_text(message, x+5, y+10, ZOrder::TOP, 1.0, 1.0, Gosu::Color::BLACK)\r\n end", "def highlight_element(element)\n execute_script(\"arguments[0].style.border='3px solid red'\", element)\n end", "def border\n \"#{BORDER}\\n #{self.align_center} \\n#{BORDER}\"\n end", "def buttons; end", "def TreeView_SetBorder(hwnd, dwFlags, xBorder, yBorder)\r\n send_treeview_message(hwnd, :SETBORDER, wparam: dwFlags, lparam: MAKELPARAM(xBorder, yBorder))\r\n end", "def hover\n root_node.hover\n end", "def print_borders #:nodoc:\n width = @width\n height = @height-1 # 2010-01-04 15:30 BUFFERED HEIGHT\n window = @graphic # 2010-01-04 12:37 BUFFERED\n startcol = @col \n startrow = @row \n #@color_pair = get_color($datacolor)\n bordercolor = @border_color || $datacolor\n borderatt = @border_attrib || Ncurses::A_NORMAL\n\n window.print_border startrow, startcol, height, width, bordercolor, borderatt\n print_title\n end", "def border=(_arg0); end", "def paint_border(options = HashWithIndifferentAccess.new)\n options.reverse_merge! theme[:border] if theme[:border]\n options[:style] = :none if options[:style].nil?\n return if options[:style] == :none\n\n # first we need a stencil\n d = Magick::Draw.new\n theme.apply_to(d)\n d.fill(\"white\")\n d.stroke(\"transparent\")\n paint_border!(options[:style], d)\n stencil = Magick::Image.new(width, height)\n stencil.matte_reset!\n d.draw(stencil)\n\n # now we place the graphics context over the stencil, causing any areas blocked (transparent pixels) by the stencil\n # to be blocked in the graphics context\n stencil.composite!(graphics_context, 0, 0, AtopCompositeOp)\n\n # then we need to retrace the border, this time using the colors we want\n d = Magick::Draw.new\n theme.apply_to(d)\n d.fill(theme[:background][:color]) if theme[:background] and theme[:background][:color]\n d.stroke(options[:color] || theme[:stroke][:color]) if options[:color] || (theme[:stroke] && theme[:stroke][:color])\n paint_border!(options[:style], d)\n\n # finally, we can composite the stencil (which is now the actual image) back into the graphics context (which is\n # useless), and then commit the border to the finished product.\n graphics_context.composite!(stencil, 0, 0, CopyCompositeOp)\n d.draw(graphics_context)\n end", "def brew_button_status; end", "def btn_area_first\n\n\t\t@layer_btns = HBox.new( true, 0 )\n\t\t@layer_btns.set_size_request( 800 , 40 )\n\n\t\t@btn_sintrom = Button.new(\"Sintrom\")\n\t\t@btn_sintrom.set_size_request( 100, 40 )\n\t\t@btn_sintrom.signal_connect( \"clicked\" ) do\n\t\t\tmain_area_sintrom\n\t\tend\n\t\t@btn_agenda = Button.new(\"Agenda\")\n\t\t@btn_agenda.set_size_request( 100, 40 )\n\t\t@btn_agenda.signal_connect( \"clicked\" ) do\n\t\t\ton_exit\n\t\tend\n\t\t@btn_bdays = Button.new(\"Cumpleaños\")\n\t\t@btn_bdays.set_size_request( 100, 40 )\n\t\t@btn_bdays.signal_connect( \"clicked\" ) do\n\t\t\ton_exit\n\t\tend\n\t\t@btn_shifts = Button.new(\"Turnos\")\n\t\t@btn_shifts.set_size_request( 100, 40 )\n\t\t@btn_shifts.signal_connect( \"clicked\" ) do\n\t\t\ton_exit\n\t\tend\n\t\t@btn_exit = Button.new(\"Exit\")\n\t\t@btn_exit.set_size_request( 100, 40 )\n\t\t@btn_exit.signal_connect( \"clicked\" ) do\n\t\t\ton_exit\n\t\tend\n\n\t\t@layer_btns.add( @btn_sintrom )\n\t\t@layer_btns.add( @btn_agenda )\n\t\t@layer_btns.add( @btn_bdays )\n\t\t@layer_btns.add( @btn_shifts )\n\t\t@layer_btns.add( @btn_exit )\n\n\t\t@layer_general.put( @layer_btns, 0, 760 )\n\n\tend", "def how_to_create_buttons args\n # Define a button style\n args.state.button_style = { w: 82, h: 10, }\n\n # Render instructions\n args.state.button_message ||= \"Press a Button!\"\n args.nokia.labels << args.nokia\n .default_label\n .merge(x: 42,\n y: 82,\n text: args.state.button_message,\n alignment_enum: 1)\n\n\n # Creates button one using a border and a label\n args.state.button_one_border = args.state.button_style.merge( x: 1, y: 32)\n args.nokia.borders << args.state.button_one_border\n args.nokia.labels << args.nokia\n .default_label\n .merge(x: args.state.button_one_border.x + 2,\n y: args.state.button_one_border.y + NOKIA_FONT_SM_HEIGHT + 2,\n text: \"Button One\")\n\n # Creates button two using a border and a label\n args.state.button_two_border = args.state.button_style.merge( x: 1, y: 20)\n\n args.nokia.borders << args.state.button_two_border\n args.nokia.labels << args.nokia\n .default_label\n .merge(x: args.state.button_two_border.x + 2,\n y: args.state.button_two_border.y + NOKIA_FONT_SM_HEIGHT + 2,\n text: \"Button Two\")\n\n # Initialize the state variable that tracks which button was clicked to \"\" (empty stringI\n args.state.last_button_clicked ||= \"--\"\n\n # If a click occurs, check to see if either button one, or button two was clicked\n # using the inside_rect? method of the mouse\n # set args.state.last_button_clicked accordingly\n if args.nokia.mouse_click\n if args.nokia.mouse_click.inside_rect? args.state.button_one_border\n args.state.last_button_clicked = \"One Clicked!\"\n elsif args.nokia.mouse_click.inside_rect? args.state.button_two_border\n args.state.last_button_clicked = \"Two Clicked!\"\n else\n args.state.last_button_clicked = \"--\"\n end\n end\n\n # Render the current value of args.state.last_button_clicked\n args.nokia.labels << args.nokia\n .default_label\n .merge(x: 42,\n y: 5,\n text: args.state.last_button_clicked,\n alignment_enum: 1)\nend", "def mouse_over_star?\n inputs.mouse.point.inside_rect?(scale_up(state.star))\n end", "def hover(name, *args)\n widget(name, *args).hover\n end", "def mouse_pressed\n # Check to see if the mouse was clicked on the box and if so create\n # a real spring and bind the mouse location to the box with a spring\n return unless box.contains(mouse_x, mouse_y)\n\n @spring = spring.bind(mouse_x, mouse_y, box)\nend", "def is_border?(); @type == GRT_BORDER; end", "def remove_border_mark(sexp)\n def sexp.inline_border?\n false\n end \n end", "def highlight(box)\n @pieces[box[0]][box[1]].stroke = yellow\nend", "def add_the_button\n @theButton = UIButton.buttonWithType(UIButtonTypeRoundedRect)\n @theButton.setTitle('Refresh Weather!', forState:UIControlStateNormal)\n # @theButton.setTitleColor(BW.rgb_color(255, 255, 255), forState:UIControlStateNormal)\n @theButton.backgroundColor = BW.rgb_color(255, 255, 255)\n # @theButton.layer.borderColor = BW.rgb_color(255, 255, 255)\n # @theButton.layer.borderWidth = 0.5\n @theButton.layer.cornerRadius = 10\n @theButton.frame = [[center_h(200), (@view_height - 200)], [200,50]] #[[x-axis, y-axis], [width, height]]\n # @theButton.setTitle('Stop', forState:UIControlStateSelected)\n\n # Add an event for the button when touched\n # 'self' refers to the handler class for the action in which the callback is defined\n # buttonClicked is the method that will be called when the event happens\n # forControlEvents will take the event name\n @theButton.addTarget(self, action:'buttonClicked', forControlEvents:UIControlEventTouchUpInside)\n\n self.view.addSubview(@theButton)\n end", "def mouse_pressed\n flock << Boid.new(mouse_x, mouse_y)\nend", "def borderColor(theColor)\n return if theColor.nil?\n @coloration[:border] = theColor\n end", "def border_style ; view.borderStyle ; end", "def how_to_render_borders args\n # Render a square at 0, 0 with a width and height of 3\n args.nokia.borders << { x: 0, y: 0, w: 3, h: 3, a: 255 }\n\n # Render a square at 3, 3 with a width and height of 3\n args.nokia.borders << { x: 3, y: 3, w: 4, h: 4, a: 255 }\n\n # Render a square at 5, 5 with a width and height of 4\n args.nokia.borders << { x: 7, y: 7, w: 5, h: 5, a: 255 }\nend", "def add_default_styling_selected(button_class)\n button_class ||= \"#3300FF\"\n button_class.insert(0, \"button \")\n end", "def draw\n # Depending on whether this is the currently selected input or not, change the\n # background's color.\n if @window.text_input == self then\n @drawbox = @box \n else\n @drawbox = @box_hover\n end\n @drawbox.draw(x - PADDING_X, y - PADDING_Y, 100)\n pos_x = x + @font.text_width(self.text[0...self.caret_pos])\n sel_x = x + @font.text_width(self.text[0...self.selection_start]) \n # Draw the caret; again, only if this is the currently selected field.\n if @window.text_input == self then\n @window.draw_line(pos_x, y - PADDING_Y + 5, CARET_COLOR,\n pos_x, y + height - PADDING_Y - 5, CARET_COLOR, 100)\n end\n # Finally, draw the text itself!\n @font.draw(self.text, x, y, 120, 1, 1, 0xff_646464)\n end" ]
[ "0.7579998", "0.6786909", "0.66236174", "0.64722836", "0.6234266", "0.61411273", "0.61221", "0.598452", "0.5958936", "0.5951008", "0.589083", "0.5876123", "0.58147824", "0.5776819", "0.5771609", "0.57340175", "0.57271856", "0.5711821", "0.5698336", "0.56889844", "0.5677698", "0.5666909", "0.5659543", "0.5649699", "0.56495845", "0.5644283", "0.5626092", "0.5597341", "0.55957425", "0.5592953", "0.55903506", "0.55430096", "0.55112827", "0.55030924", "0.54743403", "0.5449967", "0.5435261", "0.54291433", "0.54233795", "0.54219735", "0.5416489", "0.5410427", "0.5409333", "0.5409333", "0.5390003", "0.53662366", "0.53414273", "0.53393906", "0.53341985", "0.5332348", "0.5330441", "0.5320577", "0.5307318", "0.5300563", "0.529337", "0.5286516", "0.5272437", "0.5255939", "0.52351266", "0.52338016", "0.52305514", "0.5227147", "0.5221716", "0.5221072", "0.5215316", "0.52119195", "0.5207861", "0.52018553", "0.5198808", "0.518333", "0.5180312", "0.5178087", "0.51722324", "0.5149132", "0.5144411", "0.5140751", "0.5134985", "0.51342356", "0.51273036", "0.51269835", "0.5126573", "0.512395", "0.51204437", "0.51198435", "0.51179355", "0.51170206", "0.51108557", "0.5102091", "0.5100251", "0.50967", "0.5094993", "0.50941104", "0.508868", "0.50865424", "0.5084707", "0.50831443", "0.5081933", "0.5080639", "0.50751674", "0.50750566" ]
0.7456396
1
GET /principal_establecs/1 GET /principal_establecs/1.json
def show @principal_establec = PrincipalEstablec.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @principal_establec } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @principal_establec = PrincipalEstablec.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @principal_establec }\n end\n end", "def get_principal(filter = nil, sort = nil)\n puts \"ACS: get_principal\"\n res = query(\"principal-list\", \n \"filter\" => filter, \n \"sort\" => sort)\n\n return res.body\n end", "def index\n @employees = current_owner.employees.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employees }\n end\n end", "def index\n @objectives = current_user.objectives.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @objectives }\n end\n end", "def index\n @cliente = Clienteempresa.where(empresa_id: current_user.empresa_id)\n end", "def index\n @evac_centers = EvacCenter.all\n render json: @evac_centers\n end", "def index\n @assessors = Assessor.all\n end", "def index\n @junior_enterprises = JuniorEnterprise.all\n end", "def index\n @organization_memberships = OrganizationMembership.where(user_id: params['user_id'])\n authorize @organization_memberships\n\n render json: @organization_memberships\n end", "def index\n render json: @authority.all\n end", "def create\n @principal_establec = PrincipalEstablec.new(params[:principal_establec])\n\n respond_to do |format|\n if @principal_establec.save\n format.html { redirect_to @principal_establec, notice: 'Registro creado satisfactoriamente.' }\n format.json { render json: @principal_establec, status: :created, location: @principal_establec }\n else\n format.html { render action: \"new\" }\n format.json { render json: @principal_establec.errors, status: :unprocessable_entity }\n end\n end\n end", "def identities\n render json: current_user.identities\n end", "def index\n @enterprises = Enterprise.all\n end", "def index\n @identities = Identity.all\n\n render json: @identities\n end", "def index\n rol = Role.where(:id=>current_user.role).first\n if rol.nombre == \"DN\" or rol.nombre == \"ACRM\"\n @achievments = Achievment.all\n else\n @achievments = Achievment.where(:sede_id=>current_user.sede)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @achievments }\n end\n end", "def index\n @user = current_user;\n @toeic_logs = ToeicLog.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @toeic_logs }\n end\n end", "def index\n authorize Role\n\n respond_to do |format|\n format.json { render json: @roles }\n end\n end", "def index\n # render json: Epicenter.where('owner_id = ?', @epicenter.id)\n puts Epicenter.all.count\n render json: Epicenter.all\n end", "def index\n @representante_athletes = current_user.organization.athletes\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @representante_athletes }\n end\n end", "def index\n render json: @user.contracts, each_serializer: ContractSerializer\n end", "def index\n @enterprise_sectors = EnterpriseSector.all\n end", "def index\n @empolyees = Empolyee.all\n end", "def index\n \n @controles_asistencias = ControlAsistencia.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @controles_asistencias }\n end\n end", "def index\n @client_profiles = ClientProfile.all\n\n authorize ClientProfile\n end", "def index\n @articles = current_user.articles\n json_response(@articles)\n end", "def index\n @establecimientos = Establecimiento.all\n respond_to do |format|\n format.json { \n\n if (params[:appkey].eql? appkey) #si el appkey es correcto\n\n ests = @establecimientos.map { |establecimiento| { :nombre_establecimiento => establecimiento.nombre, :id => establecimiento.id, \n :descripcion => establecimiento.descripcion, :longitud => establecimiento.longitud,\n :latitud => establecimiento.latitud, :direccion => establecimiento.direccion, :imagen => establecimiento.foto.url(:small),\n :eventos => establecimiento.eventos.map { |evento| { :nombre => evento.nombre } } } } \n render json: ests\n else\n render json: {:error => \"No autorizado\"}\n end\n\n\n\n }\n format.html { redirect_to :controller=>'login', :action=>'login' } #solo el app movil puede revisar toda la lista de establecimientos.\n end\n end", "def events\n url = 'https://api.artic.edu/api/v1/exhibitions?limit=35'\n\n res = RestClient.get(url)\n JSON.parse(res)\nend", "def index\n @interno_unidads = InternoUnidad.all\n render json: @interno_unidads\n end", "def index\n @pedidos = Pedido.find(:all, :conditions => [\"cliente_id=?\", session[:usuario_id]])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pedidos }\n end\n end", "def index\n @faculties = Faculty.all\n json_response(@faculties)\n end", "def index\n @expedientes = Expediente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expedientes }\n end\n end", "def index\n @antecedentes = Antecedente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @antecedentes }\n end\n end", "def index\n @electors = Elector.all\n\n render json: @electors\n end", "def index\n @os_groups_principals = OsGroupsPrincipal.all\n end", "def index\n render :json => UserInterest.all\n end", "def index\n rol = Role.where(:id=>current_user.role).first\n if rol.nombre == \"DN\" or rol.nombre == \"ACRM\"\n @colegiaturas = Colegiatura.all\n else\n @colegiaturas = Colegiatura.where(:sede_id=>current_user.sede)\n end \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @colegiaturas }\n end\n end", "def index\n @exercises = Exercise.all\n @user = current_user # changed get logged user\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exercises }\n end\n end", "def index\n #@usuarios = User.all.order_by([:email, :asc]).paginate(:page => params[:page], :per_page => @@page)\n @usuarios = User.accessible_by(current_ability).order_by([:email, :asc]).paginate(:page => params[:page], :per_page => @@page)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @usuarios }\n end\n end", "def index\n @usuarios = Usuario.all\n @usuarios_json = @usuarios.to_json\n end", "def index\n @establecimientos = Establecimiento.all\n end", "def index\n @employee_associations = EmployeeAssociation.paginate(:page => params[:page], :per_page => 5)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employee_associations }\n end\n end", "def index\n residencial = current_user.apartamento.residencial\n #@eventos = Evento.joins(:user => [{:apartamento => :residencial}])\n #.where(:residenciais => {:id => residencial.id})\n #.order(\"created_at DESC\")\n\n @eventos = Evento\n .where(:residencial_id => residencial.id)\n .order(\"created_at DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @eventos }\n end\n end", "def index\n @educators = Educator.all\n end", "def index\n @educators = Educator.all\n end", "def index\n @deporte_usuarios = DeporteUsuario.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @deporte_usuarios }\n end\n end", "def index\n @seshes = current_user.seshes\n end", "def index\n @company_authorities = CompanyAuthority.all\n\n render json: @company_authorities\n end", "def articles \n render json: @owner, custom_key: true\n end", "def index\n\t\tauthorize! :index, EstadoPresupuesto\n @estado_presupuestos = EstadoPresupuesto.all\n end", "def byuser\n @evclient = Evclient.find(:first, :conditions => [ \"userid = ?\", params[:userid]])\n #@evclient = Evclient.find(params[:id])\n\n respond_to do |format|\n #format.html # show.html.erb\n format.json { render json: @evclient }\n end\n end", "def show\n @identity_table = IdentityTable.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @identity_table }\n end\n end", "def index\n employees = manager.employees.active\n render json: employees.all, each_serializer: EmployeeSerializer, status: 200\n end", "def show\r\n @usertable = Usertable.find(params[:id])\r\n # @user = User.find(session[:user_id])\r\n \r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @usertable }\r\n end\r\n end", "def expiracion\n @usuario = Usuario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @usuario }\n end\n end", "def index\n @clients = current_user.clients\n render json: @clients\n end", "def index\n @usuario_seguidores = UsuarioSeguidor.all\n end", "def employee_details\n if current_user.role == \"SuperAdmin\"\n @employees = Employee.all\n \n render :status => 200,\n :json => { :success => true,\n \n :data => {:employees => @employees} }\n else\n render :status => 201,\n :json => { :success => false,\n \n :data => {:error => \"You dont have authority!\" }}\n end\n \nend", "def lista_estoque()\n @client.get(Route.new([ROTA_DID_ESTOQUE]))\n end", "def show\n raise Exceptions::EducatorNotAuthorized unless current_educator.districtwide_access\n educator = Educator.find(params[:id])\n render json: educator.as_json({\n :only => [\n :id,\n :email,\n :full_name,\n :staff_type,\n :restricted_to_sped_students,\n :restricted_to_english_language_learners,\n :can_view_restricted_notes,\n :schoolwide_access,\n :districtwide_access,\n :grade_level_access,\n :admin\n ],\n :methods => [:labels],\n :include => {\n :school => { :only => [:id, :name] },\n :sections => {\n :only => [:id, :section_number],\n :methods => [:course_description]\n },\n :homeroom => { :only => [:id, :name] }\n }\n })\n end", "def index\n @epicrises = Epicrisis.all\n @epicrises = @epicrises.page(params[:page])\n end", "def index\n @educations = Education.all\n render json: @educations\n end", "def index\n @guest_educators = GuestEducator.all\n end", "def destroy\n @principal_establec = PrincipalEstablec.find(params[:id])\n @principal_establec.destroy\n\n respond_to do |format|\n format.html { redirect_to principal_establecs_url, notice: 'Registro eliminado satisfactoriamente.' }\n format.json { head :no_content }\n end\n end", "def index\n @universities = University.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @universities }\n end\n end", "def to_response\n slice(:id, :username, :cash, :referrals).to_json\n end", "def index\n users = policy_scope(User)\n render json: { users: users }\n end", "def index\n authorize! :ver, UsuarioPrestamo.new\n @usuarios_prestamos = UsuarioPrestamo.all\n @alumnos = UsuarioPrestamo.where(:categoria => UsuarioPrestamo.categorias[:alumno])\n @profesores = UsuarioPrestamo.where(:categoria => UsuarioPrestamo.categorias[:profesor])\n @personal = UsuarioPrestamo.where(:categoria => UsuarioPrestamo.categorias[:personal])\n end", "def index\n @employes = Employe.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employes }\n end\n end", "def show\n @userin = UserInvestor.find(params[:id])\n if @userin.present?\n data = @userin.as_json(include: %i[product_invest])\n render json: { status: 'OK', results: data, errors: nil }, status: :ok\n else\n render json: { status: 'FAIL', results: nil,\n errors: 'user does not exist' },\n status: :not_found\n end\n end", "def index\n @centro_usuarios = CentroUsuario.all\n end", "def index\n @representante_empresas = RepresentanteEmpresa.all\n end", "def index\n #Para no mostrar el empleado oculto que se usa como superuser en la base de datos y el sistema\n @employees = Employee.where(\"id != 1\")\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employees }\n end\n end", "def index\n @unidades = current_user.empresa.unidades.page params[:page]\n end", "def index\r\n @interventions = Intervention.all\r\n @the_author_id = current_employee['id']\r\n session[:author_id] = @the_author_id\r\n end", "def index\n @collections = current_user.collections.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @collections }\n end\n end", "def index\n professors = Professor.includes(:courses).all\n\n render json: professors.to_json(include: :courses)\n end", "def index\n @client_has_employeurs = ClientHasEmployeur.all\n end", "def index\n @invoices = Invoice.where( :user_id => current_user.id).all\n if current_user.role? :admin \n @invoices = Invoice.all\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invoices }\n end\n end", "def index\n @sections = case current_user.rc\n when 'EA'\n Section.includes(:profile).order('profiles.firstname').page(params[:page])\n when 'IA','EO'\n current_user.sections.includes(:profile).order('profiles.firstname').page(params[:page])\n when 'MOE'\n current_user.sections.includes(:profile).order('profiles.firstname').page(params[:page])\n when 'CR'\n current_user.sections.includes(:profile).order('profiles.firstname').page(params[:page])\n when 'ET'\n current_user.center.sections.includes(:profile).order('profiles.firstname').page(params[:page])\n end\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sections }\n end\n end", "def index\n @enrolls = Enroll.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @enrolls }\n end\n end", "def get_principal\n @principal = Principal.active.first\n end", "def index\n @budgets = Budget.find_owned_by current_user\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @budgets }\n end\n end", "def index\n render json: [UserRole.find_by(user_id: params[:user_id],\n role_id: params[:role_id])],\n each_serializer: UserRoleSerializer\n end", "def show\n @projeto = Projeto.find(params[:id])\n @enrollments = Enroll.find_all_by_projeto_id params[:id]\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @projeto }\n end\n end", "def index_user\n @tickets = Ticket.all_for_user(current_user.id)\n render json: @tickets, status: 200\n end", "def index\n @tutorados = Tutorado.all\n\n render json: @tutorados, status: :ok\n end", "def index\n @universitarios = Universitario.all\n end", "def index\n @roles = @client.roles\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @roles }\n end\n end", "def list_customers_manager\n @manager = User.find(params[:id])\n @employees = @manager.employee\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employees }\n end\n end", "def index\n @apoio_educacioanls = ApoioEducacioanl.all\n end", "def index\n json_response(User.all) \n end", "def index\n email = AuthenticationHelper::Auth.instance.getEmailFromJWT( request )\n if ( email == nil )\n render json: :nothing, status: :unprocessable_entity\n return\n end\n\n user = User.find_by(email: email)\n if ( user )\n accounts = Account.where(user_id: user[\"id\"])\n render json: accounts, status: :ok\n else\n render json: :nothing, status: :unprocessable_entity\n end\n end", "def index\n @cages = current_user.cages\n\n respond_to do |format|\n format.json { render json: @cages }\n end\n end", "def index\n if current_user.nil?\n redirect_to(log_in_path) and return\n end\n\n @alumnos_personas_vinculadas = AlumnoPersonaVinculada.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @alumnos_personas_vinculadas }\n end\n end", "def index\n @tenants = keystone.tenants\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @tenants }\n end\n end", "def index\n @roles = Role.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @roles }\n end\n end", "def index\n @economy_sectors = EconomySector.all\n end", "def index\n @endorsements = Endorsement.all\n\n render json: @endorsements\n end", "def index\n @tipo_usuarios = TipoUsuario.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tipo_usuarios }\n end\n end", "def index\n render jsonapi: authorized_collection, each_serializer: Connection::Serializer\n end" ]
[ "0.61725277", "0.5739674", "0.5683607", "0.5643067", "0.5642022", "0.5622067", "0.5571116", "0.55657357", "0.5544598", "0.5529464", "0.5519646", "0.5506317", "0.54886705", "0.5472257", "0.5470508", "0.5462052", "0.5455519", "0.5450254", "0.54342055", "0.5429684", "0.54123986", "0.5401694", "0.53844595", "0.535011", "0.534866", "0.5345205", "0.5344311", "0.53358555", "0.5328969", "0.5328492", "0.53238463", "0.5319115", "0.5303925", "0.52993965", "0.5296438", "0.5296102", "0.5294763", "0.52867407", "0.5286045", "0.52838653", "0.5280475", "0.5279944", "0.52791566", "0.52791566", "0.5279084", "0.5278069", "0.5277786", "0.5276247", "0.5275518", "0.52690876", "0.5268291", "0.5267546", "0.52640307", "0.5261248", "0.5256034", "0.5243709", "0.5243536", "0.523952", "0.52350837", "0.5234724", "0.5230338", "0.52299273", "0.5226306", "0.52249676", "0.5224773", "0.5220604", "0.522007", "0.5215633", "0.5214856", "0.5205003", "0.5204247", "0.51983917", "0.51932895", "0.51914537", "0.519123", "0.51890737", "0.5188283", "0.5187927", "0.5175369", "0.5172119", "0.51701564", "0.51670694", "0.5162759", "0.516222", "0.51617247", "0.5160713", "0.51581687", "0.5157989", "0.5157294", "0.5153212", "0.51494855", "0.51489824", "0.51489705", "0.5147728", "0.51472497", "0.51439345", "0.5140678", "0.5139002", "0.51372576", "0.51332796" ]
0.72588146
0
GET /principal_establecs/new GET /principal_establecs/new.json
def new @principal_establec = PrincipalEstablec.new respond_to do |format| format.html # new.html.erb format.json { render json: @principal_establec } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @principal_establec = PrincipalEstablec.new(params[:principal_establec])\n\n respond_to do |format|\n if @principal_establec.save\n format.html { redirect_to @principal_establec, notice: 'Registro creado satisfactoriamente.' }\n format.json { render json: @principal_establec, status: :created, location: @principal_establec }\n else\n format.html { render action: \"new\" }\n format.json { render json: @principal_establec.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @identity_table = IdentityTable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @identity_table }\n end\n end", "def new\n @new = true\n @alumno = Alumno.new\n @alumno.build_user\n atributos\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @alumno }\n end\n end", "def new\n \tauthorize! :new, @palestrante\n @palestrante = Palestrante.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @palestrante }\n end\n end", "def new\n @new = true\n @administrativo = Administrativo.new\n @administrativo.build_user\n atributos\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @administrativo }\n end\n end", "def new\n if current_user.nil?\n redirect_to(log_in_path) and return\n end\n\n @alumno_persona_vinculada = AlumnoPersonaVinculada.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @alumno_persona_vinculada }\n end\n end", "def new\r\n @usertable = Usertable.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @usertable }\r\n end\r\n end", "def new\n @permiso_pernocta = PermisoPernocta.new\n @id = PermisoPernocta.next_id\n @solicita = User.get_solicitante(current_user.id)\n @VoBo = User.get_jefe_area(current_user.id)\n @vehiculos = Vehiculo.get_area_vehiculos(current_user.id)\n end", "def new\n @prioridade = Prioridade.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @prioridade }\n end\n end", "def new\n if current_user.nil?\n redirect_to(log_in_path) and return\n end\n\n @persona_vinculada = PersonaVinculada.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @persona_vinculada }\n end\n end", "def new\n @table_user = TableUser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @table_user }\n end\n end", "def new\n @usuario = Usuario.new\n \n @personasvinculadas = PersonaVinculada.anioescolar_colegio(anio_escolar.id).where(\"personas_vinculadas.id not in (select persona_vinculada_id from usuarios where colegio_id = ? and persona_vinculada_id <> 0)\", colegio.id).order(\"apellido_paterno\", \"apellido_materno\", \"nombres\")\n @alumnoscolegio = Alumno.por_anio_escolar(anio_escolar.id).where(\"alumnos.id not in (select alumno_id from usuarios where colegio_id = ? and alumno_id <> 0)\", colegio.id).order(\"apellido_paterno\", \"apellido_materno\", \"nombres\")\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @usuario }\n end\n end", "def new\n @tipo_usuario = TipoUsuario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipo_usuario }\n end\n end", "def new\n @security = Security.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @security }\n end\n end", "def new\n @he = He.new\n if current_user.district_id and !current_user.admin?\n district = District.find(current_user.district_id)\n @centers = district.centers\n else\n @centers = Center.all\n end\n @chiefs = User.find_all_by_user_type(1)\n @nurses = User.find_all_by_user_type(2)\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @he }\n end\n end", "def new\n @niveau = Niveau.new\n authorize! :new, @niveau\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @niveau }\n end\n end", "def new\n @alumno = Alumno.new\n @alumno.build_user\n atributos\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @alumno }\n end\n end", "def new\n @enterprise = Enterprise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @enterprise }\n end\n end", "def new\n @u = U.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @u }\n end\n end", "def new\n @asociado = Asociado.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @asociado }\n end\n end", "def new\n @membership = Membership.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @membership }\n end\n end", "def new\n @internships_user = InternshipsUser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @internships_user }\n end\n end", "def newent\n @user = User.new\n respond_to do |format|\n format.html # newent.html.erb\n format.json { render :json => @user }\n end\n end", "def new\n @new_policy = NewPolicy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_policy }\n end\n end", "def new\n @estudiante = Estudiante.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @estudiante }\n end\n end", "def new\n @table = Table.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @table }\n end\n end", "def new\n @table = Table.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @table }\n end\n end", "def new\n @membership = Membership.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @membership }\n end\n end", "def new\n @owner = Owner.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @owner }\n end\n end", "def new\n if current_user.access == 2\n redirect_to \"/users/indexU\"\n end\n @timetable = Timetable.new\n puts @timetable.to_json\n end", "def new\n @user = current_user;\n @toeic_log = ToeicLog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @toeic_log }\n end\n end", "def new\n @collection = @user.collections.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @collection }\n end\n end", "def new\n @sesion = Sesion.where(entidad_paraestatal_id: @entidad_paraestatal.id).new\n #@sesion.suplente = Suplente.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sesion }\n end\n end", "def new\n puts 'NEW METHOD'\n @pessoa = Pessoa.new\n @pessoa.enderecos.build\n 2.times { @pessoa.telefones.build }\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pessoa }\n end\n end", "def new\n @utente = Utente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @utente }\n end\n end", "def new\n @cliente = Cliente.new\n localidad_new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cliente }\n end\n end", "def create\n @pagina_principal = PaginaPrincipal.new(pagina_principal_params)\n\n respond_to do |format|\n if @pagina_principal.save\n format.html { redirect_to @pagina_principal, notice: 'Pagina principal was successfully created.' }\n format.json { render :show, status: :created, location: @pagina_principal }\n else\n format.html { render :new }\n format.json { render json: @pagina_principal.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @stable = Stable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stable }\n end\n end", "def new\n @fornecedore = Fornecedore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fornecedore }\n end\n end", "def new\n add_breadcrumb t('model.create', model: Client.model_name.human)\n @client = Client.new\n @client.created_by = current_user.id\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @client }\n end\n end", "def new\n @selecao = Selecao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @selecao }\n end\n end", "def new\n @responsibility = Responsibility.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @responsibility }\n end\n end", "def new\n @role = Role.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @role }\n end\n end", "def new\n @role = Role.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @role }\n end\n end", "def new\n @role = Role.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @role }\n end\n end", "def new\n add_breadcrumb t('model.create', model: Client.model_name.human)\n @client = Client.new\n @client.created_by_id = current_user.id\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @client }\n end\n end", "def create\n @principalgroupe = Principalgroupe.new(principalgroupe_params)\n\n respond_to do |format|\n if @principalgroupe.save\n format.html { redirect_to @principalgroupe, notice: 'Principalgroupe was successfully created.' }\n format.json { render :show, status: :created, location: @principalgroupe }\n else\n format.html { render :new }\n format.json { render json: @principalgroupe.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @member = Member.new\n user = @member.build_user\n @roles = Role.find(:all)\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @member }\n end\n end", "def new\n @uset = Uset.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @uset }\n end\n end", "def new\n @politicalcommittee = Politicalcommittee.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @politicalcommittee }\n end\n end", "def new\n @estacionamiento = Estacionamiento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @estacionamiento }\n end\n end", "def new\n @member = Member.new\n user = @member.build_user\n @roles = Role.find(:all)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @member }\n end\n end", "def new\n @security_proj = SecurityProj.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @security_proj }\n end\n end", "def new\n\tadd_breadcrumb \"Nuevo usuario\", :new_usuario_path\n @usuario = Usuario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @usuario }\n end\n end", "def new\n \t@entrega = Entrega.new\n \tend", "def new\n @tecnico = current_user.tecnicos.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tecnico }\n end\n end", "def new\n @persona_tipo = PersonaTipo.new\n if current_user.is_admin?\n @congresos = Congreso.all(:order => \"nombre\")\n else\n @congresos = current_user.congresos(:order => \"nombre\")\n end\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @persona_tipo }\n end\n end", "def new\n @alumno = Alumno.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @alumno }\n end\n end", "def new\n @caixa = Caixa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @caixa }\n end\n end", "def new\n @establec_ppal = EstablecPpal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @establec_ppal }\n end\n end", "def new\n @classtable = Classtable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @classtable }\n end\n end", "def new\n @anniversary = Anniversary.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @anniversary }\n end\n end", "def new\n #@article = Article.where(:user_id => current_user.id).new\n @article = @user.articles.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "def create\n authorize! :create, Tipo\n @tipo = Tipo.new(tipo_params)\n log(\"Se ha creado la nomina #{@lt}\", 0)\n\n respond_to do |format|\n if @tipo.save\n format.html { redirect_to tipos_path, notice: 'La nómina fue creada exitosamente.' }\n format.json { render :show, status: :created, location: @tipo }\n else\n format.html { render :new }\n format.json { render json: @tipo.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n usuario = Usuario.find(params[:usuario_id])\n semana = Semana.find(params[:semana_id])\n \n @planificacion_semanal = PlanificacionSemanal.new(:usuario => usuario, :semana => semana)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @planificacion_semanal }\n end\n end", "def new\n @atr = Atr.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @atr }\n end\n end", "def new\n @role = Role.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @role }\n end\n end", "def new\n @collection = current_user.collections.find(params[:collection_id])\n @entity_type = EntityType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entity_type }\n end\n end", "def new\n @trabalho = current_user.trabalhos.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trabalho }\n end\n end", "def new\n #Para no mostrar el empleado oculto que se usa como superuser en la base de datos y el sistema\n @employees = Employee.where(\"id != 1\")\n @employee = Employee.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @employee }\n end\n end", "def new\n @asesor = Asesor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @asesor }\n end\n end", "def new\n @tipo_negocio = TipoNegocio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipo_negocio }\n end\n end", "def new\n @publicidade = Publicidade.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @publicidade }\n end\n end", "def new\n @sugerencia = Sugerencia.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @sugerencia }\n end\n end", "def new\n @suplente = Suplente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @suplente }\n end\n end", "def new\n @employee = current_owner.employees.new\n @category = category\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @employee }\n end\n end", "def new\n\n @clinica = Clinica.new\n @usuario = Usuario.new\n\n end", "def new\n @prioridade_adocao = PrioridadeAdocao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @prioridade_adocao }\n end\n end", "def new\n @cuerpo = Cuerpo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cuerpo }\n end\n end", "def new\n @finalidad_cultivo = FinalidadCultivo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @finalidad_cultivo }\n end\n end", "def new\n @ai_contest = AiContest.new\n @ai_contest.owner_id = current_user.id\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ai_contest }\n end\n end", "def new\n authorize! :new, @mesasredonda\n @mesasredonda = Mesasredonda.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mesasredonda }\n end\n end", "def new\n @plannegocio = Plannegocio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @plannegocio }\n end\n end", "def new\n\t\t@roles_new = Role.all\n\t\tif can?(:update, Role)\n\t\t\t@roles_new = Role.all\n\t\tend\n\n @user = User.new if can?(:create, User)\n respond_to do |format|\n format.json { render :json => @user } \n format.xml { render :xml => @user }\n format.html\n end\n end", "def new\n @leader = Leader.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @leader }\n end\n end", "def new\n @precinct = Precinct.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @precinct }\n end\n end", "def new\n @capacitacion = Capacitacion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @capacitacion }\n end\n end", "def new\n @citizenship_class = @grantee.citizenship_classes.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @citizenship_class }\n end\n end", "def new\n @publicidad = Publicidad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @publicidad }\n end\n end", "def new\n @nabe = Nabe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nabe }\n end\n end", "def new\n @ativo_outro = AtivoOutro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ativo_outro }\n end\n end", "def new\n @uniprot = Uniprot.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @uniprot }\n end\n end", "def new\n @byoin = Byoin.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @byoin }\n end\n end", "def new\n @ano = Ano.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ano }\n end\n end", "def new\n @proveedor = Proveedor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @proveedor }\n end\n end", "def new\n @tipo_pensum = TipoPensum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipo_pensum }\n end\n end", "def new\n @estatuto = Estatuto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @estatuto }\n end\n end", "def new\n @intern = Intern.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @intern }\n end\n end", "def new\n @capacidad = Capacidad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @capacidad }\n end\n end", "def new\n @status_ativ = StatusAtiv.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @status_ativ }\n end\n end" ]
[ "0.7169801", "0.6647806", "0.6558073", "0.6476157", "0.6390883", "0.6379562", "0.6320748", "0.62947965", "0.6281423", "0.62744516", "0.625537", "0.625238", "0.62340295", "0.6227621", "0.62196976", "0.6212629", "0.62100494", "0.6202174", "0.6197757", "0.61742055", "0.61696005", "0.61639255", "0.6163396", "0.61502403", "0.61469716", "0.6145467", "0.6145467", "0.6136809", "0.6125615", "0.6124238", "0.6123429", "0.61229604", "0.6112776", "0.6109711", "0.61072415", "0.6105455", "0.6104488", "0.61004627", "0.6093028", "0.60808986", "0.60802114", "0.6078615", "0.60775733", "0.60775733", "0.60775733", "0.60742694", "0.6074052", "0.60710794", "0.60699904", "0.6068692", "0.60638756", "0.60593396", "0.60570055", "0.6055407", "0.60479087", "0.6045866", "0.60447687", "0.6042334", "0.6037224", "0.60357594", "0.603555", "0.6034722", "0.6032573", "0.6030509", "0.60269845", "0.6026862", "0.6026654", "0.60264105", "0.60255504", "0.6023645", "0.6023551", "0.6022591", "0.60218084", "0.6020419", "0.60204184", "0.60202575", "0.60178596", "0.6015667", "0.60113204", "0.6010134", "0.600449", "0.6004266", "0.5996561", "0.5995975", "0.5995389", "0.5993691", "0.5993046", "0.59927785", "0.5989317", "0.5989252", "0.5987096", "0.59870857", "0.5983097", "0.59809846", "0.59803134", "0.597899", "0.5978027", "0.5976442", "0.59761375", "0.5971913" ]
0.7668875
0
POST /principal_establecs POST /principal_establecs.json
def create @principal_establec = PrincipalEstablec.new(params[:principal_establec]) respond_to do |format| if @principal_establec.save format.html { redirect_to @principal_establec, notice: 'Registro creado satisfactoriamente.' } format.json { render json: @principal_establec, status: :created, location: @principal_establec } else format.html { render action: "new" } format.json { render json: @principal_establec.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @principal_establec = PrincipalEstablec.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @principal_establec }\n end\n end", "def create\n @employee = Employee.new(employee_params)\n @employee.user_created_id = current_user.id\n @employee.usuario_externo\n @employee.usuario = params[:employee][:usuario]\n @employee.previous_profile_security = params[:employee][:security_profiles_id]\n respond_to do |format|\n if @employee.save\n format.html { redirect_to employees_path, notice: I18n.t('.employees.controller.create') }\n format.json { render :show, status: :created, location: @employee }\n else\n format.html { render :new }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def save\n send(\"principals=\", client_principal.to_abbreviated)\n client.put(api_path, to_json, headers)\n true\n end", "def show\n @principal_establec = PrincipalEstablec.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @principal_establec }\n end\n end", "def create\n @os_groups_principal = OsGroupsPrincipal.new(os_groups_principal_params)\n\n respond_to do |format|\n if @os_groups_principal.save\n format.html { redirect_to @os_groups_principal, notice: 'Os groups principal was successfully created.' }\n format.json { render :show, status: :created, location: @os_groups_principal }\n else\n format.html { render :new }\n format.json { render json: @os_groups_principal.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n params[:estacionamiento][:id_proveedor]=session['user']['id']\n @estacionamiento = Estacionamiento.new(estacionamiento_params)\n\n respond_to do |format|\n if @estacionamiento.save\n format.html { redirect_to @estacionamiento, notice: 'Estacionamiento was successfully created.' }\n format.json { render :show, status: :created, location: @estacionamiento }\n else\n format.html { render :new }\n format.json { render json: @estacionamiento.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @school = School.new(school_params)\n @principals = User.with_role(:principal)\n\n respond_to do |format|\n if @school.save\n format.html { redirect_to @school, notice: 'School was successfully created.' }\n format.json { render :show, status: :created, location: @school }\n else\n format.html { render :new }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end", "def agregar_estudiante_a_seccion\n \n if __es_del_grupo_docente && params[:id] && __es_numero_entero?(params[:id]) && SeccionSitioWeb.where(:id => params[:id]).size > 0\n @seccion = \"estudiantes\"\n @seccion_sitio_web = SeccionSitioWeb.where(:id => params[:id]).first\n @cedulas = Usuario.order(\"cedula\").where(:id => Estudiante.all).collect{ |x| x.cedula.to_s}.uniq\n return\n end\n\n redirect_to :asignatura_nombre => @sitio_web.nombre_url, :semestre => @sitio_web.periodo, :controller => \"estudiantes\", :action => \"index\"\n return\n end", "def create\n @pagina_principal = PaginaPrincipal.new(pagina_principal_params)\n\n respond_to do |format|\n if @pagina_principal.save\n format.html { redirect_to @pagina_principal, notice: 'Pagina principal was successfully created.' }\n format.json { render :show, status: :created, location: @pagina_principal }\n else\n format.html { render :new }\n format.json { render json: @pagina_principal.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if current_user\n # render json: { status: 200, msg: \"Logged-in as #{current_user.name}\" }\n @userin = UserInvestor.new(userin_params)\n if @userin.save\n render json: { status: 'OK', results: @userin, errors: nil },\n status: :created\n else\n render json: { status: 'FAIL', results: nil,\n errors: 'failed to create user' },\n status: :unprocesable_entity\n end\n end\n end", "def create\n @occasion = Occasion.new(occasion_params)\n @occasion.administrators << current_user\n respond_to do |format|\n if @occasion.save\n format.html { redirect_to @occasion, notice: 'Occasion was successfully created.' }\n format.json { render :show, status: :created, location: @occasion }\n else\n format.html { render :new }\n format.json { render json: @occasion.errors, status: :unprocessable_entity }\n end\n end\n end", "def investigador_params\n params.require(:investigador).permit(:cedula, :nombres, :apellidos)\n end", "def create\n# authorize! :create, Observation\n @observation = Observation.new(observation_params)\n @classroom = @observation.classroom\n @principals = User.with_role(:principal)\n @specialists = User.with_role(:specialist)\n if current_user.has_role? :admin\n if !params[:observation][:specialist].nil?\n @observation.specialist = params[:observation][:specialist]\n elsif !params[:observation][:principal].nil?\n @observation.principal = params[:observation][:principal]\n end\n \n elsif current_user.has_role? :principal\n @observation.principal_id = current_user.id\n else\n @observation.specialist_id = current_user.id\n end\n \n respond_to do |format|\n if @observation.save\n format.html { redirect_to observation_observation_form_index_url(@observation), notice: 'Observation was started.' }\n format.json { render :show, status: :created, location: @observation }\n else\n format.html { render :new }\n format.json { render json: @observation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @junior_enterprise = JuniorEnterprise.new(junior_enterprise_params)\n\n respond_to do |format|\n if @junior_enterprise.save\n format.html { redirect_to @junior_enterprise, notice: 'Empresa Junior criada.' }\n format.json { render :show, status: :created, location: @junior_enterprise }\n else\n format.html { render :new }\n format.json { render json: @junior_enterprise.errors, status: :unprocessable_entity }\n end\n end\n end", "def criar_sobrevivente\n @suvivor = Sobrevivente.create(\n name: params[:name], genero: params[:genero], idade: params[:idade],\n lat: params[:lat], lon: params[:lon],\n agua: params[:agua], comida: params[:comida], medicamento: params[:medicamento],\n municao: params[:municao]\n )\n render json: @suvivor\n end", "def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend", "def update\n @principal_establec = PrincipalEstablec.find(params[:id])\n\n respond_to do |format|\n if @principal_establec.update_attributes(params[:principal_establec])\n format.html { redirect_to @principal_establec, notice: 'Registro editado satisfactoriamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @principal_establec.errors, status: :unprocessable_entity }\n end\n end\n end", "def asignar_cliente\n @usuario = Usuario.find(params[:responsable])\n @clientes = params[:cliente]\n respond_to do |format|\n if @usuario.responsable? or @usuario.transcriptor?\n for cliente in @clientes.values\n nuevo = Cliente.create(:usuario_id => @usuario.id, :cliente_id => cliente)\n @usuario.clientes << nuevo\n end \n format.html { redirect_to @usuario, notice: 'Clientes asignados satisfactoriamente'}\n else \n format.html { redirect_to update_usuario_path, notice: 'Error en servidor. Intente más tarde' }\n end\n end\n end", "def destroy\n @principal_establec = PrincipalEstablec.find(params[:id])\n @principal_establec.destroy\n\n respond_to do |format|\n format.html { redirect_to principal_establecs_url, notice: 'Registro eliminado satisfactoriamente.' }\n format.json { head :no_content }\n end\n end", "def test_post_request_collection\n params = {\n size: 3,\n employmentTypeUris: ['/dk/atira/pure/person/employmenttypes/academic'],\n employmentStatus: 'ACTIVE'\n }\n response = client.persons.all_complex params: params\n assert_equal response.code, 200\n assert_instance_of HTTP::Response, response\n end", "def create\n @eatable = Eatable.new(eatable_params)\n\n respond_to do |format|\n if @eatable.save\n format.html { redirect_to @eatable, notice: 'Eatable was successfully created.' }\n format.json { render :show, status: :created, location: @eatable }\n else\n format.html { render :new }\n format.json { render json: @eatable.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_example_collection(user)\n collection = Collection.create(\n name: 'Examples',\n user_id: user.id\n )\n req_a = Request.create(\n title: 'GET with params and api_key',\n method: 'GET',\n url: 'https://calendarific.com/api/v2/holidays',\n collection_id: collection.id\n )\n attr_a = [{attr_type: 'params', key: 'country', value: 'US', description: 'get all US holidays'},\n {attr_type: 'params', key: 'year', value: '2020', description: 'for 2020'},\n {attr_type: 'auth', key: 'api_key', value: '823747516d829b140ef9807ad001d167526c64bf', description: 'params'}]\n attr_a.each do |atr|\n Attrib.create(\n attr_type: atr[:attr_type],\n key: atr[:key],\n value: atr[:value],\n description: atr[:description],\n request_id: req_a.id\n )\n end\n\n req_b = Request.create(\n title: 'GET User not found 404',\n method: 'GET',\n url: 'https://reqres.in/api/users/23',\n collection_id: collection.id\n )\n\n req_c = Request.create(\n title: 'POST Create user',\n method: 'POST',\n url: 'https://reqres.in/api/users',\n collection_id: collection.id\n )\n Attrib.create(\n attr_type: 'headers',\n key: 'Content-type',\n value: 'application/json',\n description: '',\n request_id: req_c.id\n )\n Body.create(\n body_type: 'Raw',\n key: '',\n value: '',\n description: '',\n raw_body: \n'{\n \"name\": \"morpheus\",\n \"job\": \"leader\"\n}',\n request_id: req_c.id\n )\n\n req_d = Request.create(\n title: 'UPDATE an employee record',\n method: 'PUT',\n url: 'http://dummy.restapiexample.com/api/v1/update/21',\n collection_id: collection.id\n )\n Attrib.create(\n attr_type: 'headers',\n key: 'Content-type',\n value: 'application/json',\n description: '',\n request_id: req_d.id\n )\n Body.create(\n body_type: 'Raw',\n key: '',\n value: '',\n description: '',\n raw_body: \n'{\n \"name\":\"test1\",\n \"salary\":\"1123\",\n \"age\":\"23\"\n}',\n request_id: req_d.id\n )\n \n req_e = Request.create(\n title: 'DELETE a resource',\n method: 'DELETE',\n url: 'https://jsonplaceholder.typicode.com/posts/1',\n collection_id: collection.id\n )\n end", "def create\n # Code refactoring that use the relationship between person and Entry Sets\n @entry_set = @current_user.person.entry_sets.build(params[:entry_set])\n\n respond_to do |format|\n if @entry_set.save\n format.json { render json: @entry_set, status: :created, location: @entry_set }\n else\n format.json { render json: @entry_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @estacionamiento = Estacionamiento.new(estacionamiento_params)\n @lista_departamentos = Ubigeo.find_by_sql(\"select distinct idDepartamento, Departamento from ubigeos\")\n @lista_provincias = Ubigeo.find_by_sql(\"select distinct idProvincia, Provincia from ubigeos\")\n @lista_distritos = Ubigeo.find_by_sql(\"select distinct idDistrito, Distrito from ubigeos\")\n @serv_adicinales = ServAdicinale.all\n\n respond_to do |format|\n if @estacionamiento.save\n format.html { redirect_to @estacionamiento, notice: 'Estacionamiento was successfully created.' }\n format.json { render :show, status: :created, location: @estacionamiento }\n else\n format.html { render :new }\n format.json { render json: @estacionamiento.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @employee_insentive = EmployeeInsentive.new(employee_insentive_params)\n\n respond_to do |format|\n if @employee_insentive.save\n format.html { redirect_to employee_insentives_url, notice: 'Employee insentive was successfully created.' }\n format.json { render :show, status: :created, location: @employee_insentive }\n else\n format.html { render :new }\n format.json { render json: @employee_insentive.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def create\n @estabelecimento = Estabelecimento.new(estabelecimento_params)\n @usuario = Usuario.find(usuario_params[:id])\n @estabelecimento_usuario = EstabelecimentosUsuario.create(estabelecimento: @estabelecimento, usuario: @usuario, ic_criador: true)\n\n respond_to do |format|\n if @estabelecimento.save\n format.html { redirect_to @estabelecimento, notice: 'Estabelecimento was successfully created.' }\n format.json { render json: @estabelecimento }\n else\n format.html { render :new }\n format.json { render json: @estabelecimento.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n authorize! :create_almacen,Sigesp::Solicitud \n unidad = session['unidad'] \n return render json: { unidad: \"Esta Unidad Administrativa no tiene Numero de Control \" }, status: :unprocessable_entity if Sigesp::CtrlRequisicion.control_compra(unidad).nil?\n\n @solicitudes = Sigesp::Solicitud.crear_solicitudes_almacen(sigesp_solicitud_alamcen_params)\n @grupoSolicitud = SolicitudGrupo.new\n @solicitudes.each do |solicitud|\n @grupoSolicitud.solicitudes << solicitud \n end\n if @grupoSolicitud.valid? \n @grupoSolicitud.guardar(unidad,current_usuario)\n return render json: { url: sigesp_solicitudsalmacen_path(@grupoSolicitud.solicitudes[0])} \n else\n return render json:@grupoSolicitud.errors ,status: :unprocessable_entity\n end \n end", "def create\n @principalgroupe = Principalgroupe.new(principalgroupe_params)\n\n respond_to do |format|\n if @principalgroupe.save\n format.html { redirect_to @principalgroupe, notice: 'Principalgroupe was successfully created.' }\n format.json { render :show, status: :created, location: @principalgroupe }\n else\n format.html { render :new }\n format.json { render json: @principalgroupe.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n user = User.create!(\n email: params[:email],\n password: params[:password],\n password_confirmation: params[:password_confirmation],\n name: params[:name],\n role: 'user'\n )\n\n #unless ( params[:role].eql? 'user' )\n # establishment = Establishment.find(params[:establishment])\n # user.establishments << establishment\n #end\n\n if user.save\n render json: user.as_json(:email=>user.email), status: 201\n return\n else\n warden.custom_failure!\n render json: user.errors, status: 422\n end\n\n rescue => e\n Rails.logger.error '============================================================'\n Rails.logger.error e.message\n Rails.logger.error e.backtrace\n end", "def create\n\t\tauthorize! :create, AsignacionRol\n @asignacion_rol = AsignacionRol.new(asignacion_rol_params)\n @asignacion_rol.esActual = true\n @asignacion_rol.active = true\n @proyecto = @asignacion_rol.proyecto\n @roles = []\n @rols = Rol.where(tipo_rol: TipoRol.where(nombre:'Proyecto'))\n coor_sist = Rol.where(\"nombre = ?\", 'Coordinador Sistema').first\n asig_func = AsignacionFuncion.where(\"usuario_id = ? AND rol_id = ?\", current_usuario, coor_sist).first\n @rols.each do |rol|\n if rol.nombre != 'Coordinador' || asig_func != nil then\n @roles << rol\n end\n end\n if unica(@asignacion_rol.usuario_id,@asignacion_rol.proyecto_id, @asignacion_rol.rol_id) == true\n\t respond_to do |format|\n\t if @asignacion_rol.save\n sesion= Sesion.find_by(usuario_id: current_usuario.id, fechaFin: nil)\n Transaccion.create!(\n \t\t descripcion: \"Creación asociación rol #{@asignacion_rol.rol.nombre} al usuario #{@asignacion_rol.usuario.nombreUsuario} del proyecto #{@asignacion_rol.proyecto.nombre} : actual = #{ t @asignacion_rol.esActual.to_s}\",\n \t\t sesion_id: sesion.id ,\n \t\t proyecto_id: @asignacion_rol.proyecto.id)\n\t\tformat.html {redirect_to :controller => 'asignacion_roles', :action => 'index',:proyecto_id => @asignacion_rol.proyecto.id } \n\t\tformat.json { render :show, status: :created, location: @asignacion_rol }\n\t else\n params[:usuario_id] = @asignacion_rol.usuario_id\n \t\tformat.html { render :new }\n \t\tformat.json { render json: @asignacion_rol.errors, status: :unprocessable_entity }\n\t end\n\t end\n else\n\t respond_to do |format|\n\t\t format.html { redirect_to :controller => 'asignacion_roles', :action => 'index', :proyecto_id => @asignacion_rol.proyecto.id\n\t\t flash[:danger] = 'El usuario ya se encuentra asignado' } \n\t end\n end\n end", "def create\n authorize! :create, Solicitud\n @solicitante=Solicitante.find(params[:solicitante_id])\n @beneficiario=Beneficiario.find(params[:beneficiario_id])\n @solicitud = Solicitud.create(solicitud_params)\n @solicitud.solicitante_id=@solicitante.id\n @solicitud.beneficiario_id=@beneficiario.id\n\n respond_to do |format|\n if @solicitud.save\n format.html { redirect_to solicitante_beneficiario_path(@solicitante, @beneficiario), notice: 'Solicitud creada exitosamente.' }\n format.json { render :show, status: :created, location: solicitante_beneficiario_path(@solicitante, @beneficiario) }\n else\n format.html { render :new }\n format.json { render json: @solicitud.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sucursale = Sucursale.new(sucursale_params)\n @sucursale.usuarios_id = current_usuario.id\n respond_to do |format|\n if @sucursale.save\n format.html { redirect_to @sucursale, notice: 'Sucursal creada con exito!' }\n format.json { render :show, status: :created, location: @sucursale }\n else\n format.html { render :new }\n format.json { render json: @sucursale.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #assign unpermitted parameter 'entries' to a variable\n entries = params[\"entries\"]\n @invoice = @user.invoices.build(invoice_params)\n #save entries\n @invoice.entries = entries\n if @invoice.save\n render json: @invoice, status: :created, location: api_v1_user_invoice_url(@user, @invoice)\n else\n render json: @invoice.errors, status: :unprocessable_entity\n end\n end", "def create\n @election = Election.new(election_params)\n respond_to do |format|\n if @election.save\n @election.users << current_user #add the current user to the users for this election\n format.html { redirect_to user_elections_path, notice: 'Election was successfully created.' }\n format.json { render :show, status: :created, location: @election }\n else\n format.html { render :new }\n format.json { render json: @election.errors, status: :unprocessable_entity }\n end\n end\n end", "def enrollment(params = {})\n scope 'default'\n post('enrollment/', params)\n end", "def create_new_person_authority(test_data)\n data_input_errors = enter_person_auth_data test_data\n click_top_save_button\n when_exists(delete_button, Config.short_wait)\n data_input_errors\n end", "def add_user_for_tenant(args = {}) \n post(\"/tenants.json/#{args[:tenantId]}/users\", args)\nend", "def create\n @edital = Edital.new(edital_params)\n\n if user_signed_in?\n @edital.user = current_user\n end\n \n respond_to do |format|\n if @edital.save\n format.html { redirect_to @edital, notice: 'Edital was successfully created.' }\n format.json { render :show, status: :created, location: @edital }\n else\n format.html { render :new }\n format.json { render json: @edital.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\tauthorize! :create, EstadoPresupuesto\n @estado_presupuesto = EstadoPresupuesto.new(estado_presupuesto_params)\n\n respond_to do |format|\n if @estado_presupuesto.save\n format.html { redirect_to gestionar_estados_presupuestos_path}#@estado_presupuesto, notice: 'Estado presupuesto fue creado satisfactoriamente.' }\n format.json { render :show, status: :created, location: @estado_presupuesto }\n else\n format.html { render :new }\n format.json { render json: @estado_presupuesto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n authorize! :manage, Employee\n if ['Teacher', 'Manager'].include?(employee_params['responsibility'])\n @employee = (eval \"#{employee_params['responsibility']}.new(employee_attrs)\")\n else\n @employee = Employee.new(employee_attrs)\n end\n\n respond_to do |format|\n if @employee.save\n format.html { redirect_to Employee.last, notice: t('action.create.succeed', entity: Employee.model_name.human) }\n format.json { render action: 'show', status: :created, location: @employee }\n else\n format.html { render action: 'new' }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sesiune = Sesiune.new(sesiune_params)\n\n respond_to do |format|\n if @sesiune.save\n\n # duplic temele si domeniile din ultima sesiune si le adaug in baza de date cu sesiune_id asta pe care tocmai am creat-o\n @ultima_sesiune = Sesiune.where(este_deschisa: false).last\n Domeniu.where(sesiune_id: @ultima_sesiune.id).each do |dom|\n nou_dom = Domeniu.create(nume: dom.nume, descriere: dom.descriere, user_id: dom.user_id, sesiune_id: @sesiune.id)\n Tema.where(sesiune_id: @ultima_sesiune.id).where(domeniu_id: dom.id).each do |tema|\n Tema.create(nume: tema.nume, descriere: tema.descriere, domeniu_id: nou_dom.id, este_libera: true, user_id: tema.user_id, sesiune_id: @sesiune.id)\n # ce faci dc user_id-ul temei este un student care a terminat? si th i se desfiinteaza contul?\n end\n end\n\n format.html { redirect_to controlPanel_path, notice: 'Sesiune was successfully created.' }\n format.json { render action: 'show', status: :created, location: @sesiune }\n else\n format.html { render action: 'new' }\n format.json { render json: controlPanel_path.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @faculties = Faculty.create!(faculty_params)\n json_response(@faculties, :created)\n end", "def create\n @user = User.new(employee_params)\n authorize @user\n\n respond_to do |format|\n if @user.save\n @user.employee!\n format.html { redirect_to branch_office_employees_path, 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", "def create\n @sessao = Sessao.new(sessao_params)\n psicologos_for_select\n pacientes_for_select\n respond_to do |format|\n @sessao.user = current_user\n if @sessao.save\n format.html { redirect_to @sessao, notice: \"Sessao was successfully created.\" }\n format.json { render :show, status: :created, location: @sessao }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @sessao.errors, status: :unprocessable_entity }\n end\n end\n end", "def addservice\n\n @service = ServiceProvider.find_by(username: params[:serviceprovider][:username]);\n permitted = params[:serviceprovider].permit( :description, :category_id);\n @service.services.create(permitted);\n\n render json: @service\n\n\nend", "def create\n raise Pundit::NotAuthorizedError\n @test_set = TestSet.new(permitted_params)\n permitted_to! :create, @test_set\n\n respond_to do |format|\n if @test_set.save\n format.html { redirect_to @test_set, :notice => 'Test set was successfully created.' }\n format.json { render :json => @test_set, :status => :created, :location => @test_set }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @test_set.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @usuario_prestamo = UsuarioPrestamo.new(usuario_prestamo_params)\n authorize! :crear, @usuario_prestamo\n respond_to do |format|\n if @usuario_prestamo.save\n format.html { redirect_to @usuario_prestamo, notice: 'El usuario de préstamo fue agregado correctamente' }\n format.json { render :show, status: :created, location: @usuario_prestamo }\n else\n format.html { render :new }\n format.json { render json: @usuario_prestamo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @calorie_intake = CalorieIntake.new(params[:calorie_intake])\n @user = User.find session[:user_id] unless session[:user_id]==nil\n @calorie_intake.user=@user\n respond_to do |format|\n if @calorie_intake.save\n format.html { redirect_to(@calorie_intake, :notice => 'CalorieIntake was successfully created.') }\n format.xml { render :xml => @calorie_intake, :status => :created, :location => @calorie_intake }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @calorie_intake.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n authorize! :create,Beneficiario\n solicitante=Solicitante.find(params[:solicitante_id])\n @beneficiario = Beneficiario.create(beneficiario_params)\n @beneficiario.historiales.build(parentesco: beneficiario_params[:parentesco], solicitante_id: solicitante.id)\n respond_to do |format|\n if @beneficiario.save\n format.html { redirect_to solicitante_beneficiario_path(solicitante, @beneficiario), notice: 'Beneficiario creado exitosamente.' }\n format.json { render :show, status: :created, location: solicitante_beneficiario_path(solicitante, @beneficiario) }\n else\n format.html { render :new }\n format.json { render json: @beneficiario.errors, status: :unprocessable_entity }\n end\n end\n end", "def authority_params\n params.require(:authority).permit(:user_id, :service_id)\n end", "def set_establecimiento\n @establecimiento = Establecimiento.find(params[:id])\n end", "def set_establecimiento\n @establecimiento = Establecimiento.find(params[:id])\n end", "def set_establecimiento\n @establecimiento = Establecimiento.find(params[:id])\n end", "def junior_enterprise_params\n params.require(:junior_enterprise).permit(:seal ,:access, :user_id,:name, :logo, :description, :phrase, :site, :phone, :city, :state, :facebook, :youtube, :course, :area, :address, :training, :consultor, :product, :project)\n end", "def create\n if (usuario_signed_in? != true) #Si no hay usuario logueado\n redirect_to :controller=>'login', :action=>'login' #lo envia a login\n end\n @establecimiento = Establecimiento.new(establecimiento_params)\n @establecimiento.usuario_id = current_usuario.id\n respond_to do |format|\n if @establecimiento.save\n format.html { redirect_to current_usuario, notice: 'Establecimiento was successfully created.' }\n format.json { render action: 'show', status: :created, location: @establecimiento }\n else\n format.html { render action: 'new' }\n format.json { render json: @establecimiento.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @internship_committee = InternshipCommittee.new(internship_committee_params)\n\n respond_to do |format|\n if @internship_committee.save\n format.html { redirect_to @internship_committee, notice: 'Internship committee was successfully created.' }\n format.json { render :show, status: :created, location: @internship_committee }\n else\n format.html { render :new }\n format.json { render json: @internship_committee.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @establecimiento = Establecimiento.new(establecimiento_params)\n\n respond_to do |format|\n if @establecimiento.save\n format.html { redirect_to @establecimiento, notice: 'Establecimiento was successfully created.' }\n format.json { render :show, status: :created, location: @establecimiento }\n else\n format.html { render :new }\n format.json { render json: @establecimiento.errors, status: :unprocessable_entity }\n end\n end\n end", "def userin_params\n params.permit(:user_id, :product_invest_id, :investor_slot,\n :investor_pay, :invest_year, :created_at)\n end", "def create\nuser=User.find_by_id(current_user.id)\n @exprience = Exprience.new(params[:exprience])\n@exprience.user=user\n respond_to do |format|\n if @exprience.save\n format.html { redirect_to @exprience, notice: 'Exprience was successfully created.' }\n format.json { render json: @exprience, status: :created, location: @exprience }\n else\n format.html { render action: \"new\" }\n format.json { render json: @exprience.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @estadio = Estadio.new(params[:estadio])\n\n respond_to do |format|\n if @estadio.save\n newAuditoria = Auditoria.new\n newAuditoria.tabla = params[:controller]\n newAuditoria.action = params[:action]\n newAuditoria.usuario = User.all.first.id\n newAuditoria.clave = @estadio.id\n newAuditoria.save\n format.html { redirect_to @estadio, notice: 'Estadio was successfully created.' }\n format.json { render json: @estadio, status: :created, location: @estadio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @estadio.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @empresa = Empresa.new(empresa_params)\n user_id = params[:user_id].to_i\n if user_id > 0 #Given n0 is admin and \"\" could be interpreted as 0, we avoid the risk\n @empresa.user_id = user_id\n end\n respond_to do |format|\n if @empresa.save\n helpers.set_current_empresa(@empresa.user, @empresa.id)\n format.html { redirect_to @empresa, notice: 'Empresa creada con éxito.' }\n format.json { render :show, status: :created, location: @empresa }\n else\n format.html { render :new }\n format.json { render json: @empresa.errors, status: :unprocessable_entity }\n end\n end\n end", "def principals=(value)\n write(value)\n end", "def create\n authorize! :create, CompetenceTierGroup\n \n @competence_tier_group = CompetenceTierGroup.new(competence_tier_group_params)\n @competence_tier_group.save!\n render json: {status: :ok}\n end", "def create\n @he = He.new(params[:he])\n if current_user.district_id and !current_user.admin?\n district = District.find(current_user.district_id)\n @centers = district.centers\n else\n @centers = Center.all\n end\n @chiefs = User.find_all_by_user_type(1)\n @nurses = User.find_all_by_user_type(2)\n respond_to do |format|\n if @he.save\n format.html { redirect_to @he, notice: t(:record_created) }\n format.json { render json: @he, status: :created, location: @he }\n else\n format.html { render action: \"new\" }\n format.json { render json: @he.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_teachers_for_education_organization(required)\n teachers = []\n if !required.nil? and required.size > 0\n required[\"staff\"].each do |member|\n # skip this entry if its not an Educator --> handled in 'create_staff' method\n next if [\"Student\", \"IT Administrator\", \"Leader\", \"Aggregate Viewer\"].include? member[:role]\n\n @num_teachers += 1\n teachers << {\"id\" => member[:staff_id], \"name\" => member[:name]}\n end\n end\n teachers\n end", "def create\n @principal_caracteristica = PrincipalCaracteristica.new(principal_caracteristica_params)\n\n respond_to do |format|\n if @principal_caracteristica.save\n format.html { redirect_to @principal_caracteristica, notice: 'Principal caracteristica was successfully created.' }\n format.json { render :show, status: :created, location: @principal_caracteristica }\n else\n format.html { render :new }\n format.json { render json: @principal_caracteristica.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @startup = Startup.new(params[:startup])\n @startup.status = 'new'\n respond_to do |format|\n \n if @startup.save\n\t\t params[:notice]='Startup was successfully created.'\n else\n format.html { render action: \"new\" }\n format.json { render json: @startup.errors, status: :unprocessable_entity }\n end\n\n @investor = Investor.new\n @investor.startup_id = @startup.id\n @investor.user_id = session[:id]\n @investor.isowner = 1\n @investor.save\n \tformat.html { redirect_to @startup }\n \t\n \t end\n\n end", "def trustee_params\n params.require(:trustee).permit(:access_id, :full_name, :trustee_type, :dates_of_service, :university_status, :first_year)\n end", "def create\n @enterprise_sector = EnterpriseSector.new(enterprise_sector_params)\n\n respond_to do |format|\n if @enterprise_sector.save\n format.html { redirect_to @enterprise_sector, notice: 'Enterprise sector was successfully created.' }\n format.json { render :show, status: :created, location: @enterprise_sector }\n else\n format.html { render :new }\n format.json { render json: @enterprise_sector.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @employee = current_owner.employees.new(params[:employee])\n\n respond_to do |format|\n if @employee.save\n format.html { redirect_to @employee, notice: 'Employee was successfully created.' }\n format.json { render json: @employee, status: :created, location: @employee }\n else\n format.html { render action: \"new\" }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @discipline = Discipline.new(discipline_params)\n @discipline.users_id = current_user.id\n\n respond_to do |format|\n if @discipline.save\n @discipline.codigo = \"DISC-%04d\" % [@discipline.id]\n @discipline.save\n if params[:anexos]\n\n params[:anexos].each { |anx|\n @discanexo = Discanexo.new\n @discanexo.anexo = anx\n @discanexo.Discipline_id = @discipline.id\n @discanexo.save\n }\n end\n flash[:success] = \"Disciplina cadastrada com sucesso.\"\n format.html { redirect_to @discipline}\n format.json { render :show, status: :created, location: @discipline }\n else\n format.html { render :new }\n format.json { render json: @discipline.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @solicitacao_repass = SolicitacaoRepasse.new(solicitacao_repasse_params)\n @entregas_externas = EntregaExterna.all\n @entregas_externas_usuario = []\n @entregas_externas.each { |entrega|\n if !@current_user.isMorador || entrega.encomenda.usuario.id == @current_user.id\n @entregas_externas_usuario.push(entrega)\n end\n }\n\n respond_to do |format|\n if @solicitacao_repass.save\n format.html { redirect_to @solicitacao_repass, notice: \"Solicitacao repasse was successfully created.\" }\n format.json { render :show, status: :created, location: @solicitacao_repass }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @solicitacao_repass.errors, status: :unprocessable_entity }\n end\n end\n end", "def new_asignar_cliente\n @usuario = Usuario.find(params[:format])\n @usuario.clientes.build\n @clientes = Usuario.where(:admin => 0)\n end", "def create\n\n @aviso = current_user.avisos.new(aviso_params)\n respond_to do |format|\n if @aviso.save\n @evaluacionaviso = Evaluacionaviso.new\n @evaluacionaviso_id = @aviso_id\n @evaluacionaviso.a = @aviso.nombre\n @evaluacionaviso.b = @aviso.user\n @evaluacionaviso.c = @aviso.usersede\n @evaluacionaviso.h= @current_user.sexo\n @evaluacionaviso.e = @current_user.email\n @evaluacionaviso.i = nil\n @evaluacionaviso.j= nil\n @evaluacionaviso.k = nil\n @evaluacionaviso.save\n\n format.html { redirect_to misavisos_path, notice: 'Aviso was successfully created.' }\n format.json { render :show, status: :created, location: @aviso }\n else\n format.html { render :new }\n format.json { render json: avisos_path.errors, status: :unprocessable_entity }\n end\n end\n end", "def ayty_replicate_memberships\n # usuario que sera atualizado\n @user = User.find(params[:id])\n\n @user.ayty_replicate_memberships_by_user_id(params[:ayty_user_stunt_id])\n\n @principal = Principal.find(@user.id)\n\n respond_to do |format|\n format.html { redirect_to edit_polymorphic_path(principal, :tab => 'memberships') }\n format.js\n end\n end", "def reserva_params\n params.require(:reserva).permit(:escenario_id, :user_id, :fecha, :horainicio, :horafin, :estado)\n end", "def index\n @assessors = Assessor.all\n end", "def investigacion_params\n params.require(:investigacion).permit(:id_instituto, :id_microcuenca, :id_municipio, :id_documento, :autor, :titulo, :no_paginas, :fecha_realizacion, :fecha_publicacion, :resumen, :palabras_clave, :recurso_web, :id_status)\n end", "def create\n @employee = Employee.new(employee_params)\n authorize @employee, :create?\n\n respond_to do |format|\n if @employee.save\n format.html { redirect_to @employee, notice: 'Funcionário criado com sucesso.' }\n format.json { render :show, status: :created, location: @employee }\n else\n format.html { render :new }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @delegacione = Delegacione.new(params[:delegacione])\n\n\n respond_to do |format|\n if @delegacione.save\n newAuditoria = Auditoria.new\n newAuditoria.tabla = params[:controller]\n newAuditoria.action = params[:action]\n newAuditoria.usuario = User.all.first.id\n newAuditoria.clave = @delegacione.id\n newAuditoria.save\n format.html { redirect_to @delegacione, notice: 'Delegacione was successfully created.' }\n format.json { render json: @delegacione, status: :created, location: @delegacione }\n else\n format.html { render action: \"new\" }\n format.json { render json: @delegacione.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_instructor\n instructor = params[\"instructor\"]\n\n if instructor.blank?\n render json: {message: \"Chưa truyền dữ liệu!\"}, status: :unprocessable_entity\n return\n end\n\n instructor = JSON.parse(instructor)\n\n user = User.new(\n name: instructor['name']\n )\n\n email = instructor['email'].blank? ? Utils.nomalize_string(instructor['name']).to_s + \"@tudemy.vn\" : instructor['email']\n user.email = email\n user.password = \"12345678\"\n\n instructor_profile = User::InstructorProfile.new()\n instructor_profile.academic_rank = instructor['instructor_profile']['academic_rank'] unless instructor['instructor_profile']['academic_rank'].blank?\n instructor_profile.major = instructor['instructor_profile']['major'] unless instructor['instructor_profile']['major'].blank?\n instructor_profile.function = instructor['instructor_profile']['function'] unless instructor['instructor_profile']['function'].blank?\n instructor_profile.work_unit = instructor['instructor_profile']['work_unit'] unless instructor['instructor_profile']['work_unit'].blank?\n instructor_profile.description = instructor['instructor_profile']['description'] unless instructor['instructor_profile']['description'].blank?\n \n user.instructor_profile = instructor_profile\n\n if user.save\n render json: {message: \"Success\"}\n return\n else\n render json: {message: \"Lỗi không lưu được data\"}, status: :unprocessable_entity\n return\n end\n \n end", "def create\n @contest = Contest.new(params[:contest])\n @contest.contractor_id = current_user.id\n \n respond_to do |format|\n if @contest.save\n format.html { redirect_to @contest, :notice => 'Contest was successfully created.' }\n format.json { render :json => @contest, :status => :created, :location => @contest }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @contest.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n\n if params[:cliente_id] == \"\"\n @pessoa = Pessoa.new(pessoa_params)\n if params[:senha] == \"\"\n @password = SecureRandom.random_number(99999999)\n else\n @password = params[:senha]\n end\n\n @user = User.new\n @user.email = @pessoa.email\n @user.password = @password\n @user.password_confirmation = @password\n if current_user.id == 1\n @user.empresa_id = current_user.empresa_id\n #@user.role = \"ADMIN\"\n else\n @user.empresa_id = 1\n #@user.role = \"USER\"\n end\n\n @user.role = \"USER\"\n\n respond_to do |format|\n if @pessoa.save\n #criando usuário\n @user.pessoa_id = @pessoa.id\n if @user.save\n Userinfo.send_email(@user,current_user.empresa.nome_empresa).deliver\n end\n #relacionando usuário com empresa\n Clienteempresa.create(:empresa_id => current_user.empresa_id, :pessoa_id => @pessoa.id)\n format.html { redirect_to @pessoa, notice: 'Cadastro realizado com sucesso!.' }\n format.json { render :show, status: :created, location: @pessoa }\n else\n format.html { render :new }\n format.json { render json: @pessoa.errors, status: :unprocessable_entity }\n end\n end\n else\n Clienteempresa.create(:empresa_id => current_user.empresa_id, :pessoa_id => params[:cliente_id])\n respond_to do |format|\n format.html { redirect_to pessoas_url, notice: 'Cadastro realizado com sucesso!' }\n format.json { head :no_content }\n end\n end\n\n end", "def make\n @email=params[:email]\n @name=params[:name]\n @password=params[:password]\n @sectionId = params[:sectionId]\n @departmentId = params[:departmentId]\n @password_confirmation=params[:password_confirmation]\n a=User.new\n a.email=@email\n a.name=@name\n a.password=@password\n a.password_confirmation=@password_confirmation\n a.sec_id = @sectionId\n a.dept_id = @departmentId \n a.save\n\n render json: a, status: 201\n authorize! :make, a\n end", "def index\n\t\tauthorize! :index, EstadoPresupuesto\n @estado_presupuestos = EstadoPresupuesto.all\n end", "def create_instructor\n instructor = params[\"instructor\"]\n\n if instructor.blank?\n render json: {message: \"Chưa truyền dữ liệu!\"}, status: :unprocessable_entity\n return\n end\n\n instructor = JSON.parse(instructor)\n\n user = User.new(\n name: instructor['name']\n )\n\n email = instructor['email'].blank? ? Utils.nomalize_string(instructor['name']).to_s + \"@tudemy.vn\" : instructor['email']\n user.email = email\n user.password = \"12345678\"\n\n instructor_profile = User::InstructorProfile.new()\n instructor_profile.academic_rank = instructor['instructor_profile']['academic_rank'] unless instructor['instructor_profile']['academic_rank'].blank?\n instructor_profile.major = instructor['instructor_profile']['major'] unless instructor['instructor_profile']['major'].blank?\n instructor_profile.function = instructor['instructor_profile']['function'] unless instructor['instructor_profile']['function'].blank?\n instructor_profile.work_unit = instructor['instructor_profile']['work_unit'] unless instructor['instructor_profile']['work_unit'].blank?\n instructor_profile.description = instructor['instructor_profile']['description'] unless instructor['instructor_profile']['description'].blank?\n\n user.instructor_profile = instructor_profile\n\n if user.save\n render json: {message: \"Success\"}\n return\n else\n render json: {message: \"Lỗi không lưu được data\"}, status: :unprocessable_entity\n return\n end\n end", "def estudiante_params\n params.require(:estudiante).permit(:carnet, :apellidos, :nombres, :programa, :doble_programa, :doc_identidad, :fecha_nac, :sexo, :ciudad, :celular, :sit_academica, :cred_tomados, :cred_aprobados, :cred_pga, :prom_acum, :cred_transf, :ssc, :email, :cred_sem_actual, :reviso_informacion,:token_celular)\n end", "def create\n\n @intervention = Intervention.new(intervention_params)\n @intervention.author_id = current_user.employee.id\n\n zendesk_ticket_intervention(@intervention)\n\n respond_to do |format|\n if @intervention.save\n format.html { redirect_to @intervention, notice: 'Intervention was successfully created.' }\n format.json { render :show, status: :created, location: @intervention }\n else\n format.html { render :new }\n format.json { render json: @intervention.errors, status: :unprocessable_entity }\n end\n end\n end", "def auditoria_antes(accion, tabla, objeto)\n auditoria = Auditoria.new\n auditoria.usuario = current_usuario.login\n auditoria.ip = request.remote_ip\n auditoria.accion = accion\n auditoria.tabla = tabla\n auditoria.pista_antes = objeto.to_json\n auditoria.sistema = \"RUE\"\n auditoria.save\n\n auditoria.id\n\n end", "def create\n @employee = Employee.new(employee_params)\n @employee.employer = current_user.id\n \n\n\n respond_to do |format|\n if @employee.save\n format.html { redirect_to employees_path, notice: 'New Employee was successfully created.' }\n format.json { render :show, status: :created, location: @employee }\n else\n format.html { render :new }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n redirect_to :back\n end\n end\n end", "def aprov_estabelecimento_params\n params.require(:aprov_estabelecimento).permit(:estatus, :interessado_id)\n end", "def principal=(value)\n @principal = value\n end", "def principal=(value)\n @principal = value\n end", "def create\n @table = Table.new(params[:table].permit(:name, :notes, :x, :y, :table_type, :guest_ids => []))\n\n respond_to do |format|\n if @table.save\n format.html { redirect_to @table, notice: 'Table was successfully created.' }\n format.json { render 'tables/create', status: :created, location: @table }\n else\n format.html { render action: \"new\" }\n format.json { render json: @table.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @junior_enterprise = JuniorEnterprise.new(junior_enterprise_params) \n @junior_enterprise.save!\n\n is_admin? ? (@user_id = @junior_enterprise.id) : (@user_id = current_user.id) \n\n result = HTTParty.post(\"http://jeapi.herokuapp.com/junior_enterprises\",\n :body => {:name => @junior_enterprise.name, :user_id => @user_id, :logo => @junior_enterprise.logo_url.to_s , :description => @junior_enterprise.description, :phrase => @junior_enterprise.phrase, :phrase => @junior_enterprise.phrase, :site => @junior_enterprise.site, :phone => @junior_enterprise.phone, :city => @junior_enterprise.city, :state => @junior_enterprise.state, :youtube => @junior_enterprise.youtube, :facebook => @junior_enterprise.facebook, :course => @junior_enterprise.course, :area => @junior_enterprise.area, :address => @junior_enterprise.address, :consultor => @junior_enterprise.consultor, :product => @junior_enterprise.product, :access => 0, :project => @junior_enterprise.project, :training => @junior_enterprise.training},\n :headers => { 'token' => JEAPI_KEY } )\n \n @junior_enterprise.destroy\n if result.code == 201\n if is_admin? \n redirect_to \"/admin/junior_enterprises\", notice: \"Criado com sucesso\"\n else\n redirect_to \"/dashboard\", notice: \"Criado com sucesso\"\n end\n else\n @errors = JSON.parse(result.body)\n is_admin?(@current_user) ? (render template: \"admin/junior_enterprise_new\") : (render :new) \n end\n end", "def create(attrs, user = @@default_user)\n @attributes = send_request(\n \"organizations/#{attrs[:organization_id] || attrs['organization_id']}/roles\", :post\n ) do |req|\n req.body = {\n auth_token: user.auth_token\n }.merge(attrs.except(:organization_id, 'organization_id'))\n end\n end", "def create\n @inventario.user_id = current_user.id\n respond_to do |format|\n if @inventario.save\n format.html { redirect_to @inventario, notice: 'Inventario was successfully created.' }\n format.json { render :show, status: :created, location: @inventario }\n else\n format.html { render :new }\n format.json { render json: @inventario.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @alumno = Alumno.new(params[:alumno])\n @alumno.save\n @alumnos = Alumno.asignados(@alumno.maestra_id)\n @maestra = @alumno.maestra\n respond_with @alumno\n end", "def create\n @investigador = Investigador.new(investigador_params)\n\n respond_to do |format|\n if @investigador.save\n format.html { redirect_to investigadore_path(@investigador), notice: \"Investigador was successfully created.\" }\n format.json { render :show, status: :created, location: @investigador }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @investigador.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @junior_enterprises = JuniorEnterprise.all\n end" ]
[ "0.580639", "0.5567125", "0.55025566", "0.5423747", "0.54208523", "0.5352708", "0.5235911", "0.5227482", "0.5182025", "0.5147265", "0.5127183", "0.51191145", "0.510934", "0.50643814", "0.50571424", "0.5054124", "0.5034288", "0.50313413", "0.5007421", "0.500588", "0.5005122", "0.4996461", "0.49907184", "0.498744", "0.49656177", "0.4958326", "0.49549666", "0.49491578", "0.49484426", "0.49411535", "0.49086097", "0.49069813", "0.48984522", "0.48892927", "0.4871164", "0.4870128", "0.48674285", "0.4862879", "0.48612204", "0.4860101", "0.4859119", "0.48574004", "0.48536247", "0.4853464", "0.48491058", "0.484014", "0.48399267", "0.4833801", "0.48316073", "0.48312825", "0.48267764", "0.48267764", "0.48267764", "0.48217914", "0.48212916", "0.48182234", "0.48149016", "0.48108363", "0.480766", "0.48068747", "0.48053974", "0.48002067", "0.478971", "0.4786253", "0.47850385", "0.47849724", "0.47833183", "0.47784692", "0.47760823", "0.47756946", "0.47689888", "0.4767709", "0.4767462", "0.47605112", "0.4757372", "0.4755153", "0.47522265", "0.4751376", "0.47485346", "0.4741182", "0.47400317", "0.47387984", "0.47361687", "0.47344983", "0.473399", "0.47312573", "0.47271222", "0.47268036", "0.47244316", "0.4723037", "0.47228026", "0.47218755", "0.47218755", "0.4721573", "0.47190633", "0.47079536", "0.47070923", "0.47068006", "0.4706422", "0.47044542" ]
0.6686834
0
PUT /principal_establecs/1 PUT /principal_establecs/1.json
def update @principal_establec = PrincipalEstablec.find(params[:id]) respond_to do |format| if @principal_establec.update_attributes(params[:principal_establec]) format.html { redirect_to @principal_establec, notice: 'Registro editado satisfactoriamente.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @principal_establec.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save\n send(\"principals=\", client_principal.to_abbreviated)\n client.put(api_path, to_json, headers)\n true\n end", "def create\n @principal_establec = PrincipalEstablec.new(params[:principal_establec])\n\n respond_to do |format|\n if @principal_establec.save\n format.html { redirect_to @principal_establec, notice: 'Registro creado satisfactoriamente.' }\n format.json { render json: @principal_establec, status: :created, location: @principal_establec }\n else\n format.html { render action: \"new\" }\n format.json { render json: @principal_establec.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_principal(path, prop_patch)\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def update\n# authorize! :update, current_user\n @classroom = @observation.classroom\n @principals = User.with_role(:principal)\n @specialists = User.with_role(:specialist)\n if current_user.has_role? :admin\n if !params[:observation][:specialist].nil?\n @observation.specialist = params[:observation][:specialist]\n elsif !params[:observation][:principal].nil?\n @observation.principal = params[:observation][:principal]\n end\n end\n respond_to do |format|\n if @observation.update(observation_params)\n format.html { redirect_to @observation, notice: 'Observation was successfully updated.' }\n format.json { render :show, status: :ok, location: @observation }\n else\n format.html { render :edit }\n format.json { render json: @observation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @principals = User.with_role(:principal)\n respond_to do |format|\n if @school.update(school_params)\n format.html { redirect_to @school, notice: 'School was successfully updated.' }\n format.json { render :show, status: :ok, location: @school }\n else\n format.html { render :edit }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # binding.pry;''\n @occasion.administrators << User.find(params[:adminstrator]) if params[:adminstrator]\n respond_to do |format|\n if @occasion.update(occasion_params)\n format.html { redirect_to @occasion, notice: 'Occasion was successfully updated.' }\n format.json { render :show, status: :ok, location: @occasion }\n else\n format.html { render :edit }\n format.json { render json: @occasion.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @os_groups_principal.update(os_groups_principal_params)\n format.html { redirect_to @os_groups_principal, notice: 'Os groups principal was successfully updated.' }\n format.json { render :show, status: :ok, location: @os_groups_principal }\n else\n format.html { render :edit }\n format.json { render json: @os_groups_principal.errors, status: :unprocessable_entity }\n end\n end\n end", "def change_owner\n @seminar = Seminar.find(params[:id])\n @teacher = Teacher.find(params[:new_owner])\n \n @seminar.update(:owner => @teacher)\n SeminarTeacher.find_or_create_by(:user => @teacher, :seminar => @seminar).update(:can_edit => true)\n \n flash[:success] = \"Class Owner Updated\"\n redirect_to @seminar\n end", "def show\n @principal_establec = PrincipalEstablec.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @principal_establec }\n end\n end", "def destroy\n @principal_establec = PrincipalEstablec.find(params[:id])\n @principal_establec.destroy\n\n respond_to do |format|\n format.html { redirect_to principal_establecs_url, notice: 'Registro eliminado satisfactoriamente.' }\n format.json { head :no_content }\n end\n end", "def update!(**args)\n @first_party_principal = args[:first_party_principal] if args.key?(:first_party_principal)\n @third_party_principal = args[:third_party_principal] if args.key?(:third_party_principal)\n end", "def update\n # this action is not provided for partyroles\n end", "def update_user_for_tenant(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/{tenantId}/users/{userId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update\n respond_to do |format|\n if @principalgroupe.update(principalgroupe_params)\n format.html { redirect_to @principalgroupe, notice: 'Principalgroupe was successfully updated.' }\n format.json { render :show, status: :ok, location: @principalgroupe }\n else\n format.html { render :edit }\n format.json { render json: @principalgroupe.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n client=Client.find_by_id params[:id]\n if client!= nil\n client.cedula=params[:cedula] ? params[:cedula]: client.cedula\n client.sector=params[:sector] ? params[:sector]: client.sector\n client.nombre=params[:nombre] ? params[:nombre]: client.nombre\n client.telefono=params[:telefono] ? params[:telefono]: client.telefono\n client.pagina=params[:pagina] ? params[:pagina]: client.pagina\n client.direccion=params[:direccion] ? params[:direccion]: client.direccion\n if client.save\n render(json: client, status: 201)\n end \n else\n render(json: client.errors, status: 404)\n end \n end", "def set_employee\n @employee = Employee.includes(:user).find(params[:id])\n authorize @employee\n end", "def update\n authorize! :manage, Employee\n if responsibility_changes?\n new_employee = Employee.new_from_old(employee_params['responsibility'], @employee)\n @employee.destroy\n new_employee.save\n @employee = new_employee\n end\n\n respond_to do |format|\n if @employee.update(employee_attrs)\n format.html { redirect_to (@employee.try(:employee) || @employee), notice: t('action.update.succeed', entity: Employee.model_name.human) }\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", "def set_establecimiento\n @establecimiento = Establecimiento.find(params[:id])\n end", "def set_establecimiento\n @establecimiento = Establecimiento.find(params[:id])\n end", "def set_establecimiento\n @establecimiento = Establecimiento.find(params[:id])\n end", "def update_current_logged_in_user(args = {}) \n put(\"/users.json/current\", args)\nend", "def update\n respond_to do |format|\n if @pagina_principal.update(pagina_principal_params)\n format.html { redirect_to @pagina_principal, notice: 'Pagina principal was successfully updated.' }\n format.json { render :show, status: :ok, location: @pagina_principal }\n else\n format.html { render :edit }\n format.json { render json: @pagina_principal.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @principal_establec = PrincipalEstablec.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @principal_establec }\n end\n end", "def update\n authorize! :update_almacen,Sigesp::Solicitud\n if @sigesp_solicitud.update(sigesp_solicitud_alamcen_params)\n return render json: { url: sigesp_solicitudsalmacen_path(@sigesp_solicitud)} \n else\n return render json:@sigesp_solicitud.errors ,status: :unprocessable_entity\n end \n end", "def set_sivic_escolaridade\r\n @sivic_escolaridade = SivicEscolaridade.find(params[:id])\r\n end", "def update\n authorize! :update,Beneficiario\n @solicitante= Solicitante.find(params[:solicitante_id])\n @beneficiario = Beneficiario.update(beneficiario_params)\n\n respond_to do |format|\n format.html { redirect_to solicitante_beneficiario_path(@solicitante, params[:id]), notice: 'Beneficiario actualizado exitosamente.' }\n format.json { render :show, status: :ok, location: solicitante_beneficiario_path(@solicitante, @beneficiario) }\n\n end\n end", "def set_sivic_fornecedor\r\n @sivic_fornecedor = SivicFornecedor.find(params[:id])\r\n end", "def update\n @userin = UserInvestor.find(params[:id])\n update_userin = @userin.update(userin_params)\n if update_userin\n render json: { status: 'OK', results: update_userin, errors: nil },\n status: :ok\n else\n render json: { status: 'FAIL', results: nil,\n errors: 'update user failed' },\n status: :unprocesable_entity\n end\n end", "def update\n @supervisor_estagio = SupervisorEstagio.find(params[:id])\n\n respond_to do |format|\n if @supervisor_estagio.update_attributes(params[:supervisor_estagio])\n flash[:notice] = 'Supervisor de Estagio atualizado com sucesso.'\n format.html { redirect_to(@supervisor_estagio) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @supervisor_estagio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @slider_principal.update(slider_principal_params)\n format.html { redirect_to @slider_principal, notice: 'Slider principal was successfully updated.' }\n format.json { render :show, status: :ok, location: @slider_principal }\n else\n format.html { render :edit }\n format.json { render json: @slider_principal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ventas_seguimiento = Ventas::Seguimiento.find(params[:id])\n @ventas_seguimiento.actual_user(current_user)\n\n respond_to do |format|\n if @ventas_seguimiento.update_attributes(params[:ventas_seguimiento])\n format.html { redirect_to @ventas_seguimiento, notice: 'Seguimiento was successfully updated.' }\n format.json { head :no_content }\n else\n flash.now[:error] = @ventas_seguimiento.errors.first[1]\n format.html { render action: \"edit\" }\n format.json { render json: @ventas_seguimiento.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @sesh.update(editable_sesh_params)\n render status: :accepted\n else\n render status: :invalid_resource\n end\n end", "def update\n @employee = current_owner.employees.find(params[:id])\n puts \"#{params}\"\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", "def update\n @tecnico = Tecnico.find(params[:id])\n @tecnico.user = current_user\n\n respond_to do |format|\n if @tecnico.update_attributes(params[:tecnico])\n format.html { redirect_to @tecnico, notice: 'Técnico foi atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tecnico.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :update, Solicitud\n respond_to do |format|\n if @solicitud.update(solicitud_params)\n format.html { redirect_to solicitudes_path, notice: 'Solicitud actualizada exitosamente.' }\n format.json { render :show, status: :ok, location: solicitudes_path }\n else\n format.html { render :edit }\n format.json { render json: @solicitud.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ativo_outro = AtivoOutro.find(params[:id])\n\n respond_to do |format|\n if @ativo_outro.update_attributes(params[:ativo_outro])\n format.html { redirect_to @ativo_outro, notice: 'Ativo foi salvo com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ativo_outro.errors, status: :unprocessable_entity }\n end\n end\n end", "def service_principal_id=(value)\n @service_principal_id = value\n end", "def update\n respond_to do |format|\n if @junior_enterprise.update(junior_enterprise_params)\n format.html { redirect_to @junior_enterprise, notice: 'Empresa Junior atualizada.' }\n format.json { render :show, status: :ok, location: @junior_enterprise }\n else\n format.html { render :edit }\n format.json { render json: @junior_enterprise.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :editar, @usuario_prestamo\n respond_to do |format|\n if @usuario_prestamo.update(usuario_prestamo_params)\n format.html { redirect_to @usuario_prestamo, notice: 'La información del usuario de préstamos ha sido modificada correctamente' }\n format.json { render :show, status: :ok, location: @usuario_prestamo }\n else\n format.html { render :edit }\n format.json { render json: @usuario_prestamo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @pain_assessment.author_id = current_user.id\n\n respond_to do |format|\n if @pain_assessment.update(pain_assessment_params)\n format.html { redirect_to app_pain_assessments_path, notice: 'PainAssessment was successfully updated.' }\n format.json { render :show, status: :ok, location: @pain_assessment }\n else\n format.html { render :edit }\n format.json { render json: @pain_assessment.errors, status: :unprocessable_entity }\n end\n end\n end", "def actualizacion \n fiesta.update (params[:id]) \n render json: fiesta\n end", "def update\n claim = @repo.claims.new(user: current_user)\n if claim.save\n redirect_to :back, notice: \"Your request has been sent to owner\"\n else\n flash[:error] = claim.errors.full_messages.join('\\n')\n redirect_to :back\n end\n end", "def update\n authorize @user\n\n respond_to do |format|\n if @user.update(employee_params)\n format.html { redirect_to branch_office_employees_path, notice: 'user was successfully updated.' }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n super\n if resource.role == 'employer'\n @employer = resource.employer.update(employer_params)\n elsif resource.role == 'employee'\n @employee = resource.employee.update(employee_params)\n end\n end", "def update\n authorize @employee, :update?\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Funcionário atualizado com sucesso.' }\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", "def atualiza_um_pet_existente(objeto)\n uri = \"#{ENV['BASE_URI']}/pet\"\n \n without_authentication('put', uri, objeto.to_json)\n end", "def update\n @usuario = Establecimiento.find(params[:id]).usuario #busca el usuario al que pertenece el establecimiento\n if (current_usuario != @usuario) #si el usuario logueado no es el mismo\n redirect_to :controller=>'login', :action=>'login' #lo envia a login, no lo deja modificarlo\n end\n #si llega aca es porque si es el dueño del establecimiento\n respond_to do |format|\n if @establecimiento.update(establecimiento_params)\n format.html { redirect_to current_usuario, notice: 'Establecimiento was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @establecimiento.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @infractor.update(infractor_params)\n format.html { redirect_to @infractor, notice: 'Infractor was successfully updated.' }\n format.json { render :show, status: :ok, location: @infractor }\n else\n format.html { render :edit }\n format.json { render json: @infractor.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit_identity hash = {}\n organise hash.update :action => 'edit_identity'\n end", "def claim\n put :claim\n end", "def update\n authorize! :update, CompetenceTierGroup\n \n @competence_tier_group.update!(competence_tier_group_params)\n render json: {status: :ok}\n end", "def update\n resource.update_attributes params[params_key], as: current_role\n respond_with resource\n end", "def update\n @estadio = Estadio.find(params[:id])\n newAuditoria = Auditoria.new\n newAuditoria.tabla = params[:controller]\n newAuditoria.action = params[:action]\n newAuditoria.usuario = User.all.first.id\n newAuditoria.clave = @estadio.id\n newAuditoria.save\n\n respond_to do |format|\n if @estadio.update_attributes(params[:estadio])\n format.html { redirect_to @estadio, notice: 'Estadio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @estadio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n @sucursale.usuarios_id = current_usuario.id\n if @sucursale.update(sucursale_params)\n format.html { redirect_to @sucursale, notice: 'Sucursal actualizada con exito!' }\n format.json { render :show, status: :ok, location: @sucursale }\n else\n format.html { render :edit }\n format.json { render json: @sucursale.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n contract = Contract.find_by_id(params[:id])\n (head :unauthorized unless contract) and return\n \n # try to update the attributes\n if contract.update_attributes(edit_contract_params)\n render json: contract\n else\n render json: { errors: contract.error.full_messages}\n end\n end", "def update\n respond_to do |format|\n if @table.update(table_params)\n if params[:waiter]\n @waitertable = WaiterTable.find_by(table_id: @table.id)\n @waitertable.user_id = params[:waiter]\n @waitertable.save\n end\n format.html { redirect_to @table, notice: 'Mesa actualizada correctamente.' }\n format.json { render :show, status: :ok, location: @table }\n else\n format.html { render :edit }\n format.json { render json: @table.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @internship_committee.update(internship_committee_params)\n format.html { redirect_to @internship_committee, notice: 'Internship committee was successfully updated.' }\n format.json { render :show, status: :ok, location: @internship_committee }\n else\n format.html { render :edit }\n format.json { render json: @internship_committee.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n id = params[:id]\n @datacenter = Datacenter.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @datacenter.attributes = params[:datacenter]\n @datacenter.audits << Audit.new(source: 'controller', action: 'update', admin_user: current_user)\n respond_to do |format|\n if @datacenter.save\n format.html { redirect_to @datacenter, notice: 'Datacenter was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @datacenter.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @principal_caracteristica.update(principal_caracteristica_params)\n format.html { redirect_to @principal_caracteristica, notice: 'Principal caracteristica was successfully updated.' }\n format.json { render :show, status: :ok, location: @principal_caracteristica }\n else\n format.html { render :edit }\n format.json { render json: @principal_caracteristica.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @delegacione = Delegacione.find(params[:id])\n\n newAuditoria = Auditoria.new\n newAuditoria.tabla = params[:controller]\n newAuditoria.action = params[:action]\n newAuditoria.usuario = User.all.first.id\n newAuditoria.clave = @delegacione.id\n newAuditoria.save\n\n respond_to do |format|\n if @delegacione.update_attributes(params[:delegacione])\n format.html { redirect_to @delegacione, notice: 'Delegacione was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @delegacione.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @principal_email = args[:principal_email] if args.key?(:principal_email)\n @service_metadata = args[:service_metadata] if args.key?(:service_metadata)\n end", "def update\n $usuario = params[:employee][:usuario]\n @employee.user_updated_id = current_user.id\n @employee.usuario = params[:employee][:usuario]\n if @employee.update(employee_params)\n if params[:employee][:type_profile] == 'Temporal'\n @employee.vencer_perfil\n end \n actualizar_previous_profile_security\n @employee.usuario = params[:employee][:usuario]\n $username = params[:employee][:usuario]\n if@employee.validate_username?\n actualizar_usuario\n if @employee.update_email?\n respond_to do |format|\n format.html { redirect_to employees_path,notice: I18n.t('employees.controller.update_email') }\n format.json { render :show, status: :ok, location: @employee } \n end \n else \n respond_to do |format|\n format.json { render :show, status: :ok, location: @employee }\n if $empleado == \"interno\"\n format.html { redirect_to employees_path, notice: I18n.t('employees.controller.update') }\n else\n format.html { redirect_to employees_path, notice: I18n.t('employees.controller.update_clinic') }\n end\n end \n end\n $usuario=nil\n else\n actualizar_usuario\n respond_to do |format|\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end \n end\n else\n actualizar_usuario\n respond_to do |format|\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def update\n keystone.update_tenant({:id=>params[:id],:name=>params[:name],:description=>params[:description],:enabled=>params[:enabled]})\n respond_to do |format|\n format.html { redirect_to tenants_path, :notice => 'Tenant was successfully updated.' }\n format.json { head :ok }\n end\n end", "def update\n #Finding the specific chore where the id matches the one we pass in with the body\n @v1_chore = Chore.where(id: params[:id]).first\n #Here we're checking if we have user_id in our body, and if we do, we'll change the selected chore's properties\n #with the parameters of the body, we go through the specific group to our specific chore with the path\n if v1_chore_params[:user_id]\n @v1_chore.user_id = params[:user_id]\n @v1_chore.assigned = true\n if @v1_chore.save\n render :show, status: :ok\n end\n else\n render json: @v1_chore.errors, status: :unprocessable_entity\n end\n end", "def update\n @identity_table = IdentityTable.find(params[:id])\n\n respond_to do |format|\n if @identity_table.update_attributes(params[:identity_table])\n format.html { redirect_to identity_tables_path, alert: '表名更新成功!' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @identity_table.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize EmployeeType\n respond_to do |format|\n if @employee_type.update(employee_type_params)\n format.html { redirect_to @employee_type, notice: \"Employee type #{@employee_type.description} was successfully updated.\" }\n format.json { render :show, status: :ok, location: @employee_type }\n else\n format.html { render :edit }\n format.json { render json: @employee_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def principals\n modify\n end", "def update\n @oferta_academica = OfertaAcademica.find(params[:id])\n\n if @oferta_academica.update(params[:oferta_academica])\n head :no_content\n else\n render json: @oferta_academica.errors, status: :unprocessable_entity\n end\n end", "def update\n @eou = Eou.find(params[:id])\n\n respond_to do |format|\n if @eou.update_attributes(params[:eou])\n format.html { redirect_to @eou, :notice => 'Eou was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @eou.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @enterprise = Enterprise.find(params[:id])\n\n respond_to do |format|\n if @enterprise.update_attributes(params[:enterprise])\n format.html { redirect_to \"/enterprises\", notice: 'Enterprise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @enterprise.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @eatable.update(eatable_params)\n format.html { redirect_to @eatable, notice: 'Eatable was successfully updated.' }\n format.json { render :show, status: :ok, location: @eatable }\n else\n format.html { render :edit }\n format.json { render json: @eatable.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_incidente\n @incidente = Incidente.accessible_by(current_ability).find(params[:id])\n end", "def set_assessor\n @assessor = Assessor.find(params[:id])\n end", "def update\n respond_to do |format|\n if @residente.update(residente_params)\n format.html { redirect_to @residente, notice: 'Residente was successfully updated.' }\n format.json { render :show, status: :ok, location: @residente }\n else\n format.html { render :edit }\n format.json { render json: @residente.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_should_update_membership\n login_as(:john)\n put :update, :id => 1, :membership => { }\n assert_response :redirect\n end", "def test_should_update_membership\n login_as(:john)\n put :update, :id => 1, :membership => { }\n assert_response :redirect\n end", "def update\n u=User.find(session[:user]) \n if (u.role=='Admin' || u.role=='Member')\n \n @income_event = IncomeEvent.find(params[:id])\n\n respond_to do |format|\n if @income_event.update_attributes(params[:income_event])\n format.html { redirect_to @income_event, notice: 'Income event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @income_event.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to \"/home/principal\"\n end\n end", "def update\n respond_to do |format|\n if @assessor.update(assessor_params)\n format.html { redirect_to @assessor, notice: 'Assessor editado com sucesso.' }\n format.json { render :show, status: :ok, location: @assessor }\n else\n format.html { render :edit }\n format.json { render json: @assessor.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @employee_insentive.update(employee_insentive_params)\n format.html { redirect_to @employee_insentive, notice: 'Employee insentive was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee_insentive }\n else\n format.html { render :edit }\n format.json { render json: @employee_insentive.errors, status: :unprocessable_entity }\n end\n end\n end", "def put!\n request! :put\n end", "def update\n @equipo = Equipo.find(params[:id])\n newAuditoria = Auditoria.new\n newAuditoria.tabla = params[:controller]\n newAuditoria.action = params[:action]\n newAuditoria.usuario = User.all.first.id\n newAuditoria.clave = @equipo.id\n newAuditoria.save\n\n respond_to do |format|\n if @equipo.update_attributes(params[:equipo])\n format.html { redirect_to @equipo, notice: 'Equipo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @equipo.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit_shelf(shelf_id, shelf_name, exclusive_flag = \"false\", sortable_flag = \"false\", featured = \"false\")\n\t\toptions = {\"user_shelf[name]\" => shelf_name, \"user_shelf[exclusive_flag]\" => exclusive_flag, \"user_shelf[sortable_flag]\" => sortable_flag, \"user_shelf[featured]\" => featured}\n\t\tdata = oauth_request(\"/user_shelves/#{shelf_id}.xml\", options, \"put\")\n\tend", "def edit\n @user = User.shod(params[:id])\n authorize! :update, @user\n end", "def update\n @oase = Oasis.find(params[:id])\n\n respond_to do |format|\n if @oase.update_attributes(params[:oase])\n format.html { redirect_to @oase, notice: 'Oasis was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @oase.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(*args)\n raise_authentication_error unless authenticated?\n arguments(args, required: [:id])\n\n patch_request(\"/authorizations/#{arguments.id}\", arguments.params)\n end", "def set_souvenior\n @souvenior = Souvenior.find(params[:id])\n end", "def put\n if(resource.collection?)\n Forbidden\n elsif(!resource.parent_exists? || !resource.parent_collection?)\n Conflict\n else\n resource.lock_check if resource.supports_locking?\n status = resource.put(request, response)\n response['Location'] = \"#{scheme}://#{host}:#{port}#{url_format(resource)}\" if status == Created\n response.body = response['Location']\n status\n end\n end", "def update\n @identity = Identity.find(params[:id])\n\n if @identity.update(identity_params)\n head :no_content\n else\n render json: @identity.errors, status: :unprocessable_entity\n end\n end", "def principal=(value)\n @principal = value\n end", "def principal=(value)\n @principal = value\n end", "def update\n @user = current_user\n @user.role = 'client'\n \n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to @user, flash[:success] => \"User was successfully updated\" }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_seminar\n @seminar = Seminar.unscoped.find(params[:id]).decorate\n authorize @seminar\n end", "def update_current_tenant_maintenance_window(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/maintenance\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def principal_id=(value)\n @principal_id = value\n end", "def principal_id=(value)\n @principal_id = value\n end", "def update\n respond_to do |format|\n if @sivic_discipulo.update(sivic_discipulo_params_netested)\n format.html { redirect_to @sivic_discipulo, notice: 'Registro alterado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sivic_discipulo.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_os_entregavel\n @os_entregavel = OsEntregavel.find(params[:id])\n end", "def set_anteproyecto_estudiante\n @anteproyecto_estudiante = AnteproyectoEstudiante.find(params[:id])\n end", "def update!(**args)\n @authority_selector = args[:authority_selector] if args.key?(:authority_selector)\n @principal_email = args[:principal_email] if args.key?(:principal_email)\n @principal_subject = args[:principal_subject] if args.key?(:principal_subject)\n @service_account_delegation_info = args[:service_account_delegation_info] if args.key?(:service_account_delegation_info)\n @service_account_key_name = args[:service_account_key_name] if args.key?(:service_account_key_name)\n @third_party_principal = args[:third_party_principal] if args.key?(:third_party_principal)\n end" ]
[ "0.60064065", "0.5844642", "0.57739645", "0.56477374", "0.56174105", "0.56026363", "0.55793464", "0.5578456", "0.54674494", "0.5463115", "0.53614503", "0.5341211", "0.53187567", "0.5277541", "0.5269895", "0.5243638", "0.52420896", "0.5210307", "0.5192401", "0.5192401", "0.5192401", "0.51896864", "0.5185697", "0.5174672", "0.5172146", "0.51496524", "0.51464325", "0.51342857", "0.5127999", "0.5126123", "0.51228195", "0.51205724", "0.5104266", "0.5098438", "0.50955033", "0.5087846", "0.507993", "0.5079916", "0.5079463", "0.5078676", "0.5078195", "0.5076926", "0.5076849", "0.5060252", "0.5056832", "0.5050788", "0.5047884", "0.50343704", "0.50322413", "0.50168943", "0.50159454", "0.50073254", "0.5005875", "0.5002618", "0.50016385", "0.50014234", "0.5001318", "0.49976465", "0.49971452", "0.49897596", "0.49865472", "0.497962", "0.4978481", "0.49782762", "0.49698842", "0.49673322", "0.49594098", "0.49484384", "0.4946066", "0.49411163", "0.49367914", "0.49366835", "0.4933538", "0.49330822", "0.49267158", "0.49226022", "0.49226022", "0.49212658", "0.49211076", "0.4919132", "0.49112839", "0.49051592", "0.49036565", "0.49023455", "0.48978895", "0.4895279", "0.4893867", "0.48937923", "0.4888084", "0.48858878", "0.48858878", "0.4884732", "0.48841894", "0.488375", "0.48780718", "0.48780718", "0.48774362", "0.48752838", "0.48745626", "0.48689437" ]
0.6827952
0
DELETE /principal_establecs/1 DELETE /principal_establecs/1.json
def destroy @principal_establec = PrincipalEstablec.find(params[:id]) @principal_establec.destroy respond_to do |format| format.html { redirect_to principal_establecs_url, notice: 'Registro eliminado satisfactoriamente.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def test_set3_04c_delete_principal()\n user = \"test_user\"\n @test_acl.create_principal(user)\n id = @test_acl.create_ace(user, \"allow\", \"SELECT\", \"test\", \"/db/temporary/testsource\")\n \n @test_acl.delete_principal(user)\n query = \"doc(\\\"#{@col_path}acl.xml\\\")//node()[@id=\\\"#{id}\\\"]\"\n handle = @db.execute_query(query)\n hits = @db.get_hits(handle)\n assert_equal(0, hits)\n end", "def delete_user_for_tenant(args = {}) \n delete(\"/tenants.json/#{args[:tenantId]}/users/#{args[:userId]}\", args)\nend", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def destroy\n id = params[:id]\n @datacenter = Datacenter.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @datacenter.destroy\n\n respond_to do |format|\n format.html { redirect_to datacenters_url }\n format.json { head :ok }\n end\n end", "def destroy\n @claim.destroy\n respond_to do |format|\n format.html { redirect_to claims_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @identity.destroy\n\n head :no_content\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @os_groups_principal.destroy\n respond_to do |format|\n format.html { redirect_to os_groups_principals_url, notice: 'Os groups principal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize! :destroy, Solicitud\n @solicitud.destroy\n respond_to do |format|\n format.html { redirect_to solicitudes_url, notice: 'Solicitud was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n client=Client.find_by_id(params[:id])\n if client != nil\n if client.destroy\n head 204\n end\n else\n head 404\n end\n end", "def destroy\n @aucrecord.destroy\n respond_to do |format|\n format.html { redirect_to aucrecords_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @principalgroupe.destroy\n respond_to do |format|\n format.html { redirect_to principalgroupes_url, notice: 'Principalgroupe was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @secubat_client = SecubatClient.find(params[:id])\n @secubat_client.destroy\n\n respond_to do |format|\n format.html { redirect_to secubat_clients_url }\n format.json { head :ok }\n end\n end", "def destroy\n @alumno.destroy\n respond_to do |format|\n format.html { redirect_to grupos_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @investigated.destroy\n respond_to do |format| \n format.json { head :no_content }\n end\n end", "def destroy\n \n keystone.delete_tenant(keystone.get_tenant(params[:id])[:id])\n\n respond_to do |format|\n format.html { redirect_to tenants_url }\n format.json { head :ok }\n end\n end", "def destroy\n @pagina_principal.destroy\n respond_to do |format|\n format.html { redirect_to pagina_principals_url, notice: 'Pagina principal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @identity.destroy\n respond_to do |format|\n format.html { redirect_to identities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @claim_datum.destroy\n respond_to do |format|\n format.html { redirect_to claim_data_url, notice: 'Claim datum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @client_accessory.destroy\n respond_to do |format|\n format.html { redirect_to client_accessories_url, notice: 'Client accessory was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @fulcliente = Fulcliente.find(params[:id])\n @fulcliente.destroy\n\n respond_to do |format|\n format.html { redirect_to fulclientes_url }\n format.json { head :ok }\n end\n end", "def destroy\n @sesh.destroy\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @retroaspecto = Retroaspecto.find(params[:id])\n @retroaspecto.destroy\n\n respond_to do |format|\n format.html { redirect_to retroaspectos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cliente = Cliente.find(params[:id])\n @cliente.destroy\n\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cliente = Cliente.find(params[:id])\n @cliente.destroy\n\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cliente = Cliente.find(params[:id])\n @cliente.destroy\n\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cliente = Cliente.find(params[:id])\n @cliente.destroy\n\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :ok }\n end\n end", "def destroy\n @datos_insumos_reactivo.destroy\n respond_to do |format|\n format.html { redirect_to datos_insumos_reactivos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @principal_caracteristica.destroy\n respond_to do |format|\n format.html { redirect_to principal_caracteristicas_url, notice: 'Principal caracteristica was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize @colaboradore\n @colaboradore.destroy\n respond_to do |format|\n format.html { redirect_to colaboradores_url, notice: 'Colaborador eliminado.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @claimant = Claimant.find(params[:id])\n @claimant.destroy\n\n respond_to do |format|\n format.html { redirect_to claimants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @visitante_credenciado = VisitanteCredenciado.find(params[:id])\n @visitante_credenciado.destroy\n\n respond_to do |format|\n format.html { redirect_to visitante_credenciados_url }\n format.json { head :no_content }\n end\n \n end", "def destroy\n @ativo_outro = AtivoOutro.find(params[:id])\n @ativo_outro.destroy\n\n respond_to do |format|\n format.html { redirect_to ativo_outros_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @trein_consul_comercial.destroy\n respond_to do |format|\n format.html { redirect_to trein_consul_comercials_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = current_user;\n @toeic_log = ToeicLog.find(params[:id])\n @toeic_log.destroy\n\n respond_to do |format|\n format.html { redirect_to toeic_logs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @clientepedido = Clientepedido.find(params[:id])\n @clientepedido.destroy\n\n respond_to do |format|\n format.html { redirect_to clientepedidos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client_sex = ClientSex.find(params[:id])\n @client_sex.destroy\n\n respond_to do |format|\n format.html { redirect_to client_sexes_url }\n format.json { head :ok }\n end\n end", "def destroy\n @enrollment.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @asociado = Asociado.find(params[:id])\n @asociado.destroy\n\n respond_to do |format|\n format.html { redirect_to asociados_url }\n format.json { head :ok }\n end\n end", "def destroy\n @investable.destroy\n respond_to do |format|\n format.html { redirect_to investables_url }\n format.json { head :no_content }\n end\n end", "def destroy\n set_redireccion\n @objeto.destroy\n respond_to do |format|\n format.html { redirect_to @redireccion, notice: 'Cliente was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @persona = Persona.find(params[:id])\n @persona.destroy\n\n respond_to do |format|\n format.json { head :ok }\n end\n \n end", "def destroy\n\t\tauthorize! :destroy, HistorialEstadoPresupuesto\n @historial_estado_presupuesto.destroy\n respond_to do |format|\n format.html { redirect_to historial_estado_presupuestos_url, notice: 'Historial estado presupuesto fue borrado satisfactoriamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @antecedente = Antecedente.find(params[:id])\n @antecedente.destroy\n\n respond_to do |format|\n format.html { redirect_to antecedentes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @early_access_request.destroy\n respond_to do |format|\n format.html { redirect_to early_access_requests_url, notice: 'Anfrage wurde gelöscht.' }\n format.json { head :no_content }\n end\n end", "def destroy\n #--ADICIONADO\n @cliente.perfilclientes.destroy\n #--ADICIONADO\n @cliente.destroy\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize @client_profile\n \n @client_profile.destroy\n respond_to do |format|\n format.html { redirect_to client_profiles_url, notice: 'Client profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @client_has_employeur.destroy\n respond_to do |format|\n format.html { redirect_to client_has_employeurs_url, notice: 'Client has employeur was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @alumno = Alumno.find(params[:id])\n @alumno.destroy\n\n respond_to do |format|\n format.html { redirect_to alumnos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @autorizacion.destroy\n respond_to do |format|\n format.html { redirect_to autorizacions_url, notice: 'Autorizacion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @basico_persona_juridica.destroy\n respond_to do |format|\n format.html { redirect_to basico_persona_juridicas_url, notice: 'Persona juridica was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize! :destroy, @individual\n @individual.destroy\n respond_to do |format|\n format.html { redirect_to individuals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cliente.destroy\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @solicitud.destroy\n respond_to do |format|\n format.html { redirect_to solicitudes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n clients_delete(@entity)\n @entity.destroy\n respond_to do |format|\n format.html { redirect_to clients_path }\n format.json { render json: {success: true} }\n end\n end", "def destroy\r\n @sivic_escolaridade.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_escolaridades_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @claim.destroy\n respond_to do |format|\n format.html { redirect_to insurer_claims_url, notice: 'Claim was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\r\n checar_egresso_super\r\n @egresso.destroy\r\n respond_to do |format|\r\n format.html { redirect_to egressos_url, notice: 'Egresso excluído com sucesso.' }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @apoio_educacioanl.destroy\n respond_to do |format|\n format.html { redirect_to apoio_educacioanls_url, notice: 'Apoio educacioanal foi excluído com Sucesso !' }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @sivic_contabanco.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_contabancos_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @my_studio_client = MyStudio::Client.find(params[:id])\n @my_studio_client.destroy\n\n respond_to do |format|\n format.html { redirect_to my_studio_clients_url }\n format.json { head :ok }\n end\n end", "def destroy\n @asagroupservobj = Asagroupservobj.find(params[:id])\n @asagroupservobj.destroy\n\n respond_to do |format|\n format.html { redirect_to asagroupservobjs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @alumno = Alumno.find(params[:id])\n @alumno.destroy\n\n respond_to do |format|\n format.html { redirect_to alumnos_url }\n format.json { head :ok }\n end\n end", "def destroy\n @status_ativ = StatusAtiv.find(params[:id])\n @status_ativ.destroy\n\n respond_to do |format|\n format.html { redirect_to status_ativs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n onesecgroup('delete', resource[:name])\n @property_hash.clear\n end", "def destroy\n @user_vacancy.destroy\n respond_to do |format|\n format.html { redirect_to user_vacancies_url, notice: 'Aplicación eliminada correctamente' }\n format.json { head :no_content }\n end\n end", "def destroy\n @uchronia = Uchronia.find(params[:id])\n @uchronia.destroy\n\n respond_to do |format|\n format.html { redirect_to uchronias_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @assessor.destroy\n respond_to do |format|\n format.html { redirect_to assessors_url, notice: 'Assessor deletado com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @delegacione = Delegacione.find(params[:id])\n\n newAuditoria = Auditoria.new\n newAuditoria.tabla = params[:controller]\n newAuditoria.action = params[:action]\n newAuditoria.usuario = User.all.first.id\n newAuditoria.clave = @delegacione.id\n newAuditoria.save\n \n @delegacione.destroy\n\n respond_to do |format|\n format.html { redirect_to delegaciones_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @capacitacion = Capacitacion.find(params[:id])\n @capacitacion.destroy\n\n respond_to do |format|\n format.html { redirect_to capacitacions_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: User.delete(params[\"id\"])\n end", "def destroy\n @subcontractor.destroy\n respond_to do |format|\n format.html { redirect_to subcontractors_url, notice: 'Subcontractor was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n \n if @client.deleted_at.blank?\n @client.destroy\n else\n @client.revive\n end\n \n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :ok }\n end\n end", "def destroy\n @fabrica.destroy\n respond_to do |format|\n format.html { redirect_to fabricas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n# redirect_to activacionclientets_path # ted esto para evitar que borren por la web. ok. Que valla al index. provisional ok.\n \n #@activacionclientet.destroy\n respond_to do |format|\n format.html { redirect_to activacionclientets_url, notice: 'Activacionclientes no se puede eliminar por esta via. Contacte el administrador.' } # ted esto para evitar que borren por la web\n format.json { head :no_content }\n end\n end", "def destroy\n @encuestum = Encuestum.find(params[:id])\n @encuestum.destroy\n\n respond_to do |format|\n format.html { redirect_to encuesta_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @infractor.destroy\n respond_to do |format|\n format.html { redirect_to infractors_url, notice: 'Infractor was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize! :eliminar, @usuario_prestamo\n @usuario_prestamo.destroy\n respond_to do |format|\n format.html { redirect_to usuario_prestamos_url, notice: 'El usuario de préstamo fue eliminado correctamente' }\n format.json { head :no_content }\n end\n end", "def destroy\n admin_only\n @consuming_enrollment.destroy\n respond_to do |format|\n format.html { redirect_to consuming_enrollments_url, notice: 'Consuming enrollment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @alumnu = Alumnu.find(params[:id])\n @alumnu.destroy\n\n respond_to do |format|\n format.html { redirect_to alumnus_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @alumno = Alumno.find(params[:id])\n @alumno.destroy\n\n head :no_content\n end", "def destroy\n @enterprise.destroy\n respond_to do |format|\n format.html { redirect_to enterprises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ca.destroy\n respond_to do |format|\n format.html { redirect_to cas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n head :unauthorized\n end", "def destroy\r\n @sivic_fornecedor.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_fornecedors_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n set_redireccion\n @objeto.destroy\n respond_to do |format|\n format.html { redirect_to @redireccion, notice: 'Tabla was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def destroy\n authorize! :destroy, @characteristic\n @characteristic.destroy\n respond_to do |format|\n format.html { redirect_to characteristics_url, notice: 'Characteristic was successfully destroyed.' }\n format.json { head :no_content }\n end\nend", "def destroy\n @client = Client.find(params[:id])\n authorize! :update, @client\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :ok }\n end\n end", "def destroy\n @testbed_owner = TestbedOwner.find(params[:id])\n @testbed_owner.destroy\n\n respond_to do |format|\n format.html { redirect_to testbed_owners_url }\n format.json { head :ok }\n end\n end", "def destroy\n @concedente = Concedente.find(params[:id])\n @concedente.destroy\n\n respond_to do |format|\n format.html { redirect_to concedentes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @establecimiento.destroy\n respond_to do |format|\n format.html { redirect_to establecimientos_url, notice: 'Establecimiento was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n usuario_eventos = UsuarioEvento.where(usuario_id: @usuario.id)\n usuario_eventos.each do |usuario_evento|\n usuario_evento.destroy\n end \n @usuario.destroy\n render json: {erro: \"000\", body: \"\"} \n end", "def destroy\n @estado_remate.destroy\n respond_to do |format|\n format.html { redirect_to estado_remates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @miscellaneou.destroy\n respond_to do |format|\n format.html { redirect_to miscellaneous_url, notice: 'Accessory was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @capacidad = Capacidad.find(params[:id])\n @capacidad.destroy\n\n respond_to do |format|\n format.html { redirect_to capacidades_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @alumno.destroy\n respond_to do |format|\n format.html { redirect_to alumnos_url, notice: 'Registro de Alumno eliminado correctamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @notificaciones_admin_actualouse = NotificacionesAdminActualouse.find(params[:id])\n @notificaciones_admin_actualouse.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :ok }\n end\n end" ]
[ "0.7025236", "0.68755084", "0.6595089", "0.65756476", "0.6481361", "0.64799505", "0.64579874", "0.6456819", "0.6456782", "0.6449694", "0.64460903", "0.64247763", "0.64207405", "0.64193845", "0.6413468", "0.6408376", "0.6406644", "0.64042044", "0.6392073", "0.63788736", "0.637867", "0.6376172", "0.6373242", "0.63688004", "0.63651526", "0.63509", "0.63509", "0.63509", "0.6348832", "0.6343309", "0.63408154", "0.6338687", "0.632732", "0.63262314", "0.6315468", "0.6311033", "0.63104063", "0.6310375", "0.63087434", "0.63072735", "0.6306426", "0.6303226", "0.6302254", "0.6301271", "0.6297811", "0.6292906", "0.62923586", "0.62923187", "0.62914455", "0.6291277", "0.6277437", "0.62724555", "0.6272328", "0.62663317", "0.6262784", "0.62619215", "0.6261021", "0.6260909", "0.62606275", "0.6260342", "0.6258333", "0.6256694", "0.6256665", "0.6256081", "0.6255404", "0.62538296", "0.6251577", "0.62486345", "0.62476826", "0.6243198", "0.6242983", "0.6241939", "0.62389535", "0.62370884", "0.6236896", "0.62356806", "0.6235296", "0.62349653", "0.62316203", "0.6229679", "0.622352", "0.6223354", "0.62230146", "0.6221507", "0.62177765", "0.62175703", "0.6216567", "0.621623", "0.62158555", "0.6215476", "0.62128246", "0.6211816", "0.62110287", "0.62102073", "0.62083495", "0.62048334", "0.6204832", "0.62048", "0.62044245", "0.6204258" ]
0.73490435
0
returns an array of userIds of the opponents of a bet
def get_bet_opponents(bet_id) opps = [] Bet.find(bet_id).invites.each do |i| opps.push i.invitee if i.status == "accepted" end return opps end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_opponents(game)\n opponents = []\n game.get_players.each do |player|\n if player.get_team(game) != self.get_team(game)\n opponents.push player\n end\n end\n opponents\n end", "def get_past_teammate_user_ids(participant)\n past_team_associations = TeamsUser.find_all_by_user_id(participant.user_id)\n past_team_associations -= TeamsUser.find_all_by_team_id(id)\n past_team_association_team_ids = past_team_associations.map{|association| association.team_id}\n past_team_association_team_ids.delete_if {|team_id| Assignment.find_by_id(Team.find_by_id(team_id).parent_id).course_id != Assignment.find_by_id(parent_id).course_id}\n past_teammates = TeamsUser.find_all_by_team_id(past_team_association_team_ids)\n return past_teammates.map{|teammate| teammate.user_id}\n end", "def team_ids\n return [og_id, oo_id, cg_id, co_id];\n end", "def player_ids\n\t\tmy_ids = []\n\t\tplayers.each { |player|\n\t\t\tmy_ids << player.id\n\t\t}\n\t\treturn my_ids\n\tend", "def member_ids\n team_users.pluck(:user_id)\n end", "def member_ids\n team_users.pluck(:user_id)\n end", "def member_ids\n team_users.pluck(:user_id)\n end", "def user_ids\n users.collect(&:id)\n end", "def players\n gp = Player.where :instance_id => self.id\n gp.map { |p| p.user_id }\n end", "def participants # :nodoc:\n @participant_ids.map { |p| @context.users[p] }\n end", "def user_ids\n self.users.collect{|ud| ud.id}\n end", "def household_user_ids\n @household_user_ids || household.users.where.not(id: id).pluck(:id)\n end", "def household_user_ids\n @household_user_ids || household.users.where.not(id: id).pluck(:id)\n end", "def participants\n User.find Participation.select(\"distinct user_id\").where(:occasion_id => id).all.map(&:user_id)\n # participations.map(&:user).uniq\n end", "def conversation_participant_ids\n self.conversation ?\n self.conversation.participant_ids + [self.conversation.user_id] : []\n end", "def get_user_ids\n @assigned_lawfirm_users.map(&:id)\n end", "def user_ids\n users.pluck(:id)\n end", "def participant_ids\n participants.pluck(:id)\n end", "def involved_people_ids\n (\n [self.scrum_master_id.to_s, self.product_owner_id.to_s] + self.team_member_ids + self.stakeholder_ids\n ).select {|u_id| !u_id.blank?}\n end", "def game_user_ids\n turn_ids = GameUser.where({game_id: session[:game_id]}).pluck(:user_id).join(\",\")\n respond_to do |format|\n turn_message = {:status => \"ok\", :turn => turn_ids}\n format.json {render :json => turn_message}\n end\n end", "def users\n User.in_teams(self.teams.pluck(:id))\n end", "def stakeholders\n self.stakeholder_ids.collect{|user_id| User.find(user_id)}\n end", "def arr_participants\n participants.split(',').map{|id|\n User.find(id) rescue nil\n }\n end", "def other_household_members\n return [] if period.nil?\n ids = chooser.household.users.pluck(:id) - [chooser.id]\n period.shares.nonzero.where(user_id: ids).includes(:user).map(&:user)\n end", "def players\n return [User.find_by(id: player1_id), User.find_by(id: player2_id),\n User.find_by(id: player3_id), User.find_by(id: player4_id)].compact\n end", "def involved_people\n involved_people_ids.collect{|user_id| User.find(user_id)}\n end", "def opponent_battler(battler = $game_player)\n opponents = []\n @action_battlers.each do |key, members|\n next if key == battler.team_id\n members.compact.each do |member|\n next if member.dead?\n opponents.push(member)\n end\n end\n return opponents\n end", "def banned_user_ids\n Rails.cache.fetch('banned-user-ids', expires_in: 1.week) do\n User.banned.pluck(:id)\n end\n end", "def winner_usernames\n return winners.map {|p| p.username}\n end", "def get_lawyer_user_ids\n @assigned_lawfirm_users.map(&:id)\n end", "def org_poa_participant_ids\n @org_poa_records ||= bgs.fetch_poa_org_record(user.participant_id)\n @org_poa_records.map { |poa| poa.dig(:participant_id) }\n end", "def chat_participants \n friends.map do |friend|\n friend.combination(2).to_a\n end.flatten(1)\nend", "def user_voters\n votes = self.votes.order(created_at: :desc)\n user_ids = []\n\n votes.each do |vote|\n user_ids << vote.user_id\n end\n\n users = []\n user_ids.each do |num|\n user = User.find_by(id: num)\n users << user\n end\n\n return users\n end", "def assignable_people_ids\n ([self.scrum_master_id.to_s] + self.team_member_ids).select {|u_id| !u_id.blank?}\n end", "def participants\n participant_ids.blank? ? User.none : User.where(id: participant_ids)\n end", "def get_team_participants(a_team)\n\t\tparticipants_array = []\n\t\tusers.each do |u|\n\t\t\ta_team.users.each do |team_user|\n\t\t\t\tif u==team_user\n\t\t\t\t\tparticipants_array << u\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tparticipants_array\n\tend", "def passenger_ids\n passenger_ids = []\n self.ridings.each {|riding| passenger_ids << riding.user_id}\n return passenger_ids\n end", "def invited_users\n user_state.select { |user, state| state == :invited }.keys\n end", "def users\n User.in(id: user_promotions.pluck(:user_id))\n end", "def person_ids\n persons = Person.find_all_from_identifier(source: 'xkonto', identifier: username)\n return nil if persons.blank?\n return persons.map(&:id)\n end", "def team_ids_the_user_cant_pick\n return primary_pool_picks.pluck(:team_id) || [] if status == 1\n return secondary_pool_picks.pluck(:team_id) + secondary_pool_picks.where(\"second_team_id IS NOT NULL\").pluck(:second_team_id) || [] if status == 2\n end", "def players\n players_in_signup = []\n player_ids = self.signups.map {|sign| sign.player_id}\n User.all.select do |user|\n if player_ids.any?(user.id)\n players_in_signup << user\n end\n end\n players_in_signup.uniq\n end", "def team_members\n self.team_member_ids.collect{|user_id| User.find(user_id)}\n end", "def can_see_user_ids_as_team_member_or_team_leader\n user_has_access_to_team_ids = TeamMember.where(user: self).pluck(:team_id)\n\n TeamMember.where(team: user_has_access_to_team_ids).pluck(:user_id)\n end", "def timeline_user_ids(myself = true)\n myself ? leader_ids + [id] : leader_ids\n end", "def permitted_users_id\n\treturn_user_ids = Array.new\n\tif !self.venue_id.nil?\n\t return_user_ids = ActiveInVenue.where(venue_id: self.venue_id).where.not(user_id: self.user_id).map(&:user_id)\n end\n\tif self.allow_nearby\n\t\treturn_user_ids = return_user_ids | User.where.not(id: self.user_id).near([self.latitude, self.longitude], 25, units: :km).map(&:id)\n\tend\n\tblack_list = BlockUser.blocked_user_ids(self.user_id)\n \tcontent_black_list = ShoutReportHistory.where(reportable_id: self.id).where(reportable_type: 'Shout').map(&:reporter_id)\n \treturn_user_ids = return_user_ids - black_list - content_black_list\n\n \t# only user pusher for online users\n \tonline_users_ids = User.where(id: return_user_ids).where(pusher_private_online: true).map(&:id)\n \treturn online_users_ids\n end", "def get_user_ids(deal_id, multiple_redeem = false)\n date = DateTime.now.in_time_zone(\"Singapore\").end_of_day\n if multiple_redeem\n user_ids = Array.new\n all_users = Redemption.where(deal_id: deal_id).where(\"created_at <= ?\", date).select(:user_id).distinct.pluck(:user_id)\n all_users.each do |au|\n if Redemption.where(deal_id: deal_id, user_id: au).count > 1\n user_ids << au\n end\n end\n user_ids\n else\n Redemption.where(deal_id: deal_id).where(\"created_at <= ?\", date).select(:user_id).distinct.pluck(:user_id)\n end\n end", "def fellow_group_member_ids\n user_ids = GroupUser\n .where(group_id: group_ids + owned_group_ids)\n .uniq\n .pluck(:user_id)\n\n # don't include self\n user_ids.delete(id)\n\n user_ids\n end", "def users_ids\n object.member_ids\n end", "def opponents tournament_id=nil\n left_query = DB[:bouts].where(left_fencer_id: self.id)\n left_query = left_query.where(tournament_id: tournament_id) if tournament_id\n right_ids = left_query.select(:right_fencer_id)\n right_query = DB[:bouts].where(right_fencer_id: self.id)\n right_query = right_query.where(tournament_id: tournament_id) if tournament_id\n left_ids = left_query.select(:right_fencer_id)\n Fencer.where(Sequel[id: left_ids] | Sequel[id: right_ids])\n end", "def user_ids\n self.class.where(id: id).user_ids\n end", "def choosen\n @pair = []\n for pair in @pair_collection do\n if pair.mentee_id == current_user.id\n @pair.push(pair.user_id)\n end\n end\n return @pair\n end", "def club_owner_ids\n find.\n lifes.\n clubs.\n map(:_id).\n go!\n end", "def getInvited\n rsvpInvited = []\n Invitation.where(\"study_session_id = '#{self.id}' AND status = 'invited'\").each do |invitation|\n rsvpInvited.push(User.where(\"id = '#{invitation.user_id}'\").first)\n end\n return rsvpInvited\n end", "def users_sharing_the_same_interest\n self.user_interest_preferences.map(&:user_id)\n end", "def participants\n User.find([self.thought.user_id,*thought.comments.map(&:user_id)].compact-[self.user_id])\n end", "def dead_opponents(battler = $game_player)\n opponents = []\n @action_battlers.each do |key, members|\n next if key == battler.team_id\n members.compact.each do |member|\n next unless member.dead?\n opponents.push(member)\n end\n end\n return opponents\n end", "def current_holders\n badge_nominations.select{ |bn| bn.accepted? }.map{ |bn| bn.user }\n end", "def account_ids()\n return [1, 2]\n end", "def getPlayerIds\n @socket.request 'world.getPlayerIds()'\n end", "def get_unviewed_ids(user); end", "def get_team_managed_by_profile\n rosters = Roster.select('team_id').where(:profile_id => current_profile.id, :is_manager => true)\n rosters_team_ids = rosters.collect{|u| u.team_id}\n rosters_team_ids\n end", "def all_endorsers_of_candidate(user)\n candidate = Candidate.find_by(user: user)\n p endorsements = all_endorsements.map { |endorsement| endorsement.candidate == candidate }\n endorsements = all_endorsements.select { |endorsement| endorsement.candidate == candidate }\n endorsements.map { |endorsement| endorsement.user.twitteruser }\n end", "def playing_users\n user_state.select { |user, state| state == :playing }.keys\n end", "def household_users\n User.where(id: household_user_ids)\n end", "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", "def trail_users_id_array\n # trail = Trail.find(:id)\n self.users.map do |x| \n x.id \n end \n end", "def find_user_diets\n yummly_diets = []\n\n\n #Find current user's diets\n user_diets = DietaryPreference.where(user_id: self.id)\n\n\n #Iterate through own and friends's diets and place in array yummly_diets\n if user_diets != nil\n user_diets.each do |diet|\n diet_id = diet.diet_id\n yummly_diets << Diet.find(diet_id).yummly_diet_id\n end\n \n yummly_diets\n else\n yummly_diets = nil\n end\n\n end", "def get_games_winners\n tally = all_player_tally #tally is a hash with the combination of scores between all players\n winner_tally = hash_select_by_max_key(tally)\n return convert_hash_keys_to_array(winner_tally)\n end", "def participants\n users.where(parent_id: parent_id || current_user_id).flat_map(&:participants)\n end", "def get_party\n mems = []\n for i in 0...$game_party.members.count\n mems.push($game_party.members[i].id)\n end\n return mems\n end", "def agreed\n @choosen = []\n @my_mentees = Pair.find_by_user_id(current_user.id).mentee_id\n if @my_mentees.is_a?(Integer)\n if Pair.find_by_user_id(@my_mentees) != nil\n @my_mentees_choice = Pair.find_by_user_id(@my_mentees).mentee_id\n if @my_mentees_choice == current_user.id\n @choosen.push(@my_mentees)\n end\n end\n else\n @my_mentees.each do |mentee|\n @mentees_matches = Pair.find_by_user_id(mentee).mentee_id\n if @mentees_matches.is_a?(Integer)\n if @mentees_matches == current_user.id\n @choosen.push(@mentees_matches)\n end\n elsif @mentees_matches != nil\n @mentees_matches.each do |me|\n if me == current_user.id\n @choosen.push(me)\n end\n end\n end\n end\n end\n return @choosen.last\n end", "def win_loss_array\n win_count = 0\n loss_count = 0\n\n waiting_players.each do |player|\n player.matches.each do |match| \n if match.winner_id == player.id\n win_count += 1\n elsif !match.winner_id.nil?\n loss_count += 1\n end\n end\n end\n \n [win_count, loss_count]\n end", "def teams_with_ids\n team_array = []\n\n self.teams.all.each do |team|\n team_array << [team.name, team.id]\n end\n\n team_array\n end", "def followers_ids\n followers.pluck('users.id')\n end", "def user_ids\n array = Array.new\n\n self.each(\"USERS/ID\") do |id|\n array << id.text.to_i\n end\n\n return array\n end", "def players\n # Build two arrays of players\n cur_players = teams.map do |team|\n team.wattball_players\n end\n\n # Combine the arrays\n cur_players.flatten! \n end", "def get_team_ids(game)\n team_ids = game.team_ids # \"1/2-4/5\"\n team_ids.split(\"-\").map do |team| #[\"1/2\", \"4/5\"]\n team.split(\"/\")\n end.flatten.map(&:to_i)\n end", "def user_ids\n @attributes[:user_ids]\n end", "def user_ids\n @attributes[:user_ids]\n end", "def user_ids\n @attributes[:user_ids]\n end", "def member_ids\n self.class.player_ids_for([id])\n end", "def active_tournaments\n admin_tournaments = Tournament.joins(:admins).where(tournament_admins: { user_id: self.id }).to_a\n player_tournaments = Tournament.joins(teams: :players).where(teams: { players: { user_id: self.id } }).to_a\n\n (admin_tournaments + player_tournaments).uniq\n end", "def users\n user_arr = []\n accounts.each do |s|\n user_arr << User.find(s.user.id)\n end\n user_arr\n end", "def participant_ids # :nodoc:\n @participant_ids.map { |id| id.dup }\n end", "def alive_in_game?(game)\n game.players.select { |player| player.role == \"player\"}.map(&:user_id).include?(id)\n end", "def assignable_people\n assignable_people_ids.collect{|user_id| User.find(user_id)}\n end", "def followed_ids\n followed.map(&:id)\n end", "def get_retweet_ids\n\t\tretweet_ids = $client.retweeters_ids(tweet_id, options = {})\n\t\tids = []\n\t\tretweet_ids.each do |i|\n\t\t\tUser.all.each do |u|\n\t\t\t\tif u.twitter_id.to_i == i.to_i\n\t\t\t\t\tids.push(i)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\treturn ids\n\tend", "def follower_ids\n followers.map(&:id)\n end", "def inverse_friends\n output = []\n inverse_friendships.each do |f|\n output << f.user\n end\n output\n end", "def ifollowers_of_ifollowers_ids\n Following.all(\n :select => \"user_id\",\n :conditions => {\n :follower_id => self.ifollower_ids,\n :is_active => true},\n :group => :user_id).map(&:user_id) - [self.id]\n end", "def fetch_friend_id_array\n\t\tfriend_ids = hit_twitter { @client.friend_ids.to_a }\n\t\treturn friend_ids\n\tend", "def get_saved_games_list(username)\n result = Array.new()\n res = @db.query(\"SELECT DISTINCT GameID, User1, User2, GameType FROM SavedGames WHERE User1 = '#{username}' OR User2 = '#{username}';\")\n while row = res.fetch_row do\n result.push(GameListElement.new(row[0], row[1], row[2], row[3]))\n end\n result\n end", "def all_friend_ids(username = false)\n ids = []\n cursor = \"-1\"\n while cursor != 0 do \n json = get(\"/friends/ids.json?cursor=#{cursor}#{username ? \"&screen_name=#{username}\" : ''}\")\n cursor = json[\"next_cursor\"]\n ids += json[\"ids\"]\n end\n ids\n end", "def entry_user_ids\n (entered_stories.map(&:user_id) + entered_notes_user_ids).flatten\n end", "def return_teams\r\n result = Array.new(@teams) { [] }\r\n allocation = @neighbourhoods_list[0].l_best_position\r\n (0..@length - 1).each do |x|\r\n (0..@teams - 1).each do |y|\r\n result[y].append(@table[x]['id']) if allocation[x][y] == 1\r\n end\r\n end\r\n # If there are any separated students\r\n # Assign them to teams\r\n assign_separated(result) unless @separated.nil?\r\n result\r\n end", "def blocked_user_ids\n Rails.cache.fetch(\"blocked_user_ids_#{id}\", expires_in: 1.month.from_now) do\n blocked_users_relationships.pluck(:user_id)\n end\n end", "def get_games\n @games = Game.where(:user_id=>:id)\n end", "def users_who_completed_all_studies\n @downloaded_studies = Study.find(self.study_ids)\n\n user_arr = []\n @downloaded_studies.each do |study|\n user_arr.push(study.study_completions.pluck(:user_id).uniq)\n end\n\n ## SELECT THE COMMON VALUES OF ALL INTERIOR ARRAYS\n user_ids_and_nil = user_arr.reduce { |a, b| a & b }\n\n\n ## THIS COMMAND GETS RID OF ALL LOGGED OUT USER SURVEY DATA -- could be interesting to see if its use can dry up code\n user_ids_who_completed_all_studies = user_ids_and_nil.grep(Integer)\n\n user_ids_who_completed_all_studies\n end" ]
[ "0.67178816", "0.66381216", "0.6622362", "0.6554963", "0.65111244", "0.65111244", "0.65111244", "0.64689744", "0.6463699", "0.6420505", "0.638433", "0.6377357", "0.6377357", "0.6317945", "0.6317588", "0.6302741", "0.6298207", "0.6297267", "0.62927014", "0.6287805", "0.62169194", "0.62157226", "0.62137675", "0.62132734", "0.61886996", "0.61867243", "0.61816216", "0.6172095", "0.61570084", "0.6118315", "0.6113808", "0.6102154", "0.6094601", "0.60865533", "0.608287", "0.60791844", "0.6078285", "0.6072219", "0.6036009", "0.6016705", "0.6008123", "0.6004008", "0.60029405", "0.59741724", "0.59524924", "0.59427255", "0.5942329", "0.59414595", "0.592933", "0.5923256", "0.5918757", "0.59120804", "0.58806294", "0.5878908", "0.58763146", "0.585856", "0.5847471", "0.58380264", "0.5833531", "0.5831116", "0.5818161", "0.5797984", "0.5796924", "0.5795556", "0.5790775", "0.57841057", "0.57667506", "0.5766554", "0.57297903", "0.5729238", "0.5722362", "0.5702856", "0.56995726", "0.5697102", "0.56945777", "0.5672453", "0.5659464", "0.5656567", "0.56549346", "0.56549346", "0.56549346", "0.5653939", "0.5653877", "0.5653505", "0.56530756", "0.56504047", "0.5646956", "0.56465775", "0.56376296", "0.5635839", "0.5614287", "0.56137174", "0.5609861", "0.56049484", "0.55951864", "0.5580685", "0.5580499", "0.55769837", "0.556946", "0.55663276" ]
0.76749367
0
attr_accessible :authq, :start, :order, :browse_type
def heading @heading='Browse' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_order_fields(ar_values, ar_defaults, ar_ascdesc)\n @of_options = ar_values\n @of_defaults = ar_defaults\n @of_ascdes = ar_ascdesc\n end", "def order_params\n\t\tparams.require(:order).permit(:start_date,:end_date,:location_id, :performer_id, :duration_id, :quality_id, :delivery_time_id, :clip_category_id, :email, :total,:refunded,:affiliate_id,:description, :perf_cut, :c4u_cut, :affiliate_cut, :white_label_cut,:payment_status,:pre_order_status)\n\tend", "def start_field; end", "def field_params\n params.require(:field).permit(:name, :index, :group_id, :description, :options, :hidden, :locked)\n end", "def permitted_attributes\n [:completed, :title, :phase_id, :position]\n end", "def add_sort_field(*) super end", "def author_params\n params.permit(:order_attr, :order_val, :page)\n end", "def admin_attribute_params\n params.require(:admin_attribute).permit(:name, :description, :orderby, :product_id)\n end", "def attr_params\n params[:attr].permit(:name, :type, :value, :foreign_key, :ordinal, :group, :visible, :editable, :required, :input)\n end", "def ordering_query; end", "def order_params\n params.require(:order).permit(:pick_up, :drop_off, :vehicle_type,:pick_up_at)\n end", "def order_params\n params.require(:order).permit(:name, :class_type, :address, :number, :email, :start_date, :start_time, :topic)\n end", "def order_params\n params.require(:order).permit(:index, :edit)\n end", "def _params\n # params.require(:model).permit(:model:classname, :schema, :tablename, :name)\n params.require(:model).permit(:classname, :schema, :tablename, :name, :default_sort_field)\n end", "def initialize(*)\n super\n @extra_fields = []\n end", "def form_field_order\n %w{\n\n }\n end", "def order_params\n\t params.require(:order).permit(:menu, :mtype, :restaurant, :user_id)\n\t end", "def form_field_order\n %w{\n\n }\n end", "def form_field_order\n %w{\n\n }\n end", "def mass_assignment_authorizer\n super + Field.valid_options\n end", "def order_params\n params.require(:order).permit(:user, :quantity, :canvas, :model, :offset, :startW, :image, :big_image, :cart, :price, :share, :popularity)\n end", "def page_params\n params.permit(:page, :page_size, :order)\n end", "def page_params\n\t\tparams.require(:page).permit(:is_public, paragraphs_attributes: [:id, :content, :order, marks: [:id, :start, :end, :range]])\n\tend", "def order_params\n params.require(:order).permit(:cheap_beer, :class_beer, :member)\n end", "def order_params\n # params.require(:order).permit(:user_id, :from_location_id, :to_location_id, :order_state_id, :cost, :comment, :author, :score)\n params.require(:order).permit(:cost, :comment, :author, :score)\n end", "def start_field=(_arg0); end", "def walker_params\n params.permit(:id, :name, :email, :phone_number, :location, :description)\n end", "def order_params\n params.require(:order).permit(:OrderId, :Name, :Type, :CreateTime, :CreateUser, :ExecTime, :Execer, :State)\n end", "def detail_params\n params.require(:q).permit(:sorts)\n end", "def attri_params\n params.require(:attri).permit(:name, :agroup_id, :id_sort, :parent_id, :keycode)\n end", "def order_params\n params.require(:order).permit(:collection_date, :contact_person, :marketing, :phone, :email, :email_confirmation, :status, :date_selector, :guid, :strip_id, :total, :permalink, orderitems_attributes:[:_destroy, :id, :order_id, :saleproduct_id, :quantity, :item_price, :total_price])\n end", "def req_ord_params\n params.require(:req_ord).permit(:uuid, :matkl, :status, :ord_no, :ord_at, :due_at, :ex_curr, :ex_rate, :subject, :remark, :req_by, :req_remark, :sent_by, :sent_at, :sent_ip, :reply_at, :sent_cnt, :reply_cnt, :creator, :updater, :approver, :finish_at, {werkss: []}, :vtweg, :matgrp, :matgrp_id)\n end", "def q_params\n params.require(:q)\n .permit(:requested_by_user_id, :assigned_to_user_id, :status,\n created_at: %i[start_date end_date])\n end", "def q_params\n params.require(:q)\n .permit(:requested_by_user_id, :assigned_to_user_id, :status,\n created_at: %i[start_date end_date])\n end", "def order_params\n params.require(:order).permit(:order_date, :student_id, :entree_quantity, :entree,\n :side, :dessert, :price, :notes)\n end", "def exposed_attributes\n [ :id, :goal_id, :user_id, :accuracy, :time_to_complete, :note, :due_date ]\n end", "def fields; end", "def fields; end", "def fields; end", "def start_order_params\n params.fetch(:start_order, {})\n end", "def editable_attribute_names; super + additional_fields end", "def editable_attribute_names; super + additional_fields end", "def editable_attribute_names; super + additional_fields end", "def attractive_params\n params.require(:attractive).permit(:name, :description, :address, :web, :telephone, :latitude, :longitude, :type_id, :schedule)\n end", "def initialize(order)\n @order = order\n end", "def order_params\n params.require(:order).permit(:total_due_calc, :supplier_id, :quote_id)\n end", "def order_params\n params.require(:order).permit(:branch_id, :food_id,\n :expires_at, :deadline,\n :discount_price)\n end", "def order_params\n params.require(:order).permit(:id, :company_id, :agency_id, :account_manager_id, :manager_id, :mark_up, :title, :pay_range, :notes, :number_needed, :needed_by, :urgent, :active, :dt_req, :bg_check, :stwb, :heavy_lifting, :shift, :est_duration, \n jobs_attributes: [:order_id, :title, :description, :start_date, :id, :employee_id, :active], skills_attributes: [:id, :skillable_type, :skillable_id, :name, :required, :_destroy])\n end", "def order_params\n params.require(:order).permit( :order_date, :user_id, :status)\n end", "def order_params\n params.require(:order).permit(:firstname, :lastname, :company, :street_address, :city, :state, :zipcode, :country, :telephone, :email, :user_id, :status, :question)\n end", "def order_params\n params.require(:order).permit(:menu, :mtype, :restaurant, :user_id)\n end", "def quote_params\n params.permit(:full_name, :phone_number, :building_type, \n :number_floor, :number_appartment, :number_basement, \n :number_of_trade_market, :number_parking_space, \n :number_of_elevators_cage, :number_of_distinct_business, \n :maximum_occupant_per_floor, :hour_of_activity, \n :elevator_price, :installation_price, :number_elevator, :quality)\n # params.require(:quote).permit()\n end", "def initialize(klass, attrs={})\n super(klass)\n @_table_name = klass.table_name\n @attrs = attrs.dup\n @_operator = Operator.new(attrs[:edgarj_search_form_operator])\n @_parent = attrs[:search_form_parent]\n end", "def add_index_field(*) super end", "def order_params\n params.require(:order).permit(:deliver_date, :client_id, :course_club,\n :logo, :state, :paid, :notes, :sponsors)\n end", "def query_field; end", "def initialize sort_order\n @sort_order = sort_order\n validate_sort_order! \n end", "def order\n end", "def order_params\n params.require(:order)\n .permit(\n :category_id, :description, \n :user_id, :urgency,\n :start_order, :end_order,\n :order_status, :price, \n :paid, :address_id,\n :rate, :order_wirecard_own_id,\n :order_wirecard_id, :payment_wirecard_id,\n :hora_inicio, :hora_fim,\n :user_rate)\n end", "def order_params\n params.require(:order).permit(:expires_at, :deadline,\n :discount_price)\n end", "def set_start_order\n @start_order = StartOrder.find(params[:id])\n end", "def order_params\n params.require(:order).permit!\n end", "def default_order _field, _direction=:asc\n @default_order_field = _field\n @default_order_direction = _direction\n end", "def arrangeable_fields\n raise NotImplementedError, 'You need to overwrite this method in the calling class'\n end", "def order_params\n params.require(:order).permit(:id, :company_id, :manager_id, :title, :pay_range, :notes, :number_needed, :needed_by, :urgent, :active, jobs_attributes: [:order_id, :title, :description, :start_date, :id, :employee_id, :active])\n end", "def order_params\n #params.require(:id).permit(:product_id, :shop_id, :day, :quantity, :locked, :user_id)\n params.require(:order).permit(:product_id, :shop_id, :day, :quantity, :locked, :user_id, :origqty, :cost)\n end", "def initialize\n @fields = []\n end", "def model_params\n params.require(:search_field).permit(:name, :title, :sort_order, :options)\n end", "def order_params\n params.require(:order).permit(:id, :quantity, :delivery_address, :delivery, :pickup, :order_date, :customer_phone, :meal_id, :inputPickupDelivery, :delivery_fee)\n end", "def order_params\n params.require(:order).permit(:uname, :uaddress, :upost, :uphone, :uaddress, :uhomephone, :pirce)\n end", "def order_params\n params.require(:order).permit(:date_ric, :date_cons, :note, :article_id, :customer_id, :price, :total_pieces, :packaging, :ord_number)\n end", "def initialize(start: 0, limit: 100, sort: nil, order: :asc)\n @start = start\n @limit = limit\n @sort = sort\n @order = order\n @calc_found_rows = 'Yes'\n @fields = self.class.fields.values\n @filters = []\n end", "def order; end", "def order; end", "def order_params\n params.require(:order).permit(:order_no, :order_date, :order_title, :prefix, :postfix, :order_scan_path, :notes)\n end", "def order_params\n params.require(:order).permit(:account_id, :total, :completed_at)\n end", "def quote_params\n params[:quote].permit(:id, :adtype, :views, :demographics, :subtotal, :company_id)\n end", "def order_position_params\n params.require(:order_position).permit(:ordinal, :amount, :completed, :price)\n end", "def order_params\n params.require(:order).permit(:title, :content, :car_id, :client_id, :worker_id, :finished_at, :created_at, :mileage, :status)\n end", "def goal_params\n params.permit(:title, :description, :complexity, :priority, :progress, :user_id)\n end", "def order_params\r\n params.require(:order).permit(:name, :nit, :branch_id)\r\n end", "def order_params\n base = [:customer_id, :offer_id, :quantity, :customer_observation, :approved]\n params.require(:order).permit(base)\n end", "def order_params\n params.require(:order).permit(:cel_model, :imei, :parcel_number, :price, :status, :user_id, user_attributes: [:name, :cpf, :email])\n end", "def order_params\n params.require(:order).permit(:user_id, :order_date, :expiration_date, movie_copy_ids: [])\n end", "def index_fields\n\t\t\tif defined? @_index_fields\n\t\t\t\t@_index_fields\n\t\t\telse\n\t\t\t\t#column_names = self.column_names.map do |m|\n\t\t\t\t\t#m.to_sym\n\t\t\t\t#end\n\t\t\t\tsorted_attributes\n\t\t\t# \tsorted_attrs + (column_names - sorted_attrs - [\"created_at\", \"updated_at\", \"id\"])\n\t\t\tend\n\t\tend", "def sortable_attributes\n @sortable_attributes ||= []\n end", "def order_params\n params.require(:order).permit(:order_no, :po_number, :subtotal, :tax, :total, :comment, :parts_in_order_attributes => [:part_id, :amount, :cost, :quant_ordered, :quant_received, :quant_backordered, :id])\n end", "def accessible_attributes\n\t [:name, :code ]\n\tend", "def order_params\n params.require(:order).permit!\n end", "def order_params\n params.require(:order).permit!\n end", "def order_params\n params.require(:order).permit(:order, :resturant, :image, :status , :user_id,:invited)\n end", "def order_params\n params.fetch(:order, {}).permit(:id,:quantity,:address, :billing, :coupon, :page)\n end", "def process_step_params\n params.require(:process_step).permit(:name, :sort, :active_status)\n end", "def initialize(order)\n super\n @order = order\n end", "def order_params\n params.require(:order).permit( :totalorder, :user_id, :product_id, :supplier_id, \n \t\t\t\t\t\t\t\t:OrderItems_attributes => [:id, :product_id, :quantity, :subtotal, :purchaseprice, :_destroy])\n end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end" ]
[ "0.57434744", "0.56594706", "0.5595162", "0.5505733", "0.5497588", "0.54849476", "0.5457964", "0.5439094", "0.5438873", "0.5403383", "0.5393872", "0.5390238", "0.5386956", "0.53708076", "0.53612095", "0.5330128", "0.5321766", "0.5318571", "0.5318571", "0.5290839", "0.52847815", "0.5281097", "0.5279225", "0.5276564", "0.52669513", "0.52591014", "0.52487975", "0.52470654", "0.5240763", "0.52311426", "0.5220714", "0.5214395", "0.5213388", "0.5213388", "0.5208299", "0.5201402", "0.5193724", "0.5193724", "0.5193724", "0.5185803", "0.5180679", "0.5180679", "0.5180679", "0.5179279", "0.51691884", "0.51658714", "0.51543087", "0.5149741", "0.51481694", "0.5147779", "0.5145605", "0.5144416", "0.51416343", "0.5140951", "0.51394695", "0.51346934", "0.51287156", "0.5114558", "0.5113278", "0.5112878", "0.51090384", "0.51037085", "0.51031214", "0.51025206", "0.51023537", "0.510231", "0.5099107", "0.5090867", "0.5090823", "0.5089206", "0.5087134", "0.50801677", "0.5078807", "0.5078807", "0.5077459", "0.5075665", "0.50751066", "0.5071714", "0.50615877", "0.5061294", "0.5055927", "0.50547373", "0.5050632", "0.50501066", "0.5048122", "0.5037085", "0.5036701", "0.50365245", "0.5035009", "0.5035009", "0.50325024", "0.50321096", "0.50233436", "0.5021051", "0.501771", "0.5011248", "0.5011248", "0.5011248", "0.5011248", "0.5011248", "0.5011248" ]
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_silicon_metal_mix_bag_content @silicon_metal_mix_bag_content = SiliconMetal::MixBagContent.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "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", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "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", "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", "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", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "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", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "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", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "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", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "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", "def determine_valid_action\n\n end", "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", "def startcompany(action)\n @done = true\n action.setup\n end", "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", "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", "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", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "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", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "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", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "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", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "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", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "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", "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", "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", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "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", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "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", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "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" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Only allow a trusted parameter "white list" through.
def silicon_metal_mix_bag_content_params params.require(:silicon_metal_mix_bag_content).permit(:mix_bag_id, :old_bag_no, :weight, :operator) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def filtered_parameters; end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end", "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", "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", "def param_whitelist\n [:rating, :review]\n end", "def valid_params?; end", "def permitted_params\n declared(params, include_missing: false)\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "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", "def filter_parameters; end", "def filter_parameters; end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def check_params; true; end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def list_params\n params.permit(:name)\n end", "def check_params\n true\n end", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "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", "def additional_permitted_params\n []\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end", "def allow_params_authentication!; end", "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", "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", "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", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end", "def quote_params\n params.permit!\n end", "def list_params\n params.permit(:list_name)\n end", "def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end", "def all_params; end", "def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end", "def source_params\n params.require(:source).permit(all_allowed_params)\n end", "def user_params\n end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def permitted_params\n @wfd_edit_parameters\n end", "def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end", "def user_params\r\n end", "def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend", "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", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end", "def params_permit\n params.permit(:id)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def filter_params\n params.permit(*resource_filter_permitted_params)\n end", "def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend", "def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end", "def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\n end", "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", "def argument_params\n params.require(:argument).permit(:name)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\n end", "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", "def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end", "def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end", "def parameters\n nil\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end", "def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end", "def special_device_list_params\n params.require(:special_device_list).permit(:name)\n end", "def normal_params\n reject{|param, val| param_definitions[param][:internal] }\n end", "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", "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" ]
[ "0.71207976", "0.705222", "0.69488335", "0.69021654", "0.67362636", "0.6717561", "0.6689192", "0.6678948", "0.66622657", "0.6555007", "0.6527569", "0.64588845", "0.64522904", "0.6450812", "0.6448551", "0.6434285", "0.6412147", "0.6412147", "0.6393719", "0.6381976", "0.6381976", "0.6375729", "0.63612986", "0.6355188", "0.6285782", "0.6281054", "0.62458795", "0.62301606", "0.6224915", "0.622486", "0.6210121", "0.62075305", "0.61789036", "0.6172226", "0.6168105", "0.6160074", "0.61448", "0.61348766", "0.61225486", "0.6110136", "0.60996324", "0.6078064", "0.6052116", "0.6041118", "0.6035623", "0.60318893", "0.602124", "0.6020888", "0.6020888", "0.6020888", "0.6020888", "0.6020888", "0.6020888", "0.6020888", "0.6020888", "0.6020888", "0.6020888", "0.6020888", "0.6020888", "0.6020888", "0.6020888", "0.6020888", "0.6020888", "0.6020888", "0.6016033", "0.60159355", "0.6007089", "0.6005682", "0.60034984", "0.59973234", "0.59967214", "0.5996135", "0.5985281", "0.59851986", "0.59779865", "0.5973843", "0.59714854", "0.5966646", "0.59659743", "0.59659743", "0.5957345", "0.5952455", "0.59514904", "0.59479517", "0.59451497", "0.5932892", "0.59316385", "0.5929465", "0.59269744", "0.5920278", "0.5917984", "0.59153455", "0.5913883", "0.5908388", "0.5907796", "0.590644", "0.5900998", "0.5898838", "0.5898161", "0.58975124", "0.5895988" ]
0.0
-1
POST /clubs POST /clubs.json
def create @club = Club.new(params[:club]) @club.user = current_user if @club.save @club.memberships.create!(couple_id: current_user.activeCouple.id, verified: true) redirect_to root_path, notice: t('club.create') else render :new end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @club = Club.new(params[:club])\n\n if @club.save\n render json: @club, status: :created, location: @club\n else\n render json: @club.errors, status: :unprocessable_entity\n end\n end", "def create\n\t\t@club = Club.new(club_params)\n\n\t\tif @club.save\n\t\t \trender json: @club, status: :created\n\t\telse\n\t\t \trender json: @club.errors, status: :unprocessable_entity\n\t\tend\n\tend", "def create\n @club = Club.new(club_params)\n\n respond_to do |format|\n if @club.save\n format.html { redirect_to @club, notice: 'Club was successfully created.' }\n format.json { render :show, status: :created, location: @club }\n else\n format.html { render :new }\n format.json { render json: @club.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @club = Club.new(club_params)\n\n respond_to do |format|\n if @club.save\n format.html { redirect_to @club, notice: \"Club was successfully created.\" }\n format.json { render :show, status: :created, location: @club }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @club.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @club = Club.new(club_params)\n\n respond_to do |format|\n if @club.save\n format.html { redirect_to @club, notice: 'Club was successfully created.' }\n format.json { render action: 'show', status: :created, location: @club }\n else\n format.html { render action: 'new' }\n format.json { render json: @club.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @club = Club.new(club_params)\n\n respond_to do |format|\n if @club.save\n format.html { redirect_to @club, notice: 'Club was successfully created.' }\n format.json { render action: 'show', status: :created, location: @club }\n else\n format.html { render action: 'new' }\n format.json { render json: @club.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @club = Club.new(club_params)\n @club.save\n respond_with @club\n end", "def create\n @club = Club.new(club_params)\n\n respond_to do |format|\n if @club.save\n format.html { redirect_to @club, notice: 'Circolo creato con successo.' }\n format.json { render action: 'show', status: :created, location: @club }\n else\n format.html { render action: 'new' }\n format.json { render json: @club.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @admin_club = Admin::Club.new(admin_club_params)\n\n respond_to do |format|\n if @admin_club.save\n format.html { redirect_to @admin_club, notice: 'Club was successfully created.' }\n format.json { render :show, status: :created, location: @admin_club }\n else\n format.html { render :new }\n format.json { render json: @admin_club.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tennis_club = TennisClub.new(tennis_club_params)\n\n respond_to do |format|\n if @tennis_club.save\n format.html { redirect_to @tennis_club, notice: 'Tennis club was successfully created.' }\n format.json { render :show, status: :created, location: @tennis_club }\n else\n format.html { render :new }\n format.json { render json: @tennis_club.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @club = Club.new(club_params)\n\n respond_to do |format|\n if @club.save\n @user_club = UserClub.create(user_id: current_user.id, club_id: @club.id, join_date: Date.current)\n format.html { redirect_to @club, notice: 'Club was successfully created.' }\n format.json { render :show, status: :created, location: @club }\n else\n format.html { render :new }\n format.json { render json: @club.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n authorize Club\n @club = Club.new(club_params)\n @club.owner = current_user\n @club.users << current_user\n respond_to do |format|\n if @club.save\n format.html { redirect_to @club, notice: 'Club was successfully created.' }\n format.json { render :show, status: :created, location: @club }\n else\n format.html { render :new }\n format.json { render json: @club.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @clubs = Club.all\n render json: @clubs\n end", "def create\n @nightclub = Nightclub.new(params[:nightclub])\n\n respond_to do |format|\n if @nightclub.save\n format.html { redirect_to @nightclub, notice: 'Nightclub was successfully created.' }\n format.json { render json: @nightclub, status: :created, location: @nightclub }\n else\n format.html { render action: \"new\" }\n format.json { render json: @nightclub.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @clubuser = Clubusers.new(clubuser_params)\n\n respond_to do |format|\n if @clubuser.save\n format.html { redirect_to @clubuser, notice: 'Clubuser was successfully created.' }\n format.json { render :show, status: :created, location: @clubuser }\n else\n format.html { render :new }\n format.json { render json: @clubuser.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n if params[:token].present?\n @token = Token.where(\"Value = ?\", params[:token]).first\n @user = @token.user\n else\n @user = session[:currentUser]\n end\n \n create_club_ok = is_admin_or_event_manager(@user)\n\n if create_club_ok\n @club = Club.new(params[:club])\n end\n\n respond_to do |format|\n if create_club_ok\n if @club.save\n format.html { redirect_to @club, :notice => 'Club was successfully created.' }\n format.json { render :json => @club, :status => :created, :location => @club }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @club.errors, :status => :unprocessable_entity } \n end\n else\n format.html { redirect_to :back }\n format.json { render :json => @club.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @club = Club.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @club }\n end\n end", "def create\n @beer_club = BeerClub.new(params[:beer_club])\n\n respond_to do |format|\n if @beer_club.save\n format.html { redirect_to join_path(@beer_club), notice: 'Beer club was successfully created.' }\n\n else\n format.html { render action: \"new\" }\n format.json { render json: @beer_club.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @club = Club.find_by_slug(params[:club_id])\n @team = @club.teams.new(params[:team])\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to(@club, :notice => 'Team was successfully created.') }\n else\n format.html { render :action => \"new\" }\n end\n end\n end", "def create\n @club2 = Club2.new(club2_params)\n\n respond_to do |format|\n if @club2.save\n format.html { redirect_to @club2, notice: 'Club2 was successfully created.' }\n format.json { render :show, status: :created, location: @club2 }\n else\n format.html { render :new }\n format.json { render json: @club2.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @club_type = ClubType.new(club_type_params)\n\n respond_to do |format|\n if @club_type.save\n format.html { redirect_to @club_type, notice: 'Club type was successfully created.' }\n format.json { render :show, status: :created, location: @club_type }\n else\n format.html { render :new }\n format.json { render json: @club_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @club = Club.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @club }\n end\n end", "def index\n @clubs = Club.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clubs }\n end\n end", "def create\n @nightclub = Nightclub.new(nightclub_params)\n\n respond_to do |format|\n if @nightclub.save\n format.html { redirect_to @nightclub, notice: 'Nightclub was successfully created.' }\n format.json { render action: 'show', status: :created, location: @nightclub }\n else\n format.html { render action: 'new' }\n format.json { render json: @nightclub.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @club_update = ClubUpdate.new(club_update_params)\n\n respond_to do |format|\n if @club_update.save\n format.html { redirect_to @club_update, notice: 'Club update was successfully created.' }\n format.json { render :show, status: :created, location: @club_update }\n else\n format.html { render :new }\n format.json { render json: @club_update.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @admin_update_club = Admin::Update::Club.new(admin_update_club_params)\n\n respond_to do |format|\n if @admin_update_club.save\n format.html { redirect_to @admin_update_club, notice: 'Club was successfully created.' }\n format.json { render :show, status: :created, location: @admin_update_club }\n else\n format.html { render :new }\n format.json { render json: @admin_update_club.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @wine_club = WineClub.new(wine_club_params)\n\n respond_to do |format|\n if @wine_club.save\n format.html { redirect_to @wine_club, notice: 'Wine club was successfully created.' }\n format.json { render :show, status: :created, location: @wine_club }\n else\n format.html { render :new }\n format.json { render json: @wine_club.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @stripclub = Stripclub.new(stripclub_params)\n\n respond_to do |format|\n if @stripclub.save\n format.html { redirect_to @stripclub, notice: 'Stripclub was successfully created.' }\n format.json { render :show, status: :created, location: @stripclub }\n else\n format.html { render :new }\n format.json { render json: @stripclub.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n\t\t@clubs = Club.all\n\t\trender json: @clubs\n\tend", "def show\n @club = Club.find(params[:id])\n\n render json: @club\n end", "def club_params\n params.require(:club).permit(:club_type, :name, :members, :description, :sport, :place_id)\n end", "def create\n @club_student = ClubStudent.new(club_student_params)\n\n respond_to do |format|\n if @club_student.save\n format.html { redirect_to @club_student, notice: 'Club student was successfully created.' }\n format.json { render :show, status: :created, location: @club_student }\n else\n format.html { render :new }\n format.json { render json: @club_student.errors, status: :unprocessable_entity }\n end\n end\n end", "def club_params\n params.require(:club).permit(:name, :contact_officer, :date_created)\n end", "def create\n #debugger\n @club = Club.create(params[:club])\n @current_user.club_id = @club.id\n\n @current_user.save\n\n params.each do |key, value|\n if (key.to_s[/adduser.*/])\n #if param[key].blank?\n # @object.errors.add_to_base(\"All new user fields are required.\")\n #end\n @user = User.new\n @user.update_attribute(:email,params[key])\n @user.update_attribute(:club_id,params[:id])\n @user.save\n #@user.send_confirmation_instructions\n end\n end\n\n respond_to do |format|\n if @club.save\n format.html { redirect_to @club, notice: 'Club was successfully created.' }\n format.json { render json: @club, status: :created, location: @club }\n else\n format.html { render action: \"new\" }\n format.json { render json: @club.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @yong_hu = YongHu.find_by(user_id: current_user.user_id)\n @club = Club.new(club_params)\n @club.yong_hu_id = @yong_hu.id\n @club.status = '0'\n\n respond_to do |format|\n if @club.save\n format.html { redirect_to @club, notice: '提交申请成功,等待社联大大审批中……' }\n format.json { render :show, status: :created, location: @club }\n else\n format.html { render :new }\n format.json { render json: @club.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n\n\n @membership = Membership.new(beer_club_id: params[:membership][:beer_club_id], user_id: current_user.id, confirmed: false)\n\n respond_to do |format|\n if @membership.save\n format.html { redirect_to beer_club_path(params[:membership][:beer_club_id]), notice: \"Welcome #{current_user.username}\" }\n format.json { render :show, status: :created, location: @membership }\n\n else\n format.html { render :new }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n @beer_clubs = BeerClub.all\n end\n end\n end", "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", "def club_params\n params.require(:club).permit(:name, :short_name, :address, :postal4, :postal3, :city, :phone, :email, :president, :url, :municipality_id)\n end", "def show\n \n @club = Club.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @club }\n end\n\n \n end", "def create\n if MemberRequest.req!(@club, current_user)\n flash[:success] = \"Request Sent!\" \n redirect_to view_club_path(path: @club.path)\n else\n flash[:danger] = 'ERROR: There was an error processing your request'\n redirect_to root_url\n end\n end", "def create\n @club_path = ClubPath.new(params[:club_path])\n\n respond_to do |format|\n if @club_path.save\n format.html { redirect_to @club_path, notice: 'Club path was successfully created.' }\n format.json { render json: @club_path, status: :created, location: @club_path }\n else\n format.html { render action: \"new\" }\n format.json { render json: @club_path.errors, status: :unprocessable_entity }\n end\n end\n end", "def club_params\n params.require(:club).permit(:name, :room_name)\n end", "def index\n @clubs = Club.all\n end", "def index\n @clubs = Club.all\n end", "def index\n @clubs = Club.all\n end", "def show\n\t\trender json: @club\n\tend", "def new\n @club_path = ClubPath.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @club_path }\n end\n end", "def club_params\n\t\t\tparams.require(:club).permit(:name, :contact_officer, :date_created)\n\t\tend", "def club_params\n # @user_id = current_user.id\n params.require(:club).permit(:club_name, :club_email, :club_brief, :found_time)\n end", "def club_params\n params.require(:club).permit(:name, :phone, :address, :wait, :avatar)\n end", "def new\n @beer_club = BeerClub.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @beer_club }\n end\n end", "def create\n @club = Club.new(params[:club])\n\n respond_to do |format|\n if @club.save\n @event = Event.new(:date => Time.now, :club_id => @club.id, :voices_number => 0, :voices_index => 0)\n\n if @event.save\n format.html { redirect_to(\"/cities/#{@club.city_id}\", :notice => 'Club was successfully created.') }\n format.xml { render :xml => @club, :status => :created, :location => @club }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @club.errors, :status => :unprocessable_entity }\n end\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @club.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @beer_club = BeerClub.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @beer_club }\n end\n end", "def new\n @nightclub = Nightclub.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nightclub }\n end\n end", "def club_params\n params.require(:club).permit(\n :name, :short_name, :description,\n :cover_image, :remove_cover_image, :logo, :remove_logo, :recording_area\n )\n end", "def update\n @club = Club.find(params[:id])\n\n if @club.update_attributes(params[:club])\n head :no_content\n else\n render json: @club.errors, status: :unprocessable_entity\n end\n end", "def show\n @club = Club.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @club }\n end\n end", "def tennis_club_params\n params.require(:tennis_club).permit(:city_id, :name, :phone_number, :address)\n end", "def create\n @team = @club.teams.build(params[:team])\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to club_path(@club), notice: 'Mannschaft wurde erstellt. (though in html)' }\n format.json { render json: @team, status: :created, location: @team }\n format.js\n else\n format.html { render action: \"new\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end", "def create\n @club = Club.new(club_params)\n \n respond_to do |format|\n if @club.save\n @club.users.push(User.find_by(email: @club.captain_email))\n @club.rolls.find_by(user_id: User.find_by(email: @club.captain_email).id).update(relation: \"captain\")\n \n \n format.html { redirect_to @club, notice: 'Club was successfully created.' }\n format.json { render :show, status: :created, location: @club }\n else\n format.html { render :new }\n format.json { render json: @club.errors, status: :unprocessable_entity }\n end\n end\n end", "def club_params\n params.require(:club).permit(:name, :webLink, :registrationNumber, :description, :banner, :image, :image2, :image3)\n end", "def recipe_club_params\n params.require(:recipe_club).permit(:name)\n end", "def create\n @membership = Membership.new(params[:membership])\n @membership.member = current_member\n\n respond_to do |format|\n if @membership.save\n format.html { redirect_to sub_clubs_path, :notice => 'You requested membership.' }\n format.json { render :json => @membership, :status => :created, :location => @membership }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @membership.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @club = Club.find_by_slug(params[:club_id])\n @team = @club.teams.new\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end", "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", "def club_params\n params.require(:club).permit(:title, :desc, :time, :location, :pay, :image, :captain_email)\n end", "def destroy\n @club.destroy\n respond_to do |format|\n format.html { redirect_to clubs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @club.destroy\n respond_to do |format|\n format.html { redirect_to clubs_url }\n format.json { head :no_content }\n end\n end", "def set_club\n\n @club = Club.find(params[:id])\n\n end", "def create\n @club_award = ClubAward.new(club_award_params)\n\n respond_to do |format|\n if @club_award.save\n format.html { redirect_to @club_award, notice: 'Record was successfully created.' }\n format.json { render :show, status: :created, location: @club_award }\n else\n format.html { render :new }\n format.json { render json: @club_award.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @club = Club.find(params[:id])\n @club.destroy\n\n respond_to do |format|\n format.html { redirect_to clubs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @club = Club.find(params[:id])\n @club.destroy\n\n respond_to do |format|\n format.html { redirect_to clubs_url }\n format.json { head :no_content }\n end\n end", "def club_params\n params.require(:club).permit(:Name, :admin, :numberOfMembers, :category)\n end", "def set_club\n @club = Club.find(params[:id])\n end", "def set_club\n @club = Club.find(params[:id])\n end", "def set_club\n @club = Club.find(params[:id])\n end", "def set_club\n @club = Club.find(params[:id])\n end", "def set_club\n @club = Club.find(params[:id])\n end", "def set_club\n @club = Club.find(params[:id])\n end", "def set_club\n @club = Club.find(params[:id])\n end", "def set_club\n @club = Club.find(params[:id])\n end", "def set_club\n @club = Club.find(params[:id])\n end", "def set_club\n @club = Club.find(params[:id])\n end", "def set_club\n @club = Club.find(params[:id])\n end", "def create\n\n @club = Club.new(club_params)\n if (@club.active == true and current_user.has_role? :admin)\n @club.active = true\n else\n @club.active = false\n end\n if (current_user.has_role? :admin)\n #@club.user = club_params.user <- so wars vorher thorsten\n @club.user = User.find( club_params[:user_id])\n else\n @club.user = current_user\n end\n\n\n respond_to { |format|\n if @club.save\n\n format.html { redirect_to @club, notice: \"Club was successfully created.\" }\n format.json { render :show, status: :created, location: @club }\n else\n format.html { render :new }\n format.json { render json: @club.errors, status: :unprocessable_entity }\n end\n }\n end", "def update\n @club = Club.find(params[:id])\n @club.update_attributes(club_params)\n respond_with @club\n end", "def index\n @teams = @club.teams\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @teams }\n end\n end", "def clubs\n \t@title = \"My Clubs\"\n \t@clubs = Student.find(params[:id]).clubs\n \trender 'show_clubs'\n end", "def destroy\n @club.destroy\n respond_to do |format|\n format.html { redirect_to clubs_url }\n format.json { head :no_content }\n end\n\n end", "def create\n @club = Club.new(club_params)\n # valores default\n @club.active = true\n @club.association_id = Association.find_by( :user_id => current_user.id ).id\n\n if @club.email.present? and @club.email.length > 5\n @user = User.new(name: @club.name,\n email: @club.email,\n password: @club.email,\n password_confirmation: @club.email,\n tipo: 3 )\n end\n\n respond_to do |format|\n if @club.email.present? and @club.email.length > 5\n if @user.save\n @club.user_id = @user.id\n # os admins nao podem criar clubes, apenas as proprias associações\n # NOTA CSH: numa versao onde os admins possam criar clubes para poder transitar de uma associação para outra p.ex. tem de ser alterado\n\n if @club.save\n format.html { redirect_to @club, notice: 'O clube foi criado com sucesso.' }\n format.json { render action: 'show', status: :created, location: @club }\n else\n @user.destroy\n format.html { render action: 'new' }\n format.json { render json: @club.errors, status: :unprocessable_entity }\n end\n else\n # logger.debug @user.errors.to_yaml\n format.html { render action: 'new' }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n else\n if @club.save\n format.html { redirect_to @club, notice: 'O clube foi criado com sucesso.' }\n format.json { render action: 'show', status: :created, location: @club }\n else\n format.html { render action: 'new' }\n format.json { render json: @club.errors, status: :unprocessable_entity }\n end\n end\n\n end\n end", "def destroy\n @club.destroy\n respond_to do |format|\n format.html { redirect_to clubs_url, notice: 'Club was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @club.destroy\n respond_to do |format|\n format.html { redirect_to clubs_url, notice: 'Club was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @club.destroy\n respond_to do |format|\n format.html { redirect_to clubs_url, notice: 'Club was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def club_membership_params\n params.require(:club_membership).permit(:user_id, :club_id, :status)\n end", "def create\n @list = List.new(params[:list])\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to club_path(@list.club_id), notice: 'List was successfully created.' }\n format.json { head :no_content }\n else\n format.html { render action: \"new\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @club.update(club_params)\n format.html { redirect_to @club, notice: \"Club was successfully updated.\" }\n format.json { render :show, status: :ok, location: @club }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @club.errors, status: :unprocessable_entity }\n end\n end\n end", "def tea_club_params\n params.require(:tea_club).permit(:name, :founded, :city)\n end", "def join\n @club = Club.find(params[:id])\n authorize @club\n @club.club_memberships.create! user_id: current_user.id\n redirect_to action: :show\n end", "def destroy\n @club = Club.find(params[:id])\n @club.destroy\n\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :no_content }\n end\n end", "def create\n begin\n @course = Course.new(params[:course])\n @course.club = @club\n \n respond_to do |format|\n if @course.save\n format.html { redirect_to club_course_path(@club, @course)}\n format.json { render json: @course, status: :created, location: @course }\n else\n format.html { render action: \"new\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n rescue\n render :layout => 'error', :template => 'errors/error'\n end\n end" ]
[ "0.8054806", "0.7774694", "0.76952463", "0.7686164", "0.7630623", "0.7630623", "0.73835504", "0.73758984", "0.7167092", "0.7161889", "0.7137184", "0.7117601", "0.7095895", "0.70014334", "0.69563246", "0.6934114", "0.6888747", "0.6851928", "0.68437815", "0.6838768", "0.6835147", "0.6812038", "0.6761038", "0.67468435", "0.6732181", "0.67233944", "0.67171013", "0.66807455", "0.664738", "0.65809643", "0.65778077", "0.6521509", "0.6506619", "0.64982945", "0.6497536", "0.649517", "0.6488706", "0.6463926", "0.6462549", "0.64209545", "0.64055604", "0.6381615", "0.6345969", "0.6345969", "0.6345969", "0.63349324", "0.63286626", "0.6323425", "0.6299946", "0.62899214", "0.62755305", "0.62734914", "0.62717265", "0.6258494", "0.6253406", "0.6235634", "0.6223623", "0.62196183", "0.6217021", "0.62049484", "0.6202621", "0.6192993", "0.6172298", "0.6164792", "0.6157444", "0.61562586", "0.6153395", "0.6153395", "0.6141491", "0.61329067", "0.6129991", "0.6129991", "0.6125137", "0.6121457", "0.6121457", "0.6121457", "0.6121457", "0.6121457", "0.6121457", "0.6121457", "0.6121457", "0.6121457", "0.6121457", "0.6121457", "0.6100791", "0.60961425", "0.6095887", "0.60901564", "0.60859674", "0.60677963", "0.60362405", "0.60362405", "0.60362405", "0.6035958", "0.6033796", "0.60270345", "0.6017199", "0.60115886", "0.60054487", "0.600192" ]
0.6653323
28
PUT /clubs/1 PUT /clubs/1.json
def update @club = Club.find(params[:id]) if @club.update_attributes(params[:club]) redirect_to root_path, notice: t('club.update') else render :edit end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @club = Club.find(params[:id])\n\n if @club.update_attributes(params[:club])\n head :no_content\n else\n render json: @club.errors, status: :unprocessable_entity\n end\n end", "def update\n @club = Club.find(params[:id])\n\n respond_to do |format|\n if @club.update_attributes(params[:club])\n format.html { redirect_to @club, notice: 'Club was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @club.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @club = Club.find(params[:id])\n @club.update_attributes(club_params)\n respond_with @club\n end", "def update\n @club = Club.find(params[:id])\n\n respond_to do |format|\n if @club.update_attributes(params[:club])\n format.html { redirect_to @club, :notice => 'Club was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @club.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\t\tif @club.update(club_params)\n\t \t\thead :no_content\n\t \telse\n\t \trender json: @club.errors, status: :unprocessable_entity\n\t \tend\n\tend", "def update\n respond_to do |format|\n if @club.update(club_params)\n format.html { redirect_to @club, notice: \"Club was successfully updated.\" }\n format.json { render :show, status: :ok, location: @club }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @club.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @club.update(club_params)\n format.html { redirect_to @club, notice: 'Club was successfully updated.' }\n format.json { render :show, status: :ok, location: @club }\n else\n format.html { render :edit }\n format.json { render json: @club.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @club.update(club_params)\n format.html { redirect_to @club, notice: 'Club was successfully updated.' }\n format.json { render :show, status: :ok, location: @club }\n else\n format.html { render :edit }\n format.json { render json: @club.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @club.update(club_params)\n format.html { redirect_to @club, notice: 'Club was successfully updated.' }\n format.json { render :show, status: :ok, location: @club }\n else\n format.html { render :edit }\n format.json { render json: @club.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @club.update(club_params)\n format.html { redirect_to @club, notice: 'Club was successfully updated.' }\n format.json { render :show, status: :ok, location: @club }\n else\n format.html { render :edit }\n format.json { render json: @club.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @club.update(club_params)\n format.html { redirect_to @club, notice: 'Club was successfully updated.' }\n format.json { render :show, status: :ok, location: @club }\n else\n format.html { render :edit }\n format.json { render json: @club.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @club.update(club_params)\n format.html { redirect_to @club, notice: 'Club was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @club.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @club.update(club_params)\n format.html { redirect_to @club, notice: 'Club was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @club.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @club = Club.find(params[:id])\n authorize @club\n respond_to do |format|\n if @club.update(club_params)\n format.html { redirect_to @club, notice: 'Club was successfully updated.' }\n format.json { render :show, status: :ok, location: @club }\n else\n format.html { render :edit }\n format.json { render json: @club.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_club\n\n @club = Club.find(params[:id])\n\n end", "def update\n\n #authorize!(:update, @club)\n respond_to do |format|\n if @club.update(club_params)\n format.html { redirect_to clubs_path, notice: 'Club was successfully updated.' }\n format.json { render :index, status: :ok, location: @club }\n else\n format.html { render :edit }\n format.json { render json: @club.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @club = Club.find(params[:id])\n\n respond_to do |format|\n if @club.update_attributes(params[:club])\n format.html { redirect_to(@club, :notice => 'Club was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @club.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_club\n @club = Club.find(params[:id])\n end", "def set_club\n @club = Club.find(params[:id])\n end", "def set_club\n @club = Club.find(params[:id])\n end", "def set_club\n @club = Club.find(params[:id])\n end", "def set_club\n @club = Club.find(params[:id])\n end", "def set_club\n @club = Club.find(params[:id])\n end", "def set_club\n @club = Club.find(params[:id])\n end", "def set_club\n @club = Club.find(params[:id])\n end", "def set_club\n @club = Club.find(params[:id])\n end", "def set_club\n @club = Club.find(params[:id])\n end", "def set_club\n @club = Club.find(params[:id])\n end", "def create\n @club = Club.new(params[:club])\n\n if @club.save\n render json: @club, status: :created, location: @club\n else\n render json: @club.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @club_update.update(club_update_params)\n format.html { redirect_to @club_update, notice: 'Club update was successfully updated.' }\n format.json { render :show, status: :ok, location: @club_update }\n else\n format.html { render :edit }\n format.json { render json: @club_update.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_club\n\t\t\t@club = Club.find(params[:id])\n\t\tend", "def update\n respond_to do |format|\n if @club.update(club_params)\n format.html { redirect_to @club, notice: 'Circolo aggiornato con successo.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @club.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @club2.update(club2_params)\n format.html { redirect_to @club2, notice: 'Club2 was successfully updated.' }\n format.json { render :show, status: :ok, location: @club2 }\n else\n format.html { render :edit }\n format.json { render json: @club2.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_club_update\n @club_update = ClubUpdate.find(params[:id])\n end", "def update\n respond_to do |format|\n if @admin_update_club.update(admin_update_club_params)\n format.html { redirect_to @admin_update_club, notice: 'Club was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_update_club }\n else\n format.html { render :edit }\n format.json { render json: @admin_update_club.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tennis_club.update(tennis_club_params)\n format.html { redirect_to @tennis_club, notice: 'Tennis club was successfully updated.' }\n format.json { render :show, status: :ok, location: @tennis_club }\n else\n format.html { render :edit }\n format.json { render json: @tennis_club.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_club_info\n @club_info = ClubInfo.find(params[:id])\n end", "def show\n @club = Club.find(params[:id])\n\n render json: @club\n end", "def update\n @club = Club.find_by_slug(params[:club_id])\n @team = @club.teams.find_by_name(params[:id].upcase)\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to([@club, @team], :notice => 'Team was successfully updated.') }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end", "def update\n respond_to do |format|\n if @club_type.update(club_type_params)\n format.html { redirect_to @club_type, notice: 'Club type was successfully updated.' }\n format.json { render :show, status: :ok, location: @club_type }\n else\n format.html { render :edit }\n format.json { render json: @club_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @club = Club.new(club_params)\n\n respond_to do |format|\n if @club.save\n format.html { redirect_to @club, notice: 'Club was successfully created.' }\n format.json { render :show, status: :created, location: @club }\n else\n format.html { render :new }\n format.json { render json: @club.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @club = Club.new(club_params)\n\n respond_to do |format|\n if @club.save\n format.html { redirect_to @club, notice: \"Club was successfully created.\" }\n format.json { render :show, status: :created, location: @club }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @club.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @club = Club.find(params[:id])\n\n params.each do |key, value|\n if (key.to_s[/adduser.*/])\n #if param[key].blank?\n # @object.errors.add_to_base(\"All new user fields are required.\")\n #end\n #debugger\n @user = User.new\n #clean_up_passwords @user\n @user.update_attribute(:email,params[key])\n @user.update_attribute(:club_id,params[:id])\n @user.save\n #@user.send_confirmation_instructions\n end\n end\n\n respond_to do |format|\n if @club.update_attributes(params[:club])\n format.html { redirect_to @club, notice: 'Club was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @club.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @beer_club = BeerClub.find(params[:id])\n respond_to do |format|\n if @beer_club.update_attributes(params[:beer_club])\n format.html { redirect_to @beer_club, notice: 'Beer club was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @beer_club.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @beer_club = BeerClub.find(params[:id])\n\n respond_to do |format|\n if @beer_club.update_attributes(params[:beer_club])\n format.html { redirect_to @beer_club, notice: 'Beer club was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @beer_club.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @admin_update_club = Admin::Update::Club.new(admin_update_club_params)\n\n respond_to do |format|\n if @admin_update_club.save\n format.html { redirect_to @admin_update_club, notice: 'Club was successfully created.' }\n format.json { render :show, status: :created, location: @admin_update_club }\n else\n format.html { render :new }\n format.json { render json: @admin_update_club.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n \n @club = Club.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @club }\n end\n\n \n end", "def set_club\n @club = Club.find(params[:id])\n @place = Place.find(@club.place_id)\n #devolve-nos a relacao que contem todos os UserClubs correspondentes ao clube com id = @club.id\n @users_clubs = UserClub.where(\"club_id = #{params[:id]}\")\n end", "def create\n @club = Club.new(club_params)\n\n respond_to do |format|\n if @club.save\n format.html { redirect_to @club, notice: 'Club was successfully created.' }\n format.json { render action: 'show', status: :created, location: @club }\n else\n format.html { render action: 'new' }\n format.json { render json: @club.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @club = Club.new(club_params)\n\n respond_to do |format|\n if @club.save\n format.html { redirect_to @club, notice: 'Club was successfully created.' }\n format.json { render action: 'show', status: :created, location: @club }\n else\n format.html { render action: 'new' }\n format.json { render json: @club.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @club_update = ClubUpdate.new(club_update_params)\n\n respond_to do |format|\n if @club_update.save\n format.html { redirect_to @club_update, notice: 'Club update was successfully created.' }\n format.json { render :show, status: :created, location: @club_update }\n else\n format.html { render :new }\n format.json { render json: @club_update.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @club_path = ClubPath.find(params[:id])\n\n respond_to do |format|\n if @club_path.update_attributes(params[:club_path])\n format.html { redirect_to @club_path, notice: 'Club path was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @club_path.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@club = Club.new(club_params)\n\n\t\tif @club.save\n\t\t \trender json: @club, status: :created\n\t\telse\n\t\t \trender json: @club.errors, status: :unprocessable_entity\n\t\tend\n\tend", "def update\n respond_to do |format|\n if @tea_club.update(tea_club_params)\n format.html { redirect_to @tea_club, notice: 'Tea club was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tea_club.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @clubuser.update(clubuser_params)\n format.html { redirect_to @clubuser, notice: 'Clubuser was successfully updated.' }\n format.json { render :show, status: :ok, location: @clubuser }\n else\n format.html { render :edit }\n format.json { render json: @clubuser.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_club2\n @club2 = Club2.find(params[:id])\n end", "def update\n @nightclub = Nightclub.find(params[:id])\n\n respond_to do |format|\n if @nightclub.update_attributes(params[:nightclub])\n format.html { redirect_to @nightclub, notice: 'Nightclub was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @nightclub.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @wine_club.update(wine_club_params)\n format.html { redirect_to @wine_club, notice: 'Wine club was successfully updated.' }\n format.json { render :show, status: :ok, location: @wine_club }\n else\n format.html { render :edit }\n format.json { render json: @wine_club.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @club = Club.new(club_params)\n @club.save\n respond_with @club\n end", "def set_recipe_club\n @recipe_club = RecipeClub.find(params[:id])\n end", "def update\n @team = @club.teams.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to club_path(@club), notice: 'Mannschaft wurde aktualisiert.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @club = Club.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @club }\n end\n end", "def index\n @clubs = Club.all\n render json: @clubs\n end", "def destroy\n @club = Club.find(params[:id])\n @club.destroy\n\n respond_to do |format|\n format.html { redirect_to clubs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @club = Club.find(params[:id])\n @club.destroy\n\n respond_to do |format|\n format.html { redirect_to clubs_url }\n format.json { head :no_content }\n end\n end", "def club_params\n params.require(:club).permit(:club_type, :name, :members, :description, :sport, :place_id)\n end", "def create\n @club = Club.new(club_params)\n\n respond_to do |format|\n if @club.save\n format.html { redirect_to @club, notice: 'Circolo creato con successo.' }\n format.json { render action: 'show', status: :created, location: @club }\n else\n format.html { render action: 'new' }\n format.json { render json: @club.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_clubuser\n @clubuser = Clubusers.find(params[:id])\n end", "def set_tennis_club\n @tennis_club = TennisClub.find(params[:id])\n end", "def update\n respond_to do |format|\n if @nightclub.update(nightclub_params)\n format.html { redirect_to @nightclub, notice: 'Nightclub was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @nightclub.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_club_type\n @club_type = ClubType.find(params[:id])\n end", "def show\n\n #params[:id] = @current_user.club_id\n @club = Club.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @club }\n end\n end", "def destroy\n @club = Club.find(params[:id])\n @club.destroy\n\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :no_content }\n end\n end", "def create\n @admin_club = Admin::Club.new(admin_club_params)\n\n respond_to do |format|\n if @admin_club.save\n format.html { redirect_to @admin_club, notice: 'Club was successfully created.' }\n format.json { render :show, status: :created, location: @admin_club }\n else\n format.html { render :new }\n format.json { render json: @admin_club.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n authorize Club\n @club = Club.new(club_params)\n @club.owner = current_user\n @club.users << current_user\n respond_to do |format|\n if @club.save\n format.html { redirect_to @club, notice: 'Club was successfully created.' }\n format.json { render :show, status: :created, location: @club }\n else\n format.html { render :new }\n format.json { render json: @club.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_club_student\n @club_student = ClubStudent.find(params[:id])\n end", "def club_params\n params.require(:club).permit(:name, :contact_officer, :date_created)\n end", "def update\n respond_to do |format|\n if @club_student.update(club_student_params)\n format.html { redirect_to @club_student, notice: 'Club student was successfully updated.' }\n format.json { render :show, status: :ok, location: @club_student }\n else\n format.html { render :edit }\n format.json { render json: @club_student.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_wine_club\n @wine_club = WineClub.find(params[:id])\n end", "def club_params\n # @user_id = current_user.id\n params.require(:club).permit(:club_name, :club_email, :club_brief, :found_time)\n end", "def club_params\n params.require(:club).permit(:name, :room_name)\n end", "def destroy\n @club = Club.find(params[:id])\n @club.destroy\n respond_to do |format|\n format.html { redirect_to clubs_url, notice: 'Club was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def update\n respond_to do |format|\n if @stripclub.update(stripclub_params)\n format.html { redirect_to @stripclub, notice: 'Stripclub was successfully updated.' }\n format.json { render :show, status: :ok, location: @stripclub }\n else\n format.html { render :edit }\n format.json { render json: @stripclub.errors, status: :unprocessable_entity }\n end\n end\n end", "def club_params\n params.require(:club).permit(:name, :short_name, :address, :postal4, :postal3, :city, :phone, :email, :president, :url, :municipality_id)\n end", "def set_nightclub\n @nightclub = Nightclub.find(params[:id])\n end", "def create\n @club2 = Club2.new(club2_params)\n\n respond_to do |format|\n if @club2.save\n format.html { redirect_to @club2, notice: 'Club2 was successfully created.' }\n format.json { render :show, status: :created, location: @club2 }\n else\n format.html { render :new }\n format.json { render json: @club2.errors, status: :unprocessable_entity }\n end\n end\n end", "def club_update_params\n params.require(:club_update).permit(:content, :title)\n end", "def club_params\n\t\t\tparams.require(:club).permit(:name, :contact_officer, :date_created)\n\t\tend", "def destroy\n @club = Club.find(params[:id])\n @club.destroy\n respond_with @club\n end", "def club_params\n params.require(:club).permit(\n :name, :short_name, :description,\n :cover_image, :remove_cover_image, :logo, :remove_logo, :recording_area\n )\n end", "def update\n \n if params[:destroy_logo] == \"1\"\n @admin_club.logo = nil\n end\n\n if params[:destroy_banner] == \"1\"\n @admin_club.banner = nil\n end\n\n\n respond_to do |format|\n if @admin_club.update(admin_club_params)\n format.html { redirect_to @admin_club, notice: 'Club was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_club }\n else\n format.html { render :edit }\n format.json { render json: @admin_club.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @clubs = Club.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clubs }\n end\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @club.destroy\n respond_to do |format|\n format.html { redirect_to clubs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @club.destroy\n respond_to do |format|\n format.html { redirect_to clubs_url }\n format.json { head :no_content }\n end\n end", "def clubs\n \t@title = \"My Clubs\"\n \t@clubs = Student.find(params[:id]).clubs\n \trender 'show_clubs'\n end", "def destroy\n\t\t@club = Club.find(params[:id])\n\t\t@club.destroy\n\n\t\trespond_to do |format|\n\t\t format.html { redirect_to(clubs_url) }\n\t\t format.xml { head :ok }\n\t\tend\n\tend", "def update\n club = ::Posts::Club.with_user(@user)\n authorize! :update, club\n if club.update_attributes(data_params)\n render_update_success club\n else\n render_failure club\n end\n end", "def set_admin_club\n @admin_club = Admin::Club.find(params[:id])\n end", "def destroy\n @club.destroy\n respond_to do |format|\n format.html { redirect_to clubs_url }\n format.json { head :no_content }\n end\n\n end" ]
[ "0.7922199", "0.7666208", "0.7636222", "0.7607505", "0.74574715", "0.7454791", "0.7451092", "0.7451092", "0.7451092", "0.7451092", "0.7451092", "0.7314734", "0.7314734", "0.7270194", "0.72480816", "0.7220248", "0.72081", "0.7191481", "0.7191481", "0.7191481", "0.7191481", "0.7191481", "0.7191481", "0.7191481", "0.7191481", "0.7191481", "0.7191481", "0.7191481", "0.7021457", "0.6988322", "0.6944569", "0.69393617", "0.6924945", "0.6906021", "0.6902272", "0.6845915", "0.6813648", "0.6744468", "0.67286354", "0.6685256", "0.66769636", "0.6676842", "0.66752744", "0.66706675", "0.6668723", "0.66662425", "0.66646713", "0.6654043", "0.6649138", "0.6649138", "0.66168267", "0.6601643", "0.66012514", "0.65942657", "0.65638757", "0.6561266", "0.655572", "0.6473657", "0.64695704", "0.6456225", "0.6454482", "0.64471644", "0.6425739", "0.6395481", "0.6395481", "0.6381773", "0.63531554", "0.63407177", "0.6312268", "0.63081324", "0.6302095", "0.62974596", "0.6297433", "0.62932223", "0.6274386", "0.6255486", "0.62525976", "0.6247001", "0.6245182", "0.62422144", "0.62316716", "0.6231588", "0.6205157", "0.620145", "0.6194681", "0.6179038", "0.6172396", "0.61576355", "0.61522394", "0.61428195", "0.61396277", "0.6138205", "0.6121579", "0.6111599", "0.6111599", "0.60971826", "0.60927844", "0.60788697", "0.60746884", "0.6067268" ]
0.70552456
28
DELETE /clubs/1 DELETE /clubs/1.json
def destroy @club = Club.find(params[:id]) @club.destroy respond_to do |format| format.html { redirect_to root_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @club = Club.find(params[:id])\n @club.destroy\n\n respond_to do |format|\n format.html { redirect_to clubs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @club = Club.find(params[:id])\n @club.destroy\n\n respond_to do |format|\n format.html { redirect_to clubs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @club.destroy\n respond_to do |format|\n format.html { redirect_to clubs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @club.destroy\n respond_to do |format|\n format.html { redirect_to clubs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @club.destroy\n respond_to do |format|\n format.html { redirect_to clubs_url }\n format.json { head :no_content }\n end\n\n end", "def destroy\n @club = Club.find(params[:id])\n @club.destroy\n respond_to do |format|\n format.html { redirect_to clubs_url, notice: 'Club was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @club = Club.find(params[:id])\n @club.destroy\n\n head :no_content\n end", "def destroy\n @club_path = ClubPath.find(params[:id])\n @club_path.destroy\n\n respond_to do |format|\n format.html { redirect_to club_paths_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @club.destroy\n respond_to do |format|\n format.html { redirect_to clubs_url, notice: 'Club was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @club.destroy\n respond_to do |format|\n format.html { redirect_to clubs_url, notice: 'Club was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @club.destroy\n respond_to do |format|\n format.html { redirect_to clubs_url, notice: 'Club was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @club.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: \"Club was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @club = Club.find(params[:id])\n @club.destroy\n\n respond_to do |format|\n format.html { redirect_to(clubs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @club = Club.find(params[:id])\n @club.destroy\n respond_with @club\n end", "def destroy\n @club.destroy\n respond_to do |format|\n flash[:notice] = 'Clube foi apagado com sucesso.'\n format.html { redirect_to clubs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tea_club.destroy\n respond_to do |format|\n format.html { redirect_to tea_clubs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @club = Club.find(params[:id])\n authorize @club\n @club.destroy\n respond_to do |format|\n format.html { redirect_to clubs_url, notice: 'Club was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @nightclub = Nightclub.find(params[:id])\n @nightclub.destroy\n\n respond_to do |format|\n format.html { redirect_to nightclubs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n\t\t@club = Club.find(params[:id])\n\t\t@club.destroy\n\n\t\trespond_to do |format|\n\t\t format.html { redirect_to(clubs_url) }\n\t\t format.xml { head :ok }\n\t\tend\n\tend", "def destroy\n @beer_club = BeerClub.find(params[:id])\n @beer_club.destroy\n\n respond_to do |format|\n format.html { redirect_to beer_clubs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @beer_club = BeerClub.find(params[:id])\n @beer_club.destroy\n\n respond_to do |format|\n format.html { redirect_to beer_clubs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @club2.destroy\n respond_to do |format|\n format.html { redirect_to club2s_url, notice: 'Club2 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @nightclub.destroy\n respond_to do |format|\n format.html { redirect_to nightclubs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_club.destroy\n respond_to do |format|\n format.html { redirect_to admin_clubs_url, notice: 'Club was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @club.address.destroy if @club.address.present?\n @club.events.destroy_all if @club.events.present?\n @club.destroy\n respond_to do |format|\n format.html { redirect_to clubs_url, notice: 'Club was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_update_club.destroy\n respond_to do |format|\n format.html { redirect_to admin_update_clubs_url, notice: 'Club was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @club_update.destroy\n respond_to do |format|\n format.html { redirect_to club_updates_url, notice: 'Club update was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n\t\t@club.destroy\n\t\t\n\t\thead :no_content\n\tend", "def destroy\n @club_type.destroy\n respond_to do |format|\n format.html { redirect_to club_types_url, notice: 'Club type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tennis_club.destroy\n respond_to do |format|\n format.html { redirect_to tennis_clubs_url, notice: 'Tennis club was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @team = @club.teams.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to club_teams_url(@club.id) }\n format.json { head :no_content }\n end\n end", "def destroy\n @clubuser.destroy\n respond_to do |format|\n format.html { redirect_to clubusers_url, notice: 'Clubuser was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n club_id = @membership.beer_club.id\n @membership.destroy\n respond_to do |format|\n format.html { redirect_to beer_club_path(club_id), notice: 'You are no longer a member of this club' }\n format.json { head :no_content }\n end\n end", "def destroy\n @stripclub.destroy\n respond_to do |format|\n format.html { redirect_to stripclubs_url, notice: 'Stripclub was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @club_award.destroy\n respond_to do |format|\n format.html { redirect_to club_awards_url, notice: 'Club award was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @club_student.destroy\n respond_to do |format|\n format.html { redirect_to club_students_url, notice: 'Club student was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n if is_club_current_admin?(@club.id)\n @club.destroy\n respond_to do |format|\n format.html { redirect_to clubs_url, notice: 'Club was successfully destroyed.' }\n format.json { head :no_content }\n end\n end\nelse\n flash[:error] = \"You cannot delete a club you did not create\"\n end", "def destroy\n # @athlete.destroy\n @athlete.active = false;\n @athlete.save;\n respond_to do |format|\n if params[ :clubdetail ]\n format.html { redirect_to club_url( @athlete.club_id ) }\n else\n format.html { redirect_to athletes_url }\n end\n format.json { head :no_content }\n end\n end", "def destroy\n @clonet = Clonet.find(params[:id])\n @clonet.destroy\n\n respond_to do |format|\n format.html { redirect_to clonets_url }\n format.json { head :no_content }\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @clue = Clue.find(params[:id])\n @clue.destroy\n\n respond_to do |format|\n format.html { redirect_to clues_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @clue = Clue.find(params[:id])\n @clue.destroy\n\n respond_to do |format|\n format.html { redirect_to clues_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @climb = Climb.find(params[:id])\n @climb.destroy\n\n respond_to do |format|\n format.html { redirect_to climbs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cubboard.destroy\n respond_to do |format|\n format.html { redirect_to cubboards_url, notice: \"Cubboard was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to club_path(@event.club_id), notice: 'Event was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @committeemember = Committeemember.find(params[:id])\n @committeemember.destroy\n\n respond_to do |format|\n format.html { redirect_to(club_committees_path(params[:club_id])) }\n format.xml { head :ok }\n end\n end", "def destroy\n @absence = Absence.find(params[:id])\n @absence.destroy\n\n respond_to do |format|\n format.html { redirect_to club_member_absences_path(params[:club_id],current_member) }\n format.json { head :ok }\n end\n end", "def destroy\n @brewhouse = Brewhouse.find(params[:id])\n @brewhouse.destroy\n\n respond_to do |format|\n format.html { redirect_to brewhouses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @climb.destroy\n respond_to do |format|\n format.html { redirect_to climbs_url, notice: 'Climb was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n name = @bowler.full_name\n @bowler.record :destroy, current_user, selected_tournament\n @bowler.destroy\n respond_to do |format|\n format.html { redirect_to bowlers_url, notice: \"Bowler #{name} has been successfully deleted.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @championship = Championship.find(params[:id])\n @championship.destroy\n\n respond_to do |format|\n format.html { redirect_to championships_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @code_club_school.destroy\n respond_to do |format|\n format.html { redirect_to code_club_schools_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @albumsix.destroy\n respond_to do |format|\n format.html { redirect_to albumsixes_url, notice: 'Albumsix was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def soccer_delete\n base_delete(params, \"Soccer\")\n end", "def destroy\n @golf_cource = GolfCource.find(params[:id])\n @golf_cource.destroy\n\n respond_to do |format|\n format.html { redirect_to scaffold_golf_cources_url }\n format.json { head :ok }\n end\n end", "def destroy\n @boy = Boy.find(params[:id])\n @boy.destroy\n\n respond_to do |format|\n format.html { redirect_to boys_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @boy = Boy.find(params[:id])\n @boy.destroy\n\n respond_to do |format|\n format.html { redirect_to boys_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cocktail = Cocktail.find(params[:id])\n @cocktail.destroy\n\n respond_to do |format|\n format.html { redirect_to cocktails_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cocktail = Cocktail.find(params[:id])\n @cocktail.destroy\n\n respond_to do |format|\n format.html { redirect_to cocktails_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @scribble = Scribble.find(params[:id])\n @scribble.destroy\n\n respond_to do |format|\n format.html { redirect_to scribbles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @scribble = Scribble.find(params[:id])\n @scribble.destroy\n\n respond_to do |format|\n format.html { redirect_to scribbles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @scribble = Scribble.find(params[:id])\n @scribble.destroy\n\n respond_to do |format|\n format.html { redirect_to scribbles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bustour.destroy\n respond_to do |format|\n format.html { redirect_to bustours_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bow.destroy\n respond_to do |format|\n format.html { redirect_to bows_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cabinet = Cabinet.find(params[:id])\n @cabinet.destroy\n\n respond_to do |format|\n format.html { redirect_to cabinets_url }\n format.json { head :ok }\n end\n end", "def destroy\n @jugador = Jugador.find(params[:id])\n @jugador.destroy\n @clubes = Club.all\n @equipos = Equipo.all\n respond_to do |format|\n format.html { redirect_to jugadores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bourbon.destroy\n respond_to do |format|\n format.html { redirect_to bourbons_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @secubat_client = SecubatClient.find(params[:id])\n @secubat_client.destroy\n\n respond_to do |format|\n format.html { redirect_to secubat_clients_url }\n format.json { head :ok }\n end\n end", "def destroy\n @tournament.destroy\n respond_to do |format|\n format.html { redirect_to tournaments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tournament.destroy\n respond_to do |format|\n format.html { redirect_to tournaments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @clay.destroy\n respond_to do |format|\n format.html { redirect_to clays_url, notice: 'Clay was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @camp.destroy\n respond_to do |format|\n format.html { redirect_to camps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @crowd = Crowd.find(params[:id])\n @crowd.destroy\n\n respond_to do |format|\n format.html { redirect_to crowds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @couch.destroy\n respond_to do |format|\n format.html { redirect_to couches_url, notice: 'Couche was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @contest.destroy\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @slab = Slab.find(params[:id])\n @slab.destroy\n\n respond_to do |format|\n format.html { redirect_to slabs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @camp = Camp.find(params[:id])\n @camp.destroy\n\n respond_to do |format|\n format.html { redirect_to camps_url }\n format.json { head :ok }\n end\n end", "def destroy\n @climb_datum = ClimbDatum.find(params[:id])\n @climb_datum.destroy\n\n respond_to do |format|\n format.html { redirect_to climb_data_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @hood.destroy\n respond_to do |format|\n format.html { redirect_to hoods_url }\n format.json { head :no_content }\n end\n end", "def destroy\n if current_user.admin\n @wine_club.destroy\n respond_to do |format|\n format.html { redirect_to wine_clubs_url, notice: 'Wine club was successfully destroyed.' }\n format.json { head :no_content }\n end\n else\n redirect_to wine_club_url, notice: 'You do not have sufficient rights.'\n end\n end", "def destroy\n @camp = Camp.find(params[:id])\n @camp.destroy\n\n respond_to do |format|\n format.html { redirect_to camps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @livestock = Livestock.find(params[:id])\n @livestock.destroy\n\n respond_to do |format|\n format.html { redirect_to livestocks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bowl = Bowl.find(params[:id])\n @bowl.destroy\n\n respond_to do |format|\n format.html { redirect_to bowls_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tribal_membership.destroy\n respond_to do |format|\n format.html { redirect_to tribal_memberships_url }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize(Coach)\n @sport.destroy\n respond_to do |format|\n format.html { redirect_to sports_url, notice: 'Sport was successfully destroyed.' }\n format.json { head :no_content }\n end\n \n end", "def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :ok }\n end\n end", "def destroy\n @beast.destroy\n respond_to do |format|\n format.html { redirect_to beasts_url, notice: 'Bestia została usunięta' }\n format.json { head :no_content }\n end\n end", "def destroy\n @conference.destroy\n\n respond_to do |format|\n format.html { redirect_to [:admin, @sport] }\n format.json { head :no_content }\n end\n end", "def destroy\n @contractual_labour.destroy\n respond_to do |format|\n format.html { redirect_to contractual_labours_url, notice: 'Contractual labour was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @jam_circle.destroy\n respond_to do |format|\n format.html { redirect_to jam_circles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @six.destroy\n respond_to do |format|\n format.html { redirect_to sixes_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @sivic_banco.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_bancos_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @chronicle.destroy\n respond_to do |format|\n format.html { redirect_to chronicles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @court_hall.destroy\n respond_to do |format|\n format.html { redirect_to court_halls_url, notice: 'Court hall was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @my_studio_client = MyStudio::Client.find(params[:id])\n @my_studio_client.destroy\n\n respond_to do |format|\n format.html { redirect_to my_studio_clients_url }\n format.json { head :ok }\n end\n end" ]
[ "0.8125921", "0.8125921", "0.80589193", "0.80589193", "0.80283463", "0.7990399", "0.7949108", "0.79312074", "0.78865546", "0.78865546", "0.78865546", "0.78705937", "0.78516614", "0.77526957", "0.771957", "0.7699575", "0.7623334", "0.7608901", "0.7604228", "0.7587584", "0.7587584", "0.7580031", "0.7579375", "0.75684977", "0.75385565", "0.7516351", "0.7483231", "0.7481083", "0.7480546", "0.7438556", "0.73579013", "0.73148775", "0.71957695", "0.71912444", "0.70546234", "0.7046241", "0.69294477", "0.6904359", "0.69028914", "0.67841846", "0.6780219", "0.6780219", "0.6765001", "0.67038876", "0.66520154", "0.6651997", "0.66365486", "0.6623009", "0.6599313", "0.65989256", "0.6592137", "0.6588493", "0.65875113", "0.6586263", "0.65769774", "0.65714043", "0.6566615", "0.6566615", "0.6549712", "0.6549712", "0.6549381", "0.6549381", "0.6549381", "0.65430504", "0.6539699", "0.653578", "0.65334636", "0.6532834", "0.6527983", "0.65248406", "0.65248406", "0.6521043", "0.65117055", "0.6508574", "0.6488613", "0.64871156", "0.6486664", "0.64860076", "0.6484948", "0.6474856", "0.64665633", "0.6466178", "0.6454051", "0.6448062", "0.6448062", "0.6448062", "0.6448062", "0.64473987", "0.64461136", "0.6445364", "0.6441351", "0.64345556", "0.6434292", "0.6431812", "0.64309096", "0.64306766", "0.6428685", "0.6427913", "0.6425638", "0.6422564" ]
0.81467396
0
Array of all builds for the given project that have the status `pending`
def pending_builds(project: nil) not_implemented(__method__) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def active_projects\n self.projects.where(:is_canceled => false, :is_finished => false )\n end", "def pending_refund_payments_projects\n pending_refund_payments.map(&:project)\n end", "def pending_start_projects\n self.projects.where(:is_canceled => false, :is_started => false ).order(\"shoot_date ASC\")\n end", "def in_progress_build\n active_states = [\"deploying\", \"testing\", \"monitoring\", \"awaiting_confirmation\"]\n builds_dataset.reverse_order(:id).filter(:state => active_states).first\n end", "def listjobs(project=self.project)\n get('listjobs.json', project: project).reject{|k,v| k=='status'}\n end", "def all_by_exit_status(status)\n\ta = Array.new\n\t@taskchain.taskchain_array.each do |task|\n\t\ta << task if task.exit_status == status\n end\n return a\nend", "def get_pending\n Rutodo::Database::Todo.where(done: false).map(&:as_entity)\n end", "def get_pending_requests\n r = Request.where(:assigned => self , :done => false).to_a\n return r\n end", "def active\n projects.select { |project| !project.archived? }\n end", "def builds_for_project(name, num = 100)\n count = 0\n next_token = nil\n builds = []\n loop do\n r = client.list_builds_for_project(project_name: name, next_token: next_token)\n builds += r.ids\n break if (count += r.ids.count) >= num\n break if (next_token = r.next_token).nil?\n end\n builds.first(num)\n end", "def all_by_exit_status(status)\n\ta = Array.new\n\t@chain.taskchain_array.each do |task|\n\t\ta << task if task.exit_status == status\n end\n return a\nend", "def _pending_list\r\n\t\t\t# Author\r\n\t\t\treturn render json: { staus: 6 } if cannot? :manage, Project\r\n\r\n\t\t\tper = Rails.application.config.item_per_page\r\n\t\t\t\r\n\t\t\tparams[:page] ||= 1\r\n\t\t\tparams[:page] = params[:page].to_i\r\n\r\n\t\t\tps = Project.pending_search_with_params params\r\n\r\n\t\t\tcount = ps.count\r\n\r\n\t\t\treturn render json: { status: 1 } if count === 0\r\n\r\n\t\t\trender json: {\r\n\t\t\t\tstatus: 0,\r\n\t\t\t\tresult: {\r\n\t\t\t\t\tlist: render_to_string(partial: 'projects/pending_list', locals: { projects: ps.page(params[:page], per) }),\r\n\t\t\t\t\tpagination: render_to_string(partial: 'shared/pagination', locals: { total: count, per: per, page: params[:page] })\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\tend", "def all_deliverable_projects\n all_digest_projects\n end", "def get_pending_bucks\n\t\t\t jobcode = self.job_id\n\t\t\t approve_for = ::Department.where('bucks_approve1 = \\'' + jobcode + '\\' OR bucks_approve2 = \\'' + jobcode + '\\'')\n\t\t\t bucks = Array.new\n\t\t\t approve_for.each { |d| Buck.joins('INNER JOIN employees ON bucks_bucks.issuer_id = employees.IDnum WHERE employees.department_id = ' + d.id.to_s + ' AND bucks_bucks.status = \"Pending\"').each { |b| bucks.push(b) }}\n\t\t\t return bucks\n\t\t\t end", "def pending\r\n\t\t\t# Author\r\n\t\t\tauthorize! :manage, Project\r\n\r\n\t\t\t@projects = Project.pending_search_with_params interact: 'desc'\r\n\r\n\t\t\trender layout: 'layout_back'\r\n\t\tend", "def index\n @project_statuses = Project::Status.all\n end", "def orders_completed\n result = Array.new\n self.job_applications.each do |j|\n j.orders.each do |order|\n if !order.blank? and !order.workspace.blank?\n result << order if order.workspace.completed?\n end\n end\n end\n result\n end", "def all\n [ACTIVE, PENDING]\n end", "def list_all\n response_json = @client.api_get_request(\"/api/build\")\n\n return nil unless response_json\n\n response_json[\"builds\"].map do |build|\n {\n :name => build[\"uri\"].sub(/^\\//,''),\n :uri => build[\"uri\"],\n :lastStarted => build[\"lastStarted\"]\n }\n end.sort{ |x,y| x[:name] <=> y[:name]}\n\n end", "def projects_tracked\n timings = Timing.for_period_of_time(self.id, 1.month.ago, Time.now)\n if timings.present?\n timings.map(&:project_id).uniq\n else\n []\n end\n end", "def index\n @project_statuses = ProjectStatus.all\n end", "def orders_completed\n # TODO:\n # How about service ?\n result = Array.new\n self.jobs.unscoped.each do |j|\n j.orders.each do |o|\n if !o.workspace.blank?\n result << o if o.workspace.completed?\n end\n end\n end\n result\n end", "def list_by_status(status)\n\tProject.where('client_id = ? AND status = ?',self.id,status) \n\tend", "def filter_builds\n # Retrieve the build numbers from the latest poll\n build_nums = build_failures.flatten.map do |build_result|\n build_result['build_num']\n end\n # Remove the saved build numbers\n remainder = build_nums - existing_builds_numbers(build_nums)\n # Select the winners\n build_failures.select do |build_result|\n remainder.include?(build_result['build_num'])\n end\n end", "def latest_unpassing_jobs(project_id)\n latest_jobs(project_id).each_with_object([]) do |(branch, job_names), unpassing_jobs|\n job_names.each do |job_name, job|\n unpassing_jobs << job unless job['status'] == 'success'\n end\n end\nend", "def builds(filters = {})\n fetch_resources_lazily(\"builds\", filters)\n end", "def get_statuses\n\t\t# scrape the statuses web page (more convenient than looking up an API)\n\t\t\n\t\turl = CONFIG[\"statuses URL\"]\n\t\tdoc = Nokogiri::HTML( open(url) )\n\t\tprojects = doc.css('.project')\n\t\t\n\t\tproject_statuses = projects.map do |project|\n\t\t\t{\n\t\t\t\tid_num: begin\n\t\t\t\t\tid = project.attr('id') #=> \"project_6\"\n\t\t\t\t\tid.match(/\\d+/).to_s.to_i\n\t\t\t\tend,\n\t\t\t\tname: begin\n\t\t\t\t\tproject.at_css('h3 a').content.strip\n\t\t\t\tend,\n\t\t\t\tbuild_status: begin\n\t\t\t\t\tclasses = project.attr('class').split #=> \"status_build_failed project\"\n\t\t\t\t\tbuild_status_class_common_prefix = 'status_'\n\t\t\t\t\tbuild_status_class = classes.find { |klass| klass.start_with?(build_status_class_common_prefix) }\n\t\t\t\t\tbuild_status_class.sub(build_status_class_common_prefix, '').to_sym\n\t\t\t\tend,\n\t\t\t}\n\t\tend\n\t\t\n\t\treturn project_statuses.sort_by { |status| status[:id_num] }\n\tend", "def index\n @projects = Project.where.not({status: 9})\n end", "def pending_reviews\n pending_reviews = []\n self.projects.each do |p|\n p.reviews.each do |r|\n if !r.closed?\n if r.approved? && r.submitter == self \n pending_reviews.push(r)\n elsif r.review_votes.select{ |v| v.vote == ReviewVote.allowable_votes[:no_opinion] && v.user == self }\n pending_reviews.push(r)\n end\n end\n end\n end\n return pending_reviews\n end", "def buildable\n b = []\n bts_here = @buildings.map { |b| b.type }\n BuildingType.all.each do |bt|\n if not bts_here.include? bt and bts_here.include? bt.prerequisite \\\n and residents.length >= bt.min_colony\n b << bt\n end\n end\n return b\n end", "def all\n @projects\n end", "def all\n @projects\n end", "def incomplete_tests\n return self.product_tests.includes(:test_executions).select do |test|\n test.execution_state == :pending\n end\n end", "def all_queued\n @workflow_steps = WorkflowStep.where(status: 'queued').limit(params[:limit])\n\n return unless hours_ago\n\n @workflow_steps = @workflow_steps.where(hours_ago)\n end", "def remote_builds\n @remote_builds ||= url_request(url_of_file('builds_list')).lines.map(&:strip)\n end", "def check_project_status\n submit_process(:status) if @project.started?\n render json: state_snapshot\n end", "def pending_queues\n resp = get '/queues'\n\n Array.new.tap do |pending_queues|\n resp.parsed_response.css('queue').each do |queue_xml|\n queue = Elibri::ApiClient::ApiAdapters::V1::Queue.build_from_xml(self, queue_xml)\n pending_queues << queue if queue.products_count.nonzero?\n end \n end\n end", "def list(options = {})\n get_path(\n path_to_list,\n options,\n get_parser(:collection, Tinybucket::Model::BuildStatus)\n )\n end", "def index\n @pending_jobs = PendingJob.all\n end", "def all_enabled(options)\n all(options).select do |project_info|\n project_info.enabled?\n end\n end", "def index\n @projectsEnabled = Project.order(order: :DESC).where(displayed: true)\n @projectsDisabled = Project.where(displayed: false)\n end", "def index\n @runs = Run.all.where.not(:status => \"completed\")\n end", "def latest_builds(project, amount = 5)\n project.builds.order('build_number DESC').limit(amount).to_a\n end", "def find_pending\n notifications.where sent: false\n end", "def index\n @projects = Project.all\n\n @pending_id = ProjectState.find_by(name: \"Pending\").id\n @active_id = ProjectState.find_by(name: \"Active\").id\n @complete_id = ProjectState.find_by(name: \"Complete\").id\n @on_hold_id = ProjectState.find_by(name: \"On Hold\").id\n\n @pending_projects = @projects.where(project_state_id: @pending_id)\n @active_projects = @projects.where(project_state_id: @active_id)\n @complete_projects = @projects.where(project_state_id: @active_id)\n @on_hold_projects = @projects.where(project_state_id: @active_id)\n end", "def getActiveProjects(projects)\n projects.select { |p| Asana::Project.find(p.id).color == \"dark-green\" }\nend", "def prune(bd)\n pruned = []\n bd.each do |build|\n causes = build['actions'].find_all { |elt| elt.key?('causes') } \n upstream = causes.reject { |elt| elt['causes'].eql?([{}]) }\n ad_hoc_builds = upstream.find_all { |u| u['causes'][0]['upstreamProject'].include?('ad_hoc') }\n next unless ad_hoc_builds.empty?\n pruned.push(build)\n end\n pruned\n end", "def pending_bz_bugs\n BzBug.all(:conditions => ['package_id = ? and bz_action is not null', self.id])\n end", "def find_all_projects()\n @scenario_look_up_map.keys\n end", "def incomplete_tasks\n\t\ttasks.select{ |t| !t.completed? }\n\tend", "def index\n add_breadcrumb :planning\n\n @sprints = @project.sprints.not_running\n @issues = @project.backlog_items.not_completed.where(:sprint_id => nil)\n end", "def pending_tags\n @pending_tags || []\n end", "def active_job_requests\n self.job_requests.joins(:project).where( :is_canceled => false, :project => {\n :is_finished => false ,\n :is_deleted => false \n } ).order(\"deadline_date ASC, is_finished ASC, created_at DESC\")\n end", "def get_all_withassigned(projectid)\n get(\"projects/#{projectid}/assigned_todos.json\")\n end", "def service_orders_completed\n result = Array.new\n self.services.each do |s|\n s.orders.each do |order|\n if !order.blank? and !order.workspace.blank?\n result << order if order.workspace.completed?\n end\n end\n end\n result\n end", "def builds\n servers.flat_map { |server| server.builds }\n end", "def list_all\n query = create_query(:Project, :all, by: default_sort_order)\n show_selected_projects(query)\n end", "def get_builds_by_repo(repo)\n\t\treturn self.fetch(\"repos/#{repo}/builds\")\n\tend", "def get_pending_states\n self.statemap['on_pending'].map{|state, _| state}\n end", "def recent_builds(params = {})\n CircleCi.request(@conf, \"/project/#{username}/#{project}\", params).get\n end", "def flagged_projects\n @flagged_projects = Array.new\n Flag.all.each do |f|\n if(f.flaggable_type == 'Project')\n @flagged_projects << {'project' => Project.find(f.flaggable_id),'flag' => f ,'user' => User.find(f.user_id)}\n end\n end\n end", "def canceled\n @projects = Project.where(canceled: true)\n end", "def status()\n return [true, [], [], []] if not self.jobids.any?\n \n statuses = GridVid.query(@_keys.merge({:jobids => self.jobids}))\n passed = []\n running = [] \n failed = [] \n \n statuses.each_pair {|jobid, val|\n case val['status']\n when \"PASS\"\n passed << val['jobid'] \n when \"FAILED\" \n failed << val['jobid'] \n else\n running << val['jobid'] \n end \n }\n \n return [running.length == 0, passed, failed, running] \n end", "def export_project(project)\n return [\n project.id,\n project.name,\n project.description,\n project.homepage,\n project.is_public ? 1 : 0,\n project.parent ? project.parent.identifier : nil,\n project.created_on ? project.created_on.strftime('%Y-%m-%d %H:%M:%S') : nil,\n project.updated_on ? project.updated_on.strftime('%Y-%m-%d %H:%M:%S') : nil,\n project.identifier,\n project.status,\n project.enabled_module_names * ',',\n project.trackers.collect(&:name) * ',',\n project.issue_custom_fields.collect(&:name) * ',',\n ]\n end", "def available_projects_list\n uri = \"#{@api_url}?access_token=#{@access_token}\"\n get uri\n end", "def pending_changelists\n command = %W(changelists -u #{@p4.user} -c #{@p4.client} -s pending)\n run(*command).map { |elem|\n Changelist.new(self, elem[\"change\"].to_i)\n }\n end", "def live_bets\n self.bets.select {|bet| bet.status == \"Pending\"}\n end", "def index\n @programs = Program.where(completed: false)\n end", "def build_results\n CircleCi::Project.recent_builds_branch('salsify', 'dandelion', 'develop')\n end", "def get_incomplete\n @task_list.select { |task| task.status == \"incomplete\" }\n end", "def getBillableProjIds\n\t\tprojArr = \"\"\t\n\t\tbillProjId = getProjArrays(params[:related_to], params[:related_parent])\n\t\tif !billProjId.blank?\n\t\t\tbillProjId.each do | entry|\n\t\t\t\tprojArr << entry.project_id.to_s() + ',' + entry.project_name.to_s() + \"\\n\" \n\t\t\tend\n\t\tend\n\t\trespond_to do |format|\n\t\t\tformat.text { render :text => projArr }\n\t\tend\n\t\t\n\tend", "def possible_builds\n commits = [@job.commit]\n\n if defined?(SamsonKubernetes) && @job.deploy.kubernetes_reuse_build\n previous_scope = @job.deploy.stage.deploys.prior_to(@job.deploy).where(kubernetes_reuse_build: false)\n previous = previous_scope.first&.job&.commit\n commits.unshift previous if previous\n end\n\n Build.where(git_sha: commits).sort_by { |build| [commits.index(build.git_sha), -build.updated_at.to_i] }\n end", "def all_not_done\n self.select { |todo| !todo.done? }\n end", "def arrayOfChanges\n #we could also use Ruby/Git here, but that feels like an overkill right #now.\n gitChanges = `git diff #{@args[:taskpaper_file]} | grep '^\\+' | grep -i '\\@done'`\n return gitChanges.split(\"\\n\").collect{ |line| Task.new(line.gsub(/^\\+\\ ?/, \"\"))}\n end", "def pending\n result = {\n approvals: [],\n unapprovals: [],\n flagged: [],\n unflagged: [],\n comments: [],\n ready: []\n }\n\n Agenda.index.each do |item|\n if Pending.comments[item.attach]\n result.comments << item\n end\n\n action = false\n\n if Pending.approved.include? item.attach\n result.approvals << item\n action = true\n end\n\n if Pending.unapproved.include? item.attach\n result.unapprovals << item\n action = true\n end\n\n if Pending.flagged.include? item.attach\n result.flagged << item\n action = true\n end\n\n if Pending.unflagged.include? item.attach\n result.unflagged << item\n action = true\n end\n\n if not action and item.ready_for_review(User.initials)\n result.ready << item\n end\n end\n\n return result\n end", "def queued_build_details(task_id)\n response = get(\"buildQueue/taskId:#{task_id}\")\n response\n end", "def projects\n PivotalTracker::Project.all\n end", "def archived\n projects.select { |project| project.archived? }\n end", "def get_unpublished_books\n @grid_title = \"Not Published\"\n\n # get task 'Production Complete' which is a published book\n published_task = Task.find_by_name(\"Production Complete\")\n workflow_task = published_task.workflow.root\n\n # get all tasks in the workflow that occur before production compelete.\n not_published_tasks = []\n while next_task = workflow_task.next_task\n\n # we don't want to include published_task\n break if next_task.id == published_task.id\n\n not_published_tasks.push next_task.name\n workflow_task = next_task\n end\n @projects = ProjectGridTableRow.includes(project: [:cover_template])\n .where(\"production_task_name in (?)\", not_published_tasks)\n .not_archived\n end", "def get_done_requests\n r = Request.where(:assigned => self , :done => true).to_a\n return r\n end", "def get_completed(projectid)\n get(\"projects/#{projectid}/todolists/completed.json\")\n end", "def build_status(devs = nil)\n devs = self.devices if not devs\n devs = [devs].flatten\n ptr = MemoryPointer::new( :cl_build_status )\n return devs.collect { |dev|\n error = OpenCL.clGetProgramBuildInfo(self, dev, BUILD_STATUS, ptr.size, ptr, nil)\n error_check(error)\n [dev, BuildStatus::new(ptr.read_cl_build_status)]\n }\n end", "def busy_go_cabs\n arr = []\n @go_cabs.select { |cab| arr << cab if (cab.available == false) }\n return arr\n end", "def search_pending\n rpc(:search_pending_all).key?(:success)\n end", "def pending_carpools\n @pending_carpools = trips.where('pools.is_pending': true)\n end", "def projects\n result = []\n load_attributes\n @attributes['projects'].each do |project|\n result << project['name']\n end\n puts \"Workspace projects #{result}\"\n result\n end", "def all_by_exit_status(status)\n a = Array.new\n each { |t|\n a << t if t.exit_status == status\n }\n return a\nend", "def all_by_exit_status(status)\n a = Array.new\n each { |t|\n a << t if t.exit_status == status\n }\n return a\nend", "def find_all(project_id)\n query = \"project:=#{project_id}\"\n cols = %w(dtLastUpdated ixBug sStatus sTitle sLatestTextSummary\n ixProject sProject sPersonAssignedTo sPriority).join(',')\n api.command(:search, :q => query, :cols => cols).collect do |ticket|\n self.new ticket[1][\"case\"]\n end.flatten\n end", "def all_done\n select{ |todo| todo.done? }\n end", "def active_jobs\n result = Array.new\n self.jobs.each do |j|\n if j.private?\n result << j\n elsif j.active?\n result << j\n end\n end\n result\n end", "def completed_tasks\n self.tasks.where('is_completed =?', is_completed = true)\n end", "def pending\n @definitions = Definition.all.pending\n render json: @definitions, status: :accepted\n end", "def projects\n Project.where('constructors @> ARRAY[?]::integer[]', [id])\n end", "def open_projects\n Project.where(status: :open, service_id: services)\n end", "def check_projects\n # Nasledujici kod si vyzaduje urcitou pozornost a vysvetleni komentarem. Jeho smyslem je z pole @projects_current\n # odebrat vsechny projekty, ktere jsou jiz hotove (pocet odpracovanych dni je vetsi nebo roven poctu dni potrebnemu\n # k dokonceni projektu) a tyto projekty umistit do pomocneho pole currently_done.\n # V podmince bloku metody reject! vyuzivame toho, ze pokud jeste neni odpracovan dostatecny pocet dni, bude hned\n # prvni cast podminky vyhodnocena jako false a diky zkracenemu vyhodnocovani vyrazu se druha cast podminky vubec\n # neprovede. V pripade, ze uz je odpracovano dostatecne mnozstvi dni, pridani zkoumaneho projektu do currently_done\n # se provede a vyslednou hodnotou celeho bloku bude objekt currently_done samotny, coz v podminkovem kontextu\n # znamena pravdivou hodnotu, a tedy projekt bude metodou reject! odebran z @projects_current.\n # Pokud vam takovato konstrukce pripada ponekud slozita a nepruhledna, nevadi, muzete si predstavit, ze bychom\n # misto toho pouzili nasledujici kod -- vysledek by byl stejny:\n # currently_done = @projects_current.select { |project| project.man_days_done >= project.man_days }\n # @projects_current.reject! { |project| project.man_days_done >= project.man_days }\n currently_done = []\n @projects_current.reject! { |project| project.man_days_done >= project.man_days && currently_done << project }\n\n currently_done.each do |project|\n project.state = :done\n @projects_done << project\n @budget += project.price\n end\n end", "def pending_status\n 'pending' if archive_retrieval_job_id\n end", "def only_production_status\n return if !@stage.production? || @stage.project.deployed_to_non_production_stage?(@commit)\n\n {\n state: \"pending\",\n statuses: [{\n state: \"Production Only Reference\",\n description: \"#{@reference} has not been deployed to a non-production stage.\"\n }]\n }\n end", "def filtered_builds\n @filtered_builds ||= filter_builds\n end", "def cross_project\n []\n end" ]
[ "0.627299", "0.6206553", "0.6092597", "0.6052416", "0.6046888", "0.59889466", "0.5978075", "0.5974735", "0.5951394", "0.59363586", "0.5922746", "0.5915245", "0.5884338", "0.58668303", "0.5845658", "0.58387434", "0.5796712", "0.57959735", "0.579127", "0.5772402", "0.5771239", "0.57684743", "0.5765261", "0.5730023", "0.5719091", "0.5704641", "0.5680455", "0.56786525", "0.5670188", "0.56593347", "0.5655847", "0.5655847", "0.55960214", "0.5595986", "0.5590648", "0.5584097", "0.55789036", "0.5573604", "0.55726415", "0.5565766", "0.55205274", "0.5508972", "0.55062956", "0.54978424", "0.5486408", "0.54802495", "0.5479252", "0.54760754", "0.5475442", "0.547249", "0.5472084", "0.5469873", "0.54619783", "0.54533976", "0.54532546", "0.5448291", "0.54462254", "0.54387856", "0.5436174", "0.54085255", "0.54044104", "0.5403639", "0.54021376", "0.53932786", "0.5390756", "0.53885573", "0.53850776", "0.53777546", "0.5374569", "0.53730166", "0.53652763", "0.53606576", "0.5360273", "0.53546685", "0.535378", "0.53484255", "0.5342473", "0.533708", "0.53346634", "0.5332003", "0.53245753", "0.5323653", "0.5316674", "0.531269", "0.53120923", "0.53053796", "0.5304194", "0.5304194", "0.53003836", "0.52949584", "0.5292925", "0.52892786", "0.52881026", "0.52869236", "0.5285187", "0.5281883", "0.5279287", "0.5268814", "0.52573055", "0.5257236" ]
0.681905
0
Add or update a build
def add_build!(project: nil, build: nil) not_implemented(__method__) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bumpBuild()\n\t\t\t\t@build += 1\n\t\t\tend", "def save!\n client.put_build(app_id: app_id, build_id: id, build: self)\n end", "def build\n if phase.has_key?('build')\n execute(\"build\", phase['build'])\n end\n end", "def update_buildfile\n buildfile = change_version { |version| # THIS_VERSION minus SNAPSHOT\n resolve_next_version(this_version) # THIS_VERSION\n }\n File.open(version_file, 'w') { |file| file.write buildfile }\n end", "def add_build_to_queue(build_type_id)\n action = 'add2Queue'\n path = \"/httpAuth/action.html?#{action}=#{build_type_id}&branchName=#{get_branch()}\"\n puts \"Queue build #{build_type_id} on #{get_branch()} with #{path}\"\n\n execute_get_web_request(path, false) #generate_request(path)\n end", "def update_buildfile\n buildfile = change_version { |version| # THIS_VERSION minus SNAPSHOT\n resolve_next_version(this_version) # THIS_VERSION\n }\n File.open(Rake.application.rakefile.to_s, 'w') { |file| file.write buildfile }\n end", "def update\n @build = Build.find(params[:id])\n\n respond_to do |format|\n if @build.update_attributes(params[:build])\n format.html { redirect_to @build, notice: 'Build was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @build.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @build = Build.find(params[:id])\n\n respond_to do |format|\n if @build.update_attributes(params[:build])\n format.html { redirect_to @build, notice: 'Build was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @build.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @built_with.update(built_with_params)\n format.html { redirect_to @built_with, notice: 'Built with was successfully updated.' }\n format.json { render :show, status: :ok, location: @built_with }\n else\n format.html { render :edit }\n format.json { render json: @built_with.errors, status: :unprocessable_entity }\n end\n end\n end", "def build=(value)\n if value == @defaults['ai.application.build']\n @values.delete 'ai.application.build' if @values.key? 'ai.application.build'\n else\n @values['ai.application.build'] = value\n end\n end", "def update!(**args)\n @build = args[:build] if args.key?(:build)\n @failure_cause = args[:failure_cause] if args.key?(:failure_cause)\n @failure_message = args[:failure_message] if args.key?(:failure_message)\n end", "def update!(**args)\n @build = args[:build] if args.key?(:build)\n @failure_cause = args[:failure_cause] if args.key?(:failure_cause)\n @failure_message = args[:failure_message] if args.key?(:failure_message)\n end", "def update_build_number(build_number)\n result = ''\n client = Helpers.create_aws_ec2_client\n client.create_tags(dry_run: false,\n resources: [@aws_instance_data.instance_id],\n tags: [{ key: 'Build-Number', value: build_number }])\n result += run_ssh_command(\"echo #{build_number} | sudo tee /home/bz-app/build_number.txt\")\n result += run_ssh_command(\"sudo service #{@repository} restart\")\n result\n end", "def update\n respond_to do |format|\n if @build.update(build_params)\n format.html { redirect_to @build, notice: \"Build was successfully updated.\" }\n format.json { render :show, status: :ok, location: @build }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @build.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @build.update(build_params)\n format.html { redirect_to @build, notice: 'Build was successfully updated.' }\n format.json { render :show, status: :ok, location: @build }\n else\n format.html { render :edit }\n format.json { render json: @build.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @artifact = args[:artifact] if args.key?(:artifact)\n @build = args[:build] if args.key?(:build)\n @failure_cause = args[:failure_cause] if args.key?(:failure_cause)\n @failure_message = args[:failure_message] if args.key?(:failure_message)\n @metadata = args[:metadata] if args.key?(:metadata)\n end", "def add_build_information(build_host)\n fail ArgumentError, 'Build_host has to be a string' unless build_host.is_a? String\n\n # add BuildHost\n if @sopm.xpath('/otrs_package/BuildHost').children.length == 0\n\n new_build_host_entry = Nokogiri::XML::Node.new 'BuildHost', sopm\n new_build_host_entry.content = build_host\n @sopm.xpath('/otrs_package/Filelist').first.previous = new_build_host_entry.to_xml + \"\\n \"\n else\n @sopm.xpath('/otrs_package/BuildHost').children[0].content = build_host\n end\n\n # add BuildDate\n if @sopm.xpath('/otrs_package/BuildDate').children.length == 0\n\n new_build_date_entry = Nokogiri::XML::Node.new 'BuildDate', sopm\n new_build_date_entry.content = Time.zone.now\n @sopm.xpath('/otrs_package/Filelist').first.previous = new_build_date_entry.to_xml + \"\\n \"\n else\n @sopm.xpath('/otrs_package/BuildDate').children[0].content = Time.zone.now\n end\n\n store\n end", "def set_build\n @build = Build.find(params[:id])\n end", "def set_build\n @build = Build.find(params[:id])\n end", "def set_build\n @build = Build.find(params[:id])\n end", "def set_build\n @build = Build.find(params[:id])\n end", "def set_build\n @build = Build.find(params[:id])\n end", "def add_build_information(build_host)\n parse\n\n # add buildhost\n @structure['buildhost'] = build_host\n # add builddate\n @structure['builddate'] = Time.zone.now\n\n store\n end", "def update\n respond_to do |format|\n if @os_build.update(os_build_params)\n format.html { redirect_to @os_build, notice: 'Os build was successfully updated.' }\n format.json { render :show, status: :ok, location: @os_build }\n else\n format.html { render :edit }\n format.json { render json: @os_build.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @artifact_uri = args[:artifact_uri] if args.key?(:artifact_uri)\n @build = args[:build] if args.key?(:build)\n @event_log_path = args[:event_log_path] if args.key?(:event_log_path)\n @failure_cause = args[:failure_cause] if args.key?(:failure_cause)\n @failure_message = args[:failure_message] if args.key?(:failure_message)\n end", "def build(tag, build_id, registry = '')\n build_id = SecureRandom.hex(10) unless build_id\n\n test_env = env(:build, build_id, registry)\n test_env.clean!\n\n success = test_env.commands\n\n if success\n test_env.tag_image(tag)\n test_env.push(tag)\n end\n\n success\n ensure\n test_env.clean! if test_env\n end", "def update!(**args)\n @artifacts = args[:artifacts] if args.key?(:artifacts)\n @executions = args[:executions] if args.key?(:executions)\n end", "def update!(**args)\n @building = args[:building] if args.key?(:building)\n @number = args[:number] if args.key?(:number)\n end", "def put(revision, key, options)\n put_path(\n path_to_put(revision, key),\n options,\n get_parser(:object, Tinybucket::Model::BuildStatus)\n )\n end", "def update(major, minor, build)\n\t\t\t\t@major = major\n\t\t\t\t@minor = minor\n\t\t\t\t@build = build\n\t\t\tend", "def build\n @build ||= '0.0.0'\n end", "def put_build_into_production!(app, version_number)\n begin\n verify_app(app)\n open_app_page(app)\n\n Helper.log.info(\"Choosing the latest build on iTunesConnect for release\")\n\n click_on \"Prerelease\"\n\n wait_for_preprocessing\n\n ################# Apple is finished processing the ipa file #################\n\n Helper.log.info(\"Apple finally finished processing the ipa file\")\n open_app_page(app)\n\n begin\n first('a', :text => BUTTON_ADD_NEW_BUILD).click\n wait_for_elements(\".buildModalList\")\n sleep 5\n rescue\n if page.has_content?\"Upload Date\"\n # That's fine, the ipa was already selected\n return true\n else\n raise \"Could not find Build Button. It looks like the ipa file was not properly uploaded.\"\n end\n end\n\n if page.all('td', :text => version_number).count > 1\n Helper.log.fatal \"There were multiple submitted builds found. Don't know which one to choose. Just choosing the top one for now\"\n end\n\n result = page.first('td', :text => version_number).first(:xpath,\"./..\").first(:css, \".small\").click\n click_on \"Done\" # Save the modal dialog\n click_on \"Save\" # on the top right to save everything else\n\n error = page.has_content?BUTTON_ADD_NEW_BUILD\n raise \"Could not put build itself onto production. Try opening '#{current_url}'\" if error\n\n return true\n rescue => ex\n error_occured(ex)\n end\n end", "def update_with_revision\n store_revision do\n update_without_revision\n end\n end", "def set_os_build\n @os_build = OsBuild.find(params[:id])\n end", "def build!\n build_to self[:build_path]\n end", "def build(building)\n @building = building\n end", "def build\n @values.fetch('ai.application.build') { \n @values['ai.application.build'] = nil\n }\n end", "def update!(**args)\n @pull_deps = args[:pull_deps] if args.key?(:pull_deps)\n @source = args[:source] if args.key?(:source)\n end", "def update!(**args)\n @pull_deps = args[:pull_deps] if args.key?(:pull_deps)\n @source = args[:source] if args.key?(:source)\n end", "def update!(**args)\n @abandoned = args[:abandoned] if args.key?(:abandoned)\n @annotations = args[:annotations] if args.key?(:annotations)\n @build_artifacts = args[:build_artifacts] if args.key?(:build_artifacts)\n @condition = args[:condition] if args.key?(:condition)\n @create_time = args[:create_time] if args.key?(:create_time)\n @delivery_pipeline_snapshot = args[:delivery_pipeline_snapshot] if args.key?(:delivery_pipeline_snapshot)\n @deploy_parameters = args[:deploy_parameters] if args.key?(:deploy_parameters)\n @description = args[:description] if args.key?(:description)\n @etag = args[:etag] if args.key?(:etag)\n @labels = args[:labels] if args.key?(:labels)\n @name = args[:name] if args.key?(:name)\n @render_end_time = args[:render_end_time] if args.key?(:render_end_time)\n @render_start_time = args[:render_start_time] if args.key?(:render_start_time)\n @render_state = args[:render_state] if args.key?(:render_state)\n @skaffold_config_path = args[:skaffold_config_path] if args.key?(:skaffold_config_path)\n @skaffold_config_uri = args[:skaffold_config_uri] if args.key?(:skaffold_config_uri)\n @skaffold_version = args[:skaffold_version] if args.key?(:skaffold_version)\n @target_artifacts = args[:target_artifacts] if args.key?(:target_artifacts)\n @target_renders = args[:target_renders] if args.key?(:target_renders)\n @target_snapshots = args[:target_snapshots] if args.key?(:target_snapshots)\n @uid = args[:uid] if args.key?(:uid)\n end", "def update_brew_build(advisory, prod_name, nvr)\n errata = find_errata(advisory)\n return \"Filelist is still locked. Please put advisory state in NEW_FILES\" unless errata.status == State::NEW_FILES\n \n user = find_user\n user.check_role_auth(\"Do not have permission to update builds for this advisory\", 'devel', 'secalert')\n \n pv = ProductVersion.find_by_name(prod_name)\n return \"No such product version #{prod_name}\" unless pv\n\n unless errata.product == pv.product\n return \"Cannot use product version #{prod_name} for product #{errata.product.name}\"\n end\n\n build = BrewBuild.make_from_rpc(nvr)\n return \"Could not find build #{nvr}\" unless build\n \n brew = Brew.get_connection\n has_valid_tags = brew.build_is_properly_tagged?(errata, pv, build)\n return brew.errors_to_s unless has_valid_tags\n \n old_version = ErrataBrewMapping.find(:first, \n :conditions => \n ['current = 1 and errata_id = ? and package_id = ?', \n errata, build.package])\n \n ErrataBrewMapping.transaction do \n ErrataBrewMapping.create(:product_version => pv,\n :errata => errata,\n :brew_build => build,\n :package => build.package)\n old_version.obsolete! if old_version\n errata = Errata.find(errata.id)\n RpmdiffRun.schedule_runs(errata, user.login_name)\n end\n\n if old_version\n return \"Updated build #{old_version.brew_build.nvr} to #{build.nvr} in #{errata.advisory_name}\"\n else\n return \"Added build #{build.nvr} to #{errata.advisory_name}\"\n end\n end", "def update!(**args)\n @artifacts = args[:artifacts] if args.key?(:artifacts)\n @events = args[:events] if args.key?(:events)\n @executions = args[:executions] if args.key?(:executions)\n end", "def update!(**args)\n @dependencies = args[:dependencies] if args.key?(:dependencies)\n @has_dependencies = args[:has_dependencies] if args.key?(:has_dependencies)\n @version = args[:version] if args.key?(:version)\n end", "def update!(**args)\n @has_dependencies = args[:has_dependencies] if args.key?(:has_dependencies)\n @is_installed = args[:is_installed] if args.key?(:is_installed)\n @version = args[:version] if args.key?(:version)\n end", "def update\n project.run \"apk update\"\n end", "def update_image_for_building_tag name\n unless service_config_hash[\"build\"].nil?\n service_config_hash[\"image\"]=name\n end\n \n self.image_name = service_config_hash[\"image\"]\n end", "def build; end", "def update!(**args)\n @artifacts = args[:artifacts] if args.key?(:artifacts)\n end", "def update\n install\n end", "def update!(**args)\n @code_compilation_config = args[:code_compilation_config] if args.key?(:code_compilation_config)\n @compilation_errors = args[:compilation_errors] if args.key?(:compilation_errors)\n @dataform_core_version = args[:dataform_core_version] if args.key?(:dataform_core_version)\n @git_commitish = args[:git_commitish] if args.key?(:git_commitish)\n @name = args[:name] if args.key?(:name)\n @release_config = args[:release_config] if args.key?(:release_config)\n @resolved_git_commit_sha = args[:resolved_git_commit_sha] if args.key?(:resolved_git_commit_sha)\n @workspace = args[:workspace] if args.key?(:workspace)\n end", "def perform(build, launcher, listener)\n context = BuildContext.new(build, launcher, listener)\n notes = BuildNotes.new(context).notes\n update_git_notes(notes, context)\n notify_sqs(notes, context)\n end", "def prep_build(version)\n # Reset back to master and ensure the build branch is removed\n %x( cd #{@work_dir} && git checkout -f master && git branch -D build &> /dev/null )\n\n # Checkout version as build branch\n %x( cd #{@work_dir} && git checkout #{version} -b build )\n\n # Clean everything\n %x( cd #{@work_dir} && git clean -f -d -x )\n end", "def update!(**args)\n @bundles = args[:bundles] if args.key?(:bundles)\n @platform_version = args[:platform_version] if args.key?(:platform_version)\n @required_platform_version = args[:required_platform_version] if args.key?(:required_platform_version)\n @status = args[:status] if args.key?(:status)\n end", "def add_process(build)\n # Figure out where to add the process to keep them sorted\n index = processes.find { |process| process.job == build.job && process.number > build.number }\n if index\n processes.insert(index, build)\n else\n processes << build\n end\n end", "def update!(**args)\n @repository = args[:repository] if args.key?(:repository)\n @revision_id = args[:revision_id] if args.key?(:revision_id)\n end", "def update!(**args)\n @repository = args[:repository] if args.key?(:repository)\n @revision_id = args[:revision_id] if args.key?(:revision_id)\n end", "def update!(**args)\n @branch = args[:branch] if args.key?(:branch)\n @deployed_revision = args[:deployed_revision] if args.key?(:deployed_revision)\n @repository_url = args[:repository_url] if args.key?(:repository_url)\n @revision = args[:revision] if args.key?(:revision)\n @source_path = args[:source_path] if args.key?(:source_path)\n @tag = args[:tag] if args.key?(:tag)\n end", "def same_build_in_progress?\n !Rails.env.development? &&\n !Rails.cache.write(\"build-service-#{@build.id}\", true, unless_exist: true, expires_in: 10.seconds, raw: true)\n end", "def update!(**args)\n @version = args[:version] if args.key?(:version)\n end", "def build\r\n end", "def build\r\n end", "def build_params\n params.require(:build).permit(:repo_id, :status)\n end", "def make\n @this_version = extract_version\n check\n with_release_candidate_version do |release_candidate_buildfile|\n args = []\n args << 'buildr' << '--buildfile' << release_candidate_buildfile\n args << '--environment' << Buildr.environment unless Buildr.environment.to_s.empty?\n args << 'clean' << 'upload' << 'DEBUG=no'\n sh *args\n end\n tag_release resolve_tag\n update_version_to_next if this_version != resolve_next_version(this_version)\n end", "def increment(*)\n @build += 1\n end", "def rebuild\n build addl_cmake_bld_args: '--clean-first'\n end", "def update\n respond_to do |format|\n if @build_number.update(build_number_params)\n format.html { redirect_to @build_number, notice: 'Build number was successfully updated.' }\n format.json { render :show, status: :ok, location: @build_number }\n else\n format.html { render :edit }\n format.json { render json: @build_number.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_github\n unless environment_is_production\n puts 'NOT updating github because environment is not production'\n return false\n end\n\n puts 'pushing database to github'\n\n @scraper_log.info \"------------------------------\"\n @scraper_log.info \"updating git\"\n @scraper_log.info \"------------------------------\"\n x = Subexec.run \"git add #{@db_dump_file} #{@status_file_name}\"\n x = Subexec.run \"git commit -m 'Updated database dump file and status.json with new hr.gov.ge data'\"\n x = Subexec.run \"git push origin master\"\nend", "def update!(**args)\n @building_id = args[:building_id] if args.key?(:building_id)\n @building_name = args[:building_name] if args.key?(:building_name)\n @current = args[:current] if args.key?(:current)\n @desk_code = args[:desk_code] if args.key?(:desk_code)\n @floor_name = args[:floor_name] if args.key?(:floor_name)\n @floor_section = args[:floor_section] if args.key?(:floor_section)\n @last_update_time = args[:last_update_time] if args.key?(:last_update_time)\n @metadata = args[:metadata] if args.key?(:metadata)\n @source = args[:source] if args.key?(:source)\n @type = args[:type] if args.key?(:type)\n @value = args[:value] if args.key?(:value)\n end", "def valid_build hash\n attrs = { project_id: project.id, branch: 'master' }.merge(hash)\n Build.create! attrs\n end", "def update\n is_valid_project\n $VERBOSE = !options[:verbose].nil?\n name = File.basename(CURR_DIR)\n project_dir = CURR_DIR\n overwrite_config = !options[:overwrite_config].nil?\n version = options[:version]\n unless version == nil or OK_OBD_VERSIONS.include?(version)\n throw \"Specified version \\\"#{version}\\\" isn't supported.\\nTry one of the following:\\n #{OK_OBD_VERSIONS.join(\"\\n \")}\"\n end\n rebuild = !options[:rebuild].nil?\n download_openbd(version, rebuild) unless version.nil?\n update_project(name, version, false, overwrite_config, true) \n display \"#{name} updated to OpenBD #{version}\" unless version.nil?\n end", "def update!(**args)\n @compilation_result = args[:compilation_result] if args.key?(:compilation_result)\n @error_status = args[:error_status] if args.key?(:error_status)\n @release_time = args[:release_time] if args.key?(:release_time)\n end", "def generate\n env = Enviroment.find(params[:enviroment_id])\n existing = BuildNumber.where(:branch => params[:branch], :commit => params[:vcscommit], :enviroment => env).order(:number => :desc)\n \n if existing.any? # something found - return existing buildnum\n @build_number = existing.first\n else\n existing_for_branch = BuildNumber.where(:branch => params[:branch], :enviroment => env).order(:number => :desc)\n if existing_for_branch.any?\n num = existing_for_branch.first.number\n if env.default_build_number > num\n num = env.default_build_number\n end\n else\n num = env.default_build_number\n end\n @build_number = BuildNumber.new(:branch => params[:branch], :commit => params[:vcscommit], :enviroment => env, :number => num + 1)\n end\n \n respond_to do |format|\n if not @build_number.changed? or @build_number.save\n format.html { redirect_to build_number, notice: 'Build number was successfully updated.' }\n format.json { render :show, status: :ok, location: @build_number }\n else\n format.html { render :edit }\n format.json { render json: @build_number.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @binary = args[:binary] unless args[:binary].nil?\n @version_code = args[:version_code] unless args[:version_code].nil?\n end", "def new\n @build = Build.new\n\n \n end", "def build!\n end", "def action_update\n install_bundler\n run_bundler('update')\n set_state\n end", "def update!(**args)\n @versions = args[:versions] if args.key?(:versions)\n end", "def update!(**args)\n @versions = args[:versions] if args.key?(:versions)\n end", "def update!(**args)\n @versions = args[:versions] if args.key?(:versions)\n end", "def perform(build, launcher, listener)\n BuildContext.instance.set(build, launcher, listener) do\n git_updater = GitUpdater.new\n retries = Constants::CONCURRENT_UPDATE_RETRIES\n notes = BuildNotes.new.notes\n begin\n info \"updating git notes\"\n git_updater.update!(notes)\n rescue GitUpdater::ConcurrentUpdateError => e\n if retries > 0\n warn \"caught ConcurrentUpdateError while updating git notes, retrying (#{retries}x left)\"\n retries -= 1\n retry\n else\n raise e\n end\n end\n info \"updated git notes: #{notes}\"\n end\n end", "def patches; DATA unless build.head?; end", "def update\n push_to_db\n end", "def update\n push_to_db\n end", "def build\n cd_and_sh( pkg_dir, build_commands )\n end", "def propagate_version(**args)\n return unless ENV.key? 'CI'\n\n version = get_package_key(key: :version)\n build = current_build_number(track: args[:track] || nil)\n\n UI.message \"Propagating version: #{version}\"\n UI.message 'into the Info.plist and build.gradle files'\n\n UI.message \"Setting build number to #{build}\"\n\n version = \"#{version.split('-')[0]}-pre\" if should_nightly?\n UI.message \"Actually putting #{version} into the binaries (because we're doing a nightly)\"\n\n # encode build number into js-land – we've already fetched it, so we'll\n # never set the \"+\" into the binaries\n unless version.include? '+'\n # we always want the CI build number in js-land\n set_package_data(data: { version: \"#{version}+#{build}\" })\n end\n\n case lane_context[:PLATFORM_NAME]\n when :android\n set_gradle_version_name(version_name: version, gradle_path: lane_context[:GRADLE_FILE])\n set_gradle_version_code(version_code: build, gradle_path: lane_context[:GRADLE_FILE])\n when :ios\n # we're splitting here because iTC can't handle versions with dashes in them\n increment_version_number(version_number: version.split('-')[0], xcodeproj: ENV['GYM_PROJECT'])\n increment_build_number(build_number: build, xcodeproj: ENV['GYM_PROJECT'])\n end\nend", "def create\n @build = @project.builds.new\n\n if @build.save\n if params[@project.file_var] && params[@project.file_var].is_a?(ActionDispatch::Http::UploadedFile)\n @build.update_attribute :original_filename, params[@project.file_var].original_filename\n FileUtils.mv params[@project.file_var].path, @build.build_path.join(params[@project.file_var].original_filename).to_s\n\n system(\"ls #{@build.build_path}\")\n end\n @build.tag @build.build\n\n head :ok\n else\n render plain: @build.errors, status: :unprocessable_entity\n end\n end", "def update!(**args)\n @artifact = args[:artifact] if args.key?(:artifact)\n @event_time = args[:event_time] if args.key?(:event_time)\n @execution = args[:execution] if args.key?(:execution)\n @labels = args[:labels] if args.key?(:labels)\n @type = args[:type] if args.key?(:type)\n end", "def bazel_update(from_version, to_version)\n upgrade_description = \"Update the bazel version #{from_version.nil? ? '' : \"from #{from_version} \"}to #{to_version}\"\n desc upgrade_description\n command(:\"patch_bazel_version_to_#{to_version}\") do |app|\n patched = patch_file('.bazelversion') do |content|\n from_version.nil? ? \"#{to_version}\\n\" : content.gsub(from_version, to_version)\n end\n if patched\n mysystem(\"git commit -m \\\"#{upgrade_description}\\\"\")\n end\n end\n end", "def update!(**args)\n @compilation_result = args[:compilation_result] if args.key?(:compilation_result)\n @invocation_config = args[:invocation_config] if args.key?(:invocation_config)\n @invocation_timing = args[:invocation_timing] if args.key?(:invocation_timing)\n @name = args[:name] if args.key?(:name)\n @state = args[:state] if args.key?(:state)\n @workflow_config = args[:workflow_config] if args.key?(:workflow_config)\n end", "def build_app\n project_file = 'testDemoApp.xcodeproj'\n increment_build_number(xcodeproj: project_file) # version bump\n\n gym(\n workspace: 'testDemoApp.xcworkspace',\n scheme: 'testDemoApp'\n )\n\n commit_version_bump(\n message: 'Version Bump by fastlane',\n xcodeproj: project_file,\n force: true\n )\n\n push_to_git_remote\nend", "def commit_and_tag(new_version)\n git = Git.init\n git.add([VERSION_FILE, \"Gemfile.lock\"])\n git.commit(\"Update to #{new_version}\")\n git.add_tag(new_version.to_s)\n end", "def update!(**args)\n @frameworks = args[:frameworks] if args.key?(:frameworks)\n @launch_stage = args[:launch_stage] if args.key?(:launch_stage)\n @name = args[:name] if args.key?(:name)\n @open_source_category = args[:open_source_category] if args.key?(:open_source_category)\n @parent = args[:parent] if args.key?(:parent)\n @predict_schemata = args[:predict_schemata] if args.key?(:predict_schemata)\n @publisher_model_template = args[:publisher_model_template] if args.key?(:publisher_model_template)\n @supported_actions = args[:supported_actions] if args.key?(:supported_actions)\n @version_id = args[:version_id] if args.key?(:version_id)\n end", "def build\n Bob.logger.info \"Building #{buildable.commit} of the #{buildable.scm} repo at #{buildable.uri}\"\n\n in_background do\n buildable.start_building if buildable.respond_to?(:start_building)\n\n scm.with_commit(buildable.commit) { |commit_info|\n buildable.finish_building(commit_info, *run_build_script)\n }\n end\n end", "def has_build(name)\n carry_all.register self, :has_build, name\n end", "def create\n @build = Build.new(params[:build])\n\n respond_to do |format|\n if @build.save\n format.html { redirect_to @build, notice: 'Build was successfully created.' }\n format.json { render json: @build, status: :created, location: @build }\n else\n format.html { render action: \"new\" }\n format.json { render json: @build.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @revision = args[:revision] if args.key?(:revision)\n @service = args[:service] if args.key?(:service)\n @service_urls = args[:service_urls] if args.key?(:service_urls)\n end", "def buildlog_updated?\n old_buildlog = buildlog\n update_buildlog\n buildlog && buildlog != old_buildlog\n end", "def update!(**args)\n @status = args[:status] if args.key?(:status)\n @version = args[:version] if args.key?(:version)\n end", "def update_version\n if (VersionControl.any?) \n obj = VersionControl.all.first\n else\n obj = VersionControl.create(version: 3.0)\n end\n\n obj.version += 0.1\n obj.save\n end", "def save_builds\n filtered_builds.each do |build|\n b = Build.new\n b.build_number = build['build_num']\n b.user = build['committer_name']\n b.stop_time = build['stop_time']\n b.queued_at = build['queued_at']\n b.build_time = build['build_time_millis']\n b.save\n end\n end" ]
[ "0.64575064", "0.6409246", "0.6197418", "0.6129657", "0.60455304", "0.60054934", "0.59535253", "0.5953092", "0.5916657", "0.5863953", "0.585549", "0.585549", "0.5829684", "0.5796988", "0.5760256", "0.5744043", "0.5732501", "0.57074934", "0.57074934", "0.57074934", "0.57074934", "0.57074934", "0.5695426", "0.56917554", "0.5660436", "0.5643234", "0.5638567", "0.56337976", "0.5633114", "0.5628332", "0.56272733", "0.5618467", "0.56062216", "0.557769", "0.5569784", "0.55561477", "0.5538259", "0.5536506", "0.5536506", "0.5521368", "0.5495", "0.5477393", "0.547149", "0.5445465", "0.5420811", "0.53846246", "0.53681064", "0.5362618", "0.5326687", "0.53125834", "0.5301973", "0.5283035", "0.52786064", "0.5274075", "0.5268087", "0.5268087", "0.5258447", "0.52448875", "0.5241545", "0.5241005", "0.5241005", "0.5231218", "0.5221697", "0.5216336", "0.52158695", "0.5215005", "0.52137244", "0.5212792", "0.52126247", "0.520778", "0.51890284", "0.51883775", "0.5180992", "0.51709676", "0.51647156", "0.5163626", "0.51534647", "0.51534647", "0.51534647", "0.5147103", "0.5128409", "0.51203734", "0.51203734", "0.51135844", "0.51089", "0.51077974", "0.5104899", "0.51018727", "0.50997764", "0.5097845", "0.50957054", "0.5094141", "0.5093486", "0.5091923", "0.5085991", "0.50664675", "0.5060497", "0.5056071", "0.5053497", "0.5041305" ]
0.64793015
0
For output purposes, use "puts" instead of "print" or "p"
def meal_choice(op1, op2, op3 = "tofu") puts"What a nutritious meal!" meal = "A plate of #{op3} with #{op1} and #{op2}." puts meal meal end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def puts\n end", "def puts(*strs); $stdout.puts(*strs) if ENV['DEBUG'] end", "def puts( *args )\n @output.puts(*args)\n end", "def pout(str)\n print str\n $stdout.flush\nend", "def puts(str='')\n output(str)\n end", "def puts *args\n @output.puts(*args)\n end", "def print(*args)\n s = \"\"\n args.each { |arg| s << arg.to_s }\n do_write(s)\n nil\n end", "def sprint *args\r\n print(*args)\r\n puts\r\n end", "def print\r\n puts self.output\r\n end", "def puts(*args)\n @output.puts(*args)\n end", "def print( *args )\n @output.print(*args)\n end", "def output(o);printf o;end", "def puts(*par)\n io = par.first.is_a?(IO) ? par.shift : $stdout\n io.puts(*par)\n end", "def real_puts message = \"\"\n $stdout.puts message\n end", "def pputs(*args)\n puts args.map { |item| pretty item }\nend", "def puts(msg = '')\n print(\"#{msg}\\n\")\n end", "def print(*options)\n stdoutput.print(*options)\n end", "def printResult(result)\r\n puts\r\n puts \" Least number of times you can copy paste a \"\r\n puts \" print statement: #{result}\"\r\n puts \"======================== END ========================\\n\\n\"\r\nend", "def puts(string)\n print \"#{string}\\n\"\nend", "def print(text)\n @output += %(#{text}\\n)\n puts text\n end", "def stdout; end", "def stdout; end", "def stdout; end", "def stdout; end", "def stdout; end", "def stdout; end", "def print_name(name)\n p \"Get out of my house #{name}!\"\nend", "def print(message)\n output.print(message)\n end", "def puts(message)\n output.puts(message)\n end", "def puts(*args)\n i = 0\n len = args.size\n while i < len\n s = args[i].to_s\n __printstr__ s\n __printstr__ \"\\n\" if (s[-1] != \"\\n\")\n i += 1\n end\n __printstr__ \"\\n\" if len == 0\n nil\n end", "def say(output)\n puts \"===> #{output} <===\"\nend", "def print\n end", "def puts(str)\nend", "def puts(message); end", "def stdouts; end", "def print\n end", "def print\n end", "def print\n end", "def print\n puts @text\n end", "def print\n return ''\n end", "def out(*args) print(*(args + [\"\\r\\n\"])) end", "def print\n\n end", "def print\n\t\tputs name + ' ' + className + \" just \" + move + \" and said \" + call\n\tend", "def puts(s)\n $output = s\nend", "def output(text)\n puts text\n end", "def print(*par)\n io = par.first.is_a?(IO) ? par.shift : $stdout\n io.print(*par)\n end", "def puts message\n print \">> \" + message +\"\\n\"\nend", "def puts(str = \"\")\n # {{{\n self.print(str + \"\\n\")\n # }}}\n end", "def print\n puts string\n end", "def printf\n end", "def print\r\n\t\tputs name + \" \" + className + \" says \" + call\r\n\tend", "def disp_progres\n print '.'\nend", "def printing\n \n # \"print\" print data in console without linebrean by default\n print \"HELLO WORLD! \"\n # \"puts\" print data in console with linebreak\n puts \"Hello World!\"\n puts 2+2\n\n#\"end\" finalize the function \nend", "def puts(arg)\n @io.puts(arg)\n end", "def print(text)\n Kernel.print(text)\n $stdout.flush\n end", "def print\n puts to_s\n end", "def print(message); end", "def print(message); end", "def display(msg)\n puts\n puts msg\n end", "def puts object = ''\n TetCore.break_after_print\n TetCore.real_puts(object)\nend", "def print\n\t\tputs name + \" \" + className + \" says \" + call\n\tend", "def this_output_twice\n print \"Calling print or puts\"\nend", "def output( line )\n puts( line ) \n end", "def print\r\n puts name + \" \" + className + \" says \" + \"\\\"\" + call + \"\\\"\"\r\n end", "def puts(*text)\n ostream.puts(*text)\n end", "def pp(message)\n puts \"[#{NAME}] #{message}\"\nend", "def puts(*args)\n args.each do |obj|\n self.write \"#{obj.to_s.sub(/\\n$/, '')}\\n\"\n flush\n end\n end", "def puts(*args) @mutex.synchronize { Kernel.puts(*args) } end", "def internal_puts( *msg )\n puts *msg if verbose\n end", "def puts(message)\n @out.puts message\n end", "def puts(*args)\nend", "def print_stdout(msg)\n puts \" #{msg}\"\n end", "def puts(*args)\n s = \"\"\n if args.empty?\n s << \"\\n\"\n end\n\n args.each do |arg|\n s << arg.to_s\n if $/ && /\\n\\z/ !~ s\n s << \"\\n\"\n end\n end\n\n do_write(s)\n nil\n end", "def testOutput\n\t\tputs @health\n\t\tputs @total_mana\n\t\tputs @remaining_mana\n\t\tputs @side\n\t\tp @hand\n\tend", "def puts! args, label=\"\"\n puts \"+++ +++ #{label}\"\n puts args.inspect\nend", "def display\n puts @o\n puts @a\n puts @b\n puts @c\n puts @d\n puts @e\n puts @f\n puts @g\n puts @h\n puts @i\n puts \" \"\n end", "def output text\n puts text\n end", "def v_puts(msg)\n puts msg if @options[:verbose]\n end", "def puts(*args)\n page_stdout\n super\n end", "def print(*args)\n @stdin.print(*args)\n end", "def outtoconsole(things)\n\tsep = \" -> \"\n\tprint things.join(sep).to_s + \"\\n\"\nend", "def puts(string)\n self.print(string + \"\\n\")\n end", "def puts(string)\n self.print(string + \"\\n\")\n end", "def print(s)\n wipe\n scope.output.call(s)\n end", "def puts (msg)\n $stderr.puts msg\n end", "def test_print?\n c = cli\n refute(c.print?)\n\n c = cli(['-p'])\n assert(c.print?)\n end", "def sysout(string)\n\tputs (\"[SYSTEM]: \" + string) \nend", "def sysout(string)\n\tputs (\"[SYSTEM]: \" + string) \nend", "def print_name(name)\n p \"Your name is #{name}\"\nend", "def print\n puts \"#{name} #{class_name} just #{movement} and said, \\\"#{call}\\\"\"\n end", "def puts(*rest) end", "def puts(*rest) end", "def puts(*rest) end", "def puts(*rest) end", "def print(*args)\n args.each do |a|\n io << a\n end\n end", "def print\n\t\tputs \"(#{@x},\" + \"#{@y})\"\n\tend", "def print_script(os = $stdout)\n @initial.each { |str| os.puts \"initial: #{str}\" }\n @final.each { |str| os.puts \"final: #{str}\" }\n @quit.each { |str| os.puts \"quit: #{str}\" }\n @pre.each { |src,dest| os.puts \"pre: #{src} #{dest}\" }\n @post.each { |src,dest| os.puts \"post: #{src} #{dest}\" }\n @synons.values.each { |arr| os.puts \"synon: #{arr.join(' ')}\" }\n @keys.values.each { |key| key.print(os) }\n end", "def sputs(str)\n puts str unless @simple_output\n end", "def dputs(message)\n puts message\nend", "def print(*args)\n args.join()\n end", "def output\n puts \"Name: #{@name}\"\n puts \"Email: #{@email}\"\n puts \"Phone: #{@phone}\"\n puts \"Title: #{@title}\"\n end" ]
[ "0.7546392", "0.73657894", "0.7291295", "0.7291051", "0.725948", "0.72567075", "0.72204983", "0.7209738", "0.71434444", "0.71417135", "0.71281224", "0.7107793", "0.70547396", "0.7041029", "0.7038998", "0.69841146", "0.69649035", "0.6944776", "0.69404733", "0.69336826", "0.69140965", "0.69140965", "0.69140965", "0.69140965", "0.69140965", "0.69140965", "0.68938714", "0.68826014", "0.68770134", "0.68755126", "0.6872595", "0.6864562", "0.6858906", "0.68270785", "0.6823508", "0.68167436", "0.68167436", "0.68167436", "0.6816429", "0.6803574", "0.68020964", "0.6794686", "0.678912", "0.6788328", "0.6786686", "0.67682016", "0.6764668", "0.6754889", "0.6748165", "0.67347425", "0.6734348", "0.6733749", "0.6727073", "0.6726488", "0.67233235", "0.6718376", "0.67131466", "0.67131466", "0.6712039", "0.6709854", "0.66967285", "0.66927224", "0.66919684", "0.668384", "0.668124", "0.6678153", "0.6671093", "0.66537374", "0.6652021", "0.66442937", "0.6642082", "0.6620288", "0.6614022", "0.66085434", "0.6605325", "0.65965116", "0.659576", "0.65918183", "0.6575574", "0.65549546", "0.6547569", "0.65359867", "0.65359867", "0.6534067", "0.6529267", "0.6526742", "0.65142727", "0.65142727", "0.6507705", "0.65063006", "0.650165", "0.650165", "0.650165", "0.650165", "0.65002847", "0.6485549", "0.6480879", "0.64786977", "0.64729166", "0.6470335", "0.6461674" ]
0.0
-1
returns how many courts of the sport passed as parameter the club has if no parameter is sent it passes all quantities
def court_quantity sport=nil if @sports.blank? @sports = self.courts.includes(:sport).map {|c| c.sport.name } end qty_hash = Hash.new 0 @sports.each do |sp| qty_hash[sp.downcase] += 1 end return qty_hash[sport.downcase] unless sport.blank? qty_hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def goals_against(club)\n if finished?\n if club == local\n return guest_goals\n end\n\n if club == guest\n return local_goals\n end\n end\n\n 0\n end", "def create_courts\n futbol = Sport.where(:name => 'futbol').first\n tenis = Sport.where(:name => 'tenis').first\n paddle = Sport.where(:name => 'paddle').first\n\n # court_quantity '*' indicates how many courts already has\n # @*_quantity indicates how many tha user wants\n\n ### Futbol Courts\n diffFutbol = court_quantity('futbol') - @futbol_quantity.to_i \n\n if(diffFutbol > 0)\n diffFutbol.times { self.courts.delete(self.courts.where('sport_id = ?',futbol.id).last)}\n end\n\n if(diffFutbol < 0)\n diffFutbol.abs.times { self.courts.build sport_id: futbol.id }\n end\n\n\n ### Tenis Courts\n\n diffTenis = court_quantity('tenis') - @tenis_quantity.to_i \n\n if(diffTenis > 0)\n diffTenis.times { self.courts.delete(self.courts.where('sport_id = ?',tenis.id).last)}\n end\n\n if(diffTenis < 0)\n diffTenis.abs.times { self.courts.build sport_id: tenis.id }\n end\n\n ### Paddle Courts\n\n diffPaddle = court_quantity('paddle') - @paddle_quantity.to_i \n\n if(diffPaddle > 0)\n diffPaddle.times { self.courts.delete(self.courts.where('sport_id = ?',paddle.id).last)}\n end\n\n if(diffPaddle < 0)\n diffPaddle.abs.times { self.courts.build sport_id: paddle.id }\n end \n end", "def mot_m_total(params = { season: Date.current.year })\n if params[:season]\n (mot_m_firsts.select { |x| x.match.season == params[:season] }.length * 3) + (mot_m_seconds.select { |x| x.match.season == params[:season] }.length * 2) + (mot_m_thirds.select { |x| x.match.season == params[:season] }.length * 1)\n else\n (mot_m_firsts.select { |x| x.match_id.in? [params[:match_id]].flatten }.length * 3) + (mot_m_seconds.select { |x| x.match_id.in? [params[:match_id]].flatten }.length * 2) + (mot_m_thirds.select { |x| x.match_id.in? [params[:match_id]].flatten }.length * 1)\n end\n end", "def goals_against_season(round, season = nil)\n count = 0\n matchs = find_matchs(round, season)\n\n matchs.each do |match|\n count += match.goals_against(self) if match.finished?\n end\n\n count\n end", "def count_contestants_by_hometown(data, hometown)\n all_seasons(data).reduce(0) do |sum, contestant|\n if contestant[\"hometown\"] == hometown \n sum + 1 \n else \n sum \n end\n end\nend", "def power_play_goal_percentage(seasonasstring) # power_play info in game team stat\n #find list of all games in season given by arg\n #sum all power play goals\n #sum all power play oppertunities\n #divide line 146 and line 147\n #return total of above\n end", "def total_score(play)\n sum = 0;\n play.decision_array.each_with_index{|v, i|\n sum += 1 if v == decision_array[i] && i != 0 # exclude an example\n }\n sum\n end", "def matchup_count(season = 2015)\n r = Record.find_by(team_id: self.id, year: season)\n r.wins + r.losses + r.ties\n end", "def sports_available(include_all)\n grades_available(include_all).collect(&:sport).uniq\n end", "def shoe_size (player_name)\n shoe_answer = nil\n game_hash.each do |team, all_info_hash|\n players_array = all_info_hash[:players]\n players_array.each do |player_information_hash|\n if player_information_hash[:player_name] == player_name\n shoe_answer = player_information_hash[:shoe]\n end\n end\n end\n shoe_answer\nend", "def competitive_teams\n res = 0\n @teams.each { |team| res += 1 unless TeamLevel.is_primary?(team.team_level) }\n res\n end", "def num_possible\n @possible\n end", "def total_num_assignment_teams\n assignment_team_counts.inject(:+)\n end", "def cult_population\n by_cult.count\n end", "def count_contestants_by_hometown(data, hometown)\n counter = 0\n data.each do |season_hash, info|\n info.each do |detail|\n if detail[\"hometown\"] == hometown\n counter += 1 \n end\n end\n end\n return counter\nend", "def winningest_coach(seasonasstring) # coach name in game team stats\n #per season, get list of all coaches - given by arg\n #per coach, find all games played by that coach\n #then count of all games won / count of all games played\n #find highest\n #return name of coach found in 114\n end", "def points_season(round, season = nil)\n count = 0\n matchs = find_matchs(round, season)\n\n matchs.each do |match|\n if match.is_winner?(self) and match.finished?\n count += MatchGeneral::PT_WIN\n end\n if match.deal? and match.finished?\n count += MatchGeneral::PT_DEAL\n end\n end\n\n count\n end", "def shoe_size(player_n)\n game_hash.each do |home_away, keys|\n keys[:players].each do |player|\n return player[:shoe] if player[:player_name] == player_n\n end\n end\nend", "def num_points_scored (sportsman)\ngame_hash\nscores = 0\n game_hash.each do |team_position, team_data|\n team_data.each do | player_name, information|\n # binding.pry\n if player_name == :players \n information.each do |name, numbers|\n #binding.pry\n if name == sportsman \n numbers.each do |key, value|\n #binding.pry\n if key == :points\n #binding.pry\n return scores = value.to_i\n #binding.pry\n end\n end\n end\n end\n end\n end\n end \n #return scores\n end", "def goals_against()\n\t self.as_regular_contestants.select{|c| c.opponent.score}.collect{|c| c.opponent.score}.inject{|gf, c| gf + c} || 0\n\tend", "def shoe_size(player_name)\n result = nil\n game_hash.each do |team, about|\n about[:players].each do |name, stats|\n if player_name == name\n result = stats[:shoe]\n end\n end\n end\n result\nend", "def num_district_teams\n num_teams = 0\n novice_division = Division.find_by_name('District Novice')\n experienced_division = Division.find_by_name('District Experienced')\n teams.each do |team|\n if team.division == novice_division or team.division == experienced_division\n if team.team_registration.complete?\n num_teams += 1\n end\n end\n end\n num_teams\n end", "def shoe_size(player)\n\tshoe_size = nil\n\tmy_hash = game_hash\n\tmy_hash.each do |home_or_away, data|\n\t\tdata.each do |attribute, more_data|\n\t\t\tif attribute == :players\n\t\t\t\tmore_data.each do |person|\n\t\t\t\t\tperson.each do |name, stats|\n\t\t\t\t\t\tshoe_size = stats[:shoe] if name == player\n\t\t\t\t\tend\n\t\t\t\tend \n\t\t\tend\n\t\tend\n\tend \n\tshoe_size\nend", "def get_total_games_played\n return games.size\n end", "def get_cout_total_produits\n\t sum = 0\n\t self.putoparcelles.each do |putoparcelle|\n \t\tputoparcelle.pulve.putoproduits.each do |putoproduit|\n \t\t\tsum += putoproduit.get_cout_total_parcelle(self)\n end\n end\n sum\n end", "def shoe_size(player_name)\n player_shoe_size = nil\n game_hash.each do |team, team_stats|\n team_stats[:players].each do |player_stats|\n if player_stats[:player_name] == player_name\n player_shoe_size = player_stats[:shoe]\n end\n end\n end\n player_shoe_size\nend", "def total_games_by_coach_by_season\n @total_games_by_coach = Hash.new{ |hash, key| hash[key] = 0}\n @by_season_game_team_objects.each do |game_by_season|\n @total_games_by_coach[game_by_season[\"head_coach\"]] += 1\n end\n end", "def count_item(food_item, cart)\n cart.select { |groceries| groceries.has_key?(food_item) }.count\nend", "def sum_produits_used\n sum = 0\n self.protofactures.each { |p| sum += p.prix_unit * (p.quantite - p.stock) }\n sum\n end", "def total_card_combs(star_counter)\n c = 0\n star_counter.each { |num_of_stars| c += prmutation(5) * cmbnation(num_of_stars) if num_of_stars > 4 }\n return c\nend", "def get_total_games_played\n\t\treturn games.size\n\tend", "def goals_favor(club)\n if finished?\n\n if club == local\n return local_goals\n end\n\n if club == guest\n return guest_goals\n end\n end\n\n 0\n end", "def total_workouts\n set_sport_by_user.count || 0\n end", "def shoe_size (player_name)\n lookup_by_player(player_name)[:shoe]; \nend", "def sum_of_a_beach (beach)\n (beach.scan(/sand|water|fish|sun/i) || []).length\nend", "def goals_favor_season(round, season = nil)\n count = 0\n matchs = find_matchs(round, season)\n\n matchs.each do |match|\n count += match.goals_favor(self) if match.finished?\n end\n\n count\n end", "def spicy_count\n self.spicies.size\n end", "def stock_count(shop)\n shop[:pets].length \nend", "def total_cost\n# Get the total cost of a specific lifter's gym memberships\n membs_cost = memberships.map{|membership|membership.cost}\n cost_total = membs_cost.inject(:+)\n end", "def num_points_scored (player_name)\n game_hash.each do |place_name, team|\n \n team[:players].each do |player|\n \n if player[:player_name] == player_name\n return player[:points]\n end\n \n end\n \n end\n\n nba_match\nend", "def played_matchs_season(round, season = nil)\n count = 0\n matchs = find_matchs(round, season)\n\n matchs.each do |match|\n if match.finished?\n count += 1\n end\n end\n count\n end", "def total_count\n @total_count ||= @possibility_distribution.inject(0) { |sum, n| sum + n.last }\n end", "def shoe_size(name)\n game_hash.each do |team, attributes|\n if game_hash[team][:players][name]\n return game_hash[team][:players][name][:shoe]\n end\n end\n end", "def shoe_size(name)\n answer = nil\n\n game_hash.each do |team, details_hash|\n # binding.pry\n players_array = details_hash[:players]\n players_array.each do |player, player_details_hash|\n #binding.pry\n if player == name\n answer = player_details_hash[:shoe]\n end\n end\n end\n answer.to_i\nend", "def stock_count(shop)\n return shop[:pets].length\nend", "def stock_count(shop)\n return shop[:pets].length\nend", "def count_contestants_by_hometown(data, hometown)\n counter = 0 # COUNTER VALUE HAS TO BE HERE\n data.each do |season, season_array|\n season_array.each do |into_array|\n if into_array[\"hometown\"] == hometown\n counter += 1\n # binding.pry\n end \n end \n end\n counter\nend", "def find_total_rides(rides)\n length = rides.length\n return length\nend", "def shoe_size(player_name)\n game_hash.each do |team, team_data|\n team_data[:players].each do |this_player, player_data|\n if player_name == this_player\n return player_data[:shoe]\n end\n end\n end\nend", "def compute_best_score(team, pilots, pilot_contests)\n combination = []\n total = 0.0\n total_possible = 0\n puts 'compute_score TBD'\nend", "def count\n\n Sizetype.find_all_by_godown_id_and_company_id(1,1).each do |h|\n unless h.quantity.nil?\n @count += h.quantity\n end\n end \n end", "def shoe_size(player_name)\n game_hash.each do |place, team|\n team.each do |attribute, data|\n if attribute == :players \n data.each do |player|\n if player[:player_name]== player_name\n return player[:shoe]\n end\n end\n end\n end\n end\nend", "def num_points_scored(player)\n game_hash.each do |location, team_data| #location returns away, team_data returns hash\n # binding.pry\n team_data.each do |attribute, data|\n # binding.pry\n if attribute == :players\n data.each do |player_name, categories|\n # binding.pry\n if player_name == player\n # binding.pry\n return categories[:points]\n end\n end\n end\n end\n end\nend", "def shoe_size(name)\n game_hash.each do |location, attributes|\n attributes[:players].each do |player, stats|\n if player == name\n return stats[:shoe]\n end\n end\n end\nend", "def shoe_size(name)\n game_hash.each do |place, team|\n team.each do |attribute, data|\n if attribute == :players\n data.each do |player|\n if name == player[:player_name] \n return player[:shoe] \n end\n end\n end\n end\n end\nend", "def stock_count(stock_number)\n return stock_number [:pets].count\nend", "def shoe_size(name)\n game_hash.each do |team, team_data|\n team_data[:players].each do |player_name, player_data|\n if player_name == name\n return player_data[:shoe]\n end\n end\n end\nend", "def howManyGames(p, d, m, s)\n n = (p-m)/d\n dp = [p]git\n i = 1\n j = 0\n n.times do \n dp << p - (d*i)\n i += 1 \n end \n\n total = dp.sum\n if s > total\n purchased_at_min = (s-total)/m\n end\n \n if s < p\n result = 0\n elsif s < total\n sum = p\n dps = [p]\n i = 1\n if s - p > d\n result = 1\n else\n dp.each do |v|\n sum += v\n dps << p - (d*i)\n i += 1\n break if sum > s\n end\n end\n result = dps.length\n \n else \n result = dp.length+purchased_at_min\n end\n result\nend", "def num_possible\n return -1 if filled?\n\n @possible.size\n end", "def total_students(students)\n\ttotal = 0\n\tstudents.each do |cohort, number| \n\t\ttotal += number.to_i\n\tend\n\tputs total\nend", "def agreed_with_community\n responses = self.responses\n count = 0\n responses.each do |response|\n #count += 1 if response.verdict == response.question.get_community_verdict\n count += 1 if response.question.get_community_verdict(response.verdict)\n end\n return count\n end", "def num_points_scored(player_name)\npoints_scored = 0\ngame_hash.each do |location, team_data|\n team_data.each do |attribute, data|\n if attribute == :players\n data.each do |player, stats|\n if player == player_name\n points_scored = stats[:points]\n end\n end\n end\n end\nend\npoints_scored\nend", "def num_points_scored(player_lookup) \n game_hash.each do |location, team_data|\n#return the number of points scored for that player\n team_data[:players].each do |player|\n if player[:player_name] == player_lookup\n return player[:points]\n end\n end\n end\nend", "def player_shoe_size(player, hashketball)\r\n player.capitalize!\r\n if hashketball[:home][:players].include?(player)\r\n hashketball[:home][:players][player][:shoe_size]\r\n elsif hashketball[:away][:players].include?(player)\r\n hashketball[:away][:players][player][:shoe_size]\r\n else\r\n \"No player found.\"\r\n end\r\nend", "def win_matchs_season(round, season = nil)\n count = 0\n matchs = find_matchs(round, season)\n\n matchs.each do |match|\n if match.is_winner?(self) and match.finished?\n count += 1\n end\n end\n count\n end", "def get_cout_ha_produits\n\t sum = 0\n\t self.putoparcelles.each do |putoparcelle|\n \t\tputoparcelle.pulve.putoproduits.each do |putoproduit|\n \t\t\tsum += putoproduit.get_cout_ha_parcelle(self)\n end\n end\n sum\n end", "def goals_for()\n\t self.as_regular_contestants.select{|c| c.score}.collect{|c| c.score}.inject{|gf, c| gf + c} || 0\n\tend", "def shoe_size(playerName)\n player_stats(playerName)[:shoe]\nend", "def wins()\n\t\tself.as_regular_contestants.select{|c| c.win()}.size()\n\tend", "def shoe_size(player_name)\n game_hash.each do |team, team_stats|\n team_stats[:players].each do |player|\n \n if player[:player_name] == player_name\n return player[:shoe]\n end\n end\n end\nend", "def cult_population\n BloodOath.all.find_all do |oath|\n oath.cult == self\n end.size\n end", "def avarage_calories_burned\n total_workout_calories / set_sport_by_user.count\n rescue\n 0\n end", "def gym_cost\n \t\tgym_cost = memberships.map{|member|member.cost}\n \t\tgym_cost.sum\n end", "def shoe_size(player_name)\n game_hash.each do |location, team_data|\n team_data.each do |attribute, values|\n if attribute == :players\n values.each do |person, data|\n if person.to_s == player_name\n return game_hash[location][:players][person][:shoe]\n end\n end\n end\n end\n end\nend", "def score_factor_count\n com_count = self.complaints.finished.count\n dep_review_count = count_scorable_department_reviews\n city_review_count = count_scorable_city_reviews\n petition_count = self.petitions.finished.count\n return score_count = com_count + dep_review_count + city_review_count + petition_count\n end", "def shoe_size(name)\n game_hash.each do |location, team_data|\n team_data[:players].each do |player_name, data|\n if player_name == name\n return data[:shoe]\n end\n end\n end\nend", "def shoe_size(player)\n shoe_size = 0\n game_hash[:home][:players].each do |player_name, player_info_hash|\n # player_name = home game player names string(key), player_info_hash = player_info_hash = :number, :shoe, :points, :rebounds, :assists, :steals, :blocks, :slam_dunks\n if player == player_name\n\t\t\tshoe_size = player_info_hash[:shoe]\n\t\tend\n\tend\n\tgame_hash[:away][:players].each do |player_name, player_info_hash|\n\t\tif player == player_name\n\t\t\tshoe_size = player_info_hash[:shoe]\n\t\tend\n\tend\n\tshoe_size\nend", "def count_of_games_by_season\n games_by_season = @games.group_by { |game| game.season.to_s }\n games_by_season.each { |season, games| games_by_season[season] = games.count }\n end", "def stock_count(shop)\n return shop[:pets].length\nend", "def shoe_size (name=\"Jeff Adrien\")\n size = 0\n if(game_hash[:home][:players].keys.include?(name))\n size= game_hash[:home][:players][name][:shoe]\n elsif (game_hash[:away][:players].keys.include?(name))\n size = game_hash[:away][:players][name][:shoe]\n else\n size\n end\nend", "def cult_population\n BloodOath.all.select{|bo| bo.cult == self}.length\n end", "def shoe_size(player_name)\n player_shoe_size = 0\n game_hash.each do |team,info|\n info.each do |team_info,team_data|\n if team_data.is_a? (Array) \n if team_info != :colors\n team_data.find do |player_index|\n if player_index[:player_name] == player_name\n player_shoe_size = player_index[:shoe]\n end\n end\n end\n end\n end\n end\n player_shoe_size\nend", "def number_correct_by_category(category_arg)\n # correct_category = []\n #\n # @turns.each do {|turn|turn.card.category == category_arg}\n #\n # correct_category << turn\n\n # end\n # correct_category.count\n\n # correct_guess = []\n\n # correct_guesses_in_category = @turns.each { |turn| turn.correct? && turn.card.category == category_arg}.count\n correct_guesses_in_category = []\n @turns.each do |turn|\n correct_guesses_in_category << turn if turn.correct? && turn.card.category == category_arg\n end\n correct_guesses_in_category.count\n\n end", "def get_num_courses_for_department(valid_department)\r\n valid_department.courses.count\r\n end", "def count_contestants_by_hometown(data, hometown)\n counter = 0\n data.each do |season, person| \n person.each do |person_data|\n if person_data[\"hometown\"] == hometown\n counter += 1\n end \n end\n end\n counter\nend", "def big_shoe_rebounds\n big_shoe = 0\n result = 0\n game_hash.each do |team, about|\n about[:players].each do |name , stats|\n stats.each do |stat, value|\n if stat == :shoe\n if big_shoe < value \n result = stats[:rebounds]\n big_shoe = value\n end\n end\n end\n end\n end\n result\nend", "def shoe_size(player_name)\n game_hash.values.each do |team|\n team[:players].each do |player|\n return player[:shoe] if player.has_value?(player_name)\n end\n end\nend", "def compute_qualification(team, pilots, pilot_contests)\n if 3 <= pilots.size\n contests_properties = gather_contest_properties(pilot_contests)\n non_primary_participant_occurrence_count = 0\n three_or_more_pilot_occurrence_count = 0\n contests_properties.each do |contest|\n non_primary_participant_occurrence_count += 1 if contest[:has_non_primary]\n three_or_more_pilot_occurrence_count += 1 if 3 <= contest[:pilot_count]\n end\n team.qualified = 3 <= non_primary_participant_occurrence_count &&\n 3 <= three_or_more_pilot_occurrence_count\n else\n team.qualified = false\n end\nend", "def shoe_size(player_name)\n # Hash # String #Symbol\n found_player(player_name)[:shoe] # Number\nend", "def shoe_size(player_name)\n # Hash # String #Symbol\n found_player(player_name)[:shoe] # Number\nend", "def exercise1\n parse_data\n passports.count(&:valid?)\n end", "def total_score\n\t\tall_scores = picks.collect { |pick|\n\t\t\tpicks_golfers = TournamentGolfer.where(golfer_id: pick.golfer_id, tournament_id: pick.pool.tournament_id).pluck(:total)[0]\n\t\t} - [nil] - [\"CUT\"]\n\t\tif all_scores.count < 5\n\t\t\treturn \"DQ\"\n\t\telse \n\t\t\tall_scores = all_scores.map {|score| score.to_i}\n\t\t\tall_scores = all_scores.sort\n\t\t\treturn all_scores[0..(pool.number_golfers_for_scoring-1)].sum\n\t\tend\n\tend", "def how_many\n return @@total_samurais\n end", "def games_played\n self.results.to_a.count\n end", "def expected_submissions\n deliverables.count * course.students.count\n end", "def shoe_size(player_name)\n # get list of players\n players = get_players\n # find player with matching name\n found_player = find_player(players, player_name)\n # return player's shoe size\n found_player[:shoe]\nend", "def most_expensive_player_on_team \n\n the_club = choose_club #user chooses club they want to see most expensive player for\n my_club = Club.find_by(name: the_club) #use class instance find_by to find the instance of club with the name provided by user (the_club)\n club_players = my_club.players.sort_by do |player| #loops through instance of club and sorts the players by their market value (remember to change market_value from string to integer)\n player.market_value.to_i\n end\n\n most_expensive_player = club_players.last #in ascending order the last item of the sorted array is the player with the highest market value\n puts \"#{the_club}'s most expensive player is #{most_expensive_player.name}. He is worth £#{most_expensive_player.market_value}M\"\n #the_club --> user choice of club name\n #most_expensive_player.name --> use the_club name to find the specific instance of Club class. \n #Use \".players\" method to find all player instances of that specifc club (the instances of players that \n #belong to that instance of club). Use \".name\" method to retrieve attribute \"name\" of player instance. \n #Use \".market_value\" to retrieve attribute \"market_value\" of the player instance. \n\nend", "def total_points\n\n points = 0\n wattball_matches_as_team1.each do |match|\n points += match.points(1) || 0\n end\n\n wattball_matches_as_team2.each do |match|\n points += match.points(2) || 0\n end\n\n points\n end", "def shoe_size(player)\n game_hash.each do |k, team|\n team[:players].each do |e|\n if e[:player_name] == player\n return e[:shoe]\n end\n end\n end\nend", "def user_score\n total_score = 0\n score.each do |_phase, categories|\n total_score += categories.reject { |category| category.include? \"oath\" }.count { |category| category[1] >= 80 }\n end\n total_score\n end" ]
[ "0.5965146", "0.5913507", "0.5863452", "0.5840749", "0.5828044", "0.58008087", "0.57821935", "0.57807285", "0.56624246", "0.56365997", "0.5624656", "0.5619406", "0.5609873", "0.5599306", "0.5599264", "0.5598247", "0.5598211", "0.5577597", "0.5572854", "0.5563775", "0.55564755", "0.5543555", "0.5542837", "0.5527059", "0.5496299", "0.54738396", "0.5464663", "0.5461919", "0.54575896", "0.5454259", "0.544224", "0.54410875", "0.5441051", "0.54405415", "0.54365", "0.5428146", "0.5426086", "0.54251546", "0.5420746", "0.5420313", "0.54188156", "0.5410626", "0.5409155", "0.54053754", "0.54021066", "0.54021066", "0.5401735", "0.5401064", "0.5400278", "0.5400035", "0.5398234", "0.53964585", "0.5395355", "0.53923696", "0.5392287", "0.5391006", "0.5389042", "0.5388663", "0.53876275", "0.5386883", "0.537847", "0.53772163", "0.5376668", "0.537579", "0.5375387", "0.53753436", "0.53740215", "0.53723484", "0.53709716", "0.5369806", "0.53692937", "0.53673744", "0.5364207", "0.53629047", "0.5361487", "0.5359258", "0.5358897", "0.5358657", "0.53583175", "0.53571767", "0.53559095", "0.5352007", "0.53461915", "0.534196", "0.53404117", "0.53357124", "0.5332111", "0.532623", "0.532575", "0.532575", "0.5319999", "0.53185344", "0.5318127", "0.53147244", "0.531223", "0.53013176", "0.52979714", "0.5297438", "0.5293255", "0.52914405" ]
0.7287886
0
Creates or destroy courts to match the quantity indicated by the user Can be refactored
def create_courts futbol = Sport.where(:name => 'futbol').first tenis = Sport.where(:name => 'tenis').first paddle = Sport.where(:name => 'paddle').first # court_quantity '*' indicates how many courts already has # @*_quantity indicates how many tha user wants ### Futbol Courts diffFutbol = court_quantity('futbol') - @futbol_quantity.to_i if(diffFutbol > 0) diffFutbol.times { self.courts.delete(self.courts.where('sport_id = ?',futbol.id).last)} end if(diffFutbol < 0) diffFutbol.abs.times { self.courts.build sport_id: futbol.id } end ### Tenis Courts diffTenis = court_quantity('tenis') - @tenis_quantity.to_i if(diffTenis > 0) diffTenis.times { self.courts.delete(self.courts.where('sport_id = ?',tenis.id).last)} end if(diffTenis < 0) diffTenis.abs.times { self.courts.build sport_id: tenis.id } end ### Paddle Courts diffPaddle = court_quantity('paddle') - @paddle_quantity.to_i if(diffPaddle > 0) diffPaddle.times { self.courts.delete(self.courts.where('sport_id = ?',paddle.id).last)} end if(diffPaddle < 0) diffPaddle.abs.times { self.courts.build sport_id: paddle.id } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n \n params[:cour][:ecole_id] = ecole.id if ecole?\n\n #Ajout de la classe en groupe\n params[:cour][:classe_room_id].unshift(params[:cour][:first_classe_room_id])\n\n @creneau = params[:cour][:creneau_debut].to_i \n @nombre_heure = params[:cour][:creneau_fin].to_i - params[:cour][:creneau_debut].to_i + 1\n @classe_rooms = params[:cour][:classe_room_id]\n\n # Enregistrement des cours pour chaque creneau\n @nombre_heure.times do \n # Enregistrement pour chaque chaque par creneau\n @classe_rooms.size.times do |i|\n @cour = current_user.cours.create(enseignant_id: params[:cour][:enseignant_id], matiere_id: params[:cour][:matiere_id], salle_id: params[:cour][:salle_id], creneau_id: @creneau, jour_id: params[:cour][:jour_id], nombre_heure: @nombre_heure, annee_id: params[:cour][:annee_id], ecole_id: params[:cour][:ecole_id], semestre_id: params[:cour][:annee_id], classe_room_id: @classe_rooms[i])\n end\n @creneau = @creneau + 1\n end\n\n\n respond_to do |format|\n if @cour\n format.html { redirect_to @cour, notice: 'Cours was successfully created.' }\n format.json { render :show, status: :created, location: @cour }\n else\n format.html { render :new }\n format.json { render json: @cour.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n exist = false\n current_user.carts.each do |c|\n if c.item == cart_params.fetch(\"item\")\n exist = true\n break\n end\n end\n if !exist \n @cart = current_user.carts.new(cart_params)\n else\n @cart = User.new.carts.new\n end\n if @cart.save\n redirect_to view_cart_path\n else\n redirect_to view_cart_path\n end\n end", "def purchase\n @cart_items = CartItem.where(cart: Cart.last)\n \n @cart_items.each do |cart_item|\n @product = cart_item.product\n if (@product.inventory_count > 0)\n cart_item.product.update(title: @product.title, \n description: @product.description,\n price: @product.price,\n inventory_count: @product.inventory_count - cart_item.quantity)\n cart_item.destroy\n else\n flash[:notice] = \"Item in cart had no inventory left\"\n next\n end\n end\n if @cart = Cart.last\n @cart.destroy\n respond_to do |format|\n format.html { redirect_to products_url, notice: 'Cart was successfully purchased.'}\n format.json { head :no_content }\n end\n else\n respond_to do |format|\n format.html { redirect_to products_url, notice: \"A cart must exist for products to be added to\" }\n format.json { head :no_content }\n end\n end\n Cart.create()\n end", "def cart(display_cc = false)\n c = Cart.new(self)\n\n tstotal = (tshirts || 0) + (tshirtm || 0) + (tshirtl || 0)+ (tshirtxl || 0) + \n (tshirtxxl || 0) + (tshirtxxxl || 0)\n\n # 2013\n # if staff? \n # tstotal = tstotal - 1\n # tstotal = 0 if tstotal < 0\n # elsif board? # Board gets flat rate, with dorm rooms, sunday arrival and one T-shirt included\n # c.set_quantity(\"Board Member Flat Rate\", 1)\n # tstotal = tstotal - 1\n # tstotal = 0 if tstotal < 0\n # else\n # c.set_quantity(\"Registration\", 1)\n # c.set_quantity(\"Tuition\", participant ? 1 : 0)\n # c.set_quantity(\"Dorm\", dorm ? 1 : 0)\n # c.set_quantity(\"Meals\", meals ? 1 : 0)\n # c.set_quantity(\"No Breakfast\", meals && meals_lunch_and_dinner_only ? 1 : 0)\n # end\n #c.set_quantity(\"Commemorative Wine Glass\", wine_glasses)\n #\n # 2015 pre change\n # elsif board?\n # tstotal = tstotal <= 1 ? 0 : tstotal - 1\n # c.set_quantity(\"Dorm\", (dorm_selection == 'd' || dorm_selection == 's') ? 1 : 0)\n # c.set_quantity(\"Single Room\", dorm_selection == 's' ? 1 : 0)\n # c.set_quantity(\"Meals\", (meals_selection == 'f' || meals_selection == 'l') ? 1 : 0)\n # c.set_quantity(\"No Breakfast\", meals_selection == 'l' ? 1 : 0)\n\n # FIXME: Nothing is preventing these from being mutually exclusive in the database.\n\n if staff?\n tstotal = tstotal <= 1 ? 0 : tstotal - 1\n elsif board? # Board gets flat rate, with dorm rooms, sunday arrival and one T-shirt included\n c.set_quantity(\"Board Member Flat Rate\", 1)\n tstotal = tstotal - 1\n tstotal = 0 if tstotal < 0\n elsif major_volunteer? #Major volunteer -- no registration or tuition, but pay for everything else\n c.set_quantity(\"Dorm\", (dorm_selection == 'd' || dorm_selection == 's') ? 1 : 0)\n c.set_quantity(\"Meals\", (meals_selection == 'f' || meals_selection == 'l') ? 1 : 0)\n c.set_quantity(\"No Breakfast\", meals_selection == 'l' ? 1 : 0)\n c.set_quantity(\"Sunday Arrival\", (sunday && dorm) ? 1 : 0)\n elsif faculty?\n tstotal = tstotal - 1\n tstotal = 0 if tstotal < 0\n else\n c.set_quantity(\"Registration\", 1)\n c.set_quantity(\"Tuition\", participant ? 1 : 0)\n c.set_quantity(\"Dorm\", (dorm_selection == 'd' || dorm_selection == 's') ? 1 : 0)\n c.set_quantity(\"Meals\", (meals_selection == 'f' || meals_selection == 'l') ? 1 : 0)\n c.set_quantity(\"No Breakfast\", meals_selection == 'l' ? 1 : 0)\n c.set_quantity(\"Sunday Arrival\", (sunday && dorm) ? 1 : 0)\n end\n\n # Add-ons for everybody\n c.set_quantity(\"Tshirts\", tstotal)\n c.set_quantity(\"Single Room\", (dorm_selection == 's') ? 1 : 0)\n c.set_quantity(\"Commemorative Wine Glass\", wine_glasses)\n donation ? c.install_charge(\"Donation\", donation) : c.set_quantity(\"Donation\", 0)\n\n c\n end", "def buy_yes_contracts\n #set variables\n @contract_id = params.fetch(\"contract_id\")\n @contract_row = Contract.where({ :id => @contract_id }).at(0)\n @market_id = @contract_row.market.id\n @season_id = @contract_row.market.season.id\n @club_id = @contract_row.market.season.club.id\n \n @number_of_contracts = params.fetch(\"quantity_buy_yes\")\n @membership_row = Membership.where({ :users_id => current_user.id, :seasons_id => @season_id, :goes_to => \"seasons_table\"}).at(0)\n @user_asset_rows = @membership_row.assets\n @user_season_funds_row = @user_asset_rows.where({ :membership_id => @membership_row.id, :category => \"season_fund\"}).at(0)\n @user_starting_season_funds = @user_season_funds_row.quantity\n @starting_contract_asset_row = @user_asset_rows.where({ :membership_id => @membership_row.id, :contract_id => @contract_id, :category => \"contract_quantity_a\"}).at(0) #membership_row.id is probably unnecessary.\n\n #confirm user actually belongs to the Season associated with this Contract/Market and that the market is active\n if (@membership_row.present?) && (@contract_row.market.status == \"active\")\n \n #Confirm number is a positive integer.\n if @number_of_contracts.to_i < 1 || @number_of_contracts.include?(\".\")\n flash[:alert] = \"There was an error processing your request.\"\n else\n #check if user already has an asset row associated with this contract (contract id matches and category is \"contract_quantity_a\").\n #If user does, skip step, otherwise, if user does not, create a new asset with a quantity of 0.\n if @starting_contract_asset_row.present?\n else\n new_asset = Asset.new\n new_asset.membership_id = @membership_row.id\n new_asset.season_id = @season_id\n new_asset.contract_id = @contract_id\n new_asset.category = \"contract_quantity_a\"\n new_asset.quantity = 0\n new_asset.save\n end\n\n #add variable to track contract_asset_row now that we know it must exist:\n @contract_asset_row = @user_asset_rows.where({ :membership_id => @membership_row.id, :contract_id => @contract_id, :category => \"contract_quantity_a\"}).at(0) #membership_row.id is probably unnecessary.\n \n #algorithm (C= b * ln(e^(q1/b) + e^(q2/b)...))\n #consider updating contract table to include column for quantity outstanding to avoid many of these calculations\n liquidity_param = 50 #set liquidity parameter (b) for now. Later might allow custommization or make b variable.\n\n #calculate price/cost by running price_check algo\n total_cost = @contract_row.price_check(@contract_id, liquidity_param, @number_of_contracts, \"yes\")\n\n if total_cost > @user_season_funds_row.quantity\n flash[:alert] = \"Insufficient funds. Sell some contracts or request more funds from the Season owner.\"\n else\n \n \n #(1) remove accumulated funds from user's season_funds, (2) add contract asset (3) later, make it so this is reflected in transaction table(probably in a first step and base everything off transaction)\n #Update tables based on actions above.\n\n # remove accumulated funds from user's season_funds. Consider updating method to be based on subtraction from current amount instead of current way.\n @user_season_funds_row.quantity = @user_season_funds_row.quantity - total_cost\n @user_season_funds_row.save\n\n #update contract quantity in assets table to reflect new purchase\n @contract_asset_row.quantity = @contract_asset_row.quantity + @number_of_contracts.to_i\n @contract_asset_row.save\n\n #update contract quantity in contracts table to reflect new outstanding balance\n @contract_row.quantity_a = @contract_row.quantity_a + @number_of_contracts.to_i\n @contract_row.save\n\n if @number_of_contracts.to_i == 1\n flash[:notice] = \"Yay! \" + @number_of_contracts.to_s + \" yes contract was sucessfully purchased for \" + number_to_currency(total_cost) + \".\"\n else\n flash[:notice] = \"Yay! \" + @number_of_contracts.to_s + \" yes contracts were sucessfully purchased for \" + number_to_currency(total_cost) + \".\"\n end\n \n\n end\n end\n\n #add instance variables needed for partials that are refreshed\n @contract_rows = @contract_row.market.contracts.order({ :created_at => :asc })\n @membership_id = @membership_row.id\n @season_membership_rows = Membership.where({ :seasons_id => @season_id, :goes_to => \"seasons_table\"})\n @market_row = @contract_row.market\n\n \n\n respond_to do |format|\n format.js { render 'contract_templates/render_contracts.js.erb' }\n end\n\n else\n flash[:alert] = \"You are not authorized to perform this action.\"\n end\n\n\n #old algorithm\n #contract_id_looper = @contract_row.market.contracts.at(0).id\n #tester = Asset.where({ :contract_id => contract_id_looper }).sum(:quantity)\n \n # #set trackers and counters\n # asset_quantity_counter = 0\n # asset_remaining_tracker = @number_of_contracts.to_i\n # looper = asset_remaining_tracker\n # funds_remaining_tracker = @user_starting_season_funds\n # asset_price_tracker = @starting_contract_price\n\n # #check if user has sufficient funds to buy one contract. If not, return them to the screen and alert them of insufficient funds.\n # if @user_starting_season_funds < @starting_contract_price\n # flash[:alert] = \"Insufficient funds. Sell some assets or request more money from Season owner.\"\n # redirect_to(\"/markets/\" + @club_id.to_s + \"/\" + @season_id.to_s + \"/\" + @market_id.to_s)\n # return\n # else\n # while looper > 0 \n # if funds_remaining_tracker > asset_price_tracker\n \n # #reduce season funds by amount of current contract price\n # funds_remaining_tracker = funds_remaining_tracker - asset_price_tracker\n\n # #update asset quantity counter to reflect number of assets accumulated\n # asset_quantity_counter = asset_quantity_counter + 1\n\n # #update contract price based on algorithm. Start with simple algorithm that only adds 0.005 to contract price each time one is purchased.\n # if asset_price_tracker < 1.000\n # asset_price_tracker = asset_price_tracker + 0.005\n # end\n\n # #update asset_remaining_tracker to reflect number of assets remaining to be fufilled\n # asset_remaining_tracker = asset_remaining_tracker - 1\n\n # end\n\n # #update looper to remove one loop count\n # looper = looper - 1\n\n # end\n\n # end\n\n # #(1) remove accumulated funds from user's season_funds, (2) add contract asset, (3) update contract price based on algorithm, (4)later, make it so this is reflected in transaction table(probably in a first step and base everything off transaction)\n # #Update tables based on actions above.\n\n # #remove accumulated funds from user's season_funds. Consider updating method to be based on subtraction from current amount instead of current way.\n # @user_season_funds_row.quantity = funds_remaining_tracker\n # @user_season_funds_row.save\n\n # #update contract quantity in assets table to reflect new purchase\n # @contract_asset_row.quantity = @contract_asset_row.quantity + asset_quantity_counter\n # @contract_asset_row.save\n \n # #update overall contract quantity in contract table\n # #update contract price based on accumulated new price based on current algo.\n # #Consider issues with multiple purchases in quick sucession. Better/safer way to do this?\n # @contract_row.price = asset_price_tracker\n # @contract_row.save\n\n # if asset_remaining_tracker == 0\n # flash[:notice] = \"Yay! All \" + asset_quantity_counter.to_s + \" contract(s) were sucessfully purchased!\" + \" Test parameter pre: \" + tester_pre.to_s + \" Test parameter post: \" + tester_post.to_s\n # else\n # flash[:notice] = \"Your order has partially completed. You only had sufficient funds to purchase \" + asset_quantity_counter.to_s + \" contract(s).\"\n # end\n\n end", "def add\n @course = Course.find(params[:id])\n course_id = @course.id\n session_id = cookies[:cart_id].blank? ? request.session_options[:id] : cookies[:cart_id]\n\n Cart.where(\"created_at < ?\", 72.hour.ago).delete_all\n\n if current_user.nil?\n uid = -1\n # @cart = Cart.find_by_session_id(session_id);\n else\n uid = current_user.id\n carts = Cart.where(\"user_id = ?\", uid).update_all(:session_id => session_id)\n # @cart = Cart.find_by_user_id(uid);\n end\n last_cart = Cart.find_by_session_id(session_id)\n if last_cart.blank?\n order_number = Time.now.strftime(\"%Y%m%d%H%M%S\") + session_id.to_i(16).to_s[0..2]\n else\n if last_cart.order_number.blank?\n order_number = Time.now.strftime(\"%Y%m%d%H%M%S\") + session_id.to_i(16).to_s[0..2]\n else\n order_number = last_cart.order_number\n end\n end\n\n carts = Cart.where(\"session_id = ? AND course_id = ?\", session_id, course_id)\n if carts.first.nil?\n @cart = Cart.new\n @cart.user_id = uid\n @cart.session_id = session_id\n @cart.course_id = course_id\n @cart.order_number = order_number\n @cart.save\n end\n\n respond_to do |format|\n format.html { render action: \"new\" }\n format.json { render json: carts, status: :created }\n end\n end", "def destroy\n new_quantity = Stock.where(:user_id => current_user.id, :drug_id => @prescription.drug_id).order(\"updated_at DESC\").first.quantity_available - @prescription.quantity\n @stock = Stock.new(user_id: current_user.id, quantity_available: new_quantity, drug_id: @prescription.drug_id)\n @stock.save\n \n @prescription.destroy\n respond_to do |format|\n format.html { redirect_to prescriptions_url }\n format.json { head :no_content }\n end\n end", "def create_booking\n # Finding the cart based on the passed parameters\n cart = Cart.find_by(id: cart_params[:cart_id])\n\n # Creating a booking for every item in the cart, for that user (owner of the cart)\n cart.line_items.each do |item|\n booking = Booking.create(user_id: cart.user_id, movie_title: item.screening.movie.title, booked_date: item.screening.screening_date, booked_time: item.screening.screening_time.strftime(\"%H:%M\"), quantity: item.quantity, cinema: item.screening.cinema, arena: item.screening.arena, total_price: item.total_price)\n booking.save\n end\n\n # Destroying the cart (and in turn all the line items in the cart) and redirecting the user to the home page\n cart.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: I18n.t('messages.book_success') }\n format.json { head :no_content }\n end\n end", "def buy_no_contracts\n #set variables\n @contract_id = params.fetch(\"contract_id\")\n @contract_row = Contract.where({ :id => @contract_id }).at(0)\n @market_id = @contract_row.market.id\n @season_id = @contract_row.market.season.id\n @club_id = @contract_row.market.season.club.id\n \n @number_of_contracts = params.fetch(\"quantity_buy_no\")\n @membership_row = Membership.where({ :users_id => current_user.id, :seasons_id => @season_id, :goes_to => \"seasons_table\"}).at(0)\n @user_asset_rows = @membership_row.assets\n @user_season_funds_row = @user_asset_rows.where({ :membership_id => @membership_row.id, :category => \"season_fund\"}).at(0)\n @user_starting_season_funds = @user_season_funds_row.quantity\n @starting_contract_asset_row = @user_asset_rows.where({ :membership_id => @membership_row.id, :contract_id => @contract_id, :category => \"contract_quantity_b\"}).at(0) #membership_row.id is probably unnecessary.\n \n #confirm user actually belongs to the Season associated with this Contract/Market and that the market is active\n if (@membership_row.present?) && (@contract_row.market.status == \"active\")\n \n #Confirm number is a positive integer.\n if @number_of_contracts.to_i < 1 || @number_of_contracts.include?(\".\")\n flash[:alert] = \"There was an error processing your request.\"\n else\n #check if user already has an asset row associated with this contract (contract id matches and category is \"contract_quantity_b\").\n #If user does, skip step, otherwise, if user does not, create a new asset with a quantity of 0.\n if @starting_contract_asset_row.present?\n else\n new_asset = Asset.new\n new_asset.membership_id = @membership_row.id\n new_asset.season_id = @season_id\n new_asset.contract_id = @contract_id\n new_asset.category = \"contract_quantity_b\"\n new_asset.quantity = 0\n new_asset.save\n end\n\n #add variable to track contract_asset_row now that we know it must exist:\n @contract_asset_row = @user_asset_rows.where({ :membership_id => @membership_row.id, :contract_id => @contract_id, :category => \"contract_quantity_b\"}).at(0) #membership_row.id is probably unnecessary.\n \n #algorithm (C= b * ln(e^(q1/b) + e^(q2/b)...))\n #consider updating contract table to include column for quantity outstanding to avoid many of these calculations\n liquidity_param = 50 #set liquidity parameter (b) for now. Later might allow custommization or make b variable.\n\n #calculate price/cost by running price_check algo\n total_cost = @contract_row.price_check(@contract_id, liquidity_param, @number_of_contracts, \"no\")\n \n #(1) remove accumulated funds from user's season_funds, (2) add contract asset (3) later, make it so this is reflected in transaction table(probably in a first step and base everything off transaction)\n #Update tables based on actions above.\n\n if total_cost > @user_season_funds_row.quantity\n flash[:alert] = \"Insufficient funds. Sell some contracts or request more funds from the Season owner.\"\n else\n # remove accumulated funds from user's season_funds. Consider updating method to be based on subtraction from current amount instead of current way.\n @user_season_funds_row.quantity = @user_season_funds_row.quantity - total_cost\n @user_season_funds_row.save\n\n #update contract quantity in assets table to reflect new purchase\n @contract_asset_row.quantity = @contract_asset_row.quantity + @number_of_contracts.to_i\n @contract_asset_row.save\n\n #update contract quantity in contracts table to reflect new outstanding balance\n #if market is a 'Classical' category, then instead of adding a no contract, add a yes contract for every other contract...at least for now.\n if @contract_row.category == \"Classical\"\n @contract_row.market.contracts.where.not({ :id => @contract_row.id }).each do |add_contract|\n add_contract.quantity_a = add_contract.quantity_a + @number_of_contracts.to_i\n add_contract.save\n end\n elsif @contract_row.category == \"Independent\"\n @contract_row.quantity_b = @contract_row.quantity_b + @number_of_contracts.to_i\n @contract_row.save\n end\n\n if @number_of_contracts.to_i == 1\n flash[:notice] = \"Yay! \" + @number_of_contracts.to_s + \" no contract was sucessfully purchased for \" + number_to_currency(total_cost) + \".\"\n else\n flash[:notice] = \"Yay! \" + @number_of_contracts.to_s + \" no contracts were sucessfully purchased for \" + number_to_currency(total_cost) + \".\"\n end\n end\n end\n \n #add instance variables needed for partials that are refreshed\n @contract_rows = @contract_row.market.contracts.order({ :created_at => :asc })\n @membership_id = @membership_row.id\n @season_membership_rows = Membership.where({ :seasons_id => @season_id, :goes_to => \"seasons_table\"})\n @market_row = @contract_row.market\n\n respond_to do |format|\n format.js { render 'contract_templates/render_contracts.js.erb' }\n end\n\n else\n flash[:alert] = \"You are not authorized to perform this action.\"\n end\n\n end", "def create_some_user_courses\n\n #UserCourse.destroy_all\n\n # input data\n data = [\n { code: 'MS-A0501', time: '2011-I', grade: 4 }, # stl\n { code: 'MS-A0101', time: '2009-I', grade: 3 }, # diff1\n { code: 'CSE-A1121', time: '2010-III', grade: 5 }, # ohjp2\n { code: 'CSE-A1141', time: '2010-III', grade: 5 }, # trak\n { code: 'MS-C2104', time: '2011-III', grade: 2 } # tap\n ]\n\n @user = User.where( :id => 2 ).first\n\n data.each do |dat|\n puts 'creating user course |%s|...' % [ dat ]\n\n abstract_course = AbstractCourse.where( code: dat[:code] ).first\n if abstract_course.nil?\n raise 'nil abstract course!'\n end\n\n # check whether the user has already passed the course\n if @user.passed?( abstract_course )\n puts ' - course %s already passed' % ( abstract_course.code )\n end\n\n period = get_period( dat[:time] )\n course_instance = CourseInstance.where( 'abstract_course_id = ? AND period_id = ?', abstract_course.id, period.id ).first\n #course_instance = CourseInstance.where( :abstract_course => abstract_course, :period => period ).first\n if course_instance.nil?\n raise 'nil course_instance!'\n end\n\n # creating the user course\n ucourse = UserCourse.create(\n :user_id => @user.id,\n :abstract_course_id => abstract_course.id,\n :course_instance_id => course_instance.id,\n :grade => dat[:grade]\n )\n end\n end", "def create\n @reservaacessorio = Reservaacessorio.new(reservaacessorio_params)\n\n if @reservaacessorio.qtd_acessorio.nil? ||@reservaacessorio.qtd_acessorio<=0\n redirect_to \"/reservaacessorios?reserva_id=\"+@reservaacessorio.reserva_id.to_s,notice: 'Informe uma quantidade válida!' \n else \n respond_to do |format|\n \n if @reservaacessorio.save\n format.html { redirect_to \"/reservaacessorios?reserva_id=\"+@reservaacessorio.reserva_id.to_s,notice: 'Item criado com sucesso!' }\n format.json { render :show, status: :created, location: @reservaacessorio }\n else\n format.html { render :new }\n format.json { render json: @reservaacessorio.errors, status: :unprocessable_entity }\n end\n end \n \n #Atualização da reserva total quando há a inclusão de um novo acessorio \n # @controle = Controle.where(reserva_id: @reservaacessorio.reserva_id) \n # @controle.each do |controle|\n # qtd = controle.qtd_acessorio\n # qtd= qtd + @reservaacessorio.qtd_acessorio\n # @controle.update(qtd_acessorio: qtd)\n # end\n end\n end", "def destroy\n @cajas = Caja.all \n if @viatico_detail.destroy\n begin\n @viatico[:inicial] = @viatico.get_total_inicial\n rescue\n @viatico[:inicial] = 0\n end \n \n begin\n @viatico[:total_ing] = @viatico.get_total_ingreso\n rescue \n @viatico[:total_ing] = 0\n end \n begin \n @viatico[:total_egreso]= @viatico.get_total_egreso\n rescue \n @viatico[:total_egreso]= 0 \n end \n @viatico[:saldo] = @viatico[:inicial] + @viatico[:total_ing] - @viatico[:total_egreso]\n @viatico.save\n \n if @viatico.caja_id == 1 \n a = @cajas.find(1)\n a.inicial = @viatico[:saldo]\n a.save\n end \n if @viatico.caja_id == 2\n a = @cajas.find(2)\n a.inicial = @viatico[:saldo]\n a.save\n end \n if @viatico.caja_id == 3 \n a = @cajas.find(3)\n a.inicial = @viatico[:saldo]\n a.save\n end \n if @viatico.caja_id == 4 \n a = @cajas.find(4)\n a.inicial = @viatico[:saldo]\n a.save\n end \n \n flash[:notice]= \"Item fue eliminado satisfactoriamente \"\n redirect_to @viatico\n else\n flash[:error]= \"Item ha tenido un error y no fue eliminado\"\n render :show \n end \n \n end", "def submit_edit\n id = params[:course_id]\n requires({'role' => ['admin','faculty'],'course_id'=>id})\n course_number = params[:number]\n course_term = params[:term]\n course_name = params[:name]\n course_section = params[:section]\n\n studentsToRemove = params[:students_to_remove]\n tasToRemove = params[:tas_to_remove]\n\n course = Course.find(id)\n \n\n\n course.course_number = course_number\n course.term = course_term\n course.name = course_name\n course.section = course_section\n course.save\n \n StudentInCourse.delete_all(:course_id => id, :user_id => studentsToRemove)\n TaForCourse.delete_all(:course_id => id, :user_id => tasToRemove)\n\n flash[:notice] = \"Changes saved.\"\n \n end", "def destroy\n stat = Statistic.find_by(number:@isale.pharmacy_id)\n if stat.quantity == @isale.quantity\n stat.destroy\n else\n stat.update_attributes(quantity: stat.quantity - @isale.quantity)\n end\n\n @isale.destroy\n respond_to do |format|\n format.html { redirect_to isales_url, notice: 'Isale was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @cajas = Caja.all \n if @viatico_detail.destroy\n begin\n @viatico[:inicial] = @viatico.get_total_inicial\n rescue\n @viatico[:inicial] = 0\n end \n \n begin\n @viatico[:total_ing] = @viatico.get_total_ing\n rescue \n @viatico[:total_ing] = 0\n end \n begin \n @viatico[:total_egreso]= @viatico.get_total_sal\n rescue \n @viatico[:total_egreso]= 0 \n end \n @viatico[:saldo] = @viatico[:inicial] + @viatico[:total_ing] - @viatico[:total_egreso]\n @viatico.save\n \n if @viatico.caja_id == 1 \n a = @cajas.find(1)\n a.inicial = @viatico[:saldo]\n a.save\n end \n if @viatico.caja_id == 2\n a = @cajas.find(2)\n a.inicial = @viatico[:saldo]\n a.save\n end \n if @viatico.caja_id == 3 \n a = @cajas.find(3)\n a.inicial = @viatico[:saldo]\n a.save\n end \n if @viatico.caja_id == 4 \n a = @cajas.find(4)\n a.inicial = @viatico[:saldo]\n a.save\n end \n \n flash[:notice]= \"Item fue eliminado satisfactoriamente \"\n redirect_to @viatico\n else\n flash[:error]= \"Item ha tenido un error y no fue eliminado\"\n render :show \n end \n \n end", "def destroy\n if current_user.present? && !current_user.isAdmin? #Si lo compro un usuario\n #Se procede a crear una reserva con los datos de la hotsale, actualiza la tabla de disponibilidad.\n @reservation = Reservation.new(residence: @hotsale.residence, user: current_user, year: @hotsale.availability.year, week: @hotsale.availability.week, price: @hotsale.price)\n Availability.where(:id => @hotsale.availability.id ).update_all(:is_available => false)\n @reservation.save\n current_user.update(credits: current_user.credits - 1)\n flash[:notice] = \"Se ha hecho la reserva de la residencia\"\n else\n flash[:notice] = \"¡Hotsale Terminada!\"\n end\n @hotsale.destroy\n redirect_to root_path\n end", "def index \n \n @page_title = \"Register for NAETI Courses\"\n @padding = true\n retrieve_shopping_cart\n \n if current_user\n @user = current_user\n else\n @user = User.new\n end\n \n #update cart for removals\n if params[:remove]\n for id in params[:shopping_cart_item][:ids]\n @shopping_cart_item = ShoppingCartItem.where(:id=>id).first\n @shopping_cart_item.destroy\n end\n end\n \n retrieve_shopping_cart\n\n if params[:user]\n \n if current_user\n @user.update_attributes(params[:user])\n @user = set_credit_card_info(@user)\n \n if @user.valid?\n process_checkout\n else\n flash.now[:notice] = \"Please correct the indicated fields.\"\n end\n else\n \n @user = User.new(params[:user])\n @user = set_credit_card_info(@user)\n \n if @user.valid?\n @user.save\n process_checkout\n else\n flash.now[:notice] = \"Please correct the indicated fields.\"\n end\n # end\n end\n\n end\n \n end", "def destroy\n new_quantity = Stock.where(:user_id => current_user.id, :drug_id => @dosing.drug_id).order(\"updated_at DESC\").first.quantity_available + 1\n @stock = Stock.new(user_id: current_user.id, quantity_available: new_quantity, drug_id: @dosing.drug_id)\n @stock.save\n @dosing.destroy\n respond_to do |format|\n format.html { redirect_to dosings_url }\n format.json { head :no_content }\n end\n end", "def create\n ordered_item_from_table = OrderedItem.new(passed_parameters_from_items_index)\n order = Order.where(id: ordered_item_from_table.order_id, confirmed: false, user_id: current_user.id).last\n ordered_item_from_db = OrderedItem.where(order_id: order.id, item_id: ordered_item_from_table.item_id).last\n \n if ordered_item_from_db.present?\n item = Item.where(id: ordered_item_from_db.item_id).last\n if item.quantity > 0\n if ordered_item_from_db.update(quantity: ordered_item_from_db.quantity + 1) && item.update(quantity: item.quantity - 1)\n redirect_to items_path\n flash[:notice] = \"Item has been added to your order.\"\n else\n redirect_to items_path\n flash[:alert] = \"Item can not be added to your order.\"\n end\n else \n redirect_to items_path\n flash[:alert] = \"Item can not be added to your order.\"\n end\n \n\n else\n @ordered_item = OrderedItem.new(passed_parameters_from_items_index)\n @item = Item.find(@ordered_item.item_id)\n\n if @item.quantity > 0\n @item.quantity -= @ordered_item.quantity\n @item.update(quantity: @item.quantity )\n if @ordered_item.save\n redirect_to items_path\n flash[:notice] = \"Item has been added to your order.\"\n else\n redirect_to items_path\n flash[:alert] = \"Item can not be added to your order.\"\n end\n \n\n else\n flash[:alert] = \"Something went wrong! Item was not added to the cart\"\n redirect_to items_path\n end\n\n end\n end", "def new\n # @vacancies_max = @current_user.orders.sum(:quantity_remained, joins: :pricelist, conditions: {status: 1, pricelists: {entry_type: 3}}) + Job::VACANCIES_FREE\n unless @current_user.companies.count >= 1\n redirect_to new_company_path, flash: { info: \"У вас нет ни одной компании. Пожалуйста, создайте хотя бы одну.\" }\n return\n end\n \n #if @current_user.vacancies.count <= 7 or @vacancies_max >= @current_user.vacancies.count\n if params[:id]\n @content_for_title = \"Создание вакансии на основе существующей\"\n old = Vacancy.find(params[:id]).clear_private_fields\n @vacancy = old.dup\n @vacancy.email = @current_user.email\n @vacancy.phone = @current_user.phone\n @vacancy.city = @current_user.city\n @vacancy.name = @current_user.full_name if @current_user.full_name != @current_user.email\n session[:old_job_id] = old.id\n # old.clear_private_fields# = old.clear_private_fields\n else\n @content_for_title = \"Создание новой вакансии\"\n session[:old_job_id] = nil\n @vacancy = Vacancy.new(user: current_user)\n @vacancy.email = @current_user.email\n @vacancy.phone = @current_user.phone\n @vacancy.city = @current_user.city\n @vacancy.name = @current_user.full_name if @current_user.full_name != @current_user.email\n end\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vacancy }\n end\n #else\n # respond_to do |format|\n # format.html { redirect_to vacancies_path, flash: { error: \"Лимит создаваемых вакансий исчерпан.\" }}\n # end\n #end\n end", "def destroy\n @court = Court.find(params[:id])\n @court.destroy\n\n respond_to do |format|\n format.html { redirect_to courts_url }\n format.json { head :no_content }\n end\n end", "def do_purchase\n user.purchases.create!(\n amount_in_cents: purchase_amount,\n employee_id: purchase_params.dig(:employee_id),\n qty: purchase_params.dig(:qty).to_i,\n venue_id: purchase_params.dig(:venue_id),\n tap_id: purchase_params.dig(:tap_id),\n description: purchase_params.dig(:description)\n )\n end", "def create\n @book_order = BookOrder.new(new_book_order_params)\n @book_order.cart = @cart\n @book_order.user = @current_user\n # @book_order.decrease_q\n @book_order.add_lineitems(@cart)\n if @book_order.save\n session.delete(:cart_id)\n redirect_to root_path, notice: 'Заказ оформлен.'\n else\n render :new\n end\n end", "def buy\n user = User.find_by_guid(params[:id])\n if user\n user.dollaz -= params[:price].to_i\n PlayerInventory.create(pid: user.id, item_id: params[:item].id)\n user.save!\n render nothing:true, notice: \"Item bought!\"\n else\n render nothing:true, notice: \"Error: unable to purchase item\"\n end\n end", "def create_card(character_id, quantity_released)\n available = true #default value\n quantity_released.to_i.times do |card_edition|\n user_id = current_user()[\"id\"]\n \n params = [character_id, card_edition + 1, available, user_id]\n sql_query = \"INSERT INTO cards(character_id, card_edition, available, owner_id) values($1, $2, $3, $4);\"\n run_sql(sql_query, params)\n\n # Add new card listing to the marketplace. Default listing by admin\n latest_card = get_latest_card()\n card_id = latest_card[\"id\"]\n price = latest_card[\"initial_price\"]\n\n create_card_listing(user_id, card_id, price)\n end\nend", "def create\n if (params[:course])\n @course = Course.new(params[:course])\n @user = User.find_by_id(session[:user_id])\n else\n params[:course] = {:name=>params[:title], \n :f_day=>params[:description], \n :l_day=>params[:price]\n }\n @course = Course.new(params[:course])\n @course.user_id = session[:user_id]\n end\n \n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render json: @course, status: :created, location: @course }\n else\n format.html { render action: \"new\" }\n format.json { render json: courses_path.errors, status: :unprocessable_entity }\n end\n end\n end", "def purchase_sub_existing_edu #much copied from static#students , but much not needed #in case use customer registers but then comes back later to finish purchasing\n @event = Event.find(ENV['demopage'].to_i)\n @commencement_plan = Plan.find_by_my_plan_id(plan_set_commencement) # sets @first_plan the first plan object ACCORDING TO MY LEGEND (with my_plan_id)\n @students_plan = Plan.find_by_my_plan_id(plan_set_students)\n @all_inclusive_plan = Plan.find_by_my_plan_id(plan_set_all_inclusive)\n @practiceobject = Practiceobject.new \n @practiceobject.event_id = @event.id #for the form_for(@practiceobject) which creatse a new practice object (and another form which just shows the labels - can find a better way for that)\n @registeredandrecordedpos = @event.practiceobjects.registered.recorded.visible\n @registeredandunrecordedpos = @event.practiceobjects.registered.unrecorded.visible\n @unregisteredpos = @event.practiceobjects.unregistered.visible\n @hiddenpos = @event.practiceobjects.hidden\n @hiddenandregisteredpos = @hiddenpos.registered\n @hiddenandunregisteredpos = @hiddenpos.unregistered \n\n @url = demo_record_directory_url(:event_code => @event.event_code)\nend", "def create\n @cautelamunicao = Cautelamunicao.new(cautelamunicao_params)\n\n respond_to do |format|\n if @cautelamunicao.save\n #retirando itens cautelados da reserva \n @reservamunicao=Reservamunicao.where(id: @cautelamunicao.reservamunicao_id,\n reserva_id: @cautelamunicao.cautela.reserva_id)\n qtd_reserva=0\n @reservamunicao.each do |reservamunicao| \n qtd_reserva = reservamunicao.qtd_municao\n end\n qtd_municao_cautela = @cautelamunicao.qtd_municao\n qtd_atualizar = qtd_reserva - qtd_municao_cautela \n @reservamunicao.update(qtd_municao: qtd_atualizar)\n mensagem ='O Item foi Adicionado com Sucesso!'\n \n format.html { redirect_to \"/cautelamunicaos?cautela_id=\"+@cautelamunicao.cautela_id.to_s+\"&reserva_id=\"+@cautelamunicao.cautela.reserva_id.to_s, notice: mensagem}\n format.json { render :show, status: :created, location: @cautelamunicao }\n else\n format.html { render :new }\n format.json { render json: @cautelamunicao.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n #adicionando itens baixados da cautela na reserva \n if params[:baixar]=='false' \n @reservamunicao=Reservamunicao.where(id: @cautelamunicao.reservamunicao_id,\n reserva_id: @cautelamunicao.cautela.reserva_id)\n \n qtd_reserva=0\n @reservamunicao.each do |reservamunicaos| \n qtd_reserva = reservamunicaos.qtd_municao\n end\n qtd_municao_baixado =@cautelamunicao.qtd_municao\n qtd_realocar= qtd_reserva + qtd_municao_baixado \n @reservamunicao.update(qtd_municao: qtd_realocar)\n mensagem='O Item foi excluído com Scuesso!'\n end \n \n @cautelamunicao.destroy\n respond_to do |format|\n format.html { redirect_to \"/cautelamunicaos?cautela_id=\"+@cautelamunicao.cautela_id.to_s+\"&reserva_id=\"+@cautelamunicao.cautela.reserva_id.to_s, notice: mensagem}\n format.json { head :no_content }\n end\n end", "def create\n item = Item.find(params[:item_id])\n @line_item = @cart.line_items.find_by(item: item)\n if @line_item\n @line_item.quantity += 1\n else\n @line_item = @cart.line_items.new(item: item)\n end\n\n respond_to do |format|\n if @line_item.save\n format.html { redirect_to @line_item.cart, notice: 'Line item was successfully created.' }\n format.json { render :show, status: :created, location: @line_item }\n else\n format.html { render :new }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\nend", "def destroy\n @court.destroy\n respond_to do |format|\n format.html { redirect_to courts_url, notice: 'Court was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n \n \n if @conciliabank_detail.destroy \n\n @conciliabank[:saldo_final] = @conciliabank[:saldo_inicial] - @conciliabank.get_subtotal(\"cargos\") + @conciliabank.get_subtotal(\"abonos\")\n \n @conciliabank.update_attributes(:saldo_final=> @conciliabank[:saldo_final])\n\n flash[:notice]= \"Item fue eliminado satisfactoriamente \"\n redirect_to @conciliabank\n else\n flash[:error]= \"Item ha tenido un error y no fue eliminado\"\n render :show \n end \n\n end", "def create\n # @usage = Usage.new\n # @usage.user_id = params[:user_id]\n # @usage.cart_id = params[:cart_id]\n # byebug\n @user = User.find(params[:usage][:user_id].to_i)\n @cart = Cart.find(params[:usage][:cart_id].to_i)\n @usage = @user.usages.new()\n @usage.cart_id = params[:usage][:cart_id].to_i\n\n\n respond_to do |format|\n if @usage.save\n format.html { redirect_to @usage, notice: 'Usage was successfully created.' }\n format.json { render :show, status: :created, location: @usage }\n else\n format.html { render :new }\n format.json { render json: @usage.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if current_user.present?\n Item.transaction do\n item = Item.find(params[:item_id].to_i)\n if item.remain <= 0\n #如果已被抢完,提示投资下一期\n flash[:info] = \"该期已投完,请投资下一期\"\n elsif item.remain > params[:amount].to_i\n #如果还没被抢完,可以抢,创建一条抢投记录,更新期数的已投和剩余的人次数\n if current_user.available.blank?\n flash[:info] = \"请先注册并充值\"\n elsif current_user.cash_flows.count == 1 && current_user.cash_flows.first.cash_flow_description == Dict::CashFlowDescription.prize\n flash[:info] = \"注册红包仅可用于投标\"\n elsif current_user.available >= params[:amount].to_i\n numbers = item.number_array.sample(params[:amount].to_i)\n order = ProductOrder.create_for(current_user, params[:item_id].to_i, params[:amount].to_i, numbers.join(\" \"))\n already = item.already + params[:amount].to_i\n remain = item.remain - params[:amount].to_i\n number_array = item.number_array - numbers\n item.update_already_remain(already, remain, number_array)\n flash[:info] = \"参与成功!\"\n else\n flash[:info] = \"您的账户余额不足,请充值\"\n end\n elsif item.remain <= params[:amount].to_i\n if current_user.available.blank?\n flash[:info] = \"请先注册并充值\"\n elsif current_user.available > params[:amount].to_i\n #如果已最后剩余的被抢完,除了更新记录外,还要创建新的一期,及开奖\n numbers = item.number_array\n order = ProductOrder.create_for(current_user, params[:item_id].to_i, item.remain, numbers.join(\" \"))\n already = item.already + item.remain\n remain = item.remain - item.remain\n number_array = item.number_array - numbers\n item.update_already_remain(already, remain, number_array)\n #更新产品信息\n item_product = item.product\n item_product.already += 1\n item_product.remain -= 1\n item_product.save\n #生成新的期数\n not_finish_product = Product.where(\"already != numbers\").order(\"weight desc\").first\n if not_finish_product.present?\n Item.create(product_id: not_finish_product.id, already: 0, remain: not_finish_product.total_price, number_array: (10000001..(10000000+not_finish_product.total_price)).to_a)\n end\n flash[:info] = \"参与成功!\"\n else\n flash[:info] = \"您的账户余额不足,请充值\"\n end\n end\n end\n else\n flash[:info] = \"请先登录\"\n end\n redirect_to :actions => \"index\"\n end", "def create\n purchase = @order.purchases.first(:conditions => {\n :purchasable_id => params[:purchase][:purchasable_id],\n :purchasable_type => params[:purchase][:purchasable_type]\n })\n\n if purchase\n purchase.quantity += params[:purchase][:quantity].to_i\n purchase.save\n else\n @order.purchases << Purchase.new(params[:purchase])\n @order.save\n end\n\n if params[:redirect_to]\n flash[:success] = %{#{params[:purchase][:name]} has been added to your order. <a href=\"/order/purchases\">Proceed to checkout</a>.} unless params[:hide_flash]\n redirect_to params[:redirect_to]\n else\n redirect_to order_purchases_path\n end\n end", "def destroy \n @release = Release.find(params[:id])\n #update_cashier(@release.value * -1)\n @release.view = false\n @release.save\n \n respond_to do |format|\n format.html { redirect_to cashier_path(params[:cashier_id]) }\n format.json { head :no_content }\n end\n end", "def create\n if sale_params[:sell_year] == \"\" || sale_params[:sell_year].nil?\n sale_params[:sell_year] = 2018\n end\n\n @sale = current_user.sales.build(sale_params)\n @good = Good.find(sale_params[:good_id])\n if sale_params[:sell_year] == \"\"\n sale_params[:sell_year] = 2018\n end\n if @sale.quantity > @good.quantity\n flash[:danger] = \"Não venda além do que possui..\"\n redirect_to goods_url\n else\n if @sale.save\n quantity = @good.quantity - @sale.quantity\n if @good.update(:quantity => quantity)\n flash[:success] = \"Venda realizada!\"\n redirect_to sales_url \n end\n else\n redirect_to sales_url\n end\n end\n end", "def purchase\n begin\n ActiveRecord::Base.transaction do\n @user.coin_credit -= @product.price\n requested_detail = @product.details.available.first\n requested_detail.available = false # makes the detail unavailable\n requested_detail.save!\n @user.save!\n @user.purchased_details << requested_detail # adds the detail to purchased_details of the user\n @purchased_detail = requested_detail\n end\n true\n rescue => e\n Rails.logger.error e\n @user.reload\n @user.errors.add(:base, :purchase_problem)\n false\n end\n end", "def cancel!(e, quantity)\n [e, e.matchee].each do |ex|\n ex.quantity -= quantity\n quantity.times {ex.registrations.pop}\n ex.save\n end\n end", "def create_current_cart\n new_cart = self.carts.create # instantiate and save to DB new cart already belonging to user instance\n self.current_cart_id = new_cart.id\n self.save\n end", "def create\n ##ensure that the cart item is new\n \n check_for_create(@auth_shopping_cart_item)\n @auth_shopping_cart_item = add_owner_and_signed_in_resource(@auth_shopping_cart_item)\n \n @auth_shopping_cart_item.save\n\n respond_with @auth_shopping_cart_item\n end", "def create \n @product = Product.find_by_title(params[:product]) \n @line_item = LineItem.new(params[:line_item])\n @line_item.product_id = @product.id\n @line_items= LineItem.where(:demand_id => @line_item.demand_id, :product_id => @line_item.product_id)\n \n @quantity = @line_item.quantity\n \n if @line_items != nil\n @line_items.each do |item|\n @quantity += item.quantity\n LineItem.find(item.id).destroy\n end\n @line_item.update_attributes(:quantity => @quantity)\n end\n \n respond_to do |format|\n if @line_item.save\n format.js\n else\n format.html { render action: \"new\" }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def add\n course = Course.find(params[:id])\n course_id = course.id\n cart_id = cookies[:cart_id]\n puts cookies\n #session_id = cookies[:cart_id].blank? ? request.session_options[:id] : cookies[:cart_id]\n \n\n # Delete expired carts\n Cart.where(\"created_at < ?\", 72.hour.ago).delete_all\n \n @carts = nil\n # If guest\n if current_user.nil?\n uid = -1\n else # Registered user\n uid = current_user.id\n @carts = Cart.where(\"user_id = ?\", uid).update_all(:session_id => cart_id)\n end\n\n # Check if the course already in cart\n last_cart = Cart.find_by_session_id(cart_id)\n order_number = \"\"\n if last_cart.blank? # New cart\n order_number = Time.now.strftime(\"%Y%m%d%H%M%S\") + cart_id.to_i.to_s[0..2]\n else\n if last_cart.order_number.blank?\n order_number = Time.now.strftime(\"%Y%m%d%H%M%S\") + cart_id.to_i.to_s[0..2]\n else\n order_number = last_cart.order_number\n end\n end\n\n @carts = Cart.where(\"session_id = ? AND course_id = ?\", cart_id, course_id)\n if @carts.first.nil?\n @cart = Cart.new\n @cart.user_id = uid\n @cart.session_id = cart_id\n @cart.course_id = course_id\n @cart.order_number = order_number\n @cart.save\n end\n #render json: @carts, status: :created \n respond_to do |format|\n format.html { render :action => \"index\" }\n format.json { render json: @carts, status: :created }\n end\n end", "def create\n @cart = Cart.find(session[:cart_id])\n @order = Order.new(order_params)\n @order.cart_id = @cart.id\n @order.user_id = current_user.id\n @order.Status = false\n @cartsitems = Cartsitem.all.where(cart_id: @cart.id)\n @user = User.find(current_user.id)\n\n @cartsitems.each do |item|\n if item.fruit_id\n @fruit = Fruit.find(item.fruit_id)\n @fruit.quantity = @fruit.quantity - item.quantity \n @fruit.save\n end\n if item.vegetable_id\n @vegetable = Vegetable.find(item.vegetable_id)\n @vegetable.quantity = @vegetable.quantity - item.quantity \n @vegetable.save\n end\n\n end\n\n if @user.ordernumber\n @user.ordernumber = @user.ordernumber + 1\n \n else\n @user.ordernumber = 1\n end\n @user.save\n @cart = Cart.create\n session[:cart_id] = @cart.id\n\n\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to '/', notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @buy = Buy.new(buy_params)\n @tarjetas= Card.all\n @numero= @buy.numero_de_tarjeta \n #@tarjeta=@tarjetas.first\n @tarjeta = @tarjetas.find_by(numero: @numero)\n @precio_total= @buy.cantidad * 50\n unless @tarjeta.nil?\n if @tarjeta.credito >= @precio_total\n @buy.precio_actual=50\n @buy.precio_total=@precio_total\n @tarjeta.credito= @tarjeta.credito - @precio_total \n \n @buy.user_id=current_user.id\n current_user.creditos=current_user.creditos + @buy.cantidad\n \n respond_to do |format|\n if @buy.save and current_user.save and @tarjeta.save\n format.html { redirect_to @buy, notice: 'Se ha realizado la compra con éxito.' }\n format.json { render :show, status: :created, location: @buy }\n else\n format.html { render :new }\n format.json { render json: @buy.errors, status: :unprocessable_entity }\n end\n end\n else\n respond_to do |format|\n format.html { redirect_to '/buys/new', notice: 'Crédito insuficiente.' }\n end\n end\n else\n respond_to do |format|\n format.html { redirect_to '/buys/new', notice: 'Tarjeta invalida.' }\n end\n end\nend", "def destroy\n capitol_id = @capitol.id\n licenta_id = @capitol.licenta_id\n numar = @capitol.numar\n @capitol.destroy\n\n # actualizeaza numerele la restul capitolelor de dupa asta distrus\n @capitole = Capitol.where(\"licenta_id = ? and numar > ?\", \"#{licenta_id}\", \"#{numar}\")\n if @capitole.count > 0\n @capitole.each do |cap|\n cap.update_attributes(numar: cap.numar-1)\n end\n end\n\n # sterge si todo-urile capitolului aluia din baza de date\n Todo.where(capitol_id: capitol_id).delete_all\n\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end", "def create\n # Find the item in the user's cart, if the user does not already\n # have the item in their cart, create a new line_item\n current_item = LineItem.find_or_create_by product_size_id: params[:product_size_id], cart_id: @cart.id\n\n # Increment the item's quantity by one\n requested_qty = current_item.quantity + 1\n\n # Invoke method in line_item.rb that checks the\n # requested qty against current stock levels\n update_qty = current_item.get_update_qty requested_qty\n\n # If the user's requested quantity can not be fulfilled, set a flash error\n unless update_qty == requested_qty\n flash[:item_error] = \"Sorry, not enough stock. Your shopping basket has been adjusted accordingly.\"\n end\n\n # Save the line_item update\n current_item.update quantity: update_qty\n\n # Redirect to My Basket page\n redirect_to cart_path\n end", "def create\r\n @cart_item = CartItem.new(cart_item_params)\r\n @cart_item.user = current_user\r\n\r\n if is_enough && @cart_item.save\r\n @cart_item.buy # pre-emtively \"buys\" the item to save it from other users\r\n flash[:notice] = \"Item was added to cart!\"\r\n else\r\n flash[:danger] = \"Item could not be added to cart!\"\r\n end\r\n redirect_to products_path\r\n end", "def create\n @estoquemp = Estoquemp.new(estoquemp_params)\n @estoquemp.cliente_id = current_user.cliente_id\n \n \n if !Estoquemp.where(cliente_id: current_user.cliente_id, item: @estoquemp.item).empty? && @estoquemp.atualizar == \"Entrada\"\n quantidade_velha = Estoquemp.where(cliente_id: current_user.cliente_id, item: @estoquemp.item).last.quantidade_atual\n quantidade_nova = @estoquemp.quantidade_atual\n @estoquemp.quantidade_atual = quantidade_nova + quantidade_velha\n end\n \n \n if !Estoquemp.where(cliente_id: current_user.cliente_id, item: @estoquemp.item).empty? && @estoquemp.atualizar == \"Saída\"\n quantidade_velha = Estoquemp.where(cliente_id: current_user.cliente_id, item: @estoquemp.item).last.quantidade_atual\n quantidade_nova = @estoquemp.quantidade_atual\n @estoquemp.quantidade_atual = quantidade_velha - quantidade_nova\n @estoquemp.fornecedor = Estoquemp.where(cliente_id: current_user.cliente_id, item: @estoquemp.item).last.fornecedor\n end\n \n \n respond_to do |format|\n if @estoquemp.save\n format.html { redirect_to new_estoquemp_path, flash: { success: 'Item adicionado com sucesso ao estoque' } }\n format.json { render :show, status: :created, location: @estoquemp }\n else\n format.html { render :new }\n format.json { render json: @estoquemp.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_quantity(quantity)\n\n if quantity != self.quantity\n\n old_quantity = self.quantity || 0\n old_item_cost = self.item_cost || 0\n old_item_deposit = self.product_deposit_cost || 0\n old_category_supplement_1_cost = self.category_supplement_1_cost || 0\n old_category_supplement_2_cost = self.category_supplement_2_cost || 0\n old_category_supplement_3_cost = self.category_supplement_3_cost || 0\n\n transaction do\n\n # Update the item\n self.quantity = quantity\n self.item_cost = (self.item_unit_cost || 0) * quantity\n self.product_deposit_cost = (self.product_deposit_unit_cost || 0) * quantity\n self.category_supplement_1_cost = (self.category_supplement_1_unit_cost || 0) * quantity\n self.category_supplement_2_cost = (self.category_supplement_2_unit_cost || 0) * quantity\n self.category_supplement_3_cost = (self.category_supplement_3_unit_cost || 0) * quantity\n self.save\n\n # Update the shopping cart cost\n self.shopping_cart_item_cost_variation(old_item_cost, \n old_item_deposit, \n old_category_supplement_1_cost,\n old_category_supplement_2_cost,\n old_category_supplement_3_cost)\n self.shopping_cart.calculate_cost(false, true)\n\n begin\n self.shopping_cart.save\n rescue DataMapper::SaveFailureError => error\n p \"Error saving shopping cart: #{self.shopping_cart.errors.full_messages.inspect}\"\n raise error\n end\n\n # Add or shopping cart item resources\n if quantity < old_quantity\n (quantity..(old_quantity-1)).each do |resource_number|\n self.item_resources[quantity].destroy unless self.item_resources[quantity].nil?\n self.item_resources.reload\n end\n elsif quantity > old_quantity\n product = ::Yito::Model::Booking::BookingCategory.get(item_id)\n (old_quantity..(quantity-1)).each do |resource_number|\n shopping_cart_item_resource = ShoppingCartItemResourceRenting.new\n shopping_cart_item_resource.item = self\n shopping_cart_item_resource.pax = product.capacity unless product.nil?\n shopping_cart_item_resource.save\n end\n end\n\n end\n end\n end", "def do_comp!\n # user = User.where('id=? OR rfid=?', user_param.to_i, user_param).first\n user = User.find(user_param)\n user.comps.create!(\n amount_in_cents: comp_amount,\n employee_id: comp_params.dig(:employee_id),\n venue_id: comp_params.dig(:venue_id),\n description: comp_params.dig(:description)\n )\n end", "def create\n @item = Item.new(purchase_item_params)\n\n item_cost = 2\n\n # if params[:item] == \"coin\" || params[:item] == :coin\n # @item = current_user.items.create(item: params[:item], denomination: params[:denomination])\n # elsif params[:item] == \"die\" || params[:item] == :die\n # item_cost = @item.sides\n # @item = current_user.items.create(item: params[:item], sides: params[:sides], colour: params[:colour])\n # end\n\n alert_text = \"Purchase alert: \"\n if @item.item == \"coin\" || @item.item == :coin\n if @item.sides || @item.sides != 0\n alert_text += \"Ignored number of sides '#{@item.sides}' when purchasing the coin. \"\n end\n if @item.colour || @item.colour != nil || @item.colour != \"\"\n alert_text += \"Ignored colour '#{@item.colour}' when purchasing the coin. \"\n end\n @item = current_user.items.create(purchase_coin_params)\n elsif @item.item == \"die\" || @item.item == :die\n if @item.denomination\n alert_text += \"Ignored denomination '#{@item.denomination}' when purchasing the die. \"\n end\n item_cost = @item.sides\n @item = current_user.items.create(purchase_die_params)\n end\n\n # @item = current_user.items.create(purchase_item_params)\n\n if !item_cost\n alert_text += \"Purchase refused - Please input a number of sides for the die you want to purchase.\"\n flash.now[:alert] = \"#{alert_text}\"\n render :new\n elsif current_user.gems < item_cost\n alert_text += \"Purchase refused - You don't have enough gems. The item costs #{item_cost}, but you only have #{current_user.gems} gems.\"\n flash.now[:alert] = \"#{alert_text}\"\n render :new\n else\n respond_to do |format|\n if @item.save\n current_user.gems -= item_cost\n current_user.save\n\n format.html { redirect_to purchaseitems_path, notice: 'Item was successfully purchased.', alert: alert_text }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new, alert: alert_text }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def create\n @stock = Stock.new(stock_params)\n @stock.user_id = current_user.id # set user_id\n @item = Stock.where(\"user_id = ? and item_name = ?\" , current_user.id , @stock.item_name )\n @uom = Stock.where(\"user_id = ? and item_name = ? and unit_of_measure = ?\" , current_user.id , @stock.item_name , @stock.unit_of_measure)\n @stocks = Stock.where(\"user_id = ? and item_name = ? and unit_of_measure = ? and batch_number = ? \" , current_user.id , @stock.item_name , @stock.unit_of_measure , @stock.batch_number)\n time = Time.now.strftime(\"%Y-%m-%d\")\n respond_to do |format|\n if @stock.expiry_date <= Date.parse(time)\n format.html { redirect_to @stock, notice: 'Product is alreday expired, check the expiry date' }\n\n elsif @stock.quantity <= 0\n format.html { redirect_to @stock, notice: 'Quantity should be positive' }\n\n else\n if !@stocks.present?\n\n master = Master.where(\"item_name = ? and uom = ?\" , @stock.item_name , @stock.unit_of_measure)\n\n # if item is not in masters then consider it as personal item\n if master.present?\n # base is master's row with level = 1 , to get base uom\n base = Master.where(\"item_name = ?\" , @stock.item_name )\n base = base.where(\"level = ? \" , \"1\")\n uom = base.pluck(:uom)\n uom = uom[0]\n mrp = base.pluck(:mrp)\n mrp = mrp[0]\n # onlt if given unit_of_measure is base_uom(level=1)\n if uom.to_s == @stock.unit_of_measure.to_s\n price = @stock.quantity*mrp\n purchase=Purchase.create(user_id: current_user.id , wholesaler: \"Stock Correction\",item_name: @stock.item_name ,\n batch_number: @stock.batch_number ,unit_of_measure: uom ,\n expiry_date: @stock.expiry_date , quantity:@stock.quantity , date_of_purchase: time , total_price:price)\n\n # update in report\n report = Report.find_by(item_name: @stock.item_name , user_id: current_user.id)\n if report.present?\n report.value = (price + report.value*report.quantity)/(@stock.quantity + report.quantity)\n report.quantity = report.quantity + @stock.quantity\n report.save\n else\n report=Report.create(user_id:current_user.id , item_name:@stock.item_name,value:(price/(@stock.quantity)),\n quantity:@stock.quantity)\n end\n\n if @stock.save\n format.html { redirect_to @stock, notice: 'New Item has been successfully added.' }\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\n else\n format.html { redirect_to @stock, notice: 'Item from masters list is only allowed with base unit_of_measure(level=1)' }\n format.json { render :show, status: :created, location: @stock }\n end\n\n else\n # is personal item present in stock\n if @item.present?\n # only 1 uom is allowed for personal item\n if @uom.present?\n # find average value of product\n report = Report.find_by(item_name: @stock.item_name , user_id: current_user.id)\n price = @stock.quantity*report.value\n\n purchase=Purchase.create(user_id: current_user.id , wholesaler: \"Stock Correction\",item_name: @stock.item_name ,\n batch_number: @stock.batch_number ,unit_of_measure: @stock.unit_of_measure ,\n expiry_date: @stock.expiry_date , quantity:@stock.quantity , date_of_purchase: time , total_price:price)\n\n report.value = (price + report.value*report.quantity)/(@stock.quantity + report.quantity)\n report.quantity = report.quantity + @stock.quantity\n report.save\n\n if @stock.save\n format.html { redirect_to @stock, notice: 'New Item has been successfully added.' }\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\n else\n # as defined Personal item with only one unit_of_measure is allowed\n format.html { redirect_to @stock, notice: 'Personal item with only one unit_of_measure is allowed' }\n format.json { render :show, status: :created, location: @stock }\n end\n\n else\n purchase=Purchase.create(user_id: current_user.id , wholesaler: \"Stock Correction\",item_name: @stock.item_name ,\n batch_number: @stock.batch_number ,unit_of_measure: @stock.unit_of_measure ,\n expiry_date: @stock.expiry_date , quantity:@stock.quantity , date_of_purchase: time , total_price:0)\n\n report=Report.create(user_id:current_user.id , item_name:@stock.item_name,value:0,\n quantity:@stock.quantity)\n\n if @stock.save\n format.html { redirect_to @stock, notice: 'New Item has been successfully added.' }\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\n end\n end\n else\n format.html { redirect_to @stock, notice: 'Item with corresponding unit_of_measure and batch number already exist.' }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def add_to_cart\n if current_user.cart\n update\n else\n create\n end\n end", "def create\n @purchase_requisition = PurchaseRequisition.new(params[:purchase_requisition])\n\n if ( !@purchase_requisition.filled_form_date)\n @purchase_requisition.filled_form_date = Time.now\n #logger.info \"LA hora es:\" + Time.now.to_s\n end\n\n if ( !@purchase_requisition.creator )\n @purchase_requisition.creator = current_user\n\n #logger.info \"HEEEYYYY*************************\"\n #logger.info @purchase_requisition.requisition_entries\n end\n\n respond_to do |format|\n \n if @purchase_requisition.save\n @purchase_requisition.folio = @purchase_requisition.id;\n @purchase_requisition.save\n\n# @purchase_requisition.calculate_status \n \n destinatarios = params[:destinatarios] || [] \n destinatarios << User.where(username:\"Compradores\")[0] # Es el usuario por default\n destinatarios << @purchase_requisition.buyer_id if @purchase_requisition.buyer_id#imgina Gerente Suministros quieres CREAR una SC y asignar Comprador (este codigo solo corre cuando creas ys olo el jefe de compras asigna comprador) \n\n#DEPARTMENTS = ['---','Dirección', 'Ventas','Ingeniería','Sistemas','Gerencia Planta','Suministros','Proyectos','Logística','Admin./Finanzas','Recursos humanos','Materiales','Calidad','Mantenimiento','Producción','Seguridad']# el ultimo es el 11 empieza en 0\n# 0 1* 2* 3* 4* 5* 6* 7* 8* 9* 10* 11* 12* 13* 14* 15\n\n\n if @purchase_requisition.department == 5 ||#Gerencia Planta\n @purchase_requisition.department == 11 ||#Materiales\n @purchase_requisition.department == 12 ||#Calidad 12\n @purchase_requisition.department == 13 ||#Mantenimiento 13\n @purchase_requisition.department == 14 #Producción 14\n User.where(title: 8).each do |user|\n destinatarios << user\n end\n end\n\n if @purchase_requisition.department == 6 #Suministros\n User.where(title: 9).each do |user|\n destinatarios << user\n end\n end\n if @purchase_requisition.department == 7 #Proyectos\n User.where(title: 10).each do |user|\n destinatarios << user\n end\n end\n\n if @purchase_requisition.department == 15 #Seguridad\n User.where(title: 11).each do |user|\n destinatarios << user\n end\n end\n\n\n if destinatarios.count > 0 \n mail = UserMailer.new_obj_email( current_user, destinatarios, @purchase_requisition )\n send_email(mail, destinatarios)\n end\n\n @purchase_requisition.requisition_entries.each do |re|\n if re.responsible\n mail = UserMailer.assigned_entry_or_service(current_user,re)# por default lo manda a los responsables\n send_email(mail, [re.responsible_id],\"notify\" + re.responsible_id.to_s,\"Responsable Notificado:\" )\n\n end\n end\n=begin\n @purchase_requisition.services.each do |ser|\n if ser.responsible\n\n mail = UserMailer.assigned_entry_or_service(current_user,ser) # por default lo manda a los responsables\n send_email(mail, [re.responsible_id],\"notify\" + re.responsible_id.to_s,\"Responsable Notificado:\" )\n\n end\n end\n=end\n\n format.html { redirect_to @purchase_requisition, notice: 'Solicitud de compra generada.' }\n format.json { render json: @purchase_requisition, status: :created, location: @purchase_requisition }\n else\n format.html { render action: \"new\" }\n format.json { render json: @purchase_requisition.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n id = params[:id].to_i\n qty = params[:qty].to_i\n \n cart_books = session[:cart].map { |c| c[0] }\n \n if cart_books.include?(id)\n session[:cart][cart_books.index(id)] = [id, qty]\n else\n session[:cart] << [id, qty]\n end\n \n # @cart_qty = session[:cart][cart_books.index(id)][1].to_i\n \n redirect_back(fallback_location: root_path)\n \n # logger.debug(\"Cart Create triggered\")\n # logger.debug(\"Adding book id #{params[:id]}\")\n end", "def delete_object \n diff = -1*self.quantity \n \n self.update_quantity( diff )\n self.destroy \n end", "def contractor_add\n\n # get the cliebt\n @client = Client.find(params[:client_id])\n\n # get the contract\n @contract = Contract.find(params[:id])\n\n # get the contractor\n @contractor = ContractorUser.find(params[:contractor_id])\n\n # if the contractor is not already added, add!\n\n @contract.contractor_user=@contractor\n @contract.save!\n redirect_to edit_client_contract_path(@client, @contract, :contracts_page => @contracts_page, :status => @status)\n\n end", "def reserve_inventory!(order_quantity)\n self.quantity -= order_quantity\n save!\n end", "def add_to_cart\n @cart = current_user.carts.find_or_create_by(completed: false)\n @line_item = @cart.line_items.find_or_create_by(product_id: params[:product_id])\n @line_item.update quantity: @line_item.quantity + 1\n end", "def create\n #@vacancies_max = @current_user.orders.sum(:quantity_remained, joins: :pricelist, conditions: {status: 1, pricelists: {entry_type: 3}}) + Job::VACANCIES_FREE\n #if @current_user.vacancies.count <= 7 or @vacancies_max >= @current_user.vacancies.count\n @vacancy = @current_user.vacancies.create(params[:vacancy])\n unless session[:old_job_id].nil?\n old = Vacancy.find(session[:old_job_id])\n @vacancy.list_date = old.list_date if old.user == @current_user\n end\n #@vacancy.email = @current_user.email if @vacancy.email.blank?\n #@vacancy.phone = @current_user.phone if @vacancy.phone.blank?\n #@vacancy.city = @current_user.city if @vacancy.city.blank?\n #@vacancy.name = @current_user.full_name if @vacancy.name.blank? and @current_user.full_name != @current_user.email\n #@vacancy.list_date = old.list_date\n #@vacancy.phone = @current_user.phone if @vacancy.phone.blank?\n #@vacancy.user = @current_user\n respond_to do |format|\n if @vacancy.save\n format.html { redirect_to vacancies_path, notice: 'Вакансия была создана. Проверьте и опубликуйте ее.' }\n format.json { render json: @vacancy, status: :created, location: @vacancy }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vacancy.errors, status: :unprocessable_entity }\n end\n end\n #else\n # respond_to do |format|\n # format.html { redirect_to :back, flash: { error: \"Limit of vacancies exceeded.\" }}\n # end\n # end\n end", "def destroy\n voy1=Voyage.all.where(id_itinerary: @ticketbill.itinerary_id).where(v_date: @ticketbill.departure_date).limit(1)\n voy=voy1[0]\n voy.seats=voy.seats+1\n voy.save\n if voy.seats == 34\n voy.destroy\n end\n @ticketbill.destroy\n respond_to do |format|\n format.html { redirect_to controller: 'queries',action: 'query5' }\n format.json { head :no_content }\n end\n end", "def create\n @scaleticket = Scaleticket.new(params[:scaleticket])\n @scaleticket.user_id = session[:s_user_id]\n\n \n @cropplan = Cropplan.find(@scaleticket.cropplan_id)\n if !@cropplan.nil? \n @crop = Crop.find(@cropplan.crop_id)\n @scaleticket.weight_conversion = @crop.avg_weight_uom\n @scaleticket.inventory_uom = @crop.crop_inventory_uom\n end\n \n respond_to do |format|\n if @scaleticket.save\n @update_amount = @scaleticket.pack_qty\n \n update_crop_inventory\n \n format.html { redirect_to(:controller => :scaletickets, :action => :new, :notice => 'Scaleticket created. Add next ticket.') }\n format.xml { render :xml => @scaleticket, :status => :created, :location => @scaleticket }\n \n else\n @transaction = \"new\"\n format.html { render :action => \"new\" }\n format.xml { render :xml => @scaleticket.errors, :status => :unprocessable_entity }\n end\n end\n end", "def add_stock_to_customer_cart\n # get params\n @customer_projected_rating_id = params[:id]\n @customer_drink_quantity = params[:quantity].to_i\n \n # get drink info\n if user_signed_in?\n @user = current_user\n @user_projected_ratings = ProjectedRating.where(user_id: current_user.id)\n else\n # first create an account\n @account = Account.create!(account_type: \"consumer\", number_of_users: 1)\n \n # next create fake user profile\n @fake_user_email = Faker::Internet.unique.email\n @generated_password = Devise.friendly_token.first(8)\n \n # create new user\n @user = User.create(account_id: @account.id, \n email: @fake_user_email, \n password: @generated_password,\n password_confirmation: @generated_password,\n role_id: 4,\n getting_started_step: 0,\n unregistered: true)\n \n if @user.save\n # Sign in the new user by passing validation\n bypass_sign_in(@user)\n #Rails.logger.debug(\"Current user: #{current_user.inspect}\")\n end\n end #end of check whether user is already \"signed in\"\n \n if !@user_projected_ratings.blank?\n @this_projected_rating = ProjectedRating.find_by_id(@customer_projected_rating_id)\n @inventory = Inventory.find_by_id(@this_projected_rating.inventory_id)\n @inventory_id = @inventory.id\n else\n @inventory = Inventory.find_by_id(@customer_projected_rating_id)\n @inventory_id = @inventory.id\n end\n \n # find if customer currently has an order in process\n @current_order = OrderPrep.where(account_id: @user.account_id, status: \"order in process\").first\n \n if @current_order.blank? # create a new Order Prep entry\n @current_order = OrderPrep.create!(account_id: @user.account_id, status: \"order in process\")\n end\n \n # now check if this inventory item already exists in the Order Drink Prep table\n @current_drink_order = OrderDrinkPrep.where(user_id: @user.id,\n order_prep_id: @current_order.id,\n inventory_id: @inventory_id)\n \n if !@current_drink_order.blank? #update entry\n if @customer_drink_quantity != 0\n @current_drink_order.update(quantity: @customer_drink_quantity)\n else\n @current_drink_order[0].destroy!\n end\n else # create a new entry\n OrderDrinkPrep.create!(user_id: @user.id,\n account_id: @user.account_id,\n inventory_id: @inventory.id,\n order_prep_id: @current_order.id,\n quantity: @customer_drink_quantity,\n drink_price: @inventory.drink_price_four_five)\n end\n\n # find total drink number in cart\n @order_prep_info = OrderDrinkPrep.where(order_prep_id: @current_order.id)\n @customer_number_in_cart = @order_prep_info.sum(:quantity)\n # get total amount in cart so far\n @subtotal = @order_prep_info.sum( \"drink_price*quantity\" ) \n @sales_tax = @subtotal * 0.101\n @total_drink_price = @subtotal + @sales_tax\n\n # if all drinks have been removed, delete the order prep\n if @customer_number_in_cart.to_i == 0\n @current_order.destroy!\n else\n if @current_order.delivery_fee.nil?\n @grand_total = @total_drink_price\n else\n @grand_total = @current_order.delivery_fee + @total_drink_price\n end\n # update Order Prep with cost info\n @current_order.update(subtotal: @subtotal, \n sales_tax: @sales_tax, \n total_drink_price: @total_drink_price,\n grand_total: @grand_total)\n end\n \n # update page\n respond_to do |format|\n format.js\n end # end of redirect to jquery\n \n end", "def destroy\n # @line_item = LineItem.find(params[:id])\n # @line_item.destroy\n @cart = current_cart\n# item = Item.find(params[:item_id])\n quantity = params[:quantity] || 1\n item_id=params[:item_id]\n @line_item = @cart.delete_item(item_id,quantity.to_i)\n\n respond_to do |format|\n format.html { redirect_to :back, notice: \"L'oggetto è stato rimosso dal carrello!\" }\n format.json { head :ok }\n end\n end", "def destroy\n\n if params[:product_id] then\n# TODO need to use @cart.id to ensure only this users line_item is accessed.\n current_item = LineItem.find_by_product_id(params[:product_id] )\n else\n current_item = LineItem.find(params[:id])\n end\n\n if current_item\n current_item.quantity -= 1\n puts current_item.quantity\n if current_item.quantity <= 0\n current_item.destroy\n else\n current_item.save\n end\n else\n current_item.destroy\n end\n\n respond_to do |format|\n format.html { redirect_to store_url }\n format.json { head :no_content }\n end\n end", "def create\n @coursub = Coursub.new(coursub_params)\n\n respond_to do |format|\n if @coursub.save\n format.html { redirect_to @coursub, notice: 'Coursub was successfully created.' }\n format.json { render :show, status: :created, location: @coursub }\n else\n format.html { render :new }\n format.json { render json: @coursub.errors, status: :unprocessable_entity }\n end\n end\n end", "def remove_item\n\n transaction do\n self.destroy\n \n self.shopping_cart.item_cost ||= 0\n self.shopping_cart.item_cost -= self.item_cost\n\n self.shopping_cart.product_deposit_cost ||= 0\n self.shopping_cart.product_deposit_cost -= self.product_deposit_cost\n \n self.shopping_cart.category_supplement_1_cost ||= 0\n self.shopping_cart.category_supplement_1_cost -= self.category_supplement_1_cost\n self.shopping_cart.category_supplement_2_cost ||= 0\n self.shopping_cart.category_supplement_2_cost -= self.category_supplement_2_cost\n self.shopping_cart.category_supplement_3_cost ||= 0\n self.shopping_cart.category_supplement_3_cost -= self.category_supplement_3_cost\n\n self.shopping_cart.calculate_cost(false, true)\n begin\n self.shopping_cart.save\n rescue DataMapper::SaveFailureError => error\n p \"Error saving shopping cart: #{self.shopping_cart.errors.full_messages.inspect}\"\n raise error\n end\n end\n\n end", "def new\n\n #Create new order object associated to the user\n order=current_user.orders.build\n order.save\n\n cart_items=current_user.cart.cart_items.all\n\n cart_items.each do |cart_item|\n item=Item.find(cart_item.item_id)\n\n #Create immutable object \"OrderItem\" that holds everything about the item.\n order_items=OrderItem.new(item.name,item.price,cart_item.quantity,item.keeper_id,item.id,order.id)\n order_items.save\n end\n\n #Clear cart after placing an order\n current_user.cart.clear_cart\n\n end", "def crear_productos_contratados\n @lis_products = Sale::ProductQuotation.where(sale_quotation_id: self.sale_quotation_id)\n @lis_products.each do |product|\n product.quantity.times do\n Payment::ContractedProduct.create(\n plan_id: self.id,\n product_product_id: product.product_product_id,\n price_contracted: product.product_product.price,\n valid_until: Date.today + product.product_product.valid_days,\n user_created_id: self.user_created_id)\n end\n end\n end", "def crear_cuotas\n case params[:adquisicion][:tipo_pago].to_s\n when TIPOS_PAGO[:unico].to_s\n @adquisicion.cuotas.destroy_all\n cuotas = params[:cant_cuotas]\n monto_cuota = @adquisicion.precio / cuotas.to_d\n cuotas.to_i.times do |i|\n @adquisicion.cuotas.create(monto: monto_cuota, concepto: \"Cuota #{i}\")\n end\n when TIPOS_PAGO[:recurrente].to_s\n @adquisicion.cuotas.destroy_all\n meses = params[:cant_meses]\n hoy = Time.zone.today\n dia = params[:dia_del_mes]\n mes = Time.zone.today.month\n ano = Time.zone.today.year\n fecha = Date.new(ano, mes, dia.to_i)\n hoy > fecha ? fecha += 1.month : nil\n meses.to_i.times do |i|\n @adquisicion.cuotas.create(concepto: \"Cuota #{i + 1}\", fecha_vencimiento: fecha, monto: params[:adquisicion][:precio])\n fecha += 1.month\n # mes += 1\n end\n end\n # params[:adquisicion].delete(:cuotas_attributes)\n end", "def purchase\n \t@stock -= 1\n end", "def edit\n @carts = Cart.where(user_id: current_user.id)\n @carts.each do |cart|\n Order.create(user_id: current_user.id, qty: cart.qty,order_received_date: Date.today + 1, product_size_color_id: cart.product_size_color.id, address_id: session[:address_id])\n end\n @orders = Order.where(user_id: current_user.id).order(id: :desc).page(params[:page]).per(5)\n @carts.delete_all\n super\n end", "def destroy\n #入出庫履歴マスターを削除\n InventoriesController.destroy_inventory_history(@purchase_datum)\n\t\n #add200124\n #資金繰のデータを削除\n set_cash_flow = SetCashFlow.new\n set_cash_flow.destroy_outsourcing_expected(@purchase_datum.purchase_order_datum_id) #予定\n set_cash_flow.destroy_outsourcing_actual(@purchase_datum.purchase_order_datum_id) #実際\n #\n \n\t#\n\t@purchase_datum.destroy\n respond_to do |format|\n \n\t #format.html { redirect_to purchase_data_url, notice: 'Purchase datum was successfully destroyed.' }\n #format.json { head :no_content }\n\t \n\t #format.html {redirect_to purchase_data_path( :construction_id => params[:construction_id], :move_flag => params[:move_flag])}\n\t format.html {redirect_to outsourcing_data_path( :construction_id => params[:construction_id], \n :purchase_order_id => params[:purchase_order_id], :supplier_master_id => params[:supplier_master_id],\n :move_flag => params[:move_flag])}\n end\n end", "def create\n @cart = Cart.new(cart_params)\n @item = Item.new\n if current_account && current_account.accountable_type == \"Employee\"\n @cart.update(employee_id: current_account.accountable_id)\n end\n respond_to do |format|\n if @cart.save\n format.html { redirect_back(fallback_location: :back) }\n format.json { render :show, status: :created, location: @cart }\n else\n format.html { render :new }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy_along_with_units\n self.quantity = 0\n OrderInventoryAssembly.new(self).verify\n self.destroy\n end", "def destroy_along_with_units\n self.quantity = 0\n OrderInventoryAssembly.new(self).verify\n self.destroy\n end", "def create_quincy_has_a_team\n @mark_acac_sr1 = FactoryGirl.create(:student_team, student: @mark, team: @acac_sr1, is_captain: true, start_date: 3.years.ago.to_date)\n @alex_acac_sr1 = FactoryGirl.create(:student_team, student: @alex, team: @acac_sr1, start_date: 3.years.ago.to_date)\n @quincy_acac_sr1 = FactoryGirl.create(:student_team, student: @quincy, team: @acac_sr1, start_date: 34.months.ago.to_date)\n @amanda_acac_sr2 = FactoryGirl.create(:student_team, student: @amanda, team: @acac_sr2, is_captain: true, start_date: 2.years.ago.to_date)\n @jonathan_acac_jr1 = FactoryGirl.create(:student_team, student: @jonathan, team: @acac_jr1, start_date: 11.months.ago.to_date)\n end", "def destroy\n @cuisine.destroy\n \n end", "def destroy\n @coursera.destroy\n respond_to do |format|\n format.html { redirect_to courseras_url, notice: 'Coursera was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def action(**args)\n\t\t\targs[:player].decide(:consider_purchase, property: self) if args[:player].balance >= cost unless @owner\n\t\t\tsuper\n\t\tend", "def create\n # result= get_stock_cargo_from_params(params)\n # @stock_cargo = StockCargo.new(params)\n \n # params[:stockcargo][:package_name]= #init value\n params[:stockcargo][:package_name]=$package_category_two[params[:stockcargo][:package_code]] #init value\n \n # unless params[:stockcargo][:cate_code].nil?\n params[:stockcargo][:cate_name]=$cargo_category_two[params[:stockcargo][:cate_code]] #init value\n # else\n \n # end\n params[:stockcargo][:cargocount]=0 #init value\n params[:stockcargo][:status]=\"货物闲置\" #init value\n #must initialilize ,otherwise $inc in update will not work\n params[:stockcargo][:valid_cargo]=0\n params[:stockcargo][:total_cargo]=0\n params[:stockcargo][:expired_cargo]=0\n params[:stockcargo][:sent_weight]=0\n params[:stockcargo][:sent_bulk]=0\n params[:stockcargo][:user_id]=session[:user_id] \n @stock_cargo = StockCargo.new(params[:stockcargo]) \n respond_to do |format|\n if @stock_cargo.save\n flash[:notice]=\"货物创建成功,点击下面的发布货源按钮,发布该类货物的货源信息\"\n Ustatistic.collection.update({'user_id' => session[:user_id]},{'$inc' => {\"total_stock_cargo\" => 1}}) \n # format.html { redirect_to(@stock_cargo) }\n format.html { redirect_to :action=>\"index\"}\n format.xml { render :xml => @stock_cargo, :status => :created, :location => @stock_cargo }\n else\n flash[:notice] = '货物创建失败了!.'\n format.html { render :action => \"new\" }\n format.xml { render :xml => @stock_cargo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def destroy\n @reserve.destroy\n #flash[:notice] = t('reserve.reservation_was_canceled')\n\n if @reserve.manifestation.is_reserved?\n if @reserve.item\n retain = @reserve.item.retain(User.find(1)) # TODO: システムからの送信ユーザの設定\n if retain.nil?\n flash[:message] = t('reserve.this_item_is_not_reserved')\n end\n end\n end\n\n respond_to do |format|\n format.html { redirect_to reserves_url, :notice => t('controller.successfully_deleted', :model => t('activerecord.models.reserve')) }\n format.json { head :no_content }\n end\n end", "def destroy\n @coursub.destroy\n respond_to do |format|\n format.html { redirect_to coursubs_url, notice: 'Coursub was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def set_cart\n if @current_user.nil?\n redirect_to login_path\n elsif @current_user.carts.nil?\n @cart = Cart.create( user_id: @current_user.id )\n elsif @current_user.carts.where( purchase_completed: false ).empty?\n @cart = Cart.create( user_id: @current_user.id )\n else\n @cart = @current_user.carts.find_by( purchase_completed: false )\n end\n # redirect_to cart_path( @cart )\n end", "def show\n # this is where a Cart is created when a booking starts from search, rather than straight from a tutor's profile page\n if @tutor.active_status == 'Active'\n if params[:course] \n @cart = Cart.create(info: Hash.new())\n @cart.info[:course_id] = params[:course]\n @cart.info[:tutor_id] = @tutor.id\n @cart.save\n session[:cart_id] = @cart.id\n redirect_to checkout_select_times_path(@tutor.slug)\n else\n redirect_to checkout_select_course_path(@tutor.slug)\n end\n end\n end", "def decrement_or_destroy\n @coll_card_instances.decrement_qty_or_destroy(params[:card_id])\n end", "def new_user_to_course\n\n if !current_user.nil? && current_user.is_professor?\n @course = Course.find(params[:id])\n @students = User.where('rank = ? ',User::RANK_STUDENT)\n @students -= @course.users\n render 'new_user_to_course'\n else\n redirect_to root_url\n end\n end", "def destroy\n @solicitacao.produto_solicitados.each do |item|\n i = Produto.find(item.produto_id)\n i.quantidade = i.quantidade + item.quantidade\n i.save\n end\n @solicitacao.destroy\n respond_to do |format|\n format.html { redirect_to solicitacoes_url }\n format.json { head :no_content }\n end\n end", "def create\n\n @Course = Course__c.new(params[:Course])\n @Course.OwnerId = '005G0000002idhcIAA'\n \n if @Course.save\n redirect_to course_path(@Course), :notice => 'Course was successfully created.'\n else\n format.html { render :action => \"new\" }\n end\n \n end", "def cart\n type = params[:type]\n\n if type == \"addcart\"\n #current_user.cart_additions << @item\n current_user.carts.create!(:item =>@item, :iscart? =>true)\n redirect_to cart_index_path, notice: \"#{@item.name} was added to your cart\"\n elsif type == \"removecart\"\n current_user.carts.update(:item =>@item, :iscart? =>false)\n #current_user.cart_additions.delete(@item)\n redirect_to root_path, notice: \"#{@item.name} was removed from your cart\"\n else\n redirect_to item_path(@item), notice: \"Looks like nothing happened. Try again!\"\n\n end\n end", "def execute_order_line user, line_item\n user.gift_certificates.create!(:credit_quantity => line_item.quantity,\n :gift_certificate_sku => self,\n :line_item => line_item, \n :price => price/num_credits)\n end", "def destroy\n if @cart_item.destroy\n # if @cart_item.cart.items.present?\n build do\n message 'Удаление товара из корзины'\n view 'cart_items/delete'\n end\n # else\n # @cart = @cart_item.cart\n # @cart.destroy\n # build do\n # message 'Удаление корзины'\n # view 'carts/delete'\n # end\n # end\n end\n end", "def set_courier\n @courier = Courier.find(params[:id])\n end", "def create\r\n # result= get_stock_cargo_from_params(params)\r\n # @stock_cargo = StockCargo.new(params)\r\n \r\n # params[:stockcargo][:package_name]= #init value\r\n #params[:stockcargo][:package_name]=$package_category_two[params[:stockcargo][:package_code]] #init value\r\n \r\n # unless params[:stockcargo][:cate_code].nil?\r\n #params[:stockcargo][:cate_name]=$cargo_category_two[params[:stockcargo][:cate_code]] #init value\r\n # else\r\n \r\n # end\r\n #params[:stockcargo][:status]=\"货物闲置\" #init value\r\n #must initialilize ,otherwise $inc in update will not work\r\n #params[:stockcargo][:valid_cargo]=0\r\n #params[:stockcargo][:total_cargo]=0\r\n #params[:stockcargo][:expired_cargo]=0\r\n #params[:stockcargo][:sent_weight]=0\r\n # params[:stockcargo][:sent_bulk]=0\r\n # params[:stockcargo][:user_id]=session[:user_id] \r\n @stock_cargo = current_user.stock_cargos.build(params[:stock_cargo])\r\n respond_to do |format|\r\n if @stock_cargo.save\r\n # if current_user.stock_cargos.create!(params[:stockcargo])\r\n flash[:notice]=\"货物创建成功,点击下面的发布货源按钮,发布该类货物的货源信息\"\r\n # Ustatistic.collection.update({'user_id' => session[:user_id]},{'$inc' => {\"total_stock_cargo\" => 1}}) \r\n # format.html { redirect_to(@stock_cargo) }\r\n format.html { redirect_to :action=>\"index\"}\r\n format.xml { render :xml => @stock_cargo, :status => :created, :location => @stock_cargo }\r\n else\r\n flash[:notice] = '货物创建失败了!.'\r\n format.html { render :action => \"new\" }\r\n format.xml { render :xml => @stock_cargo.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end", "def checkout_cart\n self.line_items.each do |li|\n li.item.inventory -= li.quantity\n li.item.save\n end\n self.line_items.clear\n self.status = \"submitted\"\n self.user.current_cart_id = nil\n self.user.save\n end", "def create_subscribe_competition_front\n \n \n if params[:competitionid].blank?\n\n @competitionuser = CompetitionsUser.find_by_user_id_and_competition_id(current_user.id,params[:id])\n @competition = Competition.find(params[:id])\n\n else\n @competitionuser = CompetitionsUser.find_by_user_id_and_competition_id(params[:useridc],params[:competitionid])\n @competition = Competition.find(params[:competitionid])\n end\n \n if !params[:useridc].blank?\n @current_user = User.find(params[:useridc])\n end \n p \"i got the competition user\"\n p @competitionuser\n if @competitionuser.blank?\n #this array might be used later\n @competitionuser = CompetitionsUser.new()\n @competitionuser.email = @current_user.email\n @competitionuser.name = @current_user.profile.first_name + \" \" + @current_user.profile.last_name\n @competitionuser.suburb = @current_user.profile.suburb\n @competitionuser.address = @current_user.profile.address\n @competitionuser.post_code = @current_user.profile.zip_code\n @competitionuser.user_id = @current_user.id\n if params[:competitionid].blank?\n @competitionuser.competition_id = params[:id]\n else\n @competitionuser.competition_id = params[:competitionid]\n end\n \n @competitionuser.price = 0\n @competitionuser.state = \"accepted\" \n @competitionuser.save\n @current_object = @competitionuser#Competition.find(params[:competionid])\n else\n @current_object = @competitionuser\t\n end\t\n\t ###############################################this is copy of confirm competition subscription details\n @competitionuser.confirm = true\n @competitionuser.state = 'accepted'\n @competitionuser.save\n @order = @competitionuser\n @credit_card = CreditCard.find_by_user_id(@current_user.id)\n if @credit_card.blank?\n @credit_card = CreditCard.new\t\n end\n @entry_fees = []\n @entry_fees << @competition.firstentry if !@competition.firstentry.blank?\n @entry_fees << @competition.secondentry if !@competition.secondentry.blank?\n @entry_fees << @competition.thirdentry if !@competition.thirdentry.blank?\n @entry_fees << @competition.fourthentry if !@competition.fourthentry.blank?\n @entry_fees << @competition.fifthentry if !@competition.fifthentry.blank?\n @entry_fees << @competition.sixthentry if !@competition.sixthentry.blank?\n @entry_fees << @competition.sevenentry if !@competition.sevenentry.blank?\n @entry_fees << @competition.eightentry if !@competition.eightentry.blank?\n @entry_fees << @competition.nineentry if !@competition.nineentry.blank?\n @entry_fees << @competition.tenentry if !@competition.tenentry.blank?\n session[:purchasable] = @competitionuser\n \n if params[:useridc].blank?\n \n render :update do |page|\n \n # page[\"enterintocompetitionfront\"].replace_html :partial=>\"enter_compitition_payment\",:locals=> {:order=>@order,:credit_card=>@credit_card,:competition=>@competition,:order_id=>@competitionuser.id}\n # page[\"enterintocompetition\"].show\n # page[\"list_show\"].hide\n # page[\"buylist\"].hide\n page[\"container\"].replace_html :partial=>\"show_comppayment\",:locals=> {:order=>@order,:credit_card=>@credit_card,:competition=>@competition,:order_id=>@competitionuser.id} \n \n end\n else\n render :update do |page|\n \n page[\"fragment-3\"].replace_html :partial=>\"enter_compitition_payment\",:locals=> {:order=>@order,:credit_card=>@credit_card,:competition=>@competition,:order_id=>@competitionuser.id,:entry_fees=>@entry_fees}\n end\n end\n \n\n end", "def destroy\n @cajas = Caja.all \n\n\n a = Cout.find(@viaticotbk_detail.cout_id)\n\n a.parent = nil\n\n a.save \n\n \n if @viaticotbk_detail.destroy\n\n\n begin\n @viaticotbk[:inicial] = @viaticotbk.get_total_inicial\n rescue\n @viaticotbk[:inicial] = 0\n end \n \n begin\n @viaticotbk[:total_ing] = @viaticotbk.get_total_ing\n rescue \n @viaticotbk[:total_ing] = 0\n end \n begin \n @viaticotbk[:total_egreso]= @viaticotbk.get_total_sal\n rescue \n @viaticotbk[:total_egreso]= 0 \n end \n @viaticotbk[:saldo] = @viaticotbk[:inicial] + @viaticotbk[:total_ing] - @viaticotbk[:total_egreso]\n\n\n @viaticotbk.save\n \n if @viaticotbk.caja_id == 1 \n a = @cajas.find(1)\n a.inicial = @viaticotbk[:saldo]\n a.save\n end \n if @viaticotbk.caja_id == 2\n a = @cajas.find(2)\n a.inicial = @viaticotbk[:saldo]\n a.save\n end \n if @viaticotbk.caja_id == 3 \n a = @cajas.find(3)\n a.inicial = @viaticotbk[:saldo]\n a.save\n end \n if @viaticotbk.caja_id == 4 \n a = @cajas.find(4)\n a.inicial = @viaticotbk[:saldo]\n a.save\n end \n\n if @viaticotbk.caja_id == 5\n a = @cajas.find(5)\n a.inicial = @viaticotbk[:saldo]\n a.save\n end \n\n if @viaticotbk.caja_id == 6\n a = @cajas.find(6)\n a.inicial = @viaticotbk[:saldo]\n a.save\n end \n\n \n flash[:notice]= \"Item fue eliminado satisfactoriamente \"\n redirect_to @viaticotbk\n else\n flash[:error]= \"Item ha tenido un error y no fue eliminado\"\n render :show \n end \n \n end", "def pay_with_credits\n @reservation = current_user.reservations.new(params[:reservation])\n\n respond_to do |format|\n if @reservation.save\n current_user.update_attributes(credits: current_user.credits-@reservation.meal.price)\n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\n format.json { render \"reservations/show\", success: true, status: :created, location: @reservation }\n else\n format.html {\n @menu_items = MenuItem.of_the_next_seven_days.includes(:restaurant)\n @restaurants = @menu_items.collect { |menu_item| menu_item.restaurant }\n render action: \"new\"\n }\n format.json {\n render json: @reservation.errors, status: :unprocessable_entity\n }\n end\n end\n end", "def addcourse\n current_user.courses<<@course unless current_user.courses.exists?(@course.id)\n redirect_to courses_path\n end" ]
[ "0.5989571", "0.5884454", "0.58791196", "0.5794289", "0.5767527", "0.5712051", "0.56974554", "0.56931835", "0.56616664", "0.5661304", "0.56434244", "0.5617602", "0.56034285", "0.56002253", "0.5598648", "0.55969226", "0.55898094", "0.5588776", "0.5566006", "0.5565932", "0.5561337", "0.55454177", "0.5541948", "0.5526995", "0.5525051", "0.5521773", "0.5520295", "0.54985476", "0.5475334", "0.547315", "0.54726934", "0.54699147", "0.5461391", "0.5461093", "0.54592186", "0.54583806", "0.5457274", "0.545249", "0.54418135", "0.54397106", "0.5434207", "0.5434187", "0.5431798", "0.5424774", "0.5407488", "0.54074734", "0.54062533", "0.54051375", "0.54030496", "0.5400969", "0.54005563", "0.5398214", "0.539497", "0.5387917", "0.53820693", "0.5379103", "0.53625304", "0.5359011", "0.53574497", "0.5353426", "0.5348615", "0.53455794", "0.53424615", "0.53407943", "0.53343564", "0.5334337", "0.5326988", "0.53264457", "0.5326145", "0.5324946", "0.5324673", "0.53240865", "0.53163385", "0.5312215", "0.5311988", "0.5309801", "0.5309801", "0.5306556", "0.5306", "0.53053313", "0.53049004", "0.5303855", "0.5302073", "0.5299107", "0.5297885", "0.52976763", "0.5291127", "0.5290389", "0.52902883", "0.5286978", "0.5286415", "0.52856416", "0.52850527", "0.5281539", "0.5280104", "0.52783805", "0.5275445", "0.52734375", "0.5272702", "0.52724636" ]
0.7393915
0
Sets the value of the property If status is not supplied, the status will default to 200 for nonnull properties, and 404 for null properties.
def set(property_name, value, status = nil) status = value.nil? ? 404 : 200 if status.nil? result[property_name] = [status, value] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_status_code\n if self.status_code.nil?\n self.status_code = \"200\"\n end\n end", "def set_status(val)\n self.status = val\n self\n end", "def status=(status)\n @_status = status\n end", "def status=(status)\n @_status = status\n end", "def status=(status)\n raise ArgumentError unless status.is_a?(Status)\n end", "def status(value = nil)\n\t\t\tresponse.status ||= 200\n\t\t\tresponse.headers['X-Cascade'] = 'pass' if value == 404\n\t\t\tvalue ? response.status = value : response.status\n\t\tend", "def status(value=nil)\n response.status = value if value\n response.status\n end", "def setStatus(status)\r\n\t\t\t\t\t@status = status\r\n\t\t\t\tend", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def set_status(status)\n if status.kind_of?(Symbol)\n status = Merb::ControllerExceptions::STATUS_CODES[status]\n status || raise(\"Can't find a response code with that name\")\n end\n @_status = status\n end", "def set_status\n self.status = 1\n end", "def status=(status)\n if !status.nil? && status.to_s.length > 20\n fail ArgumentError, 'invalid value for \"status\", the character length must be smaller than or equal to 20.'\n end\n\n @status = status\n end", "def status=(status); end", "def set_status!(status)\n ## FIXME_NISH Fix this.\n ## FIXED\n update(status: (status == 'true'))\n end", "def set_status(target, status)\n target.status = status\n end", "def set_status status\n self.update(pet_status: status)\n end", "def status st=nil\n @status = st if st\n @status ||= 200 #TODO: replace with constants or Kiwi.status[:OK]\n end", "def status=(status)\n validator = EnumAttributeValidator.new('String', [\"Incomplete\", \"Not-Found\", \"Not-Listed\", \"Validated\", \"Not-Evaluated\"])\n unless validator.valid?(status)\n fail ArgumentError, \"invalid value for \\\"status\\\", must be one of #{validator.allowable_values}.\"\n end\n @status = status\n end", "def set_status(status_code, fetch = false)\n case status_code\n when /1../\n @status = :running\n when \"200\"\n @status = :completed\n fetch_result if fetch\n when /4../\n @status = :error\n end\n end", "def set_status\n @status ||= Status.find(params[:id])\n end", "def status=(status)\n validator = EnumAttributeValidator.new('String', ['NotDefined', 'Active', 'Resolved', 'Closed'])\n unless validator.valid?(status)\n fail ArgumentError, 'invalid value for \"status\", must be one of #{validator.allowable_values}.'\n end\n @status = status\n end", "def status=(status)\n validator = EnumAttributeValidator.new('String', [\"processed\", \"rendered\"])\n unless validator.valid?(status)\n fail ArgumentError, \"invalid value for \\\"status\\\", must be one of #{validator.allowable_values}.\"\n end\n @status = status\n end", "def status=(new_status)\n update_values([:status] => new_status)\n end", "def status=(value)\n write_attribute :status, value.to_i\n end", "def status=(int)\n if not STATUSE.select { |k, v| v == int }\n raise Fatal::InvalidArgumentError.code(13002)\n end\n @status = int\n end", "def set_status(code)\n new(\n status: code\n )\n end", "def status=(status)\n validator = EnumAttributeValidator.new('String', ['unknown', 'not-vulnerable', 'vulnerable', 'vulnerable-version', 'vulnerable-potential', 'vulnerable-with-exception-applied', 'vulnerable-version-with-exception-applied', 'vulnerable-potential-with-exception-applied'])\n unless validator.valid?(status)\n fail ArgumentError, 'invalid value for \"status\", must be one of #{validator.allowable_values}.'\n end\n @status = status\n end", "def status=(status)\n validator = EnumAttributeValidator.new('String', ['unknown', 'archived', 'underOffer', 'sold', 'leased', 'newDevelopment', 'recentlyUpdated', 'new', 'live', 'pending'])\n unless validator.valid?(status)\n fail ArgumentError, 'invalid value for \"status\", must be one of #{validator.allowable_values}.'\n end\n @status = status\n end", "def status=(status)\n validator = EnumAttributeValidator.new('String', [\"waiting\", \"processing\", \"canceled\", \"failed\", \"succeeded\"])\n unless validator.valid?(status)\n fail ArgumentError, \"invalid value for 'status', must be one of #{validator.allowable_values}.\"\n end\n @status = status\n end", "def status(status = nil)\n if status\n @status = status\n else\n return @status if @status\n case request.request_method.to_s.upcase\n when 'POST'\n 201\n else\n 200\n end\n end \n end", "def status(*args)\n @status = args.first unless args.empty?\n @status || 200\n end", "def status code=nil\n @response.status = code if code\n @response.status\n end", "def status=(status)\n validator = EnumAttributeValidator.new('String', ['new', 'used', 'expired'])\n unless validator.valid?(status)\n fail ArgumentError, 'invalid value for \"status\", must be one of #{validator.allowable_values}.'\n end\n @status = status\n end", "def http_response_code(status = nil)\n if status\n @status = status\n else\n @status\n end\n end", "def set_default_params_status params\n params[:status] ||= 200\n end", "def status=(status)\n validator = EnumAttributeValidator.new('String', ['pending', 'active', 'inactive'])\n unless validator.valid?(status)\n fail ArgumentError, 'invalid value for \"status\", must be one of #{validator.allowable_values}.'\n end\n @status = status\n end", "def status=(status)\n @content[0] = status\n end", "def set_status\n @status= {\n 'Unstarted' => 0,\n 'In Progress' => 1,\n 'Completed' => 2\n }\n end", "def set_status\n @status = Status.find(params[:id])\n end", "def set_status\n @status = Status.find(params[:id])\n end", "def set_status\n @status = Status.find(params[:id])\n end", "def set_status\n @status = Status.find(params[:id])\n end", "def set_status\n @status = Status.find(params[:id])\n end", "def set_status\n @status = Status.find(params[:id])\n end", "def set_status\n @status = Status.find(params[:id])\n end", "def set_status\n @status = Status.find(params[:id])\n end", "def set_status\n @status = Status.find(params[:id])\n end", "def set_status\n @status = Status.find(params[:id])\n end", "def set_status\n @status = Status.find(params[:id])\n end", "def set_status\n @status = Status.find(params[:id])\n end", "def set_status\n @status = Status.find(params[:id])\n end", "def set_status\n @status = Status.find(params[:id])\n end", "def status=(new_status)\n self.last_status = status\n\n self.setValue new_status, forKey: 'status'\n end", "def set_status(status, status_message = '')\n return if status == Algorithm.statuses[self.status]\n self.update_attributes(status: status)\n self.update_attributes(status_message: status_message)\n self.update_attribute(:diva_id, nil) if self.status == 'review' || self.status == 'unpublished_changes'\n self.update_version if self.status == 'published'\n end", "def status=(val)\n unless [nil, :frozen, :live].include?(val)\n raise ArgumentError.new(\"Status must be :frozen or :live\") \n end\n @status = val\n end", "def status=(val)\n if val.nil?\n delete_element('status')\n else\n replace_element_text('status', val)\n end\n end", "def status=(value)\n raise RiskResponseStatusError.new(value) unless value == 0\n end", "def project_status_setter(status)\n if ['Proposed', 'Suspended', 'Postponed',\n 'Cancelled', 'In progress'].include? status\n self.status = status\n save\n else\n false\n end\n end", "def http_status(hs=nil)\n @_http_status = hs unless hs.nil?\n @_http_status\n end", "def set_status\n @status = Status.find(params[:id])\n end", "def status=(status)\n validator = EnumAttributeValidator.new('String', [\"LIVE\", \"QUARANTINED\", \"REMOVED\"])\n unless validator.valid?(status)\n fail ArgumentError, \"invalid value for 'status', must be one of #{validator.allowable_values}.\"\n end\n @status = status\n end", "def change_status(object, status)\n object.update_attribute :status, status\n end", "def setStatus( status )\n\t\t\tif @options.status.include?( status )\n\t\t\t\t@data.status = status\n\t\t\t\treturn true\n\t\t\tend\n\t\t\tfalse\n\t\tend", "def overall_status=(status)\n raise \"unknown status #{status}\" unless [ \"PASSED\", \"FAILED\", \"ERROR\" ].include?(status)\n\n case @overall_status\n when nil, \"PASSED\"\n @overall_status = status\n when \"ERROR\"\n # this status cannot be overriden\n when \"FAILED\"\n @overall_status = status if status != \"PASSED\"\n end\n end", "def status=(value)\n value = value.to_s.to_sym\n fail Deployment::InvalidArgument, \"#{self}: Invalid task status: #{value}\" unless ALLOWED_STATUSES.include? value\n status_changes_concurrency @status, value\n @status = value\n reset_forward if DEPENDENCY_CHANGING_STATUSES.include? value\n @status\n end", "def status=(v)\n @status = alma_string v\n end", "def status=(status)\n validator = EnumAttributeValidator.new('String', [\"not_activated\", \"done\", \"in_progress\", \"error\", \"paused\", \"stopped_by_system\", \"in_queue\", \"finished_with_warnings\", \"calculating\", \"stopped_by_user\"])\n unless validator.valid?(status)\n fail ArgumentError, \"invalid value for \\\"status\\\", must be one of #{validator.allowable_values}.\"\n end\n @status = status\n end", "def update_status(status)\n self.status = status\n self.save! validate: false\n end", "def status=(status)\n if status && (status.is_a?(String) || status.is_a?(Symbol))\n @status = status.upcase.to_sym\n end\n end", "def status=(status)\n validator = EnumAttributeValidator.new('String', [\"ACTIVE\", \"INVOICED\", \"LOCKED\"])\n unless validator.valid?(status)\n fail ArgumentError, \"invalid value for \\\"status\\\", must be one of #{validator.allowable_values}.\"\n end\n @status = status\n end", "def status=(status)\n instance_set(:size, status)\n end", "def status=(status)\n validator = EnumAttributeValidator.new('String', [\"ACTIVE\", \"INACTIVE\"])\n unless validator.valid?(status)\n fail ArgumentError, \"invalid value for 'status', must be one of #{validator.allowable_values}.\"\n end\n @status = status\n end", "def status=(status)\n validator = EnumAttributeValidator.new('String', [\"active\", \"paused\", \"ready\", \"delivered\", \"cancelled\", \"reverted\"])\n unless validator.valid?(status)\n fail ArgumentError, \"invalid value for 'status', must be one of #{validator.allowable_values}.\"\n end\n @status = status\n end", "def set_status\n @status = Status.find(params[:id])\n end", "def set_status\n @status = Status.find(params[:id])\n end", "def set_status\n @status = Status.find(params[:id])\n end", "def set_status\n @status = Status.find(params[:id])\n end" ]
[ "0.70338356", "0.6806251", "0.6752961", "0.6752961", "0.673785", "0.663394", "0.66199183", "0.653434", "0.650992", "0.6508947", "0.6508947", "0.6508947", "0.6508947", "0.6508947", "0.6508947", "0.6508947", "0.6508947", "0.6508947", "0.6508947", "0.6508947", "0.6508947", "0.6508947", "0.6508947", "0.6508947", "0.6508947", "0.6508947", "0.6508947", "0.6508947", "0.6508947", "0.6508947", "0.6508947", "0.6508947", "0.6478358", "0.64347965", "0.6432018", "0.640054", "0.6393743", "0.6336039", "0.63197863", "0.6289596", "0.6276373", "0.62325877", "0.62215245", "0.61723864", "0.61721635", "0.61693174", "0.61677456", "0.61535054", "0.61527824", "0.6147554", "0.6143148", "0.614046", "0.6101389", "0.6092465", "0.60690546", "0.6055774", "0.60504186", "0.6039101", "0.6025851", "0.6011855", "0.60102725", "0.6005265", "0.6005265", "0.6005265", "0.6005265", "0.6005265", "0.6005265", "0.6005265", "0.6005265", "0.6005265", "0.6005265", "0.6005265", "0.6005265", "0.6005265", "0.6005265", "0.5989966", "0.59830844", "0.5979408", "0.59782594", "0.59768045", "0.59630823", "0.5943857", "0.59373593", "0.5935421", "0.592567", "0.59159034", "0.5893495", "0.58900017", "0.58810264", "0.58803415", "0.58633614", "0.5854895", "0.5853481", "0.5852931", "0.5849099", "0.58347285", "0.5834456", "0.5834456", "0.5834456", "0.5834456" ]
0.79299617
0
Returns the current value for a property.
def get(property_name) result.key?(property_name) ? result[property_name][1] : nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def value\n @property_hash[:value]\n end", "def get_property(property)\n get_compound_value(get_value(property))\n end", "def property\n @property\n end", "def get_value(property)\n if @env_properties.get_value(property)\n return @env_properties.get_value(property)\n end\n @file_properties.get_value(property)\n end", "def current_value\n @value\n end", "def get_raw_property_value(name)\n return @property_values[name]\n end", "def current_property\n @property = Property.find(params[:id])\n end", "def get_value(property_path)\n element = @tree.select(property_path)[0]\n element.nil? ? nil : element.value\n end", "def get_property _property\n send_cmd(\"get_property #{_property}\")\n end", "def get_property_value(name)\n property = get_property(name)\n \n # Throw error if property doesn't exist\n if property.nil?\n raise StandardError.new(\"Property does not exist: #{name}\")\n end\n\n # Return the property value\n property.get_value(self)\n end", "def [](property_name)\n properties[property_name.to_s].value\n end", "def get\n @value\n end", "def prop\n return PropertyContext\n end", "def prop\n return PropertyContext\n end", "def get_property(property_name)\n value = get() and value[property_name]\n end", "def prop(name)\n properties.named(name).first.andand.value\n end", "def changed_value(property)\n new_value = new_resource.send(property)\n return new_value if current_resource.nil?\n\n current_value = current_resource.send(property)\n\n return current_value if required_properties.include? property\n\n new_value == current_value ? nil : new_value\n end", "def intersys_get(property)\n intersys_property(property).get\n end", "def property(name)\n get(\"/session/#{session_id}/element/#{element_id}/property/#{name}\").value\n end", "def get_value\n @value\n end", "def get_property(*args)\n return unless alive?\n\n command(\"get_property\", *args)[\"data\"]\n end", "def current_value; end", "def property_value(property_key, default_value=nil)\n prop=property(property_key)\n if default_value && property_key=='depth'\n # we're in SQALE.... Keep the text_value\n result = (prop ? prop.text_value : nil)||default_value\n else\n result = (prop ? prop.value : nil)\n unless result\n property_definition=java_definition.getWidgetProperty(property_key)\n result = WidgetProperty.text_to_value(property_definition.defaultValue(), property_definition.type().name()) if property_definition\n end\n end\n result\n end", "def get_property(key)\n self.fetch key\n end", "def get(property)\n self.send(property.to_sym)\n end", "def current_value\n value = $options.send(getter)\n if @type == :slider\n value = value.clamp(@values[:min], @values[:max])\n return value - (value % @values[:increment])\n end\n value_index = @values.index(value)\n return @values[value_index || 0]\n end", "def value\n\t\t# This bizarre construct is done in order to not be reliant\n\t\t# on the inherent assignment-order when using Property.new({...})\n\t\t# since that hash can be ordered anywhich way .daniel\n\t\tif value_id\n\t\t\tvalue_object.value\n\t\telse\t\t\t\n\t\t\t@value\n\t\tend\n\tend", "def get\n val\n end", "def get\n val\n end", "def value\n return @value\n end", "def value\n return @value\n end", "def value\n return @value\n end", "def get_property(name)\n return @properties[name]\n end", "def _property(p_name)\n __t_stringish(p_name)\n _jinja.properties[__attribute_key(p_name)]\n end", "def property(name)\n @property_hash[name]\n end", "def property property\n\t\tret = '@property '\n\n\t\tcase property.type\n\t\twhen 'int' then ret << '(nonatomic) int '\n\t\twhen 'bool' then ret << '(nonatomic) BOOL '\n\t\twhen 'flt' then ret << '(nonatomic) float '\n\t\twhen 'str' then ret << '(strong, nonatomic) NSString * '\n\t\twhen 'arr' then ret << '(strong, nonatomic) NSArray * '\n\t\twhen 'dict' then ret << '(strong, nonatomic) NSDictionary * '\n\t\telse\n\t\t\t#fallthrough: a custom object was provided\n\t\t\tret << \"(strong, nonatomic) #{property.type} * \"\n\t\tend\n\n\t\tret << property.name << \";\\n\"\n\t\tret\n\tend", "def property_name\n property.name if property\n end", "def property_reader(property)\n define_method \"#{property}\" do\n value = instance_variable_get(\"@#{property}\")\n if value.nil? && partial? && persisted?\n instance_variable_get(\"@#{property}\")\n else\n value\n end\n end\n end", "def value\n @value\n end", "def value\n @value\n end", "def value\n return @val\n end", "def value\n self['value']\n end", "def value\r\n @value\r\n end", "def property(value)\n merge(property: value.to_s)\n end", "def get_property(key)\n @data[key]\n end", "def value\n send property.type_field\n end", "def get_property(name)\n $NEO_LOGGER.debug{\"get property '#{name}'\"}\n \n return nil if ! property?(name)\n value = @internal_node.get_property(name.to_s)\n if self.class.marshal?(name)\n Marshal.load(String.from_java_bytes(value))\n else\n value\n end\n end", "def value\n @value\n end", "def value\n @value\n end", "def value\n @value\n end", "def value\n @value\n end", "def value\n @value\n end", "def value\n @value\n end", "def value\n @value\n end", "def get_property(property_name)\n command(\"get_property\", property_name)\n end", "def get_value\n @value \n end", "def property_name\n property.identifing_name\n end", "def get_value\n value\n end", "def get_value\n value\n end", "def value \n @value\n end", "def value\n variable.value\n end", "def value\n attributes.fetch(:value)\n end", "def css_value(locator, property)\n find_element(locator).css_value(property)\n end", "def get_property\n @xml = client.call(url).parsed_response.css('property').first\n @attributes.merge!(parse_xml_to_hash)\n end", "def value\n if @value\n @value\n else\n @value = resolve( :value )\n end\n end", "def name\n @property_name\n end", "def value\n self\n end", "def get_property!(node, name)\n value = node.xpath(name).text\n raise \"missing property '#{name}' in node: #{node}\" if value.empty?\n value\n end", "def property(name); end", "def value!\n @value\n end", "def [](property)\n data[property]\n end", "def get_property(property)\n rows = weather_properties.select do |row|\n row.header.text.downcase == property\n end\n\n return nil if rows.empty?\n\n rows.first.value.text\n end", "def css_value(prop); end", "def property(name)\n ensure_valid\n return property_cache[name] if property_cache.include? name\n prop = self.class.properties[name]\n raise \"No such property #{name}\" if not prop\n property_cache[name] = prop.get(@model, @path)\n end", "def record_value(record, property)\n case record\n when Hash\n record.fetch(property, record[property.field])\n when Resource\n property.get!(record)\n end\n end", "def master_property\n @data[\"master_property\"]\n end", "def value_for (attribute)\n unless current_values.key?(attribute)\n raise ArgumentError, \"No such attribute: #{attribute.inspect}\"\n end\n current_values[attribute]\n end", "def get(value)\n value\n end", "def property_name\n property.display_name\n end", "def value\n if allows_nil? && properties.values.all?(&:nil?)\n nil\n else\n Hash[properties.map { |key, value| [key, value.value] }]\n end\n end", "def property(prop)\n return unless @parsed.property_any_supported?(prop)\n return unless result = @parsed.public_send(prop)\n\n puts yield(result)\n end", "def value\n @value || default_value\n end", "def value\n @value ||= extract_value\n end", "def method_property\n @method_property\n end", "def value\n `#{@el}.value`\n end", "def value\n @value || __eval\n end", "def value\n record.send(name).value\n end", "def get_property_value(value, is_url: false)\n # Assume hash values are a type/value pair\n if value.is_a?(Hash)\n type = value['type']\n value = value['value']\n else\n type = nil\n end\n # Apply transformations to string properties\n value = transform(value, is_url: is_url) if value.is_a?(String)\n # If a block is present, return the result of the block\n return yield(value, type) if block_given?\n # Otherwise return the value\n value\n end", "def get_property(property_name)\n function = <<~JAVASCRIPT\n (object, propertyName) => {\n const result = {__proto__: null};\n result[propertyName] = object[propertyName];\n return result;\n }\n JAVASCRIPT\n object_handle = execution_context.evaluate_handle_function(function, self, property_name).value!\n properties = object_handle.get_properties\n result = properties[property_name]\n object_handle.dispose\n result\n end", "def get_value(owner)\n raw_value = owner.get_raw_property_value(name)\n\n if raw_value.nil?\n return nil\n else\n case type\n when 'string' then raw_value\n when 'integer' then raw_value\n when 'decimal' then raw_value\n when 'length' then \"#{raw_value}px\"\n when 'color' then sprintf('#%06x', raw_value)\n when 'percent' then \"#{(raw_value*100).to_i}%\"\n end\n end\n end", "def value\n self[@name]\n end", "def get_p(component, property, componentInfo=nil)\n return $marathon.getProperty(ComponentId.new(component, componentInfo), property)\nend", "def get_property_at_index(propertyIndex,exception = nil)\n res = super(context,self,propertyIndex,exception)\n\n \n val_ref = JS::Value.from_pointer_with_context(context,res)\n ret = val_ref.to_ruby\n if ret.is_a?(JS::Value)\n return check_use(ret) || is_self(ret) || ret\n else\n return check_use(ret) || ret\n end\n \n \n end", "def get_property(propertyName,exception = nil)\n propertyName = JS::String.create_with_utf8cstring(propertyName)\n res = super(context,self,propertyName,exception)\n\n \n val_ref = JS::Value.from_pointer_with_context(context,res)\n ret = val_ref.to_ruby\n if ret.is_a?(JS::Value)\n return check_use(ret) || is_self(ret) || ret\n else\n return check_use(ret) || ret\n end\n \n \n end", "def value\n return @children['value'][:value]\n end", "def currentpropvalues\n # It's important to use the 'properties' method here, as it follows the order\n # in which they're defined in the class. It also guarantees that 'ensure'\n # is the first property, which is important for skipping 'retrieve' on\n # all the properties if the resource is absent.\n ensure_state = false\n return properties.inject({}) do | prophash, property|\n if property.name == :ensure\n ensure_state = property.retrieve\n prophash[property] = ensure_state\n else\n if ensure_state == :absent\n prophash[property] = :absent\n else\n prophash[property] = property.retrieve\n end\n end\n prophash\n end\n end", "def get_value name=nil\n @value\n end", "def getvalue_for_paint\n getvalue\n end", "def get_p(component, property, componentInfo=nil)\n return $marathon.getProperty(ComponentId.new(component, componentInfo), property)\nend", "def get_property(key, default_value = nil)\n end", "def get(key)\n properties[key]\n end" ]
[ "0.78299403", "0.7591512", "0.743325", "0.73214686", "0.70258915", "0.6974477", "0.69694823", "0.6854283", "0.68525684", "0.68348163", "0.6823198", "0.6687429", "0.6646973", "0.66069996", "0.65822226", "0.64987206", "0.6472641", "0.64386296", "0.64160275", "0.6395094", "0.638764", "0.63674897", "0.6365149", "0.6350382", "0.6344013", "0.63426226", "0.6305064", "0.6298412", "0.6298412", "0.6289165", "0.6289165", "0.6289165", "0.62680393", "0.62667954", "0.6266741", "0.62386185", "0.6222547", "0.62129444", "0.619549", "0.619549", "0.6192157", "0.61796296", "0.6177047", "0.6129743", "0.6101484", "0.6094581", "0.6092046", "0.60914665", "0.60914665", "0.60914665", "0.60914665", "0.60914665", "0.60914665", "0.60914665", "0.60896367", "0.60864264", "0.60846305", "0.60554606", "0.60554606", "0.6019535", "0.60072887", "0.59945524", "0.59832835", "0.59696335", "0.5953962", "0.59458846", "0.59452707", "0.594241", "0.5906286", "0.5904081", "0.5900054", "0.58978325", "0.58890885", "0.58605677", "0.58552027", "0.58427083", "0.5827409", "0.5820931", "0.5817664", "0.581101", "0.5804606", "0.58007234", "0.57959956", "0.57914144", "0.57885957", "0.5783399", "0.57808554", "0.5766001", "0.5764705", "0.5763133", "0.57608795", "0.57602817", "0.5748517", "0.5746512", "0.574547", "0.5737847", "0.57367384", "0.57293165", "0.57232404", "0.56987697", "0.5698494" ]
0.0
-1
Returns the current status code for a property name. If the property does not appear in the list of requested properties, null will be returned.
def status(property_name) result.key?(property_name) ? result[property_name][0] : 404 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_property( propname )\n resp = conn.get('/users/'+name+'/props/'+propname+'/')\n \n case resp.code.to_i\n when 200\n return JSON.parse( resp.body )\n when 404\n case resp.header['resource-type']\n when 'user'\n raise RestAuthUserNotFound.new( resp )\n when 'property'\n raise RestAuthPropertyNotFound.new( resp )\n else\n raise RestAuthBadResponse.new( resp, \"Received 404 without Resource-Type header\" )\n end\n else\n raise RestAuthUnknownStatus.new( resp )\n end\n end", "def property_status_lookup(code)\n case code.to_i\n when 0 then [ 'For Sale', 'To Let' ]\n when 1 then [ 'Under Offer', 'Let' ]\n when 2 then [ 'Sold', 'Under Offer' ]\n when 3 then [ 'SSTC', 'Reserved' ]\n when 4 then [ 'For Sale By Auction', 'Let Agreed' ]\n when 5 then [ 'Reserved' ]\n when 6 then [ 'New Instruction' ]\n when 7 then [ 'Just on Market' ]\n when 8 then [ 'Price Reduction' ]\n when 9 then [ 'Keen to Sell' ]\n when 10 then [ 'No Chain' ]\n when 11 then [ 'Vendor will pay stamp duty' ]\n when 12 then [ 'Offers in the region of' ]\n when 13 then [ 'Guide Price' ]\n when 200 then [ 'For Sale', 'To Let' ]\n when 201 then [ 'Under Offer', 'Let' ]\n when 202 then [ 'Sold', 'Under Offer' ]\n when 203 then [ 'SSTC', 'Reserved' ]\n when 214 then [ 'Under Offer', 'Let' ]\n when 255 then []\n else nil\n end\n end", "def get(property_name)\n result.key?(property_name) ? result[property_name][1] : nil\n end", "def get_property(property_name)\n command(\"get_property\", property_name)\n end", "def get_property(name)\n return @properties[name]\n end", "def get_property property_name\n\n begin\n\n if property_name == ''\n raise 'Property name not specified.'\n end\n\n str_uri = $product_uri + '/words/' + @filename + '/documentProperties/' + property_name\n signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)\n\n response_stream = RestClient.get(signed_str_uri, {:accept => 'application/json'})\n\n stream_hash = JSON.parse(response_stream)\n stream_hash['Code'] == 200 ? stream_hash['DocumentProperty'] : false\n\n rescue Exception => e\n print e\n end\n\n end", "def name_property\n p = properties.find { |n, p| p.name_property? }\n p ? p.first : nil\n end", "def getProperty(propName)\n begin\n elementObject = waitForObject(@symbolicName, OBJECT_WAIT_TIMEOUT)\n @properties = Squish::Object.properties(elementObject)\n\n if @properties[propName]\n return @properties[propName]\n else\n # Property does not exist\n return nil\n end\n rescue Exception => e\n Log.TestFail(\"#{self.class.name}::#{__method__}(): \" + @symbolicName + \": \" + e.message)\n end\n end", "def get_property property_name\n \n begin\n \n if @filename == \"\"\n raise \"Base file not specified.\"\n end\n \n if property_name == \"\"\n raise \"Property name not specified.\"\n end\n \n str_uri = $productURI + \"/words/\" + @filename + \"/documentProperties/\" + property_name\n signed_str_uri = Common::Utils.sign(str_uri)\n \n response_stream = RestClient.get(signed_str_uri,{:accept=>\"application/json\"})\n \n stream_hash = JSON.parse(response_stream)\n \n if(stream_hash[\"Code\"] == 200)\n return stream_hash[\"DocumentProperty\"]\n else\n return false\n end\n \n rescue Exception=>e\n print e\n end\n \n end", "def get_property(property_name)\n value = get() and value[property_name]\n end", "def get_property property_name\n \n begin\n \n if @filename == ''\n raise 'Base file not specified.'\n end\n \n if property_name == ''\n raise 'Property name not specified.'\n end\n \n str_uri = $product_uri + '/slides/' + @filename + '/documentProperties/' + property_name\n signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)\n \n response_stream = RestClient.get(signed_str_uri,{:accept=>'application/json'})\n \n stream_hash = JSON.parse(response_stream)\n \n if(stream_hash['Code'] == 200)\n return stream_hash['DocumentProperty']\n else\n return false\n end\n \n rescue Exception=>e\n print e\n end\n \n end", "def property(name)\n @property_hash[name]\n end", "def set(property_name, value, status = nil)\n status = value.nil? ? 404 : 200 if status.nil?\n result[property_name] = [status, value]\n end", "def property_name\n property.name if property\n end", "def [](property_name)\n properties[property_name.to_s].value\n end", "def get_property(property)\n rows = weather_properties.select do |row|\n row.header.text.downcase == property\n end\n\n return nil if rows.empty?\n\n rows.first.value.text\n end", "def status\n STATUSES[code] || 'Unknown'\n end", "def prop(name)\n properties.named(name).first.andand.value\n end", "def check_property_value(properties, property_name)\n if properties[property_name].nil? or properties[property_name].empty?\n raise \"Entity property with symbol key '#{property_name}' should be specified\"\n end\n end", "def integer_property(name)\n val = property(name)\n val ? property_cache[name] = val.to_i : nil\n end", "def get_site_property( site_id, property_name )\n client = prepare_request( @service_wsdl )\n\n response = do_request_and_handle_errors do\n client.request :get_site_property do |soap|\n soap.body = {:sessionid => @session, :siteid => site_id, :propname => property_name}\n end\n end\n\n result = response.to_hash[:get_site_property_response][:get_site_property_return]\n\n (result.kind_of? Hash) ? (return false) : (return true)\n end", "def changed_value(property)\n new_value = new_resource.send(property)\n return new_value if current_resource.nil?\n\n current_value = current_resource.send(property)\n\n return current_value if required_properties.include? property\n\n new_value == current_value ? nil : new_value\n end", "def css_status(status = nil)\n CSS_STATUSES[status || object.status]\n end", "def property_name\n property.identifing_name\n end", "def status\n Integer(@object.payload[:status]) rescue nil\n end", "def get_property _property\n send_cmd(\"get_property #{_property}\")\n end", "def get_document_property(name, property_name, opts = {})\n @api_client.request_token_if_needed\n data, _status_code, _headers = get_document_property_with_http_info(name, property_name, opts)\n rescue ApiError => error\n if error.code == 401\n @api_client.request_token_if_needed\n data, _status_code, _headers = get_document_property_with_http_info(name, property_name, opts)\n else\n raise\n end\n return data\n end", "def property(name)\n return type if name == :type\n Builtin::Error.new(\"PropertyUnknownError: '#{name}' not recognized by #{type}\")\n end", "def fetch_property(name)\n properties.where(\"name = ?\", name).first\n end", "def get_property(name)\n $NEO_LOGGER.debug{\"get property '#{name}'\"}\n \n return nil if ! property?(name)\n value = @internal_node.get_property(name.to_s)\n if self.class.marshal?(name)\n Marshal.load(String.from_java_bytes(value))\n else\n value\n end\n end", "def status(*code)\n self.status_code = code.first if code.first.present?\n self.status_code\n end", "def property(name)\n ensure_valid\n return property_cache[name] if property_cache.include? name\n prop = self.class.properties[name]\n raise \"No such property #{name}\" if not prop\n property_cache[name] = prop.get(@model, @path)\n end", "def property(name)\n (obj = @parameters[name.intern] and obj.is_a?(Puppet::Property)) ? obj : nil\n end", "def get_property(property_name)\n function = <<~JAVASCRIPT\n (object, propertyName) => {\n const result = {__proto__: null};\n result[propertyName] = object[propertyName];\n return result;\n }\n JAVASCRIPT\n object_handle = execution_context.evaluate_handle_function(function, self, property_name).value!\n properties = object_handle.get_properties\n result = properties[property_name]\n object_handle.dispose\n result\n end", "def current_property\n @property = Property.find(params[:id])\n end", "def status\n status = stats.fetch @resource[:name], nil\n debug \"Got status: '#{status}'\"\n return :absent unless status\n return :present if [:present, :absent].include? @resource[:ensure]\n return :up if status == 'UP'\n return :down if status == 'DOWN'\n :present\n end", "def get_value(property)\n if @env_properties.get_value(property)\n return @env_properties.get_value(property)\n end\n @file_properties.get_value(property)\n end", "def get_status status_code\n status = STATUSES[status_code]\n if status\n status\n else\n status = STATUSES['IV']\n end\n end", "def getStatus\n @@statuses[@status]\n end", "def get_property_value(name)\n property = get_property(name)\n \n # Throw error if property doesn't exist\n if property.nil?\n raise StandardError.new(\"Property does not exist: #{name}\")\n end\n\n # Return the property value\n property.get_value(self)\n end", "def add_prop_status_to_response(res_ctx, msg_props, response)\n msg_props.each do |p|\n # Property can either be defined as 'request' API call\n # or just an internal variable, e.g. uid, hrn, etc.\n if res_ctx.respond_to? \"request_#{p}\"\n response[p] = res_ctx.__send__(\"request_#{p}\")\n elsif res_ctx.respond_to? p\n response[p] = res_ctx.__send__(p)\n end\n end\n end", "def property_number(property)\n if @vocabulary.properties.has_key?(property)\n @vocabulary.properties[property][:num]\n else\n @vocabulary.properties[:any][:num]\n end\n end", "def Status(name)\n return -1 if !checkExists(name)\n Convert.to_integer(\n SCR.Execute(\n path(\".target.bash\"),\n Builtins.sformat(\"%1 status %2.service\", @invoker, name),\n { \"TERM\" => \"raw\" }\n )\n )\n end", "def find_property\n unless self.property_name.blank?\n my_properties = Property.active.find_all_by_name(self.property_name)\n unless my_properties.blank? || my_properties.length != Array(self.property_name).length\n self.properties = my_properties\n else\n self.property_lookup_failed = true\n end\n end\n # be sure the call back returns true or else the call will fail with no error message\n # from the validation loop\n return true\n end", "def include_property_name?(property)\n property = Converter.rsc_2_str(property)\n each_property_name do |item|\n if item == property\n return true\n end\n end\n return false\n end", "def has_property?(name)\n property_names.include?(name.to_str)\n end", "def name\n @property_name\n end", "def status_name\n STATUSES[status]\n end", "def get_status_method\n status = false\n begin\n if @status_method.is_a? Hash\n meth = @status_method.first\n status = !!@responding_object.send(meth.first, *meth.last)\n else\n status = !!@responding_object.send(@status_method)\n end\n rescue Exception => e\n self.responding_object = e.class\n self.status_message = e.message\n end\n return status\n end", "def get_property_uri(name)\n p = @datatype_properties.detect { |mapping| name == mapping.name }\n if p == nil\n return nil\n else\n return p.property_uri\n end\n end", "def property(_name)\n raise Orocos::NotFound, \"#property is not implemented in #{self.class}\"\n end", "def property?(name); end", "def property?(name)\n raw.key? name\n end", "def getStatusCode\n @_statusCode\n end", "def preferred(property_name)\n preferred = nil\n last_pref = 101\n select(property_name).each do |field|\n pref = 101\n\n if field.key?('TYPE') && field['TYPE'].has('PREF')\n pref = 1\n elsif field.key?('PREF')\n pref = field['PREF'].value.to_i\n end\n\n if pref < last_pref || preferred.nil?\n preferred = field\n last_pref = pref\n end\n end\n\n preferred\n end", "def property(name)\n get(\"/session/#{session_id}/element/#{element_id}/property/#{name}\").value\n end", "def intersys_get(property)\n intersys_property(property).get\n end", "def status_code\n self.status.to_i\n end", "def property(name, verify = true)\n name = name.to_str\n if @properties[name]\n p = @properties[name]\n p.tracked = true\n p\n else\n raise NotFound, \"no property named '#{name}' on log task '#{self.name}'\"\n end\n end", "def get_property(prop)\r\n prop = URI.parse(prop) unless prop.is_a?(URI)\r\n\r\n each_property{|predicate, object|\r\n return object if predicate == prop\r\n }\r\n nil\r\n end", "def status_code\n @data[:status_code].to_i\n end", "def property_status(last_booking_event)\n last_booking_event.nil? || last_booking_event.type == 'BookingCheckedOut' ? 'empty' : 'occupied'\n end", "def status_code\n params['Status']\n end", "def status\n params['ret_status']\n end", "def status\n case @result.retval\n when 0 ; \"ok\"\n when 1 ; \"warning\"\n when 2 ; \"critical\"\n end\n end", "def property(project_id, event_collection, property_name)\n resource \"projects/#{project_id}/events/#{event_collection}/properties/#{property_name}\"\n end", "def wait_for(request, property=nil)\n request.wait\n if request.response.eof?\n nil\n elsif !request.response.ok?\n raise StatusException.new(request.response)\n elsif property\n request.response[property.to_sym]\n else\n request.response\n end\n end", "def property(name); end", "def find_property(properties, path, res_name = '')\n # Add context for debugging property name typos\n available = []\n prefix = ''\n\n prop = nil\n path.each do |part|\n available = properties.map { |p| prefix + p.name } unless properties.empty?\n prefix = \"#{prefix}#{part}.\"\n\n prop = properties.select { |o| o.name == part }.first\n properties = prop&.nested_properties || []\n end\n raise \"#{path.join('.')} does not exist on #{res_name}.\\n Possible values #{available}\" \\\n unless prop\n\n prop\n end", "def status\n STATUSES[self.status_id || 0]\n end", "def get_property(property)\n get_compound_value(get_value(property))\n end", "def scode(thing)\n\t\treturn StatusCodes[thing] || ''\n\tend", "def get_property(ctx,object,propertyName,exception)\n JS::Lib.JSObjectGetProperty(ctx,object,propertyName,exception)\n end", "def status\n @status ||= STATUS[mapping_for(:status)]\n end", "def status\n @status ||= STATUS[mapping_for(:status)]\n end", "def status\n return :code => info[:statuscode].to_i, :messages => info[:messages]\n end", "def get_property!(node, name)\n value = node.xpath(name).text\n raise \"missing property '#{name}' in node: #{node}\" if value.empty?\n value\n end", "def property_version_id(property_id:)\n if status[:product_properties]\n status[:product_properties].collect do |item|\n item[:property_version_id] if item[:property_id] == property_id\n end.compact.first\n else\n nil\n end\n end", "def find_status\n health = get_es_resource('/_cluster/health')\n health['status'].downcase\n end", "def status_code\n data.status_code\n end", "def status\n if status_code.present?\n if status_code['HL7 ActStatus']\n status_code['HL7 ActStatus'].first()\n elsif status_code['SNOMED-CT']\n case status_code['SNOMED-CT'].first()\n when '55561003'\n 'active'\n when '73425007'\n 'inactive'\n when '413322009' \n 'resolved'\n end\n end\n end\n end", "def property?(name)\n @internal_node.has_property(name.to_s) unless @internal_node.nil?\n end", "def get_property_type(entity_name, property_name)\n namespace, _, entity_name = entity_name.rpartition('.')\n raise ArgumentError, 'Namespace missing' if namespace.nil? || namespace.empty?\n schemas[namespace].get_property_type(entity_name, property_name)\n end", "def get_property_type(entity_name, property_name)\n namespace, _, entity_name = entity_name.rpartition('.')\n raise ArgumentError, 'Namespace missing' if namespace.nil? || namespace.empty?\n schemas[namespace].get_property_type(entity_name, property_name)\n end", "def get_status_name\n case self.status\n when STATUS_NOT_APPLIED\n return I18n.t('workflow.status.not_applied')\n when STATUS_NOT_ISSUED\n return I18n.t('workflow.status.not_issued')\n when STATUS_ACTIVE\n return I18n.t('workflow.status.active')\n when STATUS_ACCEPTED\n return I18n.t('workflow.status.accepted')\n when STATUS_DENIED\n return I18n.t('workflow.status.denied')\n end\n end", "def property?(prop_name)\n return false if properties_info[prop_name.to_sym].nil?\n properties_info[prop_name.to_sym][:defined] == true\n end", "def getStatus\n fetch(@config[:sales_path], 'Sales.getStatus')\n end", "def getStatus\r\n\t\t\t\t\treturn @status\r\n\t\t\t\tend", "def property?(prop_name)\n return false if properties_info[prop_name.to_sym].nil?\n properties_info[prop_name.to_sym][:defined] == true\n end", "def status\n self.operation.response.statusCode\n end", "def status_code\n attributes[:status_code]\n end", "def get(param)\n @property_hash[param.intern] || :absent\n end", "def get_property(propertyName,exception = nil)\n propertyName = JS::String.create_with_utf8cstring(propertyName)\n res = super(context,self,propertyName,exception)\n\n \n val_ref = JS::Value.from_pointer_with_context(context,res)\n ret = val_ref.to_ruby\n if ret.is_a?(JS::Value)\n return check_use(ret) || is_self(ret) || ret\n else\n return check_use(ret) || ret\n end\n \n \n end", "def http_status\n self[:status_code]\n end", "def get_property(name, default= \"\")\n\t\treturn @transport.get_path(\"meta\",\"properties\", name) { default }\n\tend", "def status_name\n STATUSE.key(@status)\n end", "def get_raw_property_value(name)\n return @property_values[name]\n end", "def property_name\n property.display_name\n end", "def [](property)\n @assigns[property.to_s]\n end", "def property_name_from_classname\n CLASSNAME_TO_PROPERTY[classname]\n end" ]
[ "0.6135004", "0.5816986", "0.5801187", "0.5748053", "0.56408185", "0.56390136", "0.56014687", "0.5557331", "0.5550417", "0.5525974", "0.5520257", "0.5497238", "0.5403703", "0.53703415", "0.53535676", "0.5329288", "0.5230734", "0.52157766", "0.52098304", "0.51871276", "0.51759505", "0.5170377", "0.51673305", "0.5166385", "0.51611084", "0.5154423", "0.5104487", "0.5103556", "0.5098126", "0.50833607", "0.50787884", "0.5051607", "0.5051464", "0.5043423", "0.504208", "0.50412893", "0.50316334", "0.5022654", "0.5022603", "0.5015733", "0.49988052", "0.49942967", "0.49923623", "0.49898782", "0.49818146", "0.49801645", "0.49654502", "0.49447018", "0.49207574", "0.4916626", "0.49060622", "0.48977467", "0.48969486", "0.48838645", "0.48676234", "0.4864294", "0.48609853", "0.48533282", "0.4844331", "0.48267367", "0.48246557", "0.48223755", "0.4817507", "0.48151726", "0.48087043", "0.48043343", "0.4803706", "0.4797081", "0.47816738", "0.47793496", "0.47786355", "0.47785562", "0.477431", "0.47659037", "0.47659037", "0.47595206", "0.47567135", "0.4753219", "0.47496837", "0.4746061", "0.4730815", "0.472833", "0.4727323", "0.4727323", "0.47257647", "0.47233263", "0.47211483", "0.47190088", "0.47172996", "0.4713422", "0.47109327", "0.47097045", "0.4708024", "0.47076002", "0.47064313", "0.47051683", "0.47047886", "0.46893975", "0.46860164", "0.4681068" ]
0.77607304
0
Returns all propertynames that have a 404 status, and thus don't have a value yet.
def get404_properties result = [] self.result.each do |property_name, stuff| result << property_name if stuff[0] == 404 end # If there's nothing in this list, we're adding one fictional item. result << '{http://sabredav.org/ns}idk' if result.empty? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_invalid_properties\n invalid_properties = Array.new\n if @status.nil?\n invalid_properties.push('invalid value for \"status\", status cannot be nil.')\n end\n\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n if @name.nil?\n invalid_properties.push(\"invalid value for 'name', name cannot be nil.\")\n end\n\n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = []\n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = []\n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = []\n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = []\n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = []\n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = []\n return invalid_properties\n end", "def list_invalid_properties\r\n invalid_properties = Array.new\r\n return invalid_properties\r\n end", "def list_invalid_properties\n invalid_properties = Array.new\n \n \n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n \n \n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n \n \n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n \n \n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n \n \n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n \n \n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n \n \n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n \n \n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n \n \n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n \n \n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n \n \n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n \n \n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n \n \n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n \n \n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n \n \n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n \n \n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n \n \n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n \n \n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n \n \n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n if @query.nil?\n invalid_properties.push(\"invalid value for 'query', query cannot be nil.\")\n end\n\n return invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n if @name.nil?\n invalid_properties.push('invalid value for \"name\", name cannot be nil.')\n end\n\n if @slug.nil?\n invalid_properties.push('invalid value for \"slug\", slug cannot be nil.')\n end\n\n if @status.nil?\n invalid_properties.push('invalid value for \"status\", status cannot be nil.')\n end\n\n if @type.nil?\n invalid_properties.push('invalid value for \"type\", type cannot be nil.')\n end\n\n if @sku.nil?\n invalid_properties.push('invalid value for \"sku\", sku cannot be nil.')\n end\n\n if @price.nil?\n invalid_properties.push('invalid value for \"price\", price cannot be nil.')\n end\n\n if @categories.nil?\n invalid_properties.push('invalid value for \"categories\", categories cannot be nil.')\n end\n\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end" ]
[ "0.6622768", "0.64270794", "0.64013624", "0.64013624", "0.64013624", "0.64013624", "0.64013624", "0.64013624", "0.6388563", "0.63862526", "0.63862526", "0.63862526", "0.63862526", "0.63862526", "0.63862526", "0.63862526", "0.63862526", "0.63862526", "0.63862526", "0.63862526", "0.63862526", "0.63862526", "0.63862526", "0.63862526", "0.63862526", "0.63862526", "0.63862526", "0.63862526", "0.6358606", "0.6358606", "0.6358606", "0.6358606", "0.6358606", "0.6358606", "0.6358606", "0.6358606", "0.6358606", "0.6358606", "0.6358606", "0.6358606", "0.6358606", "0.6358606", "0.6358606", "0.6358606", "0.6358606", "0.6358606", "0.6358606", "0.6358606", "0.6358606", "0.6358606", "0.6358606", "0.6358606", "0.6358606", "0.6358606", "0.6358606", "0.6358606", "0.6358606", "0.6358606", "0.6358606", "0.6358606", "0.6358606", "0.6358606", "0.6358606", "0.6358606", "0.6358606", "0.6358606", "0.63582087", "0.6357878", "0.6355965", "0.6326665", "0.6310531", "0.6310531", "0.6310531", "0.6310531", "0.6310531", "0.6310531", "0.6310531", "0.6310531", "0.6310531", "0.6310531", "0.6310531", "0.6310531", "0.6310531", "0.6310531", "0.6310531", "0.6310531", "0.6310531", "0.6310531", "0.6310531", "0.6310531", "0.6310531", "0.6310531", "0.6310531", "0.6310531", "0.6310531", "0.6310531", "0.6310531", "0.6310531", "0.6310531", "0.6310531" ]
0.78250164
0
Write a method fizz_buzz(max) that takes in a number max and returns an array containing all numbers greater than 0 and less than max that are divisible by either 4 or 6, but not both.
def fizz_buzz(max) (1...max).select{|number| (number % 4 == 0 || number % 6 == 0) && !(number % 4 == 0 && number % 6 == 0)} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fizz_buzz(max)\n array = []\n i = 1\n while i < max\n if (i % 4 == 0 || i % 6 == 0) && !(i % 4 == 0 && i % 6 == 0)\n array << i\n end\n i += 1\n end\n return array\n end", "def fizz_buzz(max)\n\ti = 0\n\tnewArr = []\n \twhile i < max\n if (i % 4 == 0 || i % 6 == 0) && !(i % 4 == 0 && i % 6 == 0)\n newArr << i\n end\n i += 1\n end\n return newArr\nend", "def fizz_buzz(max)\n result = [] \n (1...max).each do |num|\n if (num % 4 == 00 || num % 6 == 0) && !(num % 4 == 0 && num % 6 == 0)\n result << num\n end\n\n end\n return result\nend", "def fizzBuzz(max)\n\tarr = []\n\n\t(1...max).each do |num|\n\t\tif num % 3 == 0 && num % 5 != 0\n\t\t\tarr << num\n\t\tend\n\t\tif num % 3 != 0 && num % 5 == 0\n\t\t\tarr << num\n\t\tend\n\tend\n\n\treturn arr\nend", "def fizz_buzz(max)\n newArray = []\n for i in 0..max\n if (i > 0) && (i < max)\n \tif (i % 4 == 0) ^ (i % 6 == 0)\n newArray << i\n end\n end\n end\n return newArray\nend", "def fizz_buzz(max)\n nums = []\n \n i = 0\n while (i < max)\n if (i % 4 == 0 || i % 6 == 0) && !(i % 4 == 0 && i % 6 == 0)\n nums << i\n end\n \n i += 1\n end\n \n return nums\n end", "def fizz_buzz(max)\n\tnewArr = []\n i = 1\n while i < max\n if (i % 4 == 0 || i % 6 == 0) && !(i % 4 == 0 && i % 6 == 0)\n newArr << i\n end\n i += 1\n end\n return newArr\nend", "def fizz_buzz(max)\n new_array = []\n \n i = 0\n while i <= max\n if (i % 4 == 0 && i % 6 != 0) || (i % 6 == 0 && i % 4 != 0)\n new_array << i\n end\n \n i += 1\n end\n \n return new_array\nend", "def fizz_buzz(max)\n fb_arr = [];\n i = 1\n while i < max\n if !(i % 4 == 0 && i % 6 == 0) && (i % 4 == 0 || i % 6 == 0)\n fb_arr << i\n end\n i += 1\n end\n return fb_arr\nend", "def fizz_buzz(max)\n fizzed = []\n\n i = 1\n while i < max\n if (i % 4 == 0 || i % 6 == 0) && !(i % 4 == 0 && i % 6 == 0)\n fizzed << i\n end\n i += 1\n end\n\n return fizzed\nend", "def fizz_buzz(max)\n answer = []\n i = 1\n while i < max\n if (i % 4 == 0 || i % 6 == 0) && !(i % 4 == 0 && i % 6 == 0)\n answer << i\n end\n i += 1\n end\n return answer\nend", "def fizz_buzz(max)\n nums = []\n\n i = 0\n while (i < max)\n if (i % 4 == 0 || i % 6 == 0) && !(i % 4 == 0 && i % 6 == 0)\n nums << i\n end\n\n i += 1\n end\n\n return nums\nend", "def fizz_buzz(max)\n nums = []\n\n i = 0\n while (i < max)\n if (i % 4 == 0 || i % 6 == 0) && !(i % 4 == 0 && i % 6 == 0)\n nums << i\n end\n\n i += 1\n end\n\n return nums\nend", "def fizz_buzz(max)\n nums = []\n\n i = 0\n while (i < max)\n if (i % 4 == 0 || i % 6 == 0) && !(i % 4 == 0 && i % 6 == 0)\n nums << i\n end\n\n i += 1\n end\n\n return nums\nend", "def fizz_buzz(max)\n\ti = 1\n \tarry = []\n while i < max\n if i % 4 == 0 && i % 6 != 0 || i % 4 != 0 && i % 6 == 0\n arry << i\n end\n i += 1\n end\n return arry\nend", "def fizz_buzz(max)\n arr = [] \n index = 1 \n \n while index < max\n if (index % 4 == 0 || index % 6 == 0) && !(index % 4 == 0 && index % 6 == 0)\n arr << index\n end \n index += 1 \n end \n \n return arr \nend", "def fizzBuzz2(max)\n sol = []\n\n (1...max).each do |num|\n if !(num % 5 == 0 && num % 3 == 0) && (num % 5 == 0 || num % 3 == 0)\n sol << num\n end\n end\n\n sol\nend", "def fizz_buzz(max) # Define method\n \n i = 0 # Set iteration start\n \n new_array = [] # Create array\n \n while i < max # Set condition that determines how long loop iterates\n\n \tif (i % 4 == 0 || i % 6 == 0) && !(i % 4 == 0 && i % 6 == 0)\n\n \t\tnew_array << i\n\n \tend\n\n \ti += 1 # Increment loop by 1\n end\n return new_array\n\nend", "def fizz_buzz(max)\n\n new_arr=[]\n\n i = 1\n while i < max\n if i % 4 == 0 && i % 6 != 0\n new_arr << i \n\n elsif i % 6 == 0 && i % 4 != 0\n new_arr << i \n else \n end\n i += 1\n end\n\n return new_arr\nend", "def fizzBuzz(max)\n arr = []\n (1...max).each do |num|\n if num % 3 == 0 && num % 5 !==0\n arr << num\n end\n if num % 3 !== 0 && num % 5 ==0\n arr << num\n end\n puts num\n end\n return arr\nend", "def fizzBuzz(max)\n sol = []\n\n (1...max).each do |num|\n if num % 5 == 0 && num % 3 == 0\n next\n elsif num % 5 == 0\n sol << num\n elsif num % 3 == 0\n sol << num\n end\n end\n\n sol\nend", "def fizzbuzz(max)\n arr =[]\n (1..max).each do |n|\n if n % 3 != 0 && n % 5 != 0\n arr.push n\n else\n val = ''\n if n % 3 == 0\n val = \"fizz\"\n end\n if n % 5 == 0\n val += \"buzz\"\n end\n arr.push val\n end\n end\n arr\nend", "def fizzbuzz(max_val)\n\tcurrent_number = 1\n\twhile current_number <= max_val\n\n\t\tif current_number % 3 == 0\n\t\t\tputs \"fizz\"\n\t\tend\n\t\tif current_number % 5 == 0\n\t\t\tputs \"buzz\"\n\t\tend\n\t\tif current_number % 3 != 0 && current_number % 5 != 0\n\t\t\tputs current_number\n\t\tend\n\t\tcurrent_number += 1\n\tend\nend", "def fizzbuzz(n)\n arr = []\n (1..n).each do |num|\n mod3 = (num % 3).zero?\n mod5 = (num % 5).zero?\n result = ''\n result += 'fizz' if mod3\n result += 'buzz' if mod5\n result.empty? ? arr.push(num) : arr.push(result)\n end\n arr\nend", "def fizzbuzz(maxNumber)\n\n\tfor count in 1..maxNumber\n\t\tif count % 15 == 0 then\n\t\t\tprint \"fizzbuzz\"\n\t\telsif count % 3 == 0 then\n\t\t\tprint \"fizz\"\n\t\telsif count % 5 == 0 then\n\t\t\tprint \"buzz\"\n\t\telse\n\t\t\tprint count\n\t\tend\n\t\tprint \"\\n\"\n\tend\nend", "def fizzbuzz\n fizzBuzzArray = Array.new\n for num in 1..100\n if num.to_f / 3.to_f == num/3 && num.to_f / 5.to_f == num/5 then\n\tfizzBuzzArray << 'FizzBuzz'\n elsif num.to_f / 3.to_f == num/3 then\n\tfizzBuzzArray << 'Fizz'\n elsif num.to_f / 5.to_f == num/5 then\n\tfizzBuzzArray << 'Buzz'\n else\n fizzBuzzArray << num\n end\n end\n fizzBuzzArray\nend", "def fizz_buzz_woof(max)\n 1.upto(max).each do |x|\n if (x % 3 == 0) && (x % 5 == 0) && (x % 7 == 0)\n puts \"FizzBuzzWoof\"\n elsif (x % 3 == 0) && (x % 5 == 0)\n puts \"FizzBuzz\"\n elsif (x % 3 == 0) && (x % 7 == 0)\n puts \"FizzWoof\"\n elsif (x % 5 == 0) && (x % 7 == 0)\n puts \"BuzzWoof\"\n elsif x % 3 == 0\n puts \"Fizz\"\n elsif x % 5 == 0\n puts \"Buzz\"\n elsif x % 7 == 0\n puts \"Woof\"\n else\n puts x\n end\n end\nend", "def fizz_buzz(min, max)\n (min..max).each do |number|\n puts fizz_buzz_calculator(number)\n end\nend", "def fizzbuzz\n zz_array = []\n 1.upto(100) do |num|\n if num % 3 == 0 && num % 5 == 0\n zz_array << 'FizzBuzz'\n elsif num % 3 == 0\n zz_array << 'Fizz'\n elsif num % 5 == 0\n zz_array << 'Buzz'\n else\n zz_array << num\n end\n end\n return zz_array\nend", "def fizzbuzz(n)\n array = []\n (1..n).each do |num|\n if num % 15 == 0\n array << \"fizzbuzz\"\n elsif num % 3 == 0\n array << \"fizz\"\n elsif num % 5 == 0\n array << \"buzz\"\n else\n array << num\n end\n end\n return array\nend", "def fizzbuzz(n)\n output_arr = []\n\n (1..n).each do |num|\n if num % 5 == 0 && num % 3 == 0\n output_arr << 'fizzbuzz'\n elsif num % 5 == 0\n output_arr << 'buzz'\n elsif num % 3 == 0\n output_arr << 'fizz'\n else\n output_arr << num\n end\n end\n\n output_arr\nend", "def fizz_buzz_check\n @numbers.collect do |x|\n if multiple_of(15, x)\n 'FizzBuzz'\n elsif multiple_of(3, x)\n 'Fizz'\n elsif multiple_of(5, x)\n 'Buzz'\n else\n x\n end\n end\n end", "def fizzbuzz\n i =0\n arr=[]\n while i<=100 do\n if i%3 ==0 && i%5==0\n\t arr.push \"FizzBuzz\"\n\n\t elsif i%3==0\n\t arr.push \"Fizz\"\n\n\t elsif i%5==0\n\t arr.push \"Buzz\"\n\t else\n\t arr.push i\n\t end\n i+=1\n end\n return arr\nend", "def fizzbuzz(max_val)\n\tcounter = 1\n\twhile (counter <=max_val)\n\t\t\n\t\tif (counter %3 ==0)\n\t\t\tputs \"fizz\"\n\t\tend \n\n\t\tif (counter %5 ==0)\n\t\t\tputs \"buzz\"\n\t\tend\n\t\tif (counter %5 !=0 && counter %3 !=0)\n\t\t\tputs counter \n\t\tend\n\n\t\t# else \n\t\t# \tputs counter \n\t\t# end\n\t\tcounter +=1\n\tend\n\nend", "def fizzbuzz\n an_array = Array.new(100)\n for cnt in 1..100\n l3_rem = cnt%3\n l5_rem = cnt%5\n if l3_rem == 0 && l5_rem != 0\n an_array[cnt -1 ] = 'Fizz'\n elsif l3_rem != 0 && l5_rem == 0\n an_array[ cnt -1 ] = 'Buzz'\n elsif l3_rem == 0 && l5_rem == 0\n an_array[ cnt - 1] = 'FizzBuzz'\n else\n an_array[ cnt - 1] = cnt\n end\n end\n return an_array\nend", "def fizz_buzz_for_range(from, to)\n results = []\n (from..to).each do |n|\n results.push fizz_buzz(n)\n end\n results\n end", "def pre_fizz(n)\n (1..n).to_a\nend", "def fizzbuzz\narray = []\n\tfor i in 1..100\n\t\tif i%3 == 0 && i%5 == 0\n\t\t\tarray << 'FizzBuzz'\n\t\telsif i%3 == 0\n\t\t\tarray << 'Fizz'\n\t\telsif i%5 == 0 \n\t\t\tarray << 'Buzz'\n\t\telse\n\t\t\tarray << i\n \t\t\ti+= 1\n\t\tend\n\tend\n\t\t\treturn array\nend", "def fizzbuzz\n\tcount = 0\n\tan_array = []\n\twhile count <100\n\t\tan_array[count] = count\n\t\tif count%5 == 0\n\t\t\tan_array[count] = 'Buzz'\n\t\tend\n\t\tif count%3 == 0\n\t\t\tif count%5 == 0\n\t\t\t\tan_array[count] = 'FizzBuzz'\n\t\t\telse\n\t\t\t\tan_array[count] = 'Fizz'\n\t\t\tend\n\t\tend\n\t\tcount +=1\n\tend\n\treturn an_array\nend", "def fizzbuzz(n)\n array = (1..n).to_a\n answer = []\n for i in array do\n if (i % 15 == 0)\n answer.push('FizzBuzz')\n elsif (i % 3 == 0)\n answer.push('Fizz')\n elsif (i % 5 == 0)\n answer.push('Buzz')\n else \n answer.push(i)\n end\n end\n answer\nend", "def fizzbuzz(n)\n result = []\n (1..n).each do |num|\n if num % 3 == 0 && num % 5 == 0\n result << \"fizzbuzz\"\n elsif num % 3 == 0\n result << \"fizz\"\n elsif num % 5 == 0\n result << \"buzz\"\n else\n result << num\n end\n end\n result\nend", "def fizzbuzz(n)\n numbers = []\n (1..n).each do |num|\n if num % 3 == 0\n value = (num % 5 == 0) ? \"fizzbuzz\" : \"fizz\"\n numbers << value\n elsif num % 5 == 0\n numbers << \"buzz\"\n else\n numbers << num\n end\n end\n numbers\nend", "def fizzbuzz(num1 , num2)\n result = []\n arr = (num1..num2).to_a\n arr.each do |n|\n if n % 3 == 0 && n % 5 == 0\n result << 'FizzBuzz'\n elsif n % 3 == 0\n result << 'Fizz'\n elsif n % 5 == 0\n result << 'Buzz'\n else\n result << n\n end\n end\n puts result.join(', ')\nend", "def fizzbuzz(num)\n collection = (1..num).to_a\n collection.each do |num|\n if (num % 3 == 0) && (num % 5 != 0)\n puts \"Fizz #{num}\"\n elsif (num % 5 == 0) && (num % 3 != 0)\n puts \"Buzz #{num}\"\n elsif (num % 3 == 0) && (num % 5 == 0)\n puts \"FizzBuzz #{num}\"\n end\n end\nend", "def fizzbuzz(n)\n myary = []\n myn = 1\n (0...n).each do\n if myn % 15 == 0\n myary << \"FizzBuzz\"\n myn += 1\n elsif myn % 5 == 0\n myary << \"Buzz\"\n myn += 1\n elsif myn % 3 == 0\n myary << \"Fizz\"\n myn += 1\n else\n myary << myn\n myn += 1\n end\n end\n myary\nend", "def amicable_numbers(max)\n (1...max).select do |num|\n divisors(num) && num == divisors(divisors(num)) && num != divisors(num)\n end\nend", "def crazy_nums(max)\n res = []\n idx = 3\n while idx < max\n if (idx % 3 == 0 || idx % 5 == 0) && idx % 15 != 0\n res.push(idx)\n end\n idx += 1\n end\n return res\nend", "def fizzbuzz_without_modulo\n ints = []\n for i in 1..50\n ints.push(i)\n end\n\n (1..100).each do |x|\n if ints.include?(x/5.0)\n puts(ints.include?(x/3.0) ? 'fizzbuzz' : 'fizz')\n else\n puts(ints.include?(x/3.0) ? 'buzz' : x)\n end\n end\nend", "def fizzbuzz(num_1, num_2, range)\n # sets 1 to range (last number) where each number will do the following\n (1..range).each do |i|\n # if the remainder of each number i divided by the first number num_1 should have a zero AND\n # the remainder of each number i divided by the second number num_2 should have a zero\n if i % num_1 === 0 && i % num_2 === 0\n # then print 'fizzbuzz'\n puts 'fizzbuzz'\n # otherwise, if the remainder of number i divdied by num_1 should have a zero\n elsif i % num_1 === 0\n # then print 'fizz'\n puts 'fizz'\n # otherwise, if the remainder of number i divided by num_2 should have a zero\n elsif i % num_2 === 0\n # then print 'buzz'\n puts 'buzz'\n else\n # if all the conditions above are not met, then print the number i\n puts i\n end\n end\nend", "def super_fizzbuzz(array)\n fizzy=[]\n\tarray.each do |x| \n\t if x%3==0 && x%5==0\n\t\t fizzy << \"FizzBuzz\"\n\t elsif x%5==0\n\t\t fizzy << \"Buzz\"\n\t elsif x%3==0\n\t\t fizzy << \"Fizz\"\n\t else\n\t\t fizzy << x\n\t end\n\tend\nreturn fizzy\nend", "def fizzbuzz\r\n # your code goes here\r\n arr = []\r\n\r\n for i in 1 .. 30\r\n if i % 5 == 0 && i % 3 == 0\r\n arr << \"fizzbuzz\"\r\n\r\n elsif i % 3 == 0\r\n arr << \"fizz\"\r\n\r\n elsif i % 5 == 0\r\n arr << \"buzz\"\r\n\r\n else arr << i\r\n end\r\n end\r\n arr\r\nend", "def fizz_buzz_to(limit)\n 1.upto(limit).each do |num|\n puts fizzbuzz(num)\n end\n end", "def fizzbuzz(num_1, num_2, range)\n#from integer 1 to argument range above, execute the code below for each element. variable i stands for the element in the range the program is currently using at the time.\n (1..range).each do |i|\n#conditional, if variable i modulo argument num_1 is equal to 0 AND variable i modulo argument num_2 is also equal to 0, print string \"fizzbuzz\"\n if i % num_1 === 0 && i % num_2 === 0\n puts 'fizzbuzz'\n#if the above conditional is not true, check if variable i modulo argument num_1 is equal to 0 by itself. if true, print string \"fizz\"\n elsif i % num_1 === 0\n puts 'fizz'\n#if neither of the above conditionals are true, check if variable i modulo argument num_2 is equal to 0 by itself. if true, print string \"buzz\"\n elsif i % num_2 === 0\n puts 'buzz'\n#if none of the above conditionals are found to be true, print the value of variable i (the number in the range the program was checking)\n else\n puts i\n end\n end\nend", "def fizzbuzz?(x)\n x % 3 == 0 && x % 5 == 0\n end", "def fizzbuzz(num1, num2)\n array = []\n (num1..num2).each do |num|\n if num % 3 == 0 && num % 5 == 0\n array << \"FizzBuzz\"\n elsif num % 3 == 0\n array << \"Fizz\"\n elsif num % 5 == 0\n array << \"Buzz\"\n else\n array << num\n end\n end\n puts array.join(\", \")\nend", "def super_fizzbuzz(array)\nbuzz_array=[]\narray.map { |number| \n if number % 15 == 0\n \tbuzz_array << \"FizzBuzz\"\n elsif number % 3 == 0\n \tbuzz_array << \"Fizz\"\n elsif number % 5 == 0\n \tbuzz_array << \"Buzz\" \n else\n \tbuzz_array << number\n end\n}\nreturn buzz_array\nend", "def crazy_nums(max)\n nums = [] # store result\n i = 0\n count = 0\n \n while i < max\n if(i % 3 == 0) && (i % 5 == 0)\n \n elsif (i % 3 == 0) || (i % 5 == 0)\n nums[count] = i\n count = count + 1\n end\n i = i + 1\n end\n return nums \nend", "def fizzbuzz\n # TODO write your code here\n fizz_array = []\n\n for count in 1..100\n if (count%3 == 0 && count%5 == 0)\n fizz_array[count] = 'FizzBuzz'\n elsif count%3 == 0\n fizz_array[count] = 'Fizz'\n elsif count%5 == 0\n fizz_array[count] = 'Buzz'\n else\n fizz_array[count] = count\n end\n end\n\n fizz_array\nend", "def fizz_buzz min, max\n i = min\n while i <= max do\n fizz_buzz_calculator(i)\n puts fizz_buzz_calculator(i)\n i += 1\n end\nend", "def fizzbuzz\n (1..100).map do |i|\n\tif (i % 15).zero?\n\t 'FizzBuzz'\n\telsif (i % 3).zero?\n\t 'Fizz'\n\telsif (i % 5).zero?\n\t 'Buzz'\n\telse\n\t i\n\tend\n end\nend", "def fizzbuzz(a,b)\n numbers = (a..b).to_a\n\n numbers.each do |number|\n if number % 15 == 0\n puts \"FizzBuzz\"\n elsif number % 3 == 0\n puts \"Fizz\"\n elsif number % 5 == 0\n puts \"Buzz\"\n else\n puts number\n end\n end\nend", "def fizzbuzz(num_1, num_2, range)\n#create a loop that iterates from 1 up to the value of the argument range\n# variable i gets assigned another value after each loop\n (1..range).each do |i|\n# in each iteration, if i is divided by num_1 and has 0 remainder (modulo)\n# AND if i is divided by num_2 and has 0 remainders, 'fizzbuzz' will print out\n if i % num_1 === 0 && i % num_2 === 0\n puts 'fizzbuzz'\n# if condition is not met from above, then if only i divided by num_1 has 0\n#remainder, then only print out 'fizz'\n elsif i % num_1 === 0\n puts 'fizz'\n# Or if only i divided by num_2 has 0 remainder, then only print out 'buzz'\n elsif i % num_2 === 0\n puts 'buzz'\n# if the three conditions above are not true then just print out value of i\n else\n puts i\n end\n #iterate the loop to the next value in the range\n end\n # when all values within the range are finished, end the loop\nend", "def fizz_buzz\n [*1..100].map do |num|\n if num % 5 == 0 && num % 3 == 0\n 'FizzBuzz'\n elsif num % 5 == 0\n 'Buzz'\n elsif num % 3 == 0\n 'Fizz'\n else\n num\n end\n end\nend", "def super_fizzbuzz(array)\n\tnew_array = []\n\tarray.each do |num| \n\t\tif num % 15 == 0\n\t\t\tnew_array << \"FizzBuzz\"\n\t\telsif num % 3 == 0\n\t\t\tnew_array << \"Fizz\"\n\t\telsif num % 5 == 0\n\t\t\tnew_array << \"Buzz\"\n\t\telse \n\t\t\tnew_array << num\n\t\tend\n\tend\n\tnew_array\nend", "def super_fizzbuzz(array)\n\tnew_arr = []\n\tarray.each do |x|\n\t\tif x % 3 == 0 && x % 5 == 0\n\t\t\tnew_arr << \"FizzBuzz\"\n\t\telsif x % 5 == 0\n\t\t\tnew_arr << \"Buzz\"\n\t\telsif x % 3 == 0\n\t\t\tnew_arr << \"Fizz\"\n\t\telse\n\t\t\tnew_arr << x\n\t\tend\n\tend\n\treturn new_arr\n\nend", "def super_fizzbuzz(array)\n array.map! {|num| puts \"#{'Fizz' if num % 3 == 0}#{'Buzz' if num % 5 == 0}#{num if num % 5 != 0 && num % 3 != 0}\"}\nend", "def super_fizzbuzz(array)\n\tarray.map! do |num|\n\t\tif num % 15 == 0\n\t\t\t\"FizzBuzz\"\n\t\telsif num % 3 == 0\n\t\t\t\"Fizz\"\n\t\telsif num % 5 == 0\n\t\t\t\"Buzz\"\n\t\telse\n\t\t\tnum\n\t\tend\n\tend\nreturn array\t\t\nend", "def super_fizzbuzz(array)\n array.map! do |num|\n if (num % 3 == 0 && num % 5 == 0 && num % 15 == 0)\n \"FizzBuzz\"\n elsif (num % 3 == 0)\n \"Fizz\"\n elsif (num % 5 == 0)\n \"Buzz\"\n else\n num\n end\n end\n array\nend", "def supafizbuz(max_num)\n range = (0..max_num).to_a\n range.each do |num|\n if num % 3 == 0\n if num % 7 == 0\n if num % 5 == 0\n puts(\"SuperFizzBuzz\")\n next\n end\n puts(\"SuperFizz\")\n next\n end\n puts(\"Fizz\")\n next\n elsif num % 7 == 0\n if num % 5 == 0\n puts(\"SuperBuzz\")\n next\n end\n puts(\"Super\")\n next\n elsif num % 5 == 0\n puts(\"Buzz\")\n next\n end\n puts(num)\n end\n return nil\n\n range = (0..max_num).to_a\n range.each do |num|\n a = num % 7 == 0 ? \"Super\" : \"\"\n b = num % 3 == 0 ? \"Fizz\" : \"\"\n c = num % 5 == 0 ? \"Buzz\" : \"\"\n puts (a + b + c) == \"\" ? num : (a + b + c)\n end\n return nil\n\nend", "def super_fizzbuzz(array)\n\tarray = [1..100]\n\tarray.each do |num|\n\t\tif num % 3 == 0 \n\t\t\tprint \"Fizz\"\n\t\tend \n\t\tif num % 5 == 0 \n\t\t\tprint \"Buzz\"\n\t\tend \n\t\tif num % 15 == 0 \n\t\t\tprint \"FizzBuzz\"\n\t\tend \n\tend \nend", "def super_fizzbuzz(array)\n new_array = []\n array.each do |i|\n if i % 15 == 0\n new_array << \"FizzBuzz\"\n elsif i % 3 == 0\n new_array << \"Fizz\"\n elsif i % 5 == 0\n new_array << \"Buzz\"\n else\n new_array << i\n end\n end\n\nreturn new_array\nend", "def super_fizzbuzz(array)\n new_array = []\n array.each do |i|\n if i % 15 == 0\n new_array << \"FizzBuzz\"\n elsif i % 3 == 0\n new_array << \"Fizz\"\n elsif i % 5 == 0\n new_array << \"Buzz\"\n else\n new_array << i\n end\n end\n\nreturn new_array\nend", "def fizz_buzz_to(limit)\n 1.upto(limit).each do |num|\n puts fizzbuzz(num)\n end\nend", "def fizzbuzz(num1, num2)\n arr = Array(num1..num2).map! do |num|\n if num % 3 == 0 && num % 5 == 0\n 'FizzBuzz'\n elsif num % 3 == 0\n 'Fizz'\n elsif num % 5 == 0\n 'Buzz'\n else\n num\n end\n end.join(', ')\n print arr\nend", "def fizzbuzz_iterator(range_from, range_to)\n (range_from..range_to).each do |i|\n if divisable_by_given?(i, 3) && divisable_by_given?(i, 5)\n @fizzbuzz_array << 'FizzBuzz'\n elsif divisable_by_given?(i, 3)\n @fizzbuzz_array << 'Fizz'\n elsif divisable_by_given?(i, 5)\n @fizzbuzz_array << 'Buzz'\n else\n @fizzbuzz_array << i\n end\n end\n end", "def determine_fizz_buzz (num)\n if num % 3 == 0 and num % 5 == 0 and num != 0\n puts \"#{num} is FIZZ BUZZ\"\n elsif num % 5 == 0 and num != 0\n puts \"#{num} is BUZZ\"\n elsif num % 3 == 0 and num != 0\n puts \"#{num} is FIZZ\"\n else\n puts \"#{num} is boring...\"\n end\nend", "def super_fizzbuzz(array)\n fizzbuzz_array = []\n counter = 0\n while counter < array.length\n if array[counter] % 3 == 0 && array[counter] % 5 != 0\n fizzbuzz_array << \"Fizz\"\n elsif array[counter] % 5 == 0 && array[counter] % 3 != 0\n fizzbuzz_array << \"Buzz\"\n elsif array[counter] % 3 == 0 && array[counter] % 5 == 0\n fizzbuzz_array << \"FizzBuzz\"\n else\n fizzbuzz_array << array[counter]\n end\n counter += 1\n end\n p fizzbuzz_array\nend", "def super_fizzbuzz(array)\n new_array = []\n array.each do |x|\n if x % 3 == 0 && x % 5 == 0\n new_array << \"FizzBuzz\"\n elsif x % 3 == 0\n new_array << \"Fizz\"\n elsif x % 5 == 0\n new_array << \"Buzz\"\n else\n new_array << x\n end\n end\n new_array\nend", "def fizzbuzz(n)\n numbers = (1..n).to_a\n numbers.map do |num|\n if (num % 15 == 0)\n \"FizzBuzz\"\n elsif (num % 5 == 0)\n \"Buzz\"\n elsif (num % 3 == 0)\n \"Fizz\"\n else num\n end\n end\n end", "def fizzbuzz(start_num, end_num)\n new_arr = []\n (start_num..end_num).each do |num|\n case \n when (num % 3 == 0) && (num % 5 == 0)\n new_arr << \"FizzBuzz\"\n when num % 5 == 0\n new_arr << \"Buzz\"\n when num % 3 == 0 \n new_arr << \"Fizz\" \n else\n new_arr << num\n end\n end\n puts new_arr.join(', ')\nend", "def fizzbuzz(num_1, num_2, range)\n (1..range).each do |i|\n if i % num_1 === 0 && i % num_2 === 0\n puts 'fizzbuzz'\n elsif i % num_1 === 0\n puts 'fizz'\n elsif i % num_2 === 0\n puts 'buzz'\n else\n puts i\n end\n end\nend", "def fizzbuzz(num_1, num_2, range) #defines a method called fizzbuzz which takes 3 parameters (num_1, num_2, range)\n (1..range).each do |i| #iterates `i` over numbers 1 through a number set by parameter `range`\n if i % num_1 === 0 && i % num_2 === 0 #begins if...end loop with conditional that if the modulo of num_1 into `i` AND the modulo of num_2 into `i` both equal zero\n puts 'fizzbuzz' #then \"fizzbuzz\" will be sent to terminal\n elsif i % num_1 === 0 #if the first step is false AND the modulo of num_1 into `i` is 0 then\n puts 'fizz' #\"fizz\" will be printed to terminal\n elsif i % num_2 === 0 #if the first `if` AND the first `elsif` are false AND the modulo of num_2 into `i` is 0 then\n puts 'buzz' #\"buzz\" will be printed to terminal\n else #if all the above are false\n puts i #then variable `i` will be printed to terminal\n end #ends if statement from line 30\n end #ends .each do from line 29\nend", "def fizzbuzz(num1, num2)\n array = (num1..num2).to_a\n fizzbuzz = array.map do |n|\n if n % 3 == 0 && n % 5 == 0\n 'FizzBuzz'\n elsif n % 5 == 0\n 'Buzz'\n elsif n % 3 == 0\n 'Fizz'\n else \n n\n end\n end\n fizzbuzz.join(' ')\nend", "def fizzbuzz_iterator range_from , range_to\n (range_from..range_to).each do |i|\n if divisible_by?(i,3) && divisible_by?(i,5)\n @fizzbuzz_array << \"FizzBuzz\"\n elsif divisible_by?(i,3)\n @fizzbuzz_array << \"Fizz\"\n elsif divisible_by?(i,5)\n @fizzbuzz_array << \"Buzz\"\n else\n @fizzbuzz_array << i\n end\n end\n end", "def fizzbuzz(num1, num2)\n answer = []\n index = 0\n (num1..num2).to_a.each do |num|\n answer[index] = \"\"\n answer[index] << \"Fizz\" if num % 3 == 0\n answer[index] << \"Buzz\" if num % 5 == 0\n answer[index] << num.to_s if num % 3 !=0 && num % 5 != 0 \n index += 1\n end\n puts answer.join(\", \")\nend", "def fizzbuzz\n\tnum_arr = Array.new(100) {|index| index+1}\n\tarr = Array.new(100) {''}\n\tnum_arr.each do |i|\n\n\t \tif i%3 == 0\n\t \t\tif i%5 == 0\n\t \t\t\tarr[i-1] = 'FizzBuzz'\n\t \t\telse\n\t \t\t\tarr[i-1] = 'Fizz'\n\t \t\tend\n\t \telsif i%5 == 0\n\t \t\tarr[i-1] = 'Buzz'\n\t \telse\n\t \t\tarr[i-1] = i.to_s\n\t \tend\n\t end\n \tarr\nend", "def super_fizzbuzz(array)\n\tarray.collect do |i|\n \tif i % 15 == 0\n \t\t\"FizzBuzz\"\n \telsif i % 5 == 0\n \t\t\"Buzz\"\n \telsif i % 3 == 0\n \t\t\"Fizz\"\n \telse\n \t\ti\n \tend\n \tend\nend", "def fizzbuzz(num_1, num_2, range)\n# Iterate through each number in a range from 1 to whatever number is input for\n# the 'range' argument, and do something for each number.\n (1..range).each do |i|\n# Use an if statement that executes code if the conditional is true. If i is\n# divisible by num_1 and num_2, then execute the code below. If not true, move\n# on to the elsif statement.\n if i % num_1 === 0 && i % num_2 === 0\n# Print 'fizzbuzz' if the conditional above is true.\n puts 'fizzbuzz'\n# Use an elsif statement that executes code if the conditional is true. If i is\n# divisible by num_1, then print 'fizz'. If not true, move on to next elsif statement.\n elsif i % num_1 === 0\n puts 'fizz'\n# Use an elsif statement that executes code if the conditional is true. If i is\n# divisible by num_2, then print 'buzz'. If not true, move on to else statement.\n elsif i % num_2 === 0\n puts 'buzz'\n# If none of the above conditional statements are true, print i.\n else\n puts i\n# End the if/elsif/else statement.\n end\n# End the for loop.\n end\n# End the fizzbuzz method definition.\nend", "def fizzbuzz(num1, num2)\n array = []\n\n num1.upto(num2) do |num|\n if (num % 3 == 0) && (num % 5 == 0)\n array << \"FizzBuzz\"\n elsif num % 5 == 0\n array << \"Buzz\"\n elsif num % 3 == 0\n array << \"Fizz\"\n else\n array << num\n end\n end\n array.join(', ')\nend", "def fizzbuzz(n)\n arr = []\n (1..n).each do |i|\n case\n when (i % 3 == 0) && (i % 5 == 0) then arr << \"fizzbuzz\"\n when i % 3 == 0 then arr << \"fizz\"\n when i % 5 == 0 then arr << \"buzz\"\n else arr << i\n end\n end\n arr\nend", "def fizzbuzz_without_modulo\n please enter a number\n puts \"Please enter a whole number, no decimals\"\n input = gets.chomp.to_i\n ######################### Uncomment this to TEST ALL 1-100\n #100.times do |i|\n # input = i\n #########################################\n #Work around: if #.0/# - #/# > 0\n #if multiple of 3 or 5, fizzbuzz\n if (input/3.0) - (input/3) == 0 && (input/5.0) - (input/5) == 0\n puts \"fizzbuzz\"\n #if multiple of 3, fizz\n elsif\n (input/3.0) - (input/3) == 0\n puts \"fizz\"\n #if multiple of 5, buzz\n elsif\n (input/5.0) - (input/5) == 0\n puts \"buzz\"\n else puts input.to_s\n end\n #########################################\n # end\nend", "def primes(max)\n array = []\n i = 2\n while i < max.abs\n if is_prime?(i)\n array << i\n end\n i += 1\n end\n array\nend", "def fizzbuzz(num_1, num_2, range)\n# Do i for all the numbers in a range from 1 to the value that will be assigned to the variable \"range\".\n (1..range).each do |i|\n# If i divided by the value assigned to num_1 is equal to 0 and i divided by the value assigned to num_2 is equal to zero then print \"fizzbuzz\".\n if i % num_1 === 0 && i % num_2 === 0\n puts 'fizzbuzz'\n# If i divided by the value assigned to num_1 is equal to zero print \"fizz\".\n elsif i % num_1 === 0\n puts 'fizz'\n# If i divided by the value assigned to num_2 is equal to zero print \"buzz\".\n elsif i % num_2 === 0\n puts 'buzz'\n# If none of the previous conditions are true print i.\n else\n puts i\n# Ends the if/else statement.\n end\n# Ends the argument.\n end\n# Ends the method.\nend", "def super_fizzbuzz(array)\n\tfizzbuzzed_array = []\n\tarray.each do |element|\n\t\tif element % 15 == 0\n\t\t\tfizzbuzzed_array << \"FizzBuzz\"\n\t\telsif element % 3 == 0\n\t\t\tfizzbuzzed_array << \"Fizz\"\n\t\telsif element % 5 == 0\n\t\t\tfizzbuzzed_array << \"Buzz\"\n\t\telse\n\t\t\tfizzbuzzed_array << element\n\t\tend\n\tend\n\tfizzbuzzed_array\nend", "def fizzbuzz(array)\n\tfor num in array\n\t\tif num % 15 == 0\n\t\t\tputs \"fizzbuzz\"\n\t\telsif num % 3 == 0\n\t\t\tputs \"fizz\"\n\t\telsif num % 5 == 0\n\t\t\tputs \"buzz\"\n\t\telse \n\t\t\tputs num.to_s\n\t\tend\n\tend\nend", "def fizzbuzz(num1, num2)\n numbers = num1..num2\n fizzbuzz_array = []\n numbers.each do |x|\n case\n when x % 3 == 0 && x % 5 == 0\n fizzbuzz_array << \"FizzBuzz\"\n when x % 3 == 0\n fizzbuzz_array << \"Fizz\"\n when x % 5 == 0\n fizzbuzz_array << \"Buzz\"\n else\n fizzbuzz_array << x\n end\n end\n\n p fizzbuzz_array.join(\", \")\nend", "def fizzbuzz(num_1, num_2, range)\n # for each of \"range\", do the below - i iterates from 1 to range\n (1..range).each do |i|\n # if statement - calculates whether remainder = 0 when i is divided by both num_1 and num_2 \n # this is equivalent to figuring out if num_1 and num_2 both divide evenly in. \n if i % num_1 === 0 && i % num_2 === 0\n # print \"fizzbuzz \" to screen if true \n puts 'fizzbuzz'\n # if quotient is zero for num_1 but not num_2 - print fizz \n elsif i % num_1 === 0\n # print fizz \n puts 'fizz'\n #if quotient = 0 for num_2 but not num_1 - print buzz \n elsif i % num_2 === 0\n # print buzz \n puts 'buzz'\n # if none of these are true - print i \n else\n # print i \n puts i\n \n end\n \n>>>>>>> 7f31df2026bbc770e1d39fa796fd7a1c7b96e2e3\n end\n\nend", "def fizzbuzz(num_1, num_2, range)\n # Create a for loop function that will go through each number inside of the range\n (1..range).each do |i|\n # Create conditional statement and print \"fizzbuzz\" if integer is evenly divisible by both 'num_1' and 'num_2' using the 'Logical And' operator \n if i % num_1 === 0 && i % num_2 === 0\n puts 'fizzbuzz'\n # Create a second conditional statement and print \"fizz\" if integer is NOT evenly divisibly by both 'num_1' and 'num_2', but is evenly divisible by 'num_1'\n elsif i % num_1 === 0\n puts 'fizz'\n # Create a third conditional statement and print \"buzz\" if integer if NOT evenly divisible by both 'num_1' and 'num_2', but is evenly divisible by 'num_2'\n elsif i % num_2 === 0\n puts 'buzz'\n # Create the final conditional statement and print 'i' if the integer is not captured by the previous 3 conditional statements\n else\n puts i\n end\n end\nend", "def fizzbuzz(number)\n (1..number).each do |num|\n if (num % 15).zero?\n puts 'FizzBuzz'\n elsif (num % 3).zero?\n puts 'Fizz'\n elsif (num % 5).zero?\n puts 'Buzz'\n else\n puts num\n end\n end\nend", "def fizzbuzz(n)\n (1..n).map do |n|\n if n%3==0 && n%5==0\n \"fizzbuzz\"\n elsif n%3==0\n \"fizz\"\n elsif n%5==0\n \"buzz\"\n else\n n\n end\n end\nend" ]
[ "0.8941768", "0.8832673", "0.88196033", "0.88171816", "0.88147146", "0.87851703", "0.8775829", "0.87595224", "0.8743245", "0.86732525", "0.8660998", "0.85907495", "0.85907495", "0.85907495", "0.85394156", "0.8534281", "0.8470582", "0.8429976", "0.83160853", "0.82990754", "0.802583", "0.77690655", "0.72486144", "0.71344894", "0.707503", "0.7071721", "0.70692104", "0.7057743", "0.70383275", "0.7017349", "0.6971313", "0.69172984", "0.6844185", "0.6828924", "0.6816733", "0.679966", "0.67991614", "0.6785326", "0.678126", "0.67516327", "0.67449254", "0.6726721", "0.66793215", "0.6640278", "0.6634363", "0.6607477", "0.65922683", "0.6570476", "0.65609396", "0.6560005", "0.65347654", "0.65317184", "0.65047175", "0.6504442", "0.6504289", "0.6496317", "0.6493948", "0.64915764", "0.6490187", "0.6490181", "0.64802736", "0.6479135", "0.6477041", "0.6474504", "0.64689016", "0.6458638", "0.6447888", "0.6439947", "0.642953", "0.6426015", "0.64246756", "0.64246756", "0.64124393", "0.64056015", "0.64038384", "0.6402594", "0.63976496", "0.6386453", "0.63863957", "0.6381987", "0.63767445", "0.63712794", "0.6370085", "0.6362586", "0.6353719", "0.6349154", "0.6343012", "0.6336892", "0.63364124", "0.6333059", "0.63315505", "0.6331223", "0.6331172", "0.6326145", "0.632402", "0.6320727", "0.6318421", "0.6314086", "0.63126135", "0.6311462" ]
0.8511988
16
in a nonbooting version this should map to _add_singleton_method
def add_function function raise "not a function #{function}" unless function.is_a? Function raise "syserr " unless function.name.is_a? Symbol @functions << function end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def singleton_method_added(*) end", "def singleton_methods; end", "def define_singleton_method(symbol, method)\n # TODO\n end", "def singleton_method_added(meth)\n set_trace_func(nil)\n return super(meth) if meth == :initialize || @@command_options == nil\n @@command_options.merge!(:parameters=>method(meth).parameters, :class_method=>true)\n add_command(meth)\n end", "def override_singleton_method(instance, klass_name, meth)\n saved_meth_name = get_saved_method_name(meth, 'singleton')\n if instance.respond_to?(saved_meth_name, true)\n Sqreen.log.debug { \"#{saved_meth_name} found #{instance.class}##{instance.object_id} already instrumented\" }\n return nil\n elsif instance.frozen?\n Sqreen.log.debug { \"#{instance.class}##{instance.object_id} is frozen, not reinstrumenting\" }\n return nil\n end\n raise Sqreen::NotImplementedYet, \"#{instance.inspect} doesn't respond to define_singleton_method\" unless instance.respond_to?(:define_singleton_method)\n p = Instrumentation.define_callback_method(meth, saved_meth_name,\n klass_name)\n instance.define_singleton_method(saved_meth_name, instance.method(meth))\n instance.define_singleton_method(meth, p)\n # Hide saved method (its only available in this syntax)\n eval <<-RUBY, binding, __FILE__, __LINE__ + 1\n class << instance\n private :#{saved_meth_name}\n end\n saved_meth_name\n RUBY\n end", "def add_method(instance, method_name)\n\t define_singleton_method(method_name) do |*args|\n\t instance.public_send(method_name, *args)\n\t end\n\t\tend", "def singleton!\n include Singleton\n end", "def create_abstract_singleton_method(name); end", "def define_singleton_method name, &body\r\n singleton_class = class << self; self; end\r\n singleton_class.send(:define_method, name, &body)\r\n end", "def singleton_method_added(singleton_method_name)\n\n # Skip any methods that are excluded. See @@wrap_exclusions for more information.\n if @@wrap_exclusions.include?(singleton_method_name.to_sym)\n return\n end\n\n # A method that was once wrapped must now be in the excluded list, as well as it's alias.\n # This is to prevent infinite loop.\n @@wrap_exclusions << singleton_method_name.to_sym\n @@wrap_exclusions << \"old_#{singleton_method_name}\".to_sym\n\n # Because I am in a class method here, I need the special self.class_eval\n # in order to add new class methods. Because the names are part of a variable,\n # I use the HEREDOC so I can call alias_method and redefine the same method.\n #\n # * We create an alias so we can call the original method.\n # * We redefine the method by calling before and after callbacks.\n # * The before callbacks are skipped if they are already called without the after.\n # * The after callbacks are skipped if one of the method called a sibbling.\n # We only do the after callbacks when its the original methods that has finished.\n # * Any arguments and return values are perseved\n # * Methods that supports blocks are not supported.\n self.class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1\n class << self\n alias_method :old_#{singleton_method_name}, :#{singleton_method_name}\n end\n def self.#{singleton_method_name}(*args)\n if time_to_call_before_methods?\n before_methods.each do |method|\n send(method)\n end\n end\n entering_wrap_method\n result = old_#{singleton_method_name} *args\n leaving_wrap_method\n if time_to_call_after_methods?\n after_methods.each do |method|\n send(method)\n end\n end\n result\n end\n RUBY_EVAL\n\n end", "def _singleton_class\n class << self\n self\n end\n end", "def singleton_methods(all=true) end", "def singleton_method_added(meth)\n @singleton_setter_added = true if meth.to_s.end_with?('=')\n super\n end", "def singleton_method_added(meth)\n @singleton_setter_added = true if meth.to_s.end_with?('=')\n super\n end", "def singleton_method_added( sym )\n\t\tsuper\n\n\t\tif sym == :configure\n\t\t\tConfigurability.log.debug \"Re-configuring %p via deferred config hook.\" % [ self ]\n\t\t\tconfig = Configurability.loaded_config\n\t\t\tConfigurability.log.debug \"Propagating config to %p\" % [ self ]\n\t\t\tConfigurability.install_config( config, self )\n\t\tend\n\tend", "def add_method_hooks\n eigen_class = @target.singleton_class\n\n if @options[:class_methods]\n return unless @target.is_a?(Module)\n\n orig_singleton_method_added = @target.method(:singleton_method_added)\n\n eigen_class.send :define_method, :singleton_method_added do |method|\n aspector_singleton_method_added(method)\n orig_singleton_method_added.call(method)\n end\n else\n if @target.is_a? Module\n orig_method_added = @target.method(:method_added)\n else\n orig_method_added = eigen_class.method(:method_added)\n end\n\n eigen_class.send :define_method, :method_added do |method|\n aspector_instance_method_added(method)\n orig_method_added.call(method)\n end\n end\n end", "def hooked_singleton_methods_for(object)\n SINGLETON_METHOD_HOOKS[object] || {}\n end", "def add_method(instance, method_name)\n define_singleton_method(method_name) do |*args|\n instance.public_send(method_name, *args)\n end\n end", "def abstract_singleton_method(*names); end", "def singleton\n class << self; self end\n end", "def extend(mod)\n @singleton_setter_added = true\n super\n end", "def extend(mod)\n @singleton_setter_added = true\n super\n end", "def singleton_instance_eval(&block)\n singleton_class.instance_eval(&block)\n end", "def singleton\n @singleton = true\n end", "def abstract_singleton_method(*names)\n names.each(&method(:create_abstract_singleton_method))\n self\n end", "def exposed_singleton_methods\n exposing_class_ancestors = self.class.ancestors.select { |ancestor| ancestor < LocalObject }\n preferences = exposing_class_ancestors.reverse\n .map(&:_sumac_instance_expose_preferences)\n preferences << _sumac_singleton_expose_preferences\n cumulative_preferences = preferences.inject(:merge)\n cumulative_preferences.exposed\n end", "def remove_possible_singleton_method(method)\n singleton_class.instance_eval do\n remove_possible_method(method)\n end\n end", "def method_added(*) end", "def define_class_method(name, &code)\n singleton_class.instance_eval { define_method(name, &code) }\n end", "def on_start(_klass, _method); end", "def send_bypass_singleton meth, *args, &block\n self.class.instance_method(meth).bind(self).call *args, &block\n end", "def singleton_class\r\n class<<self; self end\r\n end", "def singleton_class\n\t\tclass << self; self; end\n\tend", "def abstract_singleton_method(*names)\n names.each { |name| create_abstract_singleton_method(name) }\n self\n end", "def singleton_state\n super\n end", "def runnable_methods; end", "def runnable_methods; end", "def singleton_cache; end", "def singleton_class_eval &block\n self.singleton_class.class_eval &block\n end", "def meta_singletonify\n meta_eval { include Singleton }\n end", "def singleton_class\n class << self; self; end\n end", "def add_method(method)\n # THREAD CRITICAL BEGIN\n remove_method(method.signature)\n @method.push(method)\n method.multimethod = self\n @lookup_method = { } # flush cache\n # THREAD CRITICAL END\n end", "def run_instance\n Souffle::Log.info \"Single instance runs are not currently implemented...\"\n # system = Souffle::System.from_hash(data)\n # provider = Souffle::Provider.plugin(system.try_opt(:provider)).new\n # system_tag = provider.create_system(system)\n end", "def hooked?\n self == self.class.get(base_object, method_name, singleton_method)\n end", "def method_missing( method, *args, &block )\n if method.to_s =~ /^setup_(.*)$/ && args.empty?\n add( $1.to_sym, caller.first, &block )\n else\n super\n end\n end", "def make_independent\n self.method = method.dup\n end", "def singletonify\n class_eval { include Singleton }\n end", "def target_singleton_class\n class << @obj; self; end\n end", "def registered?(method); end", "def delegating_method; end", "def instance; end", "def instance; end", "def instance; end", "def allow_registration(method); end", "def add_method method\n return method unless @document_self\n\n # HACK: avoid duplicate 'new' in io.c & struct.c (1.8.7 source code)\n key = method.pretty_name\n known = @methods_hash[key]\n\n if known then\n if @store then # otherwise we are loading\n known.comment = method.comment if known.comment.empty?\n previously = \", previously in #{known.file}\" unless\n method.file == known.file\n @store.rdoc.options.warn \\\n \"Duplicate method #{known.full_name} in #{method.file}#{previously}\"\n end\n else\n @methods_hash[key] = method\n if @current_line_visibility\n method.visibility, @current_line_visibility = @current_line_visibility, nil\n else\n method.visibility = @visibility\n end\n add_to @method_list, method\n resolve_aliases method\n end\n\n method\n end", "def _add_method\n :\"_add_#{singularize(self[:name])}\"\n end", "def method_context_class\n SingletonMethodContext\n end", "def __add_method__(name, obj)\n s = MethodContext.current.sender\n scope = s.method_scope || :public\n\n if name == :initialize or scope == :module\n visibility = :private\n else\n visibility = scope\n end\n\n # All userland added methods start out with a serial of 1.\n obj.serial = 1\n\n # Push the scoping down.\n obj.staticscope = s.method.staticscope\n\n Rubinius::VM.reset_method_cache(name)\n\n obj.staticscope.module.method_table[name] = Tuple[visibility, obj]\n\n if scope == :module\n s.current_scope.module_function name\n end\n\n if s.current_scope.respond_to? :method_added\n s.current_scope.method_added(name)\n end\n\n # Return value here is the return value of the 'def' expression\n return obj\n end", "def define_singleton_event(name, args = {})\n self.singleton_class.send(:define_event, name, args)\n end", "def method_missing(method, *args)\n super unless object.respond_to? method\n\n # We want to define it on the singleton class, not the whole Decorator\n # class, otherwise it would grow continually across all decorators.\n define_singleton_method method do\n object.send method, *args\n end\n\n send method, *args\n end", "def method_missing(meth, *args, &block)\n super unless client.respond_to?(meth)\n\n define_singleton_method meth do |*meth_args, &meth_block|\n client.send(meth, *meth_args, &meth_block)\n end\n\n send(meth, *args, &block)\n end", "def method_missing(meth, *args, &blk)\n if Hazelcast.respond_to? meth\n Hazelcast.send meth, *args, &blk\n else\n super\n end\n end", "def disable_singleton_method(name_or_sym)\n return unless singleton_methods.include?(name_or_sym.to_s)\n # dissociate the method from this instance\n method = self.method(name_or_sym.to_sym)\n method.unbind\n # JRuby unbind doesn't work in JRuby 1.1.6. In that case, redefine the singleton method to delegate\n # to the class instance method.\n if singleton_methods.include?(name_or_sym.to_s) then\n args = (1..method.arity).map { |argnum| \"arg#{argnum}\" }.join(', ')\n instance_eval \"def #{name_or_sym}(#{args}); super; end\"\n end\n end", "def standalone; end", "def instance\n @instance ||= new\n @instance.startup!\n end", "def api_singleton_method(name, method, reference = nil, collection: nil)\n reference = reference.to_s\n collection = (collection.nil? ? (reference.pluralize == reference.pluralize) : collection)\n\n define_singleton_method name do |params={}|\n result = request!(method, params)\n\n if collection\n result[reference].map { |d| new(d) }\n else\n new(reference.present? ? result[reference] : result)\n end\n end\n end", "def add_method\n <<-CODE\n next_literal;\n t1 = stack_pop();\n t2 = stack_pop();\n cpu_add_method(state, c, t1, _lit, t2);\n stack_push(t2);\n cpu_perform_hook(state, c, t1, global->sym_method_added, _lit);\n CODE\n end", "def create_abstract_singleton_method(name)\n define_singleton_method(name) do |*|\n fail NotImplementedError, \"#{self}.#{name} is not implemented\"\n end\n end", "def startup_hook; end", "def singleton_method_via_class_self_notation?\n return unless parent\n parent.type == :sclass\n end", "def unmemoized_instance_method(method_name); end", "def setup\n super\n @append_a = Module.new\n @append_a.define_singleton_method(:call) do |thing|\n thing << 'a'\n thing\n end\n\n @append_b = Class.new\n @append_b.define_singleton_method(:call) do |thing|\n thing << 'b'\n thing\n end\n\n @append_c = lambda do |thing|\n thing << 'c'\n thing\n end\n end", "def singleton_class\n `Opal.get_singleton_class(self)`\n end", "def singleton?\n false\n end", "def singleton0_cache; end", "def add_convenience_method(name_, pattern_, indexes_)\n @mutex.synchronize do\n raise ConfigurationLockedError if @locked\n name_ = name_.to_sym\n if @methods.has_key?(name_)\n raise IllegalConfigurationError, \"Factory method already exists\"\n end\n @methods[name_] = [pattern_, indexes_]\n end\n self\n end", "def instance_override(name, &block)\n unless respond_to?(\"#{METHOD_BACKUP_KEY}#{name}\")\n backup_instance_method(name)\n end\n instance_define(name, &block)\n end", "def service; end", "def invoke; end", "def entry_method( name )\n\t\tself.entry\n\t\tself.log.debug \"Looking up entry method %p\" % [ name ]\n\t\treturn nil unless self.singleton_class.method_defined?( name )\n\t\treturn self.method( name )\n\tend", "def method_of_instance; end", "def method_of_instance; end", "def method_of_instance; end", "def method_of_instance; end", "def delegate_method; end", "def entry_point\n raise NotImplementedError\n end", "def startup\nend", "def method_missing(method_name, *args)\n if method_name.to_s.start_with?('add_')\n extend method_name.slice(4..-1).camelize.constantize\n else\n super\n end\n end", "def meta_eval(&block)\n singleton_class.instance_eval(&block)\n end", "def method_missing(method, *args, &block)\n\t add_symbol = ('add_' + method.to_s).to_sym\n\t if @sketch.respond_to? add_symbol\n\t\t@sketch.send(add_symbol, *args, &block)\n\t elsif @sketch.respond_to? method\n\t\t@sketch.send method, *args, &block\n\t elsif @self_before_instance_eval.respond_to? method\n\t\t@self_before_instance_eval.send method, *args, &block\n\t else\n\t\tsuper if defined?(super)\n\t end\n\tend", "def method_added(name); end", "def method_added(name); end", "def run; new.run; end", "def start_monitoring\n raise(NotImplementedError, \"#{self.class}##{__method__} implementation not found.\")\n end", "def setup!\n setup_instance_methods!\n self\n end", "def service; raise NotImplementedError; end", "def metaclass\n class << self;\n self\n end\n end", "def metaclass\n class << self;\n self\n end\n end", "def instantiate!; end", "def main\n super\n return self\n end", "def metaclass\n class << self\n self\n end \n end" ]
[ "0.80261153", "0.7344698", "0.7074809", "0.6992933", "0.6871653", "0.6786219", "0.66744727", "0.66501844", "0.66475344", "0.6633648", "0.6537008", "0.65137005", "0.6469613", "0.6469613", "0.64628357", "0.63895565", "0.63891417", "0.6381033", "0.6349977", "0.6335969", "0.62784564", "0.62784564", "0.6264441", "0.6210569", "0.61650157", "0.61456835", "0.61168146", "0.60529363", "0.6052245", "0.6000684", "0.5999451", "0.5989688", "0.5953956", "0.58928174", "0.58888483", "0.5845428", "0.5845428", "0.5812876", "0.57895017", "0.57849705", "0.5752034", "0.57446134", "0.57256806", "0.57183826", "0.5705958", "0.57036996", "0.56990075", "0.5680352", "0.56725746", "0.5670071", "0.5660721", "0.5660721", "0.5660721", "0.5653331", "0.56442064", "0.56338704", "0.56230515", "0.5622824", "0.56170124", "0.56165016", "0.56124693", "0.5608184", "0.5588096", "0.55779135", "0.5550398", "0.5547141", "0.5546993", "0.5530224", "0.550252", "0.54924864", "0.54905784", "0.5485738", "0.5476468", "0.546343", "0.54580677", "0.5451788", "0.54241383", "0.5421604", "0.5420093", "0.54194605", "0.5405011", "0.5405011", "0.5405011", "0.5405011", "0.54009765", "0.5399451", "0.53987336", "0.53756243", "0.53648657", "0.5361165", "0.5354435", "0.5354435", "0.5354256", "0.5352322", "0.5351896", "0.53427005", "0.5320027", "0.5320027", "0.5318226", "0.53117824", "0.53104603" ]
0.0
-1
Return a hash of options along with defaults and a generated signature
def normalize_options(options) options.merge!( :format => @format, :api_key => @api_key, :expire => Time.now.to_i + 600 # Grant this request 10 minutes ).merge!(:sig => Utils.generate_signature(options, @api_secret)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def signature\n if block_given?\n @signature = Signature.new(self, &Proc.new) \n @signature.install\n options do |opt|\n signature.fill_option_parser(opt, self)\n end\n else\n @signature ||= Signature.new(self)\n end\n end", "def make_options\n options = Hash.new\n options[:file_type] = self.file_type\n options[:filepath] = self.file.path\n options[:compressed] = self.compressed\n options[:device_id] = self.device_id\n options[:file_ext] = File.extname(self.file.path) # Create extname lile \".gz\"\n options\n end", "def relevant_options_digest(options); end", "def defaults_and_options options\n options\n end", "def full_options(params)\n {\n :timestamp => Time.now.strftime(\"%F %T\"),\n :v => API_VERSION,\n :format => :xml,\n :sign_method => :md5,\n :app_key => config['app_key']\n }.merge params\n end", "def options()\n {}\n end", "def default_options; end", "def default_options; end", "def default_options; end", "def normalize_options(options)\n normalized_options = options.dup\n\n normalized_options\n .merge!(\n format: @format,\n api_key: @api_key,\n expire: request_expires_at(normalized_options)\n )\n .merge!(\n sig: Utils.generate_signature(normalized_options, @api_secret)\n )\n end", "def default_options; {} end", "def default_options\n # {}\n end", "def options\n Hash[VALID_OPTIONS_KEYS.map {|key| [key, public_send(key)] }]\n end", "def options()\n @options ||= OpenStruct.new({\n :debug => false,\n :gist_api_url => nil,\n :gist_extension => defaults[\"extension\"],\n :private_gist => defaults[\"private\"],\n :browse_enabled => defaults[\"browse\"],\n :embed_enabled => nil,\n :description => nil,\n :setup_credentials => false\n })\n end", "def options\n @options ||= OpenStruct.new(default_options)\n end", "def options\n @options ||= Hash.new{ |h, k| h[k] = {} }\n end", "def default_options\n {}\n end", "def default_options\n {}\n end", "def default_options\n {}\n end", "def header_options\n super.merge :signature => true\n end", "def default_options\n {}\n end", "def options\n Hash[*VALID_PARAMS_KEYS.map {|key| [key, send(key)] }.flatten]\n end", "def payment_options(options={})\n {}.merge(options)\n end", "def payment_options(options={})\n {}.merge(options)\n end", "def options() end", "def default_options\n {}\n end", "def default_options\n {}\n end", "def default_options\n {}\n end", "def options\n Hash[VALID_OPTIONS.map { |key| [key, send(key)] }]\n end", "def generate_generatable_options\n common_password\n security_group\n\n set_cf_release_branch(\"master\")\n end", "def to_hash\n default_options.to_hash\n end", "def to_hash\n default_options.to_hash\n end", "def user_options; end", "def options\n\t\t\tVALID_OPTIONS_KEYS.inject({}) do |option,key|\n\t\t\t\toption.merge!(key => send(key))\n\t\t\tend\n\t\tend", "def payment_options(options={})\n {}.merge(options)\n end", "def serialize_options\n\t\t{\n\t\t\texcept:\n\t\t\t[\n\t\t\t\t:access_token_secret, :access_token, :uid, :created_at,\n\t\t\t\t:refresh_token, :token_expires_at, :user_id, :updated_at\n\t\t\t],\n\t\t\tmethods:\n\t\t\t[\n\t\t\t\t:kind, :display, :url, :connectURL,\n\t\t\t\t:can_button, :can_share, :can_listen, :can_donate, :can_create_playlist,\n\t\t\t\t:name, :error\n\t\t\t]\n\t\t}\n\tend", "def default_options\n {\n appid: app_id,\n device_id: device_id,\n locale: locale,\n ip: ip,\n offer_types: offer_types,\n timestamp: Time.now.to_i\n }\n end", "def options\n\t\t\toptions = {}\n\t\t\tVALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n\t\t\toptions\n\t\tend", "def signature_plugins(options)\n if !options[:legacy_endpoints]\n {\n 'Aws::Plugins::Sign' => \"#{core_plugins}/sign.rb\"\n }\n else\n auth_types = [options.fetch(:signature_version)]\n auth_types += options[:api]['operations'].map { |_n, o| o['authtype'] }.compact\n plugins = {}\n auth_types.each do |auth_type|\n case auth_type\n when 'v4'\n plugins['Aws::Plugins::SignatureV4'] = \"#{core_plugins}/signature_v4.rb\"\n when 'v2'\n plugins['Aws::Plugins::SignatureV2'] = \"#{core_plugins}/signature_v2.rb\"\n when 'bearer'\n plugins['Aws::Plugins::BearerAuthorization'] = \"#{core_plugins}/bearer_authorization.rb\"\n end\n end\n plugins\n end\n end", "def options \n options = {}\n VALID_OPTIONS_KEYS.each {|k| options[k] = send(k)}\n options\n end", "def options(opt); end", "def options(opt); end", "def get_options; end", "def options\n Hash[VALID_OPTIONS_KEYS.map {|key| [key, send(key)] }]\n end", "def options\n\t\t@options = {\n\t\t\t:ip => ip,\n\t\t\t:email => self.email,\n\t\t\t:description => \"Author: #{self.sku.items.first.owner.id} #{self.sku.items.first.owner.pen_name} SKU: #{self.sku.id} #{self.sku.title}\",\n\t\t\t:billing_address => {\n\t\t\t\t:name => self.billing_address.name,\n\t\t\t\t:address1 => self.billing_address.street,\n\t\t\t\t:address2 => self.billing_address.street2,\n\t\t\t\t:city => self.billing_address.city,\n\t\t\t\t:state => self.billing_address.state,\n\t\t\t\t:zip => self.billing_address.zip,\n\t\t\t\t:country => self.billing_address.country,\n\t\t\t\t:phone => self.billing_address.phone\n\t\t\t}\n\t\t}\n\tend", "def options(opt)\n end", "def options\n @options ||= {}\n end", "def options\n @options ||= {}\n end", "def options\n @options ||= {}\n end", "def makeDefaultOptionHash()\n\t\toptionHash = Hash.new()\n\t\t@optionDefs.each do |optDef|\n\t\t\tdefault = optDef.getDefault()\n\t\t\tunless default.nil?\n\t\t\t\toptionHash[optDef.getKey()] = default\n\t\t\tend\n\t\tend\n\t\treturn optionHash\n\tend", "def default_request_options\n {'ha_version' => ha_version, 'ha_format' => ha_format, 'ha_fancylayout' => ha_fancylayout} #, 'strict_oauth_spec_response' => true\n end", "def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def default_options\n { }\n end", "def options\n VALID_OPTIONS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def options\n {}\n end", "def options\n {}\n end", "def options\n VALID_OPTIONS_KEYS.reduce({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def hash\n [opt_id, wallet_payer, wallet_receiver, total_amount, commission_amount, comment, return_url, cancel_url, error_url, first_name_payer, last_name_payer, email_payer, style, atos_style, notif_url, options].hash\n end", "def options\n Hash[ * VALID_OPTIONS_KEYS.map { |key| [key, send(key)] }.flatten ]\n end", "def common_options(opts); end", "def options\n {\n version: @version,\n delim: @delim,\n randomized: @flags[0],\n ordered: @flags[1],\n rotated: @flags[2],\n comments: @flags[3]\n }\n end", "def to_hash\n OPTIONS.inject({}) do |hash, option|\n hash.merge(option.to_sym => send(option))\n end\n end", "def to_hash\n OPTIONS.inject({}) do |hash, option|\n hash.merge(option.to_sym => send(option))\n end\n end", "def to_hash\n OPTIONS.inject({}) do |hash, option|\n hash.merge(option.to_sym => send(option))\n end\n end", "def to_hash\n OPTIONS.inject({}) do |hash, option|\n hash.merge(option.to_sym => send(option))\n end\n end", "def options\n defaults.merge!(@options)\n end", "def options\n defaults.merge!(@options)\n end", "def to_hash\n OPTIONS.inject({}) do |hash, option|\n hash[option.to_sym] = self.send(option)\n hash\n end\n end", "def to_hash\n OPTIONS.inject({}) do |hash, option|\n hash[option.to_sym] = self.send(option)\n hash\n end\n end", "def to_hash\n OPTIONS.inject({}) do |hash, option|\n hash[option.to_sym] = self.send(option)\n hash\n end\n end", "def to_hash\n OPTIONS.inject({}) do |hash, option|\n hash[option.to_sym] = self.send(option)\n hash\n end\n end", "def to_hash\n OPTIONS.inject({}) do |hash, option|\n hash[option.to_sym] = self.send(option)\n hash\n end\n end", "def get_full_options\n options_hash = self.get_runtime_options\n [:task_list, :version, :_exponential_retry, :prefix_name, :return_on_start, :manual_completion, :data_converter].each do |attribute|\n options_hash.merge!(attribute => self.send(attribute)) if self.send(attribute)\n end\n options_hash\n end", "def options; @opts end", "def options\n {}.tap{ |options| VALID_OPTIONS_KEYS.each{|k| options[k] = send(k) } }\n end", "def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def options\n @options ||= {}\n end", "def options\n @options ||= {}\n end", "def options\n @options ||= {}\n end", "def default_options\n {\n \"Created Date Range\" => {:field_type => :date_range, :for => \"short_interaction_created_at\", :from => \"2012-03-01\".to_date, :to => Time.current},\n Institution => {:field_type => :select_tag, :has_dependencies => \"true\"},\n Provider => {:field_type => :select_tag, :dependency => '#institution_id', :dependency_id => 'parent_id'},\n Program => {:field_type => :select_tag, :dependency => '#provider_id', :dependency_id => 'parent_id'},\n }\n end", "def set_default_options()\n @options = OpenStruct.new(\n :output_base => nil,\n :verbose => false,\n :config_file => nil,\n :samples => nil,\n :delay => 30,\n :scheduler_opts => ''\n )\nend", "def initialize_options\n @options = @spec.options.inject({}) do |options, (name, params)|\n options[name] = Option.new\n options[name].enabled = false\n options[name].description = params[\"description\"] || params\n options[name].files = params[\"files\"] || {}\n options\n end.to_struct if @spec.options\n end", "def build_opts(opts)\n {}.tap do |o|\n o[:serialize] = if opts[:serialize] && opts[:serialize].is_a?(Array)\n opts[:serialize].map(&:to_s)\n else\n []\n end\n\n o[:only] = opts[:only] || [\"add\", \"remove\"]\n o[:notify] = opts[:notify] || false\n end\n end", "def options\n OPTIONS.each_with_object({}) do |name, hash|\n hash[name] = raw.fetch(name, nil)\n end\n end", "def options\n OPTIONS.each_with_object({}) do |name, hash|\n hash[name] = raw.fetch(name, nil)\n end\n end", "def with_options(&block); end", "def options\n VALID_OPTIONS_KEYS.reduce({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def default_options=(opts); end", "def options\n @options ||= {}\n end", "def options\n @options ||= {}\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end" ]
[ "0.7361062", "0.6828099", "0.68097854", "0.6782686", "0.6717636", "0.65930074", "0.6563775", "0.6563775", "0.6563775", "0.6559247", "0.6513989", "0.65038675", "0.64899844", "0.6482193", "0.6393485", "0.63615644", "0.6342603", "0.6342603", "0.6341845", "0.634138", "0.63301176", "0.63184154", "0.6317994", "0.6317994", "0.63175714", "0.6307173", "0.6307173", "0.6307173", "0.629912", "0.62937826", "0.62853914", "0.62853914", "0.6277746", "0.62685674", "0.62675107", "0.6265157", "0.62349397", "0.6232493", "0.6221387", "0.6187465", "0.6185199", "0.61850554", "0.6181406", "0.6171515", "0.6164662", "0.6147388", "0.61438507", "0.61438507", "0.61438507", "0.6138617", "0.612486", "0.61199623", "0.6118448", "0.611773", "0.6114675", "0.6114675", "0.6110597", "0.61009085", "0.6088737", "0.6085375", "0.6072098", "0.6071599", "0.6071599", "0.6071599", "0.6071599", "0.6071403", "0.6071403", "0.6065381", "0.6065381", "0.6065381", "0.6065381", "0.6065381", "0.60651565", "0.6061387", "0.6057531", "0.6049541", "0.6049541", "0.6049541", "0.6049541", "0.6049541", "0.6049541", "0.60462743", "0.60462743", "0.60462743", "0.60323197", "0.60229546", "0.60187316", "0.6015968", "0.60145795", "0.6014228", "0.601114", "0.6008934", "0.59940803", "0.59939647", "0.59939647", "0.59873563", "0.59873563", "0.59873563", "0.59873563", "0.59873563" ]
0.68062586
3
num The Integer from which the next number is calculated. Examples next_number(1) => 2 Returns the next number
def next_number(num) return num + 1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_number(num)\n num + 1\n end", "def next_num(num)\n return num + 1\nend", "def next_number(num)\n return num += 1\nend", "def next_number(number)\n number.to_i\n return number+=1\nend", "def next_number(number)\n return number +1\nend", "def next_number(number)\n output = number + 1\n return output\nend", "def next_number(number)\n return number += 1\nend", "def next_number(number)\n\n return number + 1\n\nend", "def next_number\n process_next_block if @numbers.empty?\n\n @numbers.shift\n end", "def next_number(number)\n if number.even?\n number / 2\n else\n 3 * number + 1\n end\nend", "def next_number(n)\n\t\t(n).map{|n|n+2}\n\tend", "def next_number\n Sequence.next_val\n end", "def next_number(n)\n n.even? ? n/2 : 3*n+1\nend", "def get_next_number\n if project && number.blank?\n last_invoice_number = Invoice.where(:project_id => project.id).max(:number)\n self.number = last_invoice_number ? ((last_invoice_number + 1).to_i) : 1\n end\n end", "def generate_next(number)\n if number == 0\n return 0\n elsif number == 1\n return 1\n else\n next_element = generate_next(number-1) + generate_next(number-2)\n end\n return next_element\nend", "def next_number\n counter.call(files.last_number).to_s\n end", "def next_num(num, max=9, min=0)\r\n arr = num\r\n done = false\r\n for i in 0...arr.length\r\n index = arr.length - i - 1\r\n \tif arr[index] == max\r\n \t arr[index] = min\r\n \t next\r\n \tend\r\n\t arr[index] += 1\r\n done = true\r\n\t break\r\n end\r\n arr = [min] + arr if not done\r\n arr.join_to_i\r\nend", "def prev_num(num1)\n return num1 + 1\nend", "def next(n=1)\n self + n\n end", "def fib_num(num)\n return 1 if num == 1\n return 1 if num == 2\n retu_num = fib_num(num-1) + fib_num(num-2)\nend", "def next_prime\n next_int = self + 1\n next_int += 1 until next_int.prime?\n next_int\n end", "def previous_number(num)\n return num - 1\nend", "def previous_number(num)\n return num - 1\nend", "def previous_number(num)\n return num - 1\nend", "def previous_number(num)\n return num - 1\nend", "def num()\n @num\n end", "def get_actual_number(number)\n if number >= 31\n return number + 2\n else\n return number + 1\n end\n end", "def next_number(num, index, numbers, ph, lh)\n if index < numbers.size\n num = numbers[index]\n ph[num] = index\n return num\n end\n\n if lh[num] # second repeat\n nnum = lh[num] - ph[num]\n ph[nnum] ? lh[nnum] = index : ph[nnum] = index\n ph[num] = index - 1\n num = nnum\n else\n num = 0\n lh[num] = index # works because we know 0 has occurred before\n end\n num\nend", "def next_page\n num = current_page + 1\n num if total_pages >= num\n end", "def next(num)\n @node = num\n @hour.number +=1\n end", "def next_number\n self.to_a.size + 1\n end", "def fibonacci_num(num)\n return 0 if num == 0\n return 1 if num == 1\n return 1 if num == 2\n fib_num = (fibonacci_num(num - 1)) + (fibonacci_num(num - 2))\nend", "def next_step_number\n progress = current_progress\n progress ? current_progress.step.number + 1 : 0\n end", "def next_check_number\n\t\tmaximum = cash_bank_check_offereds.maximum(\"number\")\n\t\t(maximum ? maximum+1 : initial_check_number).to_s\n\tend", "def num; end", "def num; end", "def adding(num)\n\tsum = 0\n\t(1..num).each do |x|\n\t\tsum += x\n\tend\n\treturn sum\nend", "def num_of_num(number)\n\tnumber_of_num=1\n\tnumber_size=number.to_s.size\n while number_size > 1 do\n number_of_num = number_of_num * \tnumber_size\n number_size = number_size - 1 \n end\n return number_of_num\nend", "def next_sequence_number!\n sequence_number && @sequence_number += 1\n end", "def next_available_number\n request :get_next_available_number\n end", "def next_available_number\n request :get_next_available_number\n end", "def SimpleAdding(num)\nsum=0\n 1.upto(num) do |x|\n\tsum+=x\n\tend\n\t\nreturn sum\nend", "def factorial(num)\n\tif num <= 1\n\t\treturn 1\n\telse\n\t\tnum * factorial(num - 1)\n\tend\nend", "def prev_number(number)\n return number -= 1\nend", "def calculate_next\n n = @current_page + 1\n n > @total_pages || n <= 0 ? nil : n\n end", "def number(nth)\n if nth <= 0\n 0\n elsif nth == 1\n 1\n else\n number(nth - 1) + number(nth - 2)\n end\n end", "def next_bigger_num(num)\r\n digits = num.digits\r\n sorted_digits = digits.sort { |a, b| b <=> a }\r\n if digits.count(digits[0]) == digits.size || digits.size < 2 || sorted_digits == digits.reverse\r\n return -1\r\n end\r\n \r\n permutation = digits.permutation.to_a.map do |sub_arr|\r\n sub_arr.join('').to_i\r\n end\r\n \r\n sorted_permutation = permutation.sort\r\n \r\n sorted_permutation.each do |current_num|\r\n return current_num if current_num > num\r\n end\r\nend", "def num\n @num\n end", "def next_page_number\n [page_number + 1, last_page_number].min\n end", "def next_sequence_number\n last_sequence_number ? last_sequence_number.next : 0\n end", "def next_page_number\n last_page? ? nil : current_page_number + 1\n end", "def num\r\n @num\r\n end", "def add_up(num)\n\tsum = 0;\n\t(1..num).each { |x| sum += x }\n\tsum\nend", "def fib_iter(n)\n curr_num, next_num = 0, 1\n (n).times do\n curr_num, next_num = next_num, curr_num + next_num\n end\n curr_num\nend", "def factorial(num)\n\treturn nil if num < 0\n\treturn 1 if num.equal?(0)\n\ti = 1\n\ttotal = 1\n\tnum.times do\n\t\ttotal *= i\n\t\ti += 1\n\tend\n\treturn total\nend", "def count_down(num)\n p num;\n count_down(num - 1)\n end", "def num\n begin\n Integer self\n rescue ArgumentError\n nil\n end\n end", "def next_order_number\n return 0 unless highest_order_number\n highest_order_number + 1\n end", "def generate_number\n return if !self.number.blank? || !self.isic?\n\n range = self.club.card_range_for :isic\n current_max = Card.where(\n :members => {:club_id => self.club.id},\n :number => range\n ).maximum(:number)\n self.number = current_max.try(:succ) || range.begin\n end", "def add_two(number)\n return number.next.next\nend", "def previous_number(number)\n return number-1\nend", "def sequence(num)\n\n results = []\n\n 1.upto(num) { |num| results << num }\n\n results\n\nend", "def previous_number(number)\n return number - 1\nend", "def previous_number(number)\n return number - 1\nend", "def next\n\t\tself + 1\n\tend", "def next_step(n)\n if n.even?\n n/2.to_i\n else\n 3*n+1\n end\nend", "def previous_number(number)\n return number - 1 \nend", "def next_match_number\n # This returns a PGresult object\n # [http://rubydoc.info/github/ged/ruby-pg/master/PGresult]\n result = Match.connection.execute(\"SELECT nextval('match_number_seq')\")\n result[0]['nextval']\n end", "def tribonacci_number(num)\n return 1 if num == 1\n return 1 if num == 2\n return 2 if num == 3\n\n tribonacci_number(num - 1) + tribonacci_number(num - 2) + tribonacci_number(num - 3)\nend", "def build_total(num)\n if num == 1\n 1 # No meaningful work left to do, just return the base case\n else\n square(num) + build_total(num-1)\n end\n end", "def fib(num)\n return num if num <= 1\n fib(num-1) + fib(num-2)\nend", "def next_prime(n=1)\n apply(n, &:get_next_prime)\n end", "def fibonacci(num)\n if num < 2\n num\n else\n fibonacci(num - 1) + fibonacci(num - 2)\n end\nend", "def fibonacci(num)\n if num < 2\n num\n else\n fibonacci(num - 1) + fibonacci(num - 2)\n end\nend", "def sum_num\n\t#ask for number\n\tputs \"gimme dat number: make sure its more than 1?\"\n\tnum = gets.chomp.to_i\n\t\n\n\tif num < 1\n\t\tputs \"I told you to put a number greater than 1\"\n\t\tsum_num\n\telse\n\t\t# prints number 1 to num\n\t\tcounter = (1..num)\n\t\tnew_num = 0\n\t\tcounter.each do |num|\n\t\t\tnew_num = new_num + num\n\n\n\t\tend\n\n\tend\n\tputs new_num \nend", "def sum_num(first_num, last_num)\n # Your code goes here\n sum = 0\n first_num = first_num - 1\n num_count = (last_num - first_num)\n num_count.times do\n first_num += 1\n sum += first_num \n end\n return sum\nend", "def tribonacci_number(num)\n return 1 if num == 1 or num == 2\n return 2 if num == 3\n tribonacci_number(num-1) + tribonacci_number(num-2) + tribonacci_number(num-3)\nend", "def next_prime(num, i)\n step = 1\n if i.negative?\n i = -(i)\n step = -(step)\n end\n\n prime_count = 0\n while prime_count < i\n return nil if num < 0\n num += step\n prime_count += 1 if prime?(num)\n end\n num\nend", "def next_file_number\r\n most_recent_file_number + 1\r\n end", "def next_page_number\n Hash(next_page_params).fetch('page', {}).fetch('number', nil)\n end", "def factorial num\n\tfactorial = 1\n\twhile num > 0\n\t\tfactorial *= num\n\t\tnum -= 1\n\tend\n\treturn factorial\nend", "def factorial(number)\n\ttotal = 1\n\treturn 1 if number == 0\n\tnumber.downto(2) do |n|\n\t\ttotal = total * n\n\tend\n\ttotal\nend", "def solution(number)\n ans = 0\n (3...number).step(3) {|n| ans += n}\n (5...number).step(5) {|n| n % 3 == 0 ? next : ans += n}\n return ans\nend", "def nextLooping(number)\n for i in 1..10\n if i * number % 5 == 0\n next\n else\n puts i * number\n end\n end\n end", "def rand_num(range)\n num = @rng.rand(range) + 1\n num\n end", "def nextval current\n if ::Integer === current\n current + 1\n else\n intval = current.to_i\n if intval.to_s != current.to_s\n (current[0].ord + 1).chr\n else\n intval + 1\n end\n end\n end", "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", "def increment(number)\n if block_given?\n yield(number + 1)\n end\n number + 1\nend", "def increment(number)\n if block_given?\n yield(number + 1)\n end\n number + 1\nend", "def increment(number)\n if block_given?\n yield(number + 1)\n end\n number + 1\nend", "def get_next(counter)\n product = 1\n (counter..(counter+@digit_size - 1)).each do |num|\n next if num == 0\n product = product * @all_ints[num].to_i\n end\n product\nend", "def get_num\n value = 0\n\n return expected(\"Integer\") unless is_digit($lookahead)\n\n while is_digit($lookahead)\n value = 10 * value + $lookahead.to_i\n lookahead\n end\n\n value\nend", "def fib(num)\n return num if num < 2\n return fib(num - 1) + fib(num - 2)\nend", "def fibonacci(num)\n return 0 if num.zero?\n\n if num == 1\n 1\n else\n fibonacci(num - 1) + fibonacci(num - 2)\n end\nend", "def nth_prime(num)\n\ti = 2\n\tprime_numbers = []\n\twhile true\n\t\tif is_prime?(i)\n\t\t\tprime_numbers << i\n\t\tend\n\t\tif prime_numbers.length == num\n\t\t\treturn prime_numbers[num-1]\n\t\tend\n\t\ti +=1\n\tend\nend", "def numbers(n)\n\nend", "def num()\n\t\treturn @num\n\tend" ]
[ "0.87878114", "0.83470374", "0.8151548", "0.796511", "0.7962804", "0.7826671", "0.7774877", "0.76334405", "0.74413025", "0.7128902", "0.7068094", "0.70616204", "0.6914057", "0.6823982", "0.6646362", "0.66071683", "0.6572752", "0.65502477", "0.649349", "0.64560324", "0.64186984", "0.63068086", "0.63068086", "0.63068086", "0.63068086", "0.63064665", "0.6280536", "0.6269904", "0.62564075", "0.62410665", "0.6215379", "0.6186652", "0.61804605", "0.6167344", "0.61428106", "0.61428106", "0.61361194", "0.6110312", "0.6105982", "0.609954", "0.609954", "0.6095945", "0.60887975", "0.60862315", "0.608199", "0.60694444", "0.6067553", "0.6052077", "0.6051757", "0.60353833", "0.60333514", "0.6009408", "0.5999024", "0.5974773", "0.59623796", "0.59474134", "0.5946315", "0.5945047", "0.5944271", "0.5931684", "0.59066087", "0.5896568", "0.5890689", "0.5890689", "0.58885235", "0.588316", "0.5882485", "0.58687645", "0.58682466", "0.5861938", "0.5852161", "0.5850996", "0.5846062", "0.5846062", "0.5844342", "0.5824206", "0.58136666", "0.58060807", "0.579819", "0.5788834", "0.5785478", "0.5777485", "0.5776303", "0.5763854", "0.5762915", "0.57555264", "0.57526726", "0.57330465", "0.57330465", "0.57330465", "0.5731577", "0.5730385", "0.57303834", "0.5730187", "0.5728853", "0.57265884", "0.57195395" ]
0.8238713
4
GET /c_videos/1 GET /c_videos/1.json
def show @c_video = CVideo.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @c_video } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def videos options={}\n response = client.get(\"/#{id}/videos\", options)\n end", "def list\n @videos = Video.all\n\n respond_to do |format|\n format.html # list.html.erb\n format.json { render json: @videos }\n end\n end", "def index\n @videos = Video.all\n render json: @videos\n end", "def index\n @videos = Video.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end", "def index\n @videos = Video.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end", "def index\n @videos = Video.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end", "def index\n @videos = Video.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end", "def index\n @videos = Video.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end", "def show\n @yt_client = YouTubeIt::Client.new(:dev_key => \"AI39si6hkRNCL77mzzv1LycIohZtksVIi0L5S9lQMx6crqOfGdyKcB2U2M5WHeNBUT2VLgTVzjR9rxPa1RJZw-sZ6wqtnaZ7AA\")\n @video = Video.find(params[:id])\n\n @comments = @video.comments.all\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @video }\n end\n end", "def index\n @videos = current_user.videos\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end", "def show\n @videos = Video.find_by(id: params[:id])\n end", "def index\n\n\n\n @yt_client = YouTubeIt::Client.new(:dev_key => ENV[\"YOUTUBE_DEV_KEY\"])\n\n @videos = Video.search(params[:search])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end", "def resources\n videos\n end", "def get_album_videos album_id\n get(\"/albums/#{album_id}/videos\")\n end", "def show\n @video = current_user.videos.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @video }\n end\n end", "def index\n @videos = @item.videos\n end", "def index\n @videos = @item.videos\n end", "def show\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @video }\n end\n end", "def show\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @video }\n end\n end", "def show\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @video }\n end\n end", "def show\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @video }\n end\n end", "def show\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @video }\n end\n end", "def show\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @video }\n end\n end", "def show\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @video }\n end\n end", "def show\n render json: @video\n end", "def show\n @videos = Video.all\n @video = @videos.find params[:id]\n end", "def show\n render json: @video\n end", "def index\n @videos = Video.order('created_at DESC').page params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end", "def index\n #@videos = Video.all\n @videos = Video.paginate(:page => params[:page], :per_page => 25)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end", "def video\n YouTubeApi.find_video(youtube_id)\n end", "def show \n @project = Project.find params[:id]\n @videos = @project.videos\n end", "def index\n @videos = Video.pluck 'title'\n @videos = Video.order('created_at DESC')\n respond_to do |format|\n format.html{}\n format.json { render :json => @videos }\n end\n end", "def index\n @videos = current_user.videos\n respond_with(@videos)\n end", "def index\n @videos = Video.all\n end", "def index\n @videos = Video.all\n end", "def index\n @videos = Video.all\n end", "def index\n @videos = Video.all\n end", "def index\n @videos = Video.all\n end", "def index\n @videos = Video.all\n end", "def index\n @videos = Video.all\n end", "def index\n @videos = Video.all\n end", "def index\n @videos = Video.all\n end", "def index\n @videos = Video.all\n end", "def index\n @videos = Video.all\n end", "def index\n @videos = Video.all\n end", "def index\n @videos = Video.all\n end", "def index\n @videos = Video.all\n end", "def index\n @videos = Video.all\n end", "def index\n @videos = Video.all\n end", "def index\n @videos = Video.all\n end", "def index\n #@videos = Video.all\n Video.delete_database_and_files_on_server\n @video = Video.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end", "def get_videos_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: MediaVideosApi.get_videos ...\"\n end\n # resource path\n local_var_path = \"/media/videos\"\n\n # query parameters\n query_params = {}\n query_params[:'exclude_flagged'] = opts[:'exclude_flagged'] if !opts[:'exclude_flagged'].nil?\n query_params[:'filter_videos_by_uploader'] = opts[:'filter_videos_by_uploader'] if !opts[:'filter_videos_by_uploader'].nil?\n query_params[:'filter_category'] = opts[:'filter_category'] if !opts[:'filter_category'].nil?\n query_params[:'filter_tagset'] = opts[:'filter_tagset'] if !opts[:'filter_tagset'].nil?\n query_params[:'filter_videos_by_name'] = opts[:'filter_videos_by_name'] if !opts[:'filter_videos_by_name'].nil?\n query_params[:'filter_videos_by_contributor'] = opts[:'filter_videos_by_contributor'] if !opts[:'filter_videos_by_contributor'].nil?\n query_params[:'filter_videos_by_author'] = opts[:'filter_videos_by_author'] if !opts[:'filter_videos_by_author'].nil?\n query_params[:'filter_has_author'] = opts[:'filter_has_author'] if !opts[:'filter_has_author'].nil?\n query_params[:'filter_has_uploader'] = opts[:'filter_has_uploader'] if !opts[:'filter_has_uploader'].nil?\n query_params[:'filter_related_to'] = opts[:'filter_related_to'] if !opts[:'filter_related_to'].nil?\n query_params[:'filter_friends'] = opts[:'filter_friends'] if !opts[:'filter_friends'].nil?\n query_params[:'filter_disposition'] = opts[:'filter_disposition'] if !opts[:'filter_disposition'].nil?\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 => 'PageResourceVideoResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: MediaVideosApi#get_videos\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @jeux_videos = JeuxVideo.find(params[:id])\n \n end", "def index\n authorize! :read, @videos\n @videos = searchitems(params[:search],Video,'video_name')\n @video = @videos.first\n end", "def show\n @video = Video.new\n @competition_videos = Competition.find(params[:id]).videos\n #@competition_videos = Competition.find(params[:id]).videos.order(created_at: :desc).paginate(page: params[:page],per_page:50)\n end", "def my_video(video_id)\n client.get_my_video(video_id)\n end", "def index\n @videos = Video.where(project_id: @project.id)\n end", "def index\n @videos = current_user.videos\n end", "def load_videos2\n json = File.read(VIDEOS2_FILE)\n array = JSON.parse(json)\n array[\"videos\"].map! { |v| {\"postId\" => v[\"postId\"], \"wordList\" => v[\"wordList\"]}}\n array[\"videos\"]\n end", "def videos()\n\t\treturn Videos.new(@credentials.client_key, @credentials.get_access_token)\n\tend", "def show\n @video = Video.find(params[:id])\n\n @networks = @video.networks\n\n @impressions = @video.impressions\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @video }\n end\n end", "def list_videos_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: VideoApi.list_videos ...\"\n end\n # resource path\n local_var_path = \"/videos\"\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['bearer']\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 => 'Array<Video>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: VideoApi#list_videos\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @congratulations_videos = CongratulationsVideo.all\n end", "def show\n @video = Video.find(params[:id])\n end", "def video\n\t\tVideo.find(self.video_id)\n\tend", "def video\n\t\tif params[:category_id]==\"all\"\n\t\t@search=OldFlashFile.all\n\t\t\t\tif !@search.empty?\n\t\t\t\t@status= @search.map{|f| {:title =>f.title, :imageUrl=>request.protocol+request.host_with_port+f.preview_image.url(:small), :videoUrl=>(f.video.content_type==\"video/x-flv\") ? \"#{request.protocol+request.host_with_port+f.video.url}\".gsub(\".flv\", \".mp4\") : \"#{request.protocol+request.host_with_port+f.video.url}\" ,:videotype=>f.video.content_type}}\n\t\t\t\telse\n\t\t\t\t@status=nil \n\t\t\t\tend\n\n\t\telse\n\t\targs={:search=>{:filter=>params[:filter],:category_id=>params[:category_id]}}\n\n\t\t@search = ContentSearch.new(args) \n\t\t@results = Kaminari.paginate_array( @search.results )\n\t\t@total = @search.total\n\n\t\t\tif !@results.empty?\n\t\t\t@status= @results.map{|f| {:title =>f.title, :imageUrl=>request.protocol+request.host_with_port+f.preview_image.url(:small), :videoUrl=>(f.video.content_type==\"video/x-flv\") ? \"#{request.protocol+request.host_with_port+f.video.url}\".gsub(\".flv\", \".mp4\") : \"#{request.protocol+request.host_with_port+f.video.url}\",:videotype=>f.video.content_type}}\n\n\t\t\telse\n\t\t\t@status=nil \n\t\t\tend\n\t\tend\n\n\t\trender :json =>@status.to_json\n\t\tend", "def videos( params={} )\n videos = get_connections(\"videos\", params)\n return map_connections videos, :to => Facebook::Graph::Video\n end", "def show\n @user_video = UserVideo.find(params[:id]) \n @vid_id = @user_video.video_embed.split('?v=')[1]\n @u = \"http://www.youtube.com/embed/\" + @vid_id\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_video }\n end\n end", "def list\n respond_to do |format|\n format.html { render partial: 'videos/issues_video_container', locals: {videos: Video.where(issue_id: params[:issue_id]).page(params[:page]).per(params[:per]), issue: Issue.where(id: params[:issue_id])} }\n format.json { render json: Video.where(issue_id: params[:issue_id]).page(params[:page]).per(params[:per])}\n end\n end", "def index\n @community_member_videos = @community_member_profile.videos\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @community_member_videos }\n end\n end", "def index\n ip = index_params()\n published = ip[:published].boolean? ? ip[:published] : (ip[:published].nil? ? DEFAULT_PUBLISHED : ip[:published].to_b)\n @videos = Video.includes(:video_motifs).where(:published => published)\n @motif_ids = ip[:motif_ids] || (ip[:query] || []).select { |val|\n val.starts_with? '__'\n }.map { |val| val[2..-1] }\n @keywords = ip[:keywords] || (ip[:query] || []).select { |val|\n !val.starts_with? '__'\n }\n @videos = @videos.has_combined_motifs(@motif_ids) if !@motif_ids.empty?\n @videos = @videos.keywords_include(@keywords) if !@keywords.empty?\n @videos = @videos.order('created_at DESC')\n render :json => @videos, :include => ALL_INCLUDES\n end", "def show\n render :json => @video, :include => ALL_INCLUDES\n end", "def index\n @adm_videos = Adm::Video.all\n end", "def index\n @medio_videos = MedioVideo.all\n end", "def index\n @videos = @user.videos\n @videos = @videos.order(:id).page params[:page]\n end", "def new\n \n @video = Video.new\n \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end", "def index\n @jeux_videos = JeuxVideo.all\n end", "def index\n @game_videos = GameVideo.all\n end", "def index\n @videos = @palestrante.videos.mais_novos\n end", "def show\n @kuaibovideo = Kuaibovideo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kuaibovideo }\n end\n end", "def show\n @community_member_video = @community_member_profile.videos.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @community_member_video }\n end\n end", "def index\n @college_videos = CollegeVideo.all\n end", "def getVideoURL\n if (request.post?)\n cVideoID = self.findKeyInJSON(params[:params], \"VideoID\", 2)\n cOS = self.findKeyInJSON(params[:params], \"OS\", 2)\n \n case cOS.to_s\n when \"100\"\n # We have that file stored in S3 yet?\n # Check it later!\n # Just hard-code it\n returnFileName = \"http://ec2-50-112-145-58.us-west-2.compute.amazonaws.com:1935/vods3/_definst_/mp4:s3/\"\n returnFileName += cVideoID + \".mov\"\n returnFileName += \"/playlist.m3u8\"\n when \"101\"\n # android\n returnFileName = \"rtsp://ec2-50-112-145-58.us-west-2.compute.amazonaws.com:1935/vod/_definst_/mp4:s3/\"\n returnFileName += cVideoID + \".mov\"\n else\n # ignore\n end\n \n # Update Video Played Count\n begin\n b = Videotemp.find(cVideoID)\n if(b.playedCount == nil || b.playedCount == '')\n playedCount = 1\n else\n playedCount = b.playedCount\n playedCount = playedCount.to_i + 1\n end\n b.playedCount = playedCount.to_i\n b.save\n rescue Exception => e\n # ignore\n end\n \n # Return JSON response\n cRequestID = self.findKeyInJSON(params[:params], \"RequestID\", 1)\n rData = {\"VideoStreamUrl\" => returnFileName}\n self.jsonRender(rData, 'WOWZA URL', cRequestID, '100')\n end\n end", "def get_folder_videos folder_id, **args\n get(\"/projects/#{folder_id}/videos\", args)\n end", "def show\r\n @video = Video.find(params[:id]) \r\n\r\n respond_to do |format|\r\n format.html { render :layout => false } #show.html.erb\r\n format.json { render json: @video } \r\n end\r\n end", "def index\n \n @videos = Video.where(:video_type => 2).order(\"id DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end", "def show\n @controller = controller_name\n @action = action_name\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @video }\n end\n end", "def index\n begin\n @active_page = \"videos\"\n @videos = Video.all\n @is_create_channel = current_user.channel.blank?\n respond_with(@videos)\n rescue Exception => e\n log_error(e, \"Error occured in Index action of VideosController\")\n flash_error(t('videos.index_page_load_error'))\n end\n end", "def index\n @afdoc = ActiveFedora::Base.find(params[:archival_video_id], :cast => true)\n respond_to do |format|\n format.html { render :partial => \"external_videos/show/list\" if request.xhr? }\n end\n end", "def index\n @q = Video.search(params[:q])\n @videos = @q.result(distinct: true).page(params[:page])\n end", "def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end", "def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end", "def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end", "def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end", "def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end", "def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end", "def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end", "def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end", "def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end", "def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end" ]
[ "0.76379496", "0.7344656", "0.7323692", "0.7167795", "0.716704", "0.716704", "0.716704", "0.716704", "0.71265334", "0.71194375", "0.7093038", "0.7083882", "0.7078058", "0.7075357", "0.7067187", "0.7053308", "0.7053308", "0.70165056", "0.70165056", "0.70165056", "0.70165056", "0.70165056", "0.70165056", "0.70165056", "0.69945735", "0.6966674", "0.69244754", "0.69224346", "0.6913294", "0.68994176", "0.6880823", "0.687456", "0.6821667", "0.68166155", "0.68166155", "0.68166155", "0.68166155", "0.68166155", "0.68166155", "0.68166155", "0.68166155", "0.68166155", "0.68166155", "0.68166155", "0.68166155", "0.68166155", "0.68166155", "0.68166155", "0.68166155", "0.68166155", "0.67651874", "0.6755817", "0.6742956", "0.6700634", "0.66823184", "0.6657099", "0.6639463", "0.66359884", "0.66044974", "0.65991974", "0.65929735", "0.6581685", "0.65802354", "0.657718", "0.65762347", "0.65708065", "0.6569586", "0.6540751", "0.6532846", "0.6528379", "0.65268326", "0.6509546", "0.6504065", "0.65027106", "0.6499097", "0.64577055", "0.64488125", "0.6448599", "0.64367425", "0.64359254", "0.6433018", "0.64124453", "0.6410952", "0.6398444", "0.6398408", "0.63947666", "0.63923633", "0.6389797", "0.6382552", "0.63761276", "0.63726324", "0.63719606", "0.63719606", "0.63719606", "0.63719606", "0.63719606", "0.63719606", "0.63719606", "0.63719606", "0.63719606" ]
0.7482724
1
GET /c_videos/new GET /c_videos/new.json
def new @c_video = CVideo.new @client_choice = Client.find(:all, :order => "C_LName").collect do |d| [d.C_LName + ", " + d.C_FName, d.id] end respond_to do |format| format.html # new.html.erb format.json { render json: @c_video } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n \n @video = Video.new\n \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end", "def new\n @video = Video.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end", "def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end", "def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end", "def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end", "def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end", "def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end", "def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end", "def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end", "def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end", "def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end", "def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end", "def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end", "def new\n begin\n @active_page = \"videos\"\n @video = Video.new\n respond_with(@video)\n rescue Exception => e\n log_error(e, \"Error occured in New action of VideosController\")\n flash_error(t('videos.new_page_load_error'))\n end\n end", "def new\r\n @video = Video.new\r\n\r\n respond_to do |format|\r\n format.html { render :layout => false } # new.html.erb\r\n format.json { render json: @video }\r\n end\r\n end", "def new\n\tif user_type != 'guest' and user_type != 'bunned' and user_type != 'new_user'\n\t\t@video = Video.new\n\t\t\n\t\t@title = 'Новое видео'\n\t\trespond_to do |format|\n\t\t format.html # new.html.erb\n\t\t format.json { render :json => @video }\n\t\tend\n\telse\n\t\tredirect_to '/404'\n\tend\n end", "def new\n @channel = params[:forminfo]\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end", "def new\n authorize! :create, @videos\n @videos = Video.new\n end", "def new\n @video = Video.new\n @questions = Question.find_all_by_category_id(params[:category_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end", "def create\n @c_video = CVideo.new(params[:c_video])\n\n respond_to do |format|\n if @c_video.save\n format.html { redirect_to @c_video, notice: 'A new video was successfully created.' }\n format.json { render json: @c_video, status: :created, location: @c_video }\n else\n format.html { render action: \"new\" }\n format.json { render json: @c_video.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @video = Video.new\n @title = \"Video Submission\"\n \n @url = params[:url]\n \n respond_to do |format|\n format.html # new.html.erb\n end\n end", "def new\n\n @project = Project.user_readable(current_user, params[:project_id])\n\n if @project\n\n @video = @project.videos.new\n @video.set_defaults\n @aws_signature_url = root_url + \"signatures/aws_uploads\"\n\n respond_to do |format|\n format.html\n format.json { render :json => {:video_id => @video.id, :aws_videos_path => @video.videos_path}, :status => :ok }\n end\n\n else\n not_authorized\n end\n\n end", "def create\n @video = Video.new(video_params)\n @video.save!\n render json: @video\n end", "def new\n @video = @project.videos.build\n \n respond_to do |format|\n if @user.can_add_videos?\n format.html # new.html.erb\n format.xml { render :xml => @video }\n else\n flash[:warning] = \"You cannot add any more videos, upgrade plan or remove old videos.\"\n format.html { redirect_to(project_url(@project, :subdomain => @user.subdomain)) }\n format.xml { render :xml => @video.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @mwod_video_link = MwodVideoLink.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mwod_video_link }\n end\n end", "def new\n @user = current_user\n @course_lesson = CourseLesson.new\n 3.times { @course_lesson.videos.build }\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @course_lesson }\n end\n end", "def create\n @video = current_user.videos.new(video_params)\n respond_to do |format|\n if @video.save\n format.html { redirect_to videos_path(), notice: 'Video criado com sucesso.' }\n format.json { render :index, status: :created, location: @video }\n else\n format.html { redirect_to new_video_path(), notice: 'Video não salvo.' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @video = Video.new(params[:video])\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { render action: \"new\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @video = Video.new(params[:video])\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { render action: \"new\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @video = Video.new(params[:video])\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { render action: \"new\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @video = Video.new(params[:video])\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { render action: \"new\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\r\n @video = Video.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @video }\r\n end\r\n end", "def new\n @video_gallery = VideoGallery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video_gallery }\n end\n end", "def create\n\tif user_type != 'guest' and user_type != 'bunned' and user_type != 'new_user'\n\t\tparams[:video][:user_id] = current_user.id\n\t\t@video = Video.new(params[:video])\n\t\trespond_to do |format|\n\t\t if @video.save\n\t\t\tformat.html { redirect_to @video, :notice => 'Видео успешно добавлено' }\n\t\t\tformat.json { render :json => @video, :status => :created, :location => @video }\n\t\t else\n\t\t\tformat.html { render :action => \"new\" }\n\t\t\tformat.json { render :json => @video.errors, :status => :unprocessable_entity }\n\t\t end\n\t\tend\n\telse\n\t\tredirect_to '/404'\n\tend\n end", "def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video.as_json }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @video }\n end\n end", "def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @video }\n end\n end", "def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render action: 'show', status: :created, location: @video }\n else\n format.html { render action: 'new' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render action: 'show', status: :created, location: @video }\n else\n format.html { render action: 'new' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @video = Video.new\n @scene = Scene.find(params[:scene_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end", "def new\n @video = Video.new\n respond_with(@video)\n end", "def new\n @video = Video.new\n @video.duration = 60\n @video.width = 1280\n @video.height = 720\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end", "def new\n @video = Video.new\n end", "def new\n @video = Video.new\n end", "def new\n @video = Video.new\n end", "def new\n @video = Video.new\n end", "def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to root_url, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @tv = Tv.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tv }\n end\n end", "def create\n vid = Video.create(video_params)\n redirect_to \"/videos/#{vid.id}\"\n end", "def create\n @video = Video.new(video_params)\n puts @video\n puts \"**********************************\"\n if @video.save\n flash[:success] = 'Video added!'\n redirect_to '/videos'\n else\n render :new\n end\n end", "def create\n @video = Video.new(nicovideo_id: params[:nicovideo_id])\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { redirect_to videos_path , alert: 'Video was not successfully created.' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @channel = params[:forminfo]\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end", "def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to video_show_path(@video.category, @video), notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: video_show_path(@video.category, @video) }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_videos\n end", "def create\n @video = Video.new(params[:video])\n @licenses = License.all\n @galleries = Gallery.all\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { render action: \"new\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @video = @room.videos.new(video_params)\n respond_to do |format|\n if @video.save\n format.html { redirect_to upload_video_path(@video), notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n token = token_from_link params[:video][:token]\n\n gdata = Youtube.new token\n\n @video = Video.new(params[:video]) do |v|\n v.user = current_user\n v.token = token\n v.name = gdata.title if v.name.blank?\n\n v.yt_title = gdata.title\n v.yt_thumb = gdata.thumb\n v.yt_rating = gdata.rating_100\n v.yt_view_count = gdata.view_count\n v.yt_favorite_count = gdata.favorite_count\n v.yt_published = gdata.published\n end\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { render action: \"new\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @community_member_video = @community_member_profile.videos.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @community_member_video }\n end\n end", "def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Vídeo criado com sucesso' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @resource = Resource.new \n @video = Video.new\n end", "def create\r\n @video = Video.new(params[:video])\r\n\r\n if !@video.image_url and @video.url =~ /youtube/\r\n @video.image_url = \"http://img.youtube.com/vi/\" + @video.url.split(\"/embed/\").last + \"/default.jpg\"\r\n end\r\n\r\n respond_to do |format|\r\n if @video.save\r\n format.html { redirect_to \"/videos?p=\" + @@ADMIN_PASS }\r\n format.json { render json: @video, status: :created, location: @video }\r\n else\r\n format.html { render action: \"new\", :layout => false }\r\n format.json { render json: @video.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def new\n @vet = Vet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vet }\n end\n end", "def new\n @raw_video = RawVideo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @raw_video }\n end\n end", "def new\n @video_game = VideoGame.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video_game }\n end\n end", "def create\n @video = Video.new(video_params)\n\n if @video.save\n flash[:notice] = \"Successfully added new video!\"\n redirect_to videos_path\n else\n flash[:alert] = \"Error adding new video!\"\n render :new\n end\n end", "def new\n @video = Video.new\n p params\n @video.title = params[:title] if params[:title]\n @video.url = params[:url] if params[:url]\n @video.image_url = params[:image_url] if params[:image_url]\n @video.active = params[:active] if params[:active]\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @video }\n end\n end", "def new\n @video_model = VideoModel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @video_model }\n end\n end", "def new\n @video = Video.new\n @video.asset = Asset.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @video }\n end\n end", "def new\n @movie = @category.movies.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @movie }\n end\n end", "def create\n @video = Video.new(video_params.merge({ project_id: @project.id }))\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to action: 'show', controller: 'videos', project_id: @project.id, id: @video.id, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @voc = Voc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @voc }\n end\n end", "def new\n @record_video = RecordVideo.new\n @tuantis= Tuanti.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @record_video }\n end\n end", "def new\n @kuaibovideo = Kuaibovideo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @kuaibovideo }\n end\n end", "def new\n @user_video = current_user.user_videos.new\n @weekly_tunes = WeeklyTune.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_video }\n end\n end", "def create\n @album = Album.find(params[:album_id])\n @video = @album.videos.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @album, notice: 'Video creado satisfactoriamente.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @video = Video.new(video_params.merge(:owner => current_user))\n @original = nil\n if (@video.errors[:video_exists])\n @original = Video.where(:external_id => @video.external_id, :type => @video.type).first\n end\n if @video.save\n render :json => @video, :include => ALL_INCLUDES\n else\n render :json => @video.errors, status: :unprocessable_entity\n end\n end", "def create\n @video = Video.new(params[:video])\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to(@video, :notice => 'Video was successfully created.') }\n format.xml { render :xml => @video, :status => :created, :location => @video }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @video.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @video = Video.new(params[:video])\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to(@video, :notice => 'Video was successfully created.') }\n format.xml { render :xml => @video, :status => :created, :location => @video }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @video.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @video = Video.new(video_params)\n if @video.save\n redirect_to @video, notice: \"Video was successfully created.\"\n else\n render :new\n end\n end", "def new\n @unseen_movie = UnseenMovie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @unseen_movie }\n end\n end", "def create\n # Esta solución no es viable con la versión de Dynamoid 0.7.1\n @video = current_user.videos.create(video_params)\n @video.usuario_id = current_user.id\n respond_to do |format|\n if @video.save\n flash[:success] = \"El video ha sido posteado, pasarán unos segundos para ser publicado\"\n format.html { redirect_to current_user }\n format.json { render action: 'show', status: :created, location: @video }\n else\n puts @video.to_s\n format.html { render action: 'new' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @sequence = Sequence.new(:video => Video.find(params[:video_id]))\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sequence}\n end\n end", "def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to home_admin_path, notice: '视频创建成功!' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @videofile = Videofile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @videofile }\n end\n end", "def create\n @video = Video.new(params[:video])\n\n respond_to do |format|\n if @video.save\n flash[:notice] = 'Video was successfully created.'\n format.html { redirect_to(@video) }\n format.xml { render :xml => @video, :status => :created, :location => @video }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @video.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @videocomment = Videocomment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @videocomment }\n end\n end", "def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n\n if @video.save\n format.html {\n flash[:notice] = \"Vídeo criado!.\"\n redirect_to(:action => 'show', :id => @video.id, :palestrante_id => @palestrante.id)\n }\n format.json { \n render action: 'show', :palestrante_id => @palestrante.id, status: :created, location: @video\n }\n else\n format.html {\n @palestrantes = Palestrante.ordenados\n @agendas = Agenda.recentes\n render action: 'new'\n }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @playlist = Playlist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @playlist }\n end\n end", "def new\n @playlist = Playlist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @playlist }\n end\n end", "def new\n @movie = Movie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @movie }\n end\n end", "def new\n @movie = Movie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @movie }\n end\n end", "def new\n @movie = Movie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @movie }\n end\n end", "def new\n @movie = Movie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @movie }\n end\n end", "def new\n @movie = Movie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @movie }\n end\n end", "def new\n @movie = Movie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @movie }\n end\n end" ]
[ "0.79415655", "0.78886294", "0.7807316", "0.7806146", "0.7806146", "0.7806146", "0.7806146", "0.7806146", "0.7806146", "0.7806146", "0.7806146", "0.7806146", "0.7806146", "0.7559155", "0.74715215", "0.74391437", "0.73455477", "0.73454016", "0.7272672", "0.7262401", "0.72184944", "0.7166856", "0.7151153", "0.714359", "0.71328926", "0.7126652", "0.70982724", "0.70974135", "0.70974135", "0.70974135", "0.70974135", "0.70924157", "0.70409954", "0.7039631", "0.70290774", "0.7015964", "0.7015964", "0.6980946", "0.6980946", "0.6969786", "0.69663906", "0.6963756", "0.6961259", "0.6961259", "0.6961259", "0.6961259", "0.69601274", "0.6940577", "0.69380873", "0.69294494", "0.6920328", "0.69193214", "0.69193214", "0.69193214", "0.69193214", "0.69193214", "0.69169927", "0.69049484", "0.6888449", "0.6888196", "0.68657565", "0.6865674", "0.6865021", "0.6864479", "0.682328", "0.68212926", "0.6814012", "0.68069375", "0.68017274", "0.6793547", "0.67884076", "0.6788251", "0.67594105", "0.6739188", "0.67233235", "0.6715397", "0.6712831", "0.67105", "0.67102647", "0.66946375", "0.6692932", "0.6686086", "0.6686086", "0.66688424", "0.6668435", "0.6666079", "0.6663821", "0.66635215", "0.66562104", "0.665455", "0.6644968", "0.66310006", "0.6625121", "0.6625121", "0.6623522", "0.6623522", "0.6623522", "0.6623522", "0.6623522", "0.6623522" ]
0.7068381
32
POST /c_videos POST /c_videos.json
def create @c_video = CVideo.new(params[:c_video]) respond_to do |format| if @c_video.save format.html { redirect_to @c_video, notice: 'A new video was successfully created.' } format.json { render json: @c_video, status: :created, location: @c_video } else format.html { render action: "new" } format.json { render json: @c_video.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_videos\n end", "def create\n @video = Video.new(video_params)\n @video.save!\n render json: @video\n end", "def create\n @video = @room.videos.new(video_params)\n respond_to do |format|\n if @video.save\n format.html { redirect_to upload_video_path(@video), notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video.as_json }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @video = current_user.videos.new(video_params)\n respond_to do |format|\n if @video.save\n format.html { redirect_to videos_path(), notice: 'Video criado com sucesso.' }\n format.json { render :index, status: :created, location: @video }\n else\n format.html { redirect_to new_video_path(), notice: 'Video não salvo.' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n\n @project = Project.user_readable(current_user, params[:project_id])\n\n if @project\n\n @video = @project.videos.new(params[:project_video])\n\n if @video.save\n respond_to do |format|\n format.json { render :json => {:video_id => @video.id, :aws_videos_path => @video.videos_path}, :status => :ok }\n end\n\n else\n respond_to do |format|\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n\n else\n not_authorized\n end\n\n\n\n end", "def postprocess\n video_params = JSON.parse(params[\"upload_response\"])\n @video = Video.new(:panda_video_id => video_params[\"id\"], :title => \"Title-to-be-edited-later\")\n\n if @video.save\n render :json => {:play_url => url_for(@video), :id => @video_id}\n end\n end", "def create\n @video = Video.new(params[:video])\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { render action: \"new\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @video = Video.new(params[:video])\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { render action: \"new\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @video = Video.new(params[:video])\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { render action: \"new\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @video = Video.new(params[:video])\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { render action: \"new\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @video = Video.new(nicovideo_id: params[:nicovideo_id])\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { redirect_to videos_path , alert: 'Video was not successfully created.' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @video = Video.new(params[:video])\n @video.published = true\n @video.hits = 0\n @video.current_review = 1\n @video.attach_covers\n respond_to do |format|\n if @video.save\n format.html { redirect_to videos_path, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { render action: \"new\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @video = @user.videos.build(video_params)\n respond_to do |format|\n if @video.save\n format.html { redirect_to user_videos_path(@user), notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: user_videos_path(@user) }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @album = Album.find(params[:album_id])\n @video = @album.videos.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @album, notice: 'Video creado satisfactoriamente.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # This comment part specifies how to perform server side uploading\n # http://cloudinary.com/documentation/rails_video_upload#rails_video_upload_examples\n # http://cloudinary.com/documentation/upload_videos\n # http://cloudinary.com/documentation/video_management\n # http://cloudinary.com/documentation/rails_video_manipulation\n \n # video_public_id = \"video_#{SecureRandom.urlsafe_base64}\"\n # response = Cloudinary::Uploader.upload(params[:video][:target_file], :resource_type => :video, :public_id => video_public_id)\n # Cloudinary::Uploader.upload_large(params[:video][:target_file], :resource_type => :video, :public_id => \"my_folder/my_sub_folder/myvideo1\", :eager => [{:width => 300, :height => 300, :crop => :pad}], :eager_async => true, :eager_notification_url => \"http://c45a1454.ngrok.io/videos/transform_notification\")\n begin\n @active_page = \"videos\"\n if params[:id].blank?\n @video = Video.new(video_params)\n else\n @video = Video.find(params[:id])\n @video.update_attributes(video_params)\n end\n @video.save\n rescue Exception => e\n log_error(e, \"Error occured in Create action of VideosController\")\n flash_error(t('videos.create_page_error'))\n ensure\n redirect_to \"/videos\"\n end\n end", "def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to root_url, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @file = vid_params['file'].tempfile\n type = vid_params['file'].content_type\n client = YouTubeIt::Client.new(:username => ENV['GMAIL'], :password => ENV['GMAIL_PASSWORD'], :dev_key => ENV[\"YOUTUBE_API_KEY\"])\n res = client.video_upload(@file, title: vid_params['title'], description: vid_params['description'], category: 'People', :keywords => ['darity', 'dare', 'charity'])\n @video = Video.new(url: res.player_url, uid: res.player_url.gsub(/&.*/, \"\").gsub(/.*=/, \"\"), description: vid_params[\"description\"], title: vid_params['title'], dare_id: params[:dare_id])\n if @video.save\n redirect_to current_user\n else\n render html: \"Error\"\n end\n end", "def create\n token = token_from_link params[:video][:token]\n\n gdata = Youtube.new token\n\n @video = Video.new(params[:video]) do |v|\n v.user = current_user\n v.token = token\n v.name = gdata.title if v.name.blank?\n\n v.yt_title = gdata.title\n v.yt_thumb = gdata.thumb\n v.yt_rating = gdata.rating_100\n v.yt_view_count = gdata.view_count\n v.yt_favorite_count = gdata.favorite_count\n v.yt_published = gdata.published\n end\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { render action: \"new\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render action: 'show', status: :created, location: @video }\n else\n format.html { render action: 'new' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render action: 'show', status: :created, location: @video }\n else\n format.html { render action: 'new' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @video = Video.new(params[:video])\n @licenses = License.all\n @galleries = Gallery.all\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { render action: \"new\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # Esta solución no es viable con la versión de Dynamoid 0.7.1\n @video = current_user.videos.create(video_params)\n @video.usuario_id = current_user.id\n respond_to do |format|\n if @video.save\n flash[:success] = \"El video ha sido posteado, pasarán unos segundos para ser publicado\"\n format.html { redirect_to current_user }\n format.json { render action: 'show', status: :created, location: @video }\n else\n puts @video.to_s\n format.html { render action: 'new' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @video = Video.new(video_params)\n @video.update(user_id: current_user.id)\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully uploaded.' }\n format.json {\n render json: { files: [@video.to_jq_upload], url: video_path(@video), message: \"Uploaded successfully.\" }, status: :created, location: @video\n }\n else\n format.html { render :new }\n end\n end\n end", "def create\n @video = Video.new(video_params)\n @video.uuid = params[:videohelpsubmission][:video_uuid]\n @video.token = SecureRandom.hex\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @video_upload = VideoUpload.new\n @video_upload.save!\n @video_upload.prepare!\n\n render json: @video_upload, status: :created, location: @video_upload\n end", "def video_params\n params.require(:video).permit(:url, :client_id)\n end", "def video_params\n params.require(:video).permit(:urlID, :order, :description, :title, :curriculum_id)\n end", "def video_params\n params.require(:video).permit(:name, :description, :content, :link, :visit, :active, :section_id, :tag_list, :posted_at)\n end", "def create \n @video = Video.new() #get the attachemnt and create a video object with it\n\n if @video.save #if it saves then get the urll\n @video.create_url(params[:filepath]) \n\n if signed_in? #if the user is signed in add the video to their account\n current_user.videos << @video \n\n else #if they arent't uses sessions and a delete key\n @video.session_id = SecureRandom.urlsafe_base64(15) \n @video.delete_key = SecureRandom.urlsafe_base64(30) \n session[:owned_videos] ||= [] #if the current session doesn't have any owned_videos then create the array\n session[:owned_videos] << @video.session_id #add videos session id to array\n end\n\n @video.save \n send_to_heywatch @video\n render json: {url: \"/videos/#{@video.id}\"}\n else #error saving the video take them back to try again TODO show errors\n redirect_to \"/\"\n \n end\n end", "def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Vídeo criado com sucesso' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\tif user_type != 'guest' and user_type != 'bunned' and user_type != 'new_user'\n\t\tparams[:video][:user_id] = current_user.id\n\t\t@video = Video.new(params[:video])\n\t\trespond_to do |format|\n\t\t if @video.save\n\t\t\tformat.html { redirect_to @video, :notice => 'Видео успешно добавлено' }\n\t\t\tformat.json { render :json => @video, :status => :created, :location => @video }\n\t\t else\n\t\t\tformat.html { render :action => \"new\" }\n\t\t\tformat.json { render :json => @video.errors, :status => :unprocessable_entity }\n\t\t end\n\t\tend\n\telse\n\t\tredirect_to '/404'\n\tend\n end", "def create\n #@videos = Video.where(:curriculum_id => params[:curriculum_id]))\n @video = Video.new(video_params)\n @video.curriculum_id = params[:curriculum_id]\n @curric = Curriculum.find(params[:curriculum_id])\n respond_to do |format|\n if @video.save\n format.html { redirect_to @curric, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n format.js\n\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n \n end", "def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to home_admin_path, notice: '视频创建成功!' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if current_user.permission.can_post_video?\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n else\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'You can not post videos.' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @video = Video.new(video_params)\n puts @video\n puts \"**********************************\"\n if @video.save\n flash[:success] = 'Video added!'\n redirect_to '/videos'\n else\n render :new\n end\n end", "def video_params\n params.require(:video).permit(:name, :rating, :category, :subcategory, :language, :tags, :description, :uid, :status, :duration, :url_name, :tumbnail, :video)\n end", "def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n @publication = Publication.create(:content => @video.content + @video.name + @video.description + @video.tag_list.join(' '), :published_id => @video.id, :published_type => 'Video')\n format.html { redirect_to videos_path, notice: 'El video fue creada correctamente.' }\n format.json { render action: 'list', status: :created, location: @video }\n else\n format.html { render action: 'new' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create \n # binding.pry\n\n video = Video.new(video_params)\n if video.save\n render json: video, status: :created, location: @video\n else\n render json: {error: \"error This did not save my bro!\"}\n console.log(\"error This did not save my bro!\")\n end\n #render json: videos.to_json(:include => :rapper)\n\n end", "def create\n #p params[:video]\n @video = Video.create params[:video]\n \n respond_to do |format|\n if @video.save\n cookies[:last_video_id] = @video.id \n #Delayed::Job.enqueue(FileUploadJob.new(@video.id, @video.path), -3, 3.days.from_now)\n\n format.html { redirect_to catnum_path(@video.catnum), notice: 'Video was successfully created.' }\n format.json { render json: catnum_path(@video.catnum), status: :created, location: @video }\n else\n format.html { render action: \"new\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n vid = Video.create(video_params)\n redirect_to \"/videos/#{vid.id}\"\n end", "def upload_video(new_attributes={})\n BlipTV::ApiSpec.check_attributes('videos.upload', new_attributes)\n\n new_attributes = {\n :post => \"1\",\n :item_type => \"file\",\n :skin => \"xmlhttprequest\",\n :file_role => \"Web\"\n }.merge(new_attributes) # blip.tv requires the \"post\" param to be set to 1\n\n request = BlipTV::Request.new(:post, 'videos.upload')\n request.run do |p|\n for param, value in new_attributes\n p.send(\"#{param}=\", value)\n end\n end\n\n BlipTV::Video.new(request.response['post_url'].to_s)\n end", "def create\n @user_video = current_user.user_videos.new(params[:user_video])\n\n respond_to do |format|\n if @user_video.save\n format.html { redirect_to @user_video, notice: 'Video was successfully created.' }\n format.json { render json: @user_video, status: :created, location: @user_video }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @saved_video = SavedVideo.new(saved_video_params)\n\n respond_to do |format|\n if @saved_video.save\n format.html { redirect_to @saved_video, notice: 'Saved video was successfully created.' }\n format.json { render :show, status: :created, location: @saved_video }\n else\n format.html { render :new }\n format.json { render json: @saved_video.errors, status: :unprocessable_entity }\n end\n end\n end", "def video_params\n params.require(:video).permit(:title, :url, :description)\n end", "def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to video_show_path(@video.category, @video), notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: video_show_path(@video.category, @video) }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def video_params\n params.require(:video).permit(:title, :content)\n end", "def video_params\n params.require(:video).permit(:user_id, :id_code, :provider, :title, :duration, :description, :thumbnail, :embed_url, :embed_code, :tags, :category1, :category2, :plays)\n end", "def videos_params\n params.require(:video).permit(:title, :author, :year, :duration, :video_url, :image_url, :is_winner, :is_entrant, :is_other, :id_for_app)\n end", "def video_params\n params.require(:video).permit(:title, :video)\n end", "def video_params\n params.require(:video).permit(:title, :link, :published_at, \n :likes, :dislikes, :uid, :description, :view_count)\n end", "def create\n @video = Video.new(video_params.merge(:owner => current_user))\n @original = nil\n if (@video.errors[:video_exists])\n @original = Video.where(:external_id => @video.external_id, :type => @video.type).first\n end\n if @video.save\n render :json => @video, :include => ALL_INCLUDES\n else\n render :json => @video.errors, status: :unprocessable_entity\n end\n end", "def create\n @video = Video.new(video_params)\n @video.relateds.build\n @video.resources.build\n # obtain video metadata using the Wistia API\n Rails.logger.info(\"obtaining metadata from Wistia API for #{@video.wistia}\")\n media = Wistia::Media.find(@video.wistia)\n @video.title = media.name\n @video.description = ActionController::Base.helpers.strip_tags(media.description)\n @video.duration = (media.duration.to_i / 60) % 60\n @video.thumbnail_url = media.thumbnail.url\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to videos_path, notice: 'Created video listing.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_videos_to_album album_id, videos\n body = {}\n body['videos'] = videos if videos.is_a? String\n body['videos'] = videos.join(',') if videos.is_a? Array\n put(\"/albums/#{album_id}/videos\", body:body, code: 201)\n end", "def create\n @admin_video = Admin::Video.new(admin_video_params)\n authorize! :create, @admin_video\n\n respond_to do |format|\n if @admin_video.save\n format.html { redirect_to @admin_video, notice: 'Video was successfully created.' }\n format.json { render action: 'show', status: :created, location: @admin_video }\n else\n format.html { render action: 'new' }\n format.json { render json: @admin_video.errors, status: :unprocessable_entity }\n end\n end\n end", "def video_params\n params.require(:video).permit :title, :description, :camera_id, :data\n end", "def create\n @video = @project.videos.build(params[:video])\n\n respond_to do |format|\n if @video.save\n if current_subdomain_user.facebook_user? && @video.facebook_upload\n ItemWorker.asynch_upload_video_to_facebook(:video_id => @video.id, :fb_session => facebook_session)\n end\n flash[:notice] = 'Video is being processed.'\n format.html { redirect_to(project_item_path(@project, @video, :subdomain => @user.subdomain)) }\n format.xml { render :xml => @video, :status => :created, :location => project_video_path(project, @video) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @video.errors, :status => :unprocessable_entity }\n end\n end\n end", "def video_params\n params.require(:video).permit(:titulo, :palestrante_id, :agenda_id, :descricao, :source, :youtube, :published, :tags, :podcast_stream_url, :podcast_duration)\n end", "def video_params\n params.require(:video).permit(:url, :item_id)\n end", "def video_params\n params.require(:video).permit(:url, :item_id)\n end", "def video_params\n params.require(:video).permit(:title, :description, :yt_video_id, :is_complete)\n end", "def video_params\n params.require(:video).permit(:video, :title, :subtitle, :description, :is_published, :is_showed_on_tv, :showed_date)\n end", "def video_params\n params.require(:video).permit(:name, :description, :code)\n\n end", "def create\n @channel = params[:forminfo]\n @video = Video.new(params[:video])\n video_file = params[:video_file]\n img_file = params[:img_file]\n @video.video_type = params[:video_type]\n @video.video_id = Utils.videoid\n\n if video_file != nil\n @video.video_url = \"http://#{Constants::UPLOAD_IP}/files/videos/\"+Utils.upload(video_file, videoid)\n end\n\n if img_file != nil\n @video.video_img =\"http://#{Constants::UPLOAD_IP}/files/images/\"+Utils.upload(img_file, nil)\n end\n @video.cid = @channel\n respond_to do |format|\n if @video.save\n format.html { redirect_to channel_videos_path }\n else\n format.html { render action: \"new\" }\n end\n end\n end", "def video_params\n params.require(:video).permit(:title, :file, :video_category_id)\n end", "def video_params\n params.require(:video).permit(:title, :url)\n end", "def create\n # @video = Video.new(params[:video])\n \n # @video = current_user.videos.new(params[:video])\n \n @video = Video.new\n @video.user_id = current_user.id\n @video.archive_id = params[:video][:archive_id]\n @video.question_id = params[:video][:question_id]\n \n current_user.videos << @video\n\n respond_to do |format|\n if @video.save\n # format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n # format.html 3{ render action: \"new\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def video_params\n params.require(:video).permit(:title, :video)\n end", "def create\n @video = Video.new(video_params)\n\n if @video.save\n flash[:notice] = \"Successfully added new video!\"\n redirect_to videos_path\n else\n flash[:alert] = \"Error adding new video!\"\n render :new\n end\n end", "def index\n #@videos = Video.all\n Video.delete_database_and_files_on_server\n @video = Video.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end", "def videos options={}\n response = client.get(\"/#{id}/videos\", options)\n end", "def videolist_params\n params.require(:videolist).permit(:videoid, :videoURL, :flag, :title, :category, :author, :description, :uptime, :tag)\n end", "def create\n @video = Video.new(video_params.merge({ project_id: @project.id }))\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to action: 'show', controller: 'videos', project_id: @project.id, id: @video.id, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @medio_video = MedioVideo.new(medio_video_params)\n\n respond_to do |format|\n if @medio_video.save\n format.html { redirect_to @medio_video, notice: 'Medio video was successfully created.' }\n format.json { render :show, status: :created, location: @medio_video }\n else\n format.html { render :new }\n format.json { render json: @medio_video.errors, status: :unprocessable_entity }\n end\n end\n end", "def video_params\n params.require(:video).permit(\n :title,\n :description,\n :video,\n :slide,\n :image,\n :category_id,\n :tag_list,\n :published,\n :date_of_video,\n :short_description,\n :featured\n )\n end", "def create\n Video.transaction do\n @video = Video.new video_params\n # @video.data = { data: params[:video][:data] }\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end\n # byebug\n\n end", "def new\n \n @video = Video.new\n \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end", "def createVideoInfo\n if (request.post?)\n cOwnerSocialID = self.findKeyInJSON(params[:params], \"OwnerSocialID\", 2)\n cOwnerSocialType = self.findKeyInJSON(params[:params], \"OwnerSocialType\", 2)\n cVideoID = self.findKeyInJSON(params[:params], \"VideoID\", 2)\n cWordID = self.findKeyInJSON(params[:params], \"WordID\", 2)\n cWordPackageID = self.findKeyInJSON(params[:params], \"WordPackageID\", 2)\n cVideoInfoID = self.createMD5Key(\"videoinfo\", cVideoID)\n \n # create Video Info\n Videoinfo.createVideoInformation(cVideoInfoID, cOwnerSocialID, cOwnerSocialType, cVideoID, cWordID, cWordPackageID)\n \n # Return JSON response\n cRequestID = self.findKeyInJSON(params[:params], \"RequestID\", 1)\n rData = {\"Status\" => \"True\", \"VideoInfoID\" => cVideoInfoID}\n self.jsonRender(rData, 'Video Info Created', cRequestID, '100')\n end \n end", "def create\n\n @video = Video.new(video_params)\n file = @video.video.tempfile\n\n video = Panda::Video.create(:file => file)\n # binding.pry\n video.encodings['h264'].reload\n\n until video.encodings['h264'].status == 'success'\n video.encodings['h264'].reload\n end\n\n video.encodings['h264'].encoding_progress\n @video.video = video.encodings['h264'].url\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @video = Video.new(params[:video])\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to(@video, :notice => 'Video was successfully created.') }\n format.xml { render :xml => @video, :status => :created, :location => @video }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @video.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @video = Video.new(params[:video])\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to(@video, :notice => 'Video was successfully created.') }\n format.xml { render :xml => @video, :status => :created, :location => @video }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @video.errors, :status => :unprocessable_entity }\n end\n end\n end", "def video_params\n params.require(:video).permit()\n end", "def video_params\n params.require(:video).permit()\n end", "def video_params\n\t params.require(:video).permit(:title, :link, :img, :category, :site, :tag_list)\n\tend", "def video_params\n params.require(:video).permit(:user_id, :uuid, :videohelpsubmission => [])\n end", "def video_params\n params.require(:video).permit(:title, :description, :length, :video_filename, :video_type)\n end", "def load_videos2\n json = File.read(VIDEOS2_FILE)\n array = JSON.parse(json)\n array[\"videos\"].map! { |v| {\"postId\" => v[\"postId\"], \"wordList\" => v[\"wordList\"]}}\n array[\"videos\"]\n end", "def create\n @sales_video = Sales::Video.new(sales_video_params)\n\n respond_to do |format|\n if @sales_video.save\n format.html { redirect_to sales_seller_course_video_path(@seller, @course, @sales_video), notice: \"Video foi criado com sucesso.\" }\n format.json { render :show, status: :created, location: @sales_video }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @sales_video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @video = Video.new(params[:video])\n @scene = Scene.find(params[:video][:scene_id])\n\n @video.scene = @scene\n @video.user = current_user\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { render action: \"new\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @video = Video.new(video_params)\n @video.added_by=current_user.id\n respond_to do |format|\n if @video.save\n @video.add_labels(params[:Label])\n format.html { redirect_to media_videos_path}\n format.json { render :show, status: :created, location: [:media, @video] }\n format.js {}\n else\n format.html { render :new }\n format.json { render json: [:media, @video.errors], status: :unprocessable_entity }\n end\n end\n end", "def create\n params[:video][:fecha] = DateTime.strptime(params[:video][:fecha], \"%Y-%m-%d %H:%M:%S UTC\")\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n\t\t\t@v_id = Video.maximum(:id)\n params[:parts].each do |part|\n\t\t\t\tpart[:id_video] = @v_id\n @p = Participante.new(participante_params(part))\n if !@p.save\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n format.html { redirect_to @video, notice: 'El video se ha registrado con éxito en el catálogo.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def video_params\n params[:video]\n end", "def video_params\n params[:video]\n end", "def video_params\n params[:video]\n end", "def create\n @table_video = TableVideo.new(table_video_params)\n\n respond_to do |format|\n if @table_video.save\n format.html { redirect_to @table_video, notice: 'Table video was successfully created.' }\n format.json { render :show, status: :created, location: @table_video }\n else\n format.html { render :new }\n format.json { render json: @table_video.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.74225676", "0.7299783", "0.71033835", "0.69534236", "0.68433285", "0.68431693", "0.68373305", "0.68243843", "0.68243843", "0.68243843", "0.68243843", "0.6784164", "0.67830396", "0.6768634", "0.6768634", "0.6768634", "0.6768634", "0.6768634", "0.6768459", "0.6753449", "0.67524385", "0.6750303", "0.67102444", "0.6707893", "0.6702637", "0.6702637", "0.66935647", "0.66924983", "0.66761297", "0.6670889", "0.66584927", "0.6638973", "0.66308737", "0.6624526", "0.6618968", "0.6603836", "0.6582702", "0.6579792", "0.6578513", "0.6570402", "0.65617704", "0.6559904", "0.6553921", "0.65455097", "0.65454924", "0.6540935", "0.6518701", "0.6513766", "0.6504397", "0.65006846", "0.6496684", "0.64936787", "0.6484895", "0.6473878", "0.6456124", "0.6453929", "0.64434844", "0.64416754", "0.64409727", "0.6439758", "0.6439036", "0.64376277", "0.6432917", "0.6427595", "0.6427595", "0.6426219", "0.64257187", "0.642397", "0.6416376", "0.64101934", "0.639977", "0.639825", "0.6397502", "0.63967425", "0.6386577", "0.6383277", "0.6380387", "0.63752925", "0.6365504", "0.63413024", "0.63410634", "0.6324861", "0.6320763", "0.6319823", "0.6318213", "0.6318213", "0.6313558", "0.6313558", "0.6311634", "0.63103", "0.6309618", "0.6308109", "0.63035816", "0.62976366", "0.62939364", "0.6291499", "0.62906605", "0.62906605", "0.62906605", "0.62896824" ]
0.7073725
3
PUT /c_videos/1 PUT /c_videos/1.json
def update @c_video = CVideo.find(params[:id]) respond_to do |format| if @c_video.update_attributes(params[:c_video]) format.html { redirect_to @c_video, notice: 'The video was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @c_video.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @video.update(video_params)\n render json: @video\n end", "def update\n\n\n @project = Project.user_readable(current_user, params[:project_id])\n\n if @project\n\n @video = @project.videos.find(params[:id])\n\n if @video.update(params[:project_video])\n respond_to do |format|\n format.json { render :json => {:video_id => @video.id,\n :aws_videos_path => @video.videos_path}, :status => :ok }\n end\n\n else\n respond_to do |format|\n format.json { render json: @video.errors, status: :unprocessable_entity }\n #format.html { render action: \"edit\" }\n end\n end\n\n\n else\n not_authorized\n end\n\n\n\n\n\n end", "def update\n @video = Video.find(params[:id])\n\n respond_to do |format|\n if @video.update_attributes params[:video]\n format.html { redirect_to catnum_path(@video.catnum), notice: 'updated!' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @video = Video.find(params[:id])\n\n respond_to do |format|\n if @video.update_attributes(params[:video])\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @video = Video.find(params[:id])\n\n respond_to do |format|\n if @video.update_attributes(params[:video])\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit_video(video_id, title, description, method = HTTP_PUT)\n request_xml = %{\n <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <vzaar-api>\n }\n request_xml += %{<_method>put</_method>} if method != HTTP_PUT\n request_xml += %{\n <video>\n <title>#{title}</title>\n <description>#{description}</description >\n </video>\n </vzaar-api>\n }\n auth_connection HTTP_PUT, \"/api/videos/#{video_id}.xml\", request_xml\n end", "def update\n @video = Video.find(params[:id])\n @video.update_attributes\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { redirect_to videos_path , alert: 'Video was not successfully updated.' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n Video.find(params[:id]).update(video_params)\n redirect_to \"/videos/#{params[:id]}\"\n end", "def update\n # @video = Video.find(params[:id])\n @video = current_user.videos.find(params[:id])\n\n respond_to do |format|\n if @video.update_attributes(params[:video])\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @video = Video.find(params[:id])\n\n respond_to do |format|\n if @video.update_attributes(params[:video])\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @video = Video.find(params[:id])\n\n respond_to do |format|\n if @video.update_attributes(params[:video])\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @video = Video.find(params[:id])\n\n respond_to do |format|\n if @video.update_attributes(params[:video])\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @video = Video.find(params[:id])\n\n respond_to do |format|\n if @video.update_attributes(params[:video])\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @video = Video.find(params[:id])\n\n respond_to do |format|\n if @video.update_attributes(params[:video])\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @video = Video.find(params[:id])\n\n respond_to do |format|\n if @video.update_attributes(params[:video])\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @video = Video.find(params[:id])\n\n respond_to do |format|\n if @video.update_attributes(params[:video])\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json {\n render json: { files: [@video.to_jq_upload], url: video_path(@video), message: \"Uploaded successfully.\" }, status: :created, location: @video\n }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n @video = Video.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @video.update_attributes(params[:video])\r\n format.html { redirect_to \"/videos?p=\" + @@ADMIN_PASS }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @video.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { render :show, status: :ok, location: @video }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { render :show, status: :ok, location: @video }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { render :show, status: :ok, location: @video }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { render :show, status: :ok, location: @video }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { render :show, status: :ok, location: @video }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { render :show, status: :ok, location: @video }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { render :show, status: :ok, location: @video }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { render :show, status: :ok, location: @video }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { render :show, status: :ok, location: @video }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { render :show, status: :ok, location: @video }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { render :show, status: :ok, location: @video }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { render :show, status: :ok, location: @video }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { render :show, status: :ok, location: @video }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { render :show, status: :ok, location: @video }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @video = Video.find(params[:id])\n\n @video.actors = (params[:video].delete(:actors) || '').split(', ').collect { |name| name.strip!; Actor.find_or_create_by_name(:name => name) }\n @video.genres = (params[:video].delete(:genres) || '').split(', ').collect { |name| name.strip!; Genre.find_or_create_by_name(:name => name) }\n @video.directors = (params[:video].delete(:directors) || '').split(', ').collect { |name| name.strip!; Director.find_or_create_by_name(:name => name) }\n @video.update_attributes(params[:video])\n @video.save\n\n respond_to do |format|\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { head :no_content }\n end\n end", "def update\n @video = @user.videos.find(params[:id])\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to user_videos_path(@user), notice: 'Video was successfully updated.' }\n format.json { render :show, status: :ok, location: @video }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @video = @project.videos.find(params[:id])\n\n respond_to do |format|\n if @video.update_attributes(params[:video])\n flash[:notice] = 'Video was successfully updated.'\n format.html { redirect_to(project_item_path(@project, @video, :subdomain => @user.subdomain)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @video.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @video = Video.find(params[:id])\n params[:video][:token] = token_from_link params[:video][:token]\n\n respond_to do |format|\n if @video.update_attributes(params[:video])\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @video = Video.find(params[:id])\n @licenses = License.all\n @galleries = Gallery.all\n\n respond_to do |format|\n if @video.update_attributes(params[:video])\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video.competition, notice: 'Video modificado correctamente..' }\n format.json { render :show, status: :ok, location: @video }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |wants|\n wants.json {\n result = {}\n video = Video.find_by_tag_id(params[:tid])\n if video\n if video.update_attributes(params[:video])\n result[:result] = \"ok\"\n render :json => result.to_json\n return\n else\n result[:result] = video.errors_full_messages\n end\n else\n result[:result] = \"不存在该视频\"\n end\n render :json => result.to_json, :status => 400\n }\n end\n end", "def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to video_show_path(@video.category, @video), notice: 'Video was successfully updated.' }\n format.json { render :show, status: :ok, location: video_show_path(@video.category, @video) }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @video.update({:owner => current_user}.merge(video_params))\n render json: @video, :include => ALL_INCLUDES\n else\n render json: @video.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to home_admin_path, notice: '视频更新成功!' }\n format.json { render :show, status: :ok, location: @video }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to videos_path(), notice: 'Video atualizado com sucesso.' }\n format.json { render :index, status: :ok, location: @video }\n else\n format.html { redirect_to edit_video_path(@video), alert: 'Video não atualizado' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @video.update(video_params)\n @publication = Publication.find_by_published_id_and_published_type(@video.id, 'Video')\n @publication.update(:content => @video.content + @video.name + @video.description + @video.tag_list.join(' '))\n format.html { redirect_to videos_path, notice: 'El video fue actualizado correctamente.' }\n format.json { head :no_content }\n else\n format.html { render action: 'list' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @video = Video.find(params[:id])\n\n respond_to do |format|\n if @video.update_attributes(params[:video])\n format.html { redirect_to(@video, :notice => 'Video was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @video.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @video = Video.find(params[:id])\n\n respond_to do |format|\n if @video.update_attributes(params[:video])\n format.html { redirect_to(@video, :notice => 'Video was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @video.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @video = Video.find(params[:id])\n\n respond_to do |format|\n if @video.update_attributes(params[:video])\n flash[:notice] = 'Video was successfully updated.'\n format.html { redirect_to(@video) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @video.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @video = Video.find(params[:id])\n video_file = params[:video_file]\n img_file = params[:img_file]\n\n if video_file != nil\n videoid = Utils.videoid\n @video.video_url = \"http://#{Constants::UPLOAD_IP}/files/videos/\"+Utils.upload(video_file, videoid)\n end\n\n if img_file != nil\n @video.video_img =\"http://#{Constants::UPLOAD_IP}/files/images/\"+Utils.upload(img_file, nil)\n end\n\n respond_to do |format|\n if @video.update_attributes(params[:video])\n format.html { redirect_to channel_videos_path }\n else\n format.html { render action: \"new\" }\n end\n end\n end", "def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Vídeo atualizada com sucesso' }\n format.json { render :show, status: :ok, location: @video }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @video.update(video_params.merge({ project_id: @project.id }))\n format.html { redirect_to action: 'show', controller: 'videos', project_id: @project.id, id: @video.id, notice: 'Video was successfully updated.' }\n format.json { render :show, status: :ok, location: @video }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_video\n @video = Video.find(params[:id])\n\n end", "def update\r\n @video = Video.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @video.update_attributes(params[:video])\r\n format.html { redirect_to(@video, :notice => 'Video 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 => @video.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @video = Video.find_by_hash_permalink_id(params[:id])\n\n respond_to do |format|\n if @video.update_attributes(params[:video])\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @jeux_video.update(jeux_video_params)\n @jeux_video.create_activity :update, owner: current_user, read: false\n format.html { redirect_to @jeux_video, notice: 'Jeux video was successfully updated.' }\n format.json { render :show, status: :ok, location: @jeux_video }\n else\n format.html { render :edit }\n format.json { render json: @jeux_video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @video = Video.find(params[:id])\n respond_to do |format|\n if @video.update_attributes(params[:video]) and @video.attach_covers\n format.html { redirect_to videos_path, notice: 'Video was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @saved_video.update(saved_video_params)\n format.html { redirect_to @saved_video, notice: 'Saved video was successfully updated.' }\n format.json { render :show, status: :ok, location: @saved_video }\n else\n format.html { render :edit }\n format.json { render json: @saved_video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :update, @admin_video\n\n respond_to do |format|\n if @admin_video.update(admin_video_params)\n format.html { redirect_to @admin_video, notice: 'Video was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @admin_video.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_video\n \n @video = Video.find(params[:id])\n \n end", "def set_video\n @video = Video.find(params[:id])\n end", "def set_video\n @video = Video.find(params[:id])\n end", "def set_video\n @video = Video.find(params[:id])\n end", "def create_videos\n end", "def update\n @user_video = UserVideo.find(params[:id])\n\n respond_to do |format|\n if @user_video.update_attributes(params[:user_video])\n format.html { redirect_to @user_video, notice: 'Video was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t\trespond_to do |format|\n\t\t\tif @youtube_video.update(youtube_video_params)\n\t\t\t\tformat.html { redirect_to youtube_videos_path, notice: 'Youtube video was successfully updated.' }\n\t\t\t\tresponse = { status: 200 }\n\t\t\t\tformat.json { render json: response, status: response[:status] }\n\t\t\telse\n\t\t\t\t@youtube_video_annotations = @youtube_video.youtube_video_annotations.sort\n\t\t\t\t@youtube_video_cards = @youtube_video.youtube_video_cards.sort\n\t\t\t\tformat.html { render action: 'edit' }\n\t\t\t\tformat.json { render json: @youtube_video.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def destroy\n @c_video = CVideo.find(params[:id])\n @c_video.destroy\n\n respond_to do |format|\n format.html { redirect_to c_videos_url }\n format.json { head :no_content }\n end\n end", "def edit\n authorize! :update, @videos\n @videos = Video.find_by(id: params[:id])\n end", "def update\n\n\n @video = Video.find(params[:id])\n\n\n @url = params[:video][:url]\n\n require 'uri'\n\n\n if(@url.downcase.include? 'youtube.com')\n ##create ways to catch if user is using \n query_string = URI.parse(params[:video][:url]).query\n parameters = Hash[URI.decode_www_form(query_string)]\n puts parameters['v'] # => aNdMiIAlK0g\n video_id = parameters['v']\n elsif (@url.downcase.include? 'y2u.be')\n puts video_id = @url.match(/\\.be\\/(.+)$/)[1]\n @url = 'http://www.youtube.com/watch?v='+video_id\n puts params[:video][:url] = @url \n elsif (@url.downcase.include? 'youtu.be')\n puts video_id = @url.match(/\\.be\\/(.+)$/)[1]\n @url = 'http://www.youtube.com/watch?v='+video_id\n puts params[:video][:url] = @url\n end\n \n \n\n @yt_client = YouTubeIt::Client.new(:dev_key => \"AI39si6hkRNCL77mzzv1LycIohZtksVIi0L5S9lQMx6crqOfGdyKcB2U2M5WHeNBUT2VLgTVzjR9rxPa1RJZw-sZ6wqtnaZ7AA\")\n @video.youtube_id = video_id # => aNdMiIAlK0g\n\n this_video = @yt_client.video_by(video_id)\n\n\n @video.duration = this_video.duration \n\n\n\n\n\n respond_to do |format|\n if @video.update_attributes(params[:video])\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to board_video_path(@board, @video), notice: 'Video was successfully updated.' }\n format.json { render :show, status: :ok, location: @video }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n\n @project = Project.user_readable(current_user, params[:project_id])\n\n if @project\n\n @video = @project.videos.find(params[:id])\n @aws_signature_url = root_url + \"signatures/aws_uploads\"\n respond_to do |format|\n format.html\n format.json { render :json => {:video_id => @video.id, :aws_videos_path => @video.videos_path}, :status => :ok }\n end\n\n else\n not_authorized\n end\n\n\n\n end", "def update\n @video = Video.find(params[:id])\n\tif @video.user == current_user or user_type == 'admin' or user_type == 'super_admin' \n\t\trespond_to do |format|\n\t\t if @video.update_attributes(params[:video])\n\t\t\tformat.html { redirect_to @video, :notice => 'Видео успешно обновлено' }\n\t\t\tformat.json { head :no_content }\n\t\t else\n\t\t\tformat.html { render :action => \"edit\" }\n\t\t\tformat.json { render :json => @video.errors, :status => :unprocessable_entity }\n\t\t end\n\t\tend\n\telse\n\t\tredirect_to '/404'\n\tend\n end", "def update\n respond_to do |format|\n if @table_video.update(table_video_params)\n format.html { redirect_to @table_video, notice: 'Table video was successfully updated.' }\n format.json { render :show, status: :ok, location: @table_video }\n else\n format.html { render :edit }\n format.json { render json: @table_video.errors, status: :unprocessable_entity }\n end\n end\n end", "def put_video(*video_args, &block)\n args = parse_media_args(video_args, \"videos\")\n args.last[:video] = true\n put_connections(*args, &block)\n end", "def update\n @video = self.current_user.videos.find(params[:id])\n respond_to do |format|\n if @video.update_attributes(params[:video])\n if params[:video][:upload_ticket]\n # data is coming from asynchronous swf upload form page\n unless @video.asset\n @asset = @video.attach_uploaded_asset!(Videoasset) \n else\n @asset = @video.asset\n end\n if @asset\n format.html { render :partial => \"videos/video_info_form\", :locals => {:all_done => true}}\n else\n format.html { render :partial => \"videos/waiting_for_upload\"}\n end\n else\n # all-in-one upload page\n flash[:notice] = 'Video was successfully updated.'\n format.html { redirect_to(@video) }\n format.xml { head :ok }\n end\n else\n if params[:video][:upload_ticket]\n # data is coming from asynchronous swf upload form page\n format.html { render :partial => \"videos/video_info_form\"} \n else\n # all-in-one upload page\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @video.errors, :status => :unprocessable_entity }\n end\n end\n end\n end", "def set_video\n @video = Video.find(params[:id])\n end", "def set_video\n @video = Video.find(params[:id])\n end", "def set_video\n @video = Video.find(params[:id])\n end", "def set_video\n @video = Video.find(params[:id])\n end", "def set_video\n @video = Video.find(params[:id])\n end", "def set_video\n @video = Video.find(params[:id])\n end", "def set_video\n @video = Video.find(params[:id])\n end", "def set_video\n @video = Video.find(params[:id])\n end", "def set_video\n @video = Video.find(params[:id])\n end", "def set_video\n @video = Video.find(params[:id])\n end", "def set_video\n @video = Video.find(params[:id])\n end", "def set_video\n @video = Video.find(params[:id])\n end", "def set_video\n @video = Video.find(params[:id])\n end", "def set_video\n @video = Video.find(params[:id])\n end", "def set_video\n @video = Video.find(params[:id])\n end", "def set_video\n @video = Video.find(params[:id])\n end", "def set_video\n @video = Video.find(params[:id])\n end", "def set_video\n @video = Video.find(params[:id])\n end", "def set_video\n @video = Video.find(params[:id])\n end", "def set_video\n @video = Video.find(params[:id])\n end", "def set_video\n @video = Video.find(params[:id])\n end", "def set_video\n @video = Video.find(params[:id])\n end" ]
[ "0.72357523", "0.7062015", "0.6819968", "0.6756704", "0.6756704", "0.6751023", "0.67278373", "0.67241865", "0.671999", "0.6717912", "0.6717912", "0.6717912", "0.6717912", "0.6717912", "0.6717912", "0.6717912", "0.66861665", "0.663184", "0.6599693", "0.6599693", "0.6599693", "0.6599693", "0.6599693", "0.6599693", "0.6599693", "0.6599693", "0.6599693", "0.6599693", "0.6599693", "0.6599693", "0.6599693", "0.65991354", "0.6599002", "0.6596675", "0.6559078", "0.65421844", "0.65421844", "0.65421844", "0.65421844", "0.65421844", "0.6517422", "0.6513808", "0.65117645", "0.65107864", "0.65086824", "0.64988965", "0.64723825", "0.64519966", "0.6431684", "0.64218587", "0.64218587", "0.6398988", "0.63952917", "0.6390346", "0.6363004", "0.63545513", "0.6350367", "0.63435286", "0.6337667", "0.63292646", "0.6326435", "0.6297914", "0.6296947", "0.6278934", "0.6278934", "0.6278934", "0.6274352", "0.62666404", "0.62564117", "0.6254207", "0.6248635", "0.6240107", "0.62385505", "0.6237979", "0.6234891", "0.6221763", "0.6220651", "0.619299", "0.6192004", "0.6192004", "0.6192004", "0.6192004", "0.6192004", "0.6192004", "0.6192004", "0.6192004", "0.6192004", "0.6192004", "0.6192004", "0.6192004", "0.6192004", "0.6192004", "0.6192004", "0.6192004", "0.6192004", "0.6192004", "0.6192004", "0.6192004", "0.6192004", "0.6192004" ]
0.7023471
2
DELETE /c_videos/1 DELETE /c_videos/1.json
def destroy @c_video = CVideo.find(params[:id]) @c_video.destroy respond_to do |format| format.html { redirect_to c_videos_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n s3 = $S3\n bucket = s3.buckets['tubeyou.video']\n bucket.objects[@video.name].delete\n\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @video.destroy\n render json: @video, :status => :ok\n end", "def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to videos_url }\n format.json { head :ok }\n end\n end", "def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to videos_url }\n format.json { head :ok }\n end\n end", "def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to videos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to videos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to videos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to videos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to videos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to videos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to videos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to videos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to videos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to videos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to videos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to videos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to videos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to media_videos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'Deleted video listing.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to today_videos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'Video successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @video = Video.find_by_hash_permalink_id(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to videos_url }\n format.json { head :ok }\n end\n end", "def deleteEntityVideo( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/video\",params)\n end", "def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'Video excluido com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @adm_video.destroy\n respond_to do |format|\n format.html { redirect_to adm_videos_url, notice: t('videos.destroy_success') }\n format.json { head :no_content }\n end\n end", "def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'Video fue eliminado correctamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to user_videos_url(current_user) }\n format.json { head :no_content }\n end\n end", "def destroy\n Video.find(params[:id]).destroy\n redirect_to \"/videos\"\n end", "def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to home_admin_path, notice: '视频删除成功!' }\n format.json { head :no_content }\n end\n end", "def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'Video was successfully destroyed.' }\n format.json { head :no_video }\n end\n end", "def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'Vídeo deletado com sucesso' }\n format.json { head :no_content }\n end\n end", "def destroy\n @video = Video.find(params[:id])\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to project_videos_url, notice: 'Video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to(videos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to(videos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to(videos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to(videos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'Video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'Video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'Video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'Video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'Video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'Video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'Video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'Video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'Video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'Video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'Video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'Video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n verify_access_video(@video_clip, 'delete')\n @video_clip.destroy\n respond_to do |format|\n format.html { redirect_to video_clips_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @video.destroy\n render nothing: true, status: 200\n end", "def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'Review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_video(video_id, method = HTTP_DELETE)\n if method == HTTP_DELETE\n auth_connection method, \"/api/videos/#{video_id}.xml\"\n else\n request_xml = %{\n <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <vzaar-api>\n <_method>delete</_method>\n </vzaar-api>\n }\n auth_connection method, \"/api/videos/#{video_id}.xml\", request_xml\n end\n end", "def destroy\n @kuaibovideo = Kuaibovideo.find(params[:id])\n @kuaibovideo.destroy\n\n respond_to do |format|\n format.html { redirect_to kuaibovideos_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @video = Video.find(params[:id])\r\n @video.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(videos_url) }\r\n format.xml { head :ok }\r\n end\r\n end", "def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to @competition, notice: 'Video eliminado.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @raw_video = RawVideo.find(params[:id])\n @raw_video.destroy\n\n respond_to do |format|\n format.html { redirect_to(raw_videos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to channel_videos_url }\n end\n end", "def destroy\n @record_video = RecordVideo.find(params[:id])\n @record_video.destroy\n\n respond_to do |format|\n format.html { redirect_to record_videos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @video = @user.videos.find(params[:id])\n @video.destroy\n respond_to do |format|\n format.html { redirect_to user_videos_url(@user), notice: 'Video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize! :destroy, @admin_video\n @admin_video.destroy\n respond_to do |format|\n format.html { redirect_to admin_videos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @medio_video.destroy\n respond_to do |format|\n format.html { redirect_to medio_videos_url, notice: 'Medio video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n deleted_url = @localvdo.video.url \n vdo_obj = Video.where(local_link: deleted_url).all\n vdo_obj.each do |vdo|\n vdo.inLocal = false\n vdo.local_link = \"\"\n vdo.save!\n end\n @localvdo.destroy\n @user = User.find(session[:user_id])\n respond_to do |format|\n format.html { redirect_to @user }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_video = UserVideo.find(params[:id])\n @user_video.destroy\n\n respond_to do |format|\n format.html { redirect_to user_videos_url }\n format.json { head :no_content }\n end\n end", "def remove_videos_from_db\n Video.delete_all(\"cart_id = 1\" )\n end", "def destroy\n @saved_video.destroy\n respond_to do |format|\n format.html { redirect_to saved_videos_url, notice: 'Saved video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @video = Video.find(params[:id])\n @original_video = @video.panda_video\n @original_video.delete\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url }\n format.json { head :no_content }\n format.js\n end\n end", "def destroy\n @videoo.destroy\n respond_to do |format|\n format.html { redirect_to videoos_url, notice: 'Videoo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n if @event.ppts_url\n `rm -rf public/uploads/event/ppts/#{@event.id}`\n end\n if @event.video_url\n `rm -rf public/uploads/event/video/#{@event.id}`\n end\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url, notice: 'Event was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n redirect_to '/lifts', notice: \"video deleted\"\n end", "def destroy\n @teach_video = TeachVideo.find(params[:id])\n @teach_video.destroy\n\n respond_to do |format|\n format.html { redirect_to teach_videos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to boards_url, notice: 'Video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n\n\n @project = Project.user_editable(current_user, params[:project_id])\n\n if @project\n\n @video = @project.videos.find(params[:id])\n @video.image.destroy\n\n if @video.destroy\n respond_to do |format|\n format.json { render :json => [:id=>@video.id], :status => :ok }\n end\n\n else\n respond_to do |format|\n format.json { render :json => @video.errors, :status => :unprocessable_entity }\n end\n\n end\n\n else\n not_authorized\n end\n\n end", "def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to ({:action => \"index\", :palestrante_id => @palestrante.id}) }\n format.json { head :no_content }\n end\n end", "def deletevideos\n @video = params[:records]\n @video.each do |id|\n Video.find_by_id(id).destroy\n end\n redirect_to admin_videos_path\n end", "def destroy\n @congratulations_video.destroy\n respond_to do |format|\n format.html { redirect_to congratulations_videos_url, notice: 'Congratulations video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @traditional_route_video.destroy\n respond_to do |format|\n format.html { redirect_to traditional_route_videos_url, notice: 'Traditional route video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @videofile = Videofile.find(params[:id])\n @videofile.destroy\n\n respond_to do |format|\n format.html { redirect_to(videofiles_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n # @video = Video.find(params[:id])\n @video = current_user.videos.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to profile_index_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mwod_video_link = MwodVideoLink.find(params[:id])\n @mwod_video_link.destroy\n\n respond_to do |format|\n format.html { redirect_to mwod_video_links_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @table_video.destroy\n respond_to do |format|\n format.html { redirect_to table_videos_url, notice: 'Table video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @help_video.destroy\n respond_to do |format|\n format.html { redirect_to help_videos_url }\n format.json { head :no_content }\n end\n end", "def delete\n video = Video.find_by_id params[:id]\n valid_request_object_do(video) do\n if video.can_delete(current_user)\n Video.transaction { video.destroy }\n respond_to do |format|\n format.html { redirect_to videos_path}\n format.js do\n render :update do |page|\n page.remove \"video_div_#{video.id}\"\n end\n end\n end\n else\n render :text => 'Invalid Request', :status => 401\n end\n end\n end", "def destroy\n @voc = Voc.find(params[:id])\n @voc.destroy\n\n respond_to do |format|\n format.html { redirect_to vocs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @jeux_video.create_activity :destroy, owner: current_user, read: false\n @jeux_video.destroy\n respond_to do |format|\n format.html { redirect_to jeux_videos_url, notice: 'Jeux video was successfully destroyed.' }\n format.json { head :no_content }\n format.js { render :layout => false }\n end\n end", "def destroy\n @video_on_main_page.destroy\n respond_to do |format|\n format.html { redirect_to video_on_main_pages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize! :destroy, @videos\n Video.find(params[:id]).destroy\n redirect_to admin_videos_path\n \n end", "def destroy\n @video = Video.find(params[:id])\n\tif @video.user == current_user or user_type == 'admin' or user_type == 'super_admin'\n\t\t@video.destroy\n\n\t\trespond_to do |format|\n\t\t format.html { redirect_to videos_url }\n\t\t format.json { head :no_content }\n\t\tend\n\telse\n\t\tredirect_to '/404'\n\tend\n end", "def destroy\n @video_gallery = VideoGallery.find(params[:id])\n @video_gallery.destroy\n\n respond_to do |format|\n format.html { redirect_to video_galleries_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sales_video.destroy\n respond_to do |format|\n format.html { redirect_to sales_seller_course_videos_path(@seller, @course), notice: \"Video foi removido com sucesso.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n\t\t@parts = Participante.where(\"id_video = ?\", @video[:id])\n\t\t@parts.each do |p|\n p.destroy\n end\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'El video se ha eliminado exitosamente del catálogo.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @embedded_attachment.destroy\n respond_to do |format|\n format.html { redirect_to embedded_attachments_url, notice: 'Video was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @demanda_videomonitoramento.destroy\n respond_to do |format|\n format.html { redirect_to demanda_videomonitoramentos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @college_video.destroy\n respond_to do |format|\n format.html { redirect_to college_videos_url, notice: 'College video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @game_video.destroy\n respond_to do |format|\n format.html { redirect_to game_videos_url, notice: 'Game video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.74720913", "0.73984087", "0.73090214", "0.73090214", "0.72935194", "0.7292421", "0.7292421", "0.7292421", "0.7292421", "0.7292421", "0.7292421", "0.7292421", "0.7292421", "0.7292421", "0.7292421", "0.7292421", "0.7292421", "0.7289624", "0.72776693", "0.72776693", "0.72776693", "0.72647446", "0.7184718", "0.7164428", "0.71599126", "0.7151677", "0.7101248", "0.7082166", "0.7067201", "0.7054245", "0.7052577", "0.7050459", "0.7048618", "0.70194787", "0.70160604", "0.70101607", "0.7008229", "0.70030856", "0.70030856", "0.70030856", "0.70029795", "0.69944614", "0.69944614", "0.69944614", "0.69944614", "0.69944614", "0.69944614", "0.69944614", "0.69944614", "0.69944614", "0.69944614", "0.69944614", "0.69944614", "0.6988808", "0.6985335", "0.69840795", "0.6977349", "0.69772184", "0.6964211", "0.6954331", "0.69455266", "0.69377047", "0.6930501", "0.692925", "0.6925267", "0.6920019", "0.69097567", "0.688754", "0.6887065", "0.6839301", "0.68133444", "0.68030727", "0.6783636", "0.6782484", "0.676653", "0.6761902", "0.67613065", "0.6757965", "0.6756214", "0.67431015", "0.67329985", "0.6725905", "0.6718031", "0.671706", "0.67048156", "0.6701446", "0.66976386", "0.669502", "0.66934747", "0.6692846", "0.66842073", "0.6677044", "0.6674007", "0.6665171", "0.66570413", "0.6647942", "0.66424096", "0.6641898", "0.6625676", "0.6613179" ]
0.7571032
0
Show the main list container
def show setup_download_list render partial: "browse_#{view_type}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n initLists\n end", "def show_list\n\t\t\t@my_list.show\n\t\tend", "def show_list\n process_show_list\n end", "def view \n puts\n puts \"VIEW LIST\"\n\n items.each_with_index do |item, index| \n puts \"#{index+1}. #{item}\"\n end\n end", "def show_list\n\t\tclear\n\t\tputs \"= LISTE DES INSTANCES #{name} =\".bleu\n\t\tputs \"\\n\\n\"\n\t\tlen_delim = defined?(LIST_ENTETE) ? LIST_ENTETE.length + 2 : 80\n\t\tdelim = (\"-\"*len_delim).bleu\n\t\tif defined?(LIST_ENTETE)\n\t\t\tputs delim\n\t\t\tputs LIST_ENTETE \n\t\tend\n\t\tputs delim\n\t\tall.each do |inst|\n\t\t\tputs \" #{inst.to_console}\"\n\t\tend\n\t\tputs delim\n\t\tputs \"\\n\\n\"\n\tend", "def show\n run List::Show\n render cell(List::Cell::Show, result['model']), layout: true\n end", "def list_items_preview\n end", "def showlist\n\t\t@people_list.each do |x|\n\t\t\tputs \"* #{capitalize(x.type)}, #{capitalize(x.name)}, #{capitalize(x.party)}\"\n\t\tend\n\tend", "def list options = {} \n render_partial :list, template_locals(:list_item, options)\n end", "def index\n\t\tlist\n\t\trender('list')\n\tend", "def index\n\t\tlist\n\t\trender('list')\n\tend", "def index\n \tlist\n \t#this renders out the list view template, you can make it any other if you want \n \trender('list')\n end", "def index\n list\n\trender('list')\n end", "def index\n list\n render(\"list\")\n end", "def list\n display_recipes\n end", "def show\n @tasks = @list.tasks\n # Setting a layout different from the default\n render layout: 'application'\n end", "def list\n index\n render :partial => 'list'\n end", "def index\n @lists_grid = initialize_grid(List)\n end", "def display options={}\n\t\t\tdisplay_object :top\n\t\t\ttasks = List.get options\n\t\t\tif tasks.length > 0\n\t\t\t\ttasks.each_with_index do |task, task_index|\n\t\t\t\t\tdisplay_task(task)\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tdisplay_object :intro\n\t\t\tend\n\t\t\tdisplay_object :bottom\n\t\tend", "def index\n super\n use_widgets do |root|\n root << jqg_top_widget('program')\n end\n render\n end", "def display_board\n if @lists.empty?\n display_menu\n end\n\n system \"clear\"\n \n # Itereate through each list in the board\n for list in @lists.values\n # Store the card description in an array used to print to the user\n card_descriptions = []\n for card in list.cards.values\n card_descriptions.push(card.description)\n end\n\n # Use a TTY Box to represent a list visually\n print TTY::Box.frame(width: 30, height: (list.cards.values.length + 1) * 2, title: {top_left: \"#{list.title}\"}) { card_descriptions.join(\"\\n\") }\n end\n\n display_menu\n end", "def index\n #@collections = Collection.all\n\tshow_collections\n end", "def list\n end", "def list\n end", "def list\n end", "def list\n\n end", "def show\n @lists = @cocktail.lists.where(user_id: @current_user)\n # raise \"hell\"\n end", "def show\n\t\t end", "def main()\n main_menu(SHOW_HEADER);\n end", "def main_menu\n puts <<~Doc\n Welocome to the New York Times Bestsellers List!\n Please choose one of the following options to get started:\n Doc\n NytBestsellersList::Lists.print_list_names\n end", "def list_dashboards(lista)\n container = \"<div class='box dashboard'>\"\n unless lista.empty?\n container << '<ul>'\n lista.each do |l|\n container << '<li>'\n container << \"<a href='#{l.url}' alt='#{l.name}' title='clique para ir para o atalho : #{l.name}'>\"\n container << image_tag(l.icon,:alt => l.name)\n container << \"<em>#{l.name}</em>\"\n container << \"</a>\"\n container << '</li>'\n end\n container << '</ul>'\n end\n container << '</div>'\n container.html_safe\n end", "def show_all()\n if @items.length == 0\n puts \"Shopping list is empty...\"\n else\n @items.each_index{\n |i|\n puts \"#{i+1} - #{@items[i].to_s}\"\n }\n end\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def print_list\n\t puts \"\"\n\t puts \"\"\n\t\tputs \"#{@list_name}\"\n\t\tprint \"-\" * 40\n\t\t@grocery_list.each {|k, v| puts \"#{k} #{v}\"}\n\t\tputs \"\"\n\t\tget_item\n\tend", "def list\n @view.listing\n end", "def show\n add_breadcrumb I18n.t('integral.navigation.list'), list_backend_resources_url\n add_breadcrumb I18n.t('integral.actions.view')\n end", "def index\n @collections = Rack::WebProfiler::Model::CollectionRecord.order(Sequel.desc(:created_at))\n .limit(20)\n\n erb \"panel/index.erb\", layout: \"panel/layout.erb\"\n end", "def index\n list\n end", "def index\n list\n end", "def show\n\t\t#no need b/c we just show all at once\n\tend", "def all\n storage.lists.each do |list|\n output \" #{list.name}\"\n list.items.each do |item|\n output \" #{item.short_name}:#{item.spacer} #{item.value}\"\n end\n end\n end", "def print_list(type='all')\n\n\t\tputs \"{#name} List - #{type} items\"\n\t\tprint '-' * 30 + \"\\n\"\n\n\n\n\t\ttodo_items.each do |item|\n\t\t\tcase type\n\t\t\twhen 'all'\n\t\t\tputs item\n\t\twhen 'complete'\n\t\t\tputs item if item.complete?\n\t\twhen 'incomplete'\n\t\t\tputs item unless item.complete?\n\t\tend\n\t\tend\n\tend", "def index\n $current_loc = \"/index\"\n header \"/index\"\n stack(margin:[40,0,40,0]) do\n\t stack do\n\t $collection.each_category do |cat_name, cat_set|\n\t stack(margin: 20) do\n\t\t subtitle cat_name\n\t\t cat_set.each do |subcat_name, subcat_set|\n\t\t stack(margin: 10) do\n\t\t\ttagline subcat_name\n\t\t\tshow_subcat(subcat_set)\n\t\t end # stack (subcategory)\n\t\t end # each subcategory\n\t end # stack (category)\n\t end # each category\n\t end # stack (collection)\n end # stack (main)\n footer\n end", "def show_full\n frows = []\n frows << show_headers\n #frows << show_body\n\n return frows\n end", "def show() end", "def show() end", "def show() end", "def list_menu\n puts \"\\nMain Menu\"\n puts \"1. Daily Prophet - News!\"\n puts \"2. Evanesco - Exit\"\n end", "def show_tasks\n\t\tputs \"here are the tasks on the #{self.name} list...\"\n\t\t@tasks.map.with_index {|task, i| puts \"#{i.next}. \" + task.description + \" | complete: \" + task.status.to_s}\n\t\tputs \"\\n\"\n\tend", "def show\n @list = List.find(params[:id])\n end", "def list_view\n\t\t# render the partial page with js to show the list view\n\t\trespond_to do |format|\n\t\t\tformat.js\n\t\tend\n\tend", "def display (list)\n\tputs list\nend", "def list\n index\n end", "def list(options={})\n if options['minimal']\n minimal_list\n else\n detailed_list(options)\n end\n end", "def show\n if user_signed_in?\n @list = List.includes( listeds: [:listable] ).find(params[:id])\n render layout: 'layouts/twoColumn'\n else\n respond_to do |format|\n format.html { redirect_to management_lists_path(:user), notice: 'You must have an account to manage lists' }\n format.json { head :no_content }\n end\n end\n end", "def list\n display_meals\n end", "def display_partners\n\t\t# get an aggregate query of necessary info for the partnerships and their most recent encounter\n\t\tp_sorted = current_user_profile.partners_with_most_recent\n\t\tagg = p_sorted.map do |ship|\n\t\t\t# make a list item\n\t\t\tcontent_tag(:li, {class: \"button-list__item\"}) do\n\t\t\t\t# link to that partnership's show page\n\t\t\t\tlink_to(partnership_path(ship[\"_id\"]), class: 'cta cta--is-square partnership-link') do\n\t\t\t\t\tdisplay_partner(ship)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t# join and nest\n\t\tcontent_tag(:ul, safe_join(agg), {class: \"button-list container--has-centered-child__centered-child\"})\n\tend", "def index\n @mains = Main.all\n end", "def show\n \n end", "def show\n \n end", "def show\n \n end", "def show\n \n end", "def show\n \n end", "def show\n \n end", "def show\n \n end", "def show\n \n end", "def show\n \n end" ]
[ "0.77565867", "0.7183316", "0.6863811", "0.6838491", "0.68163884", "0.67006576", "0.6496028", "0.64407414", "0.6431495", "0.64216626", "0.64216626", "0.6394709", "0.63712436", "0.6295487", "0.62670946", "0.61754817", "0.609477", "0.6061161", "0.6033677", "0.6009429", "0.599179", "0.5979098", "0.5973652", "0.5973652", "0.5973652", "0.596428", "0.5963367", "0.5959849", "0.5952542", "0.5946555", "0.5945706", "0.59373", "0.59321153", "0.59321153", "0.59321153", "0.59321153", "0.59321153", "0.59321153", "0.59321153", "0.59321153", "0.59321153", "0.59321153", "0.59321153", "0.59321153", "0.59321153", "0.59321153", "0.59321153", "0.59321153", "0.59321153", "0.59321153", "0.59321153", "0.59321153", "0.59321153", "0.59321153", "0.59321153", "0.59321153", "0.59321153", "0.59321153", "0.59321153", "0.59321153", "0.59321153", "0.59321153", "0.59321153", "0.59321153", "0.59321153", "0.59321153", "0.59321153", "0.59267783", "0.59219337", "0.59186226", "0.5908069", "0.58983487", "0.58983487", "0.58909583", "0.5885891", "0.58849424", "0.58721954", "0.58703285", "0.5864543", "0.5864543", "0.5864543", "0.5837365", "0.5832887", "0.5831741", "0.5830215", "0.5823641", "0.5792306", "0.5785475", "0.57840914", "0.57789695", "0.57713234", "0.5765055", "0.5764774", "0.5764774", "0.5764774", "0.5764774", "0.5764774", "0.5764774", "0.5764774", "0.5764774", "0.5764774" ]
0.0
-1
Return the file list content as JSON for rendering in the list container The actual metadata returned varies based on the view_type requested, in order to speed up large directories
def content setup_download_list except_list = case view_type when 'icons' %i[file_metadata last_process_name_run updated_at created_at user_id file_hash content_type nfs_store_stored_file_id] else %i[file_metadata last_process_name_run description updated_at created_at user_id file_hash content_type nfs_store_stored_file_id] end extras = { except: except_list, allow_show_flags: @allow_show_flags, limited_results: true } tfa = @container.user_file_actions_config&.map { |a| a[:id] } ff = NfsStore::Filter::Filter.human_filters_for(@activity_log) dl_json = @downloads.as_json(extras) render json: { nfs_store_container: { id: @container.id, name: @container.name, container_files: dl_json, item_type: 'nfs_store_container', writeable: @container.writable?, readable: @container.readable?, can_download_or_view: @container.can_download_or_view?, can_download: @container.can_download?, can_send_to_trash: @container.can_send_to_trash?, can_move_files: @container.can_move_files?, can_rename_files: @container.can_move_files?, can_rename_folders: @container.can_move_files?, can_user_file_actions: @container.can_user_file_actions?, parent_type: @activity_log.class.to_s.ns_underscore, parent_id: @activity_log.id, parent_sk: @activity_log.respond_to?(:secondary_key) && @activity_log.secondary_key, master_id: @activity_log.master_id, trigger_file_action_ids: tfa, directory_not_found: @directory_not_found, filters_for: ff, view_options: @container.view_options } } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_files\n source_dir = Path.new(params[:source_dir])\n if params.has_key?(:show_catalogues)\n show_catalogues = params[:show_catalogues]\n else\n show_catalogues = false\n end\n if params[:ext].present?\n file_type = params[:ext]\n else\n file_type = nil\n end\n render json: source_dir.files(file_type: file_type, show_catalogues: show_catalogues)\n end", "def list\n client = get_dropbox_client\n unless client\n redirect_to(:action => 'auth_start') and return\n end\n @dropbox_docs = []\n path = \"/\"\n\n metadata = client.metadata(path, file_limit=25000, list=true, hash=nil, rev=nil, include_deleted=false)\n for dfile in metadata['contents']\n \tname = dfile['path']\n \t@dropbox_docs << name[1..-1]\n \tend\n \tgoogle_session = GoogleDrive.login_with_oauth(session[:google_token])\n \t@google_docs = []\n \tfor file in google_session.files\n \t\t@google_docs << file.title \n \tend\n #drivelist = get_dr.slice!(-)\n #render :inline => \"#{metadata['contents']} \\n\\n\\n\"\n #render json: metadata\n\n end", "def list(type=\"\",raw=false,format=\"json\")\n \n metadata_type = MavensMate::FileFactory.get_meta_type_by_name(type) || {}\n has_children_metadata = false\n if ! metadata_type[:child_xml_names].nil? and metadata_type[:child_xml_names].kind_of? Array\n has_children_metadata = true\n end\n is_folder_metadata = metadata_type[:in_folder]\n \n metadata_request_type = (is_folder_metadata == true) ? \"#{type}Folder\" : type\n if metadata_request_type == \"EmailTemplateFolder\"\n metadata_request_type = \"EmailFolder\"\n end\n \n #puts metadata_type.inspect + \"\\n\\n\"\n \n self.mclient = get_metadata_client\n begin\n response = self.mclient.request :list_metadata do |soap|\n soap.header = get_soap_header \n soap.body = \"<ListMetadataQuery><type>#{metadata_request_type}</type></ListMetadataQuery>\"\n end\n rescue Savon::SOAP::Fault => fault\n raise Exception.new(fault.to_s) if fault.to_s.not.include? \"sf:INVALID_TYPE\"\n end \n \n begin\n #puts \"beginning\"\n return response unless ! raw\n \n if response.nil?\n return []\n end\n \n #puts \"RESPONSE HASH: \" + response.to_hash.inspect + \"<br/><br/>\"\n \n #if theres nothing there, return an empty array\n if response.to_hash[:list_metadata_response].nil? or response.to_hash[:list_metadata_response] == nil\n return []\n end\n \n hash = response.to_hash\n \n els = Array.new\n result_elements = [] \n if hash[:list_metadata_response][:result].kind_of? Hash\n result_elements.push(hash[:list_metadata_response][:result])\n else\n result_elements = hash[:list_metadata_response][:result]\n end\n #puts \"result_elements: \" + hash.inspect\n \n #if this type has children, make a retrieve request for the type\n #parse the response as appropriate\n object_hash = {} #=> {\"Account\" => [ {\"fields\" => [\"foo\", \"bar\"]}, \"listviews\" => [\"foo\", \"bar\"] ], \"Contact\" => ... }\n \n if has_children_metadata == true && result_elements.length > 0\n #testing stuff\n require 'zip/zipfilesystem'\n require 'fileutils'\n retrieve_body = \"<RetrieveRequest><unpackaged><types><name>#{metadata_request_type}</name>\"\n result_elements.each { |el| \n retrieve_body << \"<members>#{el[:full_name]}</members>\"\n }\n retrieve_body << \"</types></unpackaged><apiVersion>#{MM_API_VERSION}</apiVersion></RetrieveRequest>\"\n zip_file = retrieve({ :body => retrieve_body })\n \n tmp_dir = Dir.tmpdir \n random = MavensMate::Util.get_random_string\n mm_tmp_dir = \"#{tmp_dir}/.org.mavens.mavensmate.#{random}\" \n \n Dir.mkdir(mm_tmp_dir)\n File.open(\"#{mm_tmp_dir}/metadata.zip\", \"wb\") {|f| f.write(Base64.decode64(zip_file))}\n Zip::ZipFile.open(\"#{mm_tmp_dir}/metadata.zip\") { |zip_file|\n zip_file.each { |f|\n f_path=File.join(mm_tmp_dir, f.name)\n FileUtils.mkdir_p(File.dirname(f_path))\n zip_file.extract(f, f_path) unless File.exist?(f_path)\n }\n }\n require 'nokogiri'\n # [{\"Account\" => [ {\"fields\" => [\"foo\", \"bar\"]}, \"listviews\" => [\"foo\", \"bar\"] ] }, ]\n \n Dir.foreach(\"#{mm_tmp_dir}/unpackaged/#{metadata_type[:directory_name]}\") do |entry| #iterate the metadata folders\n #entry => Account.object\n \n next if entry == '.' || entry == '..' || entry == '.svn' || entry == '.git'\n #puts \"processing: \" + entry + \"\\n\"\n \n doc = Nokogiri::XML(File.open(\"#{mm_tmp_dir}/unpackaged/#{metadata_type[:directory_name]}/#{entry}\"))\n doc.remove_namespaces!\n \n c_hash = {}\n metadata_type[:child_xml_names].each { |c|\n tag_name = c[:tag_name]\n items = []\n doc.xpath(\"//#{tag_name}/fullName\").each do |node|\n items.push(node.text)\n end \n c_hash[tag_name] = items\n }\n base_name = entry.split(\".\")[0]\n object_hash[base_name] = c_hash\n end \n FileUtils.rm_rf mm_tmp_dir\n end\n\n result_elements.each { |el| \n #puts \"RESULT ELEMENT: \" + el.inspect + \"<br/>\"\n #el => \"Account\"\n children = []\n full_name = el[:full_name]\n \n full_name = \"Account\" if full_name == \"PersonAccount\"\n object_detail = object_hash[full_name]\n \n #if this type has child metadata, we need to add the details\n if has_children_metadata == true\n #puts \"OBJECT DETAIL: \" + object_detail.inspect + \"<br/><br/>\" \n next if object_detail.nil?\n metadata_type[:child_xml_names].each { |child_xml|\n #puts child_xml.inspect\n #puts child_xml[:tag_name]\n \n tag_name = child_xml[:tag_name]\n #puts object_detail.inspect\n if object_detail[tag_name].size > 0\n gchildren = []\n object_detail[tag_name].each do |gchild_el|\n gchildren.push({\n :title => gchild_el,\n :key => gchild_el,\n :isLazy => false,\n :isFolder => false,\n :selected => false\n })\n end\n \n children.push({\n :title => child_xml[:tag_name],\n :key => child_xml[:tag_name],\n :isLazy => false,\n :isFolder => true,\n :children => gchildren,\n :selected => false\n })\n end\n } \n end\n \n #if this type has folders, run queries to grab all metadata in the folders\n if is_folder_metadata == true \n next if el[:manageable_state] != \"unmanaged\"\n folders = \"<folder>#{el[:full_name]}</folder>\"\n begin\n response = self.mclient.request :list_metadata do |soap|\n soap.header = get_soap_header \n soap.body = \"<ListMetadataQuery><type>#{type}</type>#{folders}</ListMetadataQuery>\"\n end\n rescue Savon::SOAP::Fault => fault\n raise Exception.new(fault.to_s)\n end\n \n folder_elements = [] \n folder_hash = response.to_hash \n if folder_hash[:list_metadata_response] && folder_hash[:list_metadata_response][:result]\n if folder_hash[:list_metadata_response][:result].kind_of? Hash\n folder_elements.push(folder_hash[:list_metadata_response][:result])\n else\n folder_elements = folder_hash[:list_metadata_response][:result]\n end \n end\n \n folder_elements.each { |folder_el|\n children.push({\n :title => folder_el[:full_name].split(\"/\")[1],\n :key => folder_el[:full_name],\n :isLazy => false,\n :isFolder => false,\n :selected => false\n })\n } \n end\n \n els.push({\n :title => el[:full_name],\n :key => el[:full_name],\n :isLazy => is_folder_metadata || has_children_metadata,\n :isFolder => is_folder_metadata || has_children_metadata,\n :children => children,\n :selected => false\n })\n }\n els.sort! { |a,b| a[:title].downcase <=> b[:title].downcase }\n \n if format == \"json\"\n return els.to_json\n else\n return els\n end\n rescue Exception => e\n puts \"\\n\\n\\n\" + e.message + \"\\n\" + e.backtrace.join(\"\\n\")\n end\n end", "def list_files\n User.sync_files!(@context)\n files = user_real_files(params, @context)\n\n if unsafe_params[:limit] && unsafe_params[:offset]\n files = files.limit(unsafe_params[:limit]).offset(unsafe_params[:offset])\n end\n\n search_string = params[:search_string].presence || \"\"\n\n result = files.eager_load(:license, user: :org).\n where(\"nodes.name LIKE ?\", \"%#{search_string}%\").\n order(id: :desc).map do |file|\n describe_for_api(file, unsafe_params[:describe])\n end.compact\n\n render json: unsafe_params[:offset]&.zero? ? { objects: result, count: result.length } : result\n end", "def file_list\n end", "def filelist\n puts_message \"filelist start\" \n\n user = current_user\n\n request = params[:request].force_encoding(\"UTF-8\")\n puts_message \"Requested Path: \" + params[:request]\n \n if user and check_existance_of_path(request) \n if request == nil\n @file_names = 'error'\n elsif request_is_directory?(request)\n fire_the_list(request)\n # @file_names = absolute_path(request)\n elsif request_is_file?(request)\n last = request.split('/').last\n path = absolute_path(request)\n send_file_info(last, request) \n else\n @file_names = 'error'\n end\n else \n @file_names = 'error'\n end\n\n puts_message \"filelist end\" \n \n @output = <<-END\n\n END\n \n if request == \"/images/\"\n @folders = Folder.all(:user_id => current_user.id)\n \n @output << \"photo\" + \"\\n\"\n \n @folders.each do |f|\n @output << f.name + \"\\n\"\n end\n \n @file_names = @output\n end\n \n return @file_names\n\n end", "def files\n db = Database.find(params[:id])\n @files = Dir.entries(db.path)\n @files.delete_if{|f| !f.include?'.dat'}\n @results = []\n @files.each do |entry|\n @results << {:name=>entry,:version=>db.version}\n end\n respond_to do |format|\n format.html\n format.json { render json: @results }\n end\n end", "def files\n list = []\n if @data['info'].key?('files')\n @data['info']['files'].each do |file|\n list << { 'name' => file['path'], 'length' => file['length'] }\n end\n return list\n end\n\n if @data['info'].key?('name') && @data['info'].key?('length')\n list << { 'name' => @data['info']['name'], 'length' => @data['info']['length'] }\n end\n list\n end", "def index\n # Fetches space files.\n respond_with_space_files && return if params[:space_id]\n\n # Fetches all user 'private' files.\n filter_tags = params.dig(:filters, :tags)\n\n files = UserFile.\n real_files.\n editable_by(@context).\n accessible_by_private.\n where.not(parent_type: [\"Comparison\", nil]).\n includes(:taggings).\n eager_load(user: :org).\n search_by_tags(filter_tags)\n\n return render(plain: files.size) if show_count\n\n files = files.where(parent_folder_id: @parent_folder_id)\n files = FileService::FilesFilter.call(files, params[:filters])\n\n folders = private_folders(@parent_folder_id).includes(:taggings).\n eager_load(user: :org).search_by_tags(filter_tags)\n folders = FileService::FilesFilter.call(folders, params[:filters])\n\n user_files = Node.eager_load(user: :org).where(id: (files + folders).map(&:id)).\n order(order_params).page(page_from_params).per(page_size)\n page_dict = pagination_dict(user_files)\n\n render json: user_files, root: \"files\", adapter: :json,\n meta: files_meta.\n merge(count(UserFile.private_count(@context.user))).\n merge({ pagination: page_dict })\n end", "def file_list\n @file_list\n end", "def index\n @file_versions = FileVersion.all\n\n render json: @file_versions\n end", "def get_file_listing\n execute!(drive.files.list).data\n end", "def list\n @file_list.to_a\n end", "def list(path, show_all)\n begin\n unless (@cmd.model[:public] + path).directory?\n return false\n end\n\n (@cmd.model[:public] + path).entries.each_with_object([]) do |entry, list|\n if show_all or not(entry.basename.start_with?(\".\"))\n list << {\n \"name\" => entry.basename,\n \"type\" => entry.directory? ? \"dir\" : \"file\",\n \"mtime\" => entry.mtime.iso8601,\n \"size\" => entry.size\n }\n end\n end\n rescue => e\n return nil\n end\n end", "def discover_files\n authorize! :create, resource_class\n respond_to do |f|\n f.json do\n render json: file_locator.to_h\n end\n end\n end", "def index\n if current_user.role.title != 'admin'\n if current_user.developer.nil?\n @config_files = []\n else\n @config_files = current_user.developer.config_files(:order => 'created_at DESC')\n end\n else\n @config_files = ConfigFile.all(:order => 'created_at DESC')\n end\n #@config_files = ConfigFile.all(:order => 'created_at DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @config_files }\n end\n end", "def pages_data\n\n config_data = get_config_data\n\n all_data_files = Dir.glob(\"../#{ROOT_DIR}/lib/views/source/#{config_data[\"templates_page\"]}/**/*.json\")\n\n pageData_files = []\n\n all_data_files.map { |data| \n\n data_name = data.split(\"/\")[-1]\n pageData_files.push(\n {\n \"file_name\": data_name,\n \"link_name\": data_name.sub(\"~\", \"__\").chomp(\".json\"),\n \"label\": data_name.sub(\"~\", \" \").chomp(\".json\")\n }\n )\n }\n\n return pageData_files\n end", "def content\n fields = self.get_fields\n fields.empty? ? self.data.merge(self.file_data).to_json : fields.to_json\n end", "def list\n\t\tfiles.map! { |filename|\n\t\t\t{:title => file_to_pagename(filename), :link => filename.chomp(\".md\")}\n\t\t}\n\tend", "def list\n\t\tfiles.map! { |filename|\n\t\t\t{:title => file_to_pagename(filename), :link => filename.chomp(\".md\")}\n\t\t}\n\tend", "def index\n fs = FileStore.by_hash(params[:hash])\n\n file_stores = fs.map do |item|\n {\n sha1_hash: item.sha1_hash,\n file_name: File.basename(item.file.path),\n user: {\n id: item.user_id,\n uname: item.user_uname\n }\n }\n end\n render json: file_stores\n end", "def index\n @resources = []\n\t\tDir.glob(\"#{params[:path]}/*\").each do |f|\n\t\tunless File.directory?(f)\n\t\t\t@resources.push(File.basename(f))\n\t\tend\n\tend\n\n\trender json: @resources\n end", "def to_json\r\n {\r\n files: @files,\r\n dirs: @dirs\r\n }\r\n end", "def render_json_fileset_response( status, filesets = nil )\n render json: API::FilesetListResponse.new( status, filesets ), :status => status\n end", "def index\n @file_list = UploadedFileList.find(params[:uploaded_file_list_id])\n @file_list_items = @file_list.file_list_items.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @file_list_items }\n end\n end", "def filelist_file(origin_name, dist_name, component_name, packages)\n content = {\n \"filelists\" => {\n :@xmlns => XMLNS_MAP[:filelists],\n :@packages => packages.size,\n :package => packages.map { |package|\n {\n :@pkgid => package[:generated_sha],\n :@name => package[\"NAME\"],\n :@arch => package[\"ARCH\"],\n :version => {\n :@epoch => package[\"EPOCHNUM\"],\n :@ver => package[\"VERSION\"],\n :@rel => package[\"RELEASE\"].split(\".\").first,\n },\n :file => (package[\"FILENAMES\"] + package[\"DIRNAMES\"]).map { |dir|\n {:@type => \"dir\", :_content_ => dir}\n },\n }\n },\n },\n }\n args = [origin_name, dist_name, component_name, \"repodata\", \"filelists.xml\"]\n [\n create_file(*args) do |file|\n file.puts generate_xml(content)\n end,\n compress_file(*args),\n ]\n end", "def index\n @medusa_premis_file_objects = MedusaPremis::FileObject.all\n\n respond_to do |format|\n format.html {setup_next_and_previous_documents} # index.html.erb\n format.json { render json: @medusa_premis_file_objects }\n end\n end", "def files\n FileList.new(`#@native.files`)\n end", "def listFiles()\n #N Without this the files won't get listed\n contentHost.listFiles(baseDir)\n end", "def list(folder)\n\t\tc = 0\n\t\tfolder = '/' + folder\t\t\t\n\t\tresp = @client.metadata(folder)\n\t\tputs \"\\n List of contents in \" + folder + \"\\n\"\n\t\tfor item in resp['contents']\t\t\n\t\t\tputs item['path']\n\n\t\t\tc=c+1\n\t\tend\t\n\t\t\n\tend", "def show\n @folder = Folder.includes(:subfolders).find(params[:id])\n\n # See if there is a better way to add filenames at a later date\n render json: @folder.as_json(include: :subfolders).merge(\n { filenames: @folder.extract_filenames }\n )\n end", "def show\n # Refresh state of file, if needed\n refresh_file(@file, @context)\n load_licenses(@file)\n\n # TODO: move common data to common_concern.rb\n comparison = if @file.parent_type == \"Comparison\"\n @file.parent.slice(:id, :user_id, :scope, :state)\n else\n synchronizer = DIContainer.resolve(\"comparisons.sync.synchronizer\")\n synchronizer.sync_comparisons!(@context.user)\n @file.comparisons.accessible_by(@context).includes(:taggings)\n end\n\n comments = if @file.in_space?\n Comment.where(commentable: @file.space_object, content_object: @file).\n order(id: :desc).page(params[:comments_page])\n else\n @file.root_comments.order(id: :desc).page(params[:comments_page])\n end\n\n notes_ids = Attachment.file_attachments(@file.id).pluck(:note_id)\n notes = Note.where(id: notes_ids).real_notes.\n accessible_by(@context).select(:id, :user_id).order(id: :desc).page(params[:notes_page])\n\n answers = @file.notes.\n accessible_by(@context).\n answers.order(id: :desc).page(params[:answers_page])\n\n discussions = @file.notes.\n accessible_by(@context).\n discussions.order(id: :desc).page(params[:discussions_page])\n\n render json: @file, root: \"files\", adapter: :json,\n meta: {\n user_licenses: @licenses,\n object_license: @license,\n comments: comments,\n discussions: discussions,\n answers: answers,\n notes: notes,\n comparisons: comparison,\n links: meta_links(@file),\n }\n end", "def parse_list_response(xml)\n [ nodes_for(xml, 'files').collect{ |node| File.new(self, node) },\n nodes_for(xml, 'folders').collect{ |node| Folder.new(@rc, self, node) } ]\n end", "def get_files_list_with_http_info(path, opts = {})\r\n if @api_client.config.debug\r\n @api_client.config.logger.debug 'Calling API: StorageApi.get_files_list ...'\r\n end\r\n # verify the required parameter 'path' is set\r\n if @api_client.config.client_side_validation && path.nil?\r\n fail ArgumentError, \"Missing the required parameter 'path' when calling StorageApi.get_files_list\"\r\n end\r\n # resource path\r\n local_var_path = '/html/folder'\r\n\r\n # query parameters\r\n query_params = {}\r\n query_params[:'path'] = path.to_s\r\n query_params[:'storageName'] = opts[:'storage_name'] if !opts[:'storage_name'].nil?\r\n\r\n # header parameters\r\n header_params = {}\r\n # HTTP header 'Accept' (if needed)\r\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\r\n # HTTP header 'Content-Type'\r\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\r\n\r\n # form parameters\r\n form_params = {}\r\n\r\n # http body (model)\r\n post_body = nil\r\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\r\n :header_params => header_params,\r\n :query_params => query_params,\r\n :form_params => form_params,\r\n :body => post_body,\r\n :return_type => 'FilesList')\r\n if @api_client.config.debug\r\n @api_client.config.logger.debug \"API called: StorageApi#get_files_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\r\n end\r\n return data, status_code, headers\r\n end", "def download_list\n task = params[:task]\n files = []\n\n case task\n when DOWNLOAD_ACTION, OPEN_ACTION, COPY_ACTION, COPY_TO_PRIVATE_ACTION\n nodes = Node.accessible_by(@context).where(id: params[:ids])\n nodes.each { |node| files += node.is_a?(Folder) ? node.all_files : [node] }\n when PUBLISH_ACTION\n nodes = Node.editable_by(@context).\n where(id: params[:ids]).\n where.not(scope: UserFile::SCOPE_PUBLIC)\n nodes.each do |node|\n files += if node.is_a?(Folder)\n node.all_files(Node.where.not(scope: UserFile::SCOPE_PUBLIC))\n else\n [node]\n end\n end\n when DELETE_ACTION\n nodes = Node.editable_by(@context).where(id: params[:ids]).to_a\n files += nodes\n nodes.each { |node| files += node.all_children if node.is_a?(Folder) }\n files.filter! { |file| file.scope == params[:scope] }\n else\n raise ApiError, \"Parameter 'task' is not defined!\"\n end\n\n render json: files,\n each_serializer: FileActionsSerializer,\n scope_name: params[:scope] || SCOPE_PRIVATE,\n action_name: task\n end", "def files\n return get_result('files')\n end", "def get_files_list_with_http_info(path, storage_name = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.get_files_list ...'\n end\n\n # verify the required parameter 'path' is set\n if @api_client.config.client_side_validation && path.nil?\n fail ArgumentError, \"Missing the required parameter 'path' when calling SlidesApi.get_files_list\"\n end\n # resource path\n local_var_path = '/slides/storage/folder/{path}'\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'path', path)\n\n # query parameters\n query_params = {}\n query_params[:'storageName'] = @api_client.prepare_for_query(storage_name) unless storage_name.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 # http body (model)\n post_body = nil\n\n # form parameters\n post_files = []\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'FilesList')\n return data, status_code, headers\n end", "def list\n ret = get()\n return [] if ret.is_a? Hash and ret.has_key? :error\n ret.map{|i| FileItem.new(i)}\n end", "def index\n @uploads = Upload.order(\"created_at DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @uploads.map{|upload| upload.to_jq_upload } }\n end\n end", "def index\n @file_descriptions = FileDescription.all\n end", "def get_files_list_with_http_info(path, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PdfApi.get_files_list ...\"\n end\n # verify the required parameter 'path' is set\n if @api_client.config.client_side_validation && path.nil?\n fail ArgumentError, \"Missing the required parameter 'path' when calling PdfApi.get_files_list\"\n end\n # resource path\n local_var_path = \"/pdf/storage/folder/{path}\".sub('{' + 'path' + '}', path.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'storageName'] = opts[:'storage_name'] if !opts[:'storage_name'].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 # Fix header in file\n post_body = nil\n\n # http body (model)\n # Fix header in file\n # post_body = nil\n auth_names = ['JWT']\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 => 'FilesList')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PdfApi#get_files_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def json_index_static_contents\n\n @static_contents = StaticContent.all\n respond_to do |format|\n\n format.json { render json: @static_contents }\n end\n end", "def list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ContentRepoMetadataFilesApi.list ...'\n end\n # resource path\n local_var_path = '/pulp/api/v3/content/rpm/repo_metadata_files/'\n\n # query parameters\n query_params = {}\n query_params[:'repository_version'] = opts[:'repository_version'] if !opts[:'repository_version'].nil?\n query_params[:'repository_version_added'] = opts[:'repository_version_added'] if !opts[:'repository_version_added'].nil?\n query_params[:'repository_version_removed'] = opts[:'repository_version_removed'] if !opts[:'repository_version_removed'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil?\n query_params[:'exclude_fields'] = opts[:'exclude_fields'] if !opts[:'exclude_fields'].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 = ['Basic']\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 => 'InlineResponse20011')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ContentRepoMetadataFilesApi#list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def list_container_content (container_uri)\n all_files =[]\n # Parse Webpage response and extracting files details\n doc = Nokogiri::XML(URI.open(\"#{container_uri}\"))\n doc.xpath(\"//Blob\").each do |item|\n # look at each item\n name = item.xpath(\"Name\").text\n url = item.xpath(\"Url\").text\n size = item.xpath(\"Size\").text.to_i\n # add to our array\n all_files << { :name=>\"#{name}\", :url => \"#{url}\", :size => \"#{size}\" }\n end\n return all_files\n end", "def ingest_path_info\n respond_to do |format|\n format.json {render json: ingest_directory_info(params[:path])}\n end\n end", "def index\n @authorized = true\n begin\n authorize! :show, UploadFile\n rescue CanCan::AccessDenied\n @authorized = false\n end\n #added to avoid raise condition when initially uploading multiple files\n check_uploads_collection unless !@authorized\n\n respond_to do |format|\n format.json {\n #TODO find_by_solr could be faster \n @multiresimages = current_user.upload_files.map do |file|\n begin\n Multiresimage.find(file.pid)\n rescue ActiveFedora::ObjectNotFoundError\n end\n end.compact\n render :json=>@multiresimages.map(&:to_jq_upload)\n }\n format.html\n end\n end", "def list\n do_list\n\n respond_to do |type|\n type.html {\n render :action => 'list', :layout => true\n }\n type.js { \n do_list\n render :action => 'list', :layout => false \n }\n type.xml { render :xml => response_object.to_xml, :content_type => Mime::XML, :status => response_status }\n type.json { render :text => response_object.to_json, :content_type => Mime::JSON, :status => response_status }\n type.yaml { render :text => response_object.to_yaml, :content_type => Mime::YAML, :status => response_status }\n end\n end", "def index\n @poblamiento_file_formats = PoblamientoFileFormat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @poblamiento_file_formats }\n end\n end", "def get_files_list_with_http_info(path, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: StorageApi.get_files_list ...\"\n end\n # verify the required parameter 'path' is set\n if @api_client.config.client_side_validation && path.nil?\n fail ArgumentError, \"Missing the required parameter 'path' when calling StorageApi.get_files_list\"\n end\n # resource path\n local_var_path = \"/diagram/storage/folder/{path}\".sub('{' + 'path' + '}', path.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'storageName'] = opts[:'storage_name'] if !opts[:'storage_name'].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 = ['JWT']\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 => 'FilesList')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: StorageApi#get_files_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def list\n @title = \"Content List\"\n # Get all content node types\n @list_options = ContentNode::TYPES\n\n # Set currently viewing by key\n if params[:key] then\n @viewing_by = params[:key]\n else\n @viewing_by = ContentNode::TYPES[0]\n end\n \n if params[:sort] == 'name' then\n sort = \"name ASC\"\n else\n sort = \"created_on DESC\"\n end\n\n @title << \" - #{@viewing_by}\"\n @content_nodes = ContentNode.paginate(\n :order => sort,\n :page => params[:page],\n :conditions => [\"#{ContentNode.connection.quote_column_name(\"type\")} = ?\", @viewing_by],\n :per_page => 10\n )\n session[:last_content_list_view] = @viewing_by\n end", "def list_files_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: NsxComponentAdministrationApi.list_files ...\"\n end\n # resource path\n local_var_path = \"/node/file-store\"\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(: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 => 'FilePropertiesListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: NsxComponentAdministrationApi#list_files\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def generate_listing(path)\n client\n listing = client.list_objects(bucket: config[:bucket], delimiter: '/', prefix: full_path(path))\n add_directories(listing)\n add_files(listing, path)\n end", "def index\n # @documents = Document.all.with_attached_images\n respond_to do |format|\n format.html\n format.json { render json: DocumentDatatable.new(params, view_context: view_context) }\n end\n end", "def get(request, response)\n raise NotFound unless exist?\n# if stat.directory?\n# response.body = \"\"\n# Rack::Directory.new(root).call(request.env)[2].each do |line|\n# response.body << line\n# end\n# response['Content-Length'] = response.body.size.to_s\n# else\n# file = Rack::File.new(root)\n# response.body = file\n# end\n if collection?\n response.body = \"<html>\"\n response.body << \"<h2>\" + file_path.html_safe + \"</h2>\"\n children.each do |child|\n name = child.file_path.html_safe\n path = child.public_path\n response.body << \"<a href='\" + path + \"'>\" + name + \"</a>\"\n response.body << \"</br>\"\n end\n response.body << \"</html>\"\n response['Content-Length'] = response.body.size.to_s\n response['Content-Type'] = 'text/html'\n else\n @filesystem.open(file_path, 'r') do |f|\n response.body = f\n response['Content-Type'] = @bson['contentType']\n end\n end\n\n end", "def index\n @processed_files = ProcessedFile.paginate(:page => params[:page], :per_page => per_page)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @processed_files }\n format.js\n end\n end", "def list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PublicationsFileApi.list ...'\n end\n # resource path\n local_var_path = '/pulp/api/v3/publications/file/file/'\n\n # query parameters\n query_params = {}\n query_params[:'ordering'] = opts[:'ordering'] if !opts[:'ordering'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil?\n query_params[:'exclude_fields'] = opts[:'exclude_fields'] if !opts[:'exclude_fields'].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 = ['Basic']\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 => 'InlineResponse20015')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PublicationsFileApi#list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def list\n files_mask = \"*.xml\"\n if current_user.role != \"admin\"\n files_mask = \"#{current_user.fileprefix}-*.xml\"\n end\n pending_path = ENV[\"EAD_XML_PENDING_FILES_PATH\"] + \"/#{files_mask}\"\n Rails.logger.info(\"Loading pending files at #{pending_path}\")\n\n file_list = []\n Dir[pending_path].each do |file|\n file_info = {\n name: File.basename(file, \".xml\"),\n timestamp: File.mtime(file),\n display_date: File.mtime(file).strftime(\"%Y-%m-%d %I:%M %p\")\n }\n file_list << file_info\n end\n file_list.sort_by! {|x| x[:timestamp]}.reverse!\n\n @presenter = UploadPresenter.new()\n @presenter.configure(pending_path, file_list, current_user)\n render\n rescue => ex\n render_error(\"list\", ex, current_user)\n end", "def documents_for(path, site_path = '')\n ethon = ethon_easy_json_requester\n ethon.url = \"#{computed_web_api_url(site_path)}GetFolderByServerRelativeUrl('#{uri_escape path}')/Files\"\n ethon.perform\n check_and_raise_failure(ethon)\n\n threads = []\n rv = []\n result = JSON.parse( ethon.response_body )\n result['d']['results'].each do |file|\n file_struct = OpenStruct.new(\n title: file['Title'],\n path: file['ServerRelativeUrl'],\n name: file['Name'],\n url: \"#{base_url}#{file['ServerRelativeUrl']}\",\n created_at: Time.parse(file['TimeCreated']),\n updated_at: Time.parse(file['TimeLastModified']),\n record_type: nil,\n date_of_issue: nil,\n )\n\n threads << Thread.new {\n ethon2 = ethon_easy_json_requester\n server_relative_url = \"#{site_path}#{path}/#{file['Name']}\"\n ethon2.url = \"#{computed_web_api_url(site_path)}GetFileByServerRelativeUrl('#{uri_escape server_relative_url}')/ListItemAllFields\"\n ethon2.perform\n rs = JSON.parse(ethon2.response_body)['d']\n file_struct.record_type = rs['Record_Type']\n file_struct.date_of_issue = rs['Date_of_issue']\n\n rv << file_struct\n }\n end\n threads.each { |t| t.join }\n rv\n end", "def image_list\n @folder = PulStore::Lae::Folder.find(params[:id])\n @page_title = \"Folder #{@folder.physical_number}\"\n @pages_list = get_pages_by_folder @folder.id\n respond_to do |format|\n format.html\n end\n end", "def json_files\n file_list '**/*.json'\n end", "def ls( *args )\r\n \r\n directory = nil\r\n opts = {}\r\n \r\n case args.count\r\n when 1\r\n if args[0].kind_of? Hash\r\n opts = args[0]\r\n else\r\n directory = args[0]\r\n end\r\n when 2\r\n directory = args[0]\r\n opts = args[1] \r\n end\r\n \r\n # args are the RPC arguments ...\r\n args = {}\r\n args[:path] = directory if directory\r\n args[:recursive] = true if opts[:recurse]\r\n args[:detail] = true if opts[:detail] \r\n args.delete(:detail) if( args[:detail] and args[:recursive])\r\n \r\n # RPC output format, default is XML\r\n outf = { :format => 'text' } if opts[:format] == :text\r\n \r\n got = @ndev.rpc.file_list( args, outf )\r\n return nil unless got\r\n \r\n return got.text if opts[:format] == :text\r\n return got if opts[:format] == :xml\r\n \r\n # if we're here, then we need to conver the output \r\n # to a Hash. Joy!\r\n \r\n collect_detail = args[:detail] || args[:recursive]\r\n \r\n ls_hash = {}\r\n got.xpath('directory').each do |dir|\r\n \r\n dir_name = dir.xpath('directory-name').text.strip\r\n dir_hash = {}\r\n \r\n dir_hash[:fileblocks] = dir.xpath('total-file-blocks').text.to_i\r\n files_info = dir.xpath('file-information')\r\n \r\n dir_hash[:files] = {} \r\n dir_hash[:dirs] = {} # sub-directories\r\n \r\n files_info.each do |file|\r\n f_name = file.xpath('file-name').text.strip\r\n f_h = {} \r\n \r\n if file.xpath('file-directory')[0]\r\n dir_hash[:dirs][f_name] = f_h\r\n else\r\n dir_hash[:files][f_name] = f_h \r\n end\r\n \r\n next unless collect_detail\r\n \r\n f_h[:owner] = file.xpath('file-owner').text.strip\r\n f_h[:group] = file.xpath('file-group').text.strip\r\n f_h[:links] = file.xpath('file-links').text.to_i\r\n f_h[:size] = file.xpath('file-size').text.to_i\r\n \r\n xml_when_item(file.xpath('file-symlink-target')) { |i|\r\n f_h[:symlink] = i.text.strip\r\n }\r\n \r\n fp = file.xpath('file-permissions')[0]\r\n f_h[:permissions_text] = fp.attribute('format').value\r\n f_h[:permissions] = fp.text.to_i\r\n \r\n fd = file.xpath('file-date')[0]\r\n f_h[:date] = fd.attribute('format').value\r\n f_h[:date_epoc] = fd.text.to_i\r\n \r\n end # each directory file\r\n ls_hash[ dir_name ] = dir_hash \r\n end # each directory\r\n \r\n return nil if ls_hash.empty?\r\n ls_hash\r\n end", "def list\n @title = \"Content List\"\n # Get all content node types\n @list_options = ContentNodeType.all_type_names\n\n # Set currently viewing by key\n if params[:key] then\n @viewing_by = params[:key]\n elsif session[:last_content_list_view]\n @viewing_by = session[:last_content_list_view]\n else\n @viewing_by = @list_options[1]\n end\n\n # Find the id of the content node type we're viewing by\n type = ContentNodeType.find(:first, :conditions => [\"name = ?\", @viewing_by])\n\n # Paginate content\n @content_node_pages,\n @content_nodes = paginate :content_node,\n :per_page => 10,\n :conditions => [\"content_node_type_id = ?\", type.id],\n :order => \"display_on DESC, name ASC\"\n session[:last_content_list_view] = @viewing_by\n end", "def render_item_list(params)\n docpath = params.fetch(:docpath)\n key = params.fetch(:key)\n klass = params.fetch(:klass, ItemList)\n title = params.fetch(:title, \"Cloud Platform Reports\")\n\n template = docpath.to_sym\n\n item_list = get_data_from_json_file(docpath, key, klass)\n\n locals = {\n title: title,\n updated_at: item_list.updated_at,\n list: item_list.list,\n }\n\n erb template, locals: locals\nend", "def get_content\n @list \n end", "def file_list(hash)\n\nend", "def file_list(hash)\n\nend", "def get_file_summary(file_path)\n response = HTTParty.get(\"https://#{accountName}.azuredatalakestore.net\" +\n \"/webhdfs/v1/#{file_path}?op=GETCONTENTSUMMARY\", {\n body: \"grant_type=client_credentials&client_id=#{clientId}\"+\n \"&client_secret=#{clientSecret}\"+\n \"&resource=https%3A%2F%2Fmanagement.azure.com%2F\",\n headers: {\n \"Authorization\" => \"Bearer #{bearerToken}\",\n \"Accept\" => \"*/*\",\n \"Cache-Control\" => 'no-cache',\n \"Host\" => \"#{accountName}.azuredatalakestore.net\",\n \"Connection\" => 'keep-alive',\n \"cache-control\" => 'no-cache'\n },\n verify: true,\n })\n \n return JSON.parse response.read_body\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @location_photos.map{|upload| upload.to_jq_upload } }\n end\n end", "def spaces\n filter_tags = params.dig(:filters, :tags)\n\n files = UserFile.real_files.\n where.not(scope: [SCOPE_PUBLIC, SCOPE_PRIVATE]).\n accessible_by(@context).\n includes(:taggings).eager_load(user: :org).\n search_by_tags(filter_tags)\n\n files = files.where(scoped_parent_folder_id: @parent_folder_id) unless show_count\n files = FileService::FilesFilter.call(files, params[:filters])\n\n folders = Folder.\n where.not(scope: [SCOPE_PUBLIC, SCOPE_PRIVATE]).\n accessible_by(@context).\n includes(:taggings).eager_load(user: :org).\n where(scoped_parent_folder_id: @parent_folder_id).\n search_by_tags(filter_tags)\n folders = FileService::FilesFilter.call(folders, params[:filters])\n\n if show_count\n render plain: files.size\n else\n nodes = Node.where(id: files + folders).eager_load(user: :org).to_a\n\n nodes = sort_array_by_fields(nodes, \"created_at\")\n page_meta = pagination_meta(nodes.count)\n nodes = paginate_array(nodes)\n\n render json: nodes, root: \"files\", adapter: :json, meta: files_meta.merge(page_meta)\n end\n end", "def index\n respond_to do |format|\n format.html do\n @recent_objects = Descriptor.recent_from_project_id(sessions_current_project_id)\n .order(updated_at: :desc).limit(10)\n render '/shared/data/all/index'\n end\n format.json {\n @descriptors = ::Queries::Descriptor::Filter.new(params).all\n .page(params[:page])\n .per(params[:per])\n .order('descriptors.name')\n }\n end\n end", "def render_list(request)\n\t\tresponse = Rack::Response.new\n\t\t# Write partial HTML\n\t\tFile.open(\"list.html\", \"rb\") { |list| response.write(list.read) }\n\t\t# Generate \"sorted by\" text\n\t\tresponse.write(generate_sorted_by(request))\n\t\t# Generate the results\n\t\tresponse.write(generate_sorted_table(request))\n\t\t# Finish HTML response\n\t\tresponse.write(closing_html)\n\t\tresponse.finish\n\tend", "def files\n result = form.select_files.map { |label, id| { id: id, text: label } }\n render json: result\n end", "def list\r\n # Get the folder\r\n @folder = Folder.find_by_id(folder_id)\r\n\r\n # Set if the user is allowed to update or delete in this folder;\r\n # these instance variables are used in the view.\r\n @can_update = @logged_in_user.can_update(@folder.id)\r\n @can_delete = @logged_in_user.can_delete(@folder.id)\r\n\r\n # determine the order in which files are shown\r\n file_order = 'filename '\r\n file_order = params[:order_by].sub('name', 'filename') + ' ' if params[:order_by]\r\n file_order += params[:order] if params[:order]\r\n\r\n # determine the order in which folders are shown\r\n folder_order = 'name '\r\n if params[:order_by] and params[:order_by] != 'filesize' \r\n folder_order = params[:order_by] + ' '\r\n folder_order += params[:order] if params[:order]\r\n end\r\n\r\n # List of subfolders\r\n @folders = @folder.list_subfolders(@logged_in_user, folder_order.rstrip)\r\n\r\n # List of files in the folder\r\n @myfiles = @folder.list_files(@logged_in_user, file_order.rstrip)\r\n\r\n #get the correct URL\r\n url = url_for(:controller => 'folder', :action => 'list', :id => nil)\r\n\r\n # it's nice to have the possibility to go up one level\r\n @folder_up = '<a href=\"' + url + '/' + @folder.parent.id.to_s + '\">..</a>' if @folder.parent\r\n end", "def list\n require_public = ( params[:user].nil? ? false : true )\n user = ( params[:user].nil? ? session[:user] : User.first(id: params[:user]) )\n raise RequestError.new(:bad_params, \"User does not exist\") unless user\n raise RequestError.new(:bad_params, \"Depth not valid\") if params[:depth].to_i < 0\n depth = (params[:depth] ? params[:depth].to_i : -1)\n xfile = ( params[:id].nil? ? user.root_folder : WFolder.get(params[:id]) )\n raise RequestError.new(:internal_error, \"No root directory. Please contact your administrator\") if xfile.nil? && params[:id].nil?\n raise RequestError.new(:folder_not_found, \"File or folder not found\") if xfile.nil?\n if (require_public && params[:id] && session[:user].admin == false) then\n raise RequestError.new(:folder_not_public, \"Folder is not public\") if xfile.folder == true && xfile.public == false\n raise RequestError.new(:folder_not_public, \"File is not public\") if xfile.folder == false && xfile.public == false\n end\n if xfile.folder then\n @result = { folder: crawl_folder(xfile, require_public, depth), success: true }\n else \n @result = { file: xfile.description(session[:user]) , success: true }\n end\n end", "def file_list path = false, only_extensions = []\n data = []\n path = @path unless path\n if File.exists?(path) && File.directory?(path)\n Dir.foreach(path) do |entry|\n next if entry == '..' or entry == '.' or entry.start_with?(\".\")\n full_path = File.join(path, entry)\n if File.directory?(full_path)\n data.concat(file_list(full_path, only_extensions))\n else\n if only_extensions.size > 0\n data << { \n :name => entry,\n :path => full_path\n } if only_extensions.all? {|extension| true if entry.end_with?(extension) }\n else\n data << { \n :name => entry,\n :path => full_path\n }\n end\n end\n end\n end\n return data\n end", "def get_directory_listing_for(params)\n # Get parent folder id\n parent_folder_id = params[:folder_id].present? ? self.get_parent_folder_id(params[:folder_id]) : nil\n \n # Get root folder id if blank\n params[:folder_id] ||= '/'\n \n # Set default params\n result = {:folder_id => params[:folder_id], :parent_folder_id => parent_folder_id, :per_page => 500, :results => []}\n\n begin\n api_result = @client.metadata(result[:folder_id], 1000, true)\n rescue\n return nil\n end\n \n if api_result.present? && api_result['contents'].present?\n api_result['contents'].each do |item|\n result[:results] << self.item_into_standard_format(item)\n end\n end\n \n result\n end", "def index\n @posts = Post.all\n respond_to do |format|\n format.html\n format.json { render :json => @posts.to_json(:include => { :assets => {:only => [:file_file_name, :file_content_type],:methods => :file_url }, :categories => {:only => [:name]}} , :methods => [:author, :author_avatar, :favorites_quantity, :comments, :comments_quantity])}\n end\n end", "def show\n render json: @file, serializer: FileSerializer, :root => \"file\"\n end", "def files\n result = form.select_files.map do |label, id|\n { id: id, text: label }\n end\n render json: result\n end", "def index\n @page_title = \"All CoreFiles\"\n @results = CoreFile.order(updated_at: :desc)\n\n respond_to do |format|\n format.html { render :template => 'shared/index' }\n format.js { render :template => 'shared/index', :layout => false }\n end\n end", "def files\n result = form.select_files.map do |label, id|\n { id: id, text: label }\n end\n render json: result\n end", "def files\n result = form.select_files.map do |label, id|\n { id: id, text: label }\n end\n render json: result\n end", "def public\n public_files = []\n files = session[:user].x_files.all(public: true)\n files.each do |file|\n public_files.push(file.description(session[:user])) if file.folder || (!file.folder && file.uploaded)\n end\n @result = { files: public_files, success: true }\n end", "def index\n @inventory_files = InventoryFile.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @inventory_files }\n end\n end", "def index\n @galleries_galleries = @galleries_album.galleries.all\n respond_to do |format|\n format.html { render :index }\n # format.json { render json: []} # ON PURPOSE\n format.json { render json: @galleries_galleries.map{|x| x.to_jq_upload }}\n end\n end", "def files\n results\n rescue ApiStruct::EntityError\n result\n end", "def list_contents\n {}.tap do |files|\n remote_files do |file|\n ftp.gettextfile(file) do |line, newline|\n content.concat newline ? line + \"\\n\" : line\n end # temporarly downloads the file\n FileUtils.rm file\n files[file] = { data: content }\n end\n end\n end", "def show_asset_files\n display_collection_of_folders_docs_tasks\n end", "def files\n @files=get_endpoint('extra').keys\n end", "def metadata(path, file_limit=10000, list=true, hash=nil)\n params = {\n \"file_limit\" => file_limit.to_s,\n \"list\" => list.to_s\n }\n\n params[\"hash\"] = hash if hash\n\n response = @session.do_get build_url(\"/metadata/#{@root}#{format_path(path)}\", params=params)\n if response.kind_of? Net::HTTPRedirection\n raise DropboxNotModified.new(\"metadata not modified\")\n end\n parse_response(response)\n end", "def index\n Dir[\"#{@base_path}/*.json\"].map{|p| File.basename(p)}\n end", "def index\n respond_to do |format|\n format.html do\n @recent_objects = Source.created_this_week.order(updated_at: :desc).limit(10)\n render '/shared/data/all/index'\n end\n format.json {\n @sources = Queries::Source::Filter.new(params).all\n .order(:cached)\n .page(params[:page])\n .per(params[:per])\n }\n format.bib {\n # TODO - handle count and download\n @sources = Queries::Source::Filter.new(params).all\n .order(:cached)\n .page(params[:page])\n .per(params[:per] || 2000)\n }\n end\n end", "def get_folder_contents\n # Get all child nodes associated with a top level folder that the logged in user is authorized\n # to view. Top level folders include Questionaires, Courses, and Assignments.\n folders = {}\n FolderNode.includes(:folder).get.each do |folder_node|\n child_nodes = folder_node.get_children(nil, nil, session[:user].id, nil, nil)\n # Serialize the contents of each node so it can be displayed on the UI\n contents = []\n child_nodes.each do |node|\n contents.push(serialize_folder_to_json(folder_node.get_name, node))\n end\n\n # Store contents according to the root level folder.\n folders[folder_node.get_name] = contents\n end\n\n respond_to do |format|\n format.html { render json: folders }\n end\n end", "def show_folder_files\n @portfolios = Portfolio.find(:all, :conditions=>['user_id = ? and portfolio_type_id = 2 and name not in (?)', current_user,[\"portfolio_created_by_system\",\"portfolio_created_by_system_for_deal_room\", \"portfolio_created_by_system_for_bulk_upload\"]], :order=> \"created_at desc\")\n @portfolio = Portfolio.find(params[:pid])\n @folder = Folder.find_folder(params[:folder_id])\n @notes = RealEstateProperty.find_properties_by_portfolio_id_with_cond(@portfolio.id,\"\",\"order by created_at desc)\") if !@portfolio.nil?\n @note = RealEstateProperty.find_real_estate_property(@folder.real_estate_property_id)\n (current_user.has_role?(\"Shared User\") && session[:role] == 'Shared User') ? find_folders_and_docs(@folder.id) : assign_options\n if request.xhr?\n render :update do |page|\n page.replace_html \"show_assets_list\",:partial=>'assets_list'\n end\n else\n render :action => 'show_files'\n end\n end", "def index\n @upload = Upload.new # Allow file uploads on index page via jq_fu\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @uploads }\n end\n end", "def index\n @backup_files = BackupFile.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @backup_files }\n end\n end", "def list_assets\n @list = []\n\n raise DRI::Exceptions::BadRequest unless params[:objects].present?\n\n solr_query = ActiveFedora::SolrQueryBuilder.construct_query_for_ids(\n params[:objects].map { |o| o.values.first }\n )\n result_docs = Solr::Query.new(solr_query)\n result_docs.each do |doc|\n item = list_files_with_surrogates(doc)\n @list << item unless item.empty?\n end\n\n raise DRI::Exceptions::NotFound if @list.empty?\n\n respond_to do |format|\n format.json\n end\n end", "def get_content(folder = nil, sort = nil)\n abs_path = folder ? ROOT + folder : ROOT\n \n # build array if pairs: [filename, :type, is_textfile]\n sorter = case sort\n when 'name' then '| sort -f'\n when 'ctime' then '-c'\n when 'mtime' then '--sort=time'\n when 'size' then '--sort=size'\n else ''\n end\n\n list_files(abs_path, sorter).map do |obj|\n file_path = abs_path + obj\n [obj,\n if file_path.file?; :file\n elsif file_path.directory?; :dir\n elsif file_path.symlink?; :link\n end,\n \n !!`file \"#{file_path.to_s.shellescape}\"`.force_encoding(Encoding::UTF_8).sub(file_path.to_s, '').index(/text/i)\n ]\n end\n end", "def index\n @folders = current_user.folders.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @folders }\n end\n end", "def index\n @event_import_files = EventImportFile.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @event_import_files }\n end\n end" ]
[ "0.6995037", "0.6731227", "0.6723786", "0.66914433", "0.65439194", "0.65369254", "0.6516771", "0.6492961", "0.6372714", "0.63477516", "0.63052166", "0.6275796", "0.62591004", "0.62393045", "0.61822623", "0.61689866", "0.6135253", "0.61291194", "0.61150324", "0.61150324", "0.61118805", "0.6076809", "0.60743314", "0.6063985", "0.6061841", "0.6046969", "0.60258985", "0.60251564", "0.60182434", "0.6009439", "0.6000137", "0.5995244", "0.59627384", "0.59622794", "0.5953464", "0.59476215", "0.593634", "0.5921325", "0.591429", "0.591226", "0.5907081", "0.5906438", "0.5900381", "0.58992505", "0.5885444", "0.5883291", "0.58731246", "0.5871868", "0.5871167", "0.5871003", "0.5865867", "0.58611006", "0.5849728", "0.5849172", "0.58486205", "0.58449525", "0.5840995", "0.5838472", "0.58313996", "0.58228576", "0.582054", "0.5818985", "0.58164734", "0.5786859", "0.5785323", "0.5785323", "0.5783271", "0.5781494", "0.57797855", "0.5761452", "0.57483333", "0.5746415", "0.5746233", "0.5744624", "0.5736728", "0.57335144", "0.5733325", "0.5732625", "0.57293564", "0.5727356", "0.5722232", "0.5722232", "0.5720062", "0.5717552", "0.57117665", "0.5701319", "0.56925434", "0.56833863", "0.5680109", "0.5676421", "0.5674763", "0.5652298", "0.5651294", "0.56472045", "0.56432945", "0.5642517", "0.5641503", "0.5639751", "0.56373763", "0.5635715" ]
0.7120745
0
Type of filestore browser requested
def view_type @view_type = ValidViewTypes.find { |vt| vt == params[:view_type] } || DefaultViewType end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ftype\n :file\n end", "def ftype() end", "def ftype() File.ftype(path) end", "def file_type\r\n\t\t@file_type\r\n\tend", "def cache_store_type\n \"file\"\n end", "def file_type\n FILE_TYPES[@file_type]\n end", "def web_viewer_type\n # Add more conditions as and when supported\n case\n when web_image? then :image\n when web_video? then :video\n when Rack::Mime.match?(mime_type, 'application/pdf') then :pdf\n when backing_store == :g_docs &&\n url.end_with?('/pub', '/pub?embedded=true')\n\n :g_docs_published\n else nil\n end\n end", "def ftype\n :directory\n end", "def content_type\n self.file_content_type\n end", "def mimetype; @mimetype ||= `file -b --mime-type '#@fname'`.strip; end", "def type\n stype = \"file\"\n stype = \"atom\" if @filepath.nil? and !@metadata.empty?\n stype = \"multipart\" if !@filepath.nil? and !@metadata.empty?\n stype\n end", "def mime_type; end", "def mime_type; end", "def mime_type; end", "def mime_type; end", "def ftype\n :unknown\n end", "def file?\n type == :file\n end", "def mime_type\n term = format_controlled_vocabulary.all.find { |x| x.definition == info_service.driver }\n term ? term.value : primary_file.mime_type\n end", "def document_type\n FileUtility.get_file_type(@file_name)\n end", "def set_filetypes\n #unless params[:id] == 'download' || params == :file\n @filetype = Filetype.find(params[:id])\n # end\n end", "def content_type\n environment.content_type_of(pathname)\n end", "def file_type\n if is_ography?\n :ography\n else\n :tei_content\n end\n end", "def ftype\n case type\n when T_SOCKET then :socket\n when T_SYMLINK then :symlink\n when T_REGULAR then :regular\n when T_BLOCK_DEVICE then :block_device\n when T_DIRECTORY then :directory\n when T_CHAR_DEVICE then :char_device\n when T_FIFO then :fifo\n when T_UNKNOWN then :unknown\n end\n end", "def mime_type type\n @app.mime_type type\n end", "def file_type_class\n self.file_type.downcase.split.join('-') + '-file'\n end", "def type\n if File.directory?(path)\n return :filesystem\n elsif File.file?(path)\n return :zip\n else\n return :nofile\n end\n end", "def type path\n end", "def fstype; end", "def content_type\n { 'print' => 'application/pdf', 'zpass' => 'text/plain' }[kind]\n end", "def content_mime_type; end", "def check_file_type\n `file #{@desktop_image}`.sub(/^.*: /,'').split.first.downcase\n end", "def file_type\n self['fileRef']['explicitFileType'] || self['fileRef']['lastKnownFileType']\n end", "def file_type(property: 'file')\n params.dig property, :type\n end", "def file_type\n case raw_file_type\n when 'f'\n :file\n when 'd'\n :directory\n when 'L'\n :symlink\n when 'D'\n :device\n when 'S'\n :special\n end\n end", "def type\n @type ||= File.extname(path)[1..-1]\n end", "def file_type; 'directory' end", "def fileType path\n\t\tif File.ftype(path) == 'file'\n\t\t\ttrue\n\t\telse\n\t\t\tputs \"The given path isn't file.\"\n\t\t\texit\n\t\tend\n\tend", "def content_type\n %x(file -bi \"#{self.path}\").chomp.scan(/^[a-z0-9\\-_]+\\/[a-z0-9\\-_]+/).first\n end", "def filetype\n `file --mime-type -b #{@file_path}`.chomp\n end", "def content_type(path)\n extension = path.split(\".\").last\n type = CONTENT_TYPE[extension] ||= 'application/octet-stream'\nend", "def get_content_type(filename)\n ext = File.extname(filename) # get the extension\n type = 'application/octed-stream'\n type = 'text/html' if ext == '.html' || ext == '.htm'\n type = 'text/plain' if ext == '.txt' || ext == '.rb'\n type = 'text/css' if ext == '.css'\n type = 'image/jpeg' if ext == '.jpeg' || ext == '.jpg'\n type = 'image/gif' if ext == '.gif'\n type = 'image/png' if ext == '.png'\n type = 'image/bmp' if ext == '.bmp'\n type = 'text/xml' if ext == '.xml' || ext == '.xsl'\n type # same as: return type\n end", "def determine_content_type\n location = File.join(self.study.data_store_path, self.download_location)\n signature = File.open(location).read(2)\n if signature == StudyFile::GZIP_MAGIC_NUMBER\n 'application/gzip'\n else\n 'text/plain'\n end\n end", "def mimetype\n return attributes['mimetype'] if attributes['mimetype']\n return \"image/png\" if content =~ /^.PNG/\n return \"application/octet-stream\"\n end", "def mime_type=(_); end", "def mime_type\n MIME_TYPES[@file_type]\n end", "def mime_type=(_arg0); end", "def mime_type=(_arg0); end", "def mime_type=(_arg0); end", "def mime_type\n term = format_controlled_vocabulary.all.find { |x| x.definition == info_service.driver }\n term ? term.value : original_file.mime_type\n end", "def content_type(ext)\n case ext\n when \"gif\": \"image/gif\"\n when \"jpg\": \"image/jpeg\"\n when \"png\": \"image/png\"\n else \"application/octet-stream\"\n end\nend", "def mime_type\n Rack::Mime.mime_type(extname)\n end", "def type t\n @files = @files.select { |file| File.exist?(file) && File.ftype(file) == t}\n self\n end", "def set_file_type\n if self.is_local?\n if self.attachment_content_type.blank?\n self.file_type = \"misc\"\n elsif self.attachment_content_type == 'application/pdf'\n self.file_type = \"pdf\"\n elsif self.attachment_content_type.include?('powerpoint')\n self.file_type = \"presentation\"\n elsif self.attachment_content_type == 'application/zip'\n self.file_type = \"zip\"\n elsif self.attachment_content_type == \"application/rtf\" || self.attachment_content_type == 'text/plain' || self.attachment_content_type == 'application/msword' || self.attachment_content_type.include?('wordprocessing')\n self.file_type = \"document\"\n elsif self.attachment_content_type.include?('spreadsheet') || self.attachment_content_type == 'ms-excel'\n self.file_type = \"spreadsheet\"\n elsif self.attachment_content_type.include?('image')\n self.file_type = \"image\"\n else\n self.file_type = \"misc\"\n end\n end\n end", "def file_set_mime_type\n file_set.mime_type.first\n end", "def storage_type\n data[:storage_type]\n end", "def storage_type\n data[:storage_type]\n end", "def filetype\n if options.filetype.to_sym == :dot then :none else options.filetype.to_sym end\n end", "def content_type\n# if stat.directory?\n# \"text/html\"\n# else \n# mime_type(file_path, DefaultMimeTypes)\n# end\n @bson['contentType'] || \"text/html\"\n end", "def mime_type\n\t\tsuffix_without_dot = extname ? extname.sub(/\\A\\./){''}.downcase : nil\n\n\t\tMechanize::Util::DefaultMimeTypes[suffix_without_dot]\n\tend", "def content_type\n @content_type || file.content_type\n end", "def content_type\n end", "def mime_type\n meta['mime_type'] || app.mime_type_for(ext)\n end", "def geo_mime_type\n return unless file_set\n file_set.mime_type.first\n end", "def accepted_mimes\n case self.type\n when'Recording'\n '.wav,.mp3'\n when 'Document'\n '.pdf'\n when 'Image'\n '.jpeg,.jpg,.gif,.bmp,.png'\n else\n ''\n end\n end", "def drive_type; end", "def resource_type\n return self.mime_type.slice(/^application\\/vnd.google-apps.(.+)$/, 1) || \"file\"\n end", "def negotiate_mime(order); end", "def mime_type\n self.class.mime_type\n end", "def mime_type\n Blob.mime_type(self.name)\n end", "def mime_type\n return content_type\nend", "def mime_type\n return @mime_type\n end", "def content_type(file_name)\n # Just grabbing the extension\n extension = ::File.extname(file_name.downcase)[1..-1]\n return @extension_map[extension] if @extension_map.key?(extension)\n 'application/octet-stream'\n end", "def media_type; end", "def media_type; end", "def file_mimetype\n if file_formats.first\n file_formats.first.mimetype\n end\n end", "def content_type\n @content_type ||= begin\n if format_extension.nil?\n engine_content_type || 'application/octet-stream'\n else\n format_content_type ||\n engine_content_type ||\n 'application/octet-stream'\n end\n end\n end", "def file_mimetype\n @descriptive_detail.file_mimetype\n end", "def filetype f\n return nil unless f\n\n f = Shellwords.escape(f)\n s = `file #{f}`\n return :text if s.index 'text'\n return :zip if s.index(/[Zz]ip/)\n return :zip if s.index('archive')\n return :image if s.index 'image'\n return :sqlite if s.index 'SQLite'\n # return :db if s.index 'database'\n return :text if s.index 'data'\n\n nil\nend", "def type(resource_type)\n Cocina::Models::FileSetType.properties[resource_type.to_sym]\n end", "def photo__mime_type\r\nif !self.photo__name.blank?\r\n mt = MIME::Types.of(File.extname(self.photo__name)).first\r\n return mt ? mt.content_type : \"application/octet-stream\"\r\nend\r\nend", "def content_type(name)\n name_li(name).span(:class=>/(mylibrary_item_|searchcontent_result_)mimetype/).text\n end", "def getcontenttype\n \"httpd/unix-directory\"\n end", "def get_doc_type(item)\n if item['is_dir']\n \"folder\"\n elsif item['mime_type'].blank?\n \"misc\"\n elsif item['mime_type'] == 'application/pdf'\n \"pdf\"\n elsif item['mime_type'].include?('powerpoint')\n \"presentation\"\n elsif item['mime_type'] == 'application/zip'\n \"zip\"\n elsif item['mime_type'] == \"application/rtf\" || item['mime_type'] == 'text/plain' || item['mime_type'] == 'application/msword' || item['mime_type'].include?('wordprocessing')\n \"document\"\n elsif item['mime_type'].include?('spreadsheet') || item['mime_type'] == 'ms-excel'\n \"spreadsheet\"\n elsif item['mime_type'].include?('image') || item['mime_type'] == 'application/vnd.google-apps.drawing'\n \"image\"\n else\n \"misc\"\n end\n end", "def content_type\n file.try(:content_type)\n end", "def primary_model\n case params[:retrieval_type]\n when 'stored_file'\n NfsStore::Manage::StoredFile\n when 'archived_file'\n NfsStore::Manage::ArchivedFile\n else\n raise FphsException, 'No retrieval_type set'\n end\n end", "def name_of_content_type\n if self.content_type == 'application/vnd.ms-word'\n return \"Word document\"\n elsif self.content_type == 'application/pdf'\n return \"PDF file\"\n end\n end", "def file_by_type_preference(*types)\n return nil if types.size == 0\n types.each {|type| return file_by_type type if has_type type}\n nil\n end", "def content_type\n @mime_type\n end", "def dor_file_mimetype\n public_xml_doc.xpath('//contentMetadata/resource/*/@mimetype').map(&:text)\n end", "def file_type(file_path)\n return 'file' if File.file? file_path\n return 'directory' if File.directory? file_path\n return 'unknown'\n end", "def mime_type\n # image/vnd.microsoft.icon won't render in IE8\n Rack::Mime::MIME_TYPES.merge!('.ico' => 'image/x-icon')\n Rack::Mime.mime_type(File.extname(@path))\n end", "def ftype() File.ftype( expand_tilde ) end", "def mime_type\n raise NotImplementedError.new 'This is only a function body for documentation'\n end", "def mime_type\n metadata[\"mime_type\"]\n end", "def browser_type\n\t if $TESTWISE_BROWSER then\n\t $TESTWISE_BROWSER.downcase.to_sym\n\t elsif ENV[\"BROWSER\"]\n\t ENV[\"BROWSER\"].downcase.to_sym\n\t else\n\t RUBY_PLATFORM =~ /mingw/ ? \"ie\".to_sym : \"firefox\".to_sym\n\t end\n\tend", "def mime_type type\n Rack::Mime.mime_type type\n end", "def fstype\n return self['fstype'] if has_key?('fstype')\n Chef::Log.info([\n self['fstype'], current[:fstype],\n File.exists?(device) && `file -s '#{device}'`.chomp,\n self,\n ].inspect)\n return current[:fstype] if current[:fstype]\n return unless File.exists?(device)\n dev_type_str = `file -s '#{device}'`.chomp\n case\n when dev_type_str =~ /SGI XFS/ then self['fstype'] = 'xfs'\n when dev_type_str =~ /Linux.*(ext[2-4])/ then self['fstype'] = $1\n else\n raise \"Can't determine filesystem type of #{device} -- set it explicitly in node[:volumes]\"\n end\n self['fstype']\n end", "def content_type; end", "def content_type; end", "def content_type; end", "def content_type; end" ]
[ "0.7297137", "0.6918949", "0.6597207", "0.6548214", "0.65420896", "0.6474147", "0.638396", "0.63555723", "0.6312229", "0.62969065", "0.6272009", "0.6262682", "0.6262682", "0.6262682", "0.6262682", "0.6233425", "0.6225005", "0.61464465", "0.61413985", "0.6137388", "0.6135113", "0.6129689", "0.612217", "0.61221534", "0.6094202", "0.6092534", "0.60913974", "0.6067325", "0.6051814", "0.60046196", "0.5949151", "0.59436375", "0.5942083", "0.5912704", "0.59112924", "0.58769476", "0.5876108", "0.58725727", "0.587161", "0.58556443", "0.58534145", "0.5851586", "0.5841433", "0.58339417", "0.58317465", "0.58276796", "0.58276796", "0.58276796", "0.5824709", "0.58087903", "0.5802738", "0.5801521", "0.5794669", "0.5783375", "0.57761556", "0.57761556", "0.5765057", "0.5762456", "0.57504946", "0.57503545", "0.5746201", "0.5743666", "0.57341707", "0.57321656", "0.573156", "0.57224053", "0.57168585", "0.57104844", "0.5709116", "0.5693256", "0.56930894", "0.5689975", "0.5683852", "0.5683852", "0.5671496", "0.5666653", "0.5658622", "0.56525403", "0.5640194", "0.5638554", "0.5636086", "0.5635119", "0.5633959", "0.5631564", "0.56217134", "0.5621633", "0.5607022", "0.560299", "0.56015635", "0.55917245", "0.55880463", "0.5579306", "0.5578093", "0.5573667", "0.55695546", "0.5568106", "0.5567878", "0.55628496", "0.55628496", "0.55628496", "0.55628496" ]
0.0
-1
Setup the list of download file items, handling item flags if needed.
def setup_download_list return unless @container.readable? # Check if we should show flags for classifications on each of the types of container file @allow_show_flags = {} %i[stored_file archived_file].each do |rt| full_name = "nfs_store__manage__#{rt}" show_flag = !!Classification::ItemFlagName.enabled_for?(full_name, current_user) @allow_show_flags[rt] = show_flag end # List types should we include flags for in the queries that return the stored_files and archived_files show_flags_for = @allow_show_flags.filter { |_k, v| v }.keys.map { |i| i.to_s.pluralize.to_sym } @downloads = Browse.list_files_from @container, activity_log: @activity_log, include_flags: show_flags_for # Prep a download object to allow selection of downloads in the browse list @download = Download.new container: @container, activity_log: @activity_log rescue FsException::NotFound @directory_not_found = true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_items(selected_items, for_action)\n # Retrieve each file's details. The container_id will be passed if this is a\n # multi container download, otherwise it will be ignored\n selected_items.each do |s|\n container = self.container || Browse.open_container(id: s[:container_id], user: current_user)\n activity_log = self.activity_log || ActivityLog.open_activity_log(s[:activity_log_type], s[:activity_log_id],\n current_user)\n retrieve_file_from(s[:id], s[:retrieval_type], container: container, activity_log: activity_log,\n for_action: for_action)\n end\n end", "def setup(items)\n\tend", "def initialize()\n @items = []\n @filename = \"watchlist.json\"\n get_items_from_file()\n end", "def initialize(item_list)\n\t\t@item_list = item_list\n\tend", "def initialize(list, item, client)\n return unless item\n KNOWN_ATTRIBUTES.each do |attr|\n send \"#{attr}=\", item[attr.to_s]\n end\n @list = list\n @client = client\n end", "def initialize\n @uploaders = []\n @downloaded_images = []\n end", "def setup\n super\n @default_provider_id = register_default_provider\n @default_consumer_id = register_default_consumer\n\n # Define some dummy items\n @default_items = [\n { name: \"Item1\", price: 39.99, provider: @default_provider_id },\n { name: \"Item2\", price: 10, provider: @default_provider_id }\n ]\n\n # Check everything is empty\n assert_equal(0, get_registered_number(\"api/items\"),\n \"There are registered items at test setup\")\n\n assert_equal 0, count_orders, \"There are registered orders at test setup\"\n\n # TODO: Rename the files\n Item.db_filename = \"tests/test_files/test_items.json\"\n Order.db_filename = \"tests/test_files/test_orders.json\"\n end", "def process_item(item)\n item = Nokogiri::HTML(item.text)\n downloads_section = item.css('h2:contains(\"Download\")').first\n return unless downloads_section\n\n process_download(downloads_section.next_element.css('li').first)\n end", "def initialize(items)\n @items = items\n @filename = 'tmp/dependencies'\n @graph = Nanoc3::DirectedGraph.new([ nil ] + @items)\n @previous_items = []\n end", "def add_download(user: nil)\n self.events.build(event_type: Event::Type::DOWNLOAD,\n description: \"Download\",\n happened_at: Time.now,\n user: user).save!\n owning_ids = self.item.owning_ids\n institution_id = owning_ids['institution_id']\n unit_id = owning_ids['unit_id']\n collection_id = owning_ids['collection_id']\n return unless institution_id && unit_id && collection_id\n MonthlyItemDownloadCount.increment(self.item)\n MonthlyCollectionItemDownloadCount.increment(collection_id)\n MonthlyUnitItemDownloadCount.increment(unit_id)\n MonthlyInstitutionItemDownloadCount.increment(institution_id)\n end", "def initialize(path_parameters, request_adapter)\n super(path_parameters, request_adapter, \"{+baseurl}/shares/{sharedDriveItem%2Did}/list/items/{listItem%2Did}{?%24select,%24expand}\")\n end", "def download_options(filename_base: nil, no_content_disposition: false)\n return [] unless file_set_id\n\n [\n {\n option_key: \"small\",\n url: Rails.application.routes.url_helpers.s3_download_redirect_path(file_set_id, \"dl_small\", filename_base: filename_base, no_content_disposition: no_content_disposition)\n },\n {\n option_key: \"medium\",\n url: Rails.application.routes.url_helpers.s3_download_redirect_path(file_set_id, \"dl_medium\", filename_base: filename_base, no_content_disposition: no_content_disposition)\n },\n {\n option_key: \"large\",\n url: Rails.application.routes.url_helpers.s3_download_redirect_path(file_set_id, \"dl_large\", filename_base: filename_base, no_content_disposition: no_content_disposition)\n },\n {\n option_key: \"full\",\n url: Rails.application.routes.url_helpers.s3_download_redirect_path(file_set_id, \"dl_full_size\", filename_base: filename_base, no_content_disposition: no_content_disposition)\n }\n ]\n end", "def initialize\n @items_list = []\n end", "def fetch_items_from_filesystem_or_zip\n unless in_zip?\n @items = Dir.foreach(current_dir).map {|fn|\n load_item dir: current_dir, name: fn\n }.to_a.partition {|i| %w(. ..).include? i.name}.flatten\n else\n @items = [load_item(dir: current_dir, name: '.', stat: File.stat(current_dir)),\n load_item(dir: current_dir, name: '..', stat: File.stat(File.dirname(current_dir)))]\n zf = Zip::File.new current_dir\n zf.each {|entry|\n next if entry.name_is_directory?\n stat = zf.file.stat entry.name\n @items << load_item(dir: current_dir, name: entry.name, stat: stat)\n }\n end\n end", "def file_list\n end", "def initialize(items=[])\n @items = items\n end", "def create_downloads(config, files)\n downloads = []\n # Write\n files&.each do |file|\n content_type = config[:format] == 'csv' ? 'text/csv' : 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'\n downloads << create_download(config[:user_id], file[:content], file[:filename], config[:export_type], content_type)\n end\n downloads\n end", "def build_ftk_file_items(coll_pid, ftk_report, ftk_xml_file_dir, display_derivative_dir)\n assembler = FtkItemAssembler.new(:collection_pid => coll_pid)\n assembler.process(ftk_report, ftk_xml_file_dir, display_derivative_dir)\nend", "def initialize(items = [])\n @items = items\n end", "def import_supply_items(filename = self.import_filename)\n super\n end", "def import_supply_items(filename = self.import_filename)\n super\n end", "def initialize\n @downloaded = false\n end", "def download(path, item)\n Download.download item.link, path\n Logger.instance.info \"Downloaded file #{item.title}\"\n @history.save item.title\n end", "def initialize data\n @listOfItem = data\n end", "def download_files\n path = Conf::directories.tmp\n manager = @current_source.file_manager\n manager.start do\n @current_source.folders.each do |folder|\n files = @files[folder]\n puts \"folder => #{folder}, Files => #{files}\" if @opts[:v]\n next if files.empty? \n # download into the TMP directory by folder\n spath = File.join(path, @current_source.name.to_s,folder)\n manager.download_files files,spath,v: true\n move_files folder\n @current_source.schema.insert_files files,folder\n SignalHandler.check { Logger.<<(__FILE__,\"WARNING\",\"SIGINT Catched. Abort.\")}\n end\n end\n end", "def items\n _ = Nanoc3::Item # autoload it now for easier step debug-ging\n these = super\n dot_dot_names = @basenames.map{|x| \"../#{x}\"}\n @hax_mode = true\n additional = dot_dot_names.map do |basename|\n if File.file?(basename) # was different\n load_objects(basename, 'item', Nanoc3::Item)\n else\n load_objects(basename, 'item', Nanoc3::Item)\n end\n end.compact.flatten(1)\n @hax_mode = false\n error_for_no_files(dot_dot_names) if additional.empty?\n res = these + additional\n orphan_rescue(res)\n res\n end", "def initialize\n @files = []\n end", "def generate_file_list\n self.file_list = Concurrent::Array.new\n targets.each do |target|\n add_target(target)\n end\n end", "def download(path, item)\n Download.download item.link, path\n Logger.instance.info \"Downloaded file #{item.title}\"\n @history.save item\n end", "def set_filetypes\n #unless params[:id] == 'download' || params == :file\n @filetype = Filetype.find(params[:id])\n # end\n end", "def initialize(cmd_switch, plucked_out_items_csv, plucked_out_dir)\n @cmd_switch = cmd_switch\t# What type of field-processing will be done\n\n # Items which have already been plucked out of the RMIS SAF tree because\n # they already exist in the DB. Hence these items were not included in\n # the SAF import.\n @plucked_out_items_csv = plucked_out_items_csv\n @plucked_out_dir = plucked_out_dir\n\n @items_from_saf = {}\t# SAF item list with focus on specified field\n gather_from_plucked_saf\n\n @items_from_db = {}\t\t# DB item list with focus on specified field\n @langs_in_db = Set.new\t# DB language used for specified field\n gather_from_db\n\n @csv_info = {}\t\t# Subset of items which need specified field updated\n end", "def initialize( *items )\n\t\tif items.length == 1 && items[0].is_a?( Enumerable )\n\t\t\t@items = items[0]\n\t\telse\n\t\t\t@items = items\n\t\tend\n\n\t\t@iteration = nil\n\t\t@lastItem = nil\n\t\t@item \t = nil\n\t\t@nextItem = nil\n\t\t@iterating = false\n\t\t@skipped = false\n\t\t@marker = nil\n\tend", "def index\n authorize! :read, Item\n @global_folder = Folder.global_root\n @user_folder = Folder.user_root(current_user)\n @shared_folders = Folder.shared_for(current_user)\n @current_folder_id = params[:folder]\n @current_folder = Folder.where(id: @current_folder_id).first\n\n @current_folder ||= if @current_folder_id.nil?\n @user_folder\n elsif @current_folder_id == 'global'\n @global_folder\n end\n\n authorize!(:download, @global_folder) if @current_folder == @global_folder\n\n @current_folder_id = @current_folder_id.to_sym if @current_folder.nil? and @current_folder_id.present?\n\n @item = Item.new(folder: @current_folder, user: current_user)\n\n if @current_folder\n @subfolders = @current_folder.subfolders.scoped\n @items = Item.where(folder_id: @current_folder.try(:id))\n elsif @current_folder_id == :shared\n @subfolders = @shared_folders\n @items = Item.shared_for(current_user)\n elsif @current_folder_id == :transfers\n @subfolders = []\n if params.has_key?(:history) and params[:history] == 'true'\n @items = current_user.transfers\n else\n @items = current_user.transfers.active\n end\n end\n\n @empty_list = (@subfolders + @items).size == 0\n\n if params.has_key?(:sort)\n column = (params[:sort][:column] || :name).to_sym\n order = (params[:sort][:dir] || :asc).to_sym\n if [:name, :size, :date].include?(column)\n @items = @items.sort_by { |i| i.send(column) }\n @items.reverse! if order == :desc\n end\n if [:name, :date].include?(column)\n @subfolders = @subfolders.sort_by { |i| i.send(column) }\n @subfolders.reverse! if order == :desc\n end\n end\n\n unless [:shared, :transfers].include?(@current_folder_id)\n @folder = Folder.new parent: @current_folder, user: current_user, global: @current_folder.try(:global)\n end\n\n respond_to do |format|\n format.html { render layout: !request.xhr? }\n end\n end", "def process_value(item)\n attachment_types = ['madb_swf_attachment', \n 'madb_file_attachment', \n 'madb_s3_attachment']\n \n if attachment_types.include? item[:data_type]\n download_url = \"#{request.protocol}#{request.host}#{request.port_string}/app/file_attachments/download/#{item[:id]}\"\n \n file_props = YAML::load item[:value]\n file_props[:download_url] = download_url\n item[:value] = file_props\n end\n return item[:value]\nend", "def index_item_set(all_items, o={})\n puts \"Indexing #{all_items.size} items...\" ; cur_docs = 0\n #Searcher.load_features() if !$clf\n all_items.in_groups_of(FileCollector::FILES_IN_BATCH) do |batch|\n items = batch.find_all{|d|d}\n\n #read contents\n if o[:download]\n $idx.read_files(items.find_all{|d|d.itype =~ /file/ && !d.content})\n items.each{|d| $idx.read_webpage(d) if d.itype =~ /webpage|concept/ && d.uri =~ /^http/}\n end\n #run indexing\n items.each{|d|$idx.index_item(d)}\n cur_docs += batch.size\n puts \"#{cur_docs} / #{all_items.size} finished\"\n end\n end", "def download(local, item)\n if item[:bundled] then\n warning \"Not downloading into bundled item #{synckey(item)}\"\n return\n end\n local.dirname.mkpath\n id = item[@itemkey.to_sym]\n if id.nil? then\n debug \"!!! Missing '#{@itemkey}', using :id instead!\"\n debug \":id => #{item[:id]}\"\n id = item[:id]\n raise \"Both #{@itemkey} and id in item are nil!\" if id.nil?\n end\n local.open('wb') do |io|\n fetch(id) do |chunk|\n io.write chunk\n end\n end\n end", "def check_downloads\n @download_manager.done.each do |wrapper, download|\n entry = wrapper.entry\n receiver = wrapper.receiver\n if download.error?\n entry.status.error!(download.message)\n @link_table.update(entry)\n elsif download.successful?\n result = download.result\n if receiver.add(result[:url], result[:name], result[:cookies])\n download.change_status(:success, nil, \"added to #{receiver.name}\")\n else\n download.change_status(:error, nil, \"could not add URL to #{receiver.name}\")\n end\n end\n end\n end", "def initialize(*args)\n super\n self.items ||= []\n end", "def populate_list_of_files_from_file(file_list, entry)\n logger.debug \"\\\"#{entry}\\\" is a file. Processing...\"\n file_list << entry\n # Find images if any\n Find.find(File.dirname(entry)) do |file|\n file_list << file if (File.file?(file) && is_image?(file))\n end\n end", "def review_items\n @dialog.setSubStatusAndLogIt('Finding items to review')\n @dialog.setSubProgress(0)\n items = add_status('endpoint')\n unless @items['endpoint-attach'].empty?\n items.concat(add_status('endpoint-attach'))\n items.concat(add_attachments)\n end\n @dialog.setSubProgress(1, 1)\n items\n end", "def download_response_files!\n files_downloaded = []\n File.makedirs(cache_location + '/returns')\n with_ftp do |ftp|\n files = ftp.list('*.csv')\n files.each do |filels|\n size, file = filels.split(/ +/)[4], filels.split(/ +/)[8..-1].join(' ')\n ftp.get(file, cache_location + '/returns/' + user_suffix + '_' + file)\n files_downloaded << file\n end\n end\n files_downloaded\n end", "def load_items\n @items = []\n data_sources.each do |ds|\n items_in_ds = ds.items\n items_in_ds.each { |i| i.identifier = File.join(ds.items_root, i.identifier) }\n @items += items_in_ds\n end\n\n @items_loaded = true\n end", "def initialize\n @items = []\n end", "def download!\n folder = \"tmp/#{self.order_code}_\" + Time.now.strftime('%Y%m%d%H%M%S%L')\n files = []\n\n # check if the directory existence\n # create the directory if it does not exist yet\n Dir::mkdir(folder) if Dir[folder].empty?\n\n xml_file = to_xml(folder)\n\n files << xml_file\n \n self.order_items.each_with_index do |o_i, index|\n next if o_i.photo.nil? || o_i.photo.image_file_name.nil?\n\n o_photo_url = o_i.photo.image.url\n\n o_photo = open(o_photo_url, &:read)\n\n File.open(\"#{folder}/#{index}_#{o_i.photo.image_name}\", 'wb') do |file|\n file << o_photo\n end\n\n files << \"#{folder}/#{index}_#{o_i.photo.image_name}\"\n end\n \n File.open(\"#{folder}/message.txt\", 'wb') do |file|\n file << \"\"\n end\n files << \"#{folder}/message.txt\"\n\n ## zip\n Zip::File.open(\"#{folder}.zip\", Zip::File::CREATE) do |zipfile|\n files.each do |file|\n zipfile.add(file.split(\"/\").last, file)\n end\n end\n\n FileUtils.rm_rf(folder)\n\n \"#{folder}.zip\"\n end", "def download links\n # Start downloading files in pool\n links.map do |file|\n next if Duplicate.downloaded? file\n downloader.perform do\n link = \"#{self.uri}/#{file}\"\n puts \"Worker thread #{Thread.current.object_id} is downloading #{file}. Wait\".colorize(:blue)\n # Create new agent for each worker\n browser = Mechanize.new\n browser.pluggable_parser.default = Mechanize::Download\n browser.get(link).save(\"./tmp/#{file}\")\n puts \"Done. #{file}\".colorize(:green)\n Duplicate.save! file # Don't redownload file\n self.enqueue(file)\n end\n end\n\n # Cool down\n downloader.dispose(10) do\n puts \"[Downloader] Worker thread #{Thread.current.object_id} is shutting down.\".colorize(:yellow)\n end\n end", "def download_list\n task = params[:task]\n files = []\n\n case task\n when DOWNLOAD_ACTION, OPEN_ACTION, COPY_ACTION, COPY_TO_PRIVATE_ACTION\n nodes = Node.accessible_by(@context).where(id: params[:ids])\n nodes.each { |node| files += node.is_a?(Folder) ? node.all_files : [node] }\n when PUBLISH_ACTION\n nodes = Node.editable_by(@context).\n where(id: params[:ids]).\n where.not(scope: UserFile::SCOPE_PUBLIC)\n nodes.each do |node|\n files += if node.is_a?(Folder)\n node.all_files(Node.where.not(scope: UserFile::SCOPE_PUBLIC))\n else\n [node]\n end\n end\n when DELETE_ACTION\n nodes = Node.editable_by(@context).where(id: params[:ids]).to_a\n files += nodes\n nodes.each { |node| files += node.all_children if node.is_a?(Folder) }\n files.filter! { |file| file.scope == params[:scope] }\n else\n raise ApiError, \"Parameter 'task' is not defined!\"\n end\n\n render json: files,\n each_serializer: FileActionsSerializer,\n scope_name: params[:scope] || SCOPE_PRIVATE,\n action_name: task\n end", "def initialize(items, options = {})\n @items = items\n @options = options\n @columns = []\n @action_columns = []\n process_options\n end", "def initialize(list_title)\n @title = list_title\n @items = Array.new\n end", "def download_files files,dest,opts = {}\n unless @started\n Logger.<<(__FILE__,\"ERROR\",\"FileManager is not started yet !\")\n abort\n end\n str = \"Will download #{files.size} files to #{dest} ... \"\n download_all_files files,dest\n str += \" Done !\"\n Logger.<<(__FILE__,\"INFO\",str) if opts[:v]\n end", "def initialize\n @items = []\n end", "def download\n @item = Item.find(params[:id])\n if @item.item_type != 1\n if !@package.custom_key\n aes_key = Base64.decode64(@package.encrypted_key)\n data = s3_downloader(\"#{ENV['AWS3_BUCKET_PREFIX']}#{@item[:package_id]}\", @item.file_name, aes_key)\n else\n data = s3_downloader(\"#{ENV['AWS3_BUCKET_PREFIX']}#{@item[:package_id]}\", @item.file_name)\n end\n if data.nil?\n flash[:notice] = \"An error has occurred, please try again later !\"\n else\n send_data(data, :filename => @item.file_name, :type => @item.file_content_type)\n end\n end\n #redirect_to\n end", "def setup_items(name, *items)\n base_remove_const(name) if base_const_defined?(name)\n base_const_set(name, items.flatten)\n end", "def setup_items(container)\n container.item :users, 'Users', '/users', html: { id: 'users_id' }, link_html: { id: 'users_link_id' }\n container.item :invoices, 'Invoices', '/invoices' do |invoices|\n invoices.item :paid, 'Paid', '/invoices/paid'\n invoices.item :unpaid, 'Unpaid', '/invoices/unpaid'\n end\n container.item :accounts, 'Accounts', '/accounts', html: { style: 'float:right' }\n container.item :miscellany, 'Miscellany'\n\n container.items.each do |item|\n allow(item).to receive_messages(selected?: false, selected_by_condition?: false)\n\n if item.sub_navigation\n item.sub_navigation.items.each do |item|\n allow(item).to receive_messages(selected?: false, selected_by_condition?: false)\n end\n end\n end\n end", "def perform\n # before downloading we have to check if file exists. checkfiles service\n # also gives us information for the download: hostname, file size for\n # progressbar\n return self unless self.check\n\n file = open(File.join(@downloads_dir, @filename), 'wb')\n block_response = Proc.new do |response|\n downloaded = 0\n total = response.header['content-length'].to_i\n\n unless total == @filesize\n @error = 'Access denied'\n return self\n end\n\n response.read_body do |chunk|\n file << chunk\n downloaded += chunk.size\n progress = ((downloaded * 100).to_f / total).round(2)\n yield chunk.size, downloaded, total, progress if block_given?\n end\n end\n\n RestClient::Request.execute(:method => :get,\n :url => self.download_link,\n :block_response => block_response)\n file.close()\n @downloaded = true\n self\n end", "def make_item_list\n end", "def initialize(item_types)\n @types = item_types\n end", "def init_filedata(file_index)\r\n @file_index = file_index\r\n @time_stamp = Time.at(0)\r\n @file_exist = FileTest.exist?(@filename)\r\n @selected = false\r\n end", "def initialize()\n\t\t@items = nil\n\t\t@copies = nil\n end", "def list\n ret = get()\n return [] if ret.is_a? Hash and ret.has_key? :error\n ret.map{|i| FileItem.new(i)}\n end", "def set_item\n @item = model.find(params[:id])\n\n @url_back = url_list\n end", "def initialize\n @items = []\n end", "def fetch_items(options = {})\n options = options.reverse_merge(:enable_max_items_per_fetch => true,\n :enable_last_fetched_item_url => true ,\n :enable_max_pages_per_fetch => true)\n\n logger.info \"now fetching: #{source_website.name}\"\n if status == RUNNING\n warning = \"the source_website #{source_website.name} is being fetched... please stop it if you want another fetch\"\n logger.info warning\n raise warning\n end\n if invalid_item_list_css?\n warning = \"the source_website #{source_website.name} seems has no entries, is the css: /#{source_website.items_list_css}/ correct? \"\n logger.info warning\n raise warning\n end\n update_attribute(:status, RUNNING)\n logger.debug \"-- last_fetched_item_url: \"\n logger.debug \"-- \\n #{last_fetched_item_url.split(LAST_N_URL_SEPARATOR).join(\"\\n\")}\" unless last_fetched_item_url.blank?\n begin\n fetch_items_list_strategy(options)\n rescue Exception => e\n puts \"exception: #{e}, more details, please check the log\"\n logger.error e\n logger.error e.backtrace.join(\"\\n\")\n ensure\n update_attribute(:status, \"\")\n save_last_fetched_info\n end\n end", "def download_files\n files = @settings['files']\n gd = GoogleDownloader.new @settings\n\n files.each do |target_file, file_id|\n target_file = target_file + \".yml\" if target_file !~ /\\.yml$/\n response = gd.download target_file, @tmp_folder, file_id\n @csv_files[target_file] = csv_convert(target_file)\n end\n end", "def files=(list)\n @files = makelist(list)\n end", "def test_files=(list)\n @test_files = list\n end", "def initialize()\n @items = nil\n end", "def initialize(list_title)\n @title = list_title\n @items = Array.new # Starts empty! No Items yet!\n @tdate = Time.now.strftime(\"%m/%d/%Y\") # Todays' Date\n end", "def initialize\n super\n @type = \"files\"\n @restore_name = \"RestoreAutomation-#{Time.now.strftime(\"%Y%m%d-%H%M%S\")}\"\n @track_num = \"#{Time.now.strftime(\"%YD%m%dR%H%M%SCC\")}\"\n @include_deleted = false\n @restore_date = \"#{Time.now.strftime(\"%m/%d/%Y\")}\"\n @restore_type = \"\"\n @num_files = \"\"\n @partner_id = \"\"\n @machine_id = \"\"\n @restore_id = \"\"\n @use_company_info = true\n @dvd_to_biz = true\n @address_info = AddressInfo.new\n @credit_card = CreditCard.new\n end", "def initialize\r\n self.items = []\r\n end", "def setup(list_name, items_text, current_user, current_admin = nil)\n self.current_user = current_user\n self.current_admin = current_admin\n self.list_name = list_name\n return unless authorized? == true\n\n raise(FphsGeneralError, 'no items selected') if items_text.blank? || items_text.empty?\n\n # Parse the items_text to get an array of hashes, each item representing a user selection change\n # This follows the JSON represented in the complex report column value, formatted as\n # {\"list_id\": \"<list_id>\",\n # \"type\":\"q2_datadic\",\n # \"id\": <source.id>,\n # \"from_master_id\": -1,\n # \"init_value\": true | false }\n self.items = items_text.map { |i| JSON.parse(i) }\n item_ids = items.map { |i| i['id'] }\n\n # Ensure there is only a single type being represented in the list\n source_types = items.map { |i| i['type'] }.uniq\n self.source_type = source_types.first\n raise(FphsGeneralError, 'source type not specified') unless source_types.length == 1 && source_type\n\n # Ensure there is only a single list ID being represented in the list\n list_ids = items.map { |i| i['list_id'] }.uniq\n self.list_id = list_ids.first\n raise(FphsGeneralError, 'list id not specified') unless list_ids.length == 1 && list_id\n\n # Use the optional *on_attr:* value to specify an alternative field to check the list against.\n # For example, this allows master_id to be specified, tying lists to master records rather than\n # dynamic definition records. By default we assume the id field will be used.\n self.list_on_attr = items.first['on_attr'] || 'id'\n\n check_authorizations!\n check_valid_list_id!\n\n # Remove the initial item that provides details about the list if nothing else is returned\n items.delete_if { |i| i['id'].nil? }\n item_ids.compact!\n\n items_in_list_record_ids = items_in_list.pluck(:record_id)\n items_in_list_ids = items_in_list.pluck(:id)\n\n self.item_ids_in_list = item_ids & items_in_list_ids\n self.new_item_ids = item_ids - items_in_list_record_ids\n self.removed_item_ids = items_in_list_record_ids - item_ids\n\n self\n end", "def initialize(lists = nil)\n\t\t\t\tif !lists.nil?\n\t\t\t\t\t@lists = lists\n\t\t\t\tend\n\t\t\t\t@file_type = 'CSV'\n\t\t\t\t@sort_by = 'EMAIL_ADDRESS'\n\t\t\t\t@export_date_added = true\n\t\t\t\t@export_added_by = true\n\t\t\t\t@column_names = ['Email Address', 'First Name', 'Last Name']\n\t\t\tend", "def write_file_list\n if EventMachine.reactor_thread? || !@update_lock.locked?\n raise 'Should not write file list in reactor thread or without' \\\n ' the local list lock!'\n end\n\n FileUtils.mkdir_p config.config_dir\n @local_file_list.root['CID'] = SecureRandom.hex(12).upcase\n output = @local_file_list.to_s(:indent => true)\n Bzip2::Writer.open(local_file_list_path, 'wb') { |f| f << output }\n @share_size = nil\n\n output = Marshal.dump([@local_file_info, @shared_directories])\n File.open(cache_file_list_path, 'wb'){ |f| f << output }\n end", "def initialize(data) #data.length on data array is 20, for the keyword \"banana\"...i just chose [0] from the data array ...should it be an each loop here instead? Is that what they meant by the 20 favorite? :/\n @item_id = data.id\n @name = data.name #this is weird...do a raise and look at it\n @type = data.type\n @image_url = #there are multiple url's in the image hash\n if data.type == \"track\" && data.album.images.present?\n data.album.images[0][\"url\"]\n else\n #PLACEHOLDER_IMG_URL\n @url = data.external_urls.values[0]\n end\n @uri = data.uri\n\n end", "def process_download(options = {})\n @download = Download.process(self, options)\n end", "def reset_data_file_download_status\n self.downloaded = false\n self.downloaded_at = nil\n self.downloading = true\n self.failed = false\n self.pid = nil\n self.save!\n end", "def initialize(list_file, target_uri)\n @list_file = list_file\n @target_uri = target_uri\n @expired_src = {}\n @expired_dst = {}\n @update_count = 0\n load\n end", "def initialize(name, items, options={})\n @name = name\n @items = items\n @options = options\n end", "def request_item\n if is_downloadable?\n if is_viewable?\n respond_to do |format|\n format.html do\n flash[:notice] = 'File retrieval request received.'\n redirect_to(\n recall_bendo_item_path(id: noid),\n status: :found\n )\n end\n format.json { json_api_response }\n end\n else\n respond_to do |format|\n format.html do\n flash[:alert] = \"You are not permitted to view the item with ID: #{noid}\"\n redirect_to recall_bendo_item_path(id: noid)\n end\n format.json { json_unauthorized_response }\n end\n end\n else\n respond_to do |format|\n format.html do\n flash[:alert] = \"No files can be downloaded for ID: #{noid}\"\n redirect_to recall_bendo_item_path(id: noid)\n end\n format.json { json_not_found_response }\n end\n end\n end", "def initialize(list_title)\n @title = list_title\n @items = Array.new\n end", "def downloaded\n files_list = []\n files = session[:user].x_files.all(:downloads.gte => 1, uploaded: true)\n files.each { |file| files_list.push(file.description(session[:user])) }\n @result = { files: files_list, success: true }\n end", "def initialize(uri, factory, parent = nil, json: nil, ld: nil)\n\n # Set properties from the Reading Lists API\n # - this must be called before the superclass constructor so that item details are available\n json = self.set_data(uri, factory, json)\n\n super(uri, factory, parent, json: json, ld: ld)\n\n # Set properties from the Linked Data API data\n set_linked_data(uri, factory, ld)\n\n end", "def setup_list_items\n all_recs = []\n\n item_attribs = source_class.permitted_params\n list_attribs = list_class.permitted_params\n\n matching_attribs = (list_attribs & item_attribs).map(&:to_s)\n raise(FphsGeneralError, 'no matching attributes') if matching_attribs.empty?\n\n source_class.where(id: new_item_ids).each do |item|\n id = item.id\n if item.attribute_names.include? 'master_id'\n master = item.master\n master.current_user = current_user\n end\n matched_vals = item.attributes.slice(*matching_attribs)\n matched_vals[:record_id] = id\n matched_vals[:record_type] = full_source_type_name\n matched_vals[:master_id] = from_master_id unless list_class.no_master_association\n matched_vals[assoc_attr] = list_id\n new_list_instance = list_class.new(matched_vals)\n new_list_instance.send :write_attribute, :user_id, current_user.id\n all_recs << new_list_instance\n end\n all_recs\n end", "def initialize(item_description)\n @description = item_description\n @completed = false\n end", "def generate_file_data(format, cgi, item_entry, item, download_allowed)\n file_data = \"\"\n file_metadata = generate_item_metadata(format, cgi, item_entry)\n \n case format.downcase\n when \"html\"\n file_data += cgi.li(\"class\" => \"file\"){ \n cgi.div(\"class\" => \"file_item\") do\n cgi.div(\"class\" => \"item_data\") do\n \"<b>File: </b>\" + cgi.a(location_string(item_entry.contributable_type, item.id)){item.title} + \n (download_allowed ? (\"&nbsp;&nbsp;&nbsp;[ \" + cgi.a(\"./files/\" + item.local_name){\"open local copy\"} + \" ]\") : \"\") + \"<br/>\" +\n uploader_string(item.contributor_type, item.contributor_id, true) + \"<br/>\"\n end +\n file_metadata\n end\n }\n \n when \"text\"\n file_data += \"+ File: #{item.title}\"\n if download_allowed\n file_data += \" (local copy: files/#{item.local_name})\"\n end\n file_data += \"\\n Location: \" + location_string(item_entry.contributable_type, item.id)\n file_data += \"\\n \" + uploader_string(item.contributor_type, item.contributor_id, false) + \"\\n\"\n file_data += file_metadata\n \n else\n return \"ERROR\"\n end\n \n return file_data\n end", "def initialize(args)\n\n item_id = args[:item_id]\n @batch = args[:batch] || ClearanceBatch.new\n @file = args[:file]\n @errors = []\n @notices = []\n @batch_ids = []\n\n process_csv if @file\n process_item(item_id) if item_id && !@file\n\n end", "def initialize_items\n find_printed_items\n find_slug_items\n find_categories\n end", "def prepare_files\n return if temp_files.blank?\n\n restrict_to_single_file! if pagefile?\n\n temp_files.each do |file|\n files.build(\n site: blockable.site,\n dimensions: tag.try(:dimensions),\n file: file\n )\n end\n end", "def get_file_list(sequence_type,site_name)\n\n case sequence_type\n when 'asm'\n ftp_url = \"#{FTP_BASE_URLS['asm']}/#{site_name}/\"\n\n # get a file list from the FTP directory listing\n LOG.info \"Checking file list on FTP server at #{ftp_url} ...\"\n curl_res = `curl -l --progress-bar #{ftp_url}`\n print \"\\n\"\n\n file_list = curl_res.split(/\\n/).map { |f| \"#{ftp_url}#{f}\" }\n when 'rrna'\n require 'csv'\n ftp_url = \"#{FTP_BASE_URLS['rrna']}/\"\n\n # parse sample IDs from TSV sample ID map\n # linked from http://hmpdacc.org/micro_analysis/microbiome_analyses.php\n sample_ids_url = \"#{CONF_DIR}/ppAll_V35_map.txt\"\n file_list = CSV.new(File.open(sample_ids_url), { :headers => :first_row, :col_sep => \"\\t\" })\n .select { |line| line[-3] == site_name.capitalize && line[5] != 'Unavailable' }\n .map { |line| \"#{ftp_url}#{line[7]}.fsa.gz\" }\n .sort\n .uniq\n else\n raise \"Unknown sequence type '#{sequence_type}' requested.\"\n end\n\n file_list\n\nend", "def bootstrap\n return if File.exist?(file)\n @items = [Taco::Item.new('Add an item! @empty')]\n save\n end", "def getlist(url)\n @url = url\n doc = Nokogiri::HTML(open(@url))\n # @fileset = doc.css(\"td a\")[1..-1]\n @fileset = doc.css(\"td a\")[1,1] #revert to above after testing\n @fileset.each do |item|\n @docname = item.text\n puts \"Downloading #{@docname}\"\n # download the zip files\n download(@url, @docname, \"/vagrant/src/ruby/JobSearch/nuvi/download/\")\n # unzip(@docname, @downloadpath)\n @zipcount += 1\n end\n @zipcount == @fileset.length ? (puts \"Retrieved #{@zipcount} zip files.\") : (puts \"missed a few\")\nend", "def setupTicketsList\n require 'tmpdir'\n lTicketsFileName = \"#{Dir.tmpdir}/WEACE_Tickets_#{Thread.current.object_id}.lst\"\n File.open(lTicketsFileName, 'w') do |oFile|\n oFile << 'TicketID 1\nTicketID 2\nTicketID 3'\n end\n yield(lTicketsFileName)\n File.unlink(lTicketsFileName)\n end", "def initialize dir, tracks\n @path = dir\n\n @files = tracks.map { |e| e }\n\n @selected_files = @files.slice(0, @files.size).to_set\n end", "def file_list\n @file_list\n end", "def init_list!\n write! unless File.exist?(path)\n @init_mtime = File.mtime(path)\n content.deep_merge!(\n MultiJson.load(\n File.open(path, \"r\") do |file|\n file.flock(File::LOCK_SH)\n file.read\n end\n )\n )\n end", "def each_item\n self.file.state.items.each_pair do |identifier, path|\n yield Item::new(self, identifier, path)\n end\n end", "def download_thread\n Thread.new do\n file = nil\n until @download_list.empty?\n @download_mutex.synchronize do\n file = @download_list.pop\n end\n next if file.nil?\n # AWS stores directories as their own object\n next if file.content_length == 0 && file.key =~ /\\/$/\n\n tmp = Tempfile.new(file.object_id.to_s)\n @source_container.files.get(file.key) do |data, rem, cl|\n tmp.syswrite(data)\n end\n tmp.flush\n tmp.rewind\n @upload_mutex.synchronize do\n @upload_list.push(body: tmp, key: file.key)\n end\n end\n end\n end", "def fetch_all\n downloaded = 0\n megabyte = 1024 * 1024\n mb_down = 0\n File.open(@file, 'wb+') do |file|\n @downloader.parts do |part|\n begin\n @server.request_get(part, @headers) do |res|\n res.read_body do |body|\n file.write body\n end\n end # /@server\n rescue Timeout::Error, EOFError, Errno::ECONNRESET => exception\n yield -1\n @server = Net::HTTP.start(@base_url.host, @base_url.port)\n STDERR.puts \"Connection error...\"\n retry\n end\n\n yield part\n end # /parts\n end # /File\n end", "def load_items\n YAML.load_file(file).each do |key, texts|\n texts.each do |text|\n if key.to_s == @options[:filter] || @options[:filter].nil?\n @items << Item.new(\"#{text} #{key}\") if key.to_s != '@done'\n end\n end\n end\n @items\n end", "def parse_files_for_download\n files = get_files_for_download # now a hash\n\n unless files.present?\n return \"\"\n else\n files.each_pair do |file, s3_needed|\n # Use Yajl JSON library to parse the log files, as they contain multiple JSON blocks\n parser = Yajl::Parser.new\n @read_from_s3 = s3_needed\n json = get_json_from_log_file_for_download(file)\n parser.parse(json) do |log|\n @jsons << log\n end\n sort_jsons\n end\n end\n end", "def fetch_and_store!\n # Get links from page\n # Download files from links concurrently\n download self.extract!\n end" ]
[ "0.7192753", "0.5699413", "0.5591785", "0.5428122", "0.53840667", "0.53437716", "0.53226024", "0.5298365", "0.5285891", "0.52695596", "0.52055764", "0.5192494", "0.5182384", "0.5180816", "0.5177297", "0.517034", "0.51582044", "0.51190865", "0.510657", "0.50914764", "0.50914764", "0.5090937", "0.50748223", "0.50676954", "0.5064648", "0.50552636", "0.5049679", "0.50399286", "0.5008075", "0.500719", "0.5005684", "0.49996355", "0.4995722", "0.49911398", "0.49884763", "0.49872455", "0.49847", "0.49690783", "0.49613938", "0.4956222", "0.49546018", "0.49439028", "0.49296555", "0.49253747", "0.49083984", "0.49057615", "0.49045044", "0.4903879", "0.48977634", "0.48910242", "0.48809594", "0.48698956", "0.48668638", "0.48632172", "0.48620647", "0.4858994", "0.48554844", "0.4854718", "0.4845777", "0.48376736", "0.48330984", "0.48304546", "0.48148578", "0.4807979", "0.48055875", "0.4800112", "0.4796579", "0.4795736", "0.4795367", "0.47952396", "0.47849533", "0.4780887", "0.47687435", "0.47680423", "0.4762969", "0.47627762", "0.47573915", "0.47543404", "0.4753759", "0.4746079", "0.47412896", "0.47411817", "0.4736323", "0.47344565", "0.4734033", "0.47325194", "0.47242138", "0.47238898", "0.4715411", "0.4712533", "0.47106352", "0.46986863", "0.46874657", "0.46866074", "0.46839452", "0.46787304", "0.467606", "0.46737897", "0.46714064", "0.46662003" ]
0.73778343
0
return the class for the current item handles namespace if the item is like an ActivityLog:Something
def primary_model NfsStore::Manage::Container end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def item_type\n self.class.name.singularize.ns_underscore\n end", "def item_class\n item_type&.classify&.constantize\n end", "def get_type(item)\n \t\t\treturn item.class.name.split(\":\").last\n \t\tend", "def item_type\n name.singularize.ns_underscore\n end", "def item_class\n @item_class || self.superclass.get_item_class\n end", "def activity_type(activity)\n activity.item.class.to_s \n end", "def activity_type(activity)\n activity.item.class.to_s \n end", "def klass\n info.klass\n end", "def activity_type(activity)\n activity.item.class.to_s\n end", "def to_class(item)\n return item if item.nil? || item.is_a?(Class)\n name = item.is_a?(Symbol) ? item.to_s : item\n name = name.class.to_s unless name.is_a?(String)\n name.underscore.delete_suffix('_controller').classify.safe_constantize or\n Log.warn { \"#{__method__}: invalid: #{item.inspect}\" }\n end", "def klass\n class_name = self[\"_type\"]\n class_name ? class_name.constantize : nil\n end", "def full_implementation_class_name\n full_item_type_name.ns_camelize\n end", "def record_class_for(item)\n return item if Record.model_class?(item)\n return item.class if Record.model_class?(item.class)\n Upload\n end", "def item_class\n if klass = (@__item_class__ || self.class.instance_variable_get(:@__item_class__))\n klass\n else\n raise CollectionError.new(\"Item class not found for %s.\" % self)\n end\n end", "def class_name\n self.class.to_s.split('::').last\n end", "def className\r\n self.class.to_s\r\n end", "def className\n\t\tself.class.to_s\n\tend", "def className\n\t\tself.class.to_s\n\tend", "def className\r\n\t\tself.class.to_s\r\n\tend", "def item_type_path\n self.class.name.pluralize.underscore\n end", "def klass\n object_name.classify.constantize\n end", "def current_class_name\n @klass.to_s\n end", "def class\n object.class\n end", "def type\n @type ||= self.class.name.split('::').last\n end", "def class_name\n self.class.name.split(\"::\").last\n end", "def type; self.class.name.split('::').last.to_sym; end", "def klass\n @object.name if (defined? @object.class.name)\n end", "def item\n item_type.name.classify.constantize.find(item_id)\n end", "def class_name\n self.class == Class ? self.name : self.class.name\n end", "def class_name\n self.class.class_name\n end", "def _class\n special_attribute('@class'.freeze) || self.class.name.demodulize\n end", "def class\n @object.class\n end", "def class_name\n self.class.to_s\n end", "def class_name\n self.class.to_s\n end", "def klass\n self.class\n end", "def class_for(fragment, *args)\n item_class = class_from(fragment, *args) or raise DeserializeError.new(\":class did not return class constant.\")\n item_class.new\n end", "def klass\n type.to_s.classify.constantize\n end", "def class_name\n klass = single_class\n while klass.name == ''\n klass = klass.superclass\n end\n if list_context?\n \"[#{klass}]\"\n else\n klass.name\n end\n end", "def namespace\n self.class.namespace\n end", "def class_name\n self.class.name.split(\"::\").last.downcase\n end", "def class_obj\n self.class\n end", "def classname\n @classname ||= self.class.name.split(\"::\")[1..-1].join(\"::\")\n end", "def _namespace_class(ns)\n return unless ns\n Ing::Util.decode_class(ns.gsub(/:$/,\": \"))\n end", "def type\n klass = self.class.name\n if sep = klass.rindex('::')\n klass[(sep+2)..-1]\n else\n klass\n end.underscore.to_sym\n end", "def from_namespace(item)\n unless item.is_a?(String)\n if item.is_a?(Module) || item.is_a?(Class) || item.is_a?(Symbol)\n item = item.to_s\n else # Assume to be an object instance in this case\n item = item.class.to_s\n end\n end\n namespace = item.split('::').first\n @apps_by_namespace ||= {}\n @apps_by_namespace[namespace] ||= begin\n return Origen.app if Origen.app.namespace == namespace\n\n Origen.app.plugins.each do |plugin|\n return plugin if plugin.namespace == namespace\n end\n nil\n end\n end", "def type\n self.class.class_name.downcase\n end", "def klass\n reflection.klass\n end", "def klass\n reflection.klass\n end", "def get_class()\n l = get_type()\n #puts \"Type #{l.class} in #{self.class} , #{self}\"\n l.object_class()\n end", "def get_class()\n l = get_type()\n #puts \"Type #{l.class} in #{self.class} , #{self}\"\n l.object_class()\n end", "def class_name\n (self.type.to_s || self.class.name).demodulize\n end", "def type_name\n self.class.name.split('::').last.upcase\n end", "def type_as_class(resource_name)\n\t resource_name.singularize.capitalize.constantize\n\tend", "def menu_item_class(menu_item_title)\n @current_archive == Archive.ada && menu_item_title == @title ? \"current\" : \"\"\n end", "def feed_class(feed)\n return '' if feed.service.blank?\n \n if feed.service.photo?\n \"feed-photos\"\n elsif feed.service.bookmark?\n \"feed-bookmarks\"\n elsif feed.service.video?\n \"feed-videos\"\n elsif feed.service.music?\n \"feed-music\"\n end\n end", "def type\n return @type if @type\n @type = 'item' if rss.css('item').count > 0\n @type = 'entry' if rss.css('entry').count > 0\n return @type\n end", "def namespace\n self.class.namespace\n end", "def full_item_type_name\n prefix = ''\n prefix = \"#{self.class.implementation_prefix.ns_underscore}__\" if self.class.implementation_prefix.present?\n\n \"#{prefix}#{implementation_model_name}\"\n end", "def repeatable_thing_class\n base_type = attr_json_registration.type.base_type\n if base_type.is_a?(AttrJson::Model)\n base_type\n else\n # Will return a symbol name, confusingly\n base_type.type\n end\n end", "def klass\n @klass ||= if self.cached && self.cached.is_a?(AridCache::CacheProxy::Result)\n self.cached.klass\n else\n object_base_class\n end\n end", "def klass\n @klass ||= class_name.constantize\n end", "def klass\n @klass ||= class_name.constantize\n end", "def return_classname(obj)\r\n obj.class.name.underscore\r\n end", "def class\n __getobj__.class\n end", "def class_name\n %x{\n var first = self[0];\n return (first && first.className) || \"\";\n }\n end", "def resource_class\n (self.class.name.split('::').last || '').downcase\n end", "def class_moniker\n self.class.moniker\n end", "def object_class\n self.class.object_class\n end", "def klass\n @klass ||= @parent unless @parent.is_a?(Scope)\n end", "def resource_klass\n resource_klass_name.constantize\n end", "def type\n self.class.name.split(':').last.downcase\n end", "def qualified_name\n self.class.name\n end", "def parent_namespace\n parent = self.to_s.split('::')[0..-2].join('::')\n if parent.empty?\n return Object\n else\n Object.const_get(parent)\n end\n end", "def type\n object.class.name\n end", "def type\n object.class.name\n end", "def type\n object.class.name\n end", "def type\n return @type if defined? @type\n\n @type = self.to_s.gsub(/.*::/, '')\n end", "def name\n @klass\n end", "def extract_namespace_and_scope type\n scope = :instance\n result = type.to_s.gsub(/<.*$/, '')\n if (result == 'Class' or result == 'Module') and type.include?('<')\n result = type.match(/<([a-z0-9:_]*)/i)[1]\n scope = :class\n end\n [result, scope]\n end", "def entries_class_name\n self.entries_class.to_s\n end", "def type\n return @type if defined? @type\n @type = self.to_s.gsub(/.*::/, '')\n end", "def resource_class\n @resource_class ||= self.class.to_s.split(\":\").last\n end", "def type\n self.class.to_s.split('::').last.downcase.to_sym\n end", "def atk_class\n return data.atk_class\n end", "def namespace\n self.class.new split(NAMESPACE_SEPARATOR).first\n end", "def class_info?; \"#{self.class.name}\" end", "def class_name\n return @options[:class_name] if not @options[:class_name].nil?\n class_main_found = false\n @catalog['resources'].each_with_index do |r,i|\n if r['type'] == 'Class' and r['title'] == 'main'\n class_main_found = true\n next\n end\n if class_main_found and r['type'] == 'Class'\n return r['title'].downcase\n end\n end\n end", "def current_class( class_code )\n self.classes.select{|c| c.class_code == class_code }.first\n end", "def record_name_for(item)\n record_class_for(item).name.demodulize.to_s\n end", "def klass\n @klass ||=\n if klass_name\n klass_name.constantize\n else\n nil\n end\n end", "def json_class_name\n [self.class.domain_module, self.class.name.demodulize].join('::')\n end", "def ar_class(type = nil)\n return ActiveNode::Base.node_class(type).ar_class if type\n @ar_class ||= superclass.try(:ar_class) rescue nil\n end", "def namespace\n @namespace ||= self.class.to_s.split('::').first.gsub('_', '').sub('Application', '')\n end", "def type\n self.class\n end", "def namespace\n @namespace || self.class.namespace\n end", "def active_link_class(item)\n active_class = 'active_menu_link'\n found = false\n case item.class.to_s\n when 'Project'\n found = true if (@project && @project == item) && (@stage.blank?)\n when 'Host'\n found = true if @host && @host == item\n when 'Recipe'\n found = true if @recipe && @recipe == item\n when 'User'\n found = true if @user && @user == item\n when 'Stage'\n found = true if @stage && @stage == item\n end\n \n if found\n active_class\n else\n ''\n end\n end", "def tag(namespace = '')\n namespace + self.class.to_s.split(/::/).last\n end", "def class_name; end", "def class_name; end", "def resource_klass_name\n resource_name.classify\n end", "def job_class(item = nil)\n item and super or @job_class ||= super(self)\n end" ]
[ "0.72199434", "0.7113705", "0.68576264", "0.6784852", "0.67243147", "0.6512567", "0.6512567", "0.65103424", "0.64893484", "0.64740723", "0.64421993", "0.64382684", "0.6437503", "0.62224096", "0.61740714", "0.61300004", "0.60859525", "0.60859525", "0.607752", "0.6059144", "0.6038686", "0.6004952", "0.59960824", "0.59892654", "0.59875536", "0.5973982", "0.5967419", "0.5966099", "0.59565365", "0.5954976", "0.5952898", "0.5925365", "0.59164953", "0.59164953", "0.5914947", "0.5897402", "0.5869287", "0.58401126", "0.5824828", "0.5822595", "0.5819741", "0.58139914", "0.58087397", "0.5807873", "0.57938266", "0.5771903", "0.5771806", "0.5771806", "0.5771631", "0.5771631", "0.57706386", "0.5766935", "0.57547164", "0.5754048", "0.5750708", "0.572679", "0.5718742", "0.5716306", "0.5686856", "0.5681554", "0.5681478", "0.5681478", "0.5681236", "0.56810975", "0.56620663", "0.5661489", "0.56601644", "0.56492406", "0.5638948", "0.5625568", "0.5620065", "0.56149775", "0.5609775", "0.56029326", "0.560117", "0.560117", "0.5594225", "0.55908096", "0.5589323", "0.55836904", "0.55766046", "0.5561698", "0.5554428", "0.5552323", "0.5546317", "0.553017", "0.55270743", "0.5525671", "0.55158675", "0.5513468", "0.55110663", "0.5505066", "0.55040455", "0.549482", "0.54907954", "0.54875946", "0.54873216", "0.54867834", "0.54867834", "0.5486493", "0.54781234" ]
0.0
-1
notice the double underscore for namespaced models to indicate the delimiter to remain consistent with the associations
def full_object_name 'nfs_store__manage__container' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def property_prefix\n # TODO: try to use the inverse relationship name if possible\n Extlib::Inflection.underscore(Extlib::Inflection.demodulize(parent_model.base_model.name)).to_sym\n end", "def ar_model_symbol\n ar_model.to_s.underscore.gsub(/\\//, '_')\n end", "def _model_full_namespace_in_str\n\t\t\t\treturn path if is_a_constant?(path)\n\t\t\t\tmodel_path = path.split(/\\/?models\\//)[1].gsub('.rb','')\n\t\t\t\tmodel_path.split('/').map { |token| camelize(token) }.join('::')\t\t\t\t\n\t\t\tend", "def sanitize_model_namespace( model )\n [ models_namespace, model.name.split(\"::\")[0...-1] ].flatten.compact.join(\".\")\n end", "def association_key\n return self unless include?('.')\n gsub('.', '_0_').gsub('_1_', '_0_')\n end", "def macro\n :belongs_to_related\n end", "def inverse_name\n super || Extlib::Inflection.underscore(Extlib::Inflection.demodulize(source_model.name)).to_sym\n end", "def bt_model(key,value)\n mdl = value[4..-2]\n if mdl.empty? then\n \" belongs_to :#{key}\"\n else\n \" belongs_to :#{key}, :class_name => '#{mdl}'\"\n end\n end", "def to_dot_for_belongs_to(assoc)\n if assoc.options[:polymorphic]\n %(\n \"#{assoc.class_name}\" [shape = \"record\"]\n \"#{constant_name}\" -> \"#{assoc.class_name}\" [headlabel=\"*\", taillabel=\"1\"]\n )\n else\n ''\n end\n end", "def revisable_association_name #:nodoc:\n revisable_class_name.demodulize.underscore\n end", "def model_association_name\n full_implementation_class_name.pluralize.ns_underscore.to_sym\n end", "def derive_relationship_model(input)\n input.match(/(Class)?\\/([a-z\\-\\/\\_]+)$/)[-1].split(separator).map{|i| ActiveSupport::Inflector.classify(i) }.join(\"::\")\n end", "def inverse_name\n Extlib::Inflection.underscore(Extlib::Inflection.demodulize(source_model.name))\n end", "def foreign_key(separate_class_name_and_id_with_underscore = true)\n ActiveSupport::Inflector.foreign_key(self, separate_class_name_and_id_with_underscore)\n end", "def derive_foreign_key\n result = super\n result = ActiveSupport::Inflector.pluralize(result) \\\n if collection? && connected_through_array?\n result\n end", "def foreign_key(separate_class_name_and_id_with_underscore = true)\n MotionSupport::Inflector.foreign_key(self, separate_class_name_and_id_with_underscore)\n end", "def model_name; end", "def model_name; end", "def singular_association_name(foreign_key)\n if foreign_key =~ foreign_key_regex\n foreign_key[0...foreign_key.index(foreign_key_regex)]\n else\n foreign_key\n end\n end", "def lookup_model_names; end", "def foreign_key_suffix\n \"_id\"\n end", "def model_relationships; end", "def model_name\n self.class.name.underscore.split('_').first.singularize\n end", "def model_name\n described_class.to_s.underscore\nend", "def model_underscore\n get_property __method_name__\n end", "def hm_model(key,value)\n mdl = value[4..-2]\n if mdl.empty? then\n \" has_many :#{key}\"\n else\n \" has_many :#{key}, :class_name => '#{mdl}'\"\n end\n end", "def id\n super.to_s.tr('.', '_')\n end", "def association_owner_key(assoc, key)\n k = 'activerecord.associations.models.'\n k << assoc.active_record.model_name.singular\n k << '.'\n k << assoc.name.to_s\n k << '.'\n k << key.to_s\n end", "def models_namespace\n options[:model_namespace]\n end", "def related_identifier_nested\n self[Solrizer.solr_name('related_identifier_nested', :displayable)]\n end", "def model_to_association_method(model_or_name, include_scope = false)\n requested_association =\n case model_or_name\n when /^(.+)[(](.+)[)]$/ #handle model(with associations), i.e. Image(for scene A)\n association = $1\n scope = $2\n include_scope ? \"#{association}.#{scope}\" : association\n when String\n model_or_name\n else\n model_or_name.name\n end\n requested_association.underscore\nend", "def model_name\n root.singularize.camelize if root.present?\n end", "def lookup_model_names\n object_name.to_s.scan(/([a-zA-Z_]+)/).flatten.map do |x|\n x.gsub('_attributes', '')\n end\n end", "def gen_relationships\n @parser.relationships.each do |rel|\n through_str = ''\n lines = []\n if rel[:has_relationship]\n has_relationship = rel[:has_relationship].gsub(':', '..')\n case has_relationship\n when '1'\n rel_str = 'belongs_to'\n when 'n'\n rel_str = \"has n,\"\n else\n rel_str = \"has #{has_relationship},\"\n if rel[:through]\n through_str = \", :through => :#{rel[:through]}\"\n else\n through_str = \", :through => Resource\"\n end\n end\n \n if rel[:through]\n lines << \" has n, :#{rel[:through]}\"\n end\n line = \" #{rel_str} :#{rel[:variable]}#{through_str}\"\n line += \" # #{rel[:comment]}\" unless rel[:comment].empty?\n lines << line\n elsif rel[:relationship]\n lines << ' ' + rel[:relationship]\n end\n editor = ModelEditor.new(rel[:filename].snake_case)\n editor.insert(AFTER_PROPERTIES, lines)\n end\n end", "def hyphenated_name\n implementation_model_name.ns_hyphenate\n end", "def strip_admin(model)\n model.split(\"::\").last\n end", "def strip_admin(model)\n model.split(\"::\").last\n end", "def normalized_foreign_key\n @normalized_foreign_key ||= attribute.singularize\n end", "def foreign_key(class_name, separate_class_name_and_id_with_underscore = true)\n Geode::FastInflector.foreign_key(class_name, separate_class_name_and_id_with_underscore)\n end", "def __prefix__\n __name__.demodulize.underscore.dasherize.to_sym\n end", "def model_file_name\n @name.underscore\n end", "def model_file_name\n @name.underscore\n end", "def related_item_relation_label(related_item)\n related_item[:relation_type].sub('isNewVersionOf', 'Previous version').sub('isPreviousVersionOf', 'Subsequent version').remove(/^is/).underscore.gsub('_', ' ').upcase_first.concat(':')\n end", "def revisable_association_name #:nodoc:\n revisable_class_name.underscore\n end", "def foreign_key(separate_class_name_and_id_with_underscore = true)\n # TODO\n # Inflector.foreign_key(self, separate_class_name_and_id_with_underscore)\n end", "def csharp_model_fqn( model )\n [ sanitize_model_namespace(model), sanitize_model_class(model) ].compact.join(\".\")\n end", "def model_name\n ''\n end", "def default_join_table\n [self[:class_name], self[:model].name].map{|i| underscore(pluralize(demodulize(i)))}.sort.join('_').to_sym\n end", "def name_underscored\n self.name.gsub(' ', '_')\n end", "def sanitize_model_class( model )\n model.name.split(\"::\").last\n end", "def api_model_nane\n api_table.classify\n end", "def controlled_model_symbol\n controlled_model_class.to_s.underscore.to_sym\n end", "def friendly_name\n self.class.model_name.split(\"::\").join(\" \")\n end", "def model_name_to_constant(name)\n name = name.gsub(/_/,' ') if name =~ /_/ # convert <underscore> to <space>\n name.singularize.split(/ |_/).collect(&:capitalize).join.constantize\n end", "def use_relative_model_naming?\n true\n end", "def entities_key\n entities_name.underscore.to_sym\n end", "def get_model_name(model_name)\n model_name.gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').downcase\n end", "def source_macro\n :belongs_to\n end", "def foreign_key(class_name, separate_class_name_and_id_with_underscore = true)\n underscore(demodulize(class_name)) + (separate_class_name_and_id_with_underscore ? \"_id\" : \"id\")\n end", "def foreign_key(class_name, separate_class_name_and_id_with_underscore = true)\n underscore(demodulize(class_name)) + (separate_class_name_and_id_with_underscore ? \"_id\" : \"id\")\n end", "def association(association_name); end", "def demodulize\n ActiveSupport::Inflector.demodulize(self)\n end", "def tableize\n ActiveSupport::Inflector.tableize(self)\n end", "def handle_o_dn\n handle_o\n handle_possible(SeparatorSpace)\n handle_dn\n end", "def notes_normalized_key(part)\n part.to_s.tr(\" \", \"_\").to_sym\n end", "def object_model_name\n item = object\n\n is_collection = item.is_a?(Array)\n item = item.first if is_collection\n\n name = item.class.name.underscore\n\n name = name.pluralize if is_collection\n\n name.split(\"/\").last\n end", "def object_model_name(explicit_object=object)\n explicit_object.is_a?(Symbol) ? explicit_object : explicit_object.class.to_s.underscore.gsub(/\\//, '_')\n end", "def dotted_id_like_pattern(prefix = nil)\n (prefix || self.dotted_ids) + '.%'\n end", "def tableize\n # TODO\n # Inflector.demodulize(self)\n end", "def underscore_fix_for_related_urls(key)\n if key == 'RelatedURLs'\n 'related_urls'\n else\n key.underscore\n end\n end", "def association_klass_key(assoc, key)\n k = 'activerecord.associations.'\n k << assoc.klass.model_name.singular\n k << '.'\n k << key.to_s\n end", "def build_dotted_ids\n self.parent ? \"#{self.parent.dotted_ids}.#{self.id}\" : self.id.to_s\n end", "def associations; end", "def name\n I18n.t(\"relation_#{ self.class.name.split(\"::\").last.underscore }.name\")\n end", "def name\n I18n.t(\"relation_#{ self.class.name.split(\"::\").last.underscore }.name\")\n end", "def constantized_model(model)\n model.gsub(' ', '_').camelize.constantize\nend", "def demodulize\n MotionSupport::Inflector.demodulize(self)\n end", "def underscore\n self.to_s.gsub(/::/, '/').\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n tr(\"-\", \"_\").\n downcase\n end", "def model_path\n @model_class.to_s.underscore.split('/').last.pluralize\n end", "def demodulize\n # TODO\n # Inflector.demodulize(self)\n end", "def plural_association_name(foreign_key)\n pluralize singular_association_name(foreign_key)\n end", "def path_model(ident, prefix='')\n File.join(base_path, identifiers(ident, ':' + prefix))\n end", "def model_name\n @model.name.demodulize.downcase # ex: posts\n end", "def model_name\n self\n end", "def implicit_table_name\n pluralize(underscore(demodulize(name))).to_sym\n end", "def implicit_table_name\n pluralize(underscore(demodulize(name))).to_sym\n end", "def resolve_names(klass)\n for r in klass.relations\n target_name = if r.collection\n :target_plural_name\n else\n :target_singular_name\n end\n\n # Inflect the relation name.\n\n unless r[target_name]\n r[target_name] = r.target_class.to_s.demodulize.underscore.downcase\n r[target_name].replace r[target_name].plural if r.collection\n end\n\n r[:name] = r[target_name]\n end\n end", "def prefix\n @prefix ||= (belongs_to.nil?) ? DEFAULT_PREFIX : belongs_to.default_prefix\n end", "def to_sym() name_singular.to_sym end", "def coll_name\n self.name.split('::').last.split(/(?=[A-Z])/).map{|x| x.downcase}.join('_')\n end", "def convert_class(klass)\n ::ActiveSupport::Inflector.underscore(klass.name).gsub(\"/\", \"_\")\n end", "def id_fragment\n return ActiveSupport::Inflector.demodulize(self.class.name)\n end", "def model_name_strings\n model_names.map(&:to_s)\n end", "def model_route\n @model_name.to_s\n end", "def model_id_string(model_class, attributes)\n components = []\n\n components << model_class.name\n\n if model_class <= Kithe::Model\n components << attributes[\"id\"]\n components << attributes[\"friendlier_id\"]\n components << attributes[\"title\"].slice(0, 30)\n end\n\n components.join(\"/\")\n end", "def default_join_table\n ([self[:class_name].demodulize, self[:model].name.to_s.demodulize]. \\\n map{|i| i.pluralize.underscore}.sort.join('_')).to_sym\n end", "def path_model(ident=:default, prefix='')\n self.class.path_model(ident, prefix)\n end", "def tableize\n MotionSupport::Inflector.tableize(self)\n end", "def model\n self.klass.constantize.name.demodulize.tableize.singularize.downcase\n end", "def attribute_parse_naming\n OBJ_ATTRIBUTE_PARSE_NAMING\n end", "def ns_underscore\n to_s.underscore.gsub('/', '__')\n end" ]
[ "0.65487075", "0.6534474", "0.65272534", "0.6246373", "0.6186009", "0.6170175", "0.602461", "0.6017012", "0.59928405", "0.59361976", "0.5911939", "0.5864012", "0.586389", "0.5807848", "0.58041316", "0.5793602", "0.57756174", "0.57756174", "0.57482904", "0.5729816", "0.5720436", "0.57011807", "0.56918424", "0.56743836", "0.56674093", "0.5658647", "0.5625332", "0.561695", "0.5592609", "0.5586387", "0.5586331", "0.5580809", "0.55651057", "0.55608135", "0.55302304", "0.5501663", "0.5501663", "0.54665405", "0.54656154", "0.5457227", "0.54476947", "0.54476947", "0.54397863", "0.5434342", "0.5429886", "0.54278654", "0.54273796", "0.54184526", "0.5413738", "0.54135805", "0.5409991", "0.5401381", "0.5391709", "0.5390915", "0.5389853", "0.53862447", "0.5380274", "0.5377129", "0.53689325", "0.53689325", "0.5366454", "0.5365413", "0.5355524", "0.5353551", "0.53532", "0.53493", "0.5341154", "0.53398424", "0.5335251", "0.533135", "0.53305286", "0.53267276", "0.5320147", "0.53160137", "0.53160137", "0.5303936", "0.5300176", "0.52949786", "0.5292196", "0.529086", "0.52881783", "0.5263925", "0.52454334", "0.5240669", "0.5238232", "0.5238232", "0.5234963", "0.5219274", "0.52054393", "0.5199045", "0.51983213", "0.5191718", "0.51848084", "0.5184118", "0.51773125", "0.51734585", "0.5168486", "0.51672786", "0.51639766", "0.5163394", "0.51621705" ]
0.0
-1
the association name from master to these objects for example player_contacts or activity_log__player_contacts_phones notice the double underscore for namespaced models to indicate the delimiter
def objects_name :nfs_store__manage__containers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def model_association_name\n full_implementation_class_name.pluralize.ns_underscore.to_sym\n end", "def property_prefix\n # TODO: try to use the inverse relationship name if possible\n Extlib::Inflection.underscore(Extlib::Inflection.demodulize(parent_model.base_model.name)).to_sym\n end", "def parent_association_name\n self.class.resolver_opts[:relation] ||\n self.class.model_klass.to_s.underscore.pluralize\n end", "def name\n association.name\n end", "def revisable_association_name #:nodoc:\n revisable_class_name.demodulize.underscore\n end", "def name\n I18n.t(\"relation_#{ self.class.name.split(\"::\").last.underscore }.name\")\n end", "def name\n I18n.t(\"relation_#{ self.class.name.split(\"::\").last.underscore }.name\")\n end", "def relation_name\n klass.relation\n end", "def macro\n :belongs_to_related\n end", "def revisable_association_name #:nodoc:\n revisable_class_name.underscore\n end", "def to_dot_for_belongs_to(assoc)\n if assoc.options[:polymorphic]\n %(\n \"#{assoc.class_name}\" [shape = \"record\"]\n \"#{constant_name}\" -> \"#{assoc.class_name}\" [headlabel=\"*\", taillabel=\"1\"]\n )\n else\n ''\n end\n end", "def plural_association_name(foreign_key)\n pluralize singular_association_name(foreign_key)\n end", "def association_owner_key(assoc, key)\n k = 'activerecord.associations.models.'\n k << assoc.active_record.model_name.singular\n k << '.'\n k << assoc.name.to_s\n k << '.'\n k << key.to_s\n end", "def relation_name\n self.class.relation_name\n end", "def association_method\n self[:name]\n end", "def singular_association_name(foreign_key)\n if foreign_key =~ foreign_key_regex\n foreign_key[0...foreign_key.index(foreign_key_regex)]\n else\n foreign_key\n end\n end", "def scaffold_associated_name(association)\n scaffold_associated_class(association).scaffold_name\n end", "def owner_key_name\n reflection.join_foreign_key\n end", "def owner_key_name\n reflection.join_foreign_key\n end", "def find_association_class_name(association_name)\n (name.split('::')[0..-2] + [association_name.to_s.singularize.camelize]).join('::')\n end", "def association_key\n return self unless include?('.')\n gsub('.', '_0_').gsub('_1_', '_0_')\n end", "def association(association_name); end", "def objects_name\n full_object_name.pluralize.to_sym\n end", "def association_key_name\n reflection.join_primary_key(klass)\n end", "def association_method\n self[:name]\n end", "def name\n relation.name\n end", "def long_association_name(join_table, left_key, left_table, right_key)\n left_key_qualifier = \"_#{left_key}\" if left_table != parent_table_for(left_key)\n \"#{singularize(join_table)}#{left_key_qualifier}_#{plural_association_name(right_key)}\"\n end", "def association_key_name\n reflection.join_primary_key(klass)\n end", "def association_id_method\n self.class.foreign_key_name(@options[\"name\"])\n end", "def derive_foreign_key\n result = super\n result = ActiveSupport::Inflector.pluralize(result) \\\n if collection? && connected_through_array?\n result\n end", "def association_name\n @resource_options.fetch(:association_name, singular_resource_name).to_s\n end", "def association_names\n @association_names ||= []\n end", "def assoc_name\n @assoc_name ||= assoc_attr.gsub(/_id$/, '').pluralize\n end", "def belongs_to_name(model)\n model.attributes['name'] || \"#{model.class.name.humanize.titleize} ##{model.id}\"\n end", "def object_model_name\n item = object\n\n is_collection = item.is_a?(Array)\n item = item.first if is_collection\n\n name = item.class.name.underscore\n\n name = name.pluralize if is_collection\n\n name.split(\"/\").last\n end", "def inverse_association_name(reflection)\n reflection.send(:inverse_name)\n end", "def coll_name\n self.name.split('::').last.split(/(?=[A-Z])/).map{|x| x.downcase}.join('_')\n end", "def resource_plural_name\n @association_name ||= self.class.resource_class.name.tableize\n end", "def parent_association\n # needed for the show view\n @parent_object = parent_object\n parent_object.names\n end", "def table\n association.table_name\n end", "def association\n matches = form.object_name.scan(/\\[([^\\]]+)\\]\\[[^\\]]+\\]\\z/).flatten\n return matches.first.delete_suffix('_attributes') if matches.size.positive?\n\n form.object.class.to_s.tableize\n end", "def association_from_relation_name(name)\n model_associations.detect { |a| a.name == name.to_sym }\n end", "def prefix\n @prefix ||= (belongs_to.nil?) ? DEFAULT_PREFIX : belongs_to.default_prefix\n end", "def inverse_name\n super || Extlib::Inflection.underscore(Extlib::Inflection.demodulize(source_model.name)).to_sym\n end", "def friendly_name\n self.class.model_name.split(\"::\").join(\" \")\n end", "def association_names\n self.class._associations.keys\n end", "def root_association\n inverse_of = @root_klass.name.underscore\n inverse_of = inverse_of.pluralize if embedding_options[:inverse_of] == :many\n inverse_of\n end", "def model_association_names\n return unless model_associations\n\n model_associations.map do |assoc|\n assoc.name.to_sym\n end\n end", "def object_name\n @object.name.split('::').last.downcase + 's'\n end", "def name(separator = \"\")\n self.class.name(@references, separator)\n end", "def scaffold_associated_human_name(association)\n association.to_s.humanize\n end", "def cyclic_parent_name\n (\"parent_#{self.name.demodulize.underscore.singularize}\").to_sym\n end", "def __belongs_to__\n\t\treturn_string = []\n\t\tself.class.reflect_on_all_associations(:belongs_to).each do |association| \n\t\t\tmodel = self.send(association.name)\n\t\t\tif model\n\t\t\t\treturn_string.push model.reference_attribute \n\t\t\tend\n\t\tend\n\t\treturn_string.join \" \"\n\tend", "def model_name\n self.class.name.underscore.split('_').first.singularize\n end", "def inverse_name\n Extlib::Inflection.underscore(Extlib::Inflection.demodulize(source_model.name))\n end", "def related_identifier_nested\n self[Solrizer.solr_name('related_identifier_nested', :displayable)]\n end", "def model_name\n root.singularize.camelize if root.present?\n end", "def class_name\n # normally is the classname of the association target\n @class_name ||= options[:join_class_name]\n end", "def default_join_table\n [self[:class_name], self[:model].name].map{|i| underscore(pluralize(demodulize(i)))}.sort.join('_').to_sym\n end", "def association_name_attributes\n \"#{association_name}_attributes\"\n end", "def relation_class_name\n @class_name ||= @options[:class_name] || ActiveSupport::Inflector.classify(name)\n end", "def link_belongs_to(reflection)\n reflection.foreign_key.to_sym\n end", "def source_macro\n :belongs_to\n end", "def model_name; end", "def model_name; end", "def foreign_key(separate_class_name_and_id_with_underscore = true)\n MotionSupport::Inflector.foreign_key(self, separate_class_name_and_id_with_underscore)\n end", "def default_join_table\n ([self[:class_name].demodulize, self[:model].name.to_s.demodulize]. \\\n map{|i| i.pluralize.underscore}.sort.join('_')).to_sym\n end", "def simple_name\n [@parent.simple_name, self.name.parameterize].compact.join('_')\n end", "def association_klass_key(assoc, key)\n k = 'activerecord.associations.'\n k << assoc.klass.model_name.singular\n k << '.'\n k << key.to_s\n end", "def global_name\n pcs = []\n cursor = self\n begin\n pcs << cursor.name\n cursor = cursor.parent\n end while cursor\n\n pcs.reverse.join(\".\")\n end", "def model_to_association_method(model_or_name, include_scope = false)\n requested_association =\n case model_or_name\n when /^(.+)[(](.+)[)]$/ #handle model(with associations), i.e. Image(for scene A)\n association = $1\n scope = $2\n include_scope ? \"#{association}.#{scope}\" : association\n when String\n model_or_name\n else\n model_or_name.name\n end\n requested_association.underscore\nend", "def model_name\n model.name\n end", "def full_name\n [@owner, @name].join('/')\n end", "def associations_class_names\n self.associations.map{|name,association|\n association.class_name\n }\n end", "def resolve_names(klass)\n for r in klass.relations\n target_name = if r.collection\n :target_plural_name\n else\n :target_singular_name\n end\n\n # Inflect the relation name.\n\n unless r[target_name]\n r[target_name] = r.target_class.to_s.demodulize.underscore.downcase\n r[target_name].replace r[target_name].plural if r.collection\n end\n\n r[:name] = r[target_name]\n end\n end", "def foreign_key(separate_class_name_and_id_with_underscore = true)\n ActiveSupport::Inflector.foreign_key(self, separate_class_name_and_id_with_underscore)\n end", "def name\n \"#{parent.name}:#{@name}\"\n end", "def to_s\n self.name.split('::').last\n end", "def parent_name\n arr = self.name.split('::')\n arr[arr.length-2].downcase\n end", "def collection_name\n self.to_s.tableize\n end", "def code_for_join_association(join_ass)\n r = \"#{join_ass.type} :#{join_ass.name}\"\n r << \", class: :#{model_class_name(join_ass.associated_table)}\" unless join_ass.name_is_conventional?\n r << \", right_key: :#{join_ass.right_foreign_key}\" unless join_ass.name_and_right_foreign_key_are_conventional?\n r << \", left_key: :#{join_ass.left_foreign_key}\" unless join_ass.left_foreign_key_is_conventional?\n r << \", join_table: :#{join_ass.join_table}\"\n # primary_key always defaults to the primary key of the referenced table\n r\n end", "def relation_name\n fetch(:relation_name, :children)\n end", "def qualified_to_name; end", "def object_model_name(explicit_object=object)\n explicit_object.is_a?(Symbol) ? explicit_object : explicit_object.class.to_s.underscore.gsub(/\\//, '_')\n end", "def name\n model_name\n end", "def model_name\n self\n end", "def mtm_association_names\n association_names([:many_to_many])\n end", "def parent_table_for(possible_foreign_key)\n pluralize singular_association_name(possible_foreign_key) if possible_foreign_key =~ foreign_key_regex\n end", "def referencing_link_name\n Domgen.error(\"referencing_link_name on #{name} is invalid as #{characteristic_container.characteristic_kind} is not a reference\") unless reference?\n base_name = \"#{self.respond_to?(:component_name) ? component_name : name}#{referenced_entity.primary_key.name}\"\n self.collection? ? Reality::Naming.pluralize(base_name) : base_name\n end", "def scaf_foreign_key_name( assoc )\n assoc.primary_key_name\n end", "def getQuestionJunctionObjName\r\n\t\t\treturn \"mfiforce__Question_Junction__c\"\r\n\t\tend", "def owner_name\n self.parsed_fullname\n end", "def association\n @association ||= model.reflect_on_association(@name)\n end", "def full_name\n \"#{namespace.name || namespace.inspect}::#{namespace.instances[ self ]}\"\n end", "def class_name\n @class_name ||= association.target_class.name\n end", "def qualified_name\n if parent\n \"#{parent.qualified_name}::#{self.name}\"\n else\n self.name\n end\n end", "def table_name\n self.name.split('::').last\n end", "def full_name\n klass.name\n end", "def makenaize_name(obj, name)\n %w(parents children).include?(name) ? \"#{obj.class.to_s.underscore}_#{name.singularize}\".to_sym : name.to_s.singularize.to_sym\n end", "def autoreport_association_name_columns(reflection)\n %w(name email title)\n end", "def automatic_inverse_of\n return super unless connected_through_array?\n\n if can_find_inverse_of_automatically?(self)\n inverse_name = options[:as] || active_record.name.demodulize\n inverse_name = ActiveSupport::Inflector.underscore(inverse_name)\n inverse_name = ActiveSupport::Inflector.pluralize(inverse_name)\n inverse_name = inverse_name.to_sym\n\n begin\n reflection = klass._reflect_on_association(inverse_name)\n rescue NameError\n # Give up: we couldn't compute the klass type so we won't be able\n # to find any associations either.\n reflection = false\n end\n\n return inverse_name if valid_inverse_reflection?(reflection)\n end\n end" ]
[ "0.7518692", "0.7183457", "0.7131547", "0.7044796", "0.69236636", "0.68153536", "0.68153536", "0.6707378", "0.66962796", "0.66469634", "0.6593404", "0.65805036", "0.65756255", "0.65550715", "0.6538172", "0.64946586", "0.64844793", "0.64797634", "0.64797634", "0.64397645", "0.642449", "0.64104927", "0.63937676", "0.638205", "0.6374978", "0.634927", "0.6346065", "0.6339497", "0.629306", "0.6290339", "0.62753576", "0.6267176", "0.6247766", "0.62467486", "0.6245525", "0.6211859", "0.6192062", "0.61486876", "0.6139071", "0.61376727", "0.6136787", "0.61338663", "0.6131472", "0.61270124", "0.6121894", "0.6120157", "0.6119927", "0.6119412", "0.61072147", "0.6091783", "0.608025", "0.60622346", "0.6057296", "0.604893", "0.6023314", "0.6016777", "0.6016063", "0.6011705", "0.60085195", "0.59956026", "0.5995047", "0.5972615", "0.5969257", "0.59559166", "0.59559166", "0.5946546", "0.5907647", "0.5902827", "0.59008265", "0.5900388", "0.5896467", "0.5894831", "0.5892099", "0.58706564", "0.5851259", "0.5845175", "0.5842243", "0.58406675", "0.58401185", "0.5834853", "0.58338034", "0.5824696", "0.5823346", "0.5805483", "0.5805184", "0.58039445", "0.58038867", "0.5801381", "0.5797563", "0.5794722", "0.57846713", "0.5781661", "0.57815665", "0.57786644", "0.57706845", "0.57674813", "0.57659984", "0.5765023", "0.57626766", "0.5756908", "0.5755182" ]
0.0
-1
CONSTRUCTOR c = numerator d = denominator
def initialize(primes,c=0,d=1) @primes = primes @residues = [] if(c!=0) primes.each do |p| @residues << Padic.hensel_code(p,1,c,d) end else @residues = Array.new(primes.size,0) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(n,d) #initilize is a reserved work for a constructor in ruby\n @numerator = n\n @denominator = d\n end", "def numerator() end", "def denominator() end", "def numerator\n\t\tan = @a.numerator\n\t\tbn = @b.numerator\n\t\tad = @a.denominator\n\t\tbd = @b.denominator\n\t\tabd = ad.lcm(bd)\n\t\t__new__(an * (abd / ad), bn * (abd / bd))\n\tend", "def initialize(a,b)\n\t\tif b==0\n\t\t\traise \"Error de ejecucion. Division entre 0\"\n\t\telse\n\t\t\t@n,@d = a,b\n\t\tend\n\t\t#Se simplifica al crear la fraccion\t\t\n\t\t@n, @d = @n/mcd(@n, @d), @d/mcd(@n, @d)\t\n\tend", "def initialize(numerator=0, denominator=1)\n @fraction = Vector[denominator,numerator]\n end", "def initialize(numerador, denominador) # Se define el constructor.\n\t\tmcd = gcd(numerador,denominador)\n\t\t@numerador , @denominador = numerador/mcd, denominador/mcd\n\tend", "def initialize(n,d)\n max = gcd(n,d)\n @n = n / max\n @d = d / max\n end", "def initialize(num, den) # Inicializamos las variables y las reducimos a su minima expresion\n\t\taux = mcd(num,den)\n\t\t@num = num / aux\n\t\t@den = den / aux\n\tend", "def initialize(numerator, denominator=nil, base=10)\n case numerator\n when ::Rational, Rational\n ratn = numerator\n base = denominator\n @value = Rational(ratn.numerator, ratn.denominator)\n else\n n = parse_value(numerator, base)\n d = parse_value(denominator, base)\n @value = Rational(n, d)\n end\n @base, @code = parse_base(base)\n end", "def initialize(num = 0, den = 1)\n @num = num \n @den = den\n self.simplify\n end", "def *(a,b,c,d)\n\t\treturn (a/b)*(c/d)\n\tend", "def division(n, d)\n n, d = reducir(n, d)\n \n @n *= d\n @d *= n\n \n reducir(@n, @d)\n return @n, @d\n end", "def Dev(a,b)\n\tc = a / b\n\treturn c\nend", "def denominator\n\t\tad = @a.denominator\n\t\tbd = @b.denominator\n\t\tad.lcm(bd)\n\tend", "def denominator\n\t\tad = @a.denominator\n\t\tbd = @b.denominator\n\t\tad.lcm(bd)\n\tend", "def test_Complex_InstanceMethods_denominator\n\t\tassert_equal(12, Complex(\"1/3+1/4i\").denominator)\n\t\tassert_equal(1, Complex(-2, 4).denominator)\n\tend", "def numerator\n @data[0]\n end", "def Fraction(*args)\n Fraction.new(*args)\nend", "def test_Complex_InstanceMethods_numerator\n\t\tc = Complex('2/3+3/4i')\n\t\tassert_equal(Complex('8+9i'), c.numerator)\n\t\tassert_equal(12, c.denominator)\n\tend", "def reduce\n divisor = mcd\n @num = @num / divisor\n @denom = @denom / divisor\n return self\n end", "def initialize(num, den)\n\t\t@num, @den = num, den\n\tend", "def denominator\n @data[1]\n end", "def /(other)\n\t\tRacional.new(num*other.denom,denom*other.num)\n\tend", "def reducir(n, d)\n aux = gcd(n, d)\n n = n / aux\n d = d / aux\n return n, d\n end", "def test_Rational_InstanceMethods_denominator\n\t\tassert_equal(3, Rational(\"2/3\").denominator)\n\t\tassert_equal(365, Rational(\"343434/365\").denominator)\n\tend", "def divide(numerator, denominator)\n puts \"#{numerator} / #{denominator} = #{numerator / denominator}\\n\"\nend", "def division(value) \n\t\tdiv = Fraccion.new(0, 0)\n\t\taux = value.numer\n\t\tvalue.numer = value.denom\n\t\tvalue.denom = aux\n\t\tdiv.numer = @numer * value.numer\n\t\tdiv.denom = @denom * value.denom \n \treturn div \n\tend", "def **(b)\n b = b.symdescfy\n case b\n when Infinity\n b\n when Int\n return Ratio.new(@numerator ** b.value, @denominator ** b.value)\n else\n super\n end\n end", "def * other\n other = Fraction.new(other) if other.instance_of? Fixnum\n Fraction.new(@numer * other.numer, @denom * other.denom)\n end", "def pre_divide; end", "def divDeComplejos(c)\n\t\tif c.class != NumCom && c.class != Float && c.class != Fixnum && c.class != Bignum\n\t\t\treturn \"El numero rescibido no es valido\"\n\t\t\texit\n\t\telse\n\t\t\ta2 = (@r * c.getReal + @i * c.getImaginario)/(c.getReal * c.getReal + c.getImaginario * c.getImaginario)\n\t\t\tb2 = (@i * c.getReal - @r * c.getImaginario)/(c.getReal * c.getReal + c.getImaginario * c.getImaginario)\n\t\tend\n\t\treturn NumCom.new(a2,b2)\n\tend", "def post_divide; end", "def reduce!\n g = gcd(@numer, @denom)\n @numer /= g\n @denom /= g\n self\n end", "def /(object)\n #multiplica numerador con numerador y denominador con denominador\n Fraccion.new(@numerador*object.denominador,@denominador*object.numerador)\n end", "def fractional; end", "def division(r, i)\n p_r = (@r*r + @i*i).to_f / (r**2 + i**2)\n p_i = (@i*r - @r*i).to_f / (r**2+i**2)\n c3 = Complejo.new(p_r, p_i)\n return c3.to_s\n end", "def to_d\n\t\treturn (@n*1.0)/@d\n\tend", "def test_Rational_InstanceMethods_numerator\n\t\tassert_equal(2, Rational(\"2/3\").numerator)\n\t\t# TODO, assert_equal(1978, Rational(\"1978/840\").numerator)\n\tend", "def div(p0) end", "def denom()\n\t\treturn @den\n\tend", "def / other\n other = Fraction.new(other) if other.instance_of? Fixnum\n self * other.inv\n end", "def reduce\n if denominator.to_i == 0\n puts \"ERROR\"\n else\n min = [numerator,denominator].min\n min.downto(2) do |x|\n if numerator%x == 0 && denominator%x == 0\n n = numerator/x\n d = denominator/x\n puts n.to_s + \"/\" + d.to_s\n break\n end\n end\n end\n end", "def initialize(n, d) #inicializacion\n @n, @d = n, d\n end", "def divide(dividend:, divisor:)\n dividend / divisor\nend", "def reciprocal ()\n\tFraccion.new(@denominador,@numerador)\n end", "def initialize(r, c)\n [r, c].each do |input|\n raise ArgumentError,\n \"input must be a Numeric.\\n\" + \n \"Received a #{input.class}\" unless input.is_a? Numeric\n end\n @r = r\n @c = c\n \n @g = 0.0\n @h = 0.0\n \n @prev = nil\n @near = []\n end", "def reciprocal\nFraccionario.new(@den, @num)\nend", "def v(r,c) (f(r)/f(c)/f(r-c)).to_s end", "def d(n)\r\n proper_divisors(n).reduce(:+)\r\nend", "def simplificar (fraccion)\n mcd = gcd(fraccion.numerador, fraccion.denominador)\n Fraccion.new( fraccion.numerador/mcd , fraccion.denominador/mcd)\n \n \n end", "def /(other)\n Fraccion.new(@num * other.denom, @denom * other.num)\n end", "def initialize(a, b, r)\n\t\t#class variables\n\t\t@@a = a \t\t\t#first number\n\t\t@@b = b\t\t\t\t#second number\n\t\t@@r = r \t\t\t#circle radius\n\tend", "def ratio\n # This call is interesting because it involves converting the\n # cog to a floar instead of both the chainring and the cog.\n # This avoids any uncessary conversions to get the job done!\n chainring / cog.to_f\n end", "def divide(numerator, denominator)\n $LOG.debug(\"Numerator: #{numerator}, denominator #{denominator}\")\n begin\n result = numerator / denominator\n rescue Exception => e\n $LOG.error \"Error in division!: #{e}\"\n\tresult = nil\n end\n return result\n end", "def test_Complex_InstanceMethods_fdiv\n\t\tc1 = Complex(1, 2)\n\t\tc2 = Complex(2, 2)\n\t\tassert_equal(Complex(\"3/4+1/4i\"), c1/c2)\n\t\t# TODO, why? assert_equal(Complex(0.75,0.25), c1.fdiv(c2))\n\tend", "def /(divisor)\n if divisor.kind_of? Measures::Measure\n value = self.value / divisor.value\n unit = \"#{self.unit}/#{divisor.unit}\"\n modifier = \"base\"\n quantity = \"#{self.quantity}/#{divisor.quantity}\"\n result = ComplexMeasure.new(value,modifier,unit,quantity)\n elsif divisor.is_a? Numeric\n value = self.value / divisor\n unit = self.unit\n modifier = self.modifier\n quantity = self.quantity\n result = self.class.new(value,modifier,unit,quantity)\n else\n raise ArgumentError, \"divisor must be either a Numeric or a Measure of some sort (BaseMeasure or ComplexMeasure)\"\n end\n return result\n end", "def to_d() \n\t @n.to_f / @d\n\tend", "def string\n if denominator.to_i == 0\n puts \"ERROR\"\n else\n puts numerator.to_s + \"/\" + denominator.to_s\n end\n end", "def decimal\n if denominator.to_i == 0\n puts \"ERROR\"\n else\n x = numerator.to_f/denominator.to_f\n puts x\n end\n end", "def to_r\n return Rational(numerator,denominator)\n end", "def divide_c!(j, c)\n @body.divide_c!(j, c)\n @right.divide_c!(j, c)\n end", "def denominator_formula\n 1.upto(payments - 1).map { |m| \"(1 + percent) ** (#{m} * payment_period)\" }\n .push(1)\n .join(' + ')\n end", "def initialize(lower=0.0, upper=1.0)\n lower,upper = upper,lower if lower > upper\n @lower = lower.to_f\n @upper = upper.to_f\n @pdf_denominator = 1.0 / (@upper - @lower)\n @use_last = nil\n end", "def initialize(r, a, b, c)\n @r = r; @a = a; @b = b; @c = c\n normalize\n end", "def initialize(r, a, b, c)\n @r = r; @a = a; @b = b; @c = c\n normalize\n end", "def divide(a,b)\n a/b\nend", "def initialize(r: 0, g: 0, b: 0, cterm: nil)\n @r = r\n @g = g\n @b = b\n @cterm = cterm\n end", "def diameter\n rim + (tire * 2)\n end", "def reciprocal\n RationalNumber.new(self.denominator, self.numerator)\n end", "def test_Rational_InstanceMethods_fdiv\n\t\t# assert_equal(11/4, Rational(\"11/2\")/2)\n\t\tassert_equal(2.75, Rational(\"11/2\").fdiv(2))\n\tend", "def to_f\n numerator.to_f / denominator.to_f\n end", "def to_r\n Rational(numerator.to_i, denominator.to_i)\n end", "def recursive_gcd(numerator, denominator)\n if d != 0\n return n\n else\n return recursive_gcd(denominator, numerator % denominator)\n end\nend", "def update!(**args)\n @denominator = args[:denominator] if args.key?(:denominator)\n @numerator = args[:numerator] if args.key?(:numerator)\n end", "def prop_c\n bases_c / length.to_f\n end", "def convert(base)\n self.class.new(numerator, denominator, base)\n end", "def divide\n match '/'\n factor\n emit_ln 'MOVE (SP)+,D1'\n emit_ln 'DIVS D1,D0'\nend", "def *(other)\n\t\tRacional.new(num*other.num,denom*other.denom)\n\tend", "def /(n)\n self * (1.0 / n)\n end", "def divide!(other)\n init_base_quantities(other.reciprocalize.to_hash)\n get_description\n return self\n end", "def /(b)\n b = b.symdescfy\n case b\n when Number\n __div_number(b)\n when Infinity\n ZERO\n else\n super\n end\n end", "def +(other)\n\t\tif other.respond_to?(\"d\")\n\t\t\treturn Fraccion.new(((mcm(@d, other.d) / @d)*@n) + ((mcm(@d, other.d) / other.d)*other.n),mcm(@d, other.d))\n\t\telse\n\t\t\treturn Fraccion.new( ((other*@d) + @n), @d)\n\t\tend\t\n\tend", "def initialize(a,b)\n c = a-b\n puts('test constructor:: '+ String(c))\n end", "def initialize(alt, anc)\n\t\t@alt = (alt-1)\n\t\t@anc = (anc-1)\n\n\tend", "def division (first_number, second_number)\nfirst_number / second_number\nend", "def reciprocal\n\t\tRacional.new(denom, num)\n\tend", "def /(other)\n\tself.num / other.num\nend", "def mediant(other)\n return SternBrocot::Fraction.new(self.numerator+other.numerator, self.denominator+other.denominator)\n end", "def * r\n if r.is_a? Ratio\n # Default response. All elsifs should point toward this.\n Ratio.from_factors(self.factors + r.factors)\n elsif r.is_a? Numeric\n self * Ratio[r, 1]\n elsif r.is_a? NArray\n self * Ratio[*r].factors\n else\n raise ArgumentError.new(\"Supplied class #{r.class} to HD::Ratio.*\")\n end\n end", "def fractional\n self\n end", "def curious_fraction(numerator,denominator)\n numerators = numerator.to_s.split('').map(&:to_i)\n denominators = denominator.to_s.split('').map(&:to_i)\n\n if numerators[0]==denominators[0] && numerators[0]!=0\n numerators.shift\n denominators.shift\n return (numerators[0].to_f)/denominators[0]\n \n elsif numerators[1]==denominators[0] && numerators[1]!=0\n numerators.pop\n denominators.shift\n return (numerators[0].to_f)/denominators[0]\n \n elsif numerators[0]==denominators[1] && numerators[0]!=0\n numerators.shift\n denominators.pop\n return (numerators[0].to_f)/denominators[0]\n\n elsif numerators[1]==denominators[1] && numerators[1]!=0\n numerators.pop\n denominators.pop\n return (numerators[0].to_f)/denominators[0]\n else\n false\n end\n\nend", "def /(other)\n RDF::Literal(to_d / (other.respond_to?(:to_d) ? other.to_d : BigDecimal(other.to_s)))\n end", "def divide(other)\n Rubinius.primitive :float_div\n redo_coerced :/, other\n end", "def /(other)\n Resistor::CombinedResistor.new(1 / (1 / @ohm + 1 / other.ohm))\n end", "def multDeComplejos (c)\n\t\tif (c.class != NumCom && c.class != Float && c.class != Fixnum && c.class != Bignum) \n\t\t\treturn \"El numero rescibido no es valido\"\n\t\t\texit\n\t\telse\n\t\t\ta2 = (@r * c.getReal) - (@i * c.getImaginario)\n\t\t\tb2 = (@r * c.getImaginario) + (@i * c.getReal)\n\t\tend\n\t\treturn NumCom.new(a2,b2)\n\tend", "def %(other)\n\t\tRacional.new(num%denom, other.num%other.denom)\n\tend", "def rdiv(p0) end", "def divisionm(num_1,num_2)\n return num_1 / num_2\nend", "def +(r)\n case r\n when Integer\n self + Fraction[r]\n when Fraction\n Fraction[ r.last*first + r.first*last, r.last*last ]\n else\n raise TypeError.new(\"Sorry, I can't add a Fraction and a #{r.class}. :(\")\n end\n end", "def divide!(rhs)\n divide rhs, self\n end" ]
[ "0.79395413", "0.7437156", "0.7402314", "0.717763", "0.7013709", "0.68929815", "0.6845381", "0.678332", "0.6584088", "0.65358627", "0.6514931", "0.64362913", "0.62976664", "0.6297248", "0.6289035", "0.6289035", "0.62650573", "0.6204994", "0.61965454", "0.6163776", "0.6120926", "0.6106021", "0.6104274", "0.60531765", "0.60429734", "0.6014756", "0.6014611", "0.6012012", "0.60092145", "0.59213805", "0.5911749", "0.5908402", "0.5889711", "0.58815235", "0.58465904", "0.58397263", "0.58008754", "0.5798589", "0.5787298", "0.5761813", "0.57554597", "0.5728647", "0.5724043", "0.5706192", "0.5701484", "0.56801724", "0.56757784", "0.5673636", "0.566196", "0.56569517", "0.5654017", "0.56492865", "0.56479776", "0.5637344", "0.56286615", "0.5622842", "0.55963796", "0.55874103", "0.55641484", "0.5548716", "0.55473584", "0.55316687", "0.55295694", "0.55070597", "0.54813075", "0.54813075", "0.5462779", "0.54534173", "0.5450709", "0.5445702", "0.54394466", "0.5439092", "0.54284036", "0.54216087", "0.54209334", "0.5412625", "0.54111195", "0.54036915", "0.54012656", "0.53998554", "0.5394721", "0.5389098", "0.5389054", "0.5380775", "0.53776264", "0.53652084", "0.53541696", "0.53487337", "0.5334788", "0.532702", "0.53109926", "0.5309348", "0.5306879", "0.5306684", "0.5301294", "0.5298128", "0.52932733", "0.5292918", "0.52831215", "0.5272462", "0.52657706" ]
0.0
-1
Given: 'This is the best' Return: 'best the is This' As part of this exercise you should remove all leading and trailing whitespace. So that inputs such as: ' space here' and 'space here ' both become: 'here space'
def reversal(sentence) sentence.split(' ').reverse.join(' ') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cleanup(str)\n str.gsub(/([^a-z])/, ' ').squeeze(' ')\nend", "def cleanup(input)\n input.gsub(/[^a-zA-Z]/, ' ').squeeze(' ')\nend", "def normalize_whitespace(input)\n input.to_s.gsub(%r!\\s+!, \" \").tap(&:strip!)\n end", "def dewhitespace\n gsub(/\\s+/,' ').strip\n end", "def cleanup(string)\n string.gsub(/[^a-z]/, ' ').squeeze(' ')\nend", "def normalize_whitespace(input); end", "def cleanup(string)\n string.gsub(/[^a-z0-9]/, \" \").gsub(/\\s+/, \" \")\n # string.gsub(/[^a-z]/, ' ').squeeze(' ')\nend", "def pre_proccess(text)\n text.to_s.strip.gsub(/[[:space:]]+/, ' ').gsub(/\\s{2,}/, ' ')\n end", "def cleanup(string)\n string.gsub(/[^a-z]/i, ' ').squeeze(' ')\nend", "def cleanup(str)\r\n str.gsub!(/[^a-z]/, ' ').squeeze(' ')\r\nend", "def normalize_whitespace(text)\n text.to_s.gsub(/[[:space:]]+/, ' ').strip\n end", "def cleanup(str)\n str.gsub(/\\W/, ' ').squeeze(' ')\nend", "def cleanup(str)\n str.gsub(/[^a-z]/,\" \").squeeze(\" \")\nend", "def cleanup str\n str2 = str.gsub(/[^A-Za-z]/, ' ')\n str3 = str2.gsub(/[ ]{2,}/, ' ')\nend", "def squash(text)\n return text.scrub.gsub(/[[:space:]]+/, ' ').strip\nend", "def strip_naked\n return self if blank?\n self.downcase.strip.gsub(/([\\s]{2,})/, ' ')\n end", "def cleanup(string)\n string.gsub(/[^a-z]/i, \" \").squeeze(' ')\nend", "def cleanup2(string)\n string.gsub(/[^a-z]/i, ' ').squeeze\nend", "def cleanup(string)\n string.gsub!(/\\W/, ' ').squeeze(' ')\nend", "def cleanup(string)\n string = string.gsub(/[^a-z]/i, ' ')\n until !string.include?(' ')\n string.gsub!(' ', ' ')\n end\n string\nend", "def cleanup(string)\n string.gsub!(/[^a-zA-Z]/, ' ').squeeze(' ')\nend", "def condense_spaces(str)\n str.gsub(/\\s+/, \" \")\n end", "def compact_whitespace s\n s.gsub(/\\s+/, ' ').gsub(/>\\s</, '><').strip\n end", "def clean(str)\n return nil unless str\n str.gsub(/\\p{Space}/, ' ').strip.squeeze(' ')\n end", "def remove_whitespace(dirty_name)\n \n return dirty_name.split(' ').join(\" \") \n \n end", "def strip(s)\n s.gsub(/^\\s+/, '').gsub(/\\s+$/, '')\n end", "def spacify(str)\n # str.chars.map { |c| c += ' '}.join.rstrip\n str.gsub(/\\w/) {|s| s + ' '}.rstrip\nend", "def cleanup(str)\n str.gsub!(/[^0-9a-z ]/i, ' ')\n str.gsub!(/\\s+/, ' ')\nend", "def cleanup(txt)\n txt.gsub(/[^a-z]/i, ' ').squeeze(' ')\nend", "def clean_whitespace(a)\n\n a.gsub(\"\\r\", ' ').gsub(\"\\n\", ' ').squeeze(\" \").strip\n\nend", "def clean_whitespace(a)\n\n a.gsub(\"\\r\", ' ').gsub(\"\\n\", ' ').squeeze(\" \").strip\n\nend", "def no_space(x)\n x.gsub(\" \", \"\")\nend", "def clean_whitespace(a)\n a.gsub(\"\\r\", ' ').gsub(\"\\n\", ' ').squeeze(\" \").strip\nend", "def clean_whitespace(a)\n a.gsub(\"\\r\", ' ').gsub(\"\\n\", ' ').squeeze(\" \").strip\nend", "def cleanup(text)\n text.gsub(/[^a-z]/i,\" \").squeeze(\" \")\nend", "def cleanup(string)\n characters = string.chars\n characters.each_with_index do |char, index|\n if !('a'..'z').include?(char.downcase)\n if characters[index - 1] == ' '\n characters[index - 1] = ''\n characters[index] = ' '\n else\n characters[index] = ' '\n end\n end\n end\n characters.join\nend", "def cleanup_noregexp str\n str2 = ''\n str.chars.each do |chr|\n case chr.downcase\n when ('a'..'z')\n str2 << chr\n else\n str2 << ' '\n end\n end\n str2.squeeze(' ')\nend", "def clean_up_spaces(string)\n string.gsub(\"\\n\", ' ').gsub(/[[:space:]]+/, ' ').strip if string.is_a? String\n end", "def cleanup(string)\n string.gsub(/[\\W\\d]/, ' ').gsub(/\\s+/, ' ')\nend", "def cleanup(string)\n string.gsub!(/[^a-z]/i, \" \") #/i makes it case insensitive\n\n loop do\n string.gsub!(\" \", \" \")\n break if !string.include?(\" \")\n end\n string\nend", "def cleanup string\n string.gsub(/\\W|\\d/, ' ').gsub(/\\ (?=\\ )/, '')\nend", "def cleanup(str)\n output = [] \n no_go = false\n str = str.gsub(/[^A-Za-z0-9 ]/, ' ').split(\"\")\n str.each_index do |i|\n if str[i]==\" \"\n output.push(str[i]) unless no_go == true\n no_go = true\n else\n output.push(str[i]) \n no_go = false\n end\n end\n output.join\nend", "def clean_string s\n s.gsub(/\\s/, \"\")\n end", "def right_strip(str)\n i = str.length - 1\n while i >= 0 && (str[i] == \" \" || str[i] == \"\\t\" || str[i] == \"\\n\")\n i -= 1\n end\n\n return str[0, i + 1]\nend", "def cleanup(str)\nstr.gsub!(/[^0-9A-Za-z]/, \" \").squeeze(\" \")\n\nend", "def crunch(str)\n str.split.map do |word|\n word.chars.each_with_object('') do |char, clean_word|\n clean_word << char if char != clean_word[-1]\n end\n end.join(' ')\nend", "def strip_squeeze\n strip.squeeze(\" \")\n end", "def trim\n self.gsub(/^\\s+/,'').gsub(/\\s+$/,'')\n end", "def no_space(x)\n # code go here\n x.gsub(' ', '')\nend", "def strip(string)\n while string[-1] == \" \" || string[-1] == \"\\n\" || string[-1] == \"\\t\"\n string[-1] = \"\"\n end\n while string[0] == \" \" || string[0] == \"\\n\" || string[0] == \"\\t\"\n string[0] = \"\"\n end\n return string\nend", "def cleanup(str)\n str.gsub(/\\W+/, ' ')\nend", "def cleanup(str)\n str.gsub(/\\W+/,' ')\nend", "def right_strip(string)\n i = string.length-1\n output = \"\"\n new_line = \"\\n\"\n tab = \"\\t\"\n space = \" \"\n while 0 < i\n if string[i] == new_line || string[i] == tab || string[i] == space \n i -= 1\n else\n j = 0\n while j <= i\n output += string[j]\n j += 1\n end\n if j == i + 1\n return output\n end\n end\n end\nend", "def trim_whitespace; end", "def cleanup(str)\n str.gsub!(/[^a-z]+/i, ' ') if str.match(/[^a-z]+/i)\n str\nend", "def tighten\n gsub(/[\\t ]+/,' ').strip\n end", "def remove_whitespace( answer_string )\n if @whitespace.nil?\n answer_string\n elsif [:strip, :chomp].include?(@whitespace)\n answer_string.send(@whitespace)\n elsif @whitespace == :collapse\n answer_string.gsub(/\\s+/, \" \")\n elsif [:strip_and_collapse, :chomp_and_collapse].include?(@whitespace)\n result = answer_string.send(@whitespace.to_s[/^[a-z]+/])\n result.gsub(/\\s+/, \" \")\n elsif @whitespace == :remove\n answer_string.gsub(/\\s+/, \"\")\n else\n answer_string\n end\n end", "def cleanup(string)\n string.gsub!(/\\W+/, ' ')\nend", "def clean_up(string)\n arr = string.split\n final_arr = []\n new_arr = arr.map do |word|\n word.scan(/\\w/).join\n end\n new_arr.each do |word|\n if word != \"\"\n final_arr << word\n end\n end\n final_arr.join(' ')\nend", "def remove_whitespaces(myString)\n\treturn myString.gsub(/\\s+/, \"\")\nend", "def spaces_suround\n string = self\n unless [-1] == \" \"\n string = string + \" \"\n end\n unless [0] == \" \"\n string = \" \" + string\n end\n string\n end", "def no_space(x)\n x = x.split(\" \").join(\"\")\n puts x\nend", "def cleanup(string)\n string.gsub(/[^A-Za-z0-9]/, \" \").squeeze\nend", "def removeWhitespace(a)\n\toutString = \"\"\n\ta.split(\"\").each do |i|\n\t\toutString += i unless i == \" \"\n\tend\n\treturn outString\nend", "def clean( input )\n input.gsub( %r/\\s+/, '' )\n end", "def strip_side_space!\n replace self.gsub(/^\\s+/, \"\").gsub(/\\s+$/, $/)\n end", "def cleanup(str)\n str.chars.map { |char| ('a'..'z').include?(char.downcase) ? char : ' ' }.join.squeeze(' ')\nend", "def cleanup(str)\n # str.gsub!(/[^a-z]/, ' ').squeeze(' ')\n str.tr_s(' -/:-@[-`{-~', ' ')\nend", "def left_strip(str)\n output = \"\"\n whitespace = \"\\n\\t \"\n i = 0\n left = true\n while i < str.length\n if !left\n output << str[i]\n elsif !whitespace.include? str[i]\n left = false\n output << str[i]\n end\n i+=1\n end\n return output\nend", "def rstrip\r\n match = rewrite(/\\s+\\z/)\r\n match ? match[0] : ''\r\n end", "def cleanup(str)\n char_clean = []\n str.chars.each do |char|\n if /[a-z]/.match(char)\n char_clean << char\n else\n char_clean << ' ' unless char_clean[-1] == ' '\n end\n end\n char_clean.join\nend", "def rstrip!\n erase! @result.length - 1 - (@result.rindex(/[^\\s]/) || -1)\n end", "def cleanup(sentence)\n sentence.gsub(/[^a-z]+/i, ' ')\nend", "def squish\n self.gsub(/[\\n\\t]/, '').squeeze(' ').strip\n end", "def clean_user_input(input)\n cleansed_input = input.strip.downcase.split.join(\" \")\n cleansed_input\n end", "def trimmed_whitespace(text)\n text.gsub(/[\\t\\n\\f\\r ]+/ium, ' ')\n end", "def no_space(x)\n x.delete(' ')\nend", "def squish!\n gsub!(/[[:space:]]+/, \" \")\n strip!\n self\n end", "def clean(string)\n string = string.gsub(\".\",\"\")\n string = string.gsub(/\\s+/,\" \")\n string = string.downcase\n return string\n end", "def clean(string)\n string = string.gsub(\".\",\"\")\n string = string.gsub(/\\s+/,\" \")\n string = string.downcase\n return string\n end", "def clean_phrase\n clean_phrase = @phrase.dup\n clean_phrase.downcase!\n clean_phrase.squeeze!\n clean_phrase.gsub!(/[[:space:]]/, '')\n clean_phrase = clean_phrase.split(//)\n end", "def squish!\n gsub!(/\\A[[:space:]]+/, '')\n gsub!(/[[:space:]]+\\z/, '')\n gsub!(/[[:space:]]+/, ' ')\n self\n end", "def squish!\n gsub!(/\\A[[:space:]]+/, '')\n gsub!(/[[:space:]]+\\z/, '')\n gsub!(/[[:space:]]+/, ' ')\n self\n end", "def solution(string)\n string.gsub(/(?=[A-Z])/, ' ')\nend", "def custom_squeeze(string)\n final = \"\"\n chars = string.split(\"\")\n chars.each_with_index { |char, index| char == chars[index + 1] ? next : final << char }\n final\nend", "def whitespace\n @input = @input.gsub(/\\ +/, ' ').strip\n end", "def custom_squeeze(string)\n final = \"\"\n chars = string.split(\"\")\n chars.each_with_index { |char, index| char == chars[index + 1] ? next : final << char }\n final\nend", "def cleanup(string)\n i = 0\n final = ''\n while i < string.length\n final << (('a'..'z').cover?(string[i]) ? string[i] : ' ')\n i += 1\n end\n final.squeeze(' ')\nend", "def normalize( text )\n text.gsub(/\\s/,'').gsub(/[[:punct:]]/, '').gsub(/\\p{S}/,'').downcase\nend", "def right_strip(string)\n whitespaces = [\"\\n\", \"\\t\"]\n i = string.length-1\n i2 = 0\n output = \"\"\n while i>=0\n if string[i] == whitespaces[1] || string[i] == whitespaces[2]\n i-=1 \n else\n while i2<=i\n output += string[i2]\n i2+=1\n end\n return output\n end\n end\n return output\nend", "def cleanup(str)\n clean = str.chars.map do |char|\n ('a'..'z').include?(char) ? char : ' '\n end\n clean.join.squeeze(' ')\nend", "def cleanup(str)\n str.gsub(/[^a-zA-Z]+/, ' ')\nend", "def normalize_spacing(text)\n text\n .delete(REMOVED_CHARACTERS)\n .tr(SQUEEZED_SPACES, ' ')\n .squeeze(' ')\n .sub(LEADING_SPACES, '')\n .sub(TRAILING_SPACES, '')\n .tr(NON_BREAKING_SPACE, ' ')\n end", "def remove_whitespace\n # NOTE: According to the docs, \\s only matches [ \\t\\r\\n\\f], i.e. it does not\n # match e.g. non-breaking space (&nbsp). The POSIX character class\n # [[:space:]] does match non-breaking space. This is relevant because\n # in Heroku, space in ENV variables might be translated as &nbsp.\n # DOC: http://ruby-doc.org/core-2.5.1/Regexp.html#class-Regexp-label-Character+Classes\n # SOURCE: http://stackoverflow.com/a/13288542\n gsub(/[[:space:]]/, '')\n end", "def cleanup(str)\n\tnew_str = str.gsub(/[^a-z]/i, ' ').split.join(' ')\n\t\" #{new_str} \"\nend", "def cleanup(string)\n\ts = string.gsub(/[^0-9a-z]/i, ' ')\n\ts.squeeze(\" \")\nend", "def clean_string(input)\r\n unless input.nil?\r\n input = input.to_s.gsub(/^[\\s]+|[\\s]+$/, \"\")\r\n end\r\n return input\r\n end", "def cleanup_noreg(string)\n blocks = string.split\n result = blocks.map do |word|\n word = word.chars.map! do |char|\n if char.downcase == char.downcase.upcase\n ' '\n else \n char\n end\n end\n word = word.join\n # p word\n #p word.squeeze(\" \")\n #word.squeeze(\" \")\n # take note that here +*& is a block or word, and gets replaced by a space without\n # any contiguous letter chars\n # so after join on line 48, there are 3 spaces between my and line, without the squeeze call\n word\n end\n result = result.join(' ').squeeze(' ')#.squeeze\nend", "def normalize\n self.clean_extra_spaces.split.map{|w| w.size>2 ? w.capitalize : w.downcase}.join(' ')\n end", "def trim_all_whitespace(text)\n text.to_a.map do |line|\n left_spacing(line) + line.squeeze(\" \").squeeze(\" \").lstrip #the 2. is a tab\n end.join\n end", "def normalize_whitespace(line)\n line.gsub(/\\s+/, ' ')\n end" ]
[ "0.75317085", "0.7494958", "0.7484309", "0.7325645", "0.72946334", "0.72815096", "0.72740895", "0.7260003", "0.7245805", "0.722515", "0.72219664", "0.72097844", "0.7208126", "0.71972007", "0.7180246", "0.7164524", "0.7160159", "0.7153445", "0.7151262", "0.7133045", "0.7121906", "0.7108375", "0.71050215", "0.7078216", "0.7073324", "0.7030287", "0.7022277", "0.7013066", "0.69937056", "0.6993174", "0.6993174", "0.6977287", "0.6971823", "0.6971823", "0.6955982", "0.6921306", "0.6915047", "0.69080406", "0.6900312", "0.68912905", "0.6885613", "0.68679637", "0.68390524", "0.6828421", "0.68204314", "0.67787325", "0.6776876", "0.6775872", "0.67737275", "0.67715156", "0.6760939", "0.67478764", "0.6731933", "0.671632", "0.67127675", "0.6711644", "0.67098916", "0.6699883", "0.6685664", "0.6683639", "0.6683003", "0.668287", "0.6671661", "0.6670292", "0.6669323", "0.6664179", "0.66561776", "0.6655192", "0.6654702", "0.66510075", "0.66431135", "0.6639609", "0.6634004", "0.660748", "0.65997624", "0.65893686", "0.658657", "0.65806603", "0.6576471", "0.6576471", "0.6570741", "0.6566764", "0.6566764", "0.6564251", "0.65600723", "0.65554905", "0.65421015", "0.6526963", "0.6525114", "0.65131766", "0.65087014", "0.6506877", "0.65006226", "0.64987546", "0.6493677", "0.6487554", "0.64869785", "0.6484471", "0.6484078", "0.6482939", "0.64814365" ]
0.0
-1
A frequent practice is to place the standard CRUD actions in each controller in the following order: index, show, new, edit, create, update and destroy. index(): show a list of recipes
def index() @recipes, @options = model_recipes({}) @title = @options[:title] # continue to /views/recipes/index.html.erb with @recipes, @title end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n # @recipes = Recipe.all\n end", "def index\n #We want to retrieve data from the database and pass these data to the \"INDEX VIEW\". We'll do using this variable\n #We will sort all recipes based on the thumb-up counter. We must use \"REVERSE\" method because by default sorting starts from the lowest value.\n #Here the badsic code is \"@recipes = Recipe.all\". But we will use \"PAGINATION\" gem to list recipes in multiple pages.\n @recipes = Recipe.paginate(page: params[:page], per_page: 1)\n end", "def index\n @recipes = Recipe.all\n end", "def index\n @recipes = Recipe.all\n end", "def index\n @recipes = Recipe.all\n end", "def index\n @recipes = Recipe.all\n end", "def index\n @recipes = Recipe.all\n end", "def index\n @recipes = Recipe.all\n end", "def index\n @recipes = Recipe.all\n end", "def index\n @recipes = Recipe.all\n end", "def index\n @recipes = Recipe.all\n end", "def index\n @recipes = Recipe.all\n end", "def index\n @recipes = Recipe.all\n end", "def index\n @recipes = Recipe.all\n end", "def index\n @recipes = Recipe.all\n end", "def index\n @recipes = Recipe.all\n end", "def index\n @recipes = Recipe.all\n end", "def index\n @recipes = Recipe.all\n @ingredients = Ingredient.all\n @cuisines = Cuisine.all\n @categories = Category.all\n end", "def index\n @recipes = Recipe.all\n @recipe = Recipe.new \n end", "def index\n @recipes = Recipe.all\n @recipe = Recipe.new\n @user = User.find_by_id(current_user.id)\n end", "def actions\n ['index', 'show', 'new', 'create', 'edit', 'update', 'destroy']\n end", "def index\n @page_title = \"All Recipes\"\n @recipes = Recipe.all\n end", "def index \n # What's in between the def & the end is all the work\n @foods = Food.all\n end", "def index\n render 'recipes/index'\n end", "def index\n @recipes_foods = RecipesFood.all\n end", "def index\n @recipes = Recipe.all.order(name: :asc)\n end", "def index\n @recipe_lists = RecipeList.all\n end", "def index\n @recipes = Recipe.render_all\n end", "def index\n @recipes = Recipe.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recipes }\n end\n end", "def index\n recipes = Recipe.all\n render status: :ok, json: recipes\n end", "def index\n @recipe_items = RecipeItem.all\n end", "def index\n @recipes = Recipe.order('name')\n end", "def index\n add_to_sortable_columns(\"search\", :model => Recipe)\n if params[:user_id] && logged_in? && @current_user.id.to_i == params[:user_id].to_i\n @user = User.find(params[:user_id])\n @recipes = @user.recipes.paginate(:all,\n :order => sortable_order('search', Recipe, 'title'),\n :page => params[:page])\n elsif params[:user_id]\n @user = User.find(params[:user_id])\n @recipes = @user.recipes.paginate_public(:all,\n :order => sortable_order('search', Recipe, 'title'),\n :page => params[:page])\n else\n @recipes = Recipe.paginate(\n :conditions => [\"NOT private OR user_id = ?\", @current_user.id],\n :order => sortable_order('search', Recipe, 'id'),\n :page => params[:page])\n end\n # So that after adding a food we can come back to this\n store_location\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @recipes.to_xml }\n end\n end", "def index\n \t@recipe = Recipe.all.order(\"name ASC\")\n end", "def index\n @recipes = Recipe.where(user_id: current_user.id)\n end", "def index\n @recipes = Recipe.all\n respond_to do |format|\n format.html {}\n format.json { render json: @recipes }\n end\n end", "def index\n\n @recipes = Recipe.all\n @recipe = current_user.recipes.new if can? :new, Recipe\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recipes }\n end\n end", "def index\n @ingredient_recipes = IngredientRecipe.all\n end", "def index \n recipes = Recipe.all\n #render will return the object back in json format so that it can be used by the frontend\n render json: recipes, except: [:created_at, :updated_at]\n end", "def index\n @list_product_recipes = ListProductRecipe.all\n end", "def index\n @recipe = Recipe.all.order(\"created_at DESC\")\n end", "def index\n if params[:book_id]\n @book = Book.find(params[:book_id])\n recipes = @book.recipes\n render json: RecipeSerializer.new(recipes).to_serialized_json\n else \n recipes = Recipe.all.order(:name)\n render json: RecipeSerializer.new(recipes).to_serialized_json\n end\n end", "def index\n @recipe_ingredients = RecipeIngredient.all\n end", "def index\n @meal_recipes = MealRecipe.all\n end", "def index\n # byebug\n if current_user\n recipes = Recipe.all \n render json: recipes\n else \n render json: { errors: [\"Not Authorized\"] }, status: :unauthorized\n end\n end", "def index\n Chef.all\n end", "def index\n\t\t@recipes = Recipe.where(user_id: session[:user_id])\n\t\tif @recipes\n\t\t\trender json: @recipes.to_json(:include => [:inventories])\n\t\telse\n\t\t\tflash[:error] = \"You haven't saved any recipes yet! Search now :)\"\n\t\t\trender status: 400, nothing: true\n\t\tend\n\tend", "def index # Only view\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end" ]
[ "0.72133416", "0.7204634", "0.7106963", "0.7106963", "0.7106963", "0.7106963", "0.7106963", "0.7106963", "0.7106963", "0.7106963", "0.7106963", "0.7106963", "0.7106963", "0.7106963", "0.7106963", "0.7106963", "0.7106963", "0.7057108", "0.70115954", "0.7006986", "0.69713455", "0.69660276", "0.68167317", "0.67845637", "0.6745432", "0.6668256", "0.66388065", "0.6638486", "0.6587156", "0.6582819", "0.6578134", "0.65766096", "0.6570504", "0.655597", "0.651177", "0.6477923", "0.6472956", "0.64603513", "0.6456556", "0.6427506", "0.6422442", "0.6367794", "0.6353892", "0.63468236", "0.6335861", "0.633356", "0.6327996", "0.63245004", "0.63153154", "0.63153154", "0.63153154", "0.63153154", "0.63153154", "0.63153154", "0.63153154", "0.63153154", "0.63153154", "0.63153154", "0.63153154", "0.63153154", "0.63153154", "0.63153154", "0.63153154", "0.63153154", "0.63153154", "0.63153154", "0.63153154", "0.63153154", "0.63153154", "0.63153154", "0.63153154", "0.63153154", "0.63153154", "0.63153154", "0.63153154", "0.63153154", "0.63153154", "0.63153154", "0.63153154", "0.63153154", "0.63153154", "0.63153154", "0.63153154", "0.63153154", "0.63153154", "0.63153154", "0.63153154", "0.63153154", "0.63153154", "0.63153154", "0.63153154", "0.63098776", "0.63098776", "0.630401", "0.630401", "0.630401", "0.630401", "0.630401", "0.630401", "0.630401", "0.630401" ]
0.0
-1
Returns the Recipe object for the recipe id specified in the url params.
def set_recipe @recipe = Recipe.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_recipe\n @recipe = Recipe.find(params[:id])\n end", "def find_recipe\n @recipe = Recipe.find(params[:id])\n end", "def show\n recipe_id = params[:id].to_i\n @recipe = Recipe.find(recipe_id)\n end", "def show(id) \n response = request(:get, \"/recipes/#{id}.json\")\n response.first[1]\n end", "def find_recipe\n \t\t@recipe = Recipe.friendly.find(params[:id])\n \tend", "def set_recipe\n @recipe = RecipeApi.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.where(id: params[:id]).first\n render_404 unless @recipe\n end", "def set_recipe\r\n @recipe = Recipe.find_by(id: params[:id])\r\n end", "def get_recipe_by_id(recipe_id)\n\t\t\t\trecipe = Recipe.find_by(id: recipe_id)\n\t\t\t\trecipe.tags = RecipeTag.where('recipe_id = ?', recipe.id).pluck(:tag)\n\t\t\t\trecipe.ingredients = RecipeIngredient.where('recipe_id = ?', recipe.id).pluck(:ingredient)\n\n\t\t\t\treturn recipe\n\t\t\tend", "def set_recipe\n @recipe = Recipe.friendly.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.friendly.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find params[:id]\n end", "def show\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\r\n @recipe = Recipe.friendly.find(params[:id])\r\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n end", "def find(id)\n params = {\n 'sys.id': id\n }\n entry = fetch(params).first\n raise Exceptions::RecordNotFound if entry.blank?\n\n to_recipe(entry)\n end", "def set_recipe\n @recipe = Recipe.friendly.find(params[:id])\n end", "def show\n\t\t@recipe = Recipe.find(params[:id])\n\tend", "def set_recipe\n @recipe = if params[:name]\n Recipe.find_by(name: params[:name])\n else\n Recipe.find_by(id: params[:id])\n end\n end", "def recipe_instance(recipe_name) \n Recipe.find_by name: recipe_name\n end", "def set_recipe\n @recipe = Recipe.find(params[:id]) # Find the recipe\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\n \n end", "def current_recipe\n recipe = Recipe.find(params[:id])\n end", "def show\n recipe = EdamamApiWrapper.show_recipe(params[:id])\n if recipe == nil\n flash[:error] = \"Recipe does not exist. Please do a new recipes search.\"\n redirect_to root_path\n else\n @recipe = recipe\n end\n end", "def set_recipe\n @recipe = Recipe.find(params[:id])\nend", "def show\n respond_with Recipe.find(params[\"id\"])\n end", "def recipe (recipe_id, name)\n if recipe_id\n this_recipe = Recipe.find(recipe_id.to_i)\n else\n this_recipe = Recipe.find_by(name)\n end\n\n creation = {\n :name => this_recipe[:name],\n :instructions => this_recipe.instructions.all,\n :ingredients => this_recipe.ingredients.all\n }\n # return the object\n creation\n end", "def set_recipe\n @recipe = Recipe.find(params[:recipe_id])\n end", "def show\n @recipe = RecipeCacheService.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.includes(:ingredients, :references, :components).find(params[:id])\n end", "def edit\n @recipe = Recipe.find(params[:id])\n end", "def edit\n\t\t@recipe = Recipe.find(params[:id])\n\tend", "def edit\n @recipe = Recipe.find(params[:id])\nend", "def show\n recipe = Recipe.find(params[:id])\n # recipes = Recipe.find_by(params[:id])\n # render json: recipe\n render json: recipe\n end", "def show\n # instance variable @recipe - Recipe(table) .find method using \n # params hash by id and passing to show view\n @recipe = Recipe.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.render(params[:id])\n end", "def set_recipe\n @recipe = Recipe\n .includes(:category, :images, :recipe_tags, :tags, :ingredient_recipes,\n :ingredients)\n .find(params[:id])\n end", "def edit_basics\n @recipe = Recipe.find(params[:id])\n end", "def userRecipe\n @user_id = params[:id]\n @user = User.find_by(id: @user_id)\n @recipes = Recipe.where(user_id: @user_id)\n end", "def set_recipe\n @user = User.find(params[:user_id])\n @recipe = @user.recipes.find(params[:id])\n end", "def show\n @recipe = EdemamApiWrapper.show_recipe(params[:uri])\n end", "def show\n @data = @recipe.read(params[:id])\n render json: @data\n end", "def edit\n #@recipe = Recipe.find(params[:id])\n \n \n end", "def set_recipe_item\n @recipe_item = RecipeItem.find(params[:id])\n end", "def recipe_finder(recipe_id)\n system 'clear'\n Recipe.all.select{|recipe| recipe.id == recipe_id}.each do |i|\n puts i.name.upcase\n puts \"Rating: #{i.rating}\"\n puts \"Cooking Time: #{i.time} hours\"\n puts \"Difficulty Level: #{i.difficulty}\"\n @recipe_ingredient = i.ingredient\n end\n prompt.select(\"What would you like to do?\") do |menu|\n menu.choice \"See ingredients\", -> {recipe_ingredients(recipe_id)}\n menu.choice \"Choose a different protein\", -> {choose_protein}\n menu.choice \"Exit\", -> {exit_helper}\n end\n end", "def recipe_info_for(id)\n response = Faraday.get(\"https://api.spoonacular.com/recipes/#{id}/information?includeNutrition=true&apiKey=#{spoonacular_key}\")\n JSON.parse response.body\n end", "def get_recipes(section)\n # Example: https://terraria.gamepedia.com/index.php?title=Recipes/Iron_Anvil&action=raw\n @connection.get '/index.php', {\n 'title' => \"Recipes/#{section}\",\n 'action' => 'raw'\n }\n end", "def get_recipe(id)\n recipe = Recipe.find(id)\n url = \"https://api2.bigoven.com/recipe/steps/#{recipe.id}?&api_key=#{ENV['API_KEY']}\"\n uri = URI(url)\n response = Net::HTTP.get(uri)\n # puts response\n\n JSON.parse(response)[\"Ingredients\"].each do |ingredient|\n # recipe.ingredients.create!(\n if (!Ingredient.exists?(ingredient[\"IngredientID\"])) \n Ingredient.create!(\n id: ingredient[\"IngredientID\"],\n name: ingredient[\"Name\"],\n html_name: ingredient[\"HTMLName\"]\n )\n end\n end\n\n if (recipe.recipe_ingredients.count > 0)\n recipe.recipe_ingredients.destroy_all\n recipe.save\n recipe.reload\n end\n\n JSON.parse(response)[\"Ingredients\"].each do |ingredient|\n \n # if (!recipe.recipe_ingredients.find_by(ingredient_id: ingredient[\"IngredientID\"]))\n recipe.recipe_ingredients.create!(\n ingredient_id: ingredient[\"IngredientID\"],\n quantity: ingredient[\"Quantity\"],\n display_quantity: ingredient[\"DisplayQuantity\"],\n unit: ingredient[\"Unit\"],\n metric_quantity: ingredient[\"MetricQuantity\"],\n metric_display_quantity: ingredient[\"MetricDisplayQuantity\"],\n metric_unit: ingredient[\"MetricUnit\"],\n preparation_notes: ingredient[\"PreparationNotes\"]\n )\n # end\n end\n \n recipe.steps = ''\n steps = JSON.parse(response)[\"Steps\"]\n steps.each do |step|\n step != steps.last ? recipe.steps += step[\"Text\"] + '$' : recipe.steps += step[\"Text\"]\n # recipe.steps += step[\"Text\"] + ','\n end\n \n recipe.save\n end", "def set_recipeingredient\n @recipeingredient = Recipeingredient.find(params[:id])\n end", "def set_recipe_page\n @recipe_page = RecipePage.find(params[:id])\n end", "def set_recipe\n @recipe = Recipe.find_by(id: params[:id])\n @message = \"Cannot find recipe with id #{params[:id]}\"\n end", "def set_ingredient_recipe\n @ingredient_recipe = IngredientRecipe.find(params[:id])\n end", "def edit(id, options = {})\n optional = [:label,\n :description,\n :compatible_with,\n :script_type\n ]\n params.accepts(optional).validate! options\n request(:put, \"/recipes/#{id}.json\", default_params(options))\n end", "def set_recipe\n I18n.locale = params[:locale]\n @recipe = Recipe.friendly.find(params[:id])\n end" ]
[ "0.7689893", "0.7534472", "0.75137156", "0.7370697", "0.7344835", "0.7227298", "0.7195498", "0.7134615", "0.71146107", "0.7011195", "0.7011195", "0.6993181", "0.69713795", "0.6968259", "0.6967425", "0.69656247", "0.69656247", "0.69656247", "0.69656247", "0.69656247", "0.69656247", "0.69656247", "0.69656247", "0.69656247", "0.69656247", "0.69656247", "0.69656247", "0.69656247", "0.69656247", "0.69656247", "0.69656247", "0.69656247", "0.69656247", "0.69656247", "0.69656247", "0.69656247", "0.69656247", "0.69656247", "0.69656247", "0.69656247", "0.69656247", "0.69656247", "0.69656247", "0.69656247", "0.69656247", "0.69656247", "0.69656247", "0.69656247", "0.69656247", "0.69656247", "0.69656247", "0.69656247", "0.69656247", "0.69656247", "0.69656247", "0.69656247", "0.69442916", "0.69442916", "0.69442916", "0.69442916", "0.69442916", "0.6933251", "0.6901238", "0.6851915", "0.6850718", "0.68398374", "0.67867655", "0.6784215", "0.6746988", "0.6744099", "0.6731194", "0.6703521", "0.6687126", "0.6683554", "0.6673643", "0.6658803", "0.66432995", "0.660903", "0.6604679", "0.66021305", "0.65729594", "0.6518106", "0.64566386", "0.6410788", "0.6388954", "0.6348536", "0.62776804", "0.62664217", "0.6266419", "0.6257781", "0.6230758", "0.6161428", "0.614927", "0.61214495", "0.6099712", "0.6079373", "0.6061032", "0.60605055", "0.6055106", "0.6046398" ]
0.68865424
63
Returns true/false. True = logged in user is owner/Chef of the Recipe object that is the target of this action.
def require_same_user_or_admin # Note: set_recipe has already been executed first because of before_action above and @recipe object now exists. if (current_user != @recipe.chef) && !current_user.admin? flash[:danger] = "You can only edit your own recipes" redirect_to recipes_path else return true end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def owner?\n resource.user_id == current_user.id\n end", "def authorized_to_edit?(recipe)\n current_user == recipe.user\n end", "def owner?(current_user)\n current_user && (self.user == current_user || current_user.has_role?(:refinery))\n end", "def user_is_owner?\n current_cookbook.is_owner?(current_user)\n end", "def cookbook_owner?\n if current_cookbook && current_user.id != current_cookbook.owner.id\n redirect_to sections_path, alert: \"As a Contributor you may only access the \\\"Recipes\\\" and \\\"Preview\\\" pages for the cookbook.\"\n end\n end", "def owner? (user)\n user == owner\n end", "def user_owner_entry?\n user_entry? && principle == \"OWNER\"\n end", "def is_owner\n object == current_user\n end", "def owner?(current_user)\n user == current_user\n end", "def owned?\n user.present?\n end", "def is_owner?(this_user)\n user == this_user\n end", "def owner?(user)\n\t\tuser.id == self.user.id\n\tend", "def owned_by?(user)\n if (access_restricted?)\n return self.acl.owner?(user)\n end\n return false\n end", "def owner? usr\n user_id == usr.id\n end", "def is_owner?(user)\n user.id == self.user_id\n end", "def owner?(resource:)\n current_user.present? && resource&.user_id == current_user.id\n end", "def owned_by?(user)\n return false unless user.is_a? User\n \n # allow admins and project owners to edit\n user.admin? or self.owner == user\n end", "def owned_by?(user)\n return false unless user.is_a? User\n \n # allow admins and project owners to edit\n user.admin? or self.owner == user\n end", "def editable_by?(user)\n \tuser && user == owner\n\tend", "def object_owner?\n User.find(params[:user_id]) == current_user\n end", "def owned?(user_to_check = current_user)\n user_to_check ? self.creator == user_to_check : false\n end", "def owner?\n self.role_level == 0 ? true : false\n end", "def is_owner?(user)\n !user.nil? && (self.user_id == user.id)\n end", "def is_owner_of?(thing)\n return false unless thing.user == self\n true\n end", "def editable_by?(user)\n\t \t# user && user == owner\n\t user == user\n \tend", "def owner?(id)\n if current_user.id == id\n return true\n else\n return false\n end\n end", "def owned_by?(u)\n self.user == u\n end", "def is_owner?(item)\n current_user_id == item.user_id\n end", "def is_owner\n if user_signed_in?\n if current_user.id == Cause.find(params[:id]).user_id\n return true\n else\n redirect_to causes_path\n end\n else\n redirect_to new_user_session_path\n end\n end", "def owner?(user)\n user == owner || owners.include?(user)\n end", "def update?\n user_is_owner_or_admin?\n end", "def is_owner?\n Account.current ? Account.current.has_owner?(self) : false\n end", "def object_owner_for_resource?(object)\n object.user == current_user\n end", "def is_owned_by_user?(user)\n self.user == user\n end", "def owner?(post_owner) # <= User object\n current_user == post_owner\n end", "def article_owner?(obj)\n\t\t\tcurrent_user.id == obj.user_id\n\t\tend", "def is_resource_owner?(resource)\n current_user && current_user.id == resource.user_id\n end", "def owned_by?(actor)\n # defaults to false. Override if resource has owner\n false\n end", "def has_owner(user)\n return self.user.id==user.id\n end", "def owned_by?(user_id)\n user_id = user_id.id if user_id.is_a?(User)\n has_role(user_id, :creator)\n end", "def canEdit?(user=current_user,owner=nil)\n return false if user.nil?\n return true if user.name == owner.name\n return true if self.isAdmin?(user)\n false\n end", "def owner?(c_utor)\n contribution.owner?(c_utor)\n end", "def owner_required?\n !Refinery::Multisites.user_class.nil?\n end", "def owner_of(resource)\n id == resource.user_id ? true : false\n end", "def owner?\n record.id == user.id\n end", "def owned_by?(current_user)\n current_user && user_id == current_user.id\n end", "def owner_of_dog?\n dog_has_owner? && current_user ? dog_owner.id == current_user.id : false\n end", "def owned_by? a_user\n a_user == program.moderator\n end", "def owned_by? a_user\n a_user == user\n end", "def user_is_guild_owner?\n @guild = Guild.find(User.find(session[:user_id])[:guild_id])\n return (@guild[:owner_id] == session[:user_id]) ? true : false\n end", "def update?\n owner? || user.is?(:admin)\n end", "def check_owner_user\n @guild = Guild.find(@invite[:guild_id])\n if self.admin?\n return 1\n end\n return (@guild[:owner_id] == session[:user_id]) ? 1 : nil\n end", "def allow(owner)\n u = User.find(session[:user_id])\n if u.role == :admin\n return true\n else\n if u.id == owner.id\n return true\n else\n return false\n end\n end\n end", "def user_is_owner_or_admin?\n record.reading.user == user || user.try(:admin?)\n end", "def update?\n user_is_owner? || user_is_admin?\n end", "def user_is_owner_or_admin?\n record.user == user || user.try(:admin?)\n end", "def recipe_owner\n unless recipe_owner?(current_user, @recipe)\n render json: { errors: [\"User not authorized to modify recipe that doesn't belong to them\"] }, status: :bad_request\n end\n end", "def user?\n get_mode == :user\n end", "def update?\n user_is_owner_or_admin?\n end", "def update?\n user_is_owner_or_admin?\n end", "def update?\n user_is_owner_or_admin?\n end", "def editable_by?(user)\n\t\tuser && user == author\n\tend", "def owner?\n name == 'owner'\n end", "def is_potential_user?\n\t\ttrue\n\tend", "def has_owner? user\n self.account_users.where(user: user, is_owner: true).count > 0\n end", "def owner?\n customer.owner_id == id\n end", "def owner?\n return if current_user == @event.creator\n\n redirect_back(fallback_location: root_path, alert: 'Unauthorized request!')\n end", "def modifiable?(user)\n RetroCM[:ticketing][:author_modifiable][:tickets] == true && self.user == user\n end", "def requested_by?(resource)\n user = resource.respond_to?(:owner) ? resource.owner : resource\n case\n when current_resource_owner.nil?\n false\n when !user.is_a?(current_resource_owner.class)\n false\n when current_resource_owner.id == user.id\n true\n else\n false\n end\n end", "def user_is_contributor?\n !current_cookbook.is_owner?(current_user)\n end", "def hasOwner? \n\t\tunless self.author_id.nil? || self.author_id == 0\n\t\t\tUser.find(self.author_id)\n\t\tend\n\n\tend", "def owner?(photo)\n !photo.nil? && photo.owner == current_user\n end", "def is_owner\n cause_num = Support.find(params[:id]).cause_id\n cause = Cause.find(cause_num)\n if user_signed_in?\n if current_user.id == Support.find(params[:id]).user_id\n return true\n else\n # return them to the page they were at\n redirect_to cause\n end\n else\n # if the user not logged, redirect them to sign up\n redirect_to new_user_session_path\n end\n end", "def is_owner?(object, no_admin = false)\n if current_user && current_user.id === object.user.id && (object.user.is_admin? || !no_admin)\n return true\n elsif is_admin? && !no_admin\n return true\n else\n return false\n end\n rescue\n return false\n end", "def is_owner?(username)\n User.get_user(username).eql?(self.owner)\n end", "def access action\n\t\tif current_user\n \treturn true\n else\n \treturn false\n end\n\n\tend", "def owner\n permission_denied unless session[:user_id] == @idea.user_id\n end", "def is_owner? (opportunity)\n \topportunity.user_id == self.id\n end", "def require_same_user\n if current_user != @recipe.chef and !current_user.admin?\n flash[:danger] = \"You can only edit your own recipes\"\n redirect_to recipes_path\n end\n \n end", "def can_edit?(current_user_id)\n\t\tif User.find(current_user_id) == creator\n\t\t\treturn true\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend", "def set_recipe\n @recipe = Recipe.find(params[:id])\n if @recipe.user.email == current_user.email\n @owner = true\n end\n end", "def managed_by? a_user\n owned_by? a_user || program.moderator == a_user\n end", "def routine_owner\n record.user == user\n end", "def owner?(key = :user_id)\n # Lookup the original user_id\n owner_id = was(key) || send(:\"_#{key}\")\n !owner_id.nil? && owner_id == Volt.current_user_id\n end", "def can_edit?(user)\n user && self.creator_id == user.id\n end", "def creator?(object)\n current_user == object.user ? true : false\n \n end", "def is_view_permitted?(given_user = nil)\n given_user ||= self.current_actor\n\n # Guests can't see circles unless they log in\n return false if given_user.guest?\n \n # Oh look, it's me\n return true if given_user.is_self_or_owner?(self.user)\n \n # Fine, let's check the db\n return Relationship.has_follower?(self.user, given_user, self.levels_can_see)\n end", "def user_can_see?(user)\n !self.private || self.is_owner?(user)\n end", "def can?\n current_user\n end", "def i_am_owner_or_admin(user_id)\n\t\tuser_to_check = User.find(user_id)\n\t\tif user_to_check\n\t\t\tif user_to_check.is_admin\n\t\t\t\treturn true\n\t\t\telse\n\t \t\tif self.user_id == user_to_check.id\n\t \t\t\treturn true\n\t \t\telse\n\t \t\t\treturn false\n\t \t\tend\n\t\t\tend\n\t\tend\n\tend", "def current_user?\n \n end", "def is_owned_by?(user_id)\n self.user_id == user_id\n end", "def manage?\n super || (@user && @user.is_curator?)\n end", "def current_user?(user)\n (user == self.current_user) || admin?\n end", "def user_is_track_owner?(track)\n return false if current_user.nil?\n return true if current_user.has_role?('admin')\n current_user.is_track_owner?(track)\n end", "def readable_by?(user)\n return true if user.has_role?(:admin, resource.unit)\n return true if user.has_role?(:wizard, resource.unit)\n user == resource\n end", "def _accessible? user_or_id, edit_or_view\n # get user id\n user_id = user_or_id.to_i\n # quick response if user is self.agent\n return true if self.agent_id == user_id\n # get user object\n user = user_or_id.is_a?(Fixnum) ? Usage::User.find(user_or_id) : user_or_id\n if user.super?\n return true\n elsif user.agent? or user.manager?\n return true if _accessible_through_family?(user, edit_or_view)\n elsif user.sales_support?\n return true if _accessible_for_sales_support?(user)\n end\n false\n end", "def current_user\n scope == object\n end", "def mayView? ( other_user )\n if ( (not other_user.valid?) or ( other_user.is_a?(User) == false ) )\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"basic check failed\"\n # d other_user.type\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n return false\n end\n user = getUser()\n if ( other_user == user )\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"same user as owner\"\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n return true\n end\n if ( ( self.public_policy == Dfile::PP_MAYVIEW ) or ( self.public_policy == Dfile::PP_MAYEDIT ) )\n return true\n end\n if self.special_users\n special = self.special_users[other_user.id.to_s]\n if special\n if ( ( special == Dfile::PP_MAYVIEW ) or ( special == Dfile::PP_MAYEDIT ) )\n return true\n else\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"User has special permission but not right one\"\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\" \n end\n else\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"User has no special permission\"\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\" \n end\n \n else\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"no special permissions\"\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\" \n end\n return false\n end", "def owner?(project)\n if id == project.user.id\n true\n else\n false\n end\n end" ]
[ "0.7813916", "0.7798049", "0.7795254", "0.7769665", "0.766255", "0.7643245", "0.75947046", "0.7588064", "0.7587782", "0.75078046", "0.7507658", "0.74990517", "0.74274623", "0.7421894", "0.74191236", "0.7410034", "0.7325981", "0.7325981", "0.73257893", "0.7314631", "0.73024523", "0.72987235", "0.7287224", "0.72503406", "0.7220884", "0.722041", "0.721339", "0.7206482", "0.7164417", "0.7163112", "0.7156364", "0.7152821", "0.7151029", "0.7127155", "0.71084684", "0.7092062", "0.70771235", "0.7056489", "0.7052266", "0.7032025", "0.70297056", "0.70296097", "0.702688", "0.7024231", "0.70241463", "0.7023805", "0.70165867", "0.7015216", "0.69906324", "0.6981666", "0.6971971", "0.6969032", "0.6945559", "0.69406646", "0.69361854", "0.693303", "0.693201", "0.69237816", "0.6908553", "0.6908553", "0.6908553", "0.68973315", "0.68728846", "0.6869171", "0.6863767", "0.6860384", "0.6853243", "0.68461263", "0.68288755", "0.6825717", "0.6824725", "0.68206704", "0.6813906", "0.68058956", "0.6805837", "0.68046093", "0.6801112", "0.6790356", "0.67826515", "0.6779721", "0.6768256", "0.6767686", "0.67604077", "0.67581064", "0.6754187", "0.67489815", "0.67395025", "0.67330384", "0.6727462", "0.6722206", "0.67112225", "0.6710516", "0.67102885", "0.66901255", "0.66827375", "0.66778743", "0.66772765", "0.66638875", "0.66611654", "0.6661134" ]
0.7265584
23
GET /spents GET /spents.json
def index @spents = Spent.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @points_spents = PointsSpent.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @points_spents }\n end\n end", "def show\n @stundent = Stundent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stundent }\n end\n end", "def index\n @spots = Spot.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @spots }\n end\n end", "def index\n @consents = Consent.all\n render json: @consents\n end", "def index\n json_response(Spot.all)\n end", "def index\n @spots = Spot.visible.order('id desc').page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @spots }\n end\n end", "def show\n @spot = Spot.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @spot }\n end\n end", "def show\n @lent = Lent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lent }\n end\n end", "def index\n @rents = Rent.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rents }\n end\n end", "def tournaments\n get('sports/en/tournaments.xml')\n end", "def show\n render json: @shelter\n end", "def index\n @sightings = Sighting.all\n render json: @sightings\n end", "def show\n @rent = Rent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rent }\n end\n end", "def show\n @slitter = Slitter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slitter }\n end\n end", "def index\n @shots = Shot.all\n\n render json: @shots\n end", "def index\n @loves = Love.all\n render json: @loves\n end", "def show\n render json: @sighting\n end", "def show\n @roster_spot = RosterSpot.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @roster_spot }\n end\n end", "def list_tenants_for_circles(args = {}) \n get(\"/tenants.json/circles\", args)\nend", "def show\n render json: Seances::UseCases::AvailableSeats.new.call(id: params[:id])\n end", "def show\n @verse = Verse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @verse }\n end\n end", "def show\n @verse = Verse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @verse }\n end\n end", "def show\n @verse = Verse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @verse }\n end\n end", "def show\n @asistence = Asistence.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @asistence }\n end\n end", "def index\n getProfile\n @consents = TherapistConsent.where('therapist_id = ? ', @therapist.id)\n respond_to do |format|\n format.html { render action: 'index' }\n format.json { render :status => 200, :json => { action: 'index', consents: @consents }}\n end\n end", "def index\n @spots = Spot.all\n end", "def index *_\n @trades = owned_trades_view\n\n render json: @trades\n end", "def index\n @verbs = Verb.all\n\n render json: @verbs\n end", "def index\n @spotlights = Spotlight.all\n end", "def current_spots\n\n if current_spots_params[:filter] && current_spots_params[:filter][:location]\n location = RGeo::GeoJSON.decode(current_spots_params[:filter][:location])\n end\n # assign default location (LA City Hall) if one couldn't be deciphered from the params.\n location ||= LA_LOCATION\n\n limit = current_spots_params[:limit] || 20\n\n @spots = Spot.current.near(location).limit(limit).includes(:guesses, :user, :game)\n\n respond_to do |format|\n format.json\n end\n end", "def index\n sighting = Sighting.all \n render json: SightingSerializer.new(sighting)\n end", "def index\n @tenants = keystone.tenants\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @tenants }\n end\n end", "def show\n @points_spent = PointsSpent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @points_spent }\n end\n end", "def index\n @sponsors = @event.sponsors\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sponsors }\n end\n end", "def show\r\n @venue = Venue.fetch(params[:id])\r\n render json: @venue\r\n end", "def show\n @stable = Stable.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stable }\n end\n end", "def show\n @artists = Artist.find(params[:id])\n puts @artists\n render json:@artists, status: :ok\n end", "def show\n @venue = Venue.find(params[:id])\n\n render json: @venue\n end", "def show\n @talent = Talent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @talent }\n end\n end", "def index\n @tournaments = @resource_finder.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tournaments }\n end\n end", "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sponsor }\n end\n end", "def index\n @absents = Absent.joins(:level).joins(:classtype).order(\"created_at DESC\").limit(100)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @absents }\n end\n end", "def show\n @saiken = Saiken.find(params[:id])\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @saiken }\n end\n end", "def index\n @incidents = @quote.incidents.all\n respond_to do |format|\n format.json { render :json => @incidents }\n end\n end", "def index\n @opportunities = Opportunity.all\n\n render json: @opportunities\n end", "def show\n @spot = Spot.visible.find(params[:id])\n @json = [@spot].to_gmaps4rails\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @spot }\n end\n end", "def show\n @lending = Lending.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @lending }\n end\n end", "def index\n @team = Team.find(params[:team_id])\n @sprints = @team.sprints.find(:all)\n\n respond_to do |format|\n format.html\n format.json\n end\n end", "def index\n @gets = Get.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gets }\n end\n end", "def show\n @salesperson = Salesperson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @salesperson }\n end\n end", "def index\n @verbs = Verb.active.to_a \n @lines = @lines.where(:verb_id => params[:verb_id]) unless params[:verb_id].nil? \n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lines }\n end\n end", "def index\n @listings = Listing.by_user(current_user).all\n\n render json: @listings\n end", "def show\n @sitio_entrega = SitioEntrega.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sitio_entrega }\n end\n end", "def index\n @offers = Offer.all\n\n render json: @offers\n end", "def show\n @sentence = Sentence.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sentence }\n end\n end", "def show\n @sighting = Sighting.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sighting }\n end\n end", "def index\n #@verses = Verse.all\n @verses = Verse.paginate(page: params[:page]) \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @verses }\n end\n end", "def index\n render json: @places\n end", "def index\n @trades = Trade.all\n render json: @trades\n end", "def index\n @specialties = Specialty.all\n\n render json: @specialties\n end", "def show\n @solicitud_servicio = SolicitudServicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @solicitud_servicio }\n end\n end", "def show\n @serv = Serv.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @serv }\n end\n end", "def index \n artists = Artist.all \n render json: artists \n end", "def show\n @spot_listing = SpotListing.find(params[:id])\n @user = @spot_listing.user\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @spot_listing }\n end\n end", "def index\n Rails.logger.info('👻 Disraptor: Showing available routes.')\n\n routes = Disraptor::Route.find_all()\n\n render json: { 'disraptor/routes': routes }\n end", "def index\n @sprintstories = Sprintstory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sprintstories }\n end\n end", "def show\n @stakeholder = Stakeholder.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stakeholder }\n end\n end", "def index\n @skills = Skill.all\n\n render json: @skills\n end", "def index\n champions = Champion.all\n render json: champions\n end", "def index\n @soils = Soil.where(:field_id => session[:field_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @soils }\n end\n end", "def show\n @love = Love.find(params[:id])\n render json: @love\n end", "def index\n @places = @site.places.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @places }\n end\n end", "def index\n @student_entities = StudentEntity.all\n render json: @student_entities, status: :ok\n end", "def index\n @symptoms = Symptom.all\n\n render json: @symptoms\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reward_and_level }\n end\n end", "def index\n @sesions = Sesion.where(entidad_paraestatal_id: @entidad_paraestatal.id).all\n @suplente = Suplente.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sesions }\n end\n end", "def show\n @trade = owned_trades_view.find(params[:id])\n\n # using render: @trade assumes that there is a route named trade_path,\n render json: @trade\n end", "def vitals\n raise UserNotAuthenticated unless access_token\n\n get('records/vitals')\n end", "def show\n @trade = Trade.find(params[:id])\n @stipulations = @trade.stipulations.order('trade_direction desc')\n @trader1 = Team.find(@trade.trader1_id)\n @trader2 = Team.find(@trade.trader2_id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trade }\n end\n end", "def index\n @spoofers = Spoofer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @spoofers }\n end\n end", "def index\n @spots = Spot.search(params[:search]).order(sort_column + \" \" + sort_direction).paginate(:per_page => 10, :page =>params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @spots }\n end\n end", "def show\n @tsp = Tsp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json:@tsp }\n end\n end", "def show\n @sorder = Sorder.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sorder }\n end\n end", "def index\n @spoilers = Spoiler.all\n\n render json: @spoilers\n end", "def index_invites\n puts \"user: #{@current_user.json_hash[:id]}\"\n dinners = []\n @dinners = @current_user.invited_dinners\n @dinners.each do |dinner|\n dinners << dinner.all_info\n end\n render json: dinners\n end", "def spot\n if Api::V1::Spot.exists?(params[:id])\n spot = Api::V1::Spot.find(params[:id])\n render json: {\n status: 200,\n message: \"OK\",\n spot: Api::V1::SpotSerializer.new(spot), \n }\n else\n render json: {\n status: 404,\n message: \"Det finns ingen birdspot med det id:t.\"\n }\n end\n end", "def show\n @kennel_litter = KennelLitter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kennel_litter }\n end\n end", "def index\n shoutouts = Shoutout.where(user_ids: params[:id])\n shoutouts = policy_scope(shoutouts)\n render json: shoutouts\n end", "def index\n @sales = Sale.all\n\n render json: @sales\n end", "def index\n @shelters = Shelter.where(filtering_params)\n render json: @shelters\n end", "def meals\n get(\"/user/#{@user_id}/meals.json\")\n end", "def show\n @party = Party.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @party }\n end\n end", "def index\n @peds = Ped.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @peds }\n end\n end", "def index\n player = Player.all\n render json: players, status: 200\n end", "def index\n if params[:keyword]\n @spots = Spot.find(:all, :conditions => [\"name like ?\", \"%#{params[:keyword]}%\"])\n else\n @spots = Spot.find(:all)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @spots }\n format.json { render :json => @spots.to_json(:only => [:name, :latitude, :longitude, :visits_count])}\n end\n end", "def index\n @granted_scopes = GrantedScope.paginate(:page => params[:page], :per_page => 100)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @granted_scopes }\n end\n end", "def show\n @ventas_seguimiento = Ventas::Seguimiento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ventas_seguimiento }\n end\n end", "def show\n @trail = Trail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trail }\n end\n end", "def show\n @trail = Trail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trail }\n end\n end", "def show\n @stashed_inventory = StashedInventory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stashed_inventory }\n end\n end" ]
[ "0.66863346", "0.6218785", "0.6188353", "0.6137427", "0.6125209", "0.6122911", "0.6090993", "0.59377146", "0.59064674", "0.58739614", "0.586759", "0.58445305", "0.58069", "0.5785005", "0.5776749", "0.576828", "0.5742789", "0.5697812", "0.56844914", "0.5678075", "0.56020933", "0.56020933", "0.56020933", "0.5596982", "0.5591157", "0.55775344", "0.5569962", "0.5561983", "0.5545419", "0.55380535", "0.5529679", "0.552889", "0.5525212", "0.55249906", "0.5524042", "0.55035293", "0.548986", "0.5484505", "0.54755527", "0.54667133", "0.5465023", "0.546015", "0.54539627", "0.54524076", "0.54451", "0.54444444", "0.54434943", "0.5437216", "0.5428736", "0.54224855", "0.54120666", "0.54080003", "0.5400766", "0.5400609", "0.53985685", "0.5393366", "0.539225", "0.53881323", "0.5385266", "0.5379856", "0.5376167", "0.5375473", "0.5373251", "0.537253", "0.53684604", "0.53626186", "0.5358873", "0.5357163", "0.53543013", "0.5352478", "0.5351705", "0.53500783", "0.53349143", "0.5330571", "0.5330429", "0.5325097", "0.53239995", "0.53182614", "0.53174615", "0.53113467", "0.53103703", "0.5310133", "0.53063864", "0.53055245", "0.530022", "0.530019", "0.5295315", "0.5291216", "0.52901", "0.52875966", "0.5286703", "0.528536", "0.5284705", "0.5284667", "0.52845246", "0.52819073", "0.52817893", "0.5279825", "0.5279825", "0.52772313" ]
0.7046632
0
GET /spents/1 GET /spents/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @spents = Spent.all\n end", "def index\n @points_spents = PointsSpent.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @points_spents }\n end\n end", "def show\n @stundent = Stundent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stundent }\n end\n end", "def show\n @spot = Spot.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @spot }\n end\n end", "def show\n @slitter = Slitter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slitter }\n end\n end", "def show\n render json: @shelter\n end", "def index\n @spots = Spot.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @spots }\n end\n end", "def show\n @serv = Serv.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @serv }\n end\n end", "def show\n @rent = Rent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rent }\n end\n end", "def index\n json_response(Spot.all)\n end", "def index\n @consents = Consent.all\n render json: @consents\n end", "def show\n @lent = Lent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lent }\n end\n end", "def index\n @spots = Spot.visible.order('id desc').page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @spots }\n end\n end", "def show\n @stable = Stable.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stable }\n end\n end", "def show\n @solicitud_servicio = SolicitudServicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @solicitud_servicio }\n end\n end", "def show\n @points_spent = PointsSpent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @points_spent }\n end\n end", "def show\n @tsp = Tsp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json:@tsp }\n end\n end", "def show\r\n @venue = Venue.fetch(params[:id])\r\n render json: @venue\r\n end", "def show\n @roster_spot = RosterSpot.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @roster_spot }\n end\n end", "def show\n @verse = Verse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @verse }\n end\n end", "def show\n @verse = Verse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @verse }\n end\n end", "def show\n @verse = Verse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @verse }\n end\n end", "def show\n render json: @sighting\n end", "def index\n @rents = Rent.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rents }\n end\n end", "def show\n @salesperson = Salesperson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @salesperson }\n end\n end", "def show\n @spaethi = Spaethi.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @spaethi }\n end\n end", "def show\n @venue = Venue.find(params[:id])\n\n render json: @venue\n end", "def index\n @shots = Shot.all\n\n render json: @shots\n end", "def show\n @sprintstory = Sprintstory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sprintstory }\n end\n end", "def index\n getProfile\n @consents = TherapistConsent.where('therapist_id = ? ', @therapist.id)\n respond_to do |format|\n format.html { render action: 'index' }\n format.json { render :status => 200, :json => { action: 'index', consents: @consents }}\n end\n end", "def show\n @mostsmallmission = Mostsmallmission.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mostsmallmission }\n end\n end", "def index\n @sightings = Sighting.all\n render json: @sightings\n end", "def show\n @asistence = Asistence.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @asistence }\n end\n end", "def show\n @sitio_entrega = SitioEntrega.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sitio_entrega }\n end\n end", "def index\n @team = Team.find(params[:team_id])\n @sprints = @team.sprints.find(:all)\n\n respond_to do |format|\n format.html\n format.json\n end\n end", "def index\n @snps = Snp.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @snps }\n end\n end", "def show\n @talent = Talent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @talent }\n end\n end", "def show\n @ventas_seguimiento = Ventas::Seguimiento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ventas_seguimiento }\n end\n end", "def show\n story = Story.find(params[:id])\n render json: story\n end", "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sponsor }\n end\n end", "def show\n @vessel = Vessel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vessel }\n end\n end", "def show\n @sorder = Sorder.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sorder }\n end\n end", "def show\n @saiken = Saiken.find(params[:id])\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @saiken }\n end\n end", "def show\n @sighting = Sighting.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sighting }\n end\n end", "def show\n @incident = Incident.find(params[:id])\n\n render json: @incident\n end", "def index\n @soils = Soil.where(:field_id => session[:field_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @soils }\n end\n end", "def index\n @loves = Love.all\n render json: @loves\n end", "def show\n @stone = Stone.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stone }\n end\n end", "def show\n @spdatum = Spdatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @spdatum }\n end\n end", "def show\n render json: Seances::UseCases::AvailableSeats.new.call(id: params[:id])\n end", "def show\n @socio = Socio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @socio }\n end\n end", "def show\n @statuspagamento = Statuspagamentoe.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @statuspagamento }\n end\n end", "def show\n #@restroom = Restroom.find(params[:id])\n @venue = client.venue(:query => params[:venue_id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @restroom }\n end\n end", "def show\n @sentence = Sentence.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sentence }\n end\n end", "def show\n @sitio = Sitio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sitio }\n end\n end", "def show\n @competent = Competent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competent }\n end\n end", "def show\n @stakeholder = Stakeholder.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stakeholder }\n end\n end", "def show\n @steam_consumption = SteamConsumption.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @steam_consumption }\n end\n end", "def show\n @spieler = Spieler.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @spieler }\n end\n end", "def show\n @sin = Sin.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sin }\n end\n end", "def show\n @spirit = Spirit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @spirit }\n end\n end", "def show\n @servicio = Servicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @servicio }\n end\n end", "def show\n @party = Party.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @party }\n end\n end", "def show\n @spot_listing = SpotListing.find(params[:id])\n @user = @spot_listing.user\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @spot_listing }\n end\n end", "def show\n params.require(%i[id])\n render json: Ingredient.find_by!(id: params[:id])\n end", "def show\n @socio = Socio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @socio }\n end\n end", "def incident_list_by_id(statuspage_id)\n request :method => :get,\n :url => @url + 'incidents/' + statuspage_id\n end", "def show\n # @passenger = Passenger.find(:name => params[:id])\n # render :json => @passenger\n end", "def show\n @slh_strategy = SlhStrategy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @slh_strategy }\n end\n end", "def show\n @nail_salon = NailSalon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nail_salon }\n end\n end", "def show\n @srsa = Srsa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @srsa }\n end\n end", "def show\n @trail = Trail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trail }\n end\n end", "def show\n @trail = Trail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trail }\n end\n end", "def list_tenants_for_circles(args = {}) \n get(\"/tenants.json/circles\", args)\nend", "def index\n @sprintstories = Sprintstory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sprintstories }\n end\n end", "def show\n @stat = Stat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @stat }\n end\n end", "def show\n @love = Love.find(params[:id])\n render json: @love\n end", "def spot\n if Api::V1::Spot.exists?(params[:id])\n spot = Api::V1::Spot.find(params[:id])\n render json: {\n status: 200,\n message: \"OK\",\n spot: Api::V1::SpotSerializer.new(spot), \n }\n else\n render json: {\n status: 404,\n message: \"Det finns ingen birdspot med det id:t.\"\n }\n end\n end", "def show\n @sprint = Sprint.find(params[:id])\n @stat = Status.find(4)\n @stories = Story.where(\"status_id = ?\", @stat.id)\n @examples = @sprint.stories \n @project_id = @examples.first.project_id\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sprint }\n end\n end", "def show\n @seat = Seat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @seat }\n end\n end", "def show\n @sproject = current_user.sprojects.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sproject }\n end\n end", "def new\n @stundent = Stundent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stundent }\n end\n end", "def show\n student = Student.find(params[:id])\n render json: student\nend", "def show\n @mosttinymobtrail = Mosttinymobtrail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mosttinymobtrail }\n end\n end", "def index\n @sponsors = @event.sponsors\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sponsors }\n end\n end", "def show\n @competency = Competency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competency }\n end\n end", "def show\n @servicetype = Servicetype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @servicetype }\n end\n end", "def show\n render json: @service\n end", "def index\n @tenants = keystone.tenants\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @tenants }\n end\n end", "def show\n render json: Server.where(name: params[:name]).first\n end", "def show\n @venue = Venue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @venue }\n end\n end", "def show\n @patent = Patent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @patent }\n end\n end", "def show\n @coin_set = CoinSet.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @coin_set }\n end\n end", "def show\n @skid = Skid.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @skid }\n end\n end", "def show\n @patient = Patient.find_by(ssn: params[:id])\n if @patient.present?\n render json: @patient, status: 200\n else\n render nothing: true, status: 204\n end\n end", "def show\n @stat = Stat.find(params[:id])\n\n respond_to do |format|\n format.html { render \"show\" }\n format.json { render json: @stat }\n end\n end", "def show\n @parking_spot = ParkingSpot.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @parking_spot }\n end\n end", "def index\n @spoofers = Spoofer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @spoofers }\n end\n end", "def show\n @spiel = Spiel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @spiel }\n end\n end", "def show\n @supermarket = Supermarket.find(params[:id])\n respond_to do |format|\n format.json { render json: @supermarket, status: :ok } \n end \n end", "def show\n @studnet = Studnet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @studnet }\n end\n end" ]
[ "0.6803169", "0.66474986", "0.6499228", "0.62448823", "0.6188258", "0.60508126", "0.6022834", "0.6000953", "0.59974337", "0.59965026", "0.599127", "0.5971303", "0.5963322", "0.59544873", "0.5903539", "0.588983", "0.5881748", "0.5877707", "0.5858243", "0.584796", "0.584796", "0.584796", "0.5815135", "0.58105046", "0.58100855", "0.57915276", "0.57832736", "0.57795995", "0.5769058", "0.57670385", "0.5739597", "0.5739191", "0.5736731", "0.57058066", "0.5705645", "0.5689061", "0.568638", "0.56580234", "0.5652798", "0.5647141", "0.5631656", "0.5616861", "0.5616476", "0.5615543", "0.5613653", "0.5612105", "0.56055486", "0.56006014", "0.5598545", "0.5596911", "0.55886066", "0.55874324", "0.5586477", "0.55831224", "0.5578778", "0.55747956", "0.5574131", "0.55703795", "0.55643296", "0.55597186", "0.55513483", "0.5543972", "0.5541927", "0.55402476", "0.5538118", "0.55357337", "0.5534346", "0.5531788", "0.55312717", "0.552614", "0.5525636", "0.5521772", "0.5521772", "0.5520414", "0.5519545", "0.5518913", "0.55189013", "0.55175793", "0.55175096", "0.55158824", "0.55093175", "0.5508165", "0.5507401", "0.55048954", "0.55045617", "0.55044264", "0.5503987", "0.550003", "0.5499715", "0.5498926", "0.54965746", "0.5491553", "0.5490849", "0.5490384", "0.5484799", "0.5484195", "0.54835796", "0.54807335", "0.54792976", "0.5479029", "0.54787534" ]
0.0
-1
POST /spents POST /spents.json
def create @spent = Spent.new(spent_params) respond_to do |format| if @spent.save format.html { redirect_to @spent, notice: 'Spent was successfully created.' } format.json { render :show, status: :created, location: @spent } else format.html { render :new } format.json { render json: @spent.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_spoonacular\n # %encode ingredients to url\n encoded_ingr = URI.escape(@translated_recipe[:ingredients_list])\n # post call block :\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/parseIngredients?includeNutrition=true\")\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(url)\n request[\"content-type\"] = \"application/x-www-form-urlencoded\"\n request[\"x-rapidapi-key\"] = ENV[\"X_RAPIDAPI_KEY\"]\n request[\"x-rapidapi-host\"] = \"spoonacular-recipe-food-nutrition-v1.p.rapidapi.com\"\n # body of the call with ingredients and servings\n request.body = \"ingredientList=#{encoded_ingr}&#{@recipe_hash[:servings]}\"\n # response\n response = http.request(request)\n end", "def create\n @stundent = Stundent.new(params[:stundent])\n\n respond_to do |format|\n if @stundent.save\n format.html { redirect_to @stundent, notice: 'Stundent was successfully created.' }\n format.json { render json: @stundent, status: :created, location: @stundent }\n else\n format.html { render action: \"new\" }\n format.json { render json: @stundent.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @spot = Spot.new(params[:spot])\n \n respond_to do |format|\n if @spot.save\n format.html { redirect_to @spot, notice: 'Spot was successfully created.' }\n format.json { render json: @spot, status: :created, location: @spot }\n else\n format.html { render action: \"new\" }\n format.json { render json: @spot.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @spot = Spot.new(spot_params)\n\n respond_to do |format|\n if @spot.save\n format.html { redirect_to @spot, notice: 'Spot was successfully created.' }\n format.json { render :show, status: :created, location: @spot }\n else\n format.html { render :new }\n format.json { render json: @spot.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @spents = Spent.all\n end", "def create\n @spot = Spot.new(params[:spot])\n @spot.spot_id = UUIDTools::UUID.timestamp_create().to_s\n @spot.user_id = current_user.id\n\n respond_to do |format|\n if @spot.save\n @userspot = UserSpots.new()\n @userspot.user_spots_id = UUIDTools::UUID.timestamp_create().to_s\n @userspot.spot_id = @spot.spot_id\n @userspot.user_id = current_user.id\n @userspot.save\n format.html { redirect_to @spot, notice: t(:spot_successfully_created) }\n format.json { render json: @spot, status: :created, location: @spot }\n else\n format.html { render action: \"new\" }\n format.json { render json: @spot.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @serving = Serving.new(params[:serving])\n\n respond_to do |format|\n if @serving.save\n format.html { redirect_to @serving, notice: 'Serving was successfully created.' }\n format.json { render json: @serving, status: :created, location: @serving }\n else\n format.html { render action: \"new\" }\n format.json { render json: @serving.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if info = parse_input(params)\n name = info.delete(:name)\n alt_names = info.delete(:alt_names)\n obstacles = info.delete(:obstacles)\n\n if spot = SkateSpot.new(info)\n spot.alt_names = alt_names.map! { |n| SpotName.find_or_create_by(:name => n, :spot => spot) } if alt_names\n spot.name = SpotName.find_or_create_by(:name => name, :spot => spot) if name\n spot.obstacles = obstacles.map! { |o| Obstacle.create(:type => ObstacleType.where(:name => o['type']).first, :geometry => o['geometry'], :spot => spot) } if obstacles\n\n return render :json => { :status => (spot.save == true ? :success : :unprocessable_entity) }\n end\n end\n\n render :json => { :status => :unprocessable_entity }\n\n rescue ActiveRecord::RecordNotSaved\n render :json => { :status => :unprocessable_entity }\n end", "def create\n @serving = Serving.new(serving_params)\n\n respond_to do |format|\n if @serving.save\n format.html { redirect_to @serving, notice: 'Serving was successfully created.' }\n format.json { render :show, status: :created, location: @serving }\n else\n format.html { render :new }\n format.json { render json: @serving.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @spawner = Spawner.new(spawner_params)\n @fieldtrips = Fieldtrip.all\n\n respond_to do |format|\n if @spawner.save\n format.html { redirect_to @spawner, notice: 'Spawner was successfully created.' }\n format.json { render json: @spawner, status: :created, location: @spawner }\n else\n format.html { render action: \"new\" }\n format.json { render json: @spawner.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @spice = Spice.new(spice_params)\n\n if @spice.save\n render json: @spice, status: :created\n else\n render json: @spice.errors, status: :unprocessable_entity\n end\n end", "def create\n quests_params = params.permit(quests: [:mission, :pose, :location])[:quests]\n quests = quests_params.map {|quest_params|\n Quest.new(quest_params)\n }\n\n route_params = params.permit(\n :name,\n :achievement_count,\n :played_count,\n :start_location,\n :description\n )\n\n @route = Route.new({\n user_id: params[:user][:id],\n # user_id: 1,\n quests: quests,\n }.merge(route_params))\n\n respond_to do |format|\n if @route.save\n format.html { redirect_to @route, notice: 'Route was successfully created.' }\n format.json { render action: 'show', status: :created, location: @route }\n else\n format.html { render action: 'new' }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @spending = Spending.new(spending_params)\n respond_to do |format|\n if @spending.save \n format.html { redirect_to new_spending_url, notice: 'Spending was successfully created.' }\n format.json { render action: 'show', status: :created, location: @spending }\n else\n format.html { render action: 'new' }\n format.json { render json: @spending.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @points_spents = PointsSpent.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @points_spents }\n end\n end", "def create\n p_name = params[:spot][:name]\n p_latitude = params[:spot][:latitude]\n p_longitude = params[:spot][:longitude]\n p_address = params[:spot][:address]\n p_type = params[:spot][:type]\n p_img = params[:spot][:img]\n p_rating = params[:spot][:rating]\n p_schedule = params[:spot][:schedule]\n p_telephone = params[:spot][:telephone]\n p_website = params[:spot][:website]\n p_description = params[:spot][:description]\n p_activities = params[:spot][:activities].split(' ')\n p_price = params[:spot][:price]\n \n @spot = Spot.new(\n name: p_name,\n latitude: p_latitude,\n longitude: p_longitude,\n address: p_address,\n type: p_type,\n img: p_img,\n rating: p_rating,\n schedule: p_schedule,\n telephone: p_telephone,\n website:p_website,\n description:p_description,\n activities: p_activities,\n price: p_price\n )\n\n respond_to do |format|\n if @spot.save\n format.html { redirect_to @spot, notice: 'Spot was successfully created.' }\n format.json { render :show, status: :created, location: @spot }\n else\n format.html { render :new }\n format.json { render json: @spot.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # @route = Route.new(params[:route])\n \n waypoints = params[:waypoints]\n creator = params[:creator]\n updated_at = params[:updated_at]\n name = params[:name]\n\n @route = Route.new(waypoints: waypoints, creator: creator, updated_at: updated_at, name: name)\n \n @route.save\n\n render json: @route\n\n # @vote_creator = VoteCreator.new(vote_params)\n # @vote = @vote_creator.vote\n # if @vote_creator.save\n # render json: @vote, status: :created, location: @vote\n # else\n # render json: @vote.errors, status: :unprocessable_entity\n # end\n end", "def create\n passenger = Passenger.new(:name => params[:name], :contact_number => params[:contact_number], :nationality => params[:nationality], :meal_pref => params[:meal_pref])\n passenger.save\n render :json => passenger\n end", "def create\n #@incident = @quote.incidents.new(incident_params)\n logger.info params[:incident]\n params[:incident].each do |incident|\n @incident = @quote.incidents.new(incident)\n @incident.save\n end\n respond_to do |format|\n format.json { render :json => { :code => \"201\", :description => \"Created incidents\"} }\n end\n end", "def create\n @serf = Serve.new(serf_params)\n\n respond_to do |format|\n if @serf.save\n format.html { redirect_to @serf, notice: 'Serve was successfully created.' }\n format.json { render :show, status: :created, location: @serf }\n else\n format.html { render :new }\n format.json { render json: @serf.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tent = Tent.new(tent_params)\n\n respond_to do |format|\n if @tent.save\n format.html { redirect_to admin_tent_path(@tent), notice: 'Tent was successfully created.' }\n format.json { render :show, status: :created, location: @tent }\n else\n format.html { render :new }\n format.json { render json: @tent.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @svote = Svote.new(svote_params)\n \n respond_to do |format|\n if @svote.save\n format.html { redirect_to @svote, notice: 'Svote was successfully created.' }\n format.json { render action: 'show', status: :created, location: @svote }\n else\n format.html { render action: 'new' }\n format.json { render json: @svote.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @spot = Spot.new(params[:spot])\n\n respond_to do |format|\n if @spot.save\n flash[:notice] = 'Spot was successfully created.'\n format.html { redirect_to(@spot) }\n format.xml { render :xml => @spot, :status => :created, :location => @spot }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @spot.errors, :status => :unprocessable_entity }\n end\n end\n end", "def sponser_params\n params.require(:sponser).permit(:name, :Address, :Catagory, :Gander, :Funding, :Typemanagment, :phone, :exprience, :sponcerBio)\n end", "def create\n @stinsfo = Stinsfo.new(stinsfo_params)\n\n respond_to do |format|\n if @stinsfo.save\n format.html { redirect_to @stinsfo, notice: 'Stinsfo was successfully created.' }\n format.json { render :show, status: :created, location: @stinsfo }\n else\n format.html { render :new }\n format.json { render json: @stinsfo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @squad = Squad.new(squad_params)\n\n respond_to do |format|\n if @squad.save\n format.html { redirect_to @squad, notice: 'Squad was successfully created.' }\n format.json { render :show, status: :created, location: @squad }\n else\n format.html { render :new }\n format.json { render json: @squad.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @rent = Rent.new(rent_params)\n\n respond_to do |format|\n if @rent.save\n format.html { redirect_to redirecting_rent_path(@rent.token) }#, notice: 'Rent was successfully created.' }\n format.json { render json: { url: redirecting_rent_path(@rent.token) }, status: :created, location: @rent }\n else\n format.html { render :new }\n format.json { render json: @rent.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sponsor = Sponsor.new(sponsor_params)\n\n respond_to do |format|\n if @sponsor.save\n format.html { redirect_to sponsors_url, notice: 'El auspiciante se creó correctamente.' }\n format.json { render :show, status: :created, location: sponsors_url }\n else\n format.html { render :new }\n format.json { render json: @sponsor.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #birdspotter id must be present\n if params[:birdspotter].blank?\n render json: {\n status: 400,\n message: \"Skaparens id saknas.\" \n }\n end\n \n #at least one bird must be present\n if params[:bird].blank?\n render json: {\n status: 400,\n message: \"En birdspot måste innehålla minst en fågel.\" \n }\n end\n \n #latitude and longitude must be present\n if params[:latitude].blank? || params[:longitude].blank?\n render json: {\n status: 400,\n message: \"En birdspot måste innehålla latitud och longitude.\" \n }\n end\n \n #check if birdspotter exists\n if Api::V1::Birdspotter.exists?(params[:birdspotter])\n \n #if exists find birdspotter\n @birdspotter = Api::V1::Birdspotter.find_by_id(params[:birdspotter])\n \n #create a new spot and append to birdspotter\n @spot = Api::V1::Spot.create(:latitude => params[:latitude], :longitude => params[:longitude])\n if @spot.save\n @birdspotter.spots << @spot\n \n #iterate through all birds and append each bird to newly created spot\n params[:bird].tr(' ','').split(',').each do |bird_id|\n if Api::V1::Bird.exists?(bird_id)\n @bird = Api::V1::Bird.find_by_id(bird_id)\n @spot.birds << @bird\n else\n render json: {\n status: 404,\n message: \"En eller flera fåglar med det id:t finns inte.\"\n }\n end\n end\n else\n render json: {\n status: 400,\n message: @spot.errors.full_messages \n }\n end\n else\n render json: {\n status: 404,\n message: \"Skapare med det id:t finns inte.\" \n }\n \n end\n \n render json: { \n status: 201,\n message: \"Din birdspot är registerad. Tack!\", \n spots: Api::V1::SpotSerializer.new(@spot) \n }\n end", "def create\n @turistic_spot_post = TuristicSpotPost.new(turistic_spot_post_params)\n\n respond_to do |format|\n if @turistic_spot_post.save\n format.html { redirect_to @turistic_spot_post, notice: 'Turistic spot post was successfully created.' }\n format.json { render :show, status: :created, location: @turistic_spot_post }\n else\n format.html { render :new }\n format.json { render json: @turistic_spot_post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @squad = Squad.new(squad_params)\n\n respond_to do |format|\n if @squad.save\n format.html { redirect_to [:api, @squad], notice: 'Squad was successfully created.' }\n format.json { render :show, status: :created, location: @squad }\n\n # create member with membership info to the squad then save\n create_membership\n else\n format.html { render :new }\n format.json { render json: @squad.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sighting = Sighting.new(sighting_params)\n\n if @sighting.save\n render json: @sighting, status: :created, location: @sighting\n else\n render json: @sighting.errors, status: :unprocessable_entity\n end\n end", "def post\n Salesforce.set_http(session[:accesstoken], session[:accessurl])\n \t@response = Salesforce.create_post(params)\n \trespond_to do |format|\n format.json { render :json => @response.to_json}\n # example of multiple reponses mapped to one object\n # format.json { render :json => {:data => @response, :meta => @describe}.to_json}\n \tend\n end", "def create\n @route = Route.new(params[:route])\n\n route_html = Nokogiri::HTML(open(@route.url))\n\n @activity_id = @route.url.split('/').last()\n @api_url = \"https://www.strava.com/api/v3/activities/\" + @activity_id + \"?access_token=9a3dd1938530a0db29fc42f4eedc4ff975e78190\"\n\n parsed_uri = URI.parse(@api_url)\n http = Net::HTTP.new(parsed_uri.host, parsed_uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Get.new(parsed_uri.request_uri)\n response = http.request(request)\n parsed_response = JSON.parse(response.body)\n\n @route.distance = ((parsed_response[\"distance\"].to_f * 0.000621371).round(2)).to_s #Convert meters to miles\n @route.elevation = ((parsed_response[\"total_elevation_gain\"] *3.28084).round(2)).to_s #Convert meters to feet\n @route.map_polyline = parsed_response[\"map\"][\"summary_polyline\"]\n\n if @route.name.empty?\n @route.name = parsed_response[\"name\"]\n end\n\n respond_to do |format|\n if @route.save\n format.html { redirect_to routes_url, notice: 'Your route was submitted successfully, and will be verified by an officer shortly.' }\n format.json { render json: @route, status: :created, location: @route }\n else\n format.html { render action: \"new\" }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @snail = Snail.new(name: params[:snail][:name], owner: params[:snail][:owner], description: params[:snail][:description], speed: Random.new.rand(1..10), endurance: Random.new.rand(1..10), motivation: Random.new.rand(1..10), win: 0, lose: 0)\n\n respond_to do |format|\n if @snail.save\n format.html { redirect_to @snail, notice: 'Snail was successfully created.' }\n format.json { render :show, status: :created, location: @snail }\n else\n format.html { render :new }\n format.json { render json: @snail.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @teams_sponsor = TeamsSponsor.new(teams_sponsor_params)\n\n respond_to do |format|\n if @teams_sponsor.save\n format.html { redirect_to @teams_sponsor, notice: 'Teams sponsor was successfully created.' }\n format.json { render :show, status: :created, location: @teams_sponsor }\n else\n format.html { render :new }\n format.json { render json: @teams_sponsor.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @spot = Spot.new(params[:spot])\n\n respond_to do |format|\n if @spot.save\n format.js\n format.html { redirect_to(@spot, :notice => 'Spot was successfully created.') }\n format.xml { render :xml => @spot, :status => :created, :location => @spot }\n else\n format.js { render :template => '/error.js', :locals => {:title => '作成できませんでした', :message => @spot.errors.full_messages.join(\"\\n\"), :script => nil} }\n format.html { render :action => \"new\" }\n format.xml { render :xml => @spot.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @stance = Stance.new(stance_params)\n @stance.participant = Participant.find_by(:session_id => session[:session_id])\n\n respond_to do |format|\n if @stance.save\n format.html { redirect_to ranking_path }\n format.json { render action: 'show', status: :created, location: @stance }\n else\n format.html { render action: 'new' }\n format.json { render json: @stance.errors, status: :unprocessable_entity }\n end\n end\n end", "def criar_sobrevivente\n @suvivor = Sobrevivente.create(\n name: params[:name], genero: params[:genero], idade: params[:idade],\n lat: params[:lat], lon: params[:lon],\n agua: params[:agua], comida: params[:comida], medicamento: params[:medicamento],\n municao: params[:municao]\n )\n render json: @suvivor\n end", "def create\n @spending_pool = SpendingPool.new(spending_pool_params)\n\n respond_to do |format|\n if @spending_pool.save\n format.html { redirect_to @spending_pool, notice: 'Spending pool was successfully created.' }\n format.json { render action: 'show', status: :created, location: @spending_pool }\n else\n format.html { render action: 'new' }\n format.json { render json: @spending_pool.errors, status: :unprocessable_entity }\n end\n end\n end", "def skater_params\n params.require(:skater).permit(:name, :team, :pos, :goals, :assists, :pool_member_id)\n end", "def post(resource, params)\n case resource\n when \"pedidos\", \"place_order\", \"new_order\" then url = \"/pedidos\"\n when \"envios\", \"shipping\" then url = \"/envios\"\n else url = \"/#{resource}\"\n end\n\n post_request(url, params)\n end", "def create\n @sesion = Sesion.where(entidad_paraestatal_id: @entidad_paraestatal.id).new(params[:sesion])\n\n respond_to do |format|\n if @sesion.save\n format.html { redirect_to [@entidad_paraestatal,@sesion], notice: 'Sesion was successfully created.' }\n format.json { render json: @sesion, status: :created, location: [@entidad_paraestatal,@sesion] }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sesion.errors, status: :unprocessable_entity }\n end\n end\n end", "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", "def create\n @sighting = Sighting.new(sighting_params)\n\n if @sighting.save\n render json: @sighting, status: :created, location: @sighting\n else\n render json: @sighting.errors, status: :unprocessable_entity\n end\n end", "def sale_params\n params.require(:sale).permit(:medicaments => [])\n end", "def new\n @stundent = Stundent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stundent }\n end\n end", "def create\n @director = Director.find(params[:director_id])\n @soaps = @director.soaps.create(soap_params)\n redirect_to director_path(@director)\n\n\n end", "def create_and_invitation_studant(params = {})\n run(:post, \"/invitations\", [201,422], JSON.dump(params))\n end", "def create\n @sity = Sity.new(sity_params)\n\n respond_to do |format|\n if @sity.save\n format.html { redirect_to @sity, notice: 'Sity was successfully created.' }\n format.json { render :show, status: :created, location: @sity }\n else\n format.html { render :new }\n format.json { render json: @sity.errors, status: :unprocessable_entity }\n end\n end\n \n end", "def create\n @sidequest = Sidequest.new(sidequest_params)\n\n respond_to do |format|\n if @sidequest.save\n format.html { redirect_to :back, notice: 'Sidequest was successfully created.' }\n format.json { render :back, status: :created, location: @sidequest }\n else\n format.html { render :new }\n format.json { render json: @sidequest.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend", "def serving_params\n params.require(:serving).permit(:name)\n end", "def create\n @order = Order.new(order_params)\n @order.sponsors = params[:sponsors]\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'El pedido se creó correctamente.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sponsor = Sponsor.new(sponsor_params)\n\n respond_to do |format|\n if @sponsor.save\n format.html { redirect_to @sponsor, notice: 'Sponsor was successfully created.' }\n format.json { render :show, status: :created, location: @sponsor }\n else\n format.html { render :new }\n format.json { render json: @sponsor.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sponsor = Sponsor.new(sponsor_params)\n\n respond_to do |format|\n if @sponsor.save\n format.html { redirect_to @sponsor, notice: 'Sponsor was successfully created.' }\n format.json { render :show, status: :created, location: @sponsor }\n else\n format.html { render :new }\n format.json { render json: @sponsor.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @swot = Swot.new(swot_params)\n\n respond_to do |format|\n if @swot.save\n format.html { redirect_to @swot, notice: 'Swot was successfully created.' }\n format.json { render :show, status: :created, location: @swot }\n else\n format.html { render :new }\n format.json { render json: @swot.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @servant = Servant.new(servant_params)\n\n respond_to do |format|\n if @servant.save\n format.html { redirect_to @servant, notice: 'Servant was successfully created.' }\n format.json { render :show, status: :created, location: @servant }\n else\n format.html { render :new }\n format.json { render json: @servant.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sponsor = @event.sponsors.new(params[:sponsor])\n\n respond_to do |format|\n if @sponsor.save\n format.html { redirect_to [:admin, @event, @sponsor], notice: 'Sponsor was successfully created.' }\n format.json { render json: @sponsor, status: :created, location: @sponsor }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sponsor.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sitio_entrega = SitioEntrega.new(params[:sitio_entrega])\n\n respond_to do |format|\n if @sitio_entrega.save\n format.html { redirect_to @sitio_entrega, notice: 'Sitio entrega was successfully created.' }\n format.json { render json: @sitio_entrega, status: :created, location: @sitio_entrega }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sitio_entrega.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @rent = Rent.new(rent_params)\n\n respond_to do |format|\n if @rent.save\n format.html { redirect_to @rent, notice: 'Rent was successfully created.' }\n format.json { render :show, status: :created, location: @rent }\n else\n format.html { render :new }\n format.json { render json: @rent.errors, status: :unprocessable_entity }\n end\n end\n end", "def stinsfo_params\n params.require(:stinsfo).permit(:name, :place)\n end", "def create\n venture = Venture.new(venture_params)\n\n if venture.save \n render json: {venture: venture}, status: :created\n else\n render json: {status: 'Error', message: 'Venture not saved', data: venture.errors}, status: :unprocessable_entity\n end\n end", "def create\n @slisting = Slisting.new(slisting_params)\n\n respond_to do |format|\n if @slisting.save\n format.html { redirect_to @slisting, notice: 'Slisting was successfully created.' }\n format.json { render action: 'show', status: :created, location: @slisting }\n else\n format.html { render action: 'new' }\n format.json { render json: @slisting.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @trainbot = Trainbot.new(trainbot_params)\n @org = UttranceService.new\n @org.post_uttrance(trainbot_params[:message],trainbot_params[:intent],trainbot_params[:entity],trainbot_params[:start],trainbot_params[:end],trainbot_params[:body]\n )\n respond_to do |format|\n if @trainbot.save\n format.html { redirect_to @trainbot, notice: 'Trainbot was successfully created.' }\n format.json { render :show, status: :created, location: @trainbot }\n else\n format.html { render :new }\n format.json { render json: @trainbot.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n p'*'*800\n p params\n\n @trainer = Trainer.new(trainer_params)\n\n p @trainer\n\n if @trainer.save\n render json: @trainer, status: :created, location: @trainer\n else\n render json: @trainer.errors, status: :unprocessable_entity\n end\n end", "def create\n params[:mentions].each do |men_params|\n men_params = men_params.permit(:ticker_id, :positive_count, :negative_count, :neutral_count)\n @mention = Mention.new(men_params)\n @mention.save\n end\n respond_to do |format|\n msg = { :status => :ok, :message => \"Success!\", :html => '<b></b>' }\n format.html do\n redirect_to '/'\n end\n format.json { render :json => msg }\n end\n end", "def create\n s = Spooge.new()\n create_status = s.save\n n = generate_random_name\n s.name = n\n s.email = \"#{n}@gmail.com\"\n s.touch_date = DateTime.now\n s.status = STATUS[rand(STATUS.length)]\n\n resp = {:create_status => create_status, :record => s}\n render :json => resp\n end", "def create\n @spot = Spot.new(params[:spot])\n @spot.log_user_info(request)\n\n respond_to do |format|\n if (!recaptcha_enabled? || verify_recaptcha(:model => @spot)) and @spot.save\n format.html { redirect_to @spot, notice: 'Spot was successfully created.' }\n format.json { render json: @spot, status: :created, location: @spot }\n else\n format.html { render action: \"new\" }\n format.json { render json: @spot.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @verb = Verb.new(:infinitive => verb_params[:infinitive], :translation => verb_params[:translation], :group => verb_params[:group])\n if @verb.save\n @tenses.each_with_index do |tense, index|\n @forms.each_with_index do |form, index2|\n if(verb_params[tense][form].strip != '')\n @form = Form.new(:content => verb_params[tense][form], :temp => index.to_i, :person => index2.to_i,:verb => @verb)\n @form.save\n end\n end\n end\n end\n\n respond_to do |format|\n if @verb.save\n format.html { redirect_to @verb, notice: 'Verb was successfully created.' }\n format.json { render action: 'show', status: :created, location: @verb }\n else\n format.html { render action: 'new' }\n format.json { render json: @verb.errors, status: :unprocessable_entity }\n end\n end\n end", "def post\n resource.post(request, response)\n end", "def create\n @solicitud = Solicitud.new(solicitud_params)\n\n respond_to do |format|\n if @solicitud.save\n format.html { redirect_to @solicitud, notice: \"Solicitud was successfully created.\" }\n format.json { render :show, status: :created, location: @solicitud }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @solicitud.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @verb = Verb.new(verb_params)\n\n if @verb.save\n render json: @verb, status: :created, location: @verb\n else\n render json: @verb.errors, status: :unprocessable_entity\n end\n end", "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", "def create\n @location = Location.find(params[:location_id])\n @shelf = @location.shelves.new\n respond_to do |format|\n if @shelf.save\n format.html { redirect_to @location, notice: 'Shelf added.' }\n format.js { render js: \"thot.increase_counter('#shc_#{@location.id}');\" }\n else\n format.html { render action: \"new\" }\n format.json { render json: @lab.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @spotlight = Spotlight.new(spotlight_params)\n @resources = Resource.all\n @supportingresources = Resource.where(\"resource_type = 'Supporting'\", params[:resource_type]).order(:title)\n @featuredresources = Resource.where(\"resource_type = 'Featured'\", params[:resource_type]).order(:title)\n\n respond_to do |format|\n if @spotlight.save\n format.html { redirect_to @spotlight, notice: 'Spotlight was successfully created.' }\n format.json { render :show, status: :created, location: @spotlight }\n else\n format.html { render :new }\n format.json { render json: @spotlight.errors, status: :unprocessable_entity }\n end\n end\n @spotlight.attributes = {'resource_ids' => []}.merge(params[:spotlight] || {})\n end", "def create\n @sing = Sing.new(sing_params)\n\n respond_to do |format|\n if @sing.save\n format.html { redirect_to @sing, notice: 'Sing was successfully created.' }\n format.json { render :show, status: :created, location: @sing }\n else\n format.html { render :new }\n format.json { render json: @sing.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sotr = Sotr.new(sotr_params)\n\n respond_to do |format|\n if @sotr.save\n format.html { redirect_to @sotr, notice: 'Sotr was successfully created.' }\n format.json { render :show, status: :created, location: @sotr }\n else\n format.html { render :new }\n format.json { render json: @sotr.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @roster_spot = RosterSpot.new(roster_spot_params)\n\n respond_to do |format|\n if @roster_spot.save\n format.html { redirect_to @roster_spot, notice: 'Roster spot was successfully created.' }\n format.json { render action: 'show', status: :created, location: @roster_spot }\n else\n format.html { render action: 'new' }\n format.json { render json: @roster_spot.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @solicitud_servicio = SolicitudServicio.new(params[:solicitud_servicio])\n\n respond_to do |format|\n if @solicitud_servicio.save\n format.html { redirect_to @solicitud_servicio, notice: 'Solicitud servicio was successfully created.' }\n format.json { render json: @solicitud_servicio, status: :created, location: @solicitud_servicio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @solicitud_servicio.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @spawner = Spawner.new\n @fieldtrips = Fieldtrip.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @spawner }\n end\n end", "def create\n @solicitud = Solicitud.new(solicitud_params)\n\n respond_to do |format|\n if @solicitud.save\n format.html { redirect_to @solicitud, notice: 'Solicitud was successfully created.' }\n format.json { render action: 'show', status: :created, location: @solicitud }\n else\n format.html { render action: 'new' }\n format.json { render json: @solicitud.errors, status: :unprocessable_entity }\n end\n end\n end", "def spot_params\n params.require(:spot).permit(:location_name, :position, :lat, :lng, :stay_time)\n end", "def post\n Typhoeus.post(@url,\n body: @results_hash.to_json,\n headers: { 'Content-Type' => 'application/json' })\n end", "def create\n @sprint.save\n\n respond_with(@sprint)\n end", "def create(entity)\n post(resource_path_for_entity(entity), entity.to_json)\n end", "def create\n params[:recipient][:tag_list] = params[:\"hidden-recipient\"][:tag_list]\n @recipient = Recipient.new(params[:recipient])\n\n respond_to do |format|\n if @recipient.save\n format.html { redirect_to @recipient, notice: 'Recipient was successfully created.' }\n format.json { render json: @recipient, status: :created, location: @recipient }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recipient.errors, status: :unprocessable_entity }\n end\n end\n end", "def post\n Rentlinx.client.post(self)\n end", "def create\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n @survey = Survey.new(json)\n respond_to do |format|\n if @survey.save\n format.html { redirect_to @survey, notice: 'Survey was successfully created.' }\n format.json { render json: @survey, status: :created, location: @survey }\n else\n format.html { render action: \"new\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pet = Pet.find(params[:id]) \n @solicitud = Solicitud.new(solicitud_params)\n @solicitud.id = current_user.id \n @solicitud.id_pet = @pet.id\n respond_to do |format|\n if @solicitud.save\n solicitud = Solicitud.find(@solicitud.id)\n user = User.find(current_user.id)\n #user.follow(solicitud) Esto no porque crea tuplas duplicadas y mal en followers\n format.html { redirect_to @solicitud, notice: 'Tu solicitud ha sido guardada' }\n format.json { render :show, status: :created, location: @solicitud }\n else\n format.html { render :new }\n format.json { render json: @solicitud.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @spdatum = Spdatum.new(params[:spdatum])\n\n respond_to do |format|\n if @spdatum.save\n format.html { redirect_to @spdatum, notice: 'Spdatum was successfully created.' }\n format.json { render json: @spdatum, status: :created, location: @spdatum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @spdatum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @teleport_incense = TeleportIncense.new(teleport_incense_params)\n\n respond_to do |format|\n if @teleport_incense.save\n format.html { redirect_to @teleport_incense, notice: 'Teleport incense was successfully created.' }\n format.json { render :show, status: :created, location: @teleport_incense }\n else\n format.html { render :new }\n format.json { render json: @teleport_incense.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sale = Sale.new(sale_params)\n\n if @sale.save\n render json: @sale, status: :created, location: @sale\n else\n render json: @sale.errors, status: :unprocessable_entity\n end\n end", "def create\n # prevent ParkingSpot error\n signed_lease_params[:parking_spot] = nil if signed_lease_params[:parking_spot] == ''\n\n request = HousingRequest.find_by_req_no(params[:req_no])\n @signed_lease = SignedLease.new(signed_lease_params)\n @signed_lease.sid = request.sid\n\n #set some attributes to nil to avoid foreign key constraint errors\n\n if (params[:type] == 'single')\n @signed_lease.apt_no = nil\n else\n @signed_lease.place_no = nil\n @signed_lease.unit_no = nil\n end\n\n @signed_lease.parking_spot = nil if @signed_lease == ''\n @signed_lease.permit_id = nil if @signed_lease == ''\n\n respond_to do |format|\n if @signed_lease.save\n\n #change app_status on housing_requests after signed_lease has been created\n request.app_status = 2\n request.save\n\n #update to rooms or family apts\n if (params[:type] == 'single')\n # can't use update because of rooms has superkey!\n #room = Room.where(:place_no => @signed_lease.place_no, :unit_no =>@signed_lease.unit_no)\n #room.occupant = request.sid # see if this works?\n #room.save\n ActiveRecord::Base.connection.execute('update rooms set occupant = \"#{request.sid}\" where unit_no = \"#{@signed_lease.unit_no}\" and place_no = \"#{@signed_lease.place_no}\"')\n else\n family_apt = FamilyApt.find_by_apt_no(@signed_lease.apt_no)\n family_apt.occupant = request.sid\n family_apt.save\n end\n\n format.html { redirect_to @signed_lease, notice: 'Signed lease was successfully created.' }\n format.json { render :show, status: :created, location: @signed_lease }\n else\n format.html { render :new }\n format.json { render json: @signed_lease.errors, status: :unprocessable_entity }\n end\n end\n end", "def spot_params\n params.require(:spot).permit(:latitude, :longitude, :address)\n end", "def post(path, json, params = {})\n if path.include?('covid19')\n request = Net::HTTP::Post.new(path, @headers)\n else\n request = Net::HTTP::Post.new('/v2' + path, @headers)\n end\n request.add_field('Content-Type', 'application/json')\n request.body = json\n params.each do |k, v|\n request[k] = v\n end\n send_request(request)\n end", "def post(*args)\n prepare_request(:post, args)\n @@client.add(:post, @path, *args)\n end", "def create\n @sloth = Sloth.new(sloth_params)\n\n respond_to do |format|\n if @sloth.save\n format.html { redirect_to @sloth, notice: 'Sloth was successfully created.' }\n format.json { render :show, status: :created, location: @sloth }\n else\n format.html { render :new }\n format.json { render json: @sloth.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # Get the variables passed in from params on create\n @expense = Expense.new(expense_params)\n\n if @expense.save\n render json: @expense, status: :created, location: @expense\n else\n render json: @expense.errors, status: :unprocessable_entity\n end\n end", "def post(*args)\n request :post, *args\n end", "def create\n @study_spot = StudySpot.new(study_spot_params)\n respond_to do |format|\n if @study_spot.save\n format.html { redirect_to @study_spot, notice: 'Study spot was successfully created.' }\n format.json { render :show, status: :created, location: @study_spot }\n else\n format.html { render :new }\n format.json { render json: @study_spot.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.5915685", "0.5810478", "0.5743416", "0.561621", "0.5596164", "0.5568079", "0.5501657", "0.54477894", "0.5420697", "0.5381398", "0.5340402", "0.5324662", "0.5305585", "0.5295365", "0.52871805", "0.52682865", "0.5263237", "0.5242624", "0.52214664", "0.5216364", "0.5207321", "0.51948905", "0.51839495", "0.51530135", "0.5151171", "0.51433593", "0.5136125", "0.5134223", "0.51281774", "0.5123804", "0.5110113", "0.5109128", "0.51010704", "0.5100987", "0.50971067", "0.50844157", "0.5082329", "0.5082172", "0.5078405", "0.50706697", "0.5065332", "0.50569284", "0.5056707", "0.5046093", "0.5042287", "0.50416595", "0.5041112", "0.50373936", "0.50360763", "0.50356233", "0.5034985", "0.502477", "0.501789", "0.50165766", "0.5016283", "0.5013159", "0.5002273", "0.49956545", "0.4976244", "0.4975834", "0.49751118", "0.4973719", "0.49733248", "0.4971797", "0.49709105", "0.49700594", "0.49660093", "0.49624038", "0.4961979", "0.4960404", "0.49562487", "0.49518493", "0.49507824", "0.49457678", "0.4944086", "0.49381664", "0.4936233", "0.49325633", "0.49307328", "0.49306968", "0.49245334", "0.49243706", "0.4923666", "0.4920943", "0.49194744", "0.49172553", "0.49093637", "0.4909091", "0.4901515", "0.4898374", "0.4897645", "0.4896061", "0.48942766", "0.4882846", "0.4881547", "0.48801038", "0.4873833", "0.48679486", "0.4866966", "0.48650435" ]
0.58148843
1
PATCH/PUT /spents/1 PATCH/PUT /spents/1.json
def update respond_to do |format| if @spent.update(spent_params) format.html { redirect_to @spent, notice: 'Spent was successfully updated.' } format.json { render :show, status: :ok, location: @spent } else format.html { render :edit } format.json { render json: @spent.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @serving = Serving.find(params[:id])\n\n respond_to do |format|\n if @serving.update_attributes(params[:serving])\n format.html { redirect_to @serving, notice: 'Serving was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @serving.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def update\n respond_to do |format|\n if @spending.update(spending_params)\n format.html { redirect_to @spending, notice: 'Spending was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @spending.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @serving.update(serving_params)\n format.html { redirect_to @serving, notice: 'Serving was successfully updated.' }\n format.json { render :show, status: :ok, location: @serving }\n else\n format.html { render :edit }\n format.json { render json: @serving.errors, status: :unprocessable_entity }\n end\n end\n end", "def put!\n request! :put\n end", "def update\n respond_to do |format|\n if @squire.update(squire_params)\n format.html { redirect_to @squire, notice: 'Squire was successfully updated.' }\n format.json { render :show, status: :ok, location: @squire }\n else\n format.html { render :edit }\n format.json { render json: @squire.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @person.seat\n render json: {errors: 'Cannot update a seated person'}, status: 422\n else\n @person.update person_params\n render json: @person\n end\n end", "def update\n @sprint.update!(sprint_params)\n json_response(@sprint)\n end", "def update\n @slitter = Slitter.find(params[:id])\n\n respond_to do |format|\n if @slitter.update_attributes(params[:slitter])\n format.html { redirect_to @slitter, notice: 'Slitter was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @slitter.errors, status: :unprocessable_entity }\n end\n end\n end", "def update \n sneaker = find_sneaker\n # update! exceptions will be handled by the rescue_from ActiveRecord::RecordInvalid code\n sneaker.update(sneaker_params)\n render json: sneaker\n end", "def update\n @stundent = Stundent.find(params[:id])\n\n respond_to do |format|\n if @stundent.update_attributes(params[:stundent])\n format.html { redirect_to @stundent, notice: 'Stundent was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stundent.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end", "def update\n respond_to do |format|\n if @stoff.update(stoff_params)\n format.html { redirect_to @stoff }\n format.json { render :show, status: :ok, location: @stoff }\n else\n format.html { render :edit }\n format.json { render json: @stoff.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @spot = Spot.find(params[:id])\n\n respond_to do |format|\n if @spot.update_attributes(params[:spot])\n format.html { redirect_to @spot, notice: 'Spot was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @spot.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @spot = Spot.find(params[:id])\n\n respond_to do |format|\n if @spot.update_attributes(params[:spot])\n format.html { redirect_to @spot, notice: 'Spot was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @spot.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @spawner = Spawner.find(params[:id])\n @fieldtrips = Fieldtrip.all\n\n respond_to do |format|\n if @spawner.update_attributes(spawner_params)\n format.html { redirect_to @spawner, notice: 'Spawner was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @spawner.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def update\n @spoofer = Spoofer.find(params[:id])\n\n respond_to do |format|\n if @spoofer.update_attributes(params[:spoofer])\n format.html { redirect_to @spoofer, notice: 'Spoofer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @spoofer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if params[:commit] == 'Accept'\n params[:scoot][:state] = 'accepted'\n else\n params[:scoot][:state] = 'rejected'\n end\n respond_to do |format|\n if @scoot.update(scoot_params)\n format.html { redirect_to root_url, notice: 'Scoot was successfully updated.' }\n format.json { render :show, status: :ok, location: @scoot }\n else\n format.html { render :edit }\n format.json { render json: @scoot.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if spot = SkateSpot.where(:id => params[:id]).first and info = parse_input(params)\n if info.has_key?(:alt_names)\n info[:alt_names].map! { |n| SpotName.find_or_create_by(:name => n, :spot => spot) }\n end\n\n if info[:name]\n info[:name] = SpotName.find_or_create_by(:name => info[:name], :spot => spot) \n end\n\n if info.has_key?(:obstacles)\n info[:obstacles].map! { |o|\n Obstacle.find_or_create_by(:type => ObstacleType.where(:name => o['type']).first, :geometry => o['geometry'], :spot => spot)\n }\n end\n\n render :json => { :status => (spot.update(info) == true ? :success : :unprocessable_entity) }\n else\n render :json => { :status => :unprocessable_entity }\n end\n\n rescue ActiveRecord::RecordNotSaved\n render :json => { :status => :unprocessable_entity }\n end", "def update\n if @spice.update(spice_params)\n head :no_content\n else\n render json: @spice.errors, status: :unprocessable_entity\n end\n end", "def update\n @sf_sobject = Sfsync::Sobject.find(params[:id])\n \n respond_to do |format|\n if @sf_sobject.update_attributes(params[:sf_sobject])\n format.html { redirect_to @sf_sobject, notice: 'Sobject was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sf_sobject.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @spending_pool.update(spending_pool_params)\n format.html { redirect_to @spending_pool, notice: 'Spending pool was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @spending_pool.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @stable = Stable.find(params[:id])\n\n respond_to do |format|\n if @stable.update_attributes(params[:stable])\n format.html { redirect_to @stable, notice: 'Stable was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stable.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch!\n request! :patch\n end", "def update\n respond_to do |format|\n if @slisting.update(slisting_params)\n format.html { redirect_to @slisting, notice: 'Slisting was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @slisting.errors, status: :unprocessable_entity }\n end\n end\n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def update\n put :update\n end", "def update\n @sprint.update_attributes(params[:sprint])\n\n respond_with(@sprint)\n end", "def update\n respond_to do |format|\n if @sour.update(sour_params)\n format.html { redirect_to swits_path, notice: 'sour <3.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sour.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @svote.update(svote_params)\n format.html { redirect_to @svote, notice: 'Svote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @svote.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @shelf.update(shelf_params)\n format.html { redirect_to house_shelves_path(params[:house_id]), notice: 'Shelf was successfully created.' } \n format.json { render :show, status: :ok, location: @shelf }\n else\n format.html { render :edit }\n format.json { render json: @shelf.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sloth.update(sloth_params)\n format.html { redirect_to @sloth, notice: 'Sloth was successfully updated.' }\n format.json { render :show, status: :ok, location: @sloth }\n else\n format.html { render :edit }\n format.json { render json: @sloth.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @spot = Spot.find(params[:id])\n\n respond_to do |format|\n if @spot.update_attributes(params[:spot])\n format.html { redirect_to @spot, notice: t(:course_successfully_updated) }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @spot.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @legal_spouse.update(legal_spouse_params)\n format.html { redirect_to @legal_spouse, notice: 'Legal spouse was successfully updated.' }\n format.json { render :show, status: :ok, location: @legal_spouse }\n else\n format.html { render :edit }\n format.json { render json: @legal_spouse.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(sobject, attrs)\n id = attrs.has_key?(:Id) ? attrs.delete(:Id) : attrs.delete('Id')\n raise 'Id field missing.' unless id\n api_patch \"sobjects/#{sobject}/#{id}\", attrs\n true\n end", "def update\n respond_to do |format|\n if @socio_spc.update(socio_spc_params)\n format.html { redirect_to @socio_spc, notice: 'Socio spc was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @socio_spc.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @snp = Snp.find(params[:id])\n\n respond_to do |format|\n if @snp.update_attributes(params[:snp])\n format.html { redirect_to @snp, notice: 'Snp was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @snp.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @servant.update(servant_params)\n format.html { redirect_to @servant, notice: 'Servant was successfully updated.' }\n format.json { render :show, status: :ok, location: @servant }\n else\n format.html { render :edit }\n format.json { render json: @servant.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @spouse = Spouse.find(params[:id])\n\n respond_to do |format|\n if @spouse.update_attributes(params[:spouse])\n flash[:notice] = 'Spouse was successfully updated.'\n format.html { redirect_to(@spouse) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @spouse.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @stinsfo.update(stinsfo_params)\n format.html { redirect_to @stinsfo, notice: 'Stinsfo was successfully updated.' }\n format.json { render :show, status: :ok, location: @stinsfo }\n else\n format.html { render :edit }\n format.json { render json: @stinsfo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @survey = Survey.find(params[:id])\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n\n respond_to do |format|\n if @survey.update_attributes(json)\n format.html { redirect_to @survey, notice: 'Survey was successfully updated.' }\n format.json { render json: @survey }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(*args)\n request :put, *args\n end", "def update\n params[:book_shelf]['user'] = User.where(:id => params[:book_shelf]['user']).first\n params[:book_shelf]['book'] = Book.where(:id => params[:book_shelf]['book']).first\n @book_shelf = BookShelf.find(params[:id])\n respond_to do |format|\n if @book_shelf.update_attributes(params[:book_shelf])\n format.html { redirect_to @book_shelf, notice: 'Book shelf was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book_shelf.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @supermarket = Supermarket.find(params[:id]) \n respond_to do |format|\n if @supermarket.update(supermarket_params)\n format.json { render json: @supermarket, status: :ok }\n end\n end\n end", "def update\n respond_to do |format|\n if @serf.update(serf_params)\n format.html { redirect_to @serf, notice: 'Serve was successfully updated.' }\n format.json { render :show, status: :ok, location: @serf }\n else\n format.html { render :edit }\n format.json { render json: @serf.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @sponsor.update_attributes(params[:sponsor])\n format.html { redirect_to [:admin, @event, @sponsor], notice: 'Sponsor was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sponsor.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @spliff.update(spliff_params)\n format.html { redirect_to '/spliffs', notice: 'Spliff was successfully updated.' }\n format.json { redirect_to '/spliffs', status: :ok, location: '/spliffs' }\n else\n format.html { render :edit }\n format.json { render json: @spliff.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end", "def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end", "def update\n @solicitud_servicio = SolicitudServicio.find(params[:id])\n\n respond_to do |format|\n if @solicitud_servicio.update_attributes(params[:solicitud_servicio])\n format.html { redirect_to @solicitud_servicio, notice: 'Solicitud servicio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @solicitud_servicio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @spit = Spit.find(params[:id])\n\n respond_to do |format|\n if @spit.update_attributes(params[:spit])\n format.html { redirect_to(@spit, :notice => 'Spit was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @spit.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @points_spent = PointsSpent.find(params[:id])\n\n respond_to do |format|\n if @points_spent.update_attributes(params[:points_spent])\n format.html { redirect_to @points_spent, notice: 'Points spent was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @points_spent.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @spot_listing = SpotListing.find(params[:id])\n\n respond_to do |format|\n if @spot_listing.update_attributes(params[:spot_listing])\n format.html { redirect_to @spot_listing, notice: 'Spot listing was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @spot_listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @stalkee.update(stalkee_params)\n format.html { redirect_to @stalkee, notice: 'Stalkee was successfully updated.' }\n format.json { render :show, status: :ok, location: @stalkee }\n else\n format.html { render :edit }\n format.json { render json: @stalkee.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @squad.update(squad_params)\n format.html { redirect_to @squad, notice: 'Squad was successfully updated.' }\n format.json { render :show, status: :ok, location: @squad }\n else\n format.html { render :edit }\n format.json { render json: @squad.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :update_almacen,Sigesp::Solicitud\n if @sigesp_solicitud.update(sigesp_solicitud_alamcen_params)\n return render json: { url: sigesp_solicitudsalmacen_path(@sigesp_solicitud)} \n else\n return render json:@sigesp_solicitud.errors ,status: :unprocessable_entity\n end \n end", "def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def update\n @partner = Partner.find(params[:id])\n\n respond_to do |format|\n if @partner.update_attributes(params[:partner])\n format.html { redirect_to @partner }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @partner.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @squad = current_user.squad\n respond_to do |format|\n if @squad.update(squad_params)\n @squad.editable\n format.html { redirect_to @squad, notice: 'Squad was successfully updated.' }\n format.json { render :show, status: :ok, location: @squad }\n else\n format.html { render :edit }\n format.json { render json: @squad.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @sprint = Sprint.find(params[:id])\n respond_to do |format|\n if @sprint.update_attributes(params[:sprint])\n format.html { redirect_to @sprint, notice: 'Sprint was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sprint.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(attrs, path=nil)\n resp = api_client.put(path || url, JSON.dump(attrs))\n refresh(JSON.load(resp.body))\n end", "def update\n @go_slim = GoSlim.find(params[:id])\n\n respond_to do |format|\n if @go_slim.update_attributes(params[:go_slim])\n format.html { redirect_to @go_slim, notice: 'Go slim was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @go_slim.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @kota_stone.update(kota_stone_params)\n format.html { redirect_to kota_stones_url, notice: 'Kota stone was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @kota_stone.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @spot.update(spot_params)\n format.html { redirect_to @spot, notice: 'Spot was successfully updated.' }\n format.json { render :show, status: :ok, location: @spot }\n else\n format.html { render :edit }\n format.json { render json: @spot.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @spot.update(spot_params)\n format.html { redirect_to @spot, notice: 'Spot was successfully updated.' }\n format.json { render :show, status: :ok, location: @spot }\n else\n format.html { render :edit }\n format.json { render json: @spot.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @staffer = Staffer.find(params[:id])\n\n respond_to do |format|\n if @staffer.update_attributes(params[:staffer])\n format.html { redirect_to @staffer, notice: 'Staffer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @staffer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @verb.update(verb_params)\n format.html { redirect_to @verb, notice: 'Verb was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @verb.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @spot = Spot.find(params[:id])\n\n respond_to do |format|\n if @spot.update_attributes(params[:spot])\n flash[:notice] = 'Spot was successfully updated.'\n format.html { redirect_to(@spot) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @spot.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @bundlesticker = Bundlesticker.find(params[:id])\n\n respond_to do |format|\n if @bundlesticker.update_attributes(params[:bundlesticker])\n format.html { redirect_to @bundlesticker, notice: 'Bundlesticker was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bundlesticker.errors, status: :unprocessable_entity }\n end\n end\n end", "def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end", "def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end", "def update\n @roster_spot = RosterSpot.find(params[:id])\n\n respond_to do |format|\n if @roster_spot.update_attributes(params[:roster_spot])\n format.html { redirect_to @roster_spot, notice: 'Roster spot was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @roster_spot.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @spaethi = Spaethi.find(params[:id])\n\n respond_to do |format|\n if @spaethi.update_attributes(params[:spaethi])\n format.html { redirect_to @spaethi, notice: 'Spaethi was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @spaethi.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @squad.update(squad_params)\n format.html { redirect_to [:api, @squad], notice: 'Squad was successfully updated.' }\n format.json { render :show, status: :ok, location: @squad }\n else\n format.html { render :edit }\n format.json { render json: @squad.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(id, json)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name, id].compact.join('/')\n url += \"/\" \n return HTTParty.put(url, :body => json, :timeout => 4, :headers => { 'Content-Type' => 'application/json' })\n end\n end", "def update\n @team = Team.find(params[:team_id])\n @sprint = @team.sprints.find(params[:id])\n\n respond_to do |format|\n if @sprint.update_attributes(params[:sprint])\n format.html { redirect_to [@sprint.team, @sprint], notice: 'Sprint was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sprint.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @stone = Stone.find(params[:id])\n\n respond_to do |format|\n if @stone.update_attributes(params[:stone])\n format.html { redirect_to @stone, notice: 'Stone was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stone.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @shelf = Shelf.find(params[:id])\n\n respond_to do |format|\n if @shelf.update_attributes(params[:shelf])\n flash[:notice] = 'Shelf was successfully updated.'\n format.html { redirect_to(@shelf) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @shelf.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @sprint = Sprint.find(params[:id])\n\n respond_to do |format|\n if @sprint.update_attributes(params[:sprint])\n format.html { redirect_to [:admin, @sprint], notice: 'Sprint was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sprint.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n @therapist_consent = TherapistConsent.find(params[:id])\n respond_to do |format|\n format.html { render action: 'edit' }\n format.json { render :status => 200, :json => { action: 'edit', therapist_consent: @therapist_consent}}\n end\n end", "def update\n @spot = Spot.find(params[:id])\n\n respond_to do |format|\n if @spot.update_attributes(params[:spot])\n format.js\n format.html { redirect_to(@spot, :notice => 'Spot was successfully updated.') }\n format.xml { head :ok }\n else\n format.js { render :template => '/error.js', :locals => {:title => '更新できませんでした', :message => @spot.errors.full_messages.join(\"\\n\"), :script => nil} }\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @spot.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @verb = Verb.find(params[:id])\n\n if @verb.update(verb_params)\n head :no_content\n else\n render json: @verb.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @spr_person.update(spr_person_params)\n format.html { redirect_to @spr_person, notice: 'Spr person was successfully updated.' }\n format.json { render :show, status: :ok, location: @spr_person }\n else\n format.html { render :edit }\n format.json { render json: @spr_person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @snipet.update(snipet_params)\n format.html { redirect_to @snipet, notice: 'Snipet was successfully updated.' }\n format.json { render :show, status: :ok, location: @snipet }\n else\n format.html { render :edit }\n format.json { render json: @snipet.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if request.content_type == \"application/json\"\n # .update is like a \"update people set ...\" in sql\n if @person.update(person_params)\n render json: @person\n else\n render json: @person.errors, status: :not_found\n end\n else\n render status: :bad_request\n end\n end", "def update\n streak, success = jsonapi_update.to_a\n\n if success\n render_jsonapi(streak, scope: false)\n else\n render_errors_for(streak)\n end\n end", "def update\n @slab = Slab.find(params[:id])\n\n respond_to do |format|\n if @slab.update_attributes(params[:slab])\n format.html { redirect_to @slab, :notice => 'Slab was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @slab.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @slap.update(slap_params)\n format.html { redirect_to @slap, notice: 'Slap was successfully updated.' }\n format.json { render :show, status: :ok, location: @slap }\n else\n format.html { render :edit }\n format.json { render json: @slap.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sidequest.update(sidequest_params)\n format.html { redirect_to @sidequest, notice: 'Sidequest was successfully updated.' }\n format.json { render :show, status: :ok, location: @sidequest }\n else\n format.html { render :edit }\n format.json { render json: @sidequest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @spdatum = Spdatum.find(params[:id])\n\n respond_to do |format|\n if @spdatum.update_attributes(params[:spdatum])\n format.html { redirect_to @spdatum, notice: 'Spdatum was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @spdatum.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n render json: Location.update(params[\"id\"], params[\"location\"])\n end", "def update\n respond_to do |format|\n if @traceroute.update(traceroute_params)\n format.html { redirect_to @traceroute, notice: 'Traceroute was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @traceroute.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @traceroute.update(traceroute_params)\n format.html { redirect_to @traceroute, notice: 'Traceroute was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @traceroute.errors, status: :unprocessable_entity }\n end\n end\n end", "def update # PATCH\n raise NotImplementedError\n end", "def jsonapi_update!(attributes)\n assign_jsonapi_attributes(attributes)\n save!\n end", "def update\n @servicetype = Servicetype.find(params[:id])\n\n respond_to do |format|\n if @servicetype.update_attributes(params[:servicetype])\n format.html { redirect_to @servicetype, :notice => 'Servicetype was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @servicetype.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @roster_spot.update(roster_spot_params)\n format.html { redirect_to @roster_spot, notice: 'Roster spot was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @roster_spot.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(*args)\n put(*args)\n end" ]
[ "0.638348", "0.6136221", "0.6115271", "0.60960454", "0.60715973", "0.60568845", "0.60533136", "0.60296375", "0.5987283", "0.5966251", "0.59660065", "0.59563744", "0.59528196", "0.5939921", "0.5938723", "0.5889873", "0.5869043", "0.58597594", "0.58588654", "0.5854152", "0.5846307", "0.58317184", "0.5818268", "0.58171064", "0.5808712", "0.5795269", "0.57886815", "0.57866657", "0.5781335", "0.5765776", "0.57640654", "0.5738385", "0.5738346", "0.5735732", "0.5725965", "0.5717831", "0.5711947", "0.5707555", "0.57059073", "0.5700838", "0.5699674", "0.5695459", "0.5693605", "0.5686101", "0.5679775", "0.5671868", "0.56669325", "0.566631", "0.5654125", "0.56419533", "0.5640628", "0.5635505", "0.5631937", "0.5629063", "0.5626526", "0.5618739", "0.56058407", "0.5603277", "0.5599955", "0.5593948", "0.5593564", "0.5587054", "0.55841386", "0.55761236", "0.55753994", "0.5575111", "0.5575111", "0.557109", "0.5569948", "0.555953", "0.5549416", "0.5547574", "0.5547574", "0.5539991", "0.55384874", "0.55378395", "0.5537731", "0.5535079", "0.55341953", "0.5532443", "0.55321395", "0.5530381", "0.5528902", "0.5527813", "0.55240434", "0.55139714", "0.55119395", "0.55115515", "0.55058295", "0.5505494", "0.5501155", "0.54962456", "0.54961735", "0.54941285", "0.54939437", "0.5490432", "0.54885674", "0.54881096", "0.54860115", "0.5485548" ]
0.5598183
59
DELETE /spents/1 DELETE /spents/1.json
def destroy @spent.destroy respond_to do |format| format.html { redirect_to incomes_url, notice: 'Spent was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @stundent = Stundent.find(params[:id])\n @stundent.destroy\n\n respond_to do |format|\n format.html { redirect_to stundents_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @serving = Serving.find(params[:id])\n @serving.destroy\n\n respond_to do |format|\n format.html { redirect_to servings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n # find ALL servings associated with this purchase and delete them\n all_servings = Serving.where(purchase_id: @purchase.id)\n puts \"all servings associated with this purchase: #{all_servings}\"\n all_servings.destroy_all\n puts \"deleted servings\"\n @purchase.destroy\n puts \"deleted purchase\"\n render json: {status: 204, purchase: @purchase}\n end", "def incident_delete(statuspage_id, incident_id)\n data = {}\n data['statuspage_id'] = statuspage_id\n data['incident_id'] = incident_id\n\n request :method => :post,\n :url => @url + 'incident/delete',\n :payload => data\n end", "def destroy\n @shelf.destroy\n\n respond_to do |format|\n format.html { redirect_to shelves_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @points_spent = PointsSpent.find(params[:id])\n @points_spent.destroy\n\n respond_to do |format|\n format.html { redirect_to points_spents_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @shelf.destroy\n respond_to do |format|\n format.html { redirect_to shelves_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @spending.destroy\n respond_to do |format|\n format.html { redirect_to spendings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @go_slim = GoSlim.find(params[:id])\n @go_slim.destroy\n\n respond_to do |format|\n format.html { redirect_to go_slims_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tsp = Tsp.find(params[:id])\n @tsp.destroy\n\n respond_to do |format|\n format.html { redirect_to tsps_url }\n format.json { head :ok }\n end\n end", "def destroy\n @spot = Spot.find(params[:id])\n @spot.destroy\n\n respond_to do |format|\n format.html { redirect_to spots_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @stable = Stable.find(params[:id])\n @stable.destroy\n\n respond_to do |format|\n format.html { redirect_to stables_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @serving.destroy\n respond_to do |format|\n format.html { redirect_to servings_url, notice: 'Serving was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sin = Sin.find(params[:id])\n @sin.destroy\n\n respond_to do |format|\n format.html { redirect_to sins_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @squad.destroy\n respond_to do |format|\n format.html { redirect_to squads_url, notice: 'Squad was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @squad.destroy\n respond_to do |format|\n format.html { redirect_to squads_url, notice: 'Squad was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @stone = Stone.find(params[:id])\n @stone.destroy\n\n respond_to do |format|\n format.html { redirect_to stones_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @shelf.destroy\n respond_to do |format|\n format.html { redirect_to house_shelves_path(params[:house_id]), notice: 'Shelf was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @subsidy = Subsidy.find(params[:id])\n @subsidy.destroy\n\n respond_to do |format|\n format.html { redirect_to subsidies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @servant.destroy\n respond_to do |format|\n format.html { redirect_to servants_url, notice: 'Servant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @squire.destroy\n respond_to do |format|\n format.html { redirect_to squires_url, notice: 'Squire was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @shelf = Shelf.find(params[:id])\n @shelf.destroy\n\n respond_to do |format|\n format.html { redirect_to(shelves_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @sour = @swit.sours.find(params[:id])\n @sour.destroy\n respond_to do |format|\n format.html { redirect_to swit_sours_path(@swit) }\n format.json { head :no_content }\n\n end\n end", "def destroy\n @scoot.destroy\n respond_to do |format|\n format.html { redirect_to scoots_url, notice: 'Scoot was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sing.destroy\n respond_to do |format|\n format.html { redirect_to sings_url, notice: 'Sing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_slip(id:)\n empty_param_error('id') if id.to_s.eql? ''\n resource :delete, \"api/v1/users/me/slips/#{id}\"\n end", "def destroy\n @spdatum = Spdatum.find(params[:id])\n @spdatum.destroy\n\n respond_to do |format|\n format.html { redirect_to spdata_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @lent = Lent.find(params[:id])\n @lent.destroy\n\n respond_to do |format|\n format.html { redirect_to lents_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @spot = Spot.find(params[:id])\n @spot.destroy\n\n respond_to do |format|\n format.html { redirect_to(spots_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @spot = Spot.find(params[:id])\n @spot.destroy\n\n respond_to do |format|\n format.html { redirect_to(spots_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @solicitud_servicio = SolicitudServicio.find(params[:id])\n @solicitud_servicio.destroy\n\n respond_to do |format|\n format.html { redirect_to solicitudes_servicios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ss.destroy\n respond_to do |format|\n format.html { redirect_to sses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @serf.destroy\n respond_to do |format|\n format.html { redirect_to serves_url, notice: 'Serve was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @stance.destroy\n respond_to do |format|\n format.html { redirect_to stances_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @stance.destroy\n respond_to do |format|\n format.html { redirect_to stances_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @legal_spouse.destroy\n respond_to do |format|\n format.html { redirect_to legal_spouses_url, notice: 'Legal spouse was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @stinsfo.destroy\n respond_to do |format|\n format.html { redirect_to stinsfos_url, notice: 'Stinsfo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sloth.destroy\n respond_to do |format|\n format.html { redirect_to sloths_url, notice: 'Sloth was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @spit = Spit.find(params[:id])\n @spit.destroy\n\n respond_to do |format|\n format.html { redirect_to(spits_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @mostsmallmission = Mostsmallmission.find(params[:id])\n @mostsmallmission.destroy\n\n respond_to do |format|\n format.html { redirect_to mostsmallmissions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @strosek.destroy\n respond_to do |format|\n format.html { redirect_to stroseks_url }\n format.json { head :no_content }\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @spot = Spot.find(params[:id])\n @spot.mark_destroyed(current_admin)\n\n respond_to do |format|\n format.html { redirect_to spots_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @slap.destroy\n respond_to do |format|\n format.html { redirect_to slaps_url, notice: 'Slap was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n render :json => { :status => (SkateSpot.where(:id => params[:id]).destroy_all.count > 0 ? :success : :unprocessable_entity) }\n end", "def destroy\n @spouse = Spouse.find(params[:id])\n @spouse.destroy\n\n respond_to do |format|\n format.html { redirect_to(spouses_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @spaethi = Spaethi.find(params[:id])\n @spaethi.destroy\n\n respond_to do |format|\n format.html { redirect_to spaethis_url }\n format.json { head :ok }\n end\n end", "def destroy\n @socio_spc.destroy\n respond_to do |format|\n format.html { redirect_to socio_spcs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @snp = Snp.find(params[:id])\n @snp.destroy\n\n respond_to do |format|\n format.html { redirect_to snps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @solicitud.destroy\n respond_to do |format|\n format.html { redirect_to solicitudes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @spiel = Spiel.find(params[:id])\n @spiel.destroy\n\n respond_to do |format|\n format.html { redirect_to spiels_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @spawner = Spawner.find(params[:id])\n @spawner.destroy\n\n respond_to do |format|\n format.html { redirect_to spawners_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @svote.destroy\n respond_to do |format|\n format.html { redirect_to svotes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @spending_pool.destroy\n respond_to do |format|\n format.html { redirect_to spending_pools_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @shouldersbiceps1.destroy\n respond_to do |format|\n format.html { redirect_to shouldersbiceps1s_url, notice: 'Shouldersbiceps1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @expensesbasis.destroy\n respond_to do |format|\n format.html { redirect_to [@post, @expensesbasis], notice: 'Expensesbase was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sity.destroy\n respond_to do |format|\n format.html { redirect_to sities_url, notice: 'Sity was successfully destroyed.' }\n format.json { head :no_content }\n end\n \n end", "def destroy\n @spice.destroy\n\n head :no_content\n end", "def destroy\n @fast.destroy\n respond_to do |format|\n format.html { redirect_to fasts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @rent = Rent.find(params[:id])\n @rent.destroy\n\n respond_to do |format|\n format.html { redirect_to rents_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sidequest.destroy\n respond_to do |format|\n format.html { redirect_to sidequests_url, notice: 'Sidequest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @server1 = Server1.find(params[:id])\n @server1.destroy\n\n respond_to do |format|\n format.html { redirect_to server1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @verb.destroy\n respond_to do |format|\n format.html { redirect_to verbs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @participant.studysite.destroy_all\n @participant.destroy\n respond_to do |format|\n format.html { redirect_to participants_url, notice: 'Participant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @statement = Statement.find(params[:id])\n @statement.destroy\n\n respond_to do |format|\n format.html { redirect_to statements_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sotr.destroy\n respond_to do |format|\n format.html { redirect_to sotrs_url, notice: 'Sotr was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @stilage.destroy\n respond_to do |format|\n format.html { redirect_to stilages_url, notice: 'Stilage was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @solicitud.destroy\n respond_to do |format|\n format.html { redirect_to solicituds_url, notice: 'Solicitud was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sorder = Sorder.find(params[:id])\n @sorder.destroy\n\n respond_to do |format|\n format.html { redirect_to sorders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @spot = Spot.find(params[:id])\n @spot.destroy\n\n respond_to do |format|\n format.html { redirect_to(spot_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @squad.destroy\n respond_to do |format|\n format.html { redirect_to api_squads_url, notice: 'Squad was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tent.destroy\n respond_to do |format|\n format.html { redirect_to action: \"index\", notice: 'Tent was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @subway.destroy\n respond_to do |format|\n format.html { redirect_to subways_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sprint = Sprint.find(params[:id])\n @sprint.destroy\n\n respond_to do |format|\n format.html { redirect_to sprints_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sprint = Sprint.find(params[:id])\n @sprint.destroy\n\n respond_to do |format|\n format.html { redirect_to sprints_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @kota_stone.destroy\n respond_to do |format|\n format.html { redirect_to kota_stones_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @taxi_sevice.destroy\n respond_to do |format|\n format.html { redirect_to taxi_sevices_url, notice: 'Taxi sevice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sitemenu.destroy\n respond_to do |format|\n format.html { redirect_to sitemenus_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @solicitud.destroy\n respond_to do |format|\n format.html { redirect_to solicituds_url, notice: \"Solicitud was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @ssd.destroy\n respond_to do |format|\n format.html { redirect_to ssds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sklad = Sklad.find(params[:id])\n @sklad.destroy\n\n respond_to do |format|\n format.html { redirect_to sklads_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @shot = Shot.find(params[:id])\n @shot.destroy\n\n respond_to do |format|\n format.html { redirect_to shots_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @smurf = Smurf.find(params[:id])\n @smurf.destroy\n\n respond_to do |format|\n format.html { redirect_to smurves_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @verse = Verse.find(params[:id])\n @verse.destroy\n\n respond_to do |format|\n format.html { redirect_to verses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @verse = Verse.find(params[:id])\n @verse.destroy\n\n respond_to do |format|\n format.html { redirect_to verses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ident = Ident.find(params[:id])\n @ident.destroy\n\n respond_to do |format|\n format.html { redirect_to idents_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sesion = Sesion.where(entidad_paraestatal_id: @entidad_paraestatal.id).find(params[:id])\n @sesion.destroy\n\n respond_to do |format|\n format.html { redirect_to entidad_paraestatal_sesions_url(@entidad_paraestatal) }\n format.json { head :no_content }\n end\n end", "def destroy\n @studant.destroy\n respond_to do |format|\n format.html { redirect_to studants_url, notice: 'Studant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sesh.destroy\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @sprintstory = Sprintstory.find(params[:id])\n @sprintstory.destroy\n\n respond_to do |format|\n format.html { redirect_to sprintstories_url }\n format.json { head :no_content }\n end\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def destroy\n @server = Server.find(params[:id])\n checkaccountobject(\"servers\",@server)\n @server.send_delete\n respond_to do |format|\n format.html { redirect_to servers_url }\n format.json { head :ok }\n end\n end", "def destroy\n @skid = Skid.find(params[:id])\n @skid.destroy\n\n respond_to do |format|\n format.html { redirect_to skids_url }\n format.json { head :ok }\n end\n end", "def soccer_delete\n base_delete(params, \"Soccer\")\n end", "def destroy\n @spirit = Spirit.find(params[:id])\n @spirit.destroy\n\n respond_to do |format|\n format.html { redirect_to spirits_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @salt.destroy\n respond_to do |format|\n format.html { redirect_to salts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sleuth.destroy\n respond_to do |format|\n format.html { redirect_to sleuths_url, notice: 'Sleuth was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @line.destroy\r\n respond_to do |format|\r\n format.html { redirect_to spots_path, notice: 'Spot was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @trein_consul_comercial.destroy\n respond_to do |format|\n format.html { redirect_to trein_consul_comercials_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @point_of_sale.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end" ]
[ "0.7005292", "0.67746216", "0.67580026", "0.66465974", "0.66398007", "0.66389585", "0.66207933", "0.6606647", "0.65488535", "0.65470123", "0.65398306", "0.65380067", "0.65334606", "0.6529416", "0.6519053", "0.65132016", "0.65132016", "0.65115726", "0.6499154", "0.64989763", "0.6485058", "0.6474921", "0.64711446", "0.64622134", "0.6443158", "0.6441796", "0.6440612", "0.6426401", "0.6426167", "0.6420589", "0.6420203", "0.64107126", "0.640735", "0.64055383", "0.64041966", "0.64041966", "0.640255", "0.64003253", "0.6398255", "0.63950735", "0.63948596", "0.6390099", "0.63886833", "0.6388639", "0.63872766", "0.63848454", "0.63795376", "0.63765824", "0.6374695", "0.63710535", "0.63709044", "0.6355768", "0.635333", "0.6349798", "0.6348999", "0.6348898", "0.6346629", "0.63443816", "0.63393617", "0.6337803", "0.63371", "0.63327044", "0.6329343", "0.63273495", "0.63181245", "0.63099647", "0.6307914", "0.63062596", "0.63054556", "0.6303958", "0.63029736", "0.63011014", "0.6300627", "0.62967086", "0.6294211", "0.6294211", "0.6294101", "0.6293921", "0.62931734", "0.6293016", "0.6292988", "0.6281845", "0.6281453", "0.62792677", "0.62756073", "0.62756073", "0.627415", "0.62727475", "0.62663805", "0.6262667", "0.6259911", "0.6256166", "0.6250826", "0.62488055", "0.6248714", "0.62483174", "0.62442887", "0.6243473", "0.6235302", "0.6231817", "0.6226391" ]
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_spent @spent = Spent.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "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", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "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", "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", "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", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "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", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "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", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "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", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "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", "def determine_valid_action\n\n end", "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", "def startcompany(action)\n @done = true\n action.setup\n end", "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", "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", "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", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "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", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "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", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "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", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "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", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "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", "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", "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", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "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", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "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", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "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" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1